#HTXC-1# 初始化开发环境
parent
56082f3d05
commit
d52ddcb683
@ -0,0 +1,9 @@
|
||||
package com.api.htsc.aqsc.web;
|
||||
|
||||
import com.engine.htsc.aqsc.web.AqscAcion;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/htsc/aqsc")
|
||||
public class AqscActionApi extends AqscAcion {
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.api.htsc.branchpayment;
|
||||
|
||||
import com.engine.htsc.branchpayment.web.BranchGeneralPaymentAction;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path(value="/branch/general/payment")
|
||||
public class BranchGeneralPaymentActionApi extends BranchGeneralPaymentAction {
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.api.htsc.workflow;
|
||||
|
||||
import com.engine.htsc.workflow.web.AssignProcessorAction;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by K1810006 on 2020/9/23.
|
||||
*/
|
||||
|
||||
@Path("/htsc/workflow/processor")
|
||||
public class AssignProcessorActionApi extends AssignProcessorAction{
|
||||
public static void main(String[] args){
|
||||
System.out.println("-------------------"+ UUID.randomUUID());
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.engine.htsc.ReimbursementFlow.tool;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
public class Apireturn {
|
||||
|
||||
public static String returnmes(int Code, String message, JSONArray jsonArray){
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("Code",Code);
|
||||
jsonObject.put("data",jsonArray);
|
||||
jsonObject.put("message",message);
|
||||
return jsonObject.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.engine.htsc.aqsc.service;
|
||||
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface AqscService {
|
||||
|
||||
/***
|
||||
*
|
||||
* @param user
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> doGetDate(User user, Map<String, Object> params);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.engine.htsc.aqsc.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.htsc.aqsc.cmd.AqscDateCmd;
|
||||
import com.engine.htsc.aqsc.service.AqscService;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AqscServiceImpl extends Service implements AqscService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> doGetDate(User user, Map<String, Object> params) {
|
||||
return commandExecutor.execute(new AqscDateCmd(user,params));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.engine.htsc.aqsc.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htsc.aqsc.service.AqscService;
|
||||
import com.engine.htsc.aqsc.service.impl.AqscServiceImpl;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AqscAcion {
|
||||
|
||||
|
||||
public AqscService getService(HttpServletRequest request, HttpServletResponse response){
|
||||
return (AqscService) ServiceUtil.getService(AqscServiceImpl.class);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/doGetDate")
|
||||
@Produces({MediaType.TEXT_PLAIN})
|
||||
public String doGetDate(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||
Map<String,Object> apidatas = new HashMap<String,Object>();
|
||||
try {
|
||||
User user = HrmUserVarify.getUser( request, response );
|
||||
Map<String,Object> param = ParamUtil.request2Map(request);
|
||||
apidatas.putAll(this.getService(request,response).doGetDate(user,param));
|
||||
apidatas.put("api_status", true);
|
||||
apidatas.put("api_errormsg", "");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
apidatas.put("api_status", false);
|
||||
apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
|
||||
}
|
||||
return JSONObject.toJSONString(apidatas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.engine.htsc.branch.approvalChain.model;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
public class BranchLinkReq {
|
||||
private String unnumber="";
|
||||
private String unnumbercode="";
|
||||
private JSONArray value;
|
||||
|
||||
public String getUnnumber() {
|
||||
return unnumber;
|
||||
}
|
||||
|
||||
public void setUnnumber(String unnumber) {
|
||||
this.unnumber = unnumber;
|
||||
}
|
||||
|
||||
public String getUnnumbercode() {
|
||||
return unnumbercode;
|
||||
}
|
||||
|
||||
public void setUnnumbercode(String unnumbercode) {
|
||||
this.unnumbercode = unnumbercode;
|
||||
}
|
||||
|
||||
public JSONArray getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(JSONArray value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.engine.htsc.branchpayment.enums;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* k1810012
|
||||
* 分支机构付款类型
|
||||
*/
|
||||
public enum BranchPay {
|
||||
|
||||
GE_PAY("0", "fzjgtyfk", "htfk",
|
||||
"com.engine.htsc.payment.service.impl.HeadPaymentBudgetCommand"), //通用付款
|
||||
GE_REI("1", "fzjgtybx", "htpt",
|
||||
"com.engine.htsc.payment.service.impl.HeadBxBudgetCommand"), //通用报销
|
||||
TRA_REI("2", "fzjgclbx", "htcl",
|
||||
"com.engine.htsc.payment.service.impl.HeadClBxBudgetCommand"), //差旅报销
|
||||
SETTLE_PAY("3", "fzjgsljsfk", "htfk",
|
||||
"com.engine.htsc.payment.service.impl.HeadPaymentBudgetCommand"), //商旅结算
|
||||
CGSC_TRAVEL("4", "cgscfk", "htfk",
|
||||
"com.engine.htsc.payment.service.impl.SettlePaymentCommand"); //采购商城付款
|
||||
|
||||
BranchPay(String type, String value, String lb, String commandClassName) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
this.lb = lb;
|
||||
this.commandClassName = commandClassName;
|
||||
}
|
||||
|
||||
private final String type;
|
||||
private final String value;
|
||||
private final String lb;
|
||||
private final String commandClassName;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getLb() {
|
||||
return lb;
|
||||
}
|
||||
|
||||
public String getCommandClassName() {
|
||||
return commandClassName;
|
||||
}
|
||||
|
||||
public static String getUnNumberByType(String type) {
|
||||
if (StringUtils.isBlank(type)) {
|
||||
return "";
|
||||
}
|
||||
String unNumber = "";
|
||||
for (BranchPay value : BranchPay.values()) {
|
||||
if (value.type.equalsIgnoreCase(type)) {
|
||||
unNumber = value.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return unNumber;
|
||||
}
|
||||
|
||||
public static String getClassByType(String type) {
|
||||
if (StringUtils.isBlank(type)) {
|
||||
return "";
|
||||
}
|
||||
String className = "";
|
||||
for (BranchPay value : BranchPay.values()) {
|
||||
if (value.type.equalsIgnoreCase(type)) {
|
||||
className = value.commandClassName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return className;
|
||||
}
|
||||
|
||||
public static String getLbByType(String type) {
|
||||
if (StringUtils.isBlank(type)) {
|
||||
return "";
|
||||
}
|
||||
String lb = "";
|
||||
for (BranchPay value : BranchPay.values()) {
|
||||
if (value.type.equalsIgnoreCase(type)) {
|
||||
lb = value.lb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lb;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.engine.htsc.branchpayment.service.impl;
|
||||
|
||||
import com.engine.htsc.branchpayment.enums.BranchPay;
|
||||
import com.engine.htsc.payment.service.BudgetCommand;
|
||||
import com.engine.htsc.subpayment.enums.SubPay;
|
||||
|
||||
/**
|
||||
* 动态获取预算command
|
||||
*/
|
||||
public class BranchBudgetCommandFactory {
|
||||
|
||||
private BranchBudgetCommandFactory() {
|
||||
}
|
||||
|
||||
// 分支
|
||||
public static BudgetCommand getBudgetCommand(String type) {
|
||||
try {
|
||||
return (BudgetCommand) Class.forName(BranchPay.getClassByType(type)).newInstance();
|
||||
} catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 子公司
|
||||
public static BudgetCommand getBudgetCommand4Sub(String type) {
|
||||
try {
|
||||
return (BudgetCommand) Class.forName(SubPay.getClassByType(type)).newInstance();
|
||||
} catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.engine.htsc.branchpayment.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.engine.htsc.branchpayment.enums.BranchPay;
|
||||
import com.engine.htsc.branchpayment.utils.BranchBizUtil;
|
||||
import com.engine.htsc.payment.pojo.CostAccountDto;
|
||||
import com.engine.htsc.payment.service.impl.SettlePaymentCommand;
|
||||
import com.engine.htsc.payment.util.BizUtils;
|
||||
import com.engine.htsc.subpayment.enums.SubPay;
|
||||
import com.engine.htsc.subpayment.utils.SubBizUtil;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* 创建核算明细
|
||||
*/
|
||||
public class BranchCostDTOFactory {
|
||||
|
||||
private BranchCostDTOFactory() {
|
||||
}
|
||||
|
||||
// 分支
|
||||
public static CostAccountDto getCostDTOByType(String requestId, String lx) throws Exception {
|
||||
Assert.notBlank(requestId, "未指定流程id");
|
||||
Assert.notBlank(lx, "未指定类型");
|
||||
BizUtils bu = new BizUtils();
|
||||
BranchBizUtil bizUtil = new BranchBizUtil();
|
||||
SettlePaymentCommand settlePaymentCommand = new SettlePaymentCommand();
|
||||
|
||||
if (BranchPay.GE_PAY.getType().equalsIgnoreCase(lx)
|
||||
|| BranchPay.SETTLE_PAY.getType().equalsIgnoreCase(lx)) {
|
||||
return bizUtil.generateCommonPayData(requestId, BranchPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
if (BranchPay.GE_REI.getType().equalsIgnoreCase(lx)) {
|
||||
return bu.generateCommonReimbData(requestId, BranchPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
if (BranchPay.TRA_REI.getType().equalsIgnoreCase(lx)) {
|
||||
return bizUtil.generateTravelReimbData(requestId, BranchPay.getLbByType(lx));
|
||||
}
|
||||
if (BranchPay.CGSC_TRAVEL.getType().equalsIgnoreCase(lx)) {
|
||||
return settlePaymentCommand.generateCommonReimbData(requestId, BranchPay.getLbByType(lx));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 子公司
|
||||
public static CostAccountDto getCostDTOByType4Sub(String requestId, String lx) throws Exception {
|
||||
Assert.notBlank(requestId, "未指定流程id");
|
||||
Assert.notBlank(lx, "未指定类型");
|
||||
SubBizUtil subBizUtil = new SubBizUtil();
|
||||
BizUtils bizUtils = new BizUtils();
|
||||
|
||||
if (SubPay.ZJ_REI.getType().equalsIgnoreCase(lx)) {
|
||||
return bizUtils.ZjCommonReimbData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
if (SubPay.ZG_REI.getType().equalsIgnoreCase(lx)) {
|
||||
return subBizUtil.generateCommonReimbData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
if (SubPay.ZGS_REI.getType().equalsIgnoreCase(lx)) {
|
||||
return subBizUtil.generateCommonReimbData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
if (SubPay.ZG_TRAVEL.getType().equalsIgnoreCase(lx)) {
|
||||
return subBizUtil.generateTravelReimbData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
if (SubPay.ZGTY_PAY.getType().equalsIgnoreCase(lx)) {
|
||||
return bizUtils.generateCommonPayData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
if (SubPay.ZJTY_PAY.getType().equalsIgnoreCase(lx)) {
|
||||
return bizUtils.generateCommonPayData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
if (SubPay.ZGS_TRAVEL.getType().equalsIgnoreCase(lx)) {
|
||||
return subBizUtil.generateTravelReimbData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
if (SubPay.ZJ_TRAVEL.getType().equalsIgnoreCase(lx)) {
|
||||
return subBizUtil.generateTravelReimbData(requestId, SubPay.getLbByType(lx));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CostAccountDto getSettlePaymentCostDTO(String requestId, String lx) throws Exception {
|
||||
Assert.notBlank(requestId, "未指定流程id");
|
||||
Assert.notBlank(lx, "未指定类型");
|
||||
SettlePaymentCommand settlePaymentCommand = new SettlePaymentCommand();
|
||||
if (BranchPay.CGSC_TRAVEL.getType().equalsIgnoreCase(lx)) {
|
||||
return settlePaymentCommand.generateCommonReimbData(requestId, BranchPay.getLbByType(lx));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package com.engine.htsc.branchpayment.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.htsc.branchpayment.service.BranchPaymentService;
|
||||
import com.engine.htsc.branchpayment.service.impl.BranchPaymentServiceImpl;
|
||||
import com.engine.htsc.trip.util.AjaxResult;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* k1810012
|
||||
* 分支出纳页面接口
|
||||
* <p>
|
||||
* 预算实占、核算、付款、废弃
|
||||
*/
|
||||
public class BranchGeneralPaymentAction extends BaseBean {
|
||||
|
||||
private BranchPaymentService getBranchPaymentServiceImpl() {
|
||||
return ServiceUtil.getService(BranchPaymentServiceImpl.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预算实占、废弃
|
||||
*
|
||||
* @param request 请求体
|
||||
* @return 消息体
|
||||
*/
|
||||
@POST
|
||||
@Path("/doBudget")
|
||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public AjaxResult<Map<String, String>> doBudget(@Context HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> requestParam = ParamUtil.request2Map(request);
|
||||
String rid = Util.null2String(requestParam.getOrDefault("rid", ""));
|
||||
String discard = Util.null2String(requestParam.getOrDefault("discard", ""));
|
||||
return AjaxResult.ok(getBranchPaymentServiceImpl().doBudgetByBatchId(rid, discard));
|
||||
} catch (Exception e) {
|
||||
writeLog(e.getMessage());
|
||||
return AjaxResult.error(e.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 核算
|
||||
*
|
||||
* @param request 请求体
|
||||
* @return 消息体
|
||||
*/
|
||||
@POST
|
||||
@Path("/doAccount")
|
||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public AjaxResult<Map<String, String>> doAccount(@Context HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> requestParam = ParamUtil.request2Map(request);
|
||||
String id = Util.null2String(requestParam.getOrDefault("id", ""));
|
||||
return AjaxResult.ok(getBranchPaymentServiceImpl().doAccountByBatchId(id));
|
||||
} catch (Exception e) {
|
||||
writeLog(e.getMessage());
|
||||
return AjaxResult.error(e.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 付款
|
||||
*
|
||||
* @param request 请求体
|
||||
* @return 消息体
|
||||
*/
|
||||
@POST
|
||||
@Path("/doPayment")
|
||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public AjaxResult<Map<String, String>> doPayment(@Context HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> requestParam = ParamUtil.request2Map(request);
|
||||
String id = Util.null2String(requestParam.getOrDefault("id", ""));
|
||||
return AjaxResult.ok(getBranchPaymentServiceImpl().doPaymentByBatchId(id));
|
||||
} catch (Exception e) {
|
||||
writeLog(e.getMessage());
|
||||
return AjaxResult.error(e.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动付款
|
||||
*/
|
||||
@POST
|
||||
@Path("/doManualPayment")
|
||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public AjaxResult<String> doManualPayment(@Context HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> requestParam = ParamUtil.request2Map(request);
|
||||
String id = Util.null2String(requestParam.getOrDefault("id", ""));
|
||||
return AjaxResult.ok(getBranchPaymentServiceImpl().updateManualPaymentStatus(id));
|
||||
} catch (Exception e) {
|
||||
writeLog(e.getMessage());
|
||||
return AjaxResult.error(e.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.engine.htsc.doc.common;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行对象的某个方法
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class AsyncThread extends Thread {
|
||||
private static Logger log = LoggerFactory.getLogger(AsyncThread.class);
|
||||
private Object async;
|
||||
private String method;
|
||||
private Object param[];
|
||||
private String key;
|
||||
|
||||
public AsyncThread(Object o,String method,Object[] param){
|
||||
this.async =o;
|
||||
this.method = method;
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long time1 = System.currentTimeMillis();
|
||||
log.info("开始ClassName:"+async.getClass().getName()+"||method:"+method);
|
||||
if(null==async||StringUtils.isEmpty(method)){
|
||||
return;
|
||||
}
|
||||
Object a =async+method;
|
||||
synchronized (a) {
|
||||
try {
|
||||
Method[] methods= async.getClass().getDeclaredMethods();
|
||||
for (Method invokeMethod : methods) {
|
||||
if(invokeMethod.getName().equals(method)){
|
||||
Class<?>[] parameterTypes = invokeMethod.getParameterTypes();
|
||||
if(null!=parameterTypes){
|
||||
log.info("方法:"+method+",参数个数:"+parameterTypes.length);
|
||||
//参数不相等,继续查找
|
||||
if(null==param||param.length!=parameterTypes.length){
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
//参数不相等,继续查找
|
||||
if(null!=param&¶m.length!=0){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
invokeMethod.setAccessible(true);
|
||||
invokeMethod.invoke(async, param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Class c [] = new Class[param.length];
|
||||
// for (int i = 0; i < param.length; i++) {
|
||||
// c[i] = param[i].getClass();
|
||||
// }
|
||||
// Method invokeMethod= async.getClass().getDeclaredMethod(method,c);
|
||||
//
|
||||
// Method[] methods= async.getClass().getDeclaredMethods();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
log.info("结束ClassName:"+async.getClass().getName()+"||method:"+method+"||耗时:"+(System.currentTimeMillis()-time1));
|
||||
if(StringUtils.isNotEmpty(key)){
|
||||
ThreadPoolUtil.hashMap_thread.put(key, "1");
|
||||
}
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,279 @@
|
||||
package com.engine.htsc.doc.util;
|
||||
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
public class BeanUtil {
|
||||
|
||||
/**
|
||||
* 将一个 Map 对象转化为一个 JavaBean
|
||||
* @param type 要转化的类型
|
||||
* @param map 包含属性值的 map
|
||||
* @return 转化出来的 JavaBean 对象
|
||||
* @throws IntrospectionException
|
||||
* 如果分析类属性失败
|
||||
* @throws IllegalAccessException
|
||||
* 如果实例化 JavaBean 失败
|
||||
* @throws InstantiationException
|
||||
* 如果实例化 JavaBean 失败
|
||||
* @throws InvocationTargetException
|
||||
* 如果调用属性的 setter 方法失败
|
||||
*/
|
||||
public static Object convertMap(Class type, Map map)
|
||||
throws IntrospectionException, IllegalAccessException,
|
||||
InstantiationException, InvocationTargetException {
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性
|
||||
Object obj = type.newInstance(); // 创建 JavaBean 对象
|
||||
|
||||
// 给 JavaBean 对象的属性赋值
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||
String propertyName = descriptor.getName();
|
||||
|
||||
if (map.containsKey(propertyName)) {
|
||||
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
|
||||
Object value = map.get(propertyName);
|
||||
|
||||
Object[] args = new Object[1];
|
||||
args[0] = value;
|
||||
|
||||
descriptor.getWriteMethod().invoke(obj, args);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将一个 JavaBean 对象转化为一个 Map
|
||||
* @param bean 要转化的JavaBean 对象
|
||||
* @return 转化出来的 Map 对象
|
||||
* @throws IntrospectionException 如果分析类属性失败
|
||||
* @throws IllegalAccessException 如果实例化 JavaBean 失败
|
||||
* @throws InvocationTargetException 如果调用属性的 setter 方法失败
|
||||
*/
|
||||
public static Map convertBean(Object bean)
|
||||
throws IntrospectionException, IllegalAccessException, InvocationTargetException {
|
||||
Class type = bean.getClass();
|
||||
Map returnMap = new HashMap();
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(type);
|
||||
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||
String propertyName = descriptor.getName();
|
||||
if (!propertyName.equals("class")) {
|
||||
Method readMethod = descriptor.getReadMethod();
|
||||
Object result = readMethod.invoke(bean, new Object[0]);
|
||||
if (result != null) {
|
||||
returnMap.put(propertyName, result);
|
||||
} else {
|
||||
returnMap.put(propertyName, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将长字符串切分成短字符串数组
|
||||
* @param ids 原始字符串 逗号英文分割
|
||||
* @param pernum 每个字符数组大小
|
||||
* @return
|
||||
*/
|
||||
public static List<String> splitByPerNum(String ids, int pernum) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(ids)) {
|
||||
String[] idArray = ids.split(",");
|
||||
result = splitByPerNum(idArray,pernum);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符list按照大小切分成指定的短字符list 逗号分割
|
||||
* @param ids
|
||||
* @param pernum
|
||||
* @return
|
||||
*/
|
||||
public static List<String> splitByPerNum (List<String> ids, int pernum) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if(CollectionUtils.isNotEmpty(ids)) {
|
||||
String[] idArray = ids.toArray(new String[ids.size()]);
|
||||
result = splitByPerNum(idArray,pernum);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将长字符串切分成短字符串数组
|
||||
* @param ids
|
||||
* @param pernum
|
||||
* @return
|
||||
*/
|
||||
public static List<String> splitByPerNum(String[] ids, int pernum) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if(null!=ids&&ids.length>0) {
|
||||
int countPer = 0;
|
||||
int countAll = 0;
|
||||
String tempIds = "";
|
||||
for(String id : ids) {
|
||||
tempIds = tempIds+id+",";
|
||||
countPer ++;
|
||||
if(countPer<pernum&&countAll+1<ids.length) {
|
||||
|
||||
}else {
|
||||
tempIds = tempIds.substring(0,tempIds.length()-1);
|
||||
result.add(tempIds);
|
||||
countPer = 0;
|
||||
tempIds = "";
|
||||
}
|
||||
countAll++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除集合中重复元素 顺序安全
|
||||
* @param list
|
||||
*/
|
||||
public static void removeDuplicateWithOrder(List list) {
|
||||
Set set = new HashSet();
|
||||
List newList = new ArrayList();
|
||||
for (Iterator iter = list.iterator(); iter.hasNext();) {
|
||||
Object element = iter.next();
|
||||
if (set.add(element))
|
||||
newList.add(element);
|
||||
}
|
||||
list.clear();
|
||||
list.addAll(newList);
|
||||
System.out.println( " remove duplicate " + list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将逗号分割的字符串转List
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static List<String> convertStrToList(String str) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(str)) {
|
||||
String[] idArray = str.split(",");
|
||||
result = Arrays.asList(idArray);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* List拆分
|
||||
* @param list
|
||||
* @param len
|
||||
* @return
|
||||
*/
|
||||
public static List<List<String>> splitList(List<String> list, int len) {
|
||||
if (list == null || list.size() == 0 || len < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<List<String>> result = new ArrayList<List<String>>();
|
||||
|
||||
int size = list.size();
|
||||
int count = (size + len - 1) / len;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
List<String> subList = list.subList(i * len, ((i + 1) * len > size ? size : len * (i + 1)));
|
||||
result.add(subList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个id 是否在ids字符串里面
|
||||
* @param id
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
public static boolean isInIds(String id,String ids) {
|
||||
boolean flag = false;
|
||||
if(StringUtils.isNotEmpty(id)&&StringUtils.isNotEmpty(ids)) {
|
||||
List<String> idsList = Arrays.asList(ids.split(","));
|
||||
if(idsList.contains(id)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 泛微id比较 返回 A集合和B集合的交集
|
||||
* @param idsA
|
||||
* @param idsB
|
||||
* @return
|
||||
*/
|
||||
public static String commonLeftAndRight(String idsA, String idsB) {
|
||||
String result = "";
|
||||
List<String> AList = StringUtils.isNotEmpty(idsA)? Arrays.asList(idsA.split(",")):new ArrayList<>();
|
||||
List<String> BList = StringUtils.isNotEmpty(idsB)? Arrays.asList(idsB.split(",")):new ArrayList<>();
|
||||
if(AList.size()==0||BList.size()==0) {
|
||||
return result;
|
||||
}
|
||||
for(String str : AList) {
|
||||
if(BList.contains(str)) {
|
||||
result = result+str+",";
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(result)) {
|
||||
result = result.substring(0,result.length()-1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
String sql = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
|
||||
List<String> result = splitByPerNum(sql,1);
|
||||
List<String> result2 = splitByPerNum(sql,2);
|
||||
List<String> result3 = splitByPerNum(sql,24);
|
||||
List<String> result4 = splitByPerNum(sql,26);
|
||||
List<String> result5 = splitByPerNum(sql,100);
|
||||
|
||||
|
||||
List<String> tempList = new ArrayList<>();
|
||||
for(int i =0;i<=2000;i++) {
|
||||
tempList.add(String.valueOf(i));
|
||||
}
|
||||
|
||||
List<String> result6 = splitByPerNum(tempList,999);
|
||||
|
||||
|
||||
String id = "1,2";
|
||||
String ids1 = "12";
|
||||
String ids2 = "2,369,";
|
||||
String ids3 = "3,11,22";
|
||||
String ids4 = "1";
|
||||
String ids5 = "45,11,113,1";
|
||||
|
||||
System.out.println(commonLeftAndRight(id,ids1));
|
||||
System.out.println(commonLeftAndRight(id,ids2));
|
||||
System.out.println(commonLeftAndRight(id,ids3));
|
||||
System.out.println(commonLeftAndRight(id,ids4));
|
||||
System.out.println(commonLeftAndRight(id,ids5));
|
||||
|
||||
System.out.println("???");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,342 @@
|
||||
package com.engine.htsc.financialadjustment.util;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.engine.htsc.payment.pojo.*;
|
||||
import com.engine.htsc.payment.util.PayUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.interfaces.htsc.cus.HTUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* utils for financial adjust work flow
|
||||
*/
|
||||
public final class BizUtil {
|
||||
|
||||
//联合,总部预算表和会计表
|
||||
private static final String LH_YSB = "uf_lhkmpz";
|
||||
private static final String LH_KJB = "uf_lhkjkmpz";
|
||||
private static final String ZB_YSB = "uf_kmpz";
|
||||
private static final String ZB_KJB = "uf_kjkmpz";
|
||||
|
||||
/**
|
||||
* 获取财务调整流程核算数据p
|
||||
*
|
||||
* @return CostAccountDto
|
||||
*/
|
||||
public static CostAccountDto getAdjustCost(String rid, String lb) throws Exception {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.writeLog("获取财务调整流程核算数据 requestid:" + rid);
|
||||
String tablename = PayUtil.getTbNameByRid(rid);
|
||||
CostAccountDto accountDto = new CostAccountDto();
|
||||
try {
|
||||
DepartmentComInfo dc = new DepartmentComInfo();
|
||||
ResourceComInfo rc = new ResourceComInfo();
|
||||
String sql = "SELECT t1.ID,t1.NGR,t1.SZBM,t1.LCBH,t1.RZRQ,t2.REQUESTNAME FROM " + tablename + " t1\n" +
|
||||
"LEFT JOIN WORKFLOW_REQUESTBASE t2\n" +
|
||||
"ON t1.REQUESTID = t2.REQUESTID \n" +
|
||||
"WHERE t1.REQUESTID = ?";
|
||||
rs.executeQuery(sql, rid);
|
||||
String mid = "";
|
||||
if (rs.next()) {
|
||||
String person = Util.null2String(rs.getString("NGR"));
|
||||
String dept = Util.null2String(rs.getString("SZBM"));
|
||||
String requestMark = Util.null2String(rs.getString("LCBH"));
|
||||
String title = Util.null2String(rs.getString("REQUESTNAME"));
|
||||
String entryDate = Util.null2String(rs.getString("RZRQ"));
|
||||
mid = Util.null2String(rs.getString("ID"));
|
||||
|
||||
accountDto.setElectronicBill("");
|
||||
accountDto.setType(lb); //总部付款费用核算
|
||||
accountDto.setBz2("0");
|
||||
accountDto.setNgrDept(dc.getDepartmentmark(dept));
|
||||
accountDto.setNgrDeptCode(dc.getDepartmentCode(dept));
|
||||
accountDto.setNgrName(rc.getWorkcode(person));
|
||||
accountDto.setRequestMark(requestMark);
|
||||
accountDto.setRequestId(requestMark); //djid传流程编码,流程id总部不需要
|
||||
accountDto.setAttachmentNum("");
|
||||
accountDto.setLocationName("");
|
||||
accountDto.setTitle(title);
|
||||
accountDto.setCurrency("RMB");
|
||||
accountDto.setCreateDate(entryDate);
|
||||
accountDto.setReimbursementWay("");
|
||||
accountDto.setPayOrderNo(requestMark); //总部付款付款单号直接传流程编码
|
||||
}
|
||||
|
||||
sql = "SELECT SFRHJZ,FYCDR,FYCDBM,JE,SFCYS,JDFX,YSKM,HJKM FROM " + tablename + "_DT2 WHERE MAINID = ?";
|
||||
rs.executeQuery(sql, mid);
|
||||
List<KjDetail> kjs = new ArrayList<>();
|
||||
List<PayDetail> pays = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
String entryKj = Util.null2String(rs.getString("SFRHJZ"));
|
||||
String debtPerson = Util.null2String(rs.getString("FYCDR"));
|
||||
String debtDept = Util.null2String(rs.getString("FYCDBM"));
|
||||
String amount = Util.null2String(rs.getString("JE"));
|
||||
String overBudget = Util.null2String(rs.getString("SFCYS"));
|
||||
String doc = Util.null2String(rs.getString("JDFX")); //计帐方向
|
||||
String budgetItem = nvl(Util.null2String(rs.getString("YSKM")));
|
||||
String accountItem = nvl(Util.null2String(rs.getString("HJKM")));
|
||||
//入会计帐为是才写记录
|
||||
if ("1".equals(entryKj)) {
|
||||
KjDetail kj = new KjDetail();
|
||||
BudgetData budgetData = new BudgetData();
|
||||
budgetData.setRelationCode(accountItem);
|
||||
budgetData.setItemCode(budgetItem);
|
||||
budgetData.setItemName(getYsName(budgetItem, "1"));
|
||||
SubjectData subjectData = new SubjectData();
|
||||
subjectData.setItemCode(accountItem);
|
||||
subjectData.setItemName(getKjName(accountItem, "1"));
|
||||
kj.setBudgetData(budgetData); //预算科目
|
||||
kj.setSubjectData(subjectData); //会计科目
|
||||
kj.setExpenseDeptCode(dc.getDepartmentCode(debtDept));
|
||||
kj.setExpenseDept(dc.getDepartmentmark(debtDept));
|
||||
kj.setExpenseBadge("");
|
||||
kj.setExpensePerson(rc.getLastname(debtPerson));
|
||||
kj.setPriceRMB(amount);
|
||||
kj.setMoney(amount);
|
||||
kj.setProjectCode("");
|
||||
kj.setProject("");
|
||||
kj.setReason(doc); // 0:借 1:贷 对应saveFj 1:借 2:贷 (财务调整不使用reason作为关键字段,设置为借贷方做业务判断)
|
||||
kjs.add(kj);
|
||||
|
||||
}
|
||||
}
|
||||
accountDto.setKjDetails(kjs);
|
||||
accountDto.setPayDetails(pays);
|
||||
} catch (Exception e) {
|
||||
rs.writeLog("catch exception:" + e.getMessage());
|
||||
}
|
||||
return accountDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取财务调整核预算数据
|
||||
*
|
||||
* @param status 预算状态, 3预占,1实占
|
||||
* @return budgetDTO
|
||||
*/
|
||||
public static BudgetDTO getAdjustBudget(String rid, String status) throws Exception {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.writeLog("获取财务调整核预算数据 requestid:" + rid + "; status:" + status);
|
||||
BudgetDTO budgetDTO = new BudgetDTO();
|
||||
String tbNameByRid = PayUtil.getTbNameByRid(rid);
|
||||
String mid = "";
|
||||
try {
|
||||
ResourceComInfo rc = new ResourceComInfo();
|
||||
String sql = String.format("SELECT t1.ID,t1.REQUESTID,t1.LCBH,t1.NGR,t1.RZRQ,t2.REQUESTNAME,t2.REQUESTMARK FROM %s t1\n" +
|
||||
"LEFT JOIN WORKFLOW_REQUESTBASE t2\n" +
|
||||
"ON t1.REQUESTID = t2.REQUESTID \n" +
|
||||
"WHERE t1.REQUESTID = ?", tbNameByRid);
|
||||
rs.executeQuery(sql, rid);
|
||||
if (rs.next()) {
|
||||
budgetDTO.setBillNum(Util.null2String(rs.getString("REQUESTID")));
|
||||
budgetDTO.setBizDate(Util.null2String(rs.getString("RZRQ")));
|
||||
budgetDTO.setBillStatus(status);
|
||||
budgetDTO.setBillName(Util.null2String(rs.getString("LCBH")));
|
||||
budgetDTO.setBillTitle(Util.null2String(rs.getString("REQUESTNAME")));
|
||||
budgetDTO.setPesonName(rc.getLastname(rs.getString("NGR")));
|
||||
mid = Util.null2String(rs.getString("ID")); //明细外键
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rs.writeLog("获取财务调整预算主表数据 catch exception:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
DepartmentComInfo dc = new DepartmentComInfo();
|
||||
List<BudgetList> budgetItems = new ArrayList<>();
|
||||
String sql = String.format("SELECT SFRHJZ,FYCDR,FYCDBM,JE,SFCYS,JDFX,YSKM,HJKM FROM %s WHERE MAINID = ?", tbNameByRid + "_DT2");
|
||||
rs.executeQuery(sql, mid);
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
int i = 1;
|
||||
while (rs.next()) {
|
||||
String debtDept = Util.null2String(rs.getString("FYCDBM"));
|
||||
String amount = Util.null2String(rs.getString("JE"));
|
||||
String budgetCode = Util.null2String(rs.getString("YSKM"));
|
||||
String superBudgetCodeLh = "";
|
||||
if (budgetDTO.getBillName().contains("联合")) {
|
||||
superBudgetCodeLh = PayUtil.getSuperBudgetCode(nvl(budgetCode));
|
||||
} else {
|
||||
superBudgetCodeLh = PayUtil.getSuperBudgetCodeLh(nvl(budgetCode));
|
||||
}
|
||||
BudgetList budgetList = new BudgetList();
|
||||
budgetList.setAmount(amount);
|
||||
budgetList.setNoTaxAmount(amount);
|
||||
budgetList.setTaxAmount("0.00");
|
||||
budgetList.setBgElement("0101");
|
||||
budgetList.setBillEntryID(uuid + "#" + i);
|
||||
budgetList.setDeptNum(dc.getDepartmentCode(debtDept));
|
||||
budgetList.setItemEntryNum(nvl(budgetCode));
|
||||
budgetList.setBgItem(superBudgetCodeLh);
|
||||
budgetList.setBgITElement(superBudgetCodeLh);
|
||||
budgetItems.add(budgetList);
|
||||
i++;
|
||||
}
|
||||
budgetDTO.setList(budgetItems);
|
||||
return budgetDTO;
|
||||
} catch (Exception e) {
|
||||
rs.writeLog("获取财务调整明细表数据 catch exception:" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get project browser by code
|
||||
*/
|
||||
public static Map<String, String> getProjectBrowserByCode(String userCode, String projectCode) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
HTUtil htUtil = new HTUtil();
|
||||
Map<String, Object> info = htUtil.getProjectInfoByCode(userCode, projectCode);
|
||||
if (info.containsKey("id")) {
|
||||
res.put("value", Util.null2String(info.get("id")));
|
||||
res.put("name", Util.null2String(info.get("name")));
|
||||
} else {
|
||||
res.put("value", "");
|
||||
res.put("name", "");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* get dept id by dept code
|
||||
*/
|
||||
public static Map<String, String> getDidByCode(String deptCode) throws Exception {
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, String> res = new HashMap<>();
|
||||
rs.executeQuery("SELECT h.ID,h.DEPARTMENTMARK FROM HRMDEPARTMENT h WHERE h.DEPARTMENTCODE = ?", deptCode);
|
||||
if (rs.next()) {
|
||||
res.put("value", Util.null2String(rs.getString("ID")));
|
||||
res.put("name", Util.null2String(rs.getString("DEPARTMENTMARK")));
|
||||
return res;
|
||||
} else {
|
||||
throw new IllegalArgumentException("deptCode not exist, deptCode: " + deptCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get employee id by work code
|
||||
*/
|
||||
public static Map<String, String> getUidByWc(String wc) throws Exception {
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, String> res = new HashMap<>();
|
||||
rs.executeQuery("SELECT h.ID,h.LASTNAME FROM HRMRESOURCE h WHERE h.WORKCODE =?", wc);
|
||||
if (rs.next()) {
|
||||
res.put("value", Util.null2String(rs.getString("ID")));
|
||||
res.put("name", Util.null2String(rs.getString("LASTNAME")));
|
||||
return res;
|
||||
} else {
|
||||
throw new IllegalArgumentException("workcode not exist, workcode: " + wc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get budget jsonObject by code and type
|
||||
*
|
||||
* @param budgetCode 预算code
|
||||
* @param type 0:总部 1:联合
|
||||
*/
|
||||
public static Map<String, String> getBudgetObj(String budgetCode, String type) throws Exception {
|
||||
Assert.notBlank(budgetCode, "budgetCode can not be empty");
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, String> res = new HashMap<>();
|
||||
String budgetTable = "";
|
||||
if ("0".equals(type)) {
|
||||
budgetTable = ZB_YSB;
|
||||
} else if ("1".equals(type)) {
|
||||
budgetTable = LH_YSB;
|
||||
} else {
|
||||
throw new IllegalArgumentException("type not match: 0:总部 1:联合");
|
||||
}
|
||||
rs.writeLog(String.format("get budget specialObj ,budgetCode: %s; zb or lh: %s; budgetTable: %s",
|
||||
budgetCode, type, budgetTable));
|
||||
rs.executeQuery(String.format("SELECT YSKMMC FROM %s WHERE YSKMBM = ? ", budgetTable), budgetCode);
|
||||
if (rs.next()) {
|
||||
res.put("value", budgetCode);
|
||||
res.put("name", Util.null2String(rs.getString("YSKMMC")));
|
||||
return res;
|
||||
} else {
|
||||
throw new Exception("budget code " + budgetCode + " not exist");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get account jsonObject by code and type
|
||||
*/
|
||||
public static Map<String, String> getAccountObj(String accountCode, String type) throws Exception {
|
||||
Assert.notBlank(accountCode, "accountCode can not be empty");
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, String> res = new HashMap<>();
|
||||
String accountTable = "";
|
||||
if ("0".equals(type)) {
|
||||
accountTable = ZB_KJB;
|
||||
} else if ("1".equals(type)) {
|
||||
accountTable = LH_KJB;
|
||||
} else {
|
||||
throw new IllegalArgumentException("type not match: 0:总部 1:联合");
|
||||
}
|
||||
rs.writeLog(String.format("get account specialObj ,accountCode: %s; zb or lh: %s; accountTable: %s",
|
||||
accountCode, type, accountTable));
|
||||
rs.executeQuery(String.format("SELECT HJKMMC FROM %s WHERE HJKMBM = ? ", accountTable), accountCode);
|
||||
if (rs.next()) {
|
||||
res.put("value", accountCode);
|
||||
res.put("name", Util.null2String(rs.getString("HJKMMC")));
|
||||
return res;
|
||||
} else {
|
||||
throw new Exception("account code " + accountCode + " not exist");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 科目截断
|
||||
*
|
||||
* @return 预算科目或会计科目
|
||||
*/
|
||||
private static String nvl(String codeWithLine) {
|
||||
if (codeWithLine.contains("_")) {
|
||||
return codeWithLine.split("_")[1];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预算名称
|
||||
*
|
||||
* @param ysCode 预算code
|
||||
* @param lhOrZb 1代表联合
|
||||
* @return 名称
|
||||
*/
|
||||
public static String getYsName(String ysCode, String lhOrZb) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String tableName = ZB_YSB;
|
||||
if ("1".equals(lhOrZb)) {
|
||||
tableName = LH_YSB;
|
||||
}
|
||||
rs.executeQuery("SELECT YSKMMC FROM " + tableName + " WHERE YSKMBM = ?", ysCode);
|
||||
if (rs.next()) {
|
||||
return Util.null2String(rs.getString("YSKMMC"));
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getKjName(String ysCode, String lhOrZb) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String tableName = ZB_KJB;
|
||||
if ("1".equals(lhOrZb)) {
|
||||
tableName = LH_KJB;
|
||||
}
|
||||
rs.executeQuery("SELECT HJKMMC FROM " + tableName + " WHERE HJKMBM = ?", ysCode);
|
||||
if (rs.next()) {
|
||||
return Util.null2String(rs.getString("HJKMMC"));
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package com.engine.htsc.payment.pojo;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AutoRequestParam {
|
||||
private String relateStaffRid;
|
||||
private String creatorUid;
|
||||
private String workflowId;
|
||||
private String requestName;
|
||||
private String isNextFlow;
|
||||
Map<String, String> main;
|
||||
List<Map<String, String>> dt5;
|
||||
List<Map<String, String>> dt6;
|
||||
List<Map<String, String>> dt7;
|
||||
List<LinkedHashMap<String, String>> dt8;
|
||||
List<LinkedHashMap<String, String>> dt13;
|
||||
|
||||
public String getRelateStaffRid() {
|
||||
return relateStaffRid;
|
||||
}
|
||||
|
||||
public void setRelateStaffRid(String relateStaffRid) {
|
||||
this.relateStaffRid = relateStaffRid;
|
||||
}
|
||||
|
||||
public String getCreatorUid() {
|
||||
return creatorUid;
|
||||
}
|
||||
|
||||
public void setCreatorUid(String creatorUid) {
|
||||
this.creatorUid = creatorUid;
|
||||
}
|
||||
|
||||
public String getWorkflowId() {
|
||||
return workflowId;
|
||||
}
|
||||
|
||||
public void setWorkflowId(String workflowId) {
|
||||
this.workflowId = workflowId;
|
||||
}
|
||||
|
||||
public String getRequestName() {
|
||||
return requestName;
|
||||
}
|
||||
|
||||
public void setRequestName(String requestName) {
|
||||
this.requestName = requestName;
|
||||
}
|
||||
|
||||
public String getIsNextFlow() {
|
||||
return isNextFlow;
|
||||
}
|
||||
|
||||
public void setIsNextFlow(String isNextFlow) {
|
||||
this.isNextFlow = isNextFlow;
|
||||
}
|
||||
|
||||
public Map<String, String> getMain() {
|
||||
return main;
|
||||
}
|
||||
|
||||
public void setMain(Map<String, String> main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getDt5() {
|
||||
return dt5;
|
||||
}
|
||||
|
||||
public void setDt5(List<Map<String, String>> dt5) {
|
||||
this.dt5 = dt5;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getDt6() {
|
||||
return dt6;
|
||||
}
|
||||
|
||||
public void setDt6(List<Map<String, String>> dt6) {
|
||||
this.dt6 = dt6;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getDt7() {
|
||||
return dt7;
|
||||
}
|
||||
|
||||
public void setDt7(List<Map<String, String>> dt7) {
|
||||
this.dt7 = dt7;
|
||||
}
|
||||
|
||||
public List<LinkedHashMap<String, String>> getDt8() {
|
||||
return dt8;
|
||||
}
|
||||
|
||||
public void setDt8(List<LinkedHashMap<String, String>> dt8) {
|
||||
this.dt8 = dt8;
|
||||
}
|
||||
|
||||
public List<LinkedHashMap<String, String>> getDt13() {
|
||||
return dt13;
|
||||
}
|
||||
|
||||
public void setDt13(List<LinkedHashMap<String, String>> dt13) {
|
||||
this.dt13 = dt13;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutoRequestParam{" +
|
||||
"relateStaffRid='" + relateStaffRid + '\'' +
|
||||
", creatorUid='" + creatorUid + '\'' +
|
||||
", workflowId='" + workflowId + '\'' +
|
||||
", requestName='" + requestName + '\'' +
|
||||
", isNextFlow='" + isNextFlow + '\'' +
|
||||
", main=" + main +
|
||||
", dt5=" + dt5 +
|
||||
", dt6=" + dt6 +
|
||||
", dt7=" + dt7 +
|
||||
", dt8=" + dt8 +
|
||||
", dt13=" + dt13 +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* 任一为空返回false
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return StringUtils.isNotBlank(creatorUid) && StringUtils.isNotBlank(workflowId)
|
||||
&& StringUtils.isNotBlank(requestName) && StringUtils.isNotBlank(isNextFlow);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.engine.htsc.payment.pojo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BankFormation {
|
||||
private String oaPayUrl;
|
||||
private String bankName;
|
||||
private String bankAccount;
|
||||
private String bankFirm;
|
||||
private List<String> opParty;
|
||||
|
||||
public String getOaPayUrl() {
|
||||
return oaPayUrl;
|
||||
}
|
||||
|
||||
public void setOaPayUrl(String oaPayUrl) {
|
||||
this.oaPayUrl = oaPayUrl;
|
||||
}
|
||||
|
||||
public String getBankName() {
|
||||
return bankName;
|
||||
}
|
||||
|
||||
public void setBankName(String bankName) {
|
||||
this.bankName = bankName;
|
||||
}
|
||||
|
||||
public String getBankAccount() {
|
||||
return bankAccount;
|
||||
}
|
||||
|
||||
public void setBankAccount(String bankAccount) {
|
||||
this.bankAccount = bankAccount;
|
||||
}
|
||||
|
||||
public String getBankFirm() {
|
||||
return bankFirm;
|
||||
}
|
||||
|
||||
public void setBankFirm(String bankFirm) {
|
||||
this.bankFirm = bankFirm;
|
||||
}
|
||||
|
||||
public List<String> getOpParty() {
|
||||
return opParty;
|
||||
}
|
||||
|
||||
public void setOpParty(List<String> opParty) {
|
||||
this.opParty = opParty;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.engine.htsc.payment.util;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class AssertUtil {
|
||||
|
||||
/**
|
||||
* 判断对象为空
|
||||
* @param obj 对象名
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static boolean isEmpty(Object obj) {
|
||||
if (obj == null) {
|
||||
return true;
|
||||
}
|
||||
if ((obj instanceof String)) {
|
||||
return ((String) obj).trim().equals("");
|
||||
}
|
||||
if ((obj instanceof List)) {
|
||||
return ((List) obj).isEmpty();
|
||||
}
|
||||
if ((obj instanceof Map)) {
|
||||
return ((Map) obj).isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断对象为空
|
||||
* @param obj 对象名
|
||||
*/
|
||||
public static boolean isNotEmpty(Object obj) {
|
||||
return !isEmpty(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断对象为空
|
||||
* @param obj 对象名
|
||||
*/
|
||||
public static void isEmpty(Object obj, String msg) {
|
||||
isTrue(isEmpty(obj), msg);
|
||||
}
|
||||
|
||||
public static void isTrue(Boolean flag, String msg) {
|
||||
if (flag) {
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.engine.htsc.seal.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ApplyPrintEntity implements Serializable {
|
||||
|
||||
public String appId;
|
||||
public String secret;
|
||||
public String docId;//文件id
|
||||
public String personName;//打印人姓名
|
||||
public String oldPersonNum;//之前的打印人标识
|
||||
public String personNum;//打印人标识
|
||||
public String printNum;//打印份数
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getSecret() {
|
||||
return secret;
|
||||
}
|
||||
|
||||
public void setSecret(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
public String getDocId() {
|
||||
return docId;
|
||||
}
|
||||
|
||||
public void setDocId(String docId) {
|
||||
this.docId = docId;
|
||||
}
|
||||
|
||||
public String getPersonName() {
|
||||
return personName;
|
||||
}
|
||||
|
||||
public void setPersonName(String personName) {
|
||||
this.personName = personName;
|
||||
}
|
||||
|
||||
public String getOldPersonNum() {
|
||||
return oldPersonNum;
|
||||
}
|
||||
|
||||
public void setOldPersonNum(String oldPersonNum) {
|
||||
this.oldPersonNum = oldPersonNum;
|
||||
}
|
||||
|
||||
public String getPersonNum() {
|
||||
return personNum;
|
||||
}
|
||||
|
||||
public void setPersonNum(String personNum) {
|
||||
this.personNum = personNum;
|
||||
}
|
||||
|
||||
public String getPrintNum() {
|
||||
return printNum;
|
||||
}
|
||||
|
||||
public void setPrintNum(String printNum) {
|
||||
this.printNum = printNum;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.engine.htsc.trip.pojo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AllowanceRequest {
|
||||
private String type;
|
||||
private String isLeader;
|
||||
private String travelApplyNo;
|
||||
private List<JourneyEntity> journeyList;
|
||||
private List<JourneyEntity> trainOrders;
|
||||
private List<JourneyEntity> flightOrders;
|
||||
private List<OrderEntity> orderList;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getIsLeader() {
|
||||
return isLeader;
|
||||
}
|
||||
|
||||
public void setIsLeader(String isLeader) {
|
||||
this.isLeader = isLeader;
|
||||
}
|
||||
|
||||
public String getTravelApplyNo() {
|
||||
return travelApplyNo;
|
||||
}
|
||||
|
||||
public void setTravelApplyNo(String travelApplyNo) {
|
||||
this.travelApplyNo = travelApplyNo;
|
||||
}
|
||||
|
||||
public List<JourneyEntity> getJourneyList() {
|
||||
return journeyList;
|
||||
}
|
||||
|
||||
public void setJourneyList(List<JourneyEntity> journeyList) {
|
||||
this.journeyList = journeyList;
|
||||
}
|
||||
|
||||
public List<JourneyEntity> getTrainOrders() {
|
||||
return trainOrders;
|
||||
}
|
||||
|
||||
public void setTrainOrders(List<JourneyEntity> trainOrders) {
|
||||
this.trainOrders = trainOrders;
|
||||
}
|
||||
|
||||
public List<JourneyEntity> getFlightOrders() {
|
||||
return flightOrders;
|
||||
}
|
||||
|
||||
public void setFlightOrders(List<JourneyEntity> flightOrders) {
|
||||
this.flightOrders = flightOrders;
|
||||
}
|
||||
|
||||
public List<OrderEntity> getOrderList() {
|
||||
return orderList;
|
||||
}
|
||||
|
||||
public void setOrderList(List<OrderEntity> orderList) {
|
||||
this.orderList = orderList;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.engine.htsc.trip.service;
|
||||
|
||||
import com.engine.htsc.trip.pojo.AllowanceRequest;
|
||||
import java.util.Map;
|
||||
|
||||
public interface AllowanceService {
|
||||
Map<String, Object> allowance(AllowanceRequest request);
|
||||
|
||||
Map<String, Object> execute(AllowanceRequest request);
|
||||
}
|
@ -0,0 +1,381 @@
|
||||
package com.engine.htsc.trip.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.htsc.trip.pojo.AllowanceRequest;
|
||||
import com.engine.htsc.trip.pojo.JourneyEntity;
|
||||
import com.engine.htsc.trip.pojo.OrderEntity;
|
||||
import com.engine.htsc.trip.service.AllowanceService;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
||||
public class AllowanceServiceImpl extends Service implements AllowanceService {
|
||||
|
||||
private static final String TITLE = "doGetAllowance";
|
||||
private Log log = LogFactory.getLog(this.getClass());
|
||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter
|
||||
.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(AllowanceRequest params) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
//此阶段明细表尚无数据
|
||||
String type = params.getType();
|
||||
String isLeader = params.getIsLeader();
|
||||
String travelApplyNo = params.getTravelApplyNo();
|
||||
List<JourneyEntity> journeyList = params.getJourneyList();
|
||||
if (CollectionUtils.isEmpty(journeyList)) {
|
||||
log.warn(String.format("%s journey list is empty! applyno:%s", TITLE, travelApplyNo));
|
||||
return result;
|
||||
}
|
||||
journeyList.sort(Comparator.comparing(JourneyEntity::getBeginTime));
|
||||
int allowance = 0;
|
||||
result.put("applyNo", travelApplyNo);
|
||||
String firstDay = "";
|
||||
String departure = "";
|
||||
Map<String, String> dayMap = new HashMap<>();
|
||||
for (int i = 0; i < journeyList.size(); i++) {
|
||||
JourneyEntity journey = journeyList.get(i);
|
||||
List<String> dayList = getDateList(journey.getBeginTime(), journey.getEndTime());
|
||||
if (i == 0) {
|
||||
departure = journey.getBeginCity();
|
||||
firstDay = dayList.get(0);
|
||||
}
|
||||
dayList.forEach(f -> {
|
||||
dayMap.put(f, journey.getEndCity());
|
||||
});
|
||||
}
|
||||
LocalDate firstLocalDate = LocalDate.parse(firstDay, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
//带领导报销
|
||||
if ("true".equals(isLeader)) {
|
||||
|
||||
for (Entry<String, String> entry : dayMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String v = entry.getValue();
|
||||
allowance += getStandardByCity(v);
|
||||
}
|
||||
} else {
|
||||
if ("1".equals(type)) {
|
||||
//内部会议出差
|
||||
allowance = 0;
|
||||
} else if ("2".equals(type)) {
|
||||
//外部会议培训
|
||||
allowance = 50 * dayMap.size();
|
||||
} else {
|
||||
//单日行程
|
||||
if (dayMap.size() == 1) {
|
||||
//使用当天的目的地城市作为补贴标准城市
|
||||
allowance = getStandardByCity(dayMap.entrySet().iterator().next().getValue());
|
||||
} else {
|
||||
List<OrderEntity> orderList = params.getOrderList();
|
||||
if (CollectionUtils.isEmpty(orderList) || orderList.size() < 2) {
|
||||
log.warn(String
|
||||
.format("%s order list is empty or size < 2 ! applyno:%s", TITLE, travelApplyNo));
|
||||
} else {
|
||||
//整理每日订单
|
||||
Map<String, List<OrderEntity>> dayOrderMap = new HashMap<>();
|
||||
String lastOrderDay = "";
|
||||
orderList.sort(Comparator.comparing(OrderEntity::getBeginTime));
|
||||
for (int i = 0; i < orderList.size(); i++) {
|
||||
OrderEntity order = orderList.get(i);
|
||||
if (i == orderList.size() - 1) {
|
||||
lastOrderDay = order.getEndTime();
|
||||
}
|
||||
String key = order.getBeginTime().substring(0, 10);
|
||||
if (dayOrderMap.containsKey(key)) {
|
||||
dayOrderMap.get(key).add(order);
|
||||
} else {
|
||||
List<OrderEntity> arr = new ArrayList<>();
|
||||
arr.add(order);
|
||||
arr.sort(Comparator.comparing(OrderEntity::getBeginTime));
|
||||
dayOrderMap.put(key, arr);
|
||||
}
|
||||
}
|
||||
|
||||
LocalDate lastLocalDate = LocalDate
|
||||
.parse(lastOrderDay, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
//遍历每一天行程
|
||||
for (Entry<String, String> entry : dayMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
LocalDate date = LocalDate.parse(k, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
if (date.isAfter(lastLocalDate)) {
|
||||
continue;
|
||||
}
|
||||
List<OrderEntity> dayOrderArr = dayOrderMap.get(k);
|
||||
//判断是否为最后一天
|
||||
if (k.equals(lastLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) {
|
||||
//如果最后一天没有订单则该天差补为0
|
||||
if (CollectionUtils.isEmpty(dayOrderArr)) {
|
||||
allowance += 0;
|
||||
} else {
|
||||
//如果最后一张订单是返程订单
|
||||
OrderEntity dayLastOrder = dayOrderArr.get(dayOrderArr.size() - 1);
|
||||
if (dayLastOrder.getEndCity().equals(departure)) {
|
||||
dayOrderArr.remove(dayOrderArr.size() - 1);
|
||||
}
|
||||
//当天所有城市中补贴最高的值
|
||||
Set<String> cityNameSet = new HashSet<>();
|
||||
if (CollectionUtils.isEmpty(dayOrderArr)) {
|
||||
cityNameSet.add(dayLastOrder.getBeginCity());
|
||||
} else {
|
||||
for (OrderEntity dayOrder : dayOrderArr) {
|
||||
cityNameSet.add(dayOrder.getEndCity());
|
||||
}
|
||||
}
|
||||
allowance += getStandardByCitySet(cityNameSet);
|
||||
}
|
||||
} else {
|
||||
//如果当天没有订单则以之前最近的订单的目的标准作为补贴标准
|
||||
if (CollectionUtils.isEmpty(dayOrderArr)) {
|
||||
LocalDate preDay = date.minusDays(1);
|
||||
while (preDay.isAfter(firstLocalDate)) {
|
||||
String dayKey = preDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
dayOrderArr = dayOrderMap.get(dayKey);
|
||||
if (!CollectionUtils.isEmpty(dayOrderArr)) {
|
||||
break;
|
||||
}
|
||||
preDay = preDay.minusDays(1);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(dayOrderArr)) {
|
||||
allowance += 0;
|
||||
} else {
|
||||
//取最后一个行程的目的地
|
||||
OrderEntity dayOrder = dayOrderArr.get(dayOrderArr.size() - 1);
|
||||
allowance += getStandardByCity(dayOrder.getEndCity());
|
||||
}
|
||||
} else {
|
||||
//当天所有城市中补贴最高的值
|
||||
Set<String> cityNameSet = new HashSet<>();
|
||||
for (OrderEntity dayOrder : dayOrderArr) {
|
||||
cityNameSet.add(dayOrder.getEndCity());
|
||||
}
|
||||
allowance += getStandardByCitySet(cityNameSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result.put("allowance", allowance);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> allowance(AllowanceRequest params) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
//此阶段明细表尚无数据
|
||||
String type = params.getType();
|
||||
String travelApplyNo = params.getTravelApplyNo();
|
||||
int allowance = 0;
|
||||
result.put("applyNo", travelApplyNo);
|
||||
result.put("allowance", allowance);
|
||||
//合并火车和机票订单
|
||||
|
||||
List<JourneyEntity> orderList = new ArrayList<>();
|
||||
orderList.addAll(params.getTrainOrders());
|
||||
orderList.addAll(params.getFlightOrders());
|
||||
if (CollectionUtils.isEmpty(orderList)) {
|
||||
return result;
|
||||
}
|
||||
orderList.sort(Comparator.comparing(JourneyEntity::getBeginTime));
|
||||
/**
|
||||
* 检查订单是否连续
|
||||
* 1、无订单或者订单数小于2
|
||||
* 2、上一段行程的目的地是下一段行程的出发地
|
||||
* 3、第一段行程的出发地等于最好一段行程的目的地
|
||||
*/
|
||||
if (!checkContinuous(orderList)) {
|
||||
return result;
|
||||
} else {
|
||||
JourneyEntity firstOrder = orderList.get(0);
|
||||
JourneyEntity lastOrder = orderList.get(orderList.size() - 1);
|
||||
String beginTime = firstOrder.getBeginTime();
|
||||
String endTime = lastOrder.getEndTime();
|
||||
//获取两个时间内的小时数 确定天数
|
||||
LocalDateTime startDateTime = LocalDateTime.parse(beginTime, FORMATTER);
|
||||
LocalDateTime endDateTime = LocalDateTime.parse(endTime, FORMATTER);
|
||||
Duration duration = Duration.between(startDateTime, endDateTime);
|
||||
long hours = duration.toHours();
|
||||
//间隔天数
|
||||
int days = (int) Math.ceil(hours / 24.0);
|
||||
if ("1".equals(type)) {
|
||||
//内部会议出差
|
||||
allowance = 0;
|
||||
} else if ("2".equals(type)) {
|
||||
//外部会议培训
|
||||
allowance = 50 * days;
|
||||
} else {
|
||||
//订单按日分组
|
||||
Map<String, List<JourneyEntity>> dayOrderMap = new HashMap<>();
|
||||
for (int i = 0; i < orderList.size(); i++) {
|
||||
JourneyEntity order = orderList.get(i);
|
||||
String key = order.getBeginTime().substring(0, 10);
|
||||
if (dayOrderMap.containsKey(key)) {
|
||||
dayOrderMap.get(key).add(order);
|
||||
} else {
|
||||
List<JourneyEntity> arr = new ArrayList<>();
|
||||
arr.add(order);
|
||||
arr.sort(Comparator.comparing(JourneyEntity::getBeginTime));
|
||||
dayOrderMap.put(key, arr);
|
||||
}
|
||||
}
|
||||
Set<String> dateSet = dayOrderMap.keySet();
|
||||
List<String> dateList = dateSet.stream().sorted().collect(Collectors.toList());
|
||||
String preDate = dateList.get(0);
|
||||
LocalDateTime preLocalDate = LocalDate.parse(preDate, DateTimeFormatter
|
||||
.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
||||
int preAllowance = calcAllowancePerDay(dayOrderMap.get(preDate), dayOrderMap.size()==1);
|
||||
allowance += preAllowance;
|
||||
List<Integer> allowanceList = Lists.newArrayList(preAllowance);
|
||||
for (int i = 1; i < dateList.size(); i++) {
|
||||
String curDate = dateList.get(i);
|
||||
//计算和上一个日期间隔的天数
|
||||
LocalDateTime curLocalDate = LocalDate.parse(curDate, DateTimeFormatter
|
||||
.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
||||
int d = (int) Duration.between(preLocalDate, curLocalDate).toDays() - 1;
|
||||
allowance += (preAllowance * d);
|
||||
for (int j = 0; j < d; j++) {
|
||||
allowanceList.add(preAllowance);
|
||||
}
|
||||
int curAllowance = calcAllowancePerDay(dayOrderMap.get(curDate),
|
||||
i == dateList.size() - 1);
|
||||
allowance += curAllowance;
|
||||
allowanceList.add(curAllowance);
|
||||
preLocalDate = curLocalDate;
|
||||
preAllowance = curAllowance;
|
||||
}
|
||||
log.info("allowance per day:" + allowanceList.stream().map(String::valueOf)
|
||||
.collect(Collectors.joining(",")) + ", applyNo:" + travelApplyNo);
|
||||
//总的计算天数
|
||||
if (allowanceList.size() > days) {
|
||||
List<Integer> temp = new ArrayList<>(allowanceList);
|
||||
Collections.sort(temp);
|
||||
//按照差补值从小到大排序
|
||||
List<Integer> filter = temp.subList(0, temp.size() - days);
|
||||
log.info("allowance per day filter:" + filter.stream().map(String::valueOf)
|
||||
.collect(Collectors.joining(",")) + ", applyNo:" + travelApplyNo);
|
||||
//去掉对应天数最低的差补
|
||||
allowance -= filter.stream().reduce(Integer::sum).orElse(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.put("allowance", allowance);
|
||||
return result;
|
||||
}
|
||||
|
||||
private int calcAllowancePerDay(List<JourneyEntity> orderEntityList, boolean lastDay) {
|
||||
if (orderEntityList.size() < 2) {
|
||||
JourneyEntity orderEntity = orderEntityList.get(0);
|
||||
String city = lastDay ? orderEntity.getBeginCity() : orderEntity.getEndCity();
|
||||
return getStandardByCity(city);
|
||||
} else {
|
||||
Set<String> citySet = new HashSet<>();
|
||||
for (int i = 0; i < orderEntityList.size(); i++) {
|
||||
if (i == orderEntityList.size() - 1) {
|
||||
citySet.add(lastDay ? orderEntityList.get(i).getBeginCity()
|
||||
: orderEntityList.get(i).getEndCity());
|
||||
} else {
|
||||
citySet.add(orderEntityList.get(i).getEndCity());
|
||||
}
|
||||
}
|
||||
return getStandardByCitySet(citySet);
|
||||
}
|
||||
}
|
||||
|
||||
private int getStandardByCitySet(Set<String> cityNameSet) {
|
||||
return cityNameSet.stream().map(this::getStandardByCity).max(Comparator.comparing(i -> i))
|
||||
.get();
|
||||
}
|
||||
|
||||
private int getStandardByCity(String cityName) {
|
||||
if (StringUtils.isBlank(cityName)) {
|
||||
return 0;
|
||||
}
|
||||
return Lists.newArrayList("北京", "上海", "深圳", "广州", "海口", "三亚", "三沙").contains(cityName) ? 100
|
||||
: 80;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将日期区间拆分为每一天
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return
|
||||
*/
|
||||
private List<String> getDateList(String start, String end) {
|
||||
List<String> result = new ArrayList<>();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDate startDate = LocalDate.parse(start, formatter);
|
||||
LocalDate endDate = LocalDate.parse(end, formatter);
|
||||
LocalDate tempDate = startDate;
|
||||
while (tempDate.isBefore(endDate)) {
|
||||
result.add(tempDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
tempDate = tempDate.plusDays(1);
|
||||
}
|
||||
result.add(endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查订单是否连续
|
||||
*
|
||||
* @param orderEntityList
|
||||
* @return
|
||||
*/
|
||||
private boolean checkContinuous(List<JourneyEntity> orderEntityList) {
|
||||
boolean result = true;
|
||||
if (org.apache.commons.collections4.CollectionUtils.isEmpty(orderEntityList)
|
||||
|| orderEntityList.size() < 2) {
|
||||
result = false;
|
||||
} else {
|
||||
JourneyEntity firstOrder = orderEntityList.get(0);
|
||||
JourneyEntity lastOrder = orderEntityList.get(orderEntityList.size() - 1);
|
||||
if (firstOrder.getBeginCity().equals(lastOrder.getEndCity())) {
|
||||
JourneyEntity pre = orderEntityList.get(0);
|
||||
for (int i = 1; i < orderEntityList.size(); i++) {
|
||||
JourneyEntity now = orderEntityList.get(i);
|
||||
if (!pre.getEndCity().equals(now.getBeginCity())) {
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
pre = now;
|
||||
}
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// GCONST.setRootPath("");
|
||||
// GCONST.setServerName("ecology");
|
||||
AllowanceServiceImpl allowanceService = new AllowanceServiceImpl();
|
||||
String json = "{\"type\":\"3\",\"isLeader\":\"false\",\"travelApplyNo\":\"20210821416\",\"journeyList\":[{\"beginTime\":\"2021-08-31 09:00:00\",\"endTime\":\"2021-09-01 17:00:00\",\"beginCity\":\"上海\",\"endCity\":\"南京\"}],\"trainOrders\":[{\"beginTime\":\"2021-09-01 09:20:00\",\"endTime\":\"2021-09-01 10:41:00\",\"beginCity\":\"上海\",\"endCity\":\"南京\"},{\"beginTime\":\"2021-09-01 16:32:00\",\"endTime\":\"2021-09-01 17:35:00\",\"beginCity\":\"南京\",\"endCity\":\"上海\"}],\"flightOrders\":[],\"orderList\":[]}";
|
||||
AllowanceRequest request = JSON.parseObject(json,
|
||||
AllowanceRequest.class);
|
||||
Map<String, Object> result = allowanceService.allowance(request);
|
||||
System.out.println(JSON.toJSONString(result));
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.engine.htxc.apprchalink.cinterface;
|
||||
|
||||
/**
|
||||
* Remark 用于日后审批链统一处理接口
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ContractLink.java
|
||||
* @createTime 2022年07月26日 14:26:00
|
||||
*/
|
||||
public interface ApprachaLink<T,R> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.engine.htxc.apprchalink.cinterface;
|
||||
|
||||
import com.engine.htxc.commonutil.user.UserTools;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName ApprachaLinkBuilder.java
|
||||
* @createTime 2022年07月26日 15:00:00
|
||||
*/
|
||||
public class ApprachaLinkBuilder<T> {
|
||||
|
||||
/**
|
||||
* <p>最终将多个记录合并</p>
|
||||
* @title collback
|
||||
* @author K1810015
|
||||
* @updateTime 2022/7/26 15:01
|
||||
* @ps 最开始考虑用Vo层来代替,有一些其他原因。。
|
||||
* @throws
|
||||
*/
|
||||
public Map<String,Object> collback(List<T> list,List<String> fileid){
|
||||
Map<String,Object> retmap=new HashMap<>(2);
|
||||
if(list==null || list.size()<=0 || fileid==null) {
|
||||
return retmap;
|
||||
}
|
||||
list.forEach(t->{
|
||||
Map<String,Object> map=(Map<String, Object>) t;
|
||||
if(map!=null && map.size()>0){
|
||||
fileid.forEach(item->{
|
||||
String value= Util.null2String(map.get(item));
|
||||
if(!StringUtils.isBlank(value)){
|
||||
|
||||
if(StringUtils.isBlank(Util.null2String(retmap.get(item)))){
|
||||
retmap.put(item,map.get(item));
|
||||
}else {
|
||||
retmap.put(item, retmap.get(item) + "," + map.get(item));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
fileid.forEach(item->{
|
||||
if(!retmap.containsKey(item)){
|
||||
retmap.put(item,"");
|
||||
}
|
||||
});
|
||||
|
||||
Map<String,Object> filtermap= retmap.entrySet().stream().filter((item)->{
|
||||
return !StringUtils.isBlank(item.getKey());
|
||||
}).collect(Collectors.toMap(p->p.getKey(),p->
|
||||
Arrays.stream(p.getValue().toString().split(",")).distinct().collect(Collectors.joining(","))
|
||||
));
|
||||
filtermap.entrySet().stream().forEach((item)->{
|
||||
retmap.put(item.getKey()+"_specialobj",getUserInfo(Util.null2String(item.getValue())));
|
||||
});
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> getUserInfo(String userids){
|
||||
return UserTools.getUserInfo(userids,"id,lastname as name");
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.engine.htxc.contract.dto;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810050
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022/8/18 21:07
|
||||
* @Description: 审核方式 默认 0
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public enum ApprovalWayEnum {
|
||||
/**
|
||||
* 顺序审核
|
||||
*/
|
||||
SEQUENTIAL,
|
||||
/**
|
||||
* 并行审核
|
||||
*/
|
||||
PARALLEL
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.engine.htxc.contract.dto;
|
||||
|
||||
/**
|
||||
* @Title: ecology-9
|
||||
* @Company: 泛微软件
|
||||
* @author: K1810050
|
||||
* @version: 1.0
|
||||
* @CreateDate: 2022/8/18 21:08
|
||||
* @Description: 是否授权简化
|
||||
* @ModifyLog:
|
||||
**/
|
||||
public enum AuthoritySimplifyEnum {
|
||||
/**
|
||||
* 是
|
||||
*/
|
||||
SIMPLIFY,
|
||||
/**
|
||||
* 否
|
||||
*/
|
||||
NO_SIMPLIFY
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.engine.htxc.workflow.create.autotrigger.contract.service;
|
||||
|
||||
import com.engine.htxc.workflow.create.autotrigger.contract.vo.AutoApproval;
|
||||
|
||||
/**
|
||||
* 提供其他业务调用合同审批的方法
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName AutoApprovalService.java
|
||||
* @createTime 2022年08月05日 10:07:00
|
||||
*/
|
||||
public interface AutoApprovalService {
|
||||
/**
|
||||
* <p>创建流程的接口</p>
|
||||
* @title create
|
||||
* @author K1810015
|
||||
* @updateTime 2022/8/21 22:07
|
||||
*/
|
||||
public int create(AutoApproval autoApproval);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.engine.htxc.workflow.create.autotrigger.contract.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.htxc.commonutil.workflow.WorkflowCreate;
|
||||
import com.engine.htxc.workflow.create.autotrigger.contract.service.AutoApprovalService;
|
||||
import com.engine.htxc.workflow.create.autotrigger.contract.vo.AutoApproval;
|
||||
import com.engine.htxc.workflow.create.autotrigger.contract.vo.ContractInfo;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName AutoApprovalService.java
|
||||
* @createTime 2022-08-0510:07:00
|
||||
*/
|
||||
public class AutoApprovalServiceImpl extends Service implements AutoApprovalService {
|
||||
|
||||
private String workflowid=new PropBean().getPropName("constract.approval.workflowid");
|
||||
private String creatorid="";
|
||||
private String requestname="";
|
||||
@Override
|
||||
public int create(AutoApproval autoApproval) {
|
||||
if(autoApproval==null){
|
||||
return -100;
|
||||
}
|
||||
creatorid=Util.null2String(autoApproval.creatorid);
|
||||
requestname=Util.null2String(autoApproval.requestname);
|
||||
if(StringUtils.isBlank(creatorid) || StringUtils.isBlank(requestname)){
|
||||
return -101;
|
||||
}
|
||||
Map<String,Object> map=new HashMap<>(15);
|
||||
map.put("ngr",creatorid);
|
||||
map.put("szbm",Util.null2String(autoApproval.getSzbm()));
|
||||
map.put("szjg",Util.null2String(autoApproval.getSzjg()));
|
||||
map.put("jjcd",Util.null2String(autoApproval.getJjcd()));
|
||||
map.put("lxfs",Util.null2String(autoApproval.getLxfs()));
|
||||
map.put("ngrq",Util.null2String(autoApproval.getNgrq()));
|
||||
map.put("nbsh",Util.null2String(autoApproval.getNbsh()));
|
||||
map.put("bmld",Util.null2String(autoApproval.getBmld()));
|
||||
map.put("sqjh",Util.null2String(autoApproval.getSqjh()));
|
||||
map.put("qttzyddx",Util.null2String(autoApproval.getQttzyddx()));
|
||||
map.put("shfs",Util.null2String(autoApproval.getShfs()));
|
||||
map.put("lkrqsfytsyq",Util.null2String(autoApproval.getLkrqsfytsyq()));
|
||||
map.put("xzhtlb",Util.null2String(autoApproval.getXzhtlb()));
|
||||
map.put("htlx",Util.null2String(autoApproval.getHtlx()));
|
||||
map.put("yz",Util.null2String(autoApproval.getYz()));
|
||||
Map<String,String> result= map.entrySet().stream().filter(mapfilter->
|
||||
!StringUtils.isBlank(Util.null2String(mapfilter.getValue()))
|
||||
).collect(Collectors.toMap(p->p.getKey(), p->Util.null2String(p.getValue()) ));
|
||||
List<ContractInfo> contractlist= autoApproval.getListcontrat();
|
||||
List<Map<String,String>> listdetail=new ArrayList<>();
|
||||
if(contractlist!=null){
|
||||
contractlist.forEach(item->{
|
||||
Map<String,Object> map2=JSONObject.parseObject(JSON.toJSONString(item),Map.class);
|
||||
if(map2!=null && map2.size()>0) {
|
||||
listdetail.add(map2.entrySet().stream().collect(Collectors.toMap(p -> p.getKey(), p -> Util.null2String(p.getValue()))));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return createworkflow(result,listdetail);
|
||||
}
|
||||
|
||||
private int createworkflow(Map<String,String> mainmap, List<Map<String,String>> listmap){
|
||||
WorkflowCreate workflowCreate= WorkflowCreate.createWorkflow(p->{
|
||||
p.setCreatorId(creatorid);
|
||||
p.setWorkflowId(workflowid);
|
||||
p.setRequestName(requestname);
|
||||
p.setIsNextFlow("");
|
||||
p.setRequestMainMap(mainmap);
|
||||
}).workflowCreateByRequestMap();
|
||||
String requestid= workflowCreate.requestid;
|
||||
if(StringUtils.isBlank(requestid)){
|
||||
return -1;
|
||||
}
|
||||
if(listmap!=null && listmap.size()>0){
|
||||
workflowCreate.workflowCreatelist("4",listmap);
|
||||
}
|
||||
|
||||
return Util.getIntValue(requestid,-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
package com.engine.htxc.workflow.create.autotrigger.contract.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName AutoApproval.java
|
||||
* @createTime 2022年08月05日 10:12:00
|
||||
*/
|
||||
|
||||
public class AutoApproval {
|
||||
public String creatorid;
|
||||
public String requestname;
|
||||
public String szbm;
|
||||
public String szjg;
|
||||
public String jjcd;
|
||||
public String lxfs;
|
||||
public String ngrq;
|
||||
public String nbsh;
|
||||
public String bmld;
|
||||
public String sqjh;
|
||||
public String qttzyddx;
|
||||
public String shfs;
|
||||
public String lkrqsfytsyq;
|
||||
public String xzhtlb;
|
||||
|
||||
public String getHtlx() {
|
||||
return htlx;
|
||||
}
|
||||
|
||||
public void setHtlx(String htlx) {
|
||||
this.htlx = htlx;
|
||||
}
|
||||
|
||||
public String htlx;
|
||||
public List<ContractInfo> getListcontrat() {
|
||||
return listcontrat;
|
||||
}
|
||||
|
||||
public void setListcontrat(List<ContractInfo> listcontrat) {
|
||||
this.listcontrat = listcontrat;
|
||||
}
|
||||
|
||||
public List<ContractInfo> listcontrat;
|
||||
|
||||
public String getCreatorid() {
|
||||
return creatorid;
|
||||
}
|
||||
|
||||
public void setCreatorid(String creatorid) {
|
||||
this.creatorid = creatorid;
|
||||
}
|
||||
|
||||
public String getRequestname() {
|
||||
return requestname;
|
||||
}
|
||||
|
||||
public void setRequestname(String requestname) {
|
||||
this.requestname = requestname;
|
||||
}
|
||||
|
||||
public String getSzbm() {
|
||||
return szbm;
|
||||
}
|
||||
|
||||
public void setSzbm(String szbm) {
|
||||
this.szbm = szbm;
|
||||
}
|
||||
|
||||
public String getSzjg() {
|
||||
return szjg;
|
||||
}
|
||||
|
||||
public void setSzjg(String szjg) {
|
||||
this.szjg = szjg;
|
||||
}
|
||||
|
||||
public String getJjcd() {
|
||||
return jjcd;
|
||||
}
|
||||
|
||||
public void setJjcd(String jjcd) {
|
||||
this.jjcd = jjcd;
|
||||
}
|
||||
|
||||
public String getLxfs() {
|
||||
return lxfs;
|
||||
}
|
||||
|
||||
public void setLxfs(String lxfs) {
|
||||
this.lxfs = lxfs;
|
||||
}
|
||||
|
||||
public String getNgrq() {
|
||||
return ngrq;
|
||||
}
|
||||
|
||||
public void setNgrq(String ngrq) {
|
||||
this.ngrq = ngrq;
|
||||
}
|
||||
|
||||
public String getNbsh() {
|
||||
return nbsh;
|
||||
}
|
||||
|
||||
public void setNbsh(String nbsh) {
|
||||
this.nbsh = nbsh;
|
||||
}
|
||||
|
||||
public String getBmld() {
|
||||
return bmld;
|
||||
}
|
||||
|
||||
public void setBmld(String bmld) {
|
||||
this.bmld = bmld;
|
||||
}
|
||||
|
||||
public String getSqjh() {
|
||||
return sqjh;
|
||||
}
|
||||
|
||||
public void setSqjh(String sqjh) {
|
||||
this.sqjh = sqjh;
|
||||
}
|
||||
|
||||
public String getQttzyddx() {
|
||||
return qttzyddx;
|
||||
}
|
||||
|
||||
public void setQttzyddx(String qttzyddx) {
|
||||
this.qttzyddx = qttzyddx;
|
||||
}
|
||||
|
||||
public String getShfs() {
|
||||
return shfs;
|
||||
}
|
||||
|
||||
public void setShfs(String shfs) {
|
||||
this.shfs = shfs;
|
||||
}
|
||||
|
||||
public String getLkrqsfytsyq() {
|
||||
return lkrqsfytsyq;
|
||||
}
|
||||
|
||||
public void setLkrqsfytsyq(String lkrqsfytsyq) {
|
||||
this.lkrqsfytsyq = lkrqsfytsyq;
|
||||
}
|
||||
|
||||
public String getXzhtlb() {
|
||||
return xzhtlb;
|
||||
}
|
||||
|
||||
public void setXzhtlb(String xzhtlb) {
|
||||
this.xzhtlb = xzhtlb;
|
||||
}
|
||||
|
||||
public String getYz() {
|
||||
return yz;
|
||||
}
|
||||
|
||||
public void setYz(String yz) {
|
||||
this.yz = yz;
|
||||
}
|
||||
|
||||
public String yz;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutoApproval{" +
|
||||
"creatorid='" + creatorid + '\'' +
|
||||
", requestname='" + requestname + '\'' +
|
||||
", szbm='" + szbm + '\'' +
|
||||
", szjg='" + szjg + '\'' +
|
||||
", jjcd='" + jjcd + '\'' +
|
||||
", lxfs='" + lxfs + '\'' +
|
||||
", ngrq='" + ngrq + '\'' +
|
||||
", nbsh='" + nbsh + '\'' +
|
||||
", bmld='" + bmld + '\'' +
|
||||
", sqjh='" + sqjh + '\'' +
|
||||
", qttzyddx='" + qttzyddx + '\'' +
|
||||
", shfs='" + shfs + '\'' +
|
||||
", lkrqsfytsyq='" + lkrqsfytsyq + '\'' +
|
||||
", xzhtlb='" + xzhtlb + '\'' +
|
||||
", yz='" + yz + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.engine.htxc.workflow.create.business.contract.approval.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import com.engine.htxc.commonutil.base.BaseUtil;
|
||||
import com.engine.htxc.commonutil.user.UserHt;
|
||||
import com.engine.htxc.commonutil.workflow.WorkflowCreate;
|
||||
import com.engine.htxc.workflow.create.business.contract.init.ContractWorkflowData;
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContracrtBaseUtil;
|
||||
import com.engine.htxc.workflow.create.business.contract.util.ContractUpdateStatus;
|
||||
import com.engine.htxc.workflow.create.cinterface.CustomizeWorkflow;
|
||||
import com.engine.integration.util.StringUtils;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.htsc.comInfo.PropBean;
|
||||
|
||||
/**
|
||||
* <p>合同审批流程办结触发签订流程</p>
|
||||
* @author K1810015
|
||||
* @version 1.0.0
|
||||
* @ClassName approvaltosign.java
|
||||
* @createTime 2022年07月20日 17:00:00
|
||||
*/
|
||||
public class Approvaltosign extends ContractWorkflowData implements CustomizeWorkflow {
|
||||
|
||||
private PropBean pb = new PropBean();
|
||||
private String requestnamevalue = "";
|
||||
public Map<String, Object> ufhtqcmap = new HashMap<>();
|
||||
public Map<String, Object> linkmodemap = new HashMap<>();
|
||||
|
||||
public Approvaltosign(Map<String, Object> map) {
|
||||
super(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int create() {
|
||||
if (StringUtils.isBlank(requestid) || StringUtils.isBlank(requestname)) {
|
||||
return -101;
|
||||
}
|
||||
String creatorid = Util.null2String(map.get("creatorid"));
|
||||
if (StringUtils.isBlank(creatorid)) {
|
||||
return -102;
|
||||
}
|
||||
int value = createworkflow();
|
||||
return value;
|
||||
}
|
||||
|
||||
public int createworkflow() {
|
||||
String workflowid = Util.null2String(pb.getPropName("constract.sign.workflowid"));
|
||||
String field = "ngr,szbm,szjg,jjcd,lxfs,ngrq,jjyy,xzhtlb,fhtlx";
|
||||
Map<String, Object> maintable = getmaintable(Arrays.stream(field.split(",")).collect(Collectors.toList()));
|
||||
List<Map<String, String>> dt4maplist = getdetailtable(4, null);
|
||||
boolean flag= (
|
||||
maintable == null || maintable.isEmpty()
|
||||
|| dt4maplist == null || dt4maplist.isEmpty());
|
||||
if (flag) {
|
||||
return -1;
|
||||
}
|
||||
Map<String, String> retmap = new HashMap<>(3);
|
||||
retmap.put("jjcd", Util.null2String(maintable.get("jjcd")));
|
||||
retmap.put("ngrq", DateTime.now().toString("yyyy-MM-dd hh:mm"));
|
||||
retmap.put("jjyy", Util.null2String(maintable.get("jjyy")));
|
||||
dt4maplist.forEach(dt4map -> {
|
||||
Map<String, Object> draftedmap = new HashMap<>(2);
|
||||
draftedmap.put("htbh", Util.null2String(dt4map.get("htbh")));
|
||||
draftedmap.put("htbb", Util.null2String(dt4map.get("htbb")));
|
||||
String prefix = Util.null2String(pb.getPropName("constract.sign.workflowname"));
|
||||
ufhtqcmap = ContracrtBaseUtil.getufhtqcmap(draftedmap);
|
||||
if (ufhtqcmap != null || ufhtqcmap.size() > 0) {
|
||||
String htmc = Util.null2String(ufhtqcmap.get("htmc"));
|
||||
String qcr = Util.null2String(ufhtqcmap.get("qcr"));
|
||||
if (!StringUtils.isBlank(htmc) && !StringUtils.isBlank(qcr)) {
|
||||
requestnamevalue = prefix + htmc;
|
||||
List<String> draftedlist = Arrays.stream(qcr.split(",")).collect(Collectors.toList());
|
||||
draftedlist.forEach(createidvalue -> {
|
||||
int userid = Util.getIntValue(createidvalue, -1);
|
||||
UserHt userht = new UserHt(userid);
|
||||
if (userid > 0) {
|
||||
retmap.put("xzhtlb", Util.null2String(dt4map.get("htbh")));
|
||||
retmap.put("fhtlx", Util.null2String(dt4map.get("htflx")));
|
||||
retmap.put("htbb", Util.null2String(dt4map.get("htbb")));
|
||||
retmap.put("htlx", Util.null2String(dt4map.get("htlx")));
|
||||
retmap.put("htzt", "3");
|
||||
retmap.put("ngr", Util.null2String(userid));
|
||||
retmap.put("szbm", Util.null2String(userht.getUserDepartment()));
|
||||
retmap.put("szjg", Util.null2String(BaseUtil.getusertoszjg(Util.null2String(userid))));
|
||||
|
||||
Map<String, Object> contracttypemap = new HashMap<>(1);
|
||||
contracttypemap.put("contracttype", Util.null2String(dt4map.get("htlx")));
|
||||
linkmodemap = ContracrtBaseUtil.getmodeltype(contracttypemap);
|
||||
if (linkmodemap != null && linkmodemap.size() > 0) {
|
||||
retmap.put("gljmmc", Util.null2String(linkmodemap.get("jmbd")));
|
||||
}
|
||||
|
||||
Map<String,
|
||||
String> result = retmap.entrySet().stream()
|
||||
.filter(mapfilter -> !StringUtils.isBlank(Util.null2String(mapfilter.getValue())))
|
||||
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
|
||||
WorkflowCreate workflowCreate = WorkflowCreate.createWorkflow(p -> {
|
||||
p.setCreatorId(createidvalue);
|
||||
p.setWorkflowId(workflowid);
|
||||
p.setRequestName(requestnamevalue);
|
||||
p.setIsNextFlow("");
|
||||
p.setRequestMainMap(result);
|
||||
}).workflowCreateByRequestMap();
|
||||
if (!StringUtils.isBlank(workflowCreate.requestid)
|
||||
&& Util.getIntValue(workflowCreate.requestid, -100) > 0) {
|
||||
String htdsf = Util.null2String(ufhtqcmap.get("htdsf"));
|
||||
if (!StringUtils.isBlank(htdsf)) {
|
||||
List<Map<String, String>> dsflist = new ArrayList<>();
|
||||
Arrays.stream(htdsf.split(",")).distinct().forEach((item) -> {
|
||||
Map<String, String> dsfmap = new HashMap<>(1);
|
||||
dsfmap.put("dsfmc", Util.null2String(item));
|
||||
dsflist.add(dsfmap);
|
||||
});
|
||||
workflowCreate.workflowCreatelist("5", dsflist);
|
||||
}
|
||||
|
||||
ContractUpdateStatus
|
||||
.createContractUpdateStatus(requestid, Util.null2String(dt4map.get("htflx")),
|
||||
Util.null2String(dt4map.get("htbh")), ufhtqcmap, user)
|
||||
.approvalend(workflowCreate.requestid);
|
||||
|
||||
} else {
|
||||
// 做好记录
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package weaver.interfaces.htsc.financialadjustment;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.workflow.request.RequestManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* k1810012
|
||||
*
|
||||
* 取明细表3的dcbm调出部门、drbm调入部门与uf_cwkhtz表中sdbm匹配,取jhcwbshr字段
|
||||
* dcbm调出部门、drbm调入部门需要过滤掉计划财务部(16)
|
||||
*
|
||||
*/
|
||||
public class ApproveAction implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
RecordSet rs = new RecordSet();
|
||||
String rid = requestInfo.getRequestid();
|
||||
RequestManager rm = requestInfo.getRequestManager();
|
||||
String tableName = rm.getBillTableName();
|
||||
int billid = rm.getBillid();
|
||||
rs.writeLog(String.format("ApproveAction -- requestid:%s; billid:%s;", rid, billid));
|
||||
try {
|
||||
List<String> departs = new ArrayList<>();
|
||||
rs.executeQuery("SELECT DCBM,DRBM FROM "+tableName+"_dt3 where mainid=?", billid);
|
||||
while (rs.next()) {
|
||||
departs.add(Util.null2String(rs.getString("DCBM")));
|
||||
departs.add(Util.null2String(rs.getString("DRBM")));
|
||||
}
|
||||
String departss = departs.stream()
|
||||
.distinct()
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.filter(d -> !d.equals("16")).collect(Collectors.joining("','"));
|
||||
rs.executeQuery("SELECT SDBM,JHCWBSHR FROM uf_cwkhtz WHERE SDBM IN ('"+departss+"')");
|
||||
List<String> shrs = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
shrs.add(Util.null2String(rs.getString("JHCWBSHR")));
|
||||
}
|
||||
String shrss = shrs.stream()
|
||||
.distinct()
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.joining(","));
|
||||
rs.writeLog(String.format("查询审核人,SDBM:%s; shrs:%s", departss, shrss));
|
||||
boolean b = rs.executeUpdate(
|
||||
"UPDATE " + tableName + " set jhcwbshr='" + shrss + "' WHERE ID =?", billid);
|
||||
|
||||
rs.writeLog("更新审批链:" + b);
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rm.setMessagecontent( "节点任务,ApproveAction出现异常,请联系管理员!");
|
||||
rs.errorLog("节点任务,ApproveAction出现异常", e);
|
||||
return FAILURE_AND_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package weaver.interfaces.htsc.payment;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.htsc.common.utils.DoubleUtil;
|
||||
import com.engine.htsc.payment.pojo.InvoiceData;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.workflow.request.RequestManager;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* k1810012
|
||||
* <p>
|
||||
* 票据汇总action
|
||||
* 提交节点后,数据用后台方式重新计算一次
|
||||
*/
|
||||
public class BillSummaryAction extends BaseBean implements Action {
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String rid = requestInfo.getRequestid();
|
||||
RequestManager rm = requestInfo.getRequestManager();
|
||||
String tableName = rm.getBillTableName();
|
||||
writeLog(String.format("票据汇总,requestid:%s; tableName=%s", rid, tableName));
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
|
||||
|
||||
try {
|
||||
String sql = "select t1.mainid,t1.FPLX,t1.JSHJ,t1.SE from " + tableName + "_DT5 t1\n" +
|
||||
"left join " + tableName + " t2\n" +
|
||||
"on t1.MAINID=t2.ID\n" +
|
||||
"where t2.REQUESTID=?";
|
||||
|
||||
rs.executeQuery(sql, rid);
|
||||
|
||||
List<InvoiceData> dataList = new ArrayList<>();
|
||||
String mainid = "";
|
||||
while (rs.next()) {
|
||||
mainid = rs.getString("mainid");
|
||||
InvoiceData invoiceData = new InvoiceData();
|
||||
invoiceData.setType(Util.null2String(rs.getString("FPLX")));
|
||||
invoiceData.setPriceTax(Util.null2String(rs.getString("JSHJ"), "0.00"));
|
||||
invoiceData.setTaxes(Util.null2String(rs.getString("SE"), "0.00"));
|
||||
dataList.add(invoiceData);
|
||||
}
|
||||
|
||||
//表6同步汇总
|
||||
sql = "select t1.mainid,t1.FPLX,t1.KPJE,t1.SE from " + tableName + "_DT6 t1\n" +
|
||||
"left join " + tableName + " t2\n" +
|
||||
"on t1.MAINID=t2.ID\n" +
|
||||
"where t2.REQUESTID=?";
|
||||
rs.executeQuery(sql, rid);
|
||||
while (rs.next()) {
|
||||
InvoiceData invoiceData = new InvoiceData();
|
||||
invoiceData.setType(Util.null2String(rs.getString("FPLX")));
|
||||
invoiceData.setPriceTax(Util.null2String(rs.getString("KPJE"), "0.00"));
|
||||
invoiceData.setTaxes(Util.null2String(rs.getString("SE"), "0.00"));
|
||||
dataList.add(invoiceData);
|
||||
}
|
||||
|
||||
//分组数据
|
||||
List<InvoiceData> packetData = dataList.stream().collect(Collectors.groupingBy(InvoiceData::getType,
|
||||
Collectors.reducing((sum, data) ->
|
||||
new InvoiceData(sum.getType(),
|
||||
String.valueOf(DoubleUtil.add(sum.getPriceTax(), data.getPriceTax(), 2)),
|
||||
String.valueOf(DoubleUtil.add(sum.getTaxes(), data.getTaxes(), 2))))
|
||||
)).values().stream().map(Optional::get).collect(Collectors.toList());
|
||||
|
||||
writeLog(String.format("packetData:%s", JSONObject.toJSONString(packetData)));
|
||||
|
||||
//批量插入
|
||||
savePacketData(packetData, tableName, mainid);
|
||||
|
||||
return SUCCESS;
|
||||
} catch (Exception e) {
|
||||
rm.setMessagecontent("票据汇总信息计算错误,原因:" + e.getMessage());
|
||||
rm.setMessageid("500");
|
||||
return FAILURE_AND_CONTINUE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除后 批量插入
|
||||
*
|
||||
* @param packetData 数据
|
||||
* @throws Exception 错误信息
|
||||
*/
|
||||
private void savePacketData(List<InvoiceData> packetData, String tableName, String mainId) throws Exception {
|
||||
if (CollectionUtils.isNotEmpty(packetData)) {
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
rst.setAutoCommit(false);
|
||||
String save = "insert into " + tableName + "_DT7 (MAINID,JSHJZE,BHSHJ,SJHJ,PJLX)\n" +
|
||||
"values(?,?,?,?,?)";
|
||||
List<List<Object>> paramList = new ArrayList<>();
|
||||
packetData.forEach(item -> {
|
||||
List<Object> valueList = new ArrayList<>();
|
||||
valueList.add(mainId);
|
||||
valueList.add(item.getPriceTax()); //价税
|
||||
valueList.add(String.valueOf(DoubleUtil.sub(item.getPriceTax(), item.getTaxes(), 2))); //价
|
||||
valueList.add(item.getTaxes()); //税
|
||||
valueList.add(item.getType());
|
||||
paramList.add(valueList);
|
||||
});
|
||||
|
||||
try {
|
||||
rst.executeUpdate("delete " + tableName + "_DT7 where MAINID=?", mainId);
|
||||
rst.executeBatchSql(save, paramList);
|
||||
rst.commit();
|
||||
} catch (Exception e) {
|
||||
rst.rollback();
|
||||
throw new Exception("savePacketData error:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package weaver.interfaces.htsc.workflow;
|
||||
|
||||
import com.engine.htsc.payment.util.PayUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by K1810006 on 2020/9/17.
|
||||
*/
|
||||
public class BankAccountHistoryHKAction extends BaseBean implements Action{
|
||||
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String tablename = requestInfo.getRequestManager().getBillTableName();
|
||||
String requestid = requestInfo.getRequestid();
|
||||
int workflowid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
String wfunnumber = PayUtil.getUnNumberByWorkFlowId(workflowid);
|
||||
if("xgtybx".equals(wfunnumber)){
|
||||
String dataSql = " select ngr,ygxm,bm,yxzh,khx,'' skdw from "+tablename+" a,"+tablename+"_dt11 b \n" +
|
||||
"where a.id=b.mainid and a.requestid=? ";
|
||||
rs.executeQuery(dataSql,requestid);
|
||||
}
|
||||
|
||||
if("xgtyfk".equals(wfunnumber)){
|
||||
String dataSql = " select ngr,'' ygxm,'' bm,yxzh,khx,skdw from "+tablename+" a,"+tablename+"_dt11 b \n" +
|
||||
"where a.id=b.mainid and a.requestid=? ";
|
||||
rs.executeQuery(dataSql,requestid);
|
||||
}
|
||||
|
||||
inserBankAccount(rs);
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否重复,银行卡号付款单位,创建人,为唯一区别
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isRepeat(String yxzh) {
|
||||
boolean flag = false;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from uf_xgyhlsjl where yxzh=? ",yxzh);
|
||||
if (rs.next()) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
public void inserBankAccount(RecordSet rs){
|
||||
try{
|
||||
ResourceComInfo resComInfo = new ResourceComInfo();
|
||||
RecordSet rs2 = new RecordSet();
|
||||
int formModeId = PayUtil.getFormModeIdByCubeName("uf_xgyhlsjl");
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
String createdate = TimeUtil.getCurrentDateString();
|
||||
String createtime = TimeUtil.getOnlyCurrentTimeString();
|
||||
String insertSql = "insert into uf_xgyhlsjl(ygxm,bm,yxzh,khx,skdw,workcode,formmodeid,modedatacreater," +
|
||||
"modedatacreatertype,modedatacreatedate,modedatacreatetime,modeuuid) \n" +
|
||||
"values(?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
while (rs.next()){
|
||||
String yxzh = Util.null2String(rs.getString("yxzh"));
|
||||
if(isRepeat(yxzh)){
|
||||
continue;
|
||||
}
|
||||
int ngr = Util.getIntValue(rs.getString("ngr"));
|
||||
String workcode = resComInfo.getWorkcode(ngr+"");
|
||||
String ygxm = Util.null2String(rs.getString("ygxm"));
|
||||
String bm = Util.null2String(rs.getString("bm"));
|
||||
String skdw = Util.null2String(rs.getString("skdw"));
|
||||
String khx = Util.null2String(rs.getString("khx"));
|
||||
boolean result = rs2.executeUpdate(insertSql,new Object[]{ygxm,bm,yxzh,khx,skdw,workcode,formModeId,ngr,0,createdate,createtime,uuid});
|
||||
if(result){
|
||||
rebuildRight(ngr,formModeId,uuid);
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 建模数据权限重构
|
||||
* @param creater
|
||||
* @param formModeId
|
||||
* @param uuid
|
||||
*/
|
||||
public void rebuildRight(int creater,int formModeId, String uuid) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(" select id from uf_xgyhlsjl where modeuuid=?",uuid);
|
||||
rs.next();
|
||||
int id = rs.getInt("id");
|
||||
if(id>0){
|
||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||
modeRightInfo.editModeDataShare(creater, formModeId, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<!--
|
||||
/**
|
||||
* @author wangcd
|
||||
* @date 2014-11-19
|
||||
*/
|
||||
-->
|
||||
<beans default-autowire="byName">
|
||||
<bean id="applicationContextHolder"
|
||||
class="weaver.common.web.ApplicationContextHolder" singleton="true">
|
||||
</bean>
|
||||
|
||||
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
|
||||
|
||||
</beans>
|
||||
|
Loading…
Reference in New Issue