diff --git a/.gitignore b/.gitignore index e4ee4f5..4be73d9 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ log /log/ .DS_Store /src/main/resources/WEB-INF/prop/weaver.properties +/src/main/resources/ajzx/ /file/ /src/test/resources/application.properties diff --git a/src/main/java/aiyh/utils/action/CusBaseCronJob.java b/src/main/java/aiyh/utils/action/CusBaseCronJob.java index 2ac99a4..87d82b1 100644 --- a/src/main/java/aiyh/utils/action/CusBaseCronJob.java +++ b/src/main/java/aiyh/utils/action/CusBaseCronJob.java @@ -5,6 +5,8 @@ import aiyh.utils.excention.CustomerException; import org.apache.log4j.Logger; import weaver.interfaces.schedule.BaseCronJob; +import java.io.IOException; + /** *

基础定时任务模板方法

* @@ -41,7 +43,7 @@ public abstract class CusBaseCronJob extends BaseCronJob { * * @author youHong.ai ****************************************** */ - public abstract void runCode(); + public abstract void runCode() throws IOException; /** diff --git a/src/main/java/com/api/bokang/xiao/porsche_repush/controller/ContractRePushController.java b/src/main/java/com/api/bokang/xiao/porsche_repush/controller/ContractRePushController.java new file mode 100644 index 0000000..137ef38 --- /dev/null +++ b/src/main/java/com/api/bokang/xiao/porsche_repush/controller/ContractRePushController.java @@ -0,0 +1,54 @@ +package com.api.bokang.xiao.porsche_repush.controller; + +import aiyh.utils.ApiResult; +import aiyh.utils.Util; +import com.api.bokang.xiao.porsche_repush.service.ContractRePushService; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.apache.log4j.Logger; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.List; +import java.util.Map; + +/** + * @ClassName ContractRePushController + * @Author 肖博亢 + * @Date 2023/5/10 10:47 + * @Description

+ **/ +@Path("/xbk/porsche_repush") +public class ContractRePushController { + + private final Logger log = Util.getLogger(); + + private final ContractRePushService contractRePushService = new ContractRePushService(); + + /** + *

获取流程的总数

+ * @param request 请求体 + * @param response 响应体 + * @param param 请求参数 + * @return 请求结果 + */ + @Path("/contractRePush") + @POST + @Produces(MediaType.APPLICATION_JSON) + public String contractRePush(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map param) { + try{ + log.info("into contractRePush success params ==> "+param); + User loginUser = HrmUserVarify.getUser(request, response); + List> result = contractRePushService.contractRePushService(param,loginUser); + return ApiResult.success(result); + }catch (Exception e){ + log.error("contractRePush error ==> "+ Util.getErrString(e)); + return ApiResult.error(e.getMessage()); + } + } + +} diff --git a/src/main/java/com/api/bokang/xiao/porsche_repush/mapper/QueryMapper.java b/src/main/java/com/api/bokang/xiao/porsche_repush/mapper/QueryMapper.java new file mode 100644 index 0000000..d161879 --- /dev/null +++ b/src/main/java/com/api/bokang/xiao/porsche_repush/mapper/QueryMapper.java @@ -0,0 +1,24 @@ +package com.api.bokang.xiao.porsche_repush.mapper; + +import aiyh.utils.annotation.recordset.ParamMapper; +import aiyh.utils.annotation.recordset.Select; +import aiyh.utils.annotation.recordset.SqlMapper; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName QueryMapper + * @Author 肖博亢 + * @Date 2023/5/10 11:00 + * @Description

+ **/ +@SqlMapper +public interface QueryMapper { + + @Select("select * from uf_zcht where id in $t{ids}") + List> queryContractByIds(@ParamMapper("ids")String ids); + + @Select("select * from actionsettingdetail where ACTIONID = (select id from actionsetting where actionname = #{actionName})") + List> queryActionParam(@ParamMapper("actionName")String actionName); +} diff --git a/src/main/java/com/api/bokang/xiao/porsche_repush/service/ContractRePushService.java b/src/main/java/com/api/bokang/xiao/porsche_repush/service/ContractRePushService.java new file mode 100644 index 0000000..fbecbda --- /dev/null +++ b/src/main/java/com/api/bokang/xiao/porsche_repush/service/ContractRePushService.java @@ -0,0 +1,91 @@ +package com.api.bokang.xiao.porsche_repush.service; + +import aiyh.utils.Util; +import aiyh.utils.excention.CustomerException; +import com.alibaba.fastjson.JSON; +import com.api.bokang.xiao.porsche_repush.mapper.QueryMapper; +import org.apache.log4j.Logger; +import weaver.aiyh_pcn.common_fadada.action.CommonContractRevocationAction; +import weaver.aiyh_pcn.common_fadada.action.CommonCreateContractAction; +import weaver.aiyh_pcn.common_fadada.action.CommonOneselfSignAction; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @ClassName ContractRePushService + * @Author 肖博亢 + * @Date 2023/5/10 10:48 + * @Description

+ **/ +public class ContractRePushService { + + private final Logger log = Util.getLogger(); + + private final QueryMapper queryMapper = Util.getMapper(QueryMapper.class); + + public List> contractRePushService(Map param, User loginUser) { + String ids = Util.null2String(param.get("ids")); + int labelId = Util.getIntValue(String.valueOf(param.get("labelId"))); + String contractCreateAction = Util.null2String(param.get("contractCreateAction")); + String signOtherAction = Util.null2String(param.get("signOtherAction")); + String contractRevocationAction = Util.null2String(param.get("ContractRevocationAction")); + String workflowField = Util.null2String(param.get("workflowField")); + List> createList = queryMapper.queryActionParam(contractCreateAction); + List> signOtherList = queryMapper.queryActionParam(signOtherAction); + List> contractRevocationList = queryMapper.queryActionParam(contractRevocationAction); + Map contractActionParam = createList.stream().collect(Collectors + .toMap( + item -> Util.null2String(item.get("attrname")), + item -> Util.null2String(item.get("attrvalue")) + ) + ); + Map signOtherActionParam = signOtherList.stream().collect(Collectors + .toMap( + item -> Util.null2String(item.get("attrname")), + item -> Util.null2String(item.get("attrvalue")) + ) + ); + Map contractRevocationParam = contractRevocationList.stream().collect(Collectors + .toMap( + item -> Util.null2String(item.get("attrname")), + item -> Util.null2String(item.get("attrvalue")) + ) + ); + log.info(String.format("contractCreateAction ==> param:%s signOtherAction ==> param:%s contractRevocationAction ==> param:%s", + JSON.toJSONString(contractRevocationParam), + JSON.toJSONString(contractActionParam), + JSON.toJSONString(signOtherActionParam) + )); + List> contractList = queryMapper.queryContractByIds(ids); + List> result = new ArrayList<>(); + for (Map contract : contractList) { + String signStatus = Util.null2String(contract.get("zcgsqszt")); + if("1".equals(signStatus)){ + throw new CustomerException(SystemEnv.getHtmlLabelName(labelId, loginUser.getLanguage())); + } + } + for (Map contract : contractList) { + Map info = new HashMap<>(); + int requestId = Util.getIntValue(String.valueOf(contract.get(workflowField))); + try{ + //合同撤回 + Util.actionTest(CommonContractRevocationAction.class,requestId,contractRevocationParam); + //合同创建 + Util.actionTest(CommonCreateContractAction.class,requestId,contractActionParam); + //对方签署 + Util.actionTest(CommonOneselfSignAction.class,requestId,signOtherActionParam); + }catch (CustomerException exception){ + info.put(String.valueOf(requestId),false); + } + info.put(String.valueOf(requestId),true); + result.add(info); + } + return result; + } +} diff --git a/src/main/java/com/api/bokang/xiao/zhenn/controller/BankController.java b/src/main/java/com/api/bokang/xiao/zhenn/controller/BankController.java new file mode 100644 index 0000000..ba84d67 --- /dev/null +++ b/src/main/java/com/api/bokang/xiao/zhenn/controller/BankController.java @@ -0,0 +1,56 @@ +package com.api.bokang.xiao.zhenn.controller; + +import aiyh.utils.ApiResult; +import aiyh.utils.Util; +import com.api.bokang.xiao.wx_report.service.ReportService; +import com.api.bokang.xiao.wx_report.service.impl.ReportServiceImpl; +import com.api.bokang.xiao.zhenn.service.BankService; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.apache.log4j.Logger; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +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.Map; + +/** + * @ClassName ContractController + * @Author 肖博亢 + * @Date 2023/5/8 16:16 + * @Description

+ **/ +@Path("/xbk/zhenn") +public class BankController { + + private final Logger log = Util.getLogger(); + + private final BankService reportService = new BankService(); + + /** + *

获取搜索组件信息

+ * @param request 请求体 + * @param response 响应体 + * @return 请求结果 + */ + @Path("/getBankData") + @POST + @Produces(MediaType.APPLICATION_JSON) + public String getBankData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map param) { + try{ + log.info("====== into getBankData success ======="); + log.info("param:"+param); + User loginUser = HrmUserVarify.getUser(request, response); + Map reportData = reportService.getBankData(loginUser, param); + return ApiResult.success(reportData); + }catch (Exception e){ + log.error("getBankData error ==> "+Util.getErrString(e)); + return ApiResult.error(e.getMessage()); + } + } +} diff --git a/src/main/java/com/api/bokang/xiao/zhenn/mapper/BankMapper.java b/src/main/java/com/api/bokang/xiao/zhenn/mapper/BankMapper.java new file mode 100644 index 0000000..c9f1693 --- /dev/null +++ b/src/main/java/com/api/bokang/xiao/zhenn/mapper/BankMapper.java @@ -0,0 +1,10 @@ +package com.api.bokang.xiao.zhenn.mapper; + +/** + * @ClassName ContractMapper + * @Author 肖博亢 + * @Date 2023/5/8 16:16 + * @Description

+ **/ +public class BankMapper { +} diff --git a/src/main/java/com/api/bokang/xiao/zhenn/service/BankService.java b/src/main/java/com/api/bokang/xiao/zhenn/service/BankService.java new file mode 100644 index 0000000..33ff78c --- /dev/null +++ b/src/main/java/com/api/bokang/xiao/zhenn/service/BankService.java @@ -0,0 +1,24 @@ +package com.api.bokang.xiao.zhenn.service; + +import weaver.hrm.User; + +import java.util.Map; + +/** + * @ClassName ContractService + * @Author 肖博亢 + * @Date 2023/5/8 16:16 + * @Description

+ **/ +public class BankService { + + /** + *

获取银行数据信息

+ * @param loginUser 登录信息 + * @param param 查询参数 + * @return 银行数据信息 + */ + public Map getBankData(User loginUser, Map param) { + return null; + } +} diff --git a/src/main/java/com/api/bokang/xiao/zscq/mapper/ReserveSelectMapper.java b/src/main/java/com/api/bokang/xiao/zscq/mapper/ReserveSelectMapper.java index d6619f8..2769f5a 100644 --- a/src/main/java/com/api/bokang/xiao/zscq/mapper/ReserveSelectMapper.java +++ b/src/main/java/com/api/bokang/xiao/zscq/mapper/ReserveSelectMapper.java @@ -38,7 +38,7 @@ public interface ReserveSelectMapper { * @param param 参数信息 * @return 建模数据 */ - @Select("select id, $t{applicationNoField}, $t{workflowInfoField}, $t{checkResultField} from $t{modeTableName} where concat(',',concat($t{dateField},',')) like #{datePicker} and ($t{markField} <> 0 or $t{markField} is not null)") + @Select("select id, $t{applicationNoField}, $t{workflowInfoField}, $t{checkResultField} from $t{modeTableName} where concat(',',concat($t{dateField},',')) like #{datePicker} and ($t{markField} <> 0 or $t{markField} is null)") @CaseConversion(value = false) List> queryModeList(Map param); diff --git a/src/main/java/com/api/bokang/xiao/zscq/service/impl/ReserveServiceImpl.java b/src/main/java/com/api/bokang/xiao/zscq/service/impl/ReserveServiceImpl.java index 855b5b2..4813c23 100644 --- a/src/main/java/com/api/bokang/xiao/zscq/service/impl/ReserveServiceImpl.java +++ b/src/main/java/com/api/bokang/xiao/zscq/service/impl/ReserveServiceImpl.java @@ -142,6 +142,7 @@ public class ReserveServiceImpl implements ReserveService { String workflowInfoField = Util.null2String(param.get("workflowInfoField")); String formId = Util.null2String(param.get("formId")); List> modeList = reserveSelectMapper.queryModeList(param); + log.info("triggerModeList ==>"+JSON.toJSONString(modeList)); if(Objects.nonNull(modeList) && !modeList.isEmpty()){ for (Map modeMap : modeList) { Map dealResult = new HashMap<>(); diff --git a/src/main/java/weaver/bokang/xiao/common/CommonUtil.java b/src/main/java/weaver/bokang/xiao/common/CommonUtil.java new file mode 100644 index 0000000..c9cd911 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/CommonUtil.java @@ -0,0 +1,71 @@ +package weaver.bokang.xiao.common; + +import java.util.Map; +import java.util.Set; + +/** + * @ClassName CommonUtil + * @Author 肖博亢 + * @Date 2023/5/11 20:10 + * @Description

+ **/ +public class CommonUtil { + + /** + *

获取更新语句

+ * @param tableName 表名 + * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @return sql语句 + */ + public static String getCusUpdateSql(String tableName, Map updateParam, Map whereParam){ + return buildUpdateSql(tableName,updateParam) + buildWhereSql(whereParam); + } + + /** + *

构建更新sql语句

+ * @param tableName 表名 + * @param updateParam 更新参数 + * @return 更新语句 + */ + public static String buildUpdateSql(String tableName, Map updateParam){ + StringBuilder updateBuilder = new StringBuilder("update "); + updateBuilder.append(tableName).append(" set "); + Set> updateEntries = updateParam.entrySet(); + for (Map.Entry updateEntry : updateEntries) { + if("cusSql".equals(updateEntry.getKey())){ + updateBuilder.append(updateEntry.getValue()); + continue; + } + updateBuilder.append(updateEntry.getKey()) + .append(" = ") + .append("#{updateParam.").append(updateEntry.getKey()).append("},"); + } + return updateBuilder.substring(0, updateBuilder.length() - 1) + " "; + } + + /** + *

构建条件sql语句

+ * @param whereParam 条件参数 + * @return 条件语句 + */ + public static String buildWhereSql(Map whereParam){ + StringBuilder whereBuilder = new StringBuilder(); + Set> whereEntries = whereParam.entrySet(); + for (Map.Entry whereEntry : whereEntries) { + if("cusSql".equals(whereEntry.getKey())){ + whereBuilder.append(" and ").append(whereEntry.getValue()); + continue; + } + whereBuilder.append(" and ") + .append(whereEntry.getKey()) + .append(" = ") + .append("#{whereParam.").append(whereEntry.getKey()).append("},"); + } + String fixStr = whereBuilder.toString(); + if(!"".equals(fixStr)){ + fixStr = fixStr.replaceFirst(" and "," where "); + } + return fixStr.substring(0, fixStr.length() - 1) + " "; + } +} diff --git a/src/main/java/weaver/bokang/xiao/common/mapper/WorkflowMapper.java b/src/main/java/weaver/bokang/xiao/common/mapper/WorkflowMapper.java index f151550..257cf66 100644 --- a/src/main/java/weaver/bokang/xiao/common/mapper/WorkflowMapper.java +++ b/src/main/java/weaver/bokang/xiao/common/mapper/WorkflowMapper.java @@ -1,11 +1,9 @@ package weaver.bokang.xiao.common.mapper; -import aiyh.utils.annotation.recordset.ParamMapper; -import aiyh.utils.annotation.recordset.Select; -import aiyh.utils.annotation.recordset.SqlMapper; -import aiyh.utils.annotation.recordset.Update; +import aiyh.utils.annotation.recordset.*; import java.util.Map; +import java.util.Set; /** * @ClassName WorkflowMapper @@ -38,4 +36,15 @@ public interface WorkflowMapper { @ParamMapper("fieldName") String fieldName, @ParamMapper("fieldValue") String fieldValue, @ParamMapper("requestId") String requestId); + + /** + *

执行自定义更新sql

+ * @param cusSql 自定义sql + * @param updateParam 更新参数信息 + * @param whereParam 条件参数信息 + * @return 查询结果 + */ + @Update(custom = true) + boolean executeUpdateCusSql(@SqlString String cusSql, @ParamMapper("updateParam")Map updateParam, @ParamMapper("whereParam")Map whereParam); + } diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/entity/AssignmentEntity.java b/src/main/java/weaver/bokang/xiao/common/model_update/entity/AssignmentEntity.java new file mode 100644 index 0000000..5100772 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/entity/AssignmentEntity.java @@ -0,0 +1,38 @@ +package weaver.bokang.xiao.common.model_update.entity; + +import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn; +import lombok.Data; + +/** + * @ClassName AssignmentEntity + * @Author 肖博亢 + * @Date 2023/4/4 15:42 + * @Description

+ **/ +@Data +public class AssignmentEntity { + + /** 赋值字段 */ + @SqlOracleDbFieldAnn("ASSIGNMENT_FIELD") + private String assignmentField; + + /** 值选择 */ + @SqlOracleDbFieldAnn("VALUE_SELECT") + private Integer valueSelect; + + /** 源字段 */ + @SqlOracleDbFieldAnn("SOURCE_FIELD") + private String sourceField; + + /** 赋值字段名 */ + @SqlOracleDbFieldAnn("ASSIGNMENT_FIELD_NAME") + private String assignmentFieldName; + + /** 源字段名 */ + @SqlOracleDbFieldAnn("SOURCE_FIELD_NAME") + private String sourceFieldName; + + /** 文本框 */ + @SqlOracleDbFieldAnn("CUS_CONTEXT") + private String cusContext; +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/entity/ConditionEntity.java b/src/main/java/weaver/bokang/xiao/common/model_update/entity/ConditionEntity.java new file mode 100644 index 0000000..12643a8 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/entity/ConditionEntity.java @@ -0,0 +1,46 @@ +package weaver.bokang.xiao.common.model_update.entity; + +import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn; +import lombok.Data; + +/** + * @ClassName ConditionEntity + * @Author 肖博亢 + * @Date 2023/4/4 15:39 + * @Description

+ **/ +@Data +public class ConditionEntity { + + /** 条件类型 */ + @SqlOracleDbFieldAnn("CONDITION_TYPE") + private Integer conditionType; + + /** 条件 */ + @SqlOracleDbFieldAnn("CONDITION_VALUE") + private Integer conditionValue; + + /** 源字段 */ + @SqlOracleDbFieldAnn("CONDITION_SOURCE_FIELD") + private String conditionSourceField; + + /** 值类型 */ + @SqlOracleDbFieldAnn("VALUE_TYPE") + private Integer valueType; + + /** 目标字段 */ + @SqlOracleDbFieldAnn("CONDITION_TARGET_FIELD") + private String conditionTargetField; + + /** 源字段名 */ + @SqlOracleDbFieldAnn("CONDITION_SOURCE_FIELD_NAME") + private String conditionSourceFieldName; + + /** 目标字段名 */ + @SqlOracleDbFieldAnn("CONDITION_TARGET_FIELD_NAME") + private String conditionTargetFieldName; + + /** 文本框 */ + @SqlOracleDbFieldAnn("CUS_TEXT") + private String cusText; +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/entity/UpdateModeConf.java b/src/main/java/weaver/bokang/xiao/common/model_update/entity/UpdateModeConf.java new file mode 100644 index 0000000..61ffeb5 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/entity/UpdateModeConf.java @@ -0,0 +1,59 @@ +package weaver.bokang.xiao.common.model_update.entity; + +import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn; +import lombok.Data; + +import java.util.List; + +/** + * @ClassName UpdateModeConf + * @Author 肖博亢 + * @Date 2023/4/4 15:32 + * @Description

+ **/ +@Data +public class UpdateModeConf { + + /** 源建模 */ + @SqlOracleDbFieldAnn("SOURCE_MODE") + private String sourceMode; + + /** 触发建模 */ + @SqlOracleDbFieldAnn("TARGET_MODE") + private String targetMode; + + /** 说明 */ + @SqlOracleDbFieldAnn("DESCRIPTION") + private String description; + + /** 唯一标识 */ + @SqlOracleDbFieldAnn("UNIQUE_CODE") + private String uniqueCode; + + /** 源表名 */ + @SqlOracleDbFieldAnn("SOURCE_TABLE_NAME") + private String sourceTableName; + + /** 触发表名 */ + @SqlOracleDbFieldAnn("TARGET_TABLE_NAME") + private String targetTableName; + + /** 数据写入方式 */ + @SqlOracleDbFieldAnn("DATA_IN_TYPE") + private Integer dataInType; + + /** 自定义操作类全路径 */ + @SqlOracleDbFieldAnn("OPERATE_PATH") + private String operatePath; + + /** 无条件触发 */ + @SqlOracleDbFieldAnn("NO_RULE") + private Integer noRule; + + /** 条件列表 */ + private List conditionList; + + /** 赋值列表 */ + private List assignmentList; + +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/function/ConditionFunction.java b/src/main/java/weaver/bokang/xiao/common/model_update/function/ConditionFunction.java new file mode 100644 index 0000000..cc6ac78 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/function/ConditionFunction.java @@ -0,0 +1,20 @@ +package weaver.bokang.xiao.common.model_update.function; + +/** + * @ClassName ConditionFunction + * @Author 肖博亢 + * @Date 2023/4/4 17:58 + * @Description

+ **/ +@FunctionalInterface +public interface ConditionFunction { + + /** + *

条件处理

+ * @param p 参数 + * @param q 参数 + * @param k 参数 + * @return 返回值 + */ + R apply(P p,Q q,K k); +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/function/CusOperateInterface.java b/src/main/java/weaver/bokang/xiao/common/model_update/function/CusOperateInterface.java new file mode 100644 index 0000000..819635a --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/function/CusOperateInterface.java @@ -0,0 +1,36 @@ +package weaver.bokang.xiao.common.model_update.function; + +import aiyh.utils.Util; +import org.apache.log4j.Logger; + +import java.util.Map; + +/** + * @ClassName CusOperateInterface + * @Author 肖博亢 + * @Date 2023/4/7 14:52 + * @Description

+ **/ +public interface CusOperateInterface { + + Logger logger = Util.getLogger(); + + /** + *

自定义接口操作

+ * + *

+ * whereParam: 条件参数信息 key为数据库字段名,值为条件值 + * param{ + * tableName:"更新数据表名", + * whereSql:"条件sql", + * operatePath:"接口全路径类名" + * } + * pathParam: 路径参数 + *

+ * + * @param whereParam 条件参数信息 + * @param param 基本参数 + * @param pathParam 路径参数 + */ + void execute(Map whereParam, Map param,Map pathParam); +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/mapper/UpdateModeMapper.java b/src/main/java/weaver/bokang/xiao/common/model_update/mapper/UpdateModeMapper.java new file mode 100644 index 0000000..e50abaf --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/mapper/UpdateModeMapper.java @@ -0,0 +1,108 @@ +package weaver.bokang.xiao.common.model_update.mapper; + +import aiyh.utils.annotation.recordset.*; +import weaver.bokang.xiao.common.model_update.entity.AssignmentEntity; +import weaver.bokang.xiao.common.model_update.entity.ConditionEntity; +import weaver.bokang.xiao.common.model_update.entity.UpdateModeConf; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName UpdateModeMapper + * @Author 肖博亢 + * @Date 2023/4/4 15:47 + * @Description

+ **/ +@SqlMapper +public interface UpdateModeMapper { + + /** + *

通过formId查询相关配置信息

+ * @param formId 表单id + * @return 配置列表 + */ + @Select("select * from uf_update_mode_conf where source_mode = #{formId}") + @CollectionMappings({ + @CollectionMapping(property = "conditionList", column = "id", id = @Id(value = Integer.class, methodId = 1)), + @CollectionMapping(property = "assignmentList", column = "id", id = @Id(value = Integer.class, methodId = 2)), + }) + List queryUpdateModeConfByFormId(@ParamMapper("formId")String formId); + + /** + *

通过formId查询相关配置信息

+ * @return 配置列表 + */ + @Select("select * from uf_update_mode_conf") + @CollectionMappings({ + @CollectionMapping(property = "conditionList", column = "id", id = @Id(value = Integer.class, methodId = 1)), + @CollectionMapping(property = "assignmentList", column = "id", id = @Id(value = Integer.class, methodId = 2)), + }) + List queryUpdateModeConf(); + + /** + *

查询条件列表

+ * @param mainId 主数据id + * @return 条件列表 + */ + @Select("select * from uf_update_mode_conf_dt1 where mainid = #{mainId}") + @CollectionMethod(1) + List queryConditionList(@ParamMapper("mainId")int mainId); + + /** + *

查询赋值列表

+ * @param mainId 主数据id + * @return 赋值列表 + */ + @Select("select * from uf_update_mode_conf_dt2 where mainid = #{mainId}") + @CollectionMethod(2) + List queryAssignmentList(@ParamMapper("mainId")int mainId); + + /** + *

执行自定义查询sql

+ * @param cusSql 自定义sql + * @param param 参数信息 + * @param cusParam 参数信息 + * @return 查询结果 + */ + @Select(custom = true) + String executeCusSql(@SqlString String cusSql, @ParamMapper("param")Map param,Map cusParam); + + /** + *

执行自定义查询sql

+ * @param cusSql 自定义sql + * @param whereParam 参数信息 + * @param cusParam 参数信息 + * @return 查询结果 + */ + @Select(custom = true) + Map executeCusSqlMap(@SqlString String cusSql, + @ParamMapper("whereParam")Map whereParam, + @ParamMapper("cusParam")Map cusParam); + + /** + *

执行自定义查询sql

+ * @param cusSql 自定义sql + * @param whereParam 参数信息 + * @param cusParam 参数信息 + * @return 查询结果 + */ + @Select(custom = true) + List> executeCusSqlList(@SqlString String cusSql, + @ParamMapper("whereParam")Map whereParam, + @ParamMapper("cusParam")Map cusParam); + + + /** + *

执行自定义更新sql

+ * @param cusSql 自定义sql + * @param updateParam 更新参数信息 + * @param whereParam 条件参数信息 + * @return 查询结果 + */ + @Update(custom = true) + boolean executeUpdateCusSql(@SqlString String cusSql, + @ParamMapper("updateParam")Map updateParam, + @ParamMapper("whereParam")Map whereParam); + +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/process/ConditionTargetProcess.java b/src/main/java/weaver/bokang/xiao/common/model_update/process/ConditionTargetProcess.java new file mode 100644 index 0000000..f470bfe --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/process/ConditionTargetProcess.java @@ -0,0 +1,131 @@ +package weaver.bokang.xiao.common.model_update.process; + +import aiyh.utils.Util; +import aiyh.utils.annotation.MethodRuleNo; +import org.apache.log4j.Logger; +import weaver.bokang.xiao.common.model_update.function.ConditionFunction; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + + +/** + * @ClassName ConditionTargetProcess + * @Author 肖博亢 + * @Date 2023/4/4 17:54 + * @Description

目标建模条件sql生成处理

+ **/ +public class ConditionTargetProcess { + + public static final Map,Map,String>> TARGET_MODE_METHOD_MAP = new HashMap<>(); + + public static final Logger logger = Util.getLogger(); + + static { + try { + Class valueRuleMethodClass = ConditionTargetProcess.class; + Method[] methods = valueRuleMethodClass.getDeclaredMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(MethodRuleNo.class)) { + MethodRuleNo annotation = method.getAnnotation(MethodRuleNo.class); + int value = annotation.value(); + TARGET_MODE_METHOD_MAP.put(value, (whereParam,param,whereSql) -> { + try { + return (String) method.invoke(null,whereParam,param,whereSql); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + }); + } + } + }catch (Exception exception){ + logger.error("ConditionTargetProcess init error !!! "+Util.getErrString(exception)); + } + } + + /** + *

目标建模等于处理方法

+ * @param whereParam 条件参数 + * @param param 参数信息 + * @param whereSql 条件sql + * @return 条件sql + */ + @MethodRuleNo(value = 0, desc = "等于") + public static String equals(Map whereParam,Map param,String whereSql) { + String conditionValue = Util.null2String(param.get("conditionValue")); + String targetFieldName = Util.null2String(param.get("targetFieldName")); + String targetStr = " and "+targetFieldName+" = #{whereParam."+targetFieldName+"}"; + whereSql += targetStr; + whereParam.put(targetFieldName,conditionValue); + return whereSql; + } + + /** + *

目标建模不等于处理方法

+ * @param whereParam 条件参数 + * @param param 参数信息 + * @param whereSql 条件sql + * @return 条件sql + */ + @MethodRuleNo(value = 1, desc = "不等于") + public static String noEquals(Map whereParam,Map param,String whereSql) { + String conditionValue = Util.null2String(param.get("conditionValue")); + String targetFieldName = Util.null2String(param.get("targetFieldName")); + String targetStr = " and "+targetFieldName+" <> #{whereParam."+targetFieldName+"}"; + whereSql += targetStr; + whereParam.put(targetFieldName,conditionValue); + return whereSql; + } + + /** + *

目标建模不等于处理方法

+ * @param whereParam 条件参数 + * @param param 参数信息 + * @param whereSql 条件sql + * @return 条件sql + */ + @MethodRuleNo(value = 6, desc = "in") + public static String in(Map whereParam,Map param,String whereSql) { + String conditionValue = Util.null2String(param.get("conditionValue")); + String targetFieldName = Util.null2String(param.get("targetFieldName")); + String targetStr = " and "+targetFieldName+" in ( $t{whereParam."+targetFieldName+"})"; + whereSql += targetStr; + whereParam.put(targetFieldName,conditionValue); + return whereSql; + } + + /** + *

目标建模不等于处理方法

+ * @param whereParam 条件参数 + * @param param 参数信息 + * @param whereSql 条件sql + * @return 条件sql + */ + @MethodRuleNo(value = 7, desc = "not in") + public static String notIn(Map whereParam,Map param,String whereSql) { + String conditionValue = Util.null2String(param.get("conditionValue")); + String targetFieldName = Util.null2String(param.get("targetFieldName")); + String targetStr = " and "+targetFieldName+" not in ( $t{whereParam."+targetFieldName+"})"; + whereSql += targetStr; + whereParam.put(targetFieldName,conditionValue); + return whereSql; + } + + /** + *

目标建模不等于处理方法

+ * @param whereParam 条件参数 + * @param param 参数信息 + * @param whereSql 条件sql + * @return 条件sql + */ + @MethodRuleNo(value = 8, desc = "自定义sql") + public static String cusSql(Map whereParam,Map param,String whereSql) { + String conditionValue = Util.null2String(param.get("conditionValue")); + String targetStr = " and "+Util.sbc2dbcCase(conditionValue); + whereSql += targetStr; + return whereSql; + } + +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/process/ConditionValueProcess.java b/src/main/java/weaver/bokang/xiao/common/model_update/process/ConditionValueProcess.java new file mode 100644 index 0000000..d428a60 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/process/ConditionValueProcess.java @@ -0,0 +1,98 @@ +package weaver.bokang.xiao.common.model_update.process; + +import aiyh.utils.Util; +import aiyh.utils.annotation.MethodRuleNo; +import org.apache.log4j.Logger; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.function.BiFunction; + +/** + * @ClassName ConditionValueProcess + * @Author 肖博亢 + * @Date 2023/4/4 16:19 + * @Description

源建模数据判读条件相关处理

+ **/ +public class ConditionValueProcess { + + public static final Map> SOURCE_MODE_METHOD_MAP = new HashMap<>(); + + + public static final Logger logger = Util.getLogger(); + + static { + try { + Class valueRuleMethodClass = ConditionValueProcess.class; + Method[] methods = valueRuleMethodClass.getDeclaredMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(MethodRuleNo.class)) { + MethodRuleNo annotation = method.getAnnotation(MethodRuleNo.class); + int value = annotation.value(); + SOURCE_MODE_METHOD_MAP.put(value, (sourceValue, conditionValue) -> { + try { + return (Boolean) method.invoke(null,sourceValue, conditionValue); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + }); + } + } + }catch (Exception exception){ + logger.error("ConditionValueProcess init error !!! "+Util.getErrString(exception)); + } + } + + /** + *

源建模等于处理方法

+ * @param sourceValue 源建模值 + * @param value 目标值 + * @return 是否符合 + */ + @MethodRuleNo(value = 0, desc = "等于") + public static boolean equals(String sourceValue, String value) { + return sourceValue.equals(value); + } + + /** + *

源建模不等于处理方法

+ * @param sourceValue 源建模值 + * @param value 目标值 + * @return 是否符合 + */ + @MethodRuleNo(value = 1, desc = "不等于") + public static boolean noEquals(String sourceValue, String value) { + return !sourceValue.equals(value); + } + + /** + *

源建模不等于处理方法

+ * @param sourceValue 源建模值 + * @param value 目标值 + * @return 是否符合 + */ + @MethodRuleNo(value = 6, desc = "in") + public static boolean in(String sourceValue, String value) { + if("".equals(sourceValue) || "".equals(value)){ + return false; + } + String tempStr = ","+value+","; + sourceValue = "," + sourceValue + ","; + return tempStr.contains(sourceValue); + } + + /** + *

源建模不等于处理方法

+ * @param sourceValue 源建模值 + * @param value 目标值 + * @return 是否符合 + */ + @MethodRuleNo(value = 7, desc = "not in") + public static boolean notIn(String sourceValue, String value) { + return !in(sourceValue, value); + } + + +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/process/DataTypeProcess.java b/src/main/java/weaver/bokang/xiao/common/model_update/process/DataTypeProcess.java new file mode 100644 index 0000000..fe860a5 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/process/DataTypeProcess.java @@ -0,0 +1,253 @@ +package weaver.bokang.xiao.common.model_update.process; + +import aiyh.utils.Util; +import aiyh.utils.annotation.MethodRuleNo; +import aiyh.utils.excention.CustomerException; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import weaver.bokang.xiao.common.model_update.function.ConditionFunction; +import weaver.bokang.xiao.common.model_update.function.CusOperateInterface; +import weaver.bokang.xiao.common.model_update.mapper.UpdateModeMapper; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + + +/** + * @ClassName DataTypeProcess + * @Author 肖博亢 + * @Date 2023/4/6 13:10 + * @Description

建模数据更新处理

+ **/ +public class DataTypeProcess { + + public static final Map,Map, Map>> SOURCE_MODE_METHOD_MAP = new HashMap<>(); + + private static final UpdateModeMapper UPDATE_MODE_MAPPER = Util.getMapper(UpdateModeMapper.class); + + public static final Logger logger = Util.getLogger(); + + static { + try { + Class valueRuleMethodClass = DataTypeProcess.class; + Method[] methods = valueRuleMethodClass.getDeclaredMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(MethodRuleNo.class)) { + MethodRuleNo annotation = method.getAnnotation(MethodRuleNo.class); + int value = annotation.value(); + SOURCE_MODE_METHOD_MAP.put(value, (updateParam, whereParam,param) -> { + try { + return (boolean) method.invoke(null,updateParam, whereParam,param); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + }); + } + } + }catch (Exception exception){ + logger.error("DataTypeProcess init error !!! "+Util.getErrString(exception)); + } + } + + /** + *

更新处理方法

+ * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @param param 表参数 + * @return 更新字符串 + */ + @MethodRuleNo(value = 0, desc = "更新") + public static boolean update(Map updateParam, Map whereParam,Map param) { + String tableName = Util.null2String(param.get("tableName")); + String whereSql = Util.null2String(param.get("whereSql")); + String updateSql = DataTypeProcess.buildUpdateSql(tableName, updateParam); + if(!"".equals(whereSql)){ + whereSql = whereSql.replaceFirst(" and "," where "); + } + updateSql = updateSql + whereSql; + logger.info(String.format("updateSql ==> %s updateParam ==> %s whereParam ==> %s",updateSql,updateParam,whereParam)); + return UPDATE_MODE_MAPPER.executeUpdateCusSql(updateSql, updateParam, whereParam); + } + + /** + *

插入处理方法

+ * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @param param 表参数 + * @return 更新字符串 + */ + @MethodRuleNo(value = 1, desc = "插入") + public static boolean insert(Map updateParam, Map whereParam,Map param) { + String tableName = Util.null2String(param.get("tableName")); + String modeId = Util.getModeIdByTableName(tableName); + int dataId = Util.getModeDataId(tableName, Util.getIntValue(modeId), 1); + whereParam.clear(); + whereParam.put("id",dataId); + String updateSql = buildUpdateSql(tableName, updateParam); + String whereSql = DataTypeProcess.buildWhereSql(whereParam); + updateSql = updateSql + " " + whereSql; + logger.info(String.format("updateSql ==> %s updateParam ==> %s whereParam ==> %s",updateSql,updateParam,whereParam)); + return UPDATE_MODE_MAPPER.executeUpdateCusSql(updateSql,updateParam,whereParam); + } + + /** + *

执行自定义处理方法

+ * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @param param 表参数 + * @return 执行结果 + */ + @MethodRuleNo(value = 2,desc = "自定义操作") + public static boolean cusOperate(Map updateParam, Map whereParam,Map param) { + String operatePath = Util.null2String(param.get("operatePath")); + if(StringUtils.isBlank(operatePath)){ + throw new CustomerException("操作全路径不能为空"); + } + Map pathParam = new HashMap<>(); + try { + CusOperateInterface cusInterfaceObj = getCusInterfaceObj(operatePath, CusOperateInterface.class, pathParam); + cusInterfaceObj.execute(whereParam,param,pathParam); + }catch (Exception e){ + logger.error("自定义处理类执行异常 ==>"+Util.getErrString(e)); + throw new CustomerException(e); + } + return true; + } + + /** + *

更新并执行自定义处理方法

+ * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @param param 表参数 + * @return 执行结果 + */ + @MethodRuleNo(value = 3,desc = "更新并执行自定义操作") + public static boolean cusAndUpdate(Map updateParam, Map whereParam,Map param) { + return update(updateParam,whereParam,param) && cusOperate(updateParam,whereParam,param); + } + + /** + *

插入并执行自定义处理方法

+ * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @param param 表参数 + * @return 执行结果 + */ + @MethodRuleNo(value = 4,desc = "插入并执行自定义操作") + public static boolean cusAndInsert(Map updateParam, Map whereParam,Map param) { + return insert(updateParam,whereParam,param) && cusOperate(updateParam,whereParam,param); + } + + /** + *

更新并执行自定义处理方法

+ * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @param param 表参数 + * @return 执行结果 + */ + @MethodRuleNo(value = 5,desc = "执行自定义操作并更新") + public static boolean updateAndCus(Map updateParam, Map whereParam,Map param) { + return cusOperate(updateParam,whereParam,param) && update(updateParam,whereParam,param); + } + + /** + *

插入并执行自定义处理方法

+ * @param updateParam 更新参数 + * @param whereParam 条件参数 + * @param param 表参数 + * @return 执行结果 + */ + @MethodRuleNo(value = 6,desc = "执行自定义操作并插入") + public static boolean insertAndCus(Map updateParam, Map whereParam,Map param) { + return cusOperate(updateParam,whereParam,param) && insert(updateParam,whereParam,param); + } + + /** + *

构建更新sql语句

+ * @param tableName 表名 + * @param updateParam 更新参数 + * @return 更新语句 + */ + public static String buildUpdateSql(String tableName, Map updateParam){ + StringBuilder updateBuilder = new StringBuilder("update "); + updateBuilder.append(tableName).append(" set "); + Set> updateEntries = updateParam.entrySet(); + for (Map.Entry updateEntry : updateEntries) { + if("cusSql".equals(updateEntry.getKey())){ + updateBuilder.append(updateEntry.getValue()); + continue; + } + updateBuilder.append(updateEntry.getKey()) + .append(" = ") + .append("#{updateParam.").append(updateEntry.getKey()).append("},"); + } + return updateBuilder.substring(0, updateBuilder.length() - 1) + " "; + } + + /** + *

构建条件sql语句

+ * @param whereParam 条件参数 + * @return 条件语句 + */ + public static String buildWhereSql(Map whereParam){ + StringBuilder whereBuilder = new StringBuilder(); + Set> whereEntries = whereParam.entrySet(); + for (Map.Entry whereEntry : whereEntries) { + if("cusSql".equals(whereEntry.getKey())){ + whereBuilder.append(" and ").append(whereEntry.getValue()); + continue; + } + whereBuilder.append(" and ") + .append(whereEntry.getKey()) + .append("#{whereParam.").append(whereEntry.getKey()).append("},"); + } + String fixStr = whereBuilder.toString(); + if(!"".equals(fixStr)){ + fixStr = fixStr.replaceFirst(" and "," where "); + } + return fixStr; + } + + /** + *

+ * @param path 全路径类名 + * @param clazz 父类接口 + * @param pathParamMap 路径参数 + * @return 接口实现类 + * @param 泛型 + */ + public static T getCusInterfaceObj(String path, Class clazz, Map pathParamMap) { + + path = Util.sbc2dbcCase(path); + String[] split = path.split("\\?"); + String classPath = split[0]; + Class aClass; + try { + aClass = Class.forName(classPath); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException("未能找到自定义接口:" + classPath); + } + if (!clazz.isAssignableFrom(aClass)) { + throw new IllegalArgumentException("自定义接口:" + classPath + " 不是" + + clazz.getName() + "的子类或实现类!"); + } + Constructor constructor; + try { + constructor = aClass.getConstructor(); + } catch (NoSuchMethodException e) { + throw new IllegalArgumentException(classPath + "没有空参构造方法,无法获取构造方法对象!"); + } + T o; + try { + o = (T) constructor.newInstance(); + } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { + throw new IllegalArgumentException("无法构造" + classPath + "对象!"); + } + pathParamMap.putAll(Util.parseCusInterfacePathParam(path)); + return o; + } +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/process/ValueSelectProcess.java b/src/main/java/weaver/bokang/xiao/common/model_update/process/ValueSelectProcess.java new file mode 100644 index 0000000..012630f --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/process/ValueSelectProcess.java @@ -0,0 +1,106 @@ +package weaver.bokang.xiao.common.model_update.process; + +import aiyh.utils.Util; +import aiyh.utils.annotation.MethodRuleNo; +import aiyh.utils.excention.CustomerException; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import weaver.bokang.xiao.common.model_update.entity.AssignmentEntity; +import weaver.bokang.xiao.common.model_update.mapper.UpdateModeMapper; +import weaver.general.TimeUtil; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.function.BiFunction; + +/** + * @ClassName ValueSelectProcess + * @Author 肖博亢 + * @Date 2023/4/6 12:42 + * @Description

赋值 - 取值类型相关处理

+ **/ +public class ValueSelectProcess { + + public static final Map, AssignmentEntity, String>> SOURCE_MODE_METHOD_MAP = new HashMap<>(); + + private static final UpdateModeMapper UPDATE_MODE_MAPPER = Util.getMapper(UpdateModeMapper.class); + + public static final Logger logger = Util.getLogger(); + + static { + try { + Class valueRuleMethodClass = ValueSelectProcess.class; + Method[] methods = valueRuleMethodClass.getDeclaredMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(MethodRuleNo.class)) { + MethodRuleNo annotation = method.getAnnotation(MethodRuleNo.class); + int value = annotation.value(); + SOURCE_MODE_METHOD_MAP.put(value, (modeMap, assignment) -> { + try { + return (String) method.invoke(null,modeMap, assignment); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + }); + } + } + }catch (Exception exception){ + logger.error("ValueTypeProcess init error !!! "+Util.getErrString(exception)); + } + } + + /** + *

默认值处理方法

+ * @param modeMap 源建模值 + * @param assignment 赋值实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 0, desc = "默认值") + public static String defaultValue(Map modeMap, AssignmentEntity assignment) { + return assignment.getCusContext(); + } + + /** + *

建模字段处理方法

+ * @param modeMap 源建模值 + * @param assignment 赋值实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 1, desc = "建模字段") + public static String modeField(Map modeMap, AssignmentEntity assignment) { + return Util.null2String(modeMap.get(assignment.getSourceFieldName())); + } + + /** + *

自定义sql处理方法

+ * @param modeMap 源建模值 + * @param assignment 赋值实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 2, desc = "自定义sql") + public static String cusSql(Map modeMap, AssignmentEntity assignment) { + String cusSqlStr = Util.null2String(assignment.getCusContext()); + cusSqlStr = Util.dbc2sbcCase(cusSqlStr); + if(StringUtils.isBlank(cusSqlStr)){ + throw new CustomerException("选择自定义sql时,sql字符串不能为空"); + } + if(!cusSqlStr.startsWith("select ")){ + throw new CustomerException("选择自定义sql时,不允许执行除select之外的其他危险操作 !!!"); + } + return UPDATE_MODE_MAPPER.executeCusSql(cusSqlStr, modeMap,new HashMap<>()); + } + + /** + *

当前时间处理方法

+ * @param modeMap 源建模值 + * @param assignment 赋值实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 3, desc = "当前时间") + public static String currentTime(Map modeMap, AssignmentEntity assignment) { + return TimeUtil.getCurrentTimeString(); + } + +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/process/ValueTypeProcess.java b/src/main/java/weaver/bokang/xiao/common/model_update/process/ValueTypeProcess.java new file mode 100644 index 0000000..bc9594d --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/process/ValueTypeProcess.java @@ -0,0 +1,106 @@ +package weaver.bokang.xiao.common.model_update.process; + +import aiyh.utils.Util; +import aiyh.utils.annotation.MethodRuleNo; +import aiyh.utils.excention.CustomerException; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import weaver.bokang.xiao.common.model_update.entity.ConditionEntity; +import weaver.bokang.xiao.common.model_update.mapper.UpdateModeMapper; +import weaver.general.TimeUtil; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.function.BiFunction; + +/** + * @ClassName ValueTypeProcess + * @Author 肖博亢 + * @Date 2023/4/4 16:18 + * @Description

条件配置 - 取值类型相关处理

+ **/ +public class ValueTypeProcess { + + public static final Map, ConditionEntity, String>> SOURCE_MODE_METHOD_MAP = new HashMap<>(); + + private static final UpdateModeMapper UPDATE_MODE_MAPPER = Util.getMapper(UpdateModeMapper.class); + + public static final Logger logger = Util.getLogger(); + + static { + try { + Class valueRuleMethodClass = ValueTypeProcess.class; + Method[] methods = valueRuleMethodClass.getDeclaredMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(MethodRuleNo.class)) { + MethodRuleNo annotation = method.getAnnotation(MethodRuleNo.class); + int value = annotation.value(); + SOURCE_MODE_METHOD_MAP.put(value, (modeMap, condition) -> { + try { + return (String) method.invoke(null,modeMap, condition); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + }); + } + } + }catch (Exception exception){ + logger.error("ValueTypeProcess init error !!! "+Util.getErrString(exception)); + } + } + + /** + *

默认值处理方法

+ * @param modeMap 源建模值 + * @param condition 条件实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 0, desc = "默认值") + public static String defaultValue(Map modeMap, ConditionEntity condition) { + return condition.getCusText(); + } + + /** + *

建模字段处理方法

+ * @param modeMap 源建模值 + * @param condition 条件实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 1, desc = "建模字段") + public static String modeField(Map modeMap, ConditionEntity condition) { + return Util.null2String(modeMap.get(condition.getConditionSourceFieldName())); + } + + /** + *

自定义sql处理方法

+ * @param modeMap 源建模值 + * @param condition 条件实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 2, desc = "自定义sql") + public static String cusSql(Map modeMap, ConditionEntity condition) { + String cusSqlStr = Util.null2String(condition.getCusText()); + cusSqlStr = Util.dbc2sbcCase(cusSqlStr); + if(StringUtils.isBlank(cusSqlStr)){ + throw new CustomerException("选择自定义sql时,sql字符串不能为空"); + } + if(!cusSqlStr.startsWith("select ")){ + throw new CustomerException("选择自定义sql时,不允许执行除select之外的其他危险操作 !!!"); + } + return UPDATE_MODE_MAPPER.executeCusSql(cusSqlStr, modeMap,new HashMap<>()); + } + + /** + *

当前时间处理方法

+ * @param modeMap 源建模值 + * @param condition 条件实体信息 + * @return 值信息 + */ + @MethodRuleNo(value = 3, desc = "当前时间") + public static String currentTime(Map modeMap, ConditionEntity condition) { + return TimeUtil.getCurrentTimeString(); + } + +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/service/ModeChangeService.java b/src/main/java/weaver/bokang/xiao/common/model_update/service/ModeChangeService.java new file mode 100644 index 0000000..246529e --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/service/ModeChangeService.java @@ -0,0 +1,248 @@ +package weaver.bokang.xiao.common.model_update.service; + +import aiyh.utils.Util; +import com.alibaba.fastjson.JSON; +import org.apache.log4j.Logger; +import weaver.bokang.xiao.common.model_update.entity.AssignmentEntity; +import weaver.bokang.xiao.common.model_update.entity.ConditionEntity; +import weaver.bokang.xiao.common.model_update.entity.UpdateModeConf; +import weaver.bokang.xiao.common.model_update.function.ConditionFunction; +import weaver.bokang.xiao.common.model_update.mapper.UpdateModeMapper; +import weaver.bokang.xiao.common.model_update.process.*; +import weaver.bokang.xiao.common.model_update.store.TableNameStore; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.BiFunction; +import java.util.stream.Collectors; + +/** + * @ClassName ModeChangeService + * @Author 肖博亢 + * @Date 2023/4/6 11:28 + * @Description

+ **/ +public class ModeChangeService { + + public final Logger logger = Util.getLogger(); + + private final UpdateModeMapper updateModeMapper = Util.getMapper(UpdateModeMapper.class); + + /** + *

更新其他建模信息

+ * @param modeMap 模块数据 + * @param formId 表单id + * @param triggerType 触发方式 0:无条件触发; 1:建模更新触发; 2:其他触发 + */ + public void changeOtherMode(Map modeMap, String formId,int triggerType){ + Map> triggerStore = TableNameStore.getInstance().getTriggerStore(); + List updateModeConfList = triggerStore.get(formId); + if(Objects.isNull(updateModeConfList) || updateModeConfList.isEmpty()){ + logger.error(String.format("此表单建模[%s] 未配置相关更新信息,请检查!!!",formId)); + return; + } + List collect = updateModeConfList.stream().filter(item -> item.getNoRule() == triggerType).collect(Collectors.toList()); + if(collect.isEmpty()){ + logger.error(String.format("此表单建模[%s] 未配置相关更新信息,请检查!!!",formId)); + return; + } + doChange(modeMap,collect); + } + + /** + *

更新其他建模信息

+ * @param formId 原建模表单ID + */ + public void changeOtherMode(String formId){ + Map> triggerStore = TableNameStore.getInstance().getTriggerStore(); + List updateModeConfList = triggerStore.get(formId); + if(Objects.isNull(updateModeConfList) || updateModeConfList.isEmpty()){ + logger.error(String.format("此建模[%s] 未配置相关更新信息,请检查!!!",formId)); + return; + } + doChange(updateModeConfList); + } + + /** + *

更新其他表数据的具体方法

+ * @param updateModeConfList 配置参数列表 + */ + private void doChange(List updateModeConfList){ + for (UpdateModeConf updateModeConf : updateModeConfList) { + List conditionList = updateModeConf.getConditionList(); + Integer noRule = updateModeConf.getNoRule(); + String sourceTableName = updateModeConf.getSourceTableName(); + if(noRule == 1 && conditionList.isEmpty()){ + logger.error(String.format("没有条件设置,不允许建模 %s 更新",updateModeConf.getTargetTableName())); + continue; + } + logger.info(String.format("处理配置 deal config [%s - %s]",updateModeConf.getUniqueCode(),updateModeConf.getDescription())); + if(Objects.nonNull(conditionList) && !conditionList.isEmpty()){ + //条件数据 + Map whereParam = new HashMap<>(8); + Map> collect = conditionList.stream().collect(Collectors.groupingBy(ConditionEntity::getConditionType)); + //获取源建模数据判断条件配置列表 + List sourceConditions = collect.get(0); + //获取目标建模条件生成配置列表 + List targetConditions = collect.get(1); + //生成查询sql + if(Objects.nonNull(sourceConditions) && !sourceConditions.isEmpty()) { + String whereSql = getWhereSql(new HashMap<>(), sourceConditions, whereParam); + String querySql = "select * from " + sourceTableName + whereSql; + List> modeDataList = updateModeMapper.executeCusSqlList(querySql, whereParam, new HashMap<>()); + if(Objects.nonNull(modeDataList) && !modeDataList.isEmpty()){ + for (Map modeMap : modeDataList) { + updateOtherModel(modeMap,updateModeConf,targetConditions); + } + } + } + } + } + } + + /** + *

更新其他表的数据

+ * @param modeMap 原建模数据 + * @param updateModeConf 配置信息 + * @param targetConditions 条件判断 + */ + private void updateOtherModel(Map modeMap,UpdateModeConf updateModeConf,List targetConditions){ + List assignmentList = updateModeConf.getAssignmentList(); + Integer dataInType = updateModeConf.getDataInType(); + //赋值数据 + Map assignmentMap = new HashMap<>(8); + //条件sql + String whereSql = ""; + //条件数据 + Map whereParam = new HashMap<>(8); + //根据赋值配置组装数据 + if(Objects.nonNull(assignmentList) && !assignmentList.isEmpty()){ + //根据配置信息生成条件sql + if(Objects.nonNull(targetConditions) && !targetConditions.isEmpty()) { + getWhereSql(modeMap,targetConditions,whereParam); + } + for (AssignmentEntity assignmentEntity : assignmentList) { + BiFunction, AssignmentEntity, String> valueFunction = ValueSelectProcess.SOURCE_MODE_METHOD_MAP.get(assignmentEntity.getValueSelect()); + String assignmentValue = valueFunction.apply(modeMap, assignmentEntity); + assignmentMap.put(assignmentEntity.getAssignmentFieldName(),assignmentValue); + } + //执行数据操作 + ConditionFunction, Map, Map> dataInFunction = DataTypeProcess.SOURCE_MODE_METHOD_MAP.get(dataInType); + Map tableMap = new HashMap<>(8); + tableMap.put("tableName",updateModeConf.getTargetTableName()); + tableMap.put("whereSql",whereSql); + tableMap.put("operatePath",updateModeConf.getOperatePath()); + boolean executeFlag = dataInFunction.apply(assignmentMap, whereParam, tableMap); + logger.info("更新结果 executeFlag ==>"+executeFlag); + } + } + + /** + *

获取配置条件sql

+ * @param modeMap 原建模数据 + * @param conditions 条件参数 + * @param whereParam 返回的参数新 + * @return whereSql + */ + private String getWhereSql(Map modeMap,List conditions,Map whereParam){ + //条件sql + String whereSql = ""; + for (ConditionEntity targetCondition : conditions) { + BiFunction, ConditionEntity, String> valueFunction = ValueTypeProcess.SOURCE_MODE_METHOD_MAP.get(targetCondition.getValueType()); + ConditionFunction, Map, String> conditionFunction = ConditionTargetProcess.TARGET_MODE_METHOD_MAP.get(targetCondition.getConditionValue()); + String sourceValue = Util.null2String(modeMap.get(targetCondition.getConditionSourceFieldName())); + String conditionValue = valueFunction.apply(modeMap, targetCondition); + Map param = new HashMap<>(8); + param.put("sourceValue", sourceValue); + param.put("conditionValue", conditionValue); + param.put("targetFieldName", targetCondition.getConditionTargetFieldName()); + whereSql = conditionFunction.apply(whereParam, param, whereSql); + } + return whereSql; + } + + /** + *

更新其他表数据的具体方法

+ * @param modeMap 源建模数据 + * @param updateModeConfList 配置参数列表 + */ + private void doChange(Map modeMap,List updateModeConfList){ + for (UpdateModeConf updateModeConf : updateModeConfList) { + List conditionList = updateModeConf.getConditionList(); + List assignmentList = updateModeConf.getAssignmentList(); + Integer dataInType = updateModeConf.getDataInType(); + Integer noRule = updateModeConf.getNoRule(); + if(noRule == 1 && conditionList.isEmpty()){ + logger.error(String.format("没有条件设置,不允许建模 %s 更新",updateModeConf.getTargetTableName())); + continue; + } + logger.info(String.format("处理配置 deal config [%s - %s]",updateModeConf.getUniqueCode(),updateModeConf.getDescription())); + //条件sql + String whereSql = ""; + //条件数据 + Map whereParam = new HashMap<>(8); + //赋值数据 + Map assignmentMap = new HashMap<>(8); + if(Objects.nonNull(conditionList) && !conditionList.isEmpty()){ + Map> collect = conditionList.stream().collect(Collectors.groupingBy(ConditionEntity::getConditionType)); + //获取源建模数据判断条件配置列表 + List sourceConditions = collect.get(0); + //获取目标建模条件生成配置列表 + List targetConditions = collect.get(1); + boolean flag = false; + //判断源建模数据是否需要触发更新 + if(Objects.nonNull(sourceConditions) && !sourceConditions.isEmpty()) { + for (ConditionEntity sourceCondition : sourceConditions) { + BiFunction, ConditionEntity, String> valueFunction = ValueTypeProcess.SOURCE_MODE_METHOD_MAP.get(sourceCondition.getValueType()); + BiFunction conditionFunction = ConditionValueProcess.SOURCE_MODE_METHOD_MAP.get(sourceCondition.getConditionValue()); + String sourceValue = Util.null2String(modeMap.get(sourceCondition.getConditionSourceFieldName())); + String conditionValue = valueFunction.apply(modeMap, sourceCondition); + Boolean result = conditionFunction.apply(sourceValue, conditionValue); + if (!result) { + flag = true; + break; + } + } + if (flag) { + logger.info("源建模条件判断不通过,此条数据跳过 sourceMode condition fail !!! "+JSON.toJSONString(modeMap)); + continue; + } + } + //根据配置信息生成条件sql + if(Objects.nonNull(targetConditions) && !targetConditions.isEmpty()) { + for (ConditionEntity targetCondition : targetConditions) { + BiFunction, ConditionEntity, String> valueFunction = ValueTypeProcess.SOURCE_MODE_METHOD_MAP.get(targetCondition.getValueType()); + ConditionFunction, Map, String> conditionFunction = ConditionTargetProcess.TARGET_MODE_METHOD_MAP.get(targetCondition.getConditionValue()); + String sourceValue = Util.null2String(modeMap.get(targetCondition.getConditionSourceFieldName())); + String conditionValue = valueFunction.apply(modeMap, targetCondition); + Map param = new HashMap<>(8); + param.put("sourceValue", sourceValue); + param.put("conditionValue", conditionValue); + param.put("targetFieldName", targetCondition.getConditionTargetFieldName()); + whereSql = conditionFunction.apply(whereParam, param, whereSql); + } + } + } + //根据赋值配置组装数据 + if(Objects.nonNull(assignmentList) && !assignmentList.isEmpty()){ + for (AssignmentEntity assignmentEntity : assignmentList) { + BiFunction, AssignmentEntity, String> valueFunction = ValueSelectProcess.SOURCE_MODE_METHOD_MAP.get(assignmentEntity.getValueSelect()); + String assignmentValue = valueFunction.apply(modeMap, assignmentEntity); + assignmentMap.put(assignmentEntity.getAssignmentFieldName(),assignmentValue); + } + } + //执行数据操作 + ConditionFunction, Map, Map> dataInFunction = DataTypeProcess.SOURCE_MODE_METHOD_MAP.get(dataInType); + Map tableMap = new HashMap<>(8); + tableMap.put("tableName",updateModeConf.getTargetTableName()); + tableMap.put("whereSql",whereSql); + tableMap.put("operatePath",updateModeConf.getOperatePath()); + boolean executeFlag = dataInFunction.apply(assignmentMap, whereParam, tableMap); + logger.info("更新结果 executeFlag ==>"+executeFlag); + } + } + + +} diff --git a/src/main/java/weaver/bokang/xiao/common/model_update/store/TableNameStore.java b/src/main/java/weaver/bokang/xiao/common/model_update/store/TableNameStore.java new file mode 100644 index 0000000..425724e --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/common/model_update/store/TableNameStore.java @@ -0,0 +1,68 @@ +package weaver.bokang.xiao.common.model_update.store; + +import aiyh.utils.Util; +import com.alibaba.fastjson.JSON; +import lombok.Getter; +import org.apache.log4j.Logger; +import weaver.bokang.xiao.common.model_update.entity.UpdateModeConf; +import weaver.bokang.xiao.common.model_update.mapper.UpdateModeMapper; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @ClassName VendorStore + * @Author 肖博亢 + * @Date 2023/3/17 18:31 + * @Description

+ **/ + +@Getter +public class TableNameStore { + + private final Map tableNameStore = new HashMap<>(); + + private final Map> triggerStore = new HashMap<>(); + + private final Map> uniqueTriggerStore = new HashMap<>(); + + private final UpdateModeMapper updateModeMapper = Util.getMapper(UpdateModeMapper.class); + + private static final Logger logger = Util.getLogger(); + + private TableNameStore(){init();} + + private void init(){ + try { + triggerStore.clear(); + List updateModeConfList = updateModeMapper.queryUpdateModeConf(); + if (Objects.nonNull(updateModeConfList) && !updateModeConfList.isEmpty()) { + Map> collect = updateModeConfList.stream().collect(Collectors.groupingBy(UpdateModeConf::getSourceMode)); + Map> configMap = updateModeConfList.stream().collect(Collectors.groupingBy(UpdateModeConf::getUniqueCode)); + triggerStore.putAll(collect); + uniqueTriggerStore.putAll(configMap); + } + logger.info(String.format("TableNameStore init success!!! triggerStore:%s \n uniqueTriggerStore: %s", JSON.toJSONString(triggerStore), JSON.toJSONString(uniqueTriggerStore))); + }catch (Exception e){ + logger.error("TableNameStore init error !!!"+Util.getErrString(e)); + } + } + + public void refresh(){ + this.init(); + } + + public static TableNameStore getInstance(){ + return VendorStoreHolder.VENDOR_STORE; + } + + private static class VendorStoreHolder{ + private VendorStoreHolder(){ + + } + private static final TableNameStore VENDOR_STORE = new TableNameStore(); + } +} diff --git a/src/main/java/weaver/bokang/xiao/deg_repeat_check/action/RepeatCheckAction.java b/src/main/java/weaver/bokang/xiao/deg_repeat_check/action/RepeatCheckAction.java index d0de9a7..4dcd95e 100644 --- a/src/main/java/weaver/bokang/xiao/deg_repeat_check/action/RepeatCheckAction.java +++ b/src/main/java/weaver/bokang/xiao/deg_repeat_check/action/RepeatCheckAction.java @@ -42,8 +42,8 @@ public class RepeatCheckAction extends SafeCusBaseAction { private final RepeatCheckMapper repeatCheckMapper = Util.getMapper(RepeatCheckMapper.class); @Override - public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) { - log.info(String.format("=================== {%s} {requestId : %s} begin ======================", this.getClass().getName(),requestId)); + public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) + {log.info(String.format("=================== {%s} {requestId : %s} begin ======================", this.getClass().getName(),requestId)); Map mainTable = this.getMainTableValue(requestInfo); String workflowNum = Util.null2String(mainTable.get(workflowNumField)); int workflowCount = repeatCheckMapper.getWorkflowCount(billTable,workflowNumField,requestId, workflowNum); diff --git a/src/main/java/weaver/bokang/xiao/porsche/action/DateFieldUpdateAction.java b/src/main/java/weaver/bokang/xiao/porsche/action/DateFieldUpdateAction.java new file mode 100644 index 0000000..87e649b --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/porsche/action/DateFieldUpdateAction.java @@ -0,0 +1,81 @@ +package weaver.bokang.xiao.porsche.action; + +import aiyh.utils.Util; +import aiyh.utils.action.SafeCusBaseAction; +import aiyh.utils.annotation.ActionDesc; +import aiyh.utils.annotation.ActionOptionalParam; +import aiyh.utils.annotation.PrintParamMark; +import aiyh.utils.annotation.RequiredMark; +import aiyh.utils.excention.CustomerException; +import lombok.Setter; +import weaver.bokang.xiao.common.CommonUtil; +import weaver.bokang.xiao.common.mapper.WorkflowMapper; +import weaver.hrm.User; +import weaver.soa.workflow.request.RequestInfo; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @ClassName DateFieldUpdateAction + * @Author 肖博亢 + * @Date 2023/5/11 14:46 + * @Description

+ **/ +@Setter +@ActionDesc(value = "时间自定义格式化",author = "bokang.xiao") +public class DateFieldUpdateAction extends SafeCusBaseAction { + + @RequiredMark("原时间字段集合") + @PrintParamMark + private String sourceDateFields; + + @RequiredMark("修改时间字段结合") + @PrintParamMark + private String targetDateFields; + + @ActionOptionalParam(value = "MMMM d','yyyy",desc = "时间格式化字符串") + @PrintParamMark + private String formationString = "MMMM d','yyyy"; + + private final WorkflowMapper workflowMapper = Util.getMapper(WorkflowMapper.class); + + @Override + public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) { + log.info(String.format("=================== {%s} {requestId : %s} begin ======================", this.getClass().getName(), requestId)); + Map workflowData = workflowMapper.queryWorkflowByRequestId(requestId, billTable); + String[] sourceDateFieldArray = sourceDateFields.split(","); + String[] targetDateFieldArray = targetDateFields.split(","); + if(sourceDateFieldArray.length != targetDateFieldArray.length){ + throw new CustomerException("请确保需要格式化的字段数量与存储字段数量一致"); + } + Map dateFormat = new HashMap<>(); + for (int i = 0; i < sourceDateFieldArray.length; i++) { + String sourceDateField = sourceDateFieldArray[i]; + String targetDateField = targetDateFieldArray[i]; + String sourceDate = Util.null2String(workflowData.get(sourceDateField)); + String targetDate = formatDate(sourceDate); + dateFormat.put(targetDateField,targetDate); + } + Map whereParam = new HashMap<>(); + whereParam.put("requestid",requestId); + String updateSql = CommonUtil.getCusUpdateSql(billTable, dateFormat, whereParam); + log.info("DateFieldUpdateAction updateSql ==>"+updateSql+" updateParam =>"+dateFormat+" whereParam =>"+whereParam); + boolean flag = workflowMapper.executeUpdateCusSql(updateSql, dateFormat, whereParam); + log.info("更新格式化日期结果 ==>"+flag); + } + + private String formatDate(String dateStr){ + try { + SimpleDateFormat sourceFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat targetFormat = new SimpleDateFormat(formationString, Locale.US); + Date parse = sourceFormat.parse(dateStr); + return targetFormat.format(parse); + }catch (ParseException parseException){ + log.error("时间格式化异常 format error!!!"+Util.getErrString(parseException)); + return ""; + } + } + +} diff --git a/src/main/java/weaver/bokang/xiao/porsche/mapper/PorscheMapper.java b/src/main/java/weaver/bokang/xiao/porsche/mapper/PorscheMapper.java new file mode 100644 index 0000000..ba0dd81 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/porsche/mapper/PorscheMapper.java @@ -0,0 +1,24 @@ +package weaver.bokang.xiao.porsche.mapper; + +import aiyh.utils.annotation.recordset.*; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName PorscheMapper + * @Author 肖博亢 + * @Date 2023/5/9 17:56 + * @Description

+ **/ +@SqlMapper +public interface PorscheMapper { + + @Select("select * from uf_zcgsxx where $t{statusField} = 0") + List> queryCompanyInfo(@ParamMapper("statusField")String statusField); + + @Update("update uf_zcgsxx set sfrz = #{authenticationStatus},fadadaid = #{contractId} where id = #{dataId}") + boolean updateAuthenticationStatus(@ParamMapper("authenticationField")String authenticationStatus, + @ParamMapper("authenticationStatus")String companyNo, + @ParamMapper("dataId")int dataId); +} diff --git a/src/main/java/weaver/bokang/xiao/porsche/schedule/CompanyWriteBackSchedule.java b/src/main/java/weaver/bokang/xiao/porsche/schedule/CompanyWriteBackSchedule.java new file mode 100644 index 0000000..c992fae --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/porsche/schedule/CompanyWriteBackSchedule.java @@ -0,0 +1,69 @@ +package weaver.bokang.xiao.porsche.schedule; + +import aiyh.utils.Util; +import aiyh.utils.action.CusBaseCronJob; +import aiyh.utils.annotation.ActionDesc; +import aiyh.utils.annotation.PrintParamMark; +import aiyh.utils.annotation.RequiredMark; +import aiyh.utils.httpUtil.ResponeVo; +import lombok.Data; +import lombok.Setter; +import weaver.aiyh_pcn.common_fadada.util.FaRequestUtils; +import weaver.bokang.xiao.porsche.mapper.PorscheMapper; +import weaver.xiao.commons.config.entity.RequestMappingConfig; +import weaver.xiao.commons.config.service.DealWithMapping; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @ClassName CompanyWriteBackSchedule + * @Author 肖博亢 + * @Date 2023/5/9 17:50 + * @Description

+ **/ +@Setter +@ActionDesc(value = "公司认证信息同步", author = "bokang.xiao") +public class CompanyWriteBackSchedule extends CusBaseCronJob { + + @RequiredMark("请求唯一标识") + @PrintParamMark + private String requestMark; + + @RequiredMark("状态字段名") + @PrintParamMark + private String statusField; + + private final DealWithMapping dealWithMapping = new DealWithMapping(); + + private final PorscheMapper porscheMapper = Util.getMapper(PorscheMapper.class); + + @Override + public void runCode() throws IOException { + log.info("======= CompanyWriteBackSchedule execute ======"); + List> maps = porscheMapper.queryCompanyInfo(statusField); + if(Objects.nonNull(maps) && !maps.isEmpty()){ + log.info("company list info ==>"+maps.size()); + for (Map map : maps) { + RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestMark); + Map requestParam = dealWithMapping.getRequestParam(map, requestMappingConfig); + ResponeVo responeVo = FaRequestUtils.companyAuthentication(requestParam, requestMappingConfig.getRequestUrl()); + if(responeVo.getCode() == 200){ + Map result = responeVo.getResponseMap(); + String code = Util.null2String(result.get("code")); + if("200".equals(code)){ + List> data = (List>) result.get("data"); + Map companyInfo = data.get(0); + Map certificationStatusResource = (Map) companyInfo.get("certificationStatusResource"); + int dataId = Util.getIntValue(String.valueOf(map.get("id"))); + String authenticationStatus = Util.null2String(certificationStatusResource.get("verifiedStatus")); + String companyNo = Util.null2String(companyInfo.get("companyInfo")); + porscheMapper.updateAuthenticationStatus(authenticationStatus,companyNo,dataId); + } + } + } + } + } +} diff --git a/src/main/java/weaver/bokang/xiao/porsche/schedule/SalaryUpdateSchedule.java b/src/main/java/weaver/bokang/xiao/porsche/schedule/SalaryUpdateSchedule.java new file mode 100644 index 0000000..e089a7e --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/porsche/schedule/SalaryUpdateSchedule.java @@ -0,0 +1,32 @@ +package weaver.bokang.xiao.porsche.schedule; + +import aiyh.utils.action.CusBaseCronJob; +import aiyh.utils.annotation.ActionDesc; +import aiyh.utils.annotation.PrintParamMark; +import aiyh.utils.annotation.RequiredMark; +import lombok.Setter; +import weaver.bokang.xiao.common.model_update.service.ModeChangeService; + +import java.io.IOException; + +/** + * @ClassName SalaryUpdateSchedule + * @Author 肖博亢 + * @Date 2023/5/11 17:59 + * @Description

+ **/ +@Setter +@ActionDesc(value = "定时更新薪酬信息", author = "bokang.xiao") +public class SalaryUpdateSchedule extends CusBaseCronJob { + + @RequiredMark("原建模表单ID") + @PrintParamMark + private String formId; + + private final ModeChangeService modeChangeService = new ModeChangeService(); + + @Override + public void runCode() throws IOException { + modeChangeService.changeOtherMode(formId); + } +} diff --git a/src/main/java/weaver/bokang/xiao/sh_bigdata/action/DataPushAction.java b/src/main/java/weaver/bokang/xiao/sh_bigdata/action/DataPushAction.java new file mode 100644 index 0000000..4345c18 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/sh_bigdata/action/DataPushAction.java @@ -0,0 +1,61 @@ +package weaver.bokang.xiao.sh_bigdata.action; + +import aiyh.utils.Util; +import aiyh.utils.action.SafeCusBaseAction; +import aiyh.utils.annotation.ActionDesc; +import aiyh.utils.annotation.ActionOptionalParam; +import aiyh.utils.annotation.PrintParamMark; +import com.alibaba.fastjson.JSON; +import lombok.Setter; +import weaver.bokang.xiao.common.mapper.WorkflowMapper; +import weaver.hrm.User; +import weaver.soa.workflow.request.RequestInfo; +import weaver.xiao.commons.config.entity.RequestMappingConfig; +import weaver.xiao.commons.config.service.DealWithMapping; +import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess; +import weaver.xuanran.wang.sh_bigdata.common.util.RequestMasterPlate; +import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * @ClassName DataPushAction + * @Author 肖博亢 + * @Date 2023/5/12 10:30 + * @Description

+ **/ +@Setter +@ActionDesc(value = "数据采集对接-数据推送action",author = "bokang.xiao") +public class DataPushAction extends SafeCusBaseAction { + + /** 数据推送接口唯一标识 */ + @PrintParamMark + @ActionOptionalParam(value = "",desc = "数据推送接口唯一标识") + private String requestUnique; + + private final WorkflowMapper workflowMapper = Util.getMapper(WorkflowMapper.class); + + private final DealWithMapping dealWithMapping = new DealWithMapping(); + + private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate(); + + @Override + public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) { + log.info(String.format("=================== {%s} {requestId : %s} begin ======================", this.getClass().getName(),requestId)); + Map workflowMessage = workflowMapper.queryWorkflowByRequestId(requestId, billTable); + dealWithMapping.setMainTable(billTable); + RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestUnique); + Map requestParam = dealWithMapping.getRequestParam(workflowMessage, requestMappingConfig); + Map header = new HashMap<>(); + header.put("Content-Type","application/json"); + CusSuccess cusSuccess = CusSuccess.builder() + .successField("code") + .successValue(0) + .errorMsg("msg") + .dataKey("data.data") + .build(); + Map result = requestMasterPlate.apiPost(ShBigDataUtil.addToken2Url(requestMappingConfig.getRequestUrl()), requestParam, header, cusSuccess); + log.info("DataPushAction push data result ==>"+ JSON.toJSONString(result)); + } +} diff --git a/src/main/java/weaver/bokang/xiao/zscq/action/OneNetComAction.java b/src/main/java/weaver/bokang/xiao/zscq/action/OneNetComAction.java index 09e9820..4c1a331 100644 --- a/src/main/java/weaver/bokang/xiao/zscq/action/OneNetComAction.java +++ b/src/main/java/weaver/bokang/xiao/zscq/action/OneNetComAction.java @@ -33,7 +33,7 @@ import java.util.List; import java.util.Map; /** - * @ClassName OneNetcomAction + * @ClassName OneNetComAction * @Author 肖博亢 * @Date 2023/3/27 14:04 * @Description

一网通接口调用action

diff --git a/src/main/java/weaver/bokang/xiao/zscq/config/mapper/UpdateModeMapper.java b/src/main/java/weaver/bokang/xiao/zscq/config/mapper/UpdateModeMapper.java index bb68a40..2620fdd 100644 --- a/src/main/java/weaver/bokang/xiao/zscq/config/mapper/UpdateModeMapper.java +++ b/src/main/java/weaver/bokang/xiao/zscq/config/mapper/UpdateModeMapper.java @@ -76,7 +76,9 @@ public interface UpdateModeMapper { * @return 查询结果 */ @Select(custom = true) - Map executeCusSqlMap(@SqlString String cusSql, @ParamMapper("whereParam")Map whereParam,@ParamMapper("cusParam")Map cusParam); + Map executeCusSqlMap(@SqlString String cusSql, + @ParamMapper("whereParam")Map whereParam, + @ParamMapper("cusParam")Map cusParam); /** *

执行自定义更新sql

@@ -86,6 +88,8 @@ public interface UpdateModeMapper { * @return 查询结果 */ @Update(custom = true) - boolean executeUpdateCusSql(@SqlString String cusSql, @ParamMapper("updateParam")Map updateParam,@ParamMapper("whereParam")Map whereParam); + boolean executeUpdateCusSql(@SqlString String cusSql, + @ParamMapper("updateParam")Map updateParam, + @ParamMapper("whereParam")Map whereParam); } diff --git a/src/main/java/weaver/bokang/xiao/zscq/config/process/DataTypeProcess.java b/src/main/java/weaver/bokang/xiao/zscq/config/process/DataTypeProcess.java index cac75ee..658fbde 100644 --- a/src/main/java/weaver/bokang/xiao/zscq/config/process/DataTypeProcess.java +++ b/src/main/java/weaver/bokang/xiao/zscq/config/process/DataTypeProcess.java @@ -125,7 +125,7 @@ public class DataTypeProcess { * @param param 表参数 * @return 执行结果 */ - @MethodRuleNo(value = 3,desc = "插入并执行自定义操作") + @MethodRuleNo(value = 3,desc = "更新并执行自定义操作") public static boolean cusAndUpdate(Map updateParam, Map whereParam,Map param) { return update(updateParam,whereParam,param) && cusOperate(updateParam,whereParam,param); } diff --git a/src/main/java/weaver/bokang/xiao/zscq/fun/ODocUpdate.java b/src/main/java/weaver/bokang/xiao/zscq/fun/ODocUpdate.java new file mode 100644 index 0000000..8ccd4e4 --- /dev/null +++ b/src/main/java/weaver/bokang/xiao/zscq/fun/ODocUpdate.java @@ -0,0 +1,42 @@ +package weaver.bokang.xiao.zscq.fun; + +import aiyh.utils.Util; +import weaver.bokang.xiao.zscq.config.function.CusOperateInterface; +import weaver.bokang.xiao.zscq.config.mapper.UpdateModeMapper; +import weaver.bokang.xiao.zscq.mapper.StatusMapper; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * @ClassName OdocUpdate + * @Author 肖博亢 + * @Date 2023/5/9 15:24 + * @Description

+ **/ +public class ODocUpdate implements CusOperateInterface { + + private final UpdateModeMapper updateModeMapper = Util.getMapper(UpdateModeMapper.class); + + private final StatusMapper statusMapper = Util.getMapper(StatusMapper.class); + + @Override + public void execute(Map whereParam, Map param, Map pathParam) { + logger.info("==== ODocUpdate 自定义处理 ==== "); + String tableName = Util.null2String(param.get("tableName")); + String numField = Util.null2String(pathParam.get("numField")); + String querySql = "select * from " + tableName +" where "+ numField +"= #{whereParam."+numField+"}"; + Map modeData = updateModeMapper.executeCusSqlMap(querySql, whereParam,new HashMap<>()); + logger.info("modeData ==>"+modeData); + if(Objects.nonNull(modeData)){ + String oDocRequestField = Util.null2String(pathParam.get("oDocRequestField")); + String oDocTextField = Util.null2String(pathParam.get("oDocTextField")); + String workflowTextField = Util.null2String(pathParam.get("workflowTextField")); + String requestId = Util.null2String(modeData.get("requestid")); + String workflowText = Util.null2String(modeData.get(workflowTextField)); + boolean flag = statusMapper.updateODocField(oDocTextField, workflowText, oDocRequestField, requestId); + logger.info("更新odoc表数据结果 ==>"+flag); + } + } +} diff --git a/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowOverOperate.java b/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowOverOperate.java index a99f5d2..25542e6 100644 --- a/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowOverOperate.java +++ b/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowOverOperate.java @@ -26,7 +26,7 @@ public class WorkflowOverOperate implements CusOperateInterface { @Override public void execute(Map whereParam, Map param, Map pathParam) { - logger.info(String.format("WorkflowOverOperate 自定义处理 whereParam[%s],param:[%s],pathParam:[%s]",whereParam,param,pathParam)); + logger.info("===== WorkflowOverOperate 自定义处理 ===== "); String tableName = Util.null2String(param.get("tableName")); String whereSql = Util.null2String(param.get("whereSql")); if(!"".equals(whereSql)){ diff --git a/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowRepossessedSign.java b/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowRepossessedSign.java index dcec3ad..69c7bfb 100644 --- a/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowRepossessedSign.java +++ b/src/main/java/weaver/bokang/xiao/zscq/fun/WorkflowRepossessedSign.java @@ -29,7 +29,7 @@ public class WorkflowRepossessedSign implements CusOperateInterface { @Override public void execute(Map whereParam, Map param, Map pathParam) { - logger.info(String.format("WorkflowRepossessedSign 自定义处理 whereParam[%s],param:[%s],pathParam:[%s]",whereParam,param,pathParam)); + logger.info("==== WorkflowRepossessedSign 自定义处理 ===="); String tableName = Util.null2String(param.get("tableName")); String whereSql = Util.null2String(param.get("whereSql")); if(!"".equals(whereSql)){ diff --git a/src/main/java/weaver/bokang/xiao/zscq/mapper/StatusMapper.java b/src/main/java/weaver/bokang/xiao/zscq/mapper/StatusMapper.java index f424845..8ec189f 100644 --- a/src/main/java/weaver/bokang/xiao/zscq/mapper/StatusMapper.java +++ b/src/main/java/weaver/bokang/xiao/zscq/mapper/StatusMapper.java @@ -32,4 +32,10 @@ public interface StatusMapper { @Select("select currentnodetype from workflow_requestbase where requestid = #{requestId}") int queryWorkflowStatus(@ParamMapper("requestId")String requestId); + @Update("update odoc_requestdoc set $t{fieldName} = #{fieldValue} where $t{oDocRequestField} = #{requestId}") + boolean updateODocField(@ParamMapper("fieldName")String fieldName, + @ParamMapper("fieldValue")String fieldValue, + @ParamMapper("oDocRequestField")String oDocRequestField, + @ParamMapper("requestId")String requestId); + } diff --git a/src/main/resources/WEB-INF/prop/prop2map/htmlLabelIndex.properties b/src/main/resources/WEB-INF/prop/prop2map/htmlLabelIndex.properties index aa1fb53..48b8541 100644 --- a/src/main/resources/WEB-INF/prop/prop2map/htmlLabelIndex.properties +++ b/src/main/resources/WEB-INF/prop/prop2map/htmlLabelIndex.properties @@ -3,4 +3,6 @@ aiyh.htmllabel.porsche.faddcontractcontroller.pusherr.defaultstr=邮件发送失 aiyh.htmllabel.porsche.faddcontractcontroller.pushsuccess.labelindex=-1 aiyh.htmllabel.porsche.faddcontractcontroller.pushsuccess.defaultstr=签署邮件发送成功! attachment_sort.annexsortaction.sorterr.labelindex=-1 -attachment_sort.annexsortaction.sorterr.defaultstr=文件排序失败,请联系系统管理员! \ No newline at end of file +attachment_sort.annexsortaction.sorterr.defaultstr=文件排序失败,请联系系统管理员! +xbk.contractRepush.errorMsg.labelindex=-83377 +xbk.contractRepush.errorMsg.defaultstr=我是傻狗 \ No newline at end of file diff --git a/src/main/resources/ajzx/ContractList.jsp b/src/main/resources/ajzx/ContractList.jsp new file mode 100644 index 0000000..7160658 --- /dev/null +++ b/src/main/resources/ajzx/ContractList.jsp @@ -0,0 +1,500 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" %> +<%@ include file="/systeminfo/init_wev8.jsp"%> +<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%> +<%@ taglib uri="/WEB-INF/tld/browser.tld" prefix="brow"%> + +<%@ page import="weaver.file.Prop" %> +<%@ page import="weaver.hrm.HrmUserVarify" %> +<%@ page import="weaver.systeminfo.SystemEnv" %> + + + + + + + + + + + + + + + +<% + + String sqlwhere = " where 1=1 "; + + String subcompanyid1 = ResourceComInfo.getSubCompanyID(String.valueOf(user.getUID())); + + //是否采购部 + boolean isDep = false; + //是否是流程接收人 + boolean isShow = false; + //采购部的同事可以选择所有合同卡片;而本部门的人员(非采购部)只能选择本部门的合同卡片 + RecordSet_Dep.executeSql("select * from HrmDepartment where departmentname like '%采购%' and id="+user.getUserDepartment()); + if(RecordSet_Dep.next()) isDep = true; + + //是否合同流程接收人 + String sqlwhere_workflow = ""; + RecordSet_Dep.executeSql("select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID()); + if(RecordSet_Dep.next()) isShow = true; + + if(!HrmUserVarify.checkUserRight("ContactInfo:Manager", user) && !HrmUserVarify.checkUserRight("ContactInfo:User", user) && !isShow && !isDep){ + response.sendRedirect("/notice/noright.jsp"); + } + + //如果是合同管理权限,则直接1=1 + if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user)){ + sqlwhere += " and 1=1"; + }else if(isShow && HrmUserVarify.checkUserRight("ContactInfo:User", user)){ + //如果是流程接收人,并且有合同查看权限 + sqlwhere += " and (requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID()+") or reqDeptId = '"+user.getUserDepartment()+"')"; + + }else if(HrmUserVarify.checkUserRight("ContactInfo:User", user)){ + //如果只有合同查看权限 + sqlwhere += " and reqDeptId = '"+user.getUserDepartment()+"'"; + + }else if(isShow){ + //如果只是流程接收人 + sqlwhere += " and requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID()+")"; + } + + //如果没有查看全部的权限,加分部条件 + if(!HrmUserVarify.checkUserRight("ContactInfoList:ALL", user)){ + if (!subcompanyid1.equals("0")) {sqlwhere += " and CrmContractInfo.subcompanyid1 = '"+subcompanyid1+"' ";} + } + String imagefilename = "/images/hdReport.gif"; + String titlename = SystemEnv.getHtmlLabelName(614, user.getLanguage()) + SystemEnv.getHtmlLabelName(527, user.getLanguage()); + String needfav = "1"; + String needhelp = ""; +%> + + <%@ include file="/systeminfo/TopTitle_wev8.jsp"%> + <%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp"%> + <% + RCMenu += "{" + SystemEnv.getHtmlLabelName(197, user.getLanguage()) + ",javascript:OnSearch(),_top} "; + RCMenuHeight += RCMenuHeightStep; + RCMenu += "{" + "Excel,javascript:ContractExport(),_top} "; + RCMenuHeight += RCMenuHeightStep; + RCMenu += "{" + SystemEnv.getHtmlLabelName(18363, user.getLanguage()) + ",javascript:_table.firstPage(),_self}"; + RCMenuHeight += RCMenuHeightStep; + RCMenu += "{" + SystemEnv.getHtmlLabelName(1258, user.getLanguage()) + ",javascript:_table.prePage(),_self}"; + RCMenuHeight += RCMenuHeightStep; + RCMenu += "{" + SystemEnv.getHtmlLabelName(1259, user.getLanguage()) + ",javascript:_table.nextPage(),_self}"; + RCMenuHeight += RCMenuHeightStep; + RCMenu += "{" + SystemEnv.getHtmlLabelName(18362, user.getLanguage()) + ",javascript:_table.lastPage(),_self}"; + RCMenuHeight += RCMenuHeightStep; + %> + <% + int pagenum = Util.getIntValue(request.getParameter("pagenum"), 1); + int perpage = Util.getPerpageLog(); + if (perpage <= 1) perpage = 10; + + String creator = Util.fromScreen(request.getParameter("creator"), user.getLanguage()); + String fromdate = Util.fromScreen(request.getParameter("fromdate"), user.getLanguage()); + String fromdate2 = Util.fromScreen(request.getParameter("fromdate2"), user.getLanguage()); + String enddate = Util.fromScreen(request.getParameter("enddate"), user.getLanguage()); + String enddate2 = Util.fromScreen(request.getParameter("enddate2"), user.getLanguage()); + String status_temp = Util.null2String(request.getParameter("status_temp")); + + String conNo = Util.fromScreen(request.getParameter("conNo"), user.getLanguage()); + String prNo = Util.fromScreen(request.getParameter("prNo"), user.getLanguage()); + String jpcNo = Util.fromScreen(request.getParameter("jpcNo"), user.getLanguage()); + String suppliersId = Util.fromScreen(request.getParameter("suppliersId"), user.getLanguage()); + String isOneSuppliers = Util.fromScreen(request.getParameter("isOneSuppliers"), user.getLanguage()); +// String reqDeptId = String.valueOf(user.getUserDepartment()); + String reqDeptId = Util.fromScreen(request.getParameter("reqDeptId"), user.getLanguage());; + //管理员组或采购部才能查询所有部门下合同,合同接收人查看接收的合同 +// if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user) || isShow) reqDeptId = Util.fromScreen(request.getParameter("reqDeptId"), user.getLanguage()); + String isOverdue = Util.fromScreen(request.getParameter("isOverdue"), user.getLanguage()); + String status = Util.fromScreen(request.getParameter("status"), user.getLanguage()); + String isOverdueNext = Util.fromScreen(request.getParameter("isOverdueNext"), user.getLanguage()); + String conType = Util.fromScreen(request.getParameter("conType"), user.getLanguage()); + + String name = Util.fromScreen(request.getParameter("name"), user.getLanguage()); + String subCompanyId = Util.fromScreen(request.getParameter("subCompanyId"), user.getLanguage()); + String reNewStatus = Util.fromScreen(request.getParameter("reNewStatus"), user.getLanguage()); + String conStatus = Util.fromScreen(request.getParameter("conStatus"), user.getLanguage()); + String contractName = Util.fromScreen(request.getParameter("contractName"), user.getLanguage()); + String csstatus = Util.fromScreen(request.getParameter("csstatus"), user.getLanguage()); + + int opentype = Util.getIntValue(request.getParameter("opentype"),-1); + + //String sqlwhere = " where status = '' "; + //if(!"".equals(status_temp)) sqlwhere += " and status in ("+status_temp+") "; + + if (!fromdate.equals("")) sqlwhere += " and startDate>='" + fromdate + "'"; + if (!fromdate2.equals("")) sqlwhere += " and startDate<='" + fromdate2 + "'"; + if (!enddate.equals("")) sqlwhere += " and enddate>='" + enddate + "'"; + if (!enddate2.equals("")) sqlwhere += " and enddate<='" + enddate2 + "'"; + if (!conNo.equals("")) sqlwhere += " and conNo like '%" + conNo + "%'"; + if (!prNo.equals("")) sqlwhere += " and prNo='" + prNo + "'"; + if (!jpcNo.equals("")) sqlwhere += " and jpcNo='" + jpcNo + "'"; + if(!"".equals(suppliersId)) sqlwhere += " and suppliersId=" + suppliersId; + if (!isOneSuppliers.equals("")) sqlwhere += " and isOneSuppliers='" + isOneSuppliers + "'"; + if (!"".equals(creator) && !"0".equals(creator)) sqlwhere += " and CrmContractInfo.creator=" + creator; + if (!reqDeptId.equals("")) sqlwhere += " and reqDeptId=" + reqDeptId; + if (!isOverdue.equals("")) sqlwhere += " and isOverdue='" + isOverdue + "'"; + if (!status.equals("")) sqlwhere += " and CrmContractInfo.status='" + status + "'"; + if (!isOverdueNext.equals("")) sqlwhere += " and isOverdueNext='" + isOverdueNext + "'"; + if (!conType.equals("")) sqlwhere += " and conType='" + conType + "'"; + if (!csstatus.equals("")) sqlwhere += " and CrmSalesContractInfo.status='" + csstatus + "'"; + + if (!name.equals("")) sqlwhere += " and name like '%" + name + "%'"; + if (!subCompanyId.equals("")) sqlwhere += " and CrmContractInfo.subcompanyid1 = '" + subCompanyId + "'"; + if (!reNewStatus.equals("")) sqlwhere += " and conStatus = '" + reNewStatus + "'"; + + if (!contractName.equals("")) sqlwhere += " and contractName like '%" + contractName + "%'"; + + //if (reNewStatus2.equals("待续签")) sqlwhere += " and dbo.getReNewStatus2(2,CrmContractInfo.saleContract) > 0"; + //else if (reNewStatus2.equals("已续签")) sqlwhere += " and dbo.getReNewStatus2(1,CrmContractInfo.saleContract) > 0"; + //else if (reNewStatus2.equals("无需续签")) sqlwhere += " and dbo.getReNewStatus2(3,CrmContractInfo.saleContract) > 0"; + //System.out.println("sqlwhere:"+sqlwhere); + + + if(opentype > -1){ + sqlwhere += " and isnull(CrmContractInfo.opentype,0) = " + opentype; + } + + String orderStr = " order by startDate desc, CrmContractInfo.id desc "; + +// out.println("sqlwhere:" + sqlwhere); +// out.println("orderStr:" + orderStr); + +// session.setAttribute("sqlwhere", sqlwhere); +// session.setAttribute("orderStr", orderStr); + %> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%if(HrmUserVarify.checkUserRight("ContactInfoList:ALL", user)){%> + + + <%}%> + + + + + + + + + + + + + + + + +
<%=SystemEnv.getHtmlLabelName(15774, user.getLanguage())%>
合同状态 + + <%=SystemEnv.getHtmlLabelName(1970, user.getLanguage())%> +   + <%=Util.toScreen(fromdate, user.getLanguage())%> -  +   + <%=Util.toScreen(fromdate2, user.getLanguage())%> + > + > + <%=SystemEnv.getHtmlLabelName(15236, user.getLanguage())%> +   + <%=Util.toScreen(enddate, user.getLanguage())%> -  +   + <%=Util.toScreen(enddate2, user.getLanguage())%> + > + > +
<%=SystemEnv.getHtmlLabelName(21282, user.getLanguage())%> + + PR<%=SystemEnv.getHtmlLabelName(403,user.getLanguage())%> + + JPC<%=SystemEnv.getHtmlLabelName(2171,user.getLanguage())%><%=SystemEnv.getHtmlLabelName(16992,user.getLanguage())%> + +
<%=SystemEnv.getHtmlLabelName(613002, user.getLanguage())%> + + + + + <%=SystemEnv.getHtmlLabelName(913, user.getLanguage())%> + + +
<%=SystemEnv.getHtmlLabelName(620002, user.getLanguage())%> + + + + +<%-- <%--%> +<%-- //管理员组才能查询所有部门下合同--%> +<%-- if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user)){--%> +<%-- %>--%> +<%-- +<%-- id="reqDeptId"--%> +<%-- name="reqDeptId"--%> +<%-- browserValue="<%=reqDeptId %>"--%> +<%-- browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"--%> +<%-- hasInput="true"--%> +<%-- isSingle="true"--%> +<%-- hasBrowser = "true"--%> +<%-- isMustInput='1'--%> +<%-- width="165px"--%> +<%-- browserSpanValue="<%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage())%>">--%> +<%-- --%> + +<%-- <%––%>--%> +<%-- <%}else{ %>--%> +<%-- <%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage()) %>--%> +<%-- <%} %>--%> + 付款状态 + + <%=SystemEnv.getHtmlLabelName(620017, user.getLanguage())%> + +
<%=SystemEnv.getHtmlLabelName(15775, user.getLanguage())%> + + <%=SystemEnv.getHtmlLabelName(15142, user.getLanguage())%> + + <%=SystemEnv.getHtmlLabelName(141,user.getLanguage())%>: + + + "> + + + + <%-- + <%--_url="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"--%> + <%--_displayText="<%=SubCompanyComInfo.getSubCompanyname(subCompanyId+"")%>"--%> + <%-->--%> +
<%=SystemEnv.getHtmlLabelName(16404, user.getLanguage())%><%=SystemEnv.getHtmlLabelName(195, user.getLanguage())%> + + 销售合同状态 + + 开闭口类型 + +
+ +
+ +
+ + + + +
+ <% + + String tableString = ""; + String backfields = " CrmContractInfo.id,case CrmContractInfo.opentype when '0' then '闭口' when '1' then '开口' when '2' then '周期性' end opentype, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '是' else '否' end as isOverdue, conAmount, content, ',' as str_temp, case isOverdueNext when 'Y' then '是' else '否' end as isOverdueNext, case CrmContractInfo.status when '0' then '执行中' when '1' then '已结清' end as status, CrmContractInfo.creator, CrmContractInfo.subcompanyid1, case conStatus when '0' then '执行' when '1' then '待续签' when '2' then '已续签' when '3' then '关闭' end as reNewStatus, contractName, saleContract, case when dbo.getReNewStatus2(1,CrmContractInfo.saleContract) > 0 then '已续签' when dbo.getReNewStatus2(2,CrmContractInfo.saleContract) > 0 then '待续签' when dbo.getReNewStatus2(3,CrmContractInfo.saleContract) > 0 then '无需续签' end as reNewStatus2,case CrmSalesContractInfo.status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as csstatus "; + String fromSql = " CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract "; + //out.print("select"+backfields+"from"+fromSql +sqlwhere); + String str_content = "content"+"str_temp"; + tableString = " " + "" + ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + //tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + //tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += ""; + tableString += "
"; + %> + + +
+
+ <%@ include file="/systeminfo/RightClickMenu_wev8.jsp"%> + + + + + + + \ No newline at end of file diff --git a/src/main/resources/ajzx/ContractReportExport.jsp b/src/main/resources/ajzx/ContractReportExport.jsp new file mode 100644 index 0000000..efe37c1 --- /dev/null +++ b/src/main/resources/ajzx/ContractReportExport.jsp @@ -0,0 +1,130 @@ +<%@ page language="java" contentType="text/html; charset=GBK" %> +<%@ include file="/systeminfo/init.jsp" %> +<%@ page import="weaver.general.Util, weaver.file.ExcelSheet, weaver.file.ExcelRow" %> +<%@ page import="lombok.val" %> +<%@ page import="weaver.zwl.common.logging.Logger" %> + + + + + + + + + + +<%! + public static String ToDBC(String input) { + char[] c = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (c[i] == 12288) { + //ȫǿոΪ12288ǿոΪ32 + c[i] = (char) 32; + continue; + } + if (c[i] > 65280 && c[i] < 65375) + //ַ(33-126)ȫ(65281-65374)ĶӦϵǣ65248 + c[i] = (char) (c[i] - 65248); + } + return new String(c); + } + + +%> + +<% + // String sqlwhere=(String)session.getAttribute("sqlwhere"); +// String orderStr=(String)session.getAttribute("orderStr"); + + val logger = aiyh.utils.Util.getLogger(); + String sqlwhere = request.getParameter("sqlwhere"); + sqlwhere = ToDBC(sqlwhere); + String orderStr = request.getParameter("orderStr"); + orderStr = ToDBC(orderStr); + + String sqlstr = ""; + + if (RecordSet.getDBType().equals("oracle")) { + sqlstr = "select CrmContractInfo.id, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '' else '' end as isOverdue, conAmount, content, case isOverdueNext when 'Y' then '' else '' end as isOverdueNext, case CrmContractInfo.status when '0' then 'ִ' when '1' then 'ѽ' end as status, case isOneSuppliers when 'Y' then '' when 'N' then '' else '' end as isOneSuppliers, prRequestId,jpcNo,jpcFile,prNo,prAmount,prAmountSum,conAmount,managerId,subject,giveDate,giveRemark,payRemark,content,CrmContractInfo.createDate,CrmContractInfo.creator,CrmContractInfo.subcompanyid1, case conStatus when '0' then 'ִ' when '1' then 'ǩ' when '2' then 'ǩ' when '3' then 'ر' end as reNewStatus,contractName, saleContract, case CrmSalesContractInfo.status when '0' then 'ǩ' when '1' then 'δǩ' when '2' then 'ǩ' when '3' then 'ر' end as reNewStatus2 from CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract" + sqlwhere + orderStr; + } else { + sqlstr = "select CrmContractInfo.id, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '' else '' end as isOverdue, conAmount, content, case isOverdueNext when 'Y' then '' else '' end as isOverdueNext, case CrmContractInfo.status when '0' then 'ִ' when '1' then 'ѽ' end as status, case isOneSuppliers when 'Y' then '' when 'N' then '' else '' end as isOneSuppliers, prRequestId,jpcNo,jpcFile,prNo,prAmount,prAmountSum,conAmount,managerId,subject,giveDate,giveRemark,payRemark,content,CrmContractInfo.createDate,CrmContractInfo.creator,CrmContractInfo.subcompanyid1, case conStatus when '0' then 'ִ' when '1' then 'ǩ' when '2' then 'ǩ' when '3' then 'ر' end as reNewStatus,contractName, saleContract, case CrmSalesContractInfo.status when '0' then 'ǩ' when '1' then 'δǩ' when '2' then 'ǩ' when '3' then 'ر' end as reNewStatus2 from CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract" + sqlwhere + orderStr; + } + new BaseBean().writeLog(">>>>>>>>"+sqlstr); + RecordSet.executeQuery(sqlstr); + + ExcelSheet es = new ExcelSheet(); + + ExcelRow er = es.newExcelRow(); + er.addStringValue(SystemEnv.getHtmlLabelName(141,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620002,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(613002,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(21282,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(15142,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(1970,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(15236,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620016,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(6146,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620015,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620017,user.getLanguage())); + er.addStringValue("״̬"); + er.addStringValue(SystemEnv.getHtmlLabelName(913,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620009,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620003,user.getLanguage())); + er.addStringValue("JPC"+SystemEnv.getHtmlLabelName(16992,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620004,user.getLanguage())); + er.addStringValue("PR"+SystemEnv.getHtmlLabelName(403,user.getLanguage())); + er.addStringValue("PR"+SystemEnv.getHtmlLabelName(856,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620010,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620011,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620006,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620012,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620013,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620014,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(620015,user.getLanguage())); + er.addStringValue(SystemEnv.getHtmlLabelName(614,user.getLanguage())+SystemEnv.getHtmlLabelName(722,user.getLanguage())); + er.addStringValue("ͬ״̬"); + er.addStringValue("ۺͬ"); + er.addStringValue("ۺͬ״̬"); + + while (RecordSet.next()) { + ExcelRow erdetail = es.newExcelRow(); + erdetail.addStringValue(SubCompanyComInfo.getSubCompanyname(RecordSet.getString("subcompanyid1"))); + erdetail.addStringValue(DepartmentComInfo.getDepartmentname(RecordSet.getString("reqDeptId"))); + erdetail.addStringValue(CrmSupplierComInfo.getSuppliername(RecordSet.getString("suppliersId"))); + erdetail.addStringValue(RecordSet.getString("conNo")); + erdetail.addStringValue(RecordSet.getString("name")); + erdetail.addStringValue(RecordSet.getString("startDate")); + erdetail.addStringValue(RecordSet.getString("endDate")); + erdetail.addStringValue(RecordSet.getString("isOverdue")); + erdetail.addStringValue(RecordSet.getString("conAmount")); + erdetail.addStringValue(Util.toScreen(SptmForDoc.getDocName(RecordSet.getString("content")), user.getLanguage())); + erdetail.addStringValue(RecordSet.getString("isOverdueNext")); + erdetail.addStringValue(RecordSet.getString("status")); + erdetail.addStringValue(Util.toScreen(ResourceComInfo.getResourcename(RecordSet.getString("creator")), user.getLanguage())); + erdetail.addStringValue(RecordSet.getString("isOneSuppliers")); + erdetail.addStringValue(RequestComInfo.getRequestname(RecordSet.getString("prRequestId"))); + erdetail.addStringValue(RecordSet.getString("jpcNo")); + erdetail.addStringValue(DocComInfo.getDocname(RecordSet.getString("jpcFile"))); + erdetail.addStringValue(RecordSet.getString("prNo")); + erdetail.addStringValue(RecordSet.getString("prAmount")); + erdetail.addStringValue(RecordSet.getString("prAmountSum")); + erdetail.addStringValue(ResourceComInfo.getResourcename(RecordSet.getString("managerId"))); + erdetail.addStringValue(RecordSet.getString("subject")); + erdetail.addStringValue(RecordSet.getString("giveDate")); + erdetail.addStringValue(RecordSet.getString("giveRemark")); + erdetail.addStringValue(RecordSet.getString("payRemark")); + erdetail.addStringValue(DocComInfo.getDocname(RecordSet.getString("content"))); + erdetail.addStringValue(RecordSet.getString("createDate")); + erdetail.addStringValue(RecordSet.getString("reNewStatus")); + erdetail.addStringValue(RecordSet.getString("contractName")); + erdetail.addStringValue(RecordSet.getString("reNewStatus2")); + } + + ExcelFile.init(); + ExcelFile.setFilename("ͬ"); + ExcelFile.addSheet("ͬ", es); +%> +<%----%> + \ No newline at end of file diff --git a/src/main/youhong_ai_old_src/weaver/aiyh_pcn/common_fadada/util/FaRequestUtils.java b/src/main/youhong_ai_old_src/weaver/aiyh_pcn/common_fadada/util/FaRequestUtils.java index 291c97b..8e9af19 100644 --- a/src/main/youhong_ai_old_src/weaver/aiyh_pcn/common_fadada/util/FaRequestUtils.java +++ b/src/main/youhong_ai_old_src/weaver/aiyh_pcn/common_fadada/util/FaRequestUtils.java @@ -116,6 +116,31 @@ public class FaRequestUtils { } return responeVo; } + + /** + * 公司认证状态同步方法 + * + * @param data 请求参数 + * @param url 请求地址 + * @return 请求结果 + */ + public static ResponeVo companyAuthentication(Map data, String url) { + log.info("公司认证状态同步"); + try { + HEADER.put("sign", builderSign(data)); + } catch (Exception e) { + throw new CustomerException("签名失败!", e); + } + HEADER.put("Content-Type", "application/json"); + ResponeVo responeVo = null; + try { + responeVo = HTTP_UTILS.apiPost(url, + data, null); + } catch (IOException e) { + e.printStackTrace(); + } + return responeVo; + } public static ResponeVo RevocationContract(Map data, String url) { log.info("撤销合同方法"); diff --git a/src/test/java/basetest/BaseTest.java b/src/test/java/basetest/BaseTest.java index 7fb47af..b394cb4 100644 --- a/src/test/java/basetest/BaseTest.java +++ b/src/test/java/basetest/BaseTest.java @@ -130,6 +130,7 @@ public class BaseTest { @Test public void with() { + Logger logger = Util.getLogger(); logger.info("aafasdf"); String sql = "select COMPANYNAME,LICENSE,EXPIREDATE,CVERSION from license "; diff --git a/src/test/java/bokang/xiao/NormalTest.java b/src/test/java/bokang/xiao/NormalTest.java index 7227bb1..a6744bd 100644 --- a/src/test/java/bokang/xiao/NormalTest.java +++ b/src/test/java/bokang/xiao/NormalTest.java @@ -22,6 +22,9 @@ import org.apache.poi.ss.usermodel.Workbook; import org.junit.Test; import weaver.bokang.xiao.common.mapper.ModeMapper; import weaver.bokang.xiao.deg_repeat_check.action.RepeatCheckAction; +import weaver.bokang.xiao.porsche.action.DateFieldUpdateAction; +import weaver.bokang.xiao.porsche.schedule.CompanyWriteBackSchedule; +import weaver.bokang.xiao.sh_bigdata.action.DataPushAction; import weaver.bokang.xiao.xhny_mode.search.CustomSearchDepart; import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData; import weaver.bokang.xiao.xhny_report.schedule.GenerateReportSchedule; @@ -44,6 +47,7 @@ import java.io.*; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.sql.*; +import java.text.SimpleDateFormat; import java.util.*; import java.util.Date; @@ -57,9 +61,9 @@ public class NormalTest extends BaseTest { @Test public void testWord(){ - //GenerateFileUtil.createCronJobDocument(GenerateReportSchedule.class); - //GenerateFileUtil.createActionDocument(OneNetComAction.class); - GenerateFileUtil.createActionDocument(RepeatSubmitAction.class); + //GenerateFileUtil.createCronJobDocument(CompanyWriteBackSchedule.class); + GenerateFileUtil.createActionDocument(DataPushAction.class); + //GenerateFileUtil.createActionDocument(DateFieldUpdateAction.class); } @Test @@ -348,4 +352,12 @@ public class NormalTest extends BaseTest { System.out.println(sourceStr.contains(value)); } + @Test + public void testDate(){ + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("MMMM d','yyyy",Locale.US); + String formattedDate = sdf.format(date); + System.out.println("Formatted date: " + formattedDate); + } + }