diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/AgentPayResultPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/AgentPayResultPluginInitializer.java new file mode 100644 index 00000000..ac1c5224 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/AgentPayResultPluginInitializer.java @@ -0,0 +1,111 @@ +package com.hzya.frame.plugin.cbs8.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.cbs8.dto.req.AgentPayResultRequestDTO; +import com.hzya.frame.cbs8.dto.res.AgentPayResultResDTO; +import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.checkerframework.checker.units.qual.A; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/6/18 17:22 + **/ +public class AgentPayResultPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(AgentPayResultPluginInitializer.class); + + @Autowired + private ICbsPluginService cbsPluginService; + + /*** + * 插件初始化方法 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 10:48 + * @Param [] + * @return void + **/ + @Override + public void initialize() { + + } + + /**** + * 插件销毁方法 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + /**** + * 插件的ID + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginId() { + return "CBS8AgentPayResultPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "cbs8代发代扣详情查询插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "cbs8代发代扣详情查询插件"; + } + + /*** + * 插件类型 1、场景插件 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 14:01 + * @Param [] + * @return java.lang.String + **/ + @Override + public String getPluginType() { + return "1"; + } + + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 执行业务代码的参数 + * @return void + **/ + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + //1、查询代发代扣交易未完成代 + //2、调用cbs接口 + AgentPayResultRequestDTO agentPayResultRequestDTO = new AgentPayResultRequestDTO(); + agentPayResultRequestDTO.setBusNum(""); + AgentPayResultResDTO agentPayResultResDTO = cbsPluginService.agentPayResult(agentPayResultRequestDTO); + //更新OA表单 + //记录日志 + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyAgentPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyAgentPluginInitializer.java new file mode 100644 index 00000000..3866684d --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyAgentPluginInitializer.java @@ -0,0 +1,128 @@ +package com.hzya.frame.plugin.cbs8.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.cbs8.dto.res.PayResponseDTO; +import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; +import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity; +import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity; +import com.hzya.frame.seeyon.cbs8.service.IAgentPaymentService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/6/18 14:03 + **/ +public class PayApplyAgentPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(PayApplyAgentPluginInitializer.class); + @Autowired + private ICbsPluginService cbsPluginService; + + + @Autowired + private IAgentPaymentService agentPaymentService; + + + /*** + * 插件初始化方法 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 10:48 + * @Param [] + * @return void + **/ + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + /**** + * 插件销毁方法 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + /**** + * 插件的ID + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginId() { + return "CBS8PayApplyAgentPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "cbs8代发代扣插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "cbs8代发代扣插件"; + } + + /*** + * 插件类型 1、场景插件 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 14:01 + * @Param [] + * @return java.lang.String + **/ + @Override + public String getPluginType() { + return "1"; + } + + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 执行业务代码的参数 + * @return void + **/ + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + //1、查询代支付的 + AgentPaymentEntity agentPaymentEntity = new AgentPaymentEntity(); + List agentPaymentList = agentPaymentService.queryUnpaid(agentPaymentEntity); + if (CollectionUtils.isNotEmpty(agentPaymentList)){ + for (AgentPaymentEntity paymentEntity : agentPaymentList) { + AgentPaymentDetailEntity detailEntity = new AgentPaymentDetailEntity(); + detailEntity.setFormmainId(paymentEntity.getId()); + List agentPaymentDetailList = agentPaymentService.queryDetails(detailEntity); + if (CollectionUtils.isNotEmpty(agentPaymentDetailList)){ + //调用代发代扣接口 + PayResponseDTO payResponseDTO = cbsPluginService.applyAgentPay(paymentEntity, agentPaymentDetailList); + //更新OA表单 + //记录日志 + } + } + } + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java index 65c4ac12..df88f720 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java @@ -97,7 +97,7 @@ public class PayApplyPluginInitializer extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { //支付申请 - // cbsPluginService.applyPay(requestJson); + //cbsPluginService.applyPay(requestJson); return null; } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java index f4491c0a..ae6401b4 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java @@ -1,8 +1,13 @@ package com.hzya.frame.plugin.cbs8.service; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.cbs8.dto.req.AgentPayResultRequestDTO; import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.res.AgentPayResultResDTO; +import com.hzya.frame.cbs8.dto.res.PayResponseDTO; import com.hzya.frame.cbs8.dto.res.TransactionDetailDTO; +import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity; +import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity; import java.util.List; @@ -39,4 +44,18 @@ public interface ICbsPluginService { * @param transactionDetailReqDTO */ List queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO); + + /** + * 代发代扣 支付申请 + * @param paymentEntity + * @param agentPaymentDetailList + */ + PayResponseDTO applyAgentPay(AgentPaymentEntity paymentEntity, List agentPaymentDetailList); + + /** + * 代发代扣 结果详情查询 + * @param agentPayResultRequestDTO + * @return + */ + AgentPayResultResDTO agentPayResult(AgentPayResultRequestDTO agentPayResultRequestDTO); } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java index 8cdc00ae..b81840ce 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java @@ -1,18 +1,19 @@ package com.hzya.frame.plugin.cbs8.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; -import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; -import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.req.*; import com.hzya.frame.cbs8.dto.res.*; import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.PayState; import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; +import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity; +import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity; import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.service.ICbsLogService; @@ -22,6 +23,7 @@ import com.hzya.frame.seeyon.entity.CtpFileEntity; import com.hzya.frame.seeyon.service.ICtpAttachmentService; import com.hzya.frame.seeyon.util.RestUtil; import com.hzya.frame.uuid.UUIDLong; +import com.hzya.frame.web.exception.BaseSystemException; import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,6 +51,8 @@ public class CbsPluginServiceImpl implements ICbsPluginService { @Autowired private ICtpAttachmentService ctpAttachmentService; + @Autowired + private RestUtil restUtil; @Value("${cbs8.elec_path}") private String elec_path; @Value("${OA.data_source_code}") @@ -177,7 +181,7 @@ public class CbsPluginServiceImpl implements ICbsPluginService { CtpFileEntity cpFileEntity = new CtpFileEntity(); cpFileEntity.setFile(file); cpFileEntity.setDataSourceCode(oa_data_source_code); - JSONObject jsonObjectUpload = RestUtil.fileUpload(file,"8000240005"); + JSONObject jsonObjectUpload = restUtil.fileUpload(file,"8000240005"); String file_url = jsonObjectUpload.getString("fileUrl"); if (null != jsonObjectUpload && StrUtil.isNotEmpty(file_url)) { String sub_reference = String.valueOf(UUIDLong.longUUID()); @@ -232,4 +236,41 @@ public class CbsPluginServiceImpl implements ICbsPluginService { return resultList; } + + /** + * 代发代扣 支付申请 + * + * @param paymentEntity + * @param agentPaymentDetailList + */ + @Override + public PayResponseDTO applyAgentPay(AgentPaymentEntity paymentEntity, List agentPaymentDetailList) { + if (null != paymentEntity && CollectionUtils.isNotEmpty(agentPaymentDetailList)){ + PaymentApplySubmitReqDTO paymentApplySubmitReqDTO = BeanUtil.copyProperties(paymentEntity,PaymentApplySubmitReqDTO.class); + List paymentApplyAgentList = new ArrayList<>(); + for (AgentPaymentDetailEntity detailEntity : agentPaymentDetailList) { + PaymentApplyAgentDTO detailDTO = BeanUtil.copyProperties(detailEntity,PaymentApplyAgentDTO.class); + paymentApplyAgentList.add(detailDTO); + } + PayResponseDTO payResponseDTO = cbs8Service.agentPayApply(paymentApplySubmitReqDTO,paymentApplyAgentList); + return payResponseDTO; + }else { + throw new BaseSystemException("参数不能为空"); + } + } + + /** + * 代发代扣 结果详情查询 + * + * @param agentPayResultRequestDTO + * @return + */ + @Override + public AgentPayResultResDTO agentPayResult(AgentPayResultRequestDTO agentPayResultRequestDTO) { + if (null != agentPayResultRequestDTO && StrUtil.isNotEmpty(agentPayResultRequestDTO.getBusNum())){ + AgentPayResultResDTO agentPayResultResDTO = cbs8Service.agentPayResult(agentPayResultRequestDTO); + return agentPayResultResDTO; + } + return null; + } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java new file mode 100644 index 00000000..e8e9d374 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -0,0 +1,436 @@ +package com.hzya.frame.plugin.mdmDistribute.plugin; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.service.IMdmServiceCache; +import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao; +import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sysnew.application.dao.ISysApplicationDao; +import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao; +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.http.HttpEntity; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import javax.annotation.Resource; +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 主数据模版(MdmModule)表服务接口 + * + * @author makejava + * @since 2024-06-18 10:33:32 + */ +public class MdmModulePluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(MdmModulePluginInitializer.class); + @Resource + private IIntegrationTaskLivingDetailsDao integrationTaskLivingDetailsDao; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Resource + private ISysApplicationApiDao sysApplicationApiDao; + @Resource + private ISysApplicationDao sysApplicationDao; + @Resource + private ISysApplicationScriptDao sysApplicationScriptDao; + @Resource + private IMdmModuleDistributeDao mdmModuleDistributeDao; + @Resource + private IGroovyIntegrationService groovyIntegrationService; + @Resource + private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; + @Resource + private IMdmModuleDao mdmModuleDao; + @Resource + private IMdmServiceCache mdmServiceCache; + + @Value("${ax.url}") + private String url ; + + //多线程请求加锁 HttpRequest 构造方法是静态的 + private final Object lock = new Object(); + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "MdmModulePlugin"; + } + + @Override + public String getPluginName() { + return "MdmModulePlugin插件"; + } + + @Override + public String getPluginLabel() { + return "MdmModulePlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try{ + //重试方法 + if (null != requestJson) { + //如果这个id不为空,说明是重试的 + String id = requestJson.getString("integration_task_living_details_id"); + //执行重新发送 + if (StrUtil.isNotEmpty(id)) { + //查询日志表 + IntegrationTaskLivingDetailsEntity taskDetailEntity = taskLivingDetailsService.get(id); + if (null != taskDetailEntity && JSONUtil.isTypeJSON(taskDetailEntity.getRootAppPk())){ + //拿到这张表的源系统ID + JSONObject jsonObject = JSONObject.parseObject(taskDetailEntity.getRootAppPk()); + Long mdmCode = jsonObject.getLong("mdmCode");//主数据编码 + String documentRule = jsonObject.getString("documentRule");//行数据的单据规则编码 + String distributeId = jsonObject.getString("distributeId");//发送表id + String type = jsonObject.getString("type");//发送类型,1、新增2、修改3、删除 + if(mdmCode == null || documentRule == null || distributeId == null || type == null + || "".equals(mdmCode) || "".equals(documentRule) || "".equals(distributeId) || "".equals(type)){ + taskDetailEntity.setResult("系统保存参数错误"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("系统保存参数错误"); + } + String apiId = null; + String scriptId = null; + //查找对应数据,组装数据发送 + + //获取主数据信息 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(mdmCode); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null ){ + taskDetailEntity.setResult("主数据不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("主数据不存在"); + + } + + //获取主数据db + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){ + taskDetailEntity.setResult("主数据数据源不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("主数据数据源不存在"); + + } + + //获取分发表 + //获取分发的接口 + MdmModuleDistributeEntity mdmModuleDistributeEntity = mdmModuleDistributeDao.get(distributeId); + if(mdmModuleDistributeEntity == null || mdmModuleDistributeEntity.getId() == null ){ + taskDetailEntity.setResult("分发不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发不存在"); + + } + // 启用停用 0、停用 + if("0".equals(mdmModuleDistributeEntity.getEnabledState())){ + taskDetailEntity.setResult("分发已停用"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发已停用"); + + } + // 启用停用 0、停用 + //if("1".equals(mdmModuleDistributeEntity.getEnabledType())){ + // taskDetailEntity.setResult("分发为手动下发"); + // taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + // return BaseResult.getFailureMessageEntity("分发为手动下发"); + //} + //1、新增2、修改3、删除 + if("1".equals(type)){ + apiId = mdmModuleDistributeEntity.getAddApi(); + scriptId = mdmModuleDistributeEntity.getAddScript(); + }else if("2".equals(type)){ + apiId = mdmModuleDistributeEntity.getUpdateApi(); + scriptId = mdmModuleDistributeEntity.getUpdateScript(); + + }else if("3".equals(type)){ + apiId = mdmModuleDistributeEntity.getDeleteApi(); + scriptId = mdmModuleDistributeEntity.getDeleteScript(); + } + if(apiId == null || "".equals(apiId)){ + taskDetailEntity.setResult("分发接口未选择,请先选择"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发接口未选择,请先选择"); + + } + SysApplicationScriptEntity scriptEntity = null; + if(scriptId != null && !"".equals(scriptId)){ + scriptEntity = sysApplicationScriptDao.get(scriptId); + if(scriptEntity == null || scriptEntity.getId() == null ){ + taskDetailEntity.setResult("分发接口脚本不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发接口脚本不存在"); + } + } + SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(apiId); + if(apiEntity == null || apiEntity.getId() == null ){ + taskDetailEntity.setResult("分发接口不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发接口不存在"); + + } + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); + if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ + taskDetailEntity.setResult("应用不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("应用不存在"); + + } + + //获取主数据db字段,以及字段的规则 + MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity(); + queryFild.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); + MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity(); + queryFildRule.setMdmId(mdmModuleEntity.getId()); + queryFildRule.setRuleCode("service"); + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); + //获取主数据db对应的实体表的数据 + JSONObject object = new JSONObject(); + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + Map map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + map.put("documentRule",documentRule); + object = mdmModuleDao.queryMdmST(map); + if(object.getString("id") == null || "".equals(object.getString("id")) ){ + taskDetailEntity.setResult("当前数据不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("当前数据不存在"); + } + //查看主表是否有字段是关联的 + if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) { + if(mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())){ + if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ + for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) { + if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){ + Map mapDetail = new HashMap<>(); + mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue()); + mapDetail.put("id",object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName())); + JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail); + object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail); + } + } + } + } + } + } + } + } + + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("2".equals(mdmModuleDbEntities.get(i).getDbType())){ + Map map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + map.put("formmainId",object.getString("id")); + List detail = mdmModuleDao.queryMdmSTDetail(map); + //查看主表是否有字段是关联的 + if(detail != null && detail.size() > 0){ + if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) { + if(mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())){ + if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ + for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) { + if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){ + for (int i3 = 0; i3 < detail.size(); i3++) { + Map mapDetail = new HashMap<>(); + mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue()); + mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName())); + JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail); + detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail); + } + } + } + } + } + } + } + } + object.put(mdmModuleDbEntities.get(i).getDbName(),detail); + } + } + //执行脚本 + JSONObject groovy = new JSONObject(); + JSONObject parameterJson = new JSONObject(); + parameterJson.put("header",apiEntity.getHeaderIn()); + parameterJson.put("body",apiEntity.getBodyIn()); + parameterJson.put("query",apiEntity.getQueryIn()); + parameterJson.put("data",object); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = object.toJSONString(); + if(scriptEntity != null && scriptEntity.getId() != null ){ + groovy.put("code",scriptEntity.getScriptCode()); + groovy.put("className",scriptEntity.getClassName()); + groovy.put("name",scriptEntity.getScriptName()); + groovy.put("methodStr",scriptEntity.getScriptData()); + groovy.put("parameterJson",parameterJson); + JSONObject groovyStr = new JSONObject(); + groovyStr.put("jsonStr",groovy); + try { + SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + taskDetailEntity.setResult("分发脚本转换错误"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + //return BaseResult.getFailureMessageEntity("分发脚本转换错误"); + } + } + Map headers = new HashMap<>(); + headers.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj"); + headers.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="); + headers.put("appId",sysApplicationEntity.getAppId().toString()); + headers.put("apiCode",apiEntity.getApiCode().toString()); + if(header != null){ + headers.putAll(header); + } + //组装数据发送 + JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); + if(jsonResultEntity.isFlag()){ + taskDetailEntity.setResult("发送成功"); + taskLivingDetailsService.saveLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("发送成功"); + }else { + taskDetailEntity.setResult("发送错误"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("发送错误"); + } + } + }else { + //执行正常下发 + + + } + } + logger.info("执行成功"); + return BaseResult.getSuccessMessageEntity("执行成功"); + } catch (Exception e) { + logger.error("执行失败{}",e.getMessage()); + } + return BaseResult.getSuccessMessageEntity("执行成功"); + } + + private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map headers ,String bodys ,String querys) { + StringBuffer urls = new StringBuffer(url); + if (querys != null) { + urls.append("?"); + urls.append(querys); + } + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpPost post = new HttpPost(urls.toString()); + CloseableHttpResponse response = null; + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(Integer.valueOf(applicationApiEntity.getTimeoutPeriod())).build(); + post.setConfig(requestConfig);//设置请求参数【超时时间】 + + if (headers != null && headers.size() > 0) { + for (String key : headers.keySet()) { + post.setHeader(key, headers.get(key)); + } + } + StringBuilder body = new StringBuilder(); + boolean flag = true; + try { + if (bodys != null && !"".equals(bodys)) { + ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8")); + entity.setContentType("application/json"); + post.setEntity(entity); + } + response = closeableHttpClient.execute(post); + + HttpEntity entity = response.getEntity(); + synchronized (lock) { + body.append(EntityUtils.toString(entity,"UTF-8")); + } + flag = true; + logger.info("返回结果:" + body); + } catch (Exception e) { + logger.error("请求错误:" + e.getMessage()); + body.append(e.getMessage()); + flag = false; + } finally { + try { + // 关闭响应对象 + if (response != null) { + response.close(); + } + // 关闭响应对象 + if (closeableHttpClient != null) { + closeableHttpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + if (flag) { + if (JSONUtil.isTypeJSON(body.toString())) { + JsonResultEntity jsonResultEntity = JSONObject.parseObject(body.toString(),JsonResultEntity.class); + if(jsonResultEntity.isFlag()){ + return BaseResult.getSuccessMessageEntity("转发成功", body); + }else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + }else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } +} diff --git a/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/pluginCfg.xml new file mode 100644 index 00000000..7b7b63b8 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/pluginCfg.xml @@ -0,0 +1,6 @@ + + +MdmModulePlugin +MdmModulePlugin插件 +90000001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..4952fc4c --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/req/AgentPayRequestDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/req/AgentPayRequestDTO.java new file mode 100644 index 00000000..1a906cba --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/req/AgentPayRequestDTO.java @@ -0,0 +1,32 @@ +package com.hzya.frame.cbs8.dto.req; + +import java.util.List; + +/** + * @Description 代发代扣请求参数 + * @Author xiangerlin + * @Date 2024/6/18 16:20 + **/ +public class AgentPayRequestDTO { + + //代发表头 + private PaymentApplySubmitReqDTO paymentApplySubmitReqDTO; + //代发明细 + private List paymentApplyAgentDTO; + + public PaymentApplySubmitReqDTO getPaymentApplySubmitReqDTO() { + return paymentApplySubmitReqDTO; + } + + public void setPaymentApplySubmitReqDTO(PaymentApplySubmitReqDTO paymentApplySubmitReqDTO) { + this.paymentApplySubmitReqDTO = paymentApplySubmitReqDTO; + } + + public List getPaymentApplyAgentDTO() { + return paymentApplyAgentDTO; + } + + public void setPaymentApplyAgentDTO(List paymentApplyAgentDTO) { + this.paymentApplyAgentDTO = paymentApplyAgentDTO; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/req/AgentPayResultRequestDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/req/AgentPayResultRequestDTO.java new file mode 100644 index 00000000..a4ef80c8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/req/AgentPayResultRequestDTO.java @@ -0,0 +1,20 @@ +package com.hzya.frame.cbs8.dto.req; + +/** + * @Description 代发代扣详情查询请求参数 + * @Author xiangerlin + * @Date 2024/6/18 17:40 + **/ +public class AgentPayResultRequestDTO { + + //申请单编号。 代发代扣支付接口会返回这个单号的 + private String busNum; + + public String getBusNum() { + return busNum; + } + + public void setBusNum(String busNum) { + this.busNum = busNum; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/req/PaymentApplyAgentDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/req/PaymentApplyAgentDTO.java new file mode 100644 index 00000000..509165a3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/req/PaymentApplyAgentDTO.java @@ -0,0 +1,132 @@ +package com.hzya.frame.cbs8.dto.req; + +/** + * @Description 代发代扣明细 + * @Author xiangerlin + * @Date 2024/6/18 13:45 + **/ +public class PaymentApplyAgentDTO { + //每笔明细金额 + private String dtlAmount; + //收款账号 + private String dtlRevAccount; + //联行号 同行可不传,跨行必传 + private String dtlCnapsCode; + //收款账户名称 + private String dtlRevName; + //收款开户行 ,如果传的联行号能匹配到对应到开户行,cbs8会自动带出 + private String dtlRevBankName; + + + + //是否跨行 Y跨行 N同行 + private String dtlBankFlag; + //明细用途 + private String dtlPurpose; + //明细摘要 + private String dtlRemark; + //收款账号银行号|地区码 + private String dtlRevBankArea; + //收款开户地 + private String dtlRevBankCity; + //明细序号,从1开始递增 + private int dtlSeqNum; + //备用字段 一共6个 + private String dtlExtend1; + + public String getDtlAmount() { + return dtlAmount; + } + + public void setDtlAmount(String dtlAmount) { + this.dtlAmount = dtlAmount; + } + + public String getDtlRevAccount() { + return dtlRevAccount; + } + + public void setDtlRevAccount(String dtlRevAccount) { + this.dtlRevAccount = dtlRevAccount; + } + + public String getDtlCnapsCode() { + return dtlCnapsCode; + } + + public void setDtlCnapsCode(String dtlCnapsCode) { + this.dtlCnapsCode = dtlCnapsCode; + } + + public String getDtlRevName() { + return dtlRevName; + } + + public void setDtlRevName(String dtlRevName) { + this.dtlRevName = dtlRevName; + } + + public String getDtlRevBankName() { + return dtlRevBankName; + } + + public void setDtlRevBankName(String dtlRevBankName) { + this.dtlRevBankName = dtlRevBankName; + } + + public String getDtlBankFlag() { + return dtlBankFlag; + } + + public void setDtlBankFlag(String dtlBankFlag) { + this.dtlBankFlag = dtlBankFlag; + } + + public String getDtlPurpose() { + return dtlPurpose; + } + + public void setDtlPurpose(String dtlPurpose) { + this.dtlPurpose = dtlPurpose; + } + + public String getDtlRemark() { + return dtlRemark; + } + + public void setDtlRemark(String dtlRemark) { + this.dtlRemark = dtlRemark; + } + + public String getDtlRevBankArea() { + return dtlRevBankArea; + } + + public void setDtlRevBankArea(String dtlRevBankArea) { + this.dtlRevBankArea = dtlRevBankArea; + } + + public String getDtlRevBankCity() { + return dtlRevBankCity; + } + + public void setDtlRevBankCity(String dtlRevBankCity) { + this.dtlRevBankCity = dtlRevBankCity; + } + + public int getDtlSeqNum() { + return dtlSeqNum; + } + + public void setDtlSeqNum(int dtlSeqNum) { + this.dtlSeqNum = dtlSeqNum; + } + + public String getDtlExtend1() { + return dtlExtend1; + } + + public void setDtlExtend1(String dtlExtend1) { + this.dtlExtend1 = dtlExtend1; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/req/PaymentApplySubmitReqDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/req/PaymentApplySubmitReqDTO.java new file mode 100644 index 00000000..ed5e55a7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/req/PaymentApplySubmitReqDTO.java @@ -0,0 +1,182 @@ +package com.hzya.frame.cbs8.dto.req; + +/** + * @Description 批量代发代扣 203代发 201代扣 + * @Author xiangerlin + * @Date 2024/6/18 11:58 + **/ +public class PaymentApplySubmitReqDTO { + //业务参考号 + private String referenceNum; + /** + * 业务类型 + * 201-代扣 + * 203-代发 + * 代发工资传203 + */ + private String busType; + //总金额 小数位2位 + private String amount; + //币种 + private String currency; + //付款账号 + private String payAccount; + //用途 + private String purpose; + // 以上是必填字段 + + + + //备注 + private String summary; + //期望支付时间 + private String expectTime; + //公私标识 1对私 0对公 + private String personalFlag; + //加急标志 1加急 0不加急 + private String urgentTag; + //是否实时 1实时 0落地 + private String realTimeTag; + /** + * 同城标志 0同城 1异地 + * 收/付账号所属同一个城市为同城,否则为异地 + */ + private String cityFlag; + //银行备用字段 一共8个 + private String bankExtend1; + + //客户备用字段1 + private String erpExtend1; + //客户备用字段1 + private String erpExtend2; + //客户备用字段1 + private String erpExtend3; + + public String getReferenceNum() { + return referenceNum; + } + + public void setReferenceNum(String referenceNum) { + this.referenceNum = referenceNum; + } + + public String getBusType() { + return busType; + } + + public void setBusType(String busType) { + this.busType = busType; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getPayAccount() { + return payAccount; + } + + public void setPayAccount(String payAccount) { + this.payAccount = payAccount; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public String getExpectTime() { + return expectTime; + } + + public void setExpectTime(String expectTime) { + this.expectTime = expectTime; + } + + public String getPersonalFlag() { + return personalFlag; + } + + public void setPersonalFlag(String personalFlag) { + this.personalFlag = personalFlag; + } + + public String getUrgentTag() { + return urgentTag; + } + + public void setUrgentTag(String urgentTag) { + this.urgentTag = urgentTag; + } + + public String getRealTimeTag() { + return realTimeTag; + } + + public void setRealTimeTag(String realTimeTag) { + this.realTimeTag = realTimeTag; + } + + public String getCityFlag() { + return cityFlag; + } + + public void setCityFlag(String cityFlag) { + this.cityFlag = cityFlag; + } + + public String getBankExtend1() { + return bankExtend1; + } + + public void setBankExtend1(String bankExtend1) { + this.bankExtend1 = bankExtend1; + } + + public String getErpExtend1() { + return erpExtend1; + } + + public void setErpExtend1(String erpExtend1) { + this.erpExtend1 = erpExtend1; + } + + public String getErpExtend2() { + return erpExtend2; + } + + public void setErpExtend2(String erpExtend2) { + this.erpExtend2 = erpExtend2; + } + + public String getErpExtend3() { + return erpExtend3; + } + + public void setErpExtend3(String erpExtend3) { + this.erpExtend3 = erpExtend3; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/res/AgentPayQueryDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/res/AgentPayQueryDTO.java new file mode 100644 index 00000000..402e7895 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/res/AgentPayQueryDTO.java @@ -0,0 +1,280 @@ +package com.hzya.frame.cbs8.dto.res; + +/** + * @Description 代发代扣查询详情 + * @Author xiangerlin + * @Date 2024/6/19 09:02 + **/ +public class AgentPayQueryDTO { + // 申请单编号 + private String busNum; + + // 代发/代扣明细序号 + private String dtlSeqNum; + + // 金额 + private String dtlAmount; // 考虑到金额计算精度,建议使用BigDecimal + + // 收款人名称 + private String dtlRevName; + + // 收款人账号 + private String dtlRevAccount; + + // 收款人开户行 + private String dtlRevBankName; + + // 银行号 + private String dtlBankNum; + + // 联行号 + private String dtlCnapsCode; + + // 是否跨行(Y:开户行是招商银行。N:开户行是他行。为空默认为招行) + private String dtlBankFlag; + + // 地区名称 + private String dtlRevBankArea; + + // 注释 + private String dtlRemark; + + // 状态 + private String dtlStatus; + + // 错误信息 + private String dtlErrorMessage; + + // 他行开户地 + private String dtlRevBankCity; + + // 备用字段1-6 + private String dtlExtend1; + private String dtlExtend2; + private String dtlExtend3; + private String dtlExtend4; + private String dtlExtend5; + private String dtlExtend6; + + // ERP备注1-3 + private String dtlErpComment1; + private String dtlErpComment2; + private String dtlErpComment3; + + // 用途 + private String dtlPurpose; + + // 银行支付时间 + private String dtlPayTime; + + // 实际扣款金额 + private String dtlActualAmount; + + public String getBusNum() { + return busNum; + } + + public void setBusNum(String busNum) { + this.busNum = busNum; + } + + public String getDtlSeqNum() { + return dtlSeqNum; + } + + public void setDtlSeqNum(String dtlSeqNum) { + this.dtlSeqNum = dtlSeqNum; + } + + public String getDtlAmount() { + return dtlAmount; + } + + public void setDtlAmount(String dtlAmount) { + this.dtlAmount = dtlAmount; + } + + public String getDtlRevName() { + return dtlRevName; + } + + public void setDtlRevName(String dtlRevName) { + this.dtlRevName = dtlRevName; + } + + public String getDtlRevAccount() { + return dtlRevAccount; + } + + public void setDtlRevAccount(String dtlRevAccount) { + this.dtlRevAccount = dtlRevAccount; + } + + public String getDtlRevBankName() { + return dtlRevBankName; + } + + public void setDtlRevBankName(String dtlRevBankName) { + this.dtlRevBankName = dtlRevBankName; + } + + public String getDtlBankNum() { + return dtlBankNum; + } + + public void setDtlBankNum(String dtlBankNum) { + this.dtlBankNum = dtlBankNum; + } + + public String getDtlCnapsCode() { + return dtlCnapsCode; + } + + public void setDtlCnapsCode(String dtlCnapsCode) { + this.dtlCnapsCode = dtlCnapsCode; + } + + public String getDtlBankFlag() { + return dtlBankFlag; + } + + public void setDtlBankFlag(String dtlBankFlag) { + this.dtlBankFlag = dtlBankFlag; + } + + public String getDtlRevBankArea() { + return dtlRevBankArea; + } + + public void setDtlRevBankArea(String dtlRevBankArea) { + this.dtlRevBankArea = dtlRevBankArea; + } + + public String getDtlRemark() { + return dtlRemark; + } + + public void setDtlRemark(String dtlRemark) { + this.dtlRemark = dtlRemark; + } + + public String getDtlStatus() { + return dtlStatus; + } + + public void setDtlStatus(String dtlStatus) { + this.dtlStatus = dtlStatus; + } + + public String getDtlErrorMessage() { + return dtlErrorMessage; + } + + public void setDtlErrorMessage(String dtlErrorMessage) { + this.dtlErrorMessage = dtlErrorMessage; + } + + public String getDtlRevBankCity() { + return dtlRevBankCity; + } + + public void setDtlRevBankCity(String dtlRevBankCity) { + this.dtlRevBankCity = dtlRevBankCity; + } + + public String getDtlExtend1() { + return dtlExtend1; + } + + public void setDtlExtend1(String dtlExtend1) { + this.dtlExtend1 = dtlExtend1; + } + + public String getDtlExtend2() { + return dtlExtend2; + } + + public void setDtlExtend2(String dtlExtend2) { + this.dtlExtend2 = dtlExtend2; + } + + public String getDtlExtend3() { + return dtlExtend3; + } + + public void setDtlExtend3(String dtlExtend3) { + this.dtlExtend3 = dtlExtend3; + } + + public String getDtlExtend4() { + return dtlExtend4; + } + + public void setDtlExtend4(String dtlExtend4) { + this.dtlExtend4 = dtlExtend4; + } + + public String getDtlExtend5() { + return dtlExtend5; + } + + public void setDtlExtend5(String dtlExtend5) { + this.dtlExtend5 = dtlExtend5; + } + + public String getDtlExtend6() { + return dtlExtend6; + } + + public void setDtlExtend6(String dtlExtend6) { + this.dtlExtend6 = dtlExtend6; + } + + public String getDtlErpComment1() { + return dtlErpComment1; + } + + public void setDtlErpComment1(String dtlErpComment1) { + this.dtlErpComment1 = dtlErpComment1; + } + + public String getDtlErpComment2() { + return dtlErpComment2; + } + + public void setDtlErpComment2(String dtlErpComment2) { + this.dtlErpComment2 = dtlErpComment2; + } + + public String getDtlErpComment3() { + return dtlErpComment3; + } + + public void setDtlErpComment3(String dtlErpComment3) { + this.dtlErpComment3 = dtlErpComment3; + } + + public String getDtlPurpose() { + return dtlPurpose; + } + + public void setDtlPurpose(String dtlPurpose) { + this.dtlPurpose = dtlPurpose; + } + + public String getDtlPayTime() { + return dtlPayTime; + } + + public void setDtlPayTime(String dtlPayTime) { + this.dtlPayTime = dtlPayTime; + } + + public String getDtlActualAmount() { + return dtlActualAmount; + } + + public void setDtlActualAmount(String dtlActualAmount) { + this.dtlActualAmount = dtlActualAmount; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/res/AgentPayResultResDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/res/AgentPayResultResDTO.java new file mode 100644 index 00000000..5ea5d5ae --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/res/AgentPayResultResDTO.java @@ -0,0 +1,450 @@ +package com.hzya.frame.cbs8.dto.res; + +import java.util.List; + +/** + * @Description 代发代扣 返回参数对象 + * @Author xiangerlin + * @Date 2024/6/19 08:53 + **/ +public class AgentPayResultResDTO { + // 支付的业务类型 + private String busType; + + // 申请单编号 + private String busNum; + + // 付款账户 + private String payAccount; + + // 付款账户名称 + private String payAccountName; + + // 付款账户开户行 + private String payBankName; + + // 付款银行类型 + private String payBankType; + + // 币种 + private String currency; + + // 金额 + private String amount; + + // 收款账户 + private String revAccount; + + // 收款账户名称 + private String revAccountName; + + // 收款开户行 + private String revBankName; + + // 收款银行类型 + private String revBankType; + + // 收款人省 + private String revProvince; + + // 对账码集合(假设为String列表) + private List checkCodeList; + + // 收款人市 + private String revCity; + + // 支付渠道 + private String payChannel; + + // 付款单提示信息/银行返回信息 + private String errorMsg; + + // 支付申请状态 + private String status; + + // 经办人ID + private String createBy; + + // 经办人名称 + private String createByName; + + // 用途 + private String purpose; + + // 摘要/备注 + private String summary; + + // 期望支付时间 + private String expectTime; + + // 支付时间 + private String payDate; + + // 支付状态 + private String payStatus; + + // 客户备用字段1 + private String erpExtend1; + + // 客户备用字段2 + private String erpExtend2; + + // 客户备用字段3 + private String erpExtend3; + + // 计划流水号 + private String planNumber; + + // 资金预算编号 + private String planItemCode; + + // 预算项名称 + private String planItemName; + + // 预算所属单位编码 + private String planUnitCode; + + // 预算所属单位名称 + private String planUnitName; + + // 单位编码(前端展示) + private String displayUnitCode; + + // 预算单位编码(前端展示) + private String displayPlanUnitCode; + + // 经办用户单位编码(前端展示) + private String displayOperaterOrgCode; + + // 付方单位编码(前端展示) + private String displayPayOrgCode; + + // 客商编号 + private String revCustomerCode; + + // 结算方式 + private String payType; + + //代发代扣详情 + private List agentDetails; + + public String getBusType() { + return busType; + } + + public void setBusType(String busType) { + this.busType = busType; + } + + public String getBusNum() { + return busNum; + } + + public void setBusNum(String busNum) { + this.busNum = busNum; + } + + public String getPayAccount() { + return payAccount; + } + + public void setPayAccount(String payAccount) { + this.payAccount = payAccount; + } + + public String getPayAccountName() { + return payAccountName; + } + + public void setPayAccountName(String payAccountName) { + this.payAccountName = payAccountName; + } + + public String getPayBankName() { + return payBankName; + } + + public void setPayBankName(String payBankName) { + this.payBankName = payBankName; + } + + public String getPayBankType() { + return payBankType; + } + + public void setPayBankType(String payBankType) { + this.payBankType = payBankType; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getRevAccount() { + return revAccount; + } + + public void setRevAccount(String revAccount) { + this.revAccount = revAccount; + } + + public String getRevAccountName() { + return revAccountName; + } + + public void setRevAccountName(String revAccountName) { + this.revAccountName = revAccountName; + } + + public String getRevBankName() { + return revBankName; + } + + public void setRevBankName(String revBankName) { + this.revBankName = revBankName; + } + + public String getRevBankType() { + return revBankType; + } + + public void setRevBankType(String revBankType) { + this.revBankType = revBankType; + } + + public String getRevProvince() { + return revProvince; + } + + public void setRevProvince(String revProvince) { + this.revProvince = revProvince; + } + + public List getCheckCodeList() { + return checkCodeList; + } + + public void setCheckCodeList(List checkCodeList) { + this.checkCodeList = checkCodeList; + } + + public String getRevCity() { + return revCity; + } + + public void setRevCity(String revCity) { + this.revCity = revCity; + } + + public String getPayChannel() { + return payChannel; + } + + public void setPayChannel(String payChannel) { + this.payChannel = payChannel; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public String getCreateByName() { + return createByName; + } + + public void setCreateByName(String createByName) { + this.createByName = createByName; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public String getExpectTime() { + return expectTime; + } + + public void setExpectTime(String expectTime) { + this.expectTime = expectTime; + } + + public String getPayDate() { + return payDate; + } + + public void setPayDate(String payDate) { + this.payDate = payDate; + } + + public String getPayStatus() { + return payStatus; + } + + public void setPayStatus(String payStatus) { + this.payStatus = payStatus; + } + + public String getErpExtend1() { + return erpExtend1; + } + + public void setErpExtend1(String erpExtend1) { + this.erpExtend1 = erpExtend1; + } + + public String getErpExtend2() { + return erpExtend2; + } + + public void setErpExtend2(String erpExtend2) { + this.erpExtend2 = erpExtend2; + } + + public String getErpExtend3() { + return erpExtend3; + } + + public void setErpExtend3(String erpExtend3) { + this.erpExtend3 = erpExtend3; + } + + public String getPlanNumber() { + return planNumber; + } + + public void setPlanNumber(String planNumber) { + this.planNumber = planNumber; + } + + public String getPlanItemCode() { + return planItemCode; + } + + public void setPlanItemCode(String planItemCode) { + this.planItemCode = planItemCode; + } + + public String getPlanItemName() { + return planItemName; + } + + public void setPlanItemName(String planItemName) { + this.planItemName = planItemName; + } + + public String getPlanUnitCode() { + return planUnitCode; + } + + public void setPlanUnitCode(String planUnitCode) { + this.planUnitCode = planUnitCode; + } + + public String getPlanUnitName() { + return planUnitName; + } + + public void setPlanUnitName(String planUnitName) { + this.planUnitName = planUnitName; + } + + public String getDisplayUnitCode() { + return displayUnitCode; + } + + public void setDisplayUnitCode(String displayUnitCode) { + this.displayUnitCode = displayUnitCode; + } + + public String getDisplayPlanUnitCode() { + return displayPlanUnitCode; + } + + public void setDisplayPlanUnitCode(String displayPlanUnitCode) { + this.displayPlanUnitCode = displayPlanUnitCode; + } + + public String getDisplayOperaterOrgCode() { + return displayOperaterOrgCode; + } + + public void setDisplayOperaterOrgCode(String displayOperaterOrgCode) { + this.displayOperaterOrgCode = displayOperaterOrgCode; + } + + public String getDisplayPayOrgCode() { + return displayPayOrgCode; + } + + public void setDisplayPayOrgCode(String displayPayOrgCode) { + this.displayPayOrgCode = displayPayOrgCode; + } + + public String getRevCustomerCode() { + return revCustomerCode; + } + + public void setRevCustomerCode(String revCustomerCode) { + this.revCustomerCode = revCustomerCode; + } + + public String getPayType() { + return payType; + } + + public void setPayType(String payType) { + this.payType = payType; + } + + public List getAgentDetails() { + return agentDetails; + } + + public void setAgentDetails(List agentDetails) { + this.agentDetails = agentDetails; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java index b51a41fa..9cd4e3cd 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java @@ -5,7 +5,7 @@ package com.hzya.frame.cbs8.dto.res; * @Author xiangerlin * @Date 2023/12/29 16:40 **/ -public class TransactionDetailDTO extends TransactionResParentDTO{ +public class TransactionDetailDTO{ private String accountNo;//银行账号 private String accountName;//银行名称 private String bankType;//银行类型 diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java index f4961dc9..5f47a625 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java @@ -16,6 +16,13 @@ public interface ICbs8ExtService { */ SysExtensionApiEntity payApply(SysExtensionApiEntity entity); + /** + * 代发代扣 支付申请 + * @param entity + * @return + */ + SysExtensionApiEntity agentPayApply(SysExtensionApiEntity entity); + /** * 交易结果查询 * @param entity @@ -49,4 +56,5 @@ public interface ICbs8ExtService { * @return */ SysExtensionApiEntity elecQuery(SysExtensionApiEntity entity); + } diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java index 138991ac..2b55c362 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java @@ -1,9 +1,7 @@ package com.hzya.frame.cbs8.service; import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; -import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; -import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.req.*; import com.hzya.frame.cbs8.dto.res.*; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; @@ -50,4 +48,19 @@ public interface ICbs8Service { * @return */ CbsResDataDTO queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO); + + /** + * 代发代扣 支付申请 + * @param paymentApplySubmitReqDTO + * @param paymentApplyAgentList + */ + PayResponseDTO agentPayApply(PaymentApplySubmitReqDTO paymentApplySubmitReqDTO, List paymentApplyAgentList); + + /** + * 代发代扣 详情查询 + * @param agentPayResultRequestDTO + * @return + */ + AgentPayResultResDTO agentPayResult(AgentPayResultRequestDTO agentPayResultRequestDTO); + } diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java index 0e3edd92..57e49443 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java @@ -4,14 +4,10 @@ import cn.hutool.core.convert.Convert; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; -import com.hzya.frame.cbs8.dto.req.PayRequestDTO; -import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; -import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.req.*; import com.hzya.frame.cbs8.service.ICbs8ExtService; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.CbsAccessToken; -import com.hzya.frame.cbs8.util.SM2Util; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.stringutil.StringUtil; import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; @@ -65,26 +61,31 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { payRequestDTO.setPayAccount(null); } String requestData = JSONObject.toJSONString(payRequestDTO); - //签名 - long timestamp = System.currentTimeMillis(); - String sign = CBSUtil.sign(requestData,timestamp); - //加密 - byte[] encryptedData = CBSUtil.encrypt(requestData); - Map header = new HashMap(); - header.put(CBSUtil.SIGN_HEADER_NAME,sign); - header.put(CBSUtil.TIMESTAMP_HEADER,Long.toString(timestamp)); - header.put(HTTP.CONTENT_TYPE,CBSUtil.TARGET_CONTENT_TYPE); - header.put(CBSUtil.AUTHORIZATION,CBSUtil.BEARER+ CbsAccessToken.getToken()); - entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); - entity.setHeaders(header); - - String body = HttpRequest.post("https://cbs8-openapi-reprd.csuat.cmburl.cn/openapi/payment/openapi/v1/payment-apply-common").addHeaders(header).body(encryptedData).execute().body(); - System.out.println(body); + //加密 签名 + encrypAndsign(entity,requestData); } } return entity; } + /** + * 代发代扣 支付申请 + * + * @param entity + * @return + */ + @Override + public SysExtensionApiEntity agentPayApply(SysExtensionApiEntity entity) { + String boyds = entity.getBodys(); + if (StrUtil.isNotEmpty(boyds)){ + AgentPayRequestDTO agentPayRequest = JSONObject.parseObject(boyds,AgentPayRequestDTO.class); + String requestData = JSONObject.toJSONString(agentPayRequest); + //加密签名 + encrypAndsign(entity, requestData); + } + return entity; + } + /** * 交易结果查询 * @@ -98,17 +99,8 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { PayResultRequestDTO payResultRequest = JSONObject.parseObject(bodys,PayResultRequestDTO.class); if (null != payResultRequest && StrUtil.isNotEmpty(payResultRequest.getReferenceNum())){ String requestData = JSONObject.toJSONString(payResultRequest); - //签名 - long timestamp = System.currentTimeMillis(); - String sign = CBSUtil.sign(requestData,timestamp); - //加密 - byte[] encryptedData = CBSUtil.encrypt(requestData); - Map header = getHeaders(sign,timestamp); - entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); - entity.setHeaders(header); - byte[] bodyBytes = HttpRequest.post("https://cbs8-openapi-reprd.csuat.cmburl.cn/openapi/payment/openapi/v2/detail").addHeaders(header).body(encryptedData).execute().bodyBytes(); - //解密报文 - String decrypt = CBSUtil.decrypt(bodyBytes); + //加密 签名 + encrypAndsign(entity,requestData); }else { throw new BaseSystemException("业务参考号不能为空!!!!"); } @@ -128,14 +120,8 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { if (StrUtil.isEmpty(bodys)){ TransactionDetailReqDTO transactionDetailReqDTO = JSONObject.parseObject(bodys,TransactionDetailReqDTO.class); String requestData = JSONObject.toJSONString(transactionDetailReqDTO); - //签名 - long timestamp = System.currentTimeMillis(); - String sign = CBSUtil.sign(requestData,timestamp); - //加密 - byte[] encryptedData = CBSUtil.encrypt(requestData); - Map header = getHeaders(sign,timestamp); - entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); - entity.setHeaders(header); + ////加密签名 + encrypAndsign(entity, requestData); } return entity; } @@ -148,9 +134,18 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { */ @Override public SysExtensionApiEntity payApplyAgent(SysExtensionApiEntity entity) { - return null; + String bodys = entity.getBodys(); + if (StrUtil.isNotEmpty(bodys)){ + AgentPayRequestDTO agentPayRequest = JSONObject.parseObject(bodys,AgentPayRequestDTO.class); + String requestData = JSONObject.toJSONString(agentPayRequest); + ////加密签名 + encrypAndsign(entity, requestData); + } + return entity; } + + /** * 代发代扣结果查询 * @@ -159,7 +154,13 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { */ @Override public SysExtensionApiEntity payApplyAgentResult(SysExtensionApiEntity entity) { - return null; + String bodys = entity.getBodys(); + if (StrUtil.isNotEmpty(bodys)){ + AgentPayResultRequestDTO agentPayResultRequestDTO = JSONObject.parseObject(bodys,AgentPayResultRequestDTO.class); + String requestData = JSONObject.toJSONString(agentPayResultRequestDTO); + encrypAndsign(entity,requestData); + } + return entity; } /** @@ -174,25 +175,20 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { if (StrUtil.isNotEmpty(bodys)){ ElecRequestDTO elecRequestDTO = JSONObject.parseObject(bodys,ElecRequestDTO.class); String requestData = JSONObject.toJSONString(elecRequestDTO); - //签名 - long timestamp = System.currentTimeMillis(); - String sign = CBSUtil.sign(requestData,timestamp); - //加密 - byte[] encryptedData = CBSUtil.encrypt(requestData); - Map header = getHeaders(sign,timestamp); - entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); - entity.setHeaders(header); - byte[] bodyBytes = HttpRequest.post("https://cbs8-openapi-reprd.csuat.cmburl.cn/openapi/account/openapi/v1/electronic-bill/query").addHeaders(header).body(encryptedData).execute().bodyBytes(); - //解密报文 - String decrypt = CBSUtil.decrypt(bodyBytes); - System.out.println(decrypt); + //加密 签名 + encrypAndsign(entity,requestData); } return entity; } - - private Map getHeaders(String sign,long timestamp){ + /** + * 请求头 + * @param sign + * @param timestamp + * @return + */ + private Map headersValueOf(String sign, long timestamp){ Map header = new HashMap(); header.put(CBSUtil.SIGN_HEADER_NAME,sign); header.put(CBSUtil.TIMESTAMP_HEADER,Long.toString(timestamp)); @@ -200,4 +196,20 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { header.put(CBSUtil.AUTHORIZATION,CBSUtil.BEARER+ CbsAccessToken.getToken()); return header; } + + /** + * 加密 签名 + * @param entity 接口转发参数对象 + * @param requestData 请求参数json字符串 + */ + private void encrypAndsign(SysExtensionApiEntity entity, String requestData) { + //签名 + long timestamp = System.currentTimeMillis(); + String sign = CBSUtil.sign(requestData,timestamp); + //加密 + byte[] encryptedData = CBSUtil.encrypt(requestData); + Map header = headersValueOf(sign,timestamp); + entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); + entity.setHeaders(header); + } } diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java index 08e91d12..a2aad83d 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java @@ -7,19 +7,19 @@ import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; -import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; -import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; -import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.req.*; import com.hzya.frame.cbs8.dto.res.*; import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.service.IPaymentService; +import com.hzya.frame.web.entity.JsonResultEntity; import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Base64; import java.util.List; import java.util.Map; @@ -41,8 +41,10 @@ public class Cbs8ServiceImpl implements ICbs8Service { .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") .put("appId","800026") .build(); - String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(JSONObject.toJSONString(paymentEntity)).timeout(60000).execute().body(); - PayResponseDTO payResponseDTO = JSONObject.parseObject(body,PayResponseDTO.class); + String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(JSONObject.toJSONString(paymentEntity)).timeout(60000).execute().body(); + //解密响应报文 + String result = decryptResBody(body); + PayResponseDTO payResponseDTO = JSONObject.parseObject(result,PayResponseDTO.class); return payResponseDTO; } @@ -61,14 +63,13 @@ public class Cbs8ServiceImpl implements ICbs8Service { .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") .put("appId","800026") .build(); - String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(JSONObject.toJSONString(resultRequestDTO)).timeout(60000).execute().body(); - if (StrUtil.isEmpty(body)){ - CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(body, CbsResponseDTO.class); - if (CollectionUtils.isNotEmpty(cbsResponseDTO.getData())){ - List dataList = cbsResponseDTO.getData(); - List payResultList = CBSUtil.convertJsonArrayToList(dataList, PayResultResDTO.class); - return payResultList; - } + String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(JSONObject.toJSONString(resultRequestDTO)).timeout(60000).execute().body(); + String result = decryptResBody(body); + CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); + if (CollectionUtils.isNotEmpty(cbsResponseDTO.getData())){ + List dataList = cbsResponseDTO.getData(); + List payResultList = CBSUtil.convertJsonArrayToList(dataList, PayResultResDTO.class); + return payResultList; } return null; } @@ -104,7 +105,8 @@ public class Cbs8ServiceImpl implements ICbs8Service { .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") .put("appId","800026") .build(); - String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + String result = decryptResBody(body); if (StrUtil.isNotEmpty(result)){ CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); if (null != cbsResponseDTO){ @@ -148,7 +150,8 @@ public class Cbs8ServiceImpl implements ICbs8Service { .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") .put("appId","800026") .build(); - String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + String result = decryptResBody(body); if (StrUtil.isNotEmpty(result)){ CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); if (null != cbsResponseDTO){ @@ -164,4 +167,82 @@ public class Cbs8ServiceImpl implements ICbs8Service { } return null; } + + /** + * 代发代扣 支付申请 + * @param paymentApplySubmitReqDTO + * @param paymentApplyAgentList + */ + @Override + public PayResponseDTO agentPayApply(PaymentApplySubmitReqDTO paymentApplySubmitReqDTO, List paymentApplyAgentList) { + AgentPayRequestDTO param = new AgentPayRequestDTO(); + param.setPaymentApplySubmitReqDTO(paymentApplySubmitReqDTO); + param.setPaymentApplyAgentDTO(paymentApplyAgentList); + String params = JSON.toJSONString(param); + Map headerMap = MapBuilder.create(true) + .put("apiCode", "8000260003") + .put("publicKey","ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj") + .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") + .put("appId","800026") + .build(); + String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + String result = decryptResBody(body); + if (StrUtil.isNotEmpty(result)){ + CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); + List dataList = cbsResponseDTO.getData(); + if (CollectionUtils.isNotEmpty(dataList)){ + JSONObject o = dataList.get(0); + PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class); + return payResponseDTO; + } + } + return null; + } + + /** + * 代发代扣 详情查询 + * + * @param agentPayResultRequestDTO + * @return + */ + @Override + public AgentPayResultResDTO agentPayResult(AgentPayResultRequestDTO agentPayResultRequestDTO) { + Map headerMap = MapBuilder.create(true) + .put("apiCode", "8000260004") + .put("publicKey","ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj") + .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") + .put("appId","800026") + .build(); + String params = JSON.toJSONString(agentPayResultRequestDTO); + String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + //解密报文 + String result = decryptResBody(body); + if (StrUtil.isNotEmpty(result)){ + CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); + List dataList = cbsResponseDTO.getData(); + if (CollectionUtils.isNotEmpty(dataList)){ + JSONObject o = dataList.get(0); + AgentPayResultResDTO agentPayResultResDTO = JSON.toJavaObject(o, AgentPayResultResDTO.class); + return agentPayResultResDTO; + } + } + return null; + } + + /** + * 解密响应报文 + * @param body + * @return + */ + private String decryptResBody(String body){ + if (StrUtil.isNotEmpty(body)){ + JsonResultEntity resultEntity = JSONObject.parseObject(body,JsonResultEntity.class); + String bodyBase64 = String.valueOf(resultEntity.getAttribute()); + byte[] bodyBytes = Base64.getDecoder().decode(bodyBase64); + //解密报文 + String result = CBSUtil.decrypt(bodyBytes); + return result; + } + return null; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java index 5a2b602f..f40843a7 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java @@ -1,5 +1,6 @@ package com.hzya.frame.mdm.mdmModule.dao; +import com.alibaba.fastjson.JSONObject; import com.hzya.frame.mdm.entity.MdmDataDto; import com.hzya.frame.mdm.entity.MdmDto; import com.hzya.frame.mdm.entity.MdmQuery; @@ -47,5 +48,9 @@ public interface IMdmModuleDao extends IBaseDao { Integer deleteTable(Map maps); + + JSONObject queryMdmST(Map maps); + List queryMdmSTDetail(Map maps); + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java index 594da2f1..dd63a32d 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java @@ -1,5 +1,6 @@ package com.hzya.frame.mdm.mdmModule.dao.impl; +import com.alibaba.fastjson.JSONObject; import com.hzya.frame.mdm.entity.MdmDataDto; import com.hzya.frame.mdm.entity.MdmDto; import com.hzya.frame.mdm.entity.MdmQuery; @@ -127,6 +128,9 @@ public class MdmModuleDaoImpl extends MybatisGenericDao Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteTable", maps); return o; } + + + @Override public Integer alterTable(Map maps) { Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTable", maps); @@ -144,5 +148,18 @@ public class MdmModuleDaoImpl extends MybatisGenericDao return o; } + + @Override + public JSONObject queryMdmST(Map maps) { + JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps); + return o; + } + + @Override + public List queryMdmSTDetail(Map maps) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryMdmSTDetail", maps); + return o; + } + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index 7dbd9244..75ff1531 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -792,5 +792,23 @@ where id = #{id} + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index 677329b2..2bae850a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -495,6 +495,16 @@ public class MdmModuleServiceImpl extends BaseService i //新增 设置日志表 setMdmField(mdmModuleDbEntity1, mdmModuleDbFiledsEntities); } + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + //查看表是否存在 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setDbName(mdmModuleDbEntities.get(i).getDbName()); + mdmModuleDbEntity.setSts("Y"); + int a = mdmModuleDbDao.getCount(mdmModuleDbEntity); + if(a > 0){ + return BaseResult.getFailureMessageEntity("表已存在,请修改"); + } + } mdmServiceCache.saveOrUpdateMdmModuleDb(entity.getMdmId(), mdmModuleDbEntities); mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java index 80e26fd1..3e1debd5 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java @@ -1,11 +1,9 @@ package com.hzya.frame.mdm.mdmModuleDbFileds.entity; -import java.util.Date; import java.util.List; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.web.entity.BaseEntity; -import org.apache.poi.ss.formula.functions.T; /** * 模版数据库字段表(MdmModuleDbFileds)实体类 diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java index 895f30cd..ffa3cacc 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java @@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao; * 主数据功能应用分发表(mdm_module_distribute: table)表数据库访问层 * * @author makejava - * @since 2024-06-14 10:06:36 + * @since 2024-06-18 11:39:46 */ public interface IMdmModuleDistributeDao extends IBaseDao { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java index 4c029e80..83ba2db8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java @@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; * 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层 * * @author makejava - * @since 2024-06-14 10:06:36 + * @since 2024-06-18 11:39:46 */ @Repository(value = "MdmModuleDistributeDaoImpl") public class MdmModuleDistributeDaoImpl extends MybatisGenericDao implements IMdmModuleDistributeDao{ diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java index 9b6677b9..30fcf0dc 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java @@ -9,7 +9,7 @@ import com.hzya.frame.web.entity.BaseEntity; * 主数据功能应用分发表(MdmModuleDistribute)实体类 * * @author makejava - * @since 2024-06-14 10:06:36 + * @since 2024-06-18 11:39:46 */ public class MdmModuleDistributeEntity extends BaseEntity { @@ -17,20 +17,29 @@ public class MdmModuleDistributeEntity extends BaseEntity { private String mdmId; /** 应用id */ private String appId; + /** 触发类型 0、手动1、自动 */ + private String enabledType; /** 修改接口 */ private String updateApi; + /** 修改插件 */ + private String updateScript; /** 新增接口 */ private String addApi; + /** 新增插件 */ + private String addScript; /** 删除接口 */ private String deleteApi; + /** 删除插件 */ + private String deleteScript; /** 启用停用 0、停用1、启用 */ private String enabledState; /** 主表ID */ private String dbId; /** 公司id */ private String companyId; + /** 公司id */ + private List mdmModuleDistributeDetailEntities; - private List mdmModuleDistributeDetailEntities; public String getMdmId() { return mdmId; @@ -48,6 +57,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.appId = appId; } + public String getEnabledType() { + return enabledType; + } + + public void setEnabledType(String enabledType) { + this.enabledType = enabledType; + } + public String getUpdateApi() { return updateApi; } @@ -56,6 +73,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.updateApi = updateApi; } + public String getUpdateScript() { + return updateScript; + } + + public void setUpdateScript(String updateScript) { + this.updateScript = updateScript; + } + public String getAddApi() { return addApi; } @@ -64,6 +89,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.addApi = addApi; } + public String getAddScript() { + return addScript; + } + + public void setAddScript(String addScript) { + this.addScript = addScript; + } + public String getDeleteApi() { return deleteApi; } @@ -72,6 +105,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.deleteApi = deleteApi; } + public String getDeleteScript() { + return deleteScript; + } + + public void setDeleteScript(String deleteScript) { + this.deleteScript = deleteScript; + } + public String getEnabledState() { return enabledState; } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml index 20e5de5b..0a959f0f 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml @@ -6,9 +6,13 @@ + + + + @@ -25,9 +29,13 @@ id ,mdm_id ,app_id + ,enabled_type ,update_api + ,update_script ,add_api + ,add_script ,delete_api + ,delete_script ,enabled_state ,db_id ,sorts @@ -55,9 +63,13 @@ and id = #{id} and mdm_id = #{mdmId} and app_id = #{appId} + and enabled_type = #{enabledType} and update_api = #{updateApi} + and update_script = #{updateScript} and add_api = #{addApi} + and add_script = #{addScript} and delete_api = #{deleteApi} + and delete_script = #{deleteScript} and enabled_state = #{enabledState} and db_id = #{dbId} and sorts = #{sorts} @@ -81,9 +93,13 @@ and id = #{id} and mdm_id = #{mdmId} and app_id = #{appId} + and enabled_type = #{enabledType} and update_api = #{updateApi} + and update_script = #{updateScript} and add_api = #{addApi} + and add_script = #{addScript} and delete_api = #{deleteApi} + and delete_script = #{deleteScript} and enabled_state = #{enabledState} and db_id = #{dbId} and sorts = #{sorts} @@ -109,9 +125,13 @@ and id like concat('%',#{id},'%') and mdm_id like concat('%',#{mdmId},'%') and app_id like concat('%',#{appId},'%') + and enabled_type like concat('%',#{enabledType},'%') and update_api like concat('%',#{updateApi},'%') + and update_script like concat('%',#{updateScript},'%') and add_api like concat('%',#{addApi},'%') + and add_script like concat('%',#{addScript},'%') and delete_api like concat('%',#{deleteApi},'%') + and delete_script like concat('%',#{deleteScript},'%') and enabled_state like concat('%',#{enabledState},'%') and db_id like concat('%',#{dbId},'%') and sorts like concat('%',#{sorts},'%') @@ -137,9 +157,13 @@ or id = #{id} or mdm_id = #{mdmId} or app_id = #{appId} + or enabled_type = #{enabledType} or update_api = #{updateApi} + or update_script = #{updateScript} or add_api = #{addApi} + or add_script = #{addScript} or delete_api = #{deleteApi} + or delete_script = #{deleteScript} or enabled_state = #{enabledState} or db_id = #{dbId} or sorts = #{sorts} @@ -157,15 +181,19 @@ - + insert into mdm_module_distribute( id , mdm_id , app_id , + enabled_type , update_api , + update_script , add_api , + add_script , delete_api , + delete_script , enabled_state , db_id , sorts , @@ -184,9 +212,13 @@ #{id} , #{mdmId} , #{appId} , + #{enabledType} , #{updateApi} , + #{updateScript} , #{addApi} , + #{addScript} , #{deleteApi} , + #{deleteScript} , #{enabledState} , #{dbId} , #{sorts} , @@ -203,26 +235,30 @@ ) - - insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + + insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values - (#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + (#{entity.mdmId},#{entity.appId},#{entity.enabledType},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - - insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + + insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values - (#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.mdmId},#{entity.appId},#{entity.enabledType},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) on duplicate key update mdm_id = values(mdm_id), app_id = values(app_id), + enabled_type = values(enabled_type), update_api = values(update_api), + update_script = values(update_script), add_api = values(add_api), + add_script = values(add_script), delete_api = values(delete_api), + delete_script = values(delete_script), enabled_state = values(enabled_state), db_id = values(db_id), create_user_id = values(create_user_id), @@ -238,9 +274,13 @@ update mdm_module_distribute set mdm_id = #{mdmId}, app_id = #{appId}, + enabled_type = #{enabledType}, update_api = #{updateApi}, + update_script = #{updateScript}, add_api = #{addApi}, + add_script = #{addScript}, delete_api = #{deleteApi}, + delete_script = #{deleteScript}, enabled_state = #{enabledState}, db_id = #{dbId}, create_user_id = #{create_user_id}, @@ -265,9 +305,13 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_ and id = #{id} and mdm_id = #{mdmId} and app_id = #{appId} + and enabled_type = #{enabledType} and update_api = #{updateApi} + and update_script = #{updateScript} and add_api = #{addApi} + and add_script = #{addScript} and delete_api = #{deleteApi} + and delete_script = #{deleteScript} and enabled_state = #{enabledState} and db_id = #{dbId} and sorts = #{sorts} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java index ab9fe2da..46befe7b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 主数据功能应用分发表(MdmModuleDistribute)表服务接口 * * @author makejava - * @since 2024-06-14 10:06:36 + * @since 2024-06-18 11:39:46 */ public interface IMdmModuleDistributeService extends IBaseService{ } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java index 5133bc1a..29bbea60 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 主数据功能应用分发表(MdmModuleDistribute)表服务实现类 * * @author makejava - * @since 2024-06-14 10:06:36 + * @since 2024-06-18 11:39:46 */ @Service(value = "mdmModuleDistributeService") public class MdmModuleDistributeServiceImpl extends BaseService implements IMdmModuleDistributeService { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml index 962f618a..171168f4 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml @@ -196,7 +196,6 @@ sts , org_id , company_id , - sorts, sts, )values( @@ -220,7 +219,6 @@ #{sts} , #{org_id} , #{companyId} , - (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute_detail a WHERE a.sts = 'Y' ), 'Y', ) diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml index af218694..0ff0cabc 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml @@ -167,7 +167,6 @@ sts , org_id , company_id , - sorts, sts, )values( @@ -187,7 +186,6 @@ #{sts} , #{org_id} , #{companyId} , - (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from ${tableName} a WHERE a.sts = 'Y' ), 'Y', ) diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml index 0cea9a23..e3beb6bd 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml @@ -161,7 +161,6 @@ sts , org_id , company_id , - sorts, sts, )values( @@ -180,7 +179,6 @@ #{sts} , #{org_id} , #{companyId} , - (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from ${tableName} a WHERE a.sts = 'Y' ), 'Y', ) diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml index 5f69ee49..c26a0486 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml @@ -179,7 +179,6 @@ WHERE sts , org_id , company_id , - sorts, sts, )values( @@ -197,7 +196,6 @@ WHERE #{sts} , #{org_id} , #{companyId} , - (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_source a WHERE a.sts = 'Y' ), 'Y', ) diff --git a/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java b/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java index 016d50b7..eccc4f7a 100644 --- a/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java @@ -3,20 +3,15 @@ package com.hzya.frame.report.reportManage.service.impl; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.report.reportManage.dao.IReportManageDao; import com.hzya.frame.report.reportManage.entity.JimuReportEntity; import com.hzya.frame.report.reportManage.entity.ReportManageEntity; -import com.hzya.frame.report.reportManage.dao.IReportManageDao; import com.hzya.frame.report.reportManage.service.IReportManageService; -import com.hzya.frame.sysnew.user.entity.SysUserEntity; -import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity; -import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity; -import com.hzya.frame.util.AESUtil; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; -import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.Resource; -import com.hzya.frame.basedao.service.impl.BaseService; +import org.springframework.stereotype.Service; import java.util.List; @@ -28,272 +23,269 @@ import java.util.List; */ @Service(value = "reportManageService") public class ReportManageServiceImpl extends BaseService implements IReportManageService { - + private IReportManageDao reportManageDao; - + @Autowired - public void setReportManageDao(IReportManageDao dao) { - this.reportManageDao = dao; - this.dao = dao; - } + public void setReportManageDao(IReportManageDao dao) { + this.reportManageDao = dao; + this.dao = dao; + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表列表分页 - * @Date 11:52 上午 2024/3/27 - **/ - @Override - public JsonResultEntity queryEntityPage(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List list = reportManageDao.queryByLikeClassify(entity); - PageInfo pageInfo = new PageInfo(list); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表列表分页 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public JsonResultEntity queryEntityPage(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = reportManageDao.queryByLikeClassify(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表列表 - * @Date 11:52 上午 2024/3/27 - **/ - @Override - public JsonResultEntity queryEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - entity = new ReportManageEntity(); - } - List list = reportManageDao.queryByLike(entity); - return BaseResult.getSuccessMessageEntity("查询数据成功", list); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表列表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + entity = new ReportManageEntity(); + } + List list = reportManageDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 保存报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity saveEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getReportId() == null || "".equals(entity.getReportId())) { - return BaseResult.getFailureMessageEntity("请先选择报表"); - } - if (entity.getReportName() == null || "".equals(entity.getReportName())) { - return BaseResult.getFailureMessageEntity("请先输入报表名称"); - } - if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { - return BaseResult.getFailureMessageEntity("请先选择分类"); - } - if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setState("0"); - if (!checkIsUse(entity)) { - return BaseResult.getFailureMessageEntity("当前报表已经配置,请勿重复配置"); - } - entity.setCreate(); - //保存 - reportManageDao.save(entity); - return BaseResult.getSuccessMessageEntity("保存报表成功", entity); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 保存报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity saveEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getReportId() == null || "".equals(entity.getReportId())) { + return BaseResult.getFailureMessageEntity("请先选择报表"); + } + if (entity.getReportName() == null || "".equals(entity.getReportName())) { + return BaseResult.getFailureMessageEntity("请先输入报表名称"); + } + if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { + return BaseResult.getFailureMessageEntity("请先选择分类"); + } + if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setState("0"); + if (!checkIsUse(entity)) { + return BaseResult.getFailureMessageEntity("当前报表已经配置,请勿重复配置"); + } + entity.setCreate(); + //保存 + reportManageDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存报表成功", entity); + } + private boolean checkIsUse(ReportManageEntity entity) { + ReportManageEntity checkUse = new ReportManageEntity(); + checkUse.setReportId(entity.getReportId()); + return reportManageDao.getCount(checkUse) <= 0; + } - private boolean checkIsUse(ReportManageEntity entity) { - ReportManageEntity checkUse = new ReportManageEntity(); - checkUse.setReportId(entity.getReportId()); - if (reportManageDao.getCount(checkUse) > 0) { - return false; - } - return true; - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity getEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = reportManageDao.get(entity.getId()); + if (entity == null) { + return BaseResult.getFailureMessageEntity("获取报表失败"); + } + return BaseResult.getSuccessMessageEntity("获取报表成功", entity); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity getEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity = reportManageDao.get(entity.getId()); - if (entity == null) { - return BaseResult.getFailureMessageEntity("获取报表失败"); - } - return BaseResult.getSuccessMessageEntity("获取报表成功", entity); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 修改报表 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity updateEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getReportId() == null || "".equals(entity.getReportId())) { + return BaseResult.getFailureMessageEntity("请先选择报表"); + } + if (entity.getReportName() == null || "".equals(entity.getReportName())) { + return BaseResult.getFailureMessageEntity("请先输入报表名称"); + } + if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { + return BaseResult.getFailureMessageEntity("请先选择分类"); + } + if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + //保存 + reportManageDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改报表成功"); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 修改报表 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity updateEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getReportId() == null || "".equals(entity.getReportId())) { - return BaseResult.getFailureMessageEntity("请先选择报表"); - } - if (entity.getReportName() == null || "".equals(entity.getReportName())) { - return BaseResult.getFailureMessageEntity("请先输入报表名称"); - } - if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { - return BaseResult.getFailureMessageEntity("请先选择分类"); - } - if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setUpdate(); - //保存 - reportManageDao.update(entity); - return BaseResult.getSuccessMessageEntity("修改报表成功"); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除报表 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity deleteEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + reportManageDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除报表成功"); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除报表 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity deleteEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setUpdate(); - reportManageDao.logicRemove(entity); - return BaseResult.getSuccessMessageEntity("删除报表成功"); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 启用停用报表 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity enableDisableEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getState() == null || "".equals(entity.getState())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + reportManageDao.update(entity); + //0启用 1 停用 + if ("0".equals(entity.getState())) { + return BaseResult.getSuccessMessageEntity("启用用户成功"); + } else { + return BaseResult.getSuccessMessageEntity("停用用户成功"); + } + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 启用停用报表 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity enableDisableEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getState() == null || "".equals(entity.getState())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setUpdate(); - reportManageDao.update(entity); - //0启用 1 停用 - if ("0".equals(entity.getState())) { - return BaseResult.getSuccessMessageEntity("启用用户成功"); - } else { - return BaseResult.getSuccessMessageEntity("停用用户成功"); - } - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity queryReport(JSONObject jsonObject) { + JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = reportManageDao.queryReportNotUse(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity queryReport(JSONObject jsonObject) { - JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List list = reportManageDao.queryReportNotUse(entity); - PageInfo pageInfo = new PageInfo(list); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity queryReportEntity(JSONObject jsonObject) { + JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = reportManageDao.queryReportEntity(entity); + if (entity == null) { + return BaseResult.getFailureMessageEntity("获取报表失败"); + } + return BaseResult.getSuccessMessageEntity("获取报表成功", entity); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity queryReportEntity(JSONObject jsonObject) { - JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity = reportManageDao.queryReportEntity(entity); - if (entity == null) { - return BaseResult.getFailureMessageEntity("获取报表失败"); - } - return BaseResult.getSuccessMessageEntity("获取报表成功", entity); + } - } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 权限查询 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity jurisdiction(JSONObject jsonObject) { + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 权限查询 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity jurisdiction(JSONObject jsonObject) { - return null; - } + return null; + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 保存权限查询 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity saveJurisdiction(JSONObject jsonObject) { + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 保存权限查询 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity saveJurisdiction(JSONObject jsonObject) { - return null; - } + return null; + } } diff --git a/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml b/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml index d6e57e45..bcc70052 100644 --- a/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml +++ b/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml @@ -66,10 +66,51 @@ - select + + -- 差旅费报销单 + SELECT + formson_0210.id as oaId, -- 主表id + 'formson_0210' as tableName, -- 表名 + COL_SUMMARY.SUBJECT as title, -- 单据标题 + unit.name as payCompany, -- 付款公司 + '差旅费报销单' as billName, + 'field0072' as payResultField, -- 支付结果字段 + 'field0073' as payDateField, -- 打款日期字段 + '' as receiptFiled,-- 电子回单字段 + COL_SUMMARY.id as summaryId, + formmain_0209.field0017||'-'||formson_0210.sort as referenceNum, -- 单据编号 + formmain_0209.START_DATE as startDate, -- 单据日期 + formmain_0209.FINISHEDFLAG as finishedflag, -- 流程状态 + formson_0210.field0073 as payDate, -- 打款日期 + formson_0210.field0072 as payResult, -- 支付结果 + REGEXP_REPLACE(formmain_0209.field0042, '[[:space:]]', '') as payAccount, -- 付款账户 + REGEXP_REPLACE(formmain_0209.field0041, '[[:space:]]', '') as payBankName, -- 付款开户行 + formson_0210.field0031 as amount, -- 金额 + formmain_0209.field0038 as purpose, -- 用途 + formmain_0209.field0038 as cbsAbstract, -- 摘要 + REGEXP_REPLACE(formson_0210.field0069, '[[:space:]]', '') as revAccount, -- 收款账户 + formson_0210.field0068 as revBankName, -- 收款开户行 + '' as revAccountName, -- 收款人 + REGEXP_REPLACE(formson_0210.field0071, '[[:space:]]', '') as cnapsCode, -- 收款联行号 + item.showvalue as personalFlag,-- 公私标记 + '' as revBankType,-- 收款银行类型 + '10' as currency,-- 币种 + '' as busType,-- 业务类型 + '' as receipt -- 电子回单 + from + formson_0210 + LEFT JOIN formmain_0209 ON formson_0210.FORMMAIN_ID = formmain_0209.id + LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0209.id + LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.object_id = COL_SUMMARY.id + left join CTP_ENUM_ITEM item on item.id =formson_0210.field0070 + left join ORG_UNIT unit on unit.id =formmain_0209.field0002 + -- left join V_USER_VIEW_ALL us on us.staffid=formmain_0209.field0024 + WHERE 1=1 + -- and formson_0210.field0031>0 + and CTP_AFFAIR.node_name = '发起者' and CTP_AFFAIR.COMPLETE_TIME is null and CTP_AFFAIR.STATE = 3 referenceNum = #{referenceNum} and busType = #{busType} @@ -127,10 +209,51 @@ + + select + + from sys_application_script where id = #{ id } and sts='Y' + + + + + + + + + + + + + + + + insert into sys_application_script( + + id , + app_id , + script_name , + script_code , + script_version , + class_name , + script_data , + script_remark , + release_date , + script_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sts, + + )values( + + #{id} , + #{appId} , + #{scriptName} , + #{scriptCode} , + #{scriptVersion} , + CONCAT('g','_',LAST_INSERT_ID()) , + #{scriptData} , + #{scriptRemark} , + #{releaseDate} , + #{scriptStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + 'Y', + + ) + + + + insert into sys_application_script(app_id, script_name, script_code, script_version, class_name, script_data, script_remark, release_date, script_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.appId},#{entity.scriptName},#{entity.scriptCode},#{entity.scriptVersion},#{entity.className},#{entity.scriptData},#{entity.scriptRemark},#{entity.releaseDate},#{entity.scriptStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + + + + + insert into sys_application_script(app_id, script_name, script_code, script_version, class_name, script_data, script_remark, release_date, script_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.appId},#{entity.scriptName},#{entity.scriptCode},#{entity.scriptVersion},#{entity.className},#{entity.scriptData},#{entity.scriptRemark},#{entity.releaseDate},#{entity.scriptStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + app_id = values(app_id), + script_name = values(script_name), + script_code = values(script_code), + script_version = values(script_version), + class_name = values(class_name), + script_data = values(script_data), + script_remark = values(script_remark), + release_date = values(release_date), + script_status = values(script_status), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + +update sys_application_script set + + app_id = #{appId}, + script_name = #{scriptName}, + script_code = #{scriptCode}, + script_version = #{scriptVersion}, + class_name = #{className}, + script_data = #{scriptData}, + script_remark = #{scriptRemark}, + release_date = #{releaseDate}, + script_status = #{scriptStatus}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + +where id = #{id} + + + +update sys_application_script set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_script set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and script_name = #{scriptName} + and script_code = #{scriptCode} + and script_version = #{scriptVersion} + and class_name = #{className} + and script_data = #{scriptData} + and script_remark = #{scriptRemark} + and release_date = #{releaseDate} + and script_status = #{scriptStatus} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from sys_application_script where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/service/ISysApplicationScriptService.java b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/ISysApplicationScriptService.java new file mode 100644 index 00000000..73d7588d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/ISysApplicationScriptService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sysnew.application.script.service; + +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 脚本表(SysApplicationScript)表服务接口 + * + * @author makejava + * @since 2024-06-17 11:07:22 + */ +public interface ISysApplicationScriptService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/service/impl/SysApplicationScriptServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/impl/SysApplicationScriptServiceImpl.java new file mode 100644 index 00000000..59ef35e1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/impl/SysApplicationScriptServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sysnew.application.script.service.impl; + +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao; +import com.hzya.frame.sysnew.application.script.service.ISysApplicationScriptService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 脚本表(SysApplicationScript)表服务实现类 + * + * @author makejava + * @since 2024-06-17 11:07:22 + */ +@Service(value = "sysApplicationScriptService") +public class SysApplicationScriptServiceImpl extends BaseService implements ISysApplicationScriptService { + + private ISysApplicationScriptDao sysApplicationScriptDao; + + @Autowired + public void setSysApplicationScriptDao(ISysApplicationScriptDao dao) { + this.sysApplicationScriptDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java b/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java index a4711b39..e1f3290a 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java @@ -357,4 +357,74 @@ public interface ISysApplicationService extends IBaseService sysApplicationScriptEntities = sysApplicationScriptDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(sysApplicationScriptEntities); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本查询接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + List sysApplicationScriptEntities = sysApplicationScriptDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", sysApplicationScriptEntities); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本修改接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getScriptCode() == null || "".equals(entity.getScriptCode())) { + return BaseResult.getFailureMessageEntity("请先输入脚本编号"); + } + if (entity.getScriptData() == null || "".equals(entity.getScriptData())) { + return BaseResult.getFailureMessageEntity("请先输入脚本内容"); + } + entity.setCreate(); + sysApplicationScriptDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存脚本成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本修改接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity updateAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getScriptCode() == null || "".equals(entity.getScriptCode())) { + return BaseResult.getFailureMessageEntity("请先输入脚本编号"); + } + if (entity.getScriptData() == null || "".equals(entity.getScriptData())) { + return BaseResult.getFailureMessageEntity("请先输入脚本内容"); + } + entity.setUpdate(); + sysApplicationScriptDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改脚本成功"); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本删除接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity deleteAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + sysApplicationScriptDao.logicRemoveMultiCondition(entity); + return BaseResult.getSuccessMessageEntity("删除脚本成功"); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 获取脚本接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity getAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询接口 + SysApplicationScriptEntity sysApplicationScriptEntity = sysApplicationScriptDao.get(entity.getId()); + return BaseResult.getSuccessMessageEntity("查询数据成功", sysApplicationScriptEntity); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本启用停用接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity enableOrDisableAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getScriptStatus() == null || "".equals(entity.getScriptStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + sysApplicationScriptDao.update(entity); + if ("1".equals(entity.getScriptStatus())) {// 1启用2停用 + return BaseResult.getSuccessMessageEntity("启用成功"); + } else { + return BaseResult.getSuccessMessageEntity("停用成功"); + } + } + + @Override + public JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse) { + + //例如:A应用发送数据到中台,中台转发到B应用 + HttpServletRequest request = (HttpServletRequest) servletRequest; + String oldbodys = ServletUtil.getBody(servletRequest); + Map oldheaderMap = ServletUtil.getHeaderMap(request); + String oldquerys = request.getQueryString(); + //应用key + String publicKey = request.getHeader("publicKey"); + //应用密钥 + String secretKey = request.getHeader("secretKey"); + //appId + String appId = request.getHeader("appId"); + //apiCode + String apiCode = request.getHeader("apiCode"); + + String ip = IPHelper.getIpAddr(request); + if (publicKey == null || "".equals(publicKey)) { + return BaseResult.getFailureMessageEntity("请先传递公钥"); + } + if (secretKey == null || "".equals(secretKey)) { + return BaseResult.getFailureMessageEntity("请先传递密钥"); + } + if (appId == null || "".equals(appId)) { + return BaseResult.getFailureMessageEntity("请先传递接收方应用"); + } + if (apiCode == null || "".equals(apiCode)) { + return BaseResult.getFailureMessageEntity("请先传递发送接口"); + } + + logger.info("请求参数:publicKey:【" + publicKey + "】secretKey:【" + secretKey + "】appId:【" + appId + "】apiCode:【" + apiCode); + //根据请求a应用的公钥、密钥是否能查找到一条数据 + + SysApplicationEntity sendApp = getAppByPublicKeySecretKey(publicKey, secretKey); + if (sendApp == null) { + //saveLog(new SysApplicationEntity(), new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"公钥、密钥错误"); + return BaseResult.getFailureMessageEntity("公钥、密钥错误,请联系管理员"); + } + //判断应用是否启用 + if (sendApp.getAppStatus() == null || !"1".equals(sendApp.getAppStatus())) { + saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,sendApp.getName() + "应用未启用"); + return BaseResult.getFailureMessageEntity(sendApp.getName() + "应用未启用,请联系管理员"); + } + + + SysApplicationEntity receiveApp = getAppByAppId(appId); + if (receiveApp == null) { + saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"根据appId:" + appId + "未匹配到应用"); + return BaseResult.getFailureMessageEntity("根据appId:" + appId + "未匹配到应用,请联系管理员"); + } + //判断应用是否启用 + if (receiveApp.getAppStatus() == null || !"1".equals(receiveApp.getAppStatus())) { + saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用未启用" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用未启用,请联系管理员"); + } + //判断应用接口是否启用 + if (receiveApp.getInterfaceStatus() == null || !"1".equals(receiveApp.getInterfaceStatus())) { + saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用接口环境未启用" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用接口环境未启用,请联系管理员"); + } + + SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode); + if (receiveApi == null) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + ":" + apiCode + "未启用或者未创建" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建"); + } + + SysApplicationApiAuthEntity sysApplicationApiAuthEntity = getApiAuthByNameAppId(sendApp.getId(), receiveApp.getId()); + if (sysApplicationApiAuthEntity == null) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用权限配置错误" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用权限配置错误"); + } + if (sysApplicationApiAuthEntity.getSystemAddress() != null && !"".equals(sysApplicationApiAuthEntity.getSystemAddress()) + && !sysApplicationApiAuthEntity.getSystemAddress().contains(ip)) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误"); + } + + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = getApiAuthDetailByAppIdApiIdTripartiteSystemId(receiveApp.getId(), receiveApi.getId(), sysApplicationApiAuthEntity.getId()); + if (sysApplicationApiAuthDetailEntity == null) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApi.getApiName() + "未授权给" + sendApp.getName() ); + return BaseResult.getFailureMessageEntity(receiveApi.getApiName() + "未授权给" + sendApp.getName() + ",请联系管理员"); + } + SysExtensionApiEntity sysExtensionApiEntity = new SysExtensionApiEntity(); + + + List a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"}); + Map headers = new HashMap<>(); + if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) { + JSONArray jsonArray = JSONArray.parseArray(receiveApi.getHeaderIn()); + if (jsonArray != null && jsonArray.size() > 0) { + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject object1 = jsonArray.getJSONObject(i); + headers.put(object1.getString("parameterName"), object1.getString("example")); + } + } + } + if (oldheaderMap != null && oldheaderMap.size() > 0) { + for (Map.Entry entry : oldheaderMap.entrySet()) { + if (!a.contains(entry.getKey())) { + headers.put(entry.getKey(), entry.getValue()); + } + } + } + + + + sysExtensionApiEntity.setSendApp(sendApp); + sysExtensionApiEntity.setReceiveApp(receiveApp); + sysExtensionApiEntity.setReceiveApi(receiveApi); + sysExtensionApiEntity.setHeaders(headers); + sysExtensionApiEntity.setQuerys(oldquerys); + sysExtensionApiEntity.setBodys(oldbodys); + Method[] methods = null; + Object object = null; + + + + + // 判断是否有内部api 是否扩展api 1、启用 2、停用 + if (receiveApi.getExtensionApi() != null && "1".equals(receiveApi.getExtensionApi()) + && receiveApi.getBeanName() != null && !"".equals(receiveApi.getBeanName()) + && receiveApi.getFunName() != null && !"".equals(receiveApi.getFunName()) + ) { + //获取类 + try { + object = ApplicationContextUtil.getBeanByName(receiveApi.getBeanName()); + } catch (SecurityException e) { + + } + //获取类下面的方法 + methods = object.getClass().getMethods(); + if (methods == null || methods.length == 0) { + return BaseResult.getFailureMessageEntity("未找到内部方法,请联系管理员"); + } + for (Method m : methods) { + if (null != m) { + if (m.getName().equals(receiveApi.getFunName().trim())) { + try { + logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + sysExtensionApiEntity = (SysExtensionApiEntity) m.invoke(object, sysExtensionApiEntity); + logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } catch (Exception e) { + logger.error("invokeException{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("内部方法执行错误,请联系管理员"); + } + } + } + } + + } + headers = sysExtensionApiEntity.getHeaders(); + String querys = sysExtensionApiEntity.getQuerys(); + + byte[] byteBodys = sysExtensionApiEntity.getByteBodys(); + //设置参数获取参数 + StringBuffer url = new StringBuffer(); + if(!receiveApi.getDestinationAddress().toLowerCase().startsWith("http")){ + url.append(receiveApp.getInterfaceAddress()); + } + url.append(receiveApi.getDestinationAddress()); + if (querys != null) { + url.append("?"); + url.append(querys); + } + Integer outTime = 6000; + if (receiveApi.getTimeoutPeriod() != null && !"".equals(receiveApi.getTimeoutPeriod())) { + outTime = Integer.valueOf(receiveApi.getTimeoutPeriod()); + } + //1、POST 2、GET + String method = "POST"; + if ("2".equals(receiveApi.getRequestMethod())) { + method = "GET"; + } + //List a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"}); + //Map headers = new HashMap<>(); + //if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) { + // JSONArray jsonArray = JSONArray.parseArray(receiveApi.getHeaderIn()); + // if (jsonArray != null && jsonArray.size() > 0) { + // for (int i = 0; i < jsonArray.size(); i++) { + // JSONObject object1 = jsonArray.getJSONObject(i); + // headers.put(object1.getString("parameterName"), object1.getString("example")); + // } + // } + //} + //if (headerMap != null && headerMap.size() > 0) { + // for (Map.Entry entry : headerMap.entrySet()) { + // if (!a.contains(entry.getKey())) { + // headers.put(entry.getKey(), entry.getValue()); + // } + // } + //} + + + if ("POST".equals(method)) { + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpPost post = new HttpPost(url.toString()); + CloseableHttpResponse response = null; + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build(); + post.setConfig(requestConfig);//设置请求参数【超时时间】 + + if (headers != null && headers.size() > 0) { + for (String key : headers.keySet()) { + post.setHeader(key, headers.get(key)); + } + } + byte[] body = null; + boolean flag = true; + try { + if (byteBodys != null && !"".equals(byteBodys)) { + ByteArrayEntity entity = new ByteArrayEntity(byteBodys); + entity.setContentType("application/json"); + post.setEntity(entity); + } + response = closeableHttpClient.execute(post); + + HttpEntity entity = response.getEntity(); + synchronized (lock) { + body = EntityUtils.toByteArray(entity); + } + flag = true; + logger.info("返回结果:" +Base64.getEncoder().encodeToString(body)); + } catch (Exception e) { + logger.error("请求错误:" + e.getMessage()); + flag = false; + } finally { + try { + // 关闭响应对象 + if (response != null) { + response.close(); + } + // 关闭响应对象 + if (closeableHttpClient != null) { + closeableHttpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + logger.info("保存日志开始"); + SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(),true,null); + if (methods != null && methods.length > 0) { + for (Method m : methods) { + if (null != m) { + if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) { + try { + logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + m.invoke(object, sysMessageManageLogEntity); + logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } catch (Exception e) { + logger.error("invokeException{}", e.getMessage()); + } + } + } + } + } + logger.info("保存日志结束"); + if (flag) { + if (JSONUtil.isTypeJSON(body.toString())) { + JSONObject jsonObject = JSONObject.parseObject(body.toString()); + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", jsonObject); + }else { + return BaseResult.getFailureMessageEntity("转发失败", jsonObject); + } + } else { + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", body); + }else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + + } else {//GET + + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpGet get = new HttpGet(url.toString()); + CloseableHttpResponse response = null; + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build(); + get.setConfig(requestConfig);//设置请求参数【超时时间】 + if (headers != null && headers.size() > 0) { + for (String key : headers.keySet()) { + get.setHeader(key, headers.get(key)); + } + } + StringBuilder body = new StringBuilder(); + + boolean flag = true; + try { + response = closeableHttpClient.execute(get); + HttpEntity entity = response.getEntity(); + synchronized (lock) { + body.append(EntityUtils.toString(entity,"UTF-8")); + } + flag = true; + logger.info("返回结果:" + body); + } catch (Exception e) { + logger.error("请求错误:" + e.getMessage()); + body.append(e.getMessage()); + flag = false; + } finally { + try { + // 关闭响应对象 + if (response != null) { + response.close(); + } + // 关闭响应对象 + if (closeableHttpClient != null) { + closeableHttpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + logger.info("保存日志开始"); + SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(), true,null); + if (methods != null && methods.length > 0) { + for (Method m : methods) { + if (null != m) { + if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) { + try { + logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + m.invoke(object, sysMessageManageLogEntity); + logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } catch (Exception e) { + logger.error("invokeException{}", e.getMessage()); + } + } + } + } + } + logger.info("保存日志结束"); + if (flag) { + if (JSONUtil.isTypeJSON(body.toString())) { + JSONObject jsonObject = JSONObject.parseObject(body.toString()); + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", jsonObject); + }else { + return BaseResult.getFailureMessageEntity("转发失败", jsonObject); + } + } else { + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", body); + }else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java index c28bd496..ae475ac4 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java @@ -1,6 +1,7 @@ package com.hzya.frame.sysnew.grovy.service; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.web.entity.JsonResultEntity; /** @@ -21,5 +22,5 @@ public interface IGroovyIntegrationService { * @param jsonObject 请求参数对象 * @return com.hzya.frame.web.entity.JsonResultEntity **/ - JsonResultEntity groovyScriptExecution(JSONObject jsonObject); + SysExtensionApiEntity groovyScriptExecution(JSONObject jsonObject); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java index 580c718c..293d81c6 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java @@ -2,12 +2,11 @@ package com.hzya.frame.sysnew.grovy.service.impl; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService; import com.hzya.frame.util.GroovyUtil; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; -import groovy.lang.GroovyClassLoader; -import groovy.lang.GroovyObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -24,28 +23,41 @@ import org.springframework.stereotype.Service; public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService { private static final Logger logger = LoggerFactory.getLogger(GroovyIntegrationServiceImpl.class); -// public static void main(String[] args) { -// HelloWorld helloWorld = new HelloWorld(); -// System.out.println(helloWorld.sayHello()); -// } - - public static void main(String[] args) throws IllegalAccessException, InstantiationException { - GroovyClassLoader groovyClassLoader = new GroovyClassLoader(); - - // 动态编译和加载Groovy脚本 - Class groovyClass = groovyClassLoader.parseClass("println(\"1231231\")"); - - // 创建Groovy类的实例 - GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); - // 执行Groovy脚本 - JSONObject jsonObject = new JSONObject(); - jsonObject.put("name", "张三"); - Object returnObj = groovyObject.invokeMethod("run", jsonObject.toJSONString()); - } @Override - public JsonResultEntity groovyScriptExecution(JSONObject jsonObject) { + public SysExtensionApiEntity groovyScriptExecution(JSONObject jsonObject) { Object object = GroovyUtil.execute(jsonObject); - return BaseResult.getSuccessMessageEntity(object); + return new SysExtensionApiEntity(); } + + public static void main(String[] args) { + java.lang.String str = "{\"project_org\":\"\",\"modify_time\":\"2024-06-17 16:52:34\",\"project_duty_dept\":null,\"project_name\":\"凯伍德组织档案\",\"document_rule_num\":1,\"add_status\":\"0\",\"delete_status\":\"1\",\"project_dutier\":\"\",\"id\":\"fb12734c8267488b96833633e68a7abc\",\"data_status\":\"F\",\"modify_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"sorts\":1,\"project_memo\":\"\",\"document_rule\":\"XM-2024-06-17-00001\",\"create_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"create_time\":\"2024-06-17 16:42:18\",\"company_id\":null,\"project_sh_name\":\"\",\"project_code\":\"01004\",\"project_currtype\":\"\",\"update_status\":\"0\",\"sts\":\"Y\",\"org_id\":\"0\",\"project_parentpro\":\"\",\"project_bill_type\":\"\"}"; + + A88772 s = new A88772(); + s .execute(str); + } + static class A88772 { + String execute(String jsonStr) { + com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr); + com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject(); + ufinterfaceObject.put("billtype", "supplier"); ufinterfaceObject.put("isexchange", "Y"); + ufinterfaceObject.put("replace", "Y"); ufinterfaceObject.put("sender", "OA"); + ufinterfaceObject.put("account", "01"); ufinterfaceObject.put("groupcode", "00"); + com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject(); + billheadObject.put("code", reqData.get("project_code")); billheadObject.put("supprop", "0"); + billheadObject.put("custstate", "1"); billheadObject.put("pk_supplierclass", "S01"); + billheadObject.put("pk_country", "CN"); billheadObject.put("pk_timezone", "P0800"); + billheadObject.put("pk_format", "ZH-CN"); billheadObject.put("enablestate", "2"); + billheadObject.put("name", reqData.get("project_sh_name")); billheadObject.put("pk_group", "00"); + billheadObject.put("pk_org", "003"); billheadObject.put("taxpayerid", "087981489021135119"); + returnObject.put("ufinterface",ufinterfaceObject); billObject.put("billhead", billheadObject); returnObject.put("bill",billObject); + System.out.println( returnObject.toJSONString()); + return returnObject.toJSONString(); + } + } + + + } diff --git a/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java b/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java index f126e010..e9ef121d 100644 --- a/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java @@ -1,16 +1,10 @@ package com.hzya.frame.u8c.ax.service.impl; -import cn.hutool.http.HttpRequest; -import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; import com.hzya.frame.u8c.ax.dao.IAxDao; -import com.hzya.frame.u8c.ax.entity.ArchivesEntity; -import com.hzya.frame.u8c.ax.entity.Ass; -import com.hzya.frame.u8c.ax.entity.Voucher; -import com.hzya.frame.u8c.ax.entity.VoucherDetails; -import com.hzya.frame.u8c.ax.entity.VoucherRoot; +import com.hzya.frame.u8c.ax.entity.*; import com.hzya.frame.u8c.ax.service.IAxService; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; @@ -22,14 +16,11 @@ import org.apache.http.entity.ByteArrayEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; -import org.checkerframework.checker.units.qual.A; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.beans.factory.annotation.Autowired; -import com.hzya.frame.basedao.service.impl.BaseService; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -218,6 +209,7 @@ public class AxServiceImpl extends BaseService implement post.setHeader("publicKey", publicKey); post.setHeader("secretKey", secretKey); post.setHeader("appId", appId); + post.setHeader("needStackTrace", jsonObject.getString("needStackTrace")); switch (jsonObject.getString("voucherType")){ case "add"://新增 post.setHeader("apiCode", pzApiCodexz); diff --git a/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java b/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java index 0f6d4958..3fab59ec 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java @@ -1,6 +1,5 @@ package com.hzya.frame.webapp.entrance.controler; -import com.hzya.frame.bip.v3.v2207.service.IBipSsoService; import com.hzya.frame.sysnew.application.service.ISysApplicationService; import com.hzya.frame.sys.entity.EsbReturnEntity; import com.hzya.frame.sys.file.download.entity.FileDownloadEntity; @@ -30,8 +29,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -52,8 +49,6 @@ public class EntranceController { private IEntranceService entranceService; @Autowired protected IFileDownloadService filedownloadService; - @Autowired - protected IBipSsoService bipSsoService; @Resource protected ISysApplicationService sysApplicationService; @RequestMapping(value = "/option") @@ -169,10 +164,9 @@ public class EntranceController { public JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { return sysApplicationService.externalCallInterface(servletRequest,servletResponse); } - @RequestMapping(value = "/erpSso") + @RequestMapping(value = "/externalCallInterfaceToESB") @ResponseBody - public String erpSso(HttpServletRequest request,HttpServletResponse response, String ticket) throws Exception { - response.sendRedirect(bipSsoService.erpSso(request,ticket)); - return null; + public JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + return sysApplicationService.externalCallInterfaceToESB(servletRequest,servletResponse); } }