diff --git a/.gitignore b/.gitignore index 1b1d7c41..b9730e0b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ Icon .Trashes .VolumeIcon.icns .com.apple.timemachine.donotpresent - +*.iml # Directories potentially created on remote AFP share .AppleDB .AppleDesktop @@ -60,3 +60,8 @@ $RECYCLE.BIN/ /common/target/ /buildpackage/target/ /webapp/target/ +/E:/yongansystem/log/2024-10-15/ +/base-buildpackage/target/ +/base-common/target/ +/base-core/target/ +/fw-weixin/target/ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/dao/IPayBillPluginInitializerDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/dao/IPayBillPluginInitializerDao.java new file mode 100644 index 00000000..c94fd3fa --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/dao/IPayBillPluginInitializerDao.java @@ -0,0 +1,36 @@ +package com.hzya.frame.plugin.a8bill.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; + +import java.util.HashMap; +import java.util.List; + +/** + * 组织档案(mdm_org: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-07 18:30:04 + */ +public interface IPayBillPluginInitializerDao extends IBaseDao { + /** + * + * @content 通用获取OA数据接口 + * @author laborer + * @date 2024/7/10 0010 16:06 + * + */ + + List> getOaBillData(String str , PayBillEntity entity)throws Exception; + /** + * + * @content 通过ID修改单据状态 + * @author laborer + * @date 2024/7/10 0010 17:32 + * + */ + + int updateStateForId(String str , PayBillEntity entity)throws Exception; +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/dao/impl/PayBillPluginInitializerDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/dao/impl/PayBillPluginInitializerDaoImpl.java new file mode 100644 index 00000000..8b948102 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/dao/impl/PayBillPluginInitializerDaoImpl.java @@ -0,0 +1,33 @@ +package com.hzya.frame.plugin.a8bill.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.execsql.service.IExecSqlService; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.HashMap; +import java.util.List; + +/** + * 组织档案(MdmOrg)表数据库访问层 + * + * @author makejava + * @since 2024-06-07 18:30:04 + */ +public class PayBillPluginInitializerDaoImpl extends MybatisGenericDao implements IPayBillPluginInitializerDao { + @Autowired + private IExecSqlService execSqlService; + @DS("#entity.dataSourceCode") + @Override + public List> getOaBillData(String str, PayBillEntity entity)throws Exception { + return execSqlService.execSelectSql(str, ""); + } + @DS("#entity.dataSourceCode") + @Override + public int updateStateForId(String str , PayBillEntity entity)throws Exception { + return super.update("com.hzya.frame.plugin.a8bill.dao.impl.PayBillPluginInitializerDaoImpl.PayBillEntity_update",entity); + } +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.java index ecca14fb..dd8d1c0b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.java @@ -9,6 +9,14 @@ import com.hzya.frame.web.entity.BaseEntity; * @since 2024-06-07 18:30:04 */ public class PayBillEntity extends BaseEntity { + private String sql; + public String getSql() { + return sql; + } + + public void setSql(String sql) { + this.sql = sql; + } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.xml index a251e1cd..bdde6c3f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/entity/PayBillEntity.xml @@ -1,16 +1,21 @@ - + - + - + id - - + + + + + ${sql} + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/AccLogPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/AccLogPluginInitializer.java new file mode 100644 index 00000000..ee1ecf96 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/AccLogPluginInitializer.java @@ -0,0 +1,158 @@ +package com.hzya.frame.plugin.a8bill.plugin; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.map.MapBuilder; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.ningboBankTreasury.dto.req.AccTransactionReq; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes; +import com.hzya.frame.ningboBankTreasury.util.NingboBankUtil; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService; +import com.hzya.frame.web.entity.BaseResult; +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.beans.factory.annotation.Value; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description 查询宁波银行账户交易明细 保存到OA + * @Author xiangerlin + * @Date 2024/7/25 16:24 + **/ +public class AccLogPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private INingboBankPluginService ningboBankPluginService; + @Value("${OA.data_source_code}") + private String oa_data_source_code; + @Autowired + private IPayBillPluginInitializerDao payBillDao; + /*** + * 插件初始化方法 + * @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 "AccLogPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "查询交易明细插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "AccLogPlugin"; + } + + /*** + * 插件类型 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 { + //查询银行账户列表 + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + List> hashMaps = payBillDao.getOaBillData("SELECT field0002 from formmain_0053",oaBillEntity); + List accList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(hashMaps)){ + for (HashMap hashMap : hashMaps) { + String field0002 = String.valueOf(hashMap.get("field0002")); + accList.add(field0002); + } + } + accList = Convert.toList(String.class,"86041110000110293,86041110000109337,6223160030547665,6214180002001411023,6214180000002609736"); + //1、查询宁波银行的交易记录 + AccTransactionReq accTransactionReq = new AccTransactionReq(); + accTransactionReq.setCdSign(NingboBankUtil.SHOURU); + accTransactionReq.setBeginDate(DateUtil.format(DateUtil.yesterday(),"yyyy-MM-dd")); + accTransactionReq.setEndDate(DateUtil.today()); + accTransactionReq.setBankAccList(accList); + Map headerMap = MapBuilder.create(true) + .put("apiCode", "8000360002") + .put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj") + .put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") + .put("appId","800036") + .build(); + String body = HttpRequest.post("http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(JSONObject.toJSONString(accTransactionReq)).timeout(60000).execute().body(); + System.out.println(body); + if (StrUtil.isNotEmpty(body)){ + JSONObject response = JSONObject.parseObject(body); + if (response.getBoolean("flag")){ + List accTransactionResList = JSONObject.parseArray(response.getJSONObject("attribute").getString("attribute"), AccTransactionRes.class); + //2、保存到OA底表 + if (CollectionUtils.isNotEmpty(accTransactionResList)){ + ningboBankPluginService.saveAccLog(accTransactionResList); + } + return BaseResult.getSuccessMessageEntity(getPluginName()+"执行成功:{}",accTransactionResList); + } + } + return BaseResult.getSuccessMessageEntity(getPluginName()+"执行成功"); + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankPayPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankPayPluginInitializer.java new file mode 100644 index 00000000..c54e09e8 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankPayPluginInitializer.java @@ -0,0 +1,144 @@ +package com.hzya.frame.plugin.a8bill.plugin; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.web.entity.JsonResultEntity; +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.util.HashMap; +import java.util.List; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/7/29 11:08 + **/ +public class NingboBankPayPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private INingboBankPluginService ningboBankPluginService; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Autowired + private IPayBillPluginInitializerDao payBillDao; + + @Value("${OA.data_source_code:}") + private String oa_data_source_code; + /*** + * 插件初始化方法 + * @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 "NingboBankPayPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "宁波银行转账插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "宁波银行转账插件"; + } + + /*** + * 插件类型 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 { + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + + try { + StringBuffer sb = new StringBuffer(); + if(StrUtil.isNotEmpty(rootAppPk)){ + String code = requestJson.getString("code"); + sb.append(" and id = '"+rootAppPk+"'"); + }else{ + sb.append(" and payState is null"); + } + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + StringBuffer stringBuffer = new StringBuffer(); + //付款单 + stringBuffer.append("select * from v_hzya_pay where 1=1 " ); + stringBuffer.append(sb.toString()); + List> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity); + ningboBankPluginService.payRequest(hashMaps,getPluginId(),"8000360000",interId); + } catch (Exception e) { + logger.info("获取OA数据失败"+e.getMessage()); + e.printStackTrace(); + } + return new JsonResultEntity("成功",true,new JsonResultEntity()); + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankPayResultPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankPayResultPluginInitializer.java new file mode 100644 index 00000000..7b366558 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankPayResultPluginInitializer.java @@ -0,0 +1,129 @@ +package com.hzya.frame.plugin.a8bill.plugin; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.ningboBankTreasury.enums.PayStatusEnum; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService; +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.beans.factory.annotation.Value; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description 宁波银行 单笔付款交易结果查询 + * @Author xiangerlin + * @Date 2024/7/29 16:59 + **/ +public class NingboBankPayResultPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(getClass()); + @Value("${OA.data_source_code}") + private String oa_data_source_code; + @Autowired + private IPayBillPluginInitializerDao payBillDao; + @Autowired + private INingboBankPluginService ningboBankPluginService; + /*** + * 插件初始化方法 + * @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 "NingboBankPayResultPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "宁波银行转账结果查询插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "宁波银行转账结果查询插件"; + } + + /*** + * 插件类型 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 { + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select * from v_hzya_pay where payState ='1'"); + try { + List> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity); + if(CollectionUtils.isNotEmpty(hashMaps)){ + //查询交易结果 + ningboBankPluginService.queryResult(hashMaps,"8000360001"); + } + } catch (Exception e) { + e.printStackTrace(); + } + return new JsonResultEntity("成功",true,new JsonResultEntity()); + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankTTPayPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankTTPayPluginInitializer.java new file mode 100644 index 00000000..5303546e --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankTTPayPluginInitializer.java @@ -0,0 +1,147 @@ +package com.hzya.frame.plugin.a8bill.plugin; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +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.beans.factory.annotation.Value; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +/** + * @Description 外汇 TT 汇款 + * @Author xiangerlin + * @Date 2024/8/1 14:33 + **/ +public class NingboBankTTPayPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private INingboBankPluginService ningboBankPluginService; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Autowired + private IPayBillPluginInitializerDao payBillDao; + @Value("${OA.data_source_code}") + private String oa_data_source_code; + + + /*** + * 插件初始化方法 + * @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 "NingboBankTTPayPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "宁波银行T/T汇款插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "宁波银行T/T汇款插件"; + } + + /*** + * 插件类型 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 { + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + try { + StringBuffer sb = new StringBuffer(); + if(StrUtil.isNotEmpty(rootAppPk)){ + String code = requestJson.getString("code"); + sb.append(" and id = '"+rootAppPk+"'"); + }else{ + sb.append(" and payState is null"); + } + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + StringBuffer stringBuffer = new StringBuffer(); + //付款单 + stringBuffer.append("select * from v_hzya_pay_tt where 1=1 " ); + stringBuffer.append(sb.toString()); + List> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity); + ningboBankPluginService.payRequest(hashMaps,getPluginId(),"8000360003",interId); + } catch (Exception e) { + logger.info("获取OA数据失败"+e.getMessage()); + e.printStackTrace(); + } + return new JsonResultEntity("成功",true,new JsonResultEntity()); + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankTTPayResultPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankTTPayResultPluginInitializer.java new file mode 100644 index 00000000..f5ed1791 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/NingboBankTTPayResultPluginInitializer.java @@ -0,0 +1,129 @@ +package com.hzya.frame.plugin.a8bill.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +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.beans.factory.annotation.Value; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; + +/** + * @Description TT汇款汇出交易结果查询 + * @Author xiangerlin + * @Date 2024/8/2 10:47 + **/ +public class NingboBankTTPayResultPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private INingboBankPluginService ningboBankPluginService; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Autowired + private IPayBillPluginInitializerDao payBillDao; + @Value("${OA.data_source_code}") + private String oa_data_source_code; + + + /*** + * 插件初始化方法 + * @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 "NingboBankTTPayResultPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "宁波银行T/T汇款交易状态查询插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "宁波银行T/T汇款交易状态查询插件"; + } + + /*** + * 插件类型 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 { + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select * from v_hzya_pay_tt where payState ='1'"); + try { + List> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity); + if(CollectionUtils.isNotEmpty(hashMaps)){ + //查询交易结果 + ningboBankPluginService.queryResult(hashMaps,"8000360007"); + } + } catch (Exception e) { + e.printStackTrace(); + } + return new JsonResultEntity("成功",true,new JsonResultEntity()); + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/PayReqSyncU8CPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/PayReqSyncU8CPluginInitializer.java new file mode 100644 index 00000000..74297311 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/plugin/PayReqSyncU8CPluginInitializer.java @@ -0,0 +1,154 @@ +package com.hzya.frame.plugin.a8bill.plugin; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +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.util.HashMap; +import java.util.List; + +/** + * @Description OA付款申请审批完成后传u8c + * @Author xiangerlin + * @Date 2024/10/9 14:19 + **/ +public class PayReqSyncU8CPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private INingboBankPluginService ningboBankPluginService; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Autowired + private IPayBillPluginInitializerDao payBillDao; + @Value("${OA.data_source_code}") + private String oa_data_source_code; + + /*** + * 插件初始化方法 + * @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 "PayReqSyncU8CPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "付款申请审批结果传U8C"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "付款申请审批结果传U8C"; + } + + /*** + * 插件类型 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 { + logger.info("======开始执行付款申请审批结果传U8C========"); + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(), JSONObject.class); + String integration_task_living_details_id = requestJsonObj.getString("integration_task_living_details_id"); + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if (StrUtil.isNotEmpty(integration_task_living_details_id)) { + oldMsg = taskLivingDetailsService.get(integration_task_living_details_id); + } + String rootAppPk = oldMsg.getRootAppPk(); + try { + StringBuffer sb = new StringBuffer(); + if (StrUtil.isNotEmpty(rootAppPk)) { + sb.append(" and id = '" + rootAppPk + "'"); + }else { + sb.append("and finishedflag = '1' and pushState is null"); + } + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + StringBuffer stringBuffer = new StringBuffer(); + //付款单 + stringBuffer.append("SELECT * from v_hzya_payres_u8c WHERE 1= 1 "); + stringBuffer.append(sb.toString()); + List> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(), oaBillEntity); + for (HashMap hashMap : hashMaps) { + JSONObject main = new JSONObject(); + for (String key : hashMap.keySet()) { + main.put(key, hashMap.get(key)); + } + logger.info("组装数据前"+JSON.toJSONString(hashMaps)); + logger.info("组装数据前1"+main.toString()); + ningboBankPluginService.updateU8CStatus(main,integration_task_living_details_id); + } + } catch (Exception e) { + logger.info("获取OA数据失败" + e.getMessage()); + e.printStackTrace(); + } + return BaseResult.getSuccessMessageEntity(getPluginName()+"执行成功"); + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/service/INingboBankPluginService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/service/INingboBankPluginService.java new file mode 100644 index 00000000..a60a7302 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/service/INingboBankPluginService.java @@ -0,0 +1,60 @@ +package com.hzya.frame.plugin.a8bill.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes; + +import java.util.HashMap; +import java.util.List; + +/** + * @Description 宁波银行插件用 + * @Author xiangerlin + * @Date 2024/7/25 16:33 + **/ +public interface INingboBankPluginService { + + /** + * 支付申请 + * @param hashMaps oa 查到的数据 + * @param pluginId 插件 id + * @param apiCode api 编码 + * @param interId 重试 id + */ + void payRequest(List> hashMaps,String pluginId,String apiCode,String interId); + /** + * 调用宁波银行esb接口 + * @param params 参数 + * @param apiCode 接口编码 + * @param appId 应用id + * @return + */ + String executeEsb(String params,String apiCode,String appId); + + + /** + * 保存收款日志到oa底表 + * @param accTransactionResList + */ + void saveAccLog(List accTransactionResList); + + /** + * 查询交易结果 + * @param hashMaps + * @param apiCode + */ + void queryResult(List> hashMaps,String apiCode); + + /** + * 查询OA附件,并上传到宁波银行 + * @param oaId oa主键id + * @return 宁波银行附件上传编码 + */ + String fileUpload(String oaId); + + /** + * 更新u8c单据状态 + * @param jsonObject + * @param integration_task_living_details_id 重试id + */ + void updateU8CStatus(JSONObject jsonObject,String integration_task_living_details_id); +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/service/impl/NingboBankPluginServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/service/impl/NingboBankPluginServiceImpl.java new file mode 100644 index 00000000..889ba344 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/a8bill/service/impl/NingboBankPluginServiceImpl.java @@ -0,0 +1,479 @@ +package com.hzya.frame.plugin.a8bill.service.impl; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.map.MapBuilder; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.ningboBankTreasury.dto.req.SingleTransferReq; +import com.hzya.frame.ningboBankTreasury.dto.req.TTRemitReq; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes; +import com.hzya.frame.ningboBankTreasury.enums.CurrencyEnum; +import com.hzya.frame.ningboBankTreasury.enums.PayStatusEnum; +import com.hzya.frame.ningboBankTreasury.enums.TTPayStatusEnum; +import com.hzya.frame.ningboBankTreasury.service.INingboBankTreasuryService; +import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao; +import com.hzya.frame.plugin.a8bill.entity.PayBillEntity; +import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService; +import com.hzya.frame.seeyon.dongj.entity.Formmain0044Entity; +import com.hzya.frame.seeyon.dongj.service.IFormmain0044Service; +import com.hzya.frame.seeyon.util.RestUtil; +import com.hzya.frame.stringutil.StringUtil; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +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.beans.factory.annotation.Value; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Description 宁波银行插件用 + * @Author xiangerlin + * @Date 2024/7/25 16:34 + **/ +public class NingboBankPluginServiceImpl implements INingboBankPluginService { + Logger logger = LoggerFactory.getLogger(getClass()); +@Autowired +private IFormmain0044Service formmain0044Service; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Autowired + private IPayBillPluginInitializerDao payBillDao; + @Autowired + private RestUtil restUtil; + @Autowired + private INingboBankTreasuryService ningboBankTreasuryService; + @Value("${OA.data_source_code}") + private String oa_data_source_code; + + + /** + * 支付申请 + * @param hashMaps oa 查到的数据 + * @param pluginId 插件 id + * @param apiCode api 编码 + * @param interId 重试 id + */ + @Override + public void payRequest(List> hashMaps, String pluginId, String apiCode,String interId) { + if(CollectionUtils.isNotEmpty(hashMaps)){ + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + + for (HashMap hashMap : hashMaps) { + try { + JSONObject main = new JSONObject(); + for(String key:hashMap.keySet()) { + main.put(key, hashMap.get(key)); + } + String param = ""; + //单笔转账 + if ("8000360000".equals(apiCode)){ + SingleTransferReq singleTransferReq = JSONObject.parseObject(main.toString(), SingleTransferReq.class); + param = JSONObject.toJSONString(singleTransferReq); + }else if("8000360003".equals(apiCode)){ + //TT汇款 + TTRemitReq ttRemitReq = JSONObject.parseObject(main.toString(), TTRemitReq.class); + //货到付款时,要上传附件 + if ("01".equals(ttRemitReq.getPayMode())){ + String fileCode = fileUpload(main.getString("id")); + ttRemitReq.setFileUploadCodes(Convert.toList(String.class,fileCode)); + } + param = JSONObject.toJSONString(ttRemitReq); + } + if (StrUtil.isEmpty(param)){ + param = main.toString(); + } + logger.info("获取到付款单的数据:{}",main.toString()); + String result = this.executeEsb(param,apiCode,"800036"); + logger.info("推送宁波银行的返回结果:{}",result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(main.getString("id")); + logDetails.setRootAppBill(main.getString("serialNo")); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(main)); + logDetails.setPluginId(pluginId); + JSONObject resultObj = JSON.parseObject(result); + String attribute = resultObj.getString("attribute"); + boolean flag = resultObj.getBoolean("flag"); + String subState = ""; + String fieldName = main.getString("fieldName"); + String tableName = main.getString("tableName"); + String payMsg = main.getString("payMsg"); +// String subMsg = main.getString("subMsg"); + String str = ""; + String sync_flag = ""; + try { + if(StrUtil.isEmpty(interId)){// 银行状态 1支付中 2 支付失败 null 未提交支付 0支付成功 + logDetails.setCreate_time(new Date()); + logDetails.setModify_time(new Date()); + if(flag){ + subState = "1"; + sync_flag = " ,"+payMsg+" = '支付中'"; + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + subState = "2"; + String resMsg = JSONObject.parseObject(attribute).getString("retMsg"); + sync_flag = " ,"+payMsg+" = '"+resMsg+"'"; + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + logDetails.setModify_time(new Date()); + if(flag){ + subState = "1"; + sync_flag = " ,"+payMsg+" = '支付中'"; + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + subState = "2"; + String resMsg = JSONObject.parseObject(attribute).getString("retMsg"); + sync_flag = " ,"+payMsg+" = '"+resMsg+"'"; + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + + str = "update "+tableName+" set " + fieldName + "= '" +subState+"'" +sync_flag+"where id = '"+main.getString("id")+"'"; + } catch (Exception e) { + subState = "N"; + str = "update "+tableName+" set " + fieldName + "= '" +subState+"'," +payMsg+" = '"+attribute+"' "+"where id = '"+main.getString("id")+"'"; + logger.info("保存日志失败"+e.getMessage()); + oaBillEntity.setSql(str); + payBillDao.updateStateForId(str,oaBillEntity); + e.printStackTrace(); + } + //修改推送状态,防止重复推送 + oaBillEntity.setSql(str); + payBillDao.updateStateForId(str,oaBillEntity); + }catch (Exception e){ + logger.info("宁波银行付款接口调用出错:{}",e); + } + } + } + } + + /** + * 查询交易结果 + * + * @param hashMaps + * @param apiCode + */ + @Override + public void queryResult(List> hashMaps, String apiCode) { + if(CollectionUtils.isNotEmpty(hashMaps)){ + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + for (HashMap hashMap : hashMaps) { + JSONObject main = new JSONObject(); + for(String key:hashMap.keySet()) { + main.put(key, hashMap.get(key)); + } + String tableName = main.getString("tableName"); + String fieldName = main.getString("fieldName"); + String payDate = main.getString("payDate"); + String payMsg = main.getString("payMsg"); + try { + + logger.info("获取到付款单状态的数据"+main.toString()); + JSONObject reMain = new JSONObject(); + reMain.put("serialNo",main.getString("serialNo")); + String result = this.executeEsb(reMain.toString(),apiCode,"800036"); + logger.info("获取付款状态结果"+result); + + JSONObject resultObj = JSON.parseObject(result); + JSONObject attribute = resultObj.getJSONObject("attribute"); + boolean flag = resultObj.getBoolean("flag"); + + StringBuffer sb = new StringBuffer(); + sb.append("update "+tableName); + if(flag){ + JSONObject data = attribute.getJSONObject("Data"); + JSONObject transferDtl = new JSONObject(); + String status = ""; + String msg = ""; + boolean isFinally = true; + if ("8000360001".equals(apiCode)){ + transferDtl = data.getJSONObject("transferDtl"); + status = transferDtl.getString("status"); + msg = PayStatusEnum.getByCode(status); + isFinally = PayStatusEnum.isFinally(status); + }else if ("8000360007".equals(apiCode)){ + status = data.getString("transState"); + msg = TTPayStatusEnum.getByCode(status); + isFinally = TTPayStatusEnum.isFinally(status); + } + if(StrUtil.isEmpty(msg)){ + msg ="未知交易状态,请联系管理员查证"; + sb.append(" set "+payMsg+" = '"+msg+"'"); + sb.append(" , "+fieldName+" = '2'"); + } + sb.append(" set "+payMsg+" = '"+msg+"'"); + //是否最终态 + if(isFinally){ + sb.append(" , "+fieldName+" = '0'"); + String payDateStr = DateUtil.now(); + sb.append(" , "+payDate+" = '"+payDateStr+"'"); + } + }else { + sb.append(" set "+payMsg+" = '"+attribute.getString("retMsg")+"'"); + sb.append(" ,"+fieldName+" = '2'"); + + } + sb.append(" where id = '"+main.getString("id")+"'"); + //修改推送状态,防止重复推送 + oaBillEntity.setSql(sb.toString()); + payBillDao.updateStateForId(sb.toString(),oaBillEntity); + } catch (Exception e) { + StringBuffer sb = new StringBuffer(); + sb.append("update "+tableName ); + sb.append(" set "+payMsg+" = '获取交易状态失败'"); + sb.append(" , "+fieldName+" = '2'"); + sb.append(" where id = '"+main.getString("id")+"'"); + logger.info("获取交易状态失败,更新交易信息为失败状态,后续不在查询"); + e.printStackTrace(); + } + } + } + } + + /** + * 调用宁波银行esb接口 + * + * @param params + * @param apiCode + * @return + */ + @Override + public String executeEsb(String params, String apiCode,String appId) { + logger.info("请求apiCode:{},参数:{}",apiCode,params); + Map header = MapBuilder.create(true) + .put("apiCode", apiCode) + .put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj") + .put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") + //.put("appId","800036") + .put("appId",appId) + .build(); + String res = HttpRequest.post("http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(header).body(params).timeout(50000).execute().body(); + return res; + } + + /** + * 保存收款日志到oa底表 + * @param accTransactionResList + */ + @Override + public void saveAccLog(List accTransactionResList) { + if (CollectionUtils.isNotEmpty(accTransactionResList)){ + //查询已经存在的数据 + Formmain0044Entity formmain0044 = new Formmain0044Entity(); + formmain0044.setStart_date(DateUtil.lastWeek().toDateStr()); + formmain0044.setDataSourceCode(oa_data_source_code); + List formmain0044List = formmain0044Service.querySeridId(formmain0044); + //过滤已保存的数据 + if (CollectionUtils.isNotEmpty(formmain0044List) && CollectionUtils.isNotEmpty(accTransactionResList)){ + accTransactionResList = accTransactionResList.stream() + .filter(acc -> formmain0044List.stream() + .noneMatch(f -> acc.getSerialId().equals(f.getField0018()))) + .collect(Collectors.toList()); + } + if (CollectionUtils.isNotEmpty(accTransactionResList)){ + for (AccTransactionRes accTransactionRes : accTransactionResList) { + String bankAcc = StringUtil.nullConvert(accTransactionRes.getBankAcc()); + String bankName = StringUtil.nullConvert(accTransactionRes.getBankName()); + String accName = StringUtil.nullConvert(accTransactionRes.getAccName()); + String oppAccNo = StringUtil.nullConvert(accTransactionRes.getOppAccNo()); + String oppAccName = StringUtil.nullConvert(accTransactionRes.getOppAccName()); + String oppAccBank = StringUtil.nullConvert(accTransactionRes.getOppAccBank()); + String transTime = StringUtil.nullConvert(accTransactionRes.getTransTime()); + //这个是唯一的 + String serialId = StringUtil.nullConvert(StringUtil.replaceBlank(accTransactionRes.getSerialId())); + String amt = StringUtil.nullConvert(accTransactionRes.getAmt()); + String abs = StringUtil.nullConvert(accTransactionRes.getAbs()); + String bankType = StringUtil.nullConvert(accTransactionRes.getBankType()); + String serialNo = StringUtil.nullConvert(accTransactionRes.getSerialNo()); + String currency = StringUtil.nullConvert(CurrencyEnum.getNameByCode(accTransactionRes.getCurCode())); + String uses = StringUtil.nullConvert(accTransactionRes.getUses()); + //String curCode = StringUtil.nullConvert(accTransactionRes.getCurCode()); + //这里转换成货币符号 + String curCode = StringUtil.nullConvert(CurrencyEnum.getSymbolByCode(accTransactionRes.getCurCode())); + String postScript = StringUtil.nullConvert(accTransactionRes.getPostScript()); + String data = StrUtil.format(getAccLogXmlTemplate(),bankAcc,bankName,accName,oppAccNo,oppAccName,oppAccBank,transTime,serialId,amt,abs,bankType,serialNo,currency,uses,postScript,curCode); + JSONObject paramsTemplate = new JSONObject(); + paramsTemplate.put("loginName", "oa1"); + paramsTemplate.put("dataXml", data); + Map header = MapBuilder.create(true) + .put("apiCode", "8000340006") + .put("publicKey","ZJYAA9Z/jWMe1rC+Sjh8NVMRtwVMb5Bn0DbmIEsgpVlR3C9Ce7eDIk+3zDUT+v578prj") + .put("secretKey","B8sgQwEaskwM7BQj1XLvu3kdKD3xm7Lyd4FWsPaFQk5v+UtQLCkzVzLlCZ9Bdyv2j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") + .put("appId","800034") + .build(); + String res = HttpRequest.post("http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(header).body(paramsTemplate.toString()).timeout(60000).execute().body(); + System.out.println("保存oa底表结果:"+res); + } + } + } + } + + /** + * 查询OA附件,并上传到宁波银行 + * + * @param oaId oa主键id + * @return 宁波银行附件上传编码 + */ + @Override + public String fileUpload(String oaId) { + if (StrUtil.isNotEmpty(oaId)){ + try { + //查询oa单据关联附件 + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + String sql = " SELECT\n" + + " formmain_0058.id,\n" + + " formmain_0058.field0024 ,\n" + + " CTP_ATTACHMENT.FILE_URL,\n" + + " CTP_ATTACHMENT.FILENAME\n" + + "FROM\n" + + " formmain_0058 \n" + + " LEFT JOIN CTP_ATTACHMENT ON CTP_ATTACHMENT.SUB_REFERENCE = formmain_0058.field0024 \n" + + "WHERE\n" + + " formmain_0058.field0061 = '境外'\n" + + " and formmain_0058.id = '" + oaId+"'"; + oaBillEntity.setSql(sql); + List> dataList = payBillDao.getOaBillData(sql, oaBillEntity); + if (CollectionUtils.isNotEmpty(dataList)){ + HashMap oaDataMap = dataList.get(0); + String fileUrl = String.valueOf(oaDataMap.get("FILE_URL")); + String fileName = String.valueOf(oaDataMap.get("FILENAME")); + if (StrUtil.isNotEmpty(fileUrl)){ + //下载OA附件 + byte[] bytes = restUtil.downloadFileBytes("oa1", "8000340000", fileUrl, fileName); + //上传到宁波银行 + logger.info("上传附件到宁波银行:{},{}",fileUrl,fileName); + JSONObject param = new JSONObject(); + param.put("fileName",fileName); + param.put("bytes",bytes); + param.put("channelNo","open-filegateway"); + String res = executeEsb(param.toString(), "8000360008","800036"); + JsonResultEntity jsonResultEntity = JSONObject.parseObject(res, JsonResultEntity.class); + if (null != jsonResultEntity && jsonResultEntity.isFlag()){ + JSONObject attribute = JSONObject.parseObject(String.valueOf(jsonResultEntity.getAttribute())); + JSONObject data = attribute.getJSONObject("Data"); + String fileCode = data.getString("data"); + return fileCode; + } + } + } + }catch(Exception e){ + logger.error("上传附件到宁波银行出错:{}",e); + } + } + return null; + } + + /** + * 更新u8c单据状态 + * @param main + */ + @Override + public void updateU8CStatus(JSONObject main,String integration_task_living_details_id) { + String billCode = main.getString("serialNo"); + String dwbm = main.getString("dwbm"); + String state = main.getString("state"); + String userCode = main.getString("userCode"); + String id = main.getString("id"); + if (StrUtil.isNotEmpty(billCode)){ + PayBillEntity oaBillEntity = new PayBillEntity(); + oaBillEntity.setDataSourceCode(oa_data_source_code); + String str = "update formmain_0058 set field0072 = 'N' where id = "+id; + try { + JSONObject param = new JSONObject(); + param.put("billno",billCode); + param.put("corpcode",dwbm); + param.put("billType","paybill"); + param.put("userCode",userCode); + param.put("ckeckResult","3".equals(state) ? "Y" :"N"); + param.put("ckeckNote",getStateName(state)); + String result = executeEsb(param.toString(), "8000350060","800035"); + logger.info("调用U8C付款单审批返回参数:{}",result); + //保存日志 + IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity(); + taskLivingDetail.setCreate_time(new Date()); + taskLivingDetail.setModify_time(new Date()); + taskLivingDetail.setRootAppPk(id); + taskLivingDetail.setRootAppBill(main.getString("serialNo")); + taskLivingDetail.setPluginId("PayReqSyncU8CPlugin"); + taskLivingDetail.setRootAppNewData(param.toString()); + taskLivingDetail.setNewTransmitInfo(result); + taskLivingDetail.setNewPushDate(new Date()); + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.getBoolean("flag"); + //保存日志 + saveLog(integration_task_living_details_id,flag,taskLivingDetail); + //更新oa表单推送状态 + if (flag){ + str = "update formmain_0058 set field0072 = 'Y' where id = "+id; + } + }catch (Exception e){ + logger.error("执行U8C付款单审批接口出错:{}",e); + } + //修改推送状态,防止重复推送 + oaBillEntity.setSql(str); + try { + payBillDao.updateStateForId(str,oaBillEntity); + } catch (Exception e) { + logger.error("执行U8C付款单审批接口后更新OA单据状态出错:{}",e); + } + } + } + //审批状态对应的中文 + private String getStateName(String state){ + if ("3".equals(state)){ + return "审批通过"; + }else if ("1".equals(state)){ + return "流程终止"; + }else if ("2".equals(state)){ + return "流程撤销"; + } + return "审批通过"; + } + public void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail){ + try { + //判断,成功调用这个方法 + if (StrUtil.isEmpty(integration_task_living_details_id)){ + if (flag){ + taskLivingDetailsService.saveLogToSuccess(taskLivingDetail); + }else { + //失败 调用这个方法 + taskLivingDetailsService.saveLogToFail(taskLivingDetail); + } + }else { + taskLivingDetail.setId(integration_task_living_details_id); + if (flag){ + //如果是重试 成功调这个方法 + taskLivingDetailsService.saveLogFailToSuccess(taskLivingDetail); + }else { + //如果是重试 失败调这个方法 + taskLivingDetailsService.updateLogFailToSuccess(taskLivingDetail); + } + } + }catch (Exception e){ + logger.error("保存日志出错:{}",e); + } + } + private static String getAccLogXmlTemplate(){ + // return ""; + return ""; + } +} 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 index ebff9dc2..411215ea 100644 --- 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 @@ -452,6 +452,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { } } } catch (Exception e) { + logger.info("执行异常错误原因:"+e); logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute()); taskDetailEntity.setResult("新增返回脚本解析保存三方id错误"); taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); @@ -543,7 +544,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { map1.put("tableName",mainDb); map1.put("dataStatus", "N"); map1.put("deleteStatus", "0"); - map1.put("size", 10); + map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); @@ -738,7 +739,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { map1.put("tableName",mainDb); //map1.put("dataStatus", "F"); map1.put("updateStatus", "0"); - map1.put("size", 10); + map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); @@ -926,7 +927,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { map1.put("tableName",mainDb); //map1.put("dataStatus", "Y"); map1.put("addStatus", "0"); - map1.put("size", 100); + map1.put("size", 50); objects = mdmModuleDao.queryMdmSTs(map1); objects = toLowerCaseKeys(objects); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/dao/IOaReceiptDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/dao/IOaReceiptDao.java new file mode 100644 index 00000000..1051b7fa --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/dao/IOaReceiptDao.java @@ -0,0 +1,7 @@ +package com.hzya.frame.plugin.oaReceipt.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.oaReceipt.entity.OaReceiptEntity; + +public interface IOaReceiptDao extends IBaseDao { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/dao/impl/OaReceiptDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/dao/impl/OaReceiptDaoImpl.java new file mode 100644 index 00000000..e458e4d8 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/dao/impl/OaReceiptDaoImpl.java @@ -0,0 +1,8 @@ +package com.hzya.frame.plugin.oaReceipt.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.plugin.oaReceipt.dao.IOaReceiptDao; +import com.hzya.frame.plugin.oaReceipt.entity.OaReceiptEntity; + +public class OaReceiptDaoImpl extends MybatisGenericDao implements IOaReceiptDao { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/entity/OaReceiptEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/entity/OaReceiptEntity.java new file mode 100644 index 00000000..1ef5e65e --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/entity/OaReceiptEntity.java @@ -0,0 +1,6 @@ +package com.hzya.frame.plugin.oaReceipt.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class OaReceiptEntity extends BaseEntity { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/entity/OaReceiptEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/entity/OaReceiptEntity.xml new file mode 100644 index 00000000..896fd71d --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/entity/OaReceiptEntity.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + id + + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/plugin/OaReceiptPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/plugin/OaReceiptPluginInitializer.java new file mode 100644 index 00000000..015354c0 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/plugin/OaReceiptPluginInitializer.java @@ -0,0 +1,58 @@ +package com.hzya.frame.plugin.oaReceipt.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.a8bill.plugin.PayBillPluginInitializer; +import com.hzya.frame.seeyon.receiptFor.service.IReceiptForService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +public class OaReceiptPluginInitializer extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(PayBillPluginInitializer.class); + @Autowired + private IReceiptForService receiptForService; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "OaReceiptPlugin"; + } + + @Override + public String getPluginName() { + return "OaReceiptPlugin插件"; + } + + @Override + public String getPluginLabel() { + return "OaReceiptPlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行付款单据信息同步========"); + return receiptForService.sendReceiptFor(requestJson); + }catch (Exception e){ + logger.info("======执行付款单据同步失败:{}========",e.getMessage()); + e.printStackTrace(); + } + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/service/IOaReceiptService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/service/IOaReceiptService.java new file mode 100644 index 00000000..10ce9851 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/service/IOaReceiptService.java @@ -0,0 +1,7 @@ +package com.hzya.frame.plugin.oaReceipt.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.oaReceipt.entity.OaReceiptEntity; + +public interface IOaReceiptService extends IBaseService { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/service/impl/OaReceiptServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/service/impl/OaReceiptServiceImpl.java new file mode 100644 index 00000000..721488bd --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/oaReceipt/service/impl/OaReceiptServiceImpl.java @@ -0,0 +1,8 @@ +package com.hzya.frame.plugin.oaReceipt.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.plugin.oaReceipt.entity.OaReceiptEntity; +import com.hzya.frame.plugin.oaReceipt.service.IOaReceiptService; + +public class OaReceiptServiceImpl extends BaseService implements IOaReceiptService { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/dao/IPushMessageDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/dao/IPushMessageDao.java new file mode 100644 index 00000000..fa96f193 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/dao/IPushMessageDao.java @@ -0,0 +1,7 @@ +package com.hzya.frame.plugin.pushMessage.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity; + +public interface IPushMessageDao extends IBaseDao { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/dao/impl/PushMessageDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/dao/impl/PushMessageDaoImpl.java new file mode 100644 index 00000000..adff81f2 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/dao/impl/PushMessageDaoImpl.java @@ -0,0 +1,8 @@ +package com.hzya.frame.plugin.pushMessage.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.plugin.pushMessage.dao.IPushMessageDao; +import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity; + +public class PushMessageDaoImpl extends MybatisGenericDao implements IPushMessageDao { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/entity/PushMessageEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/entity/PushMessageEntity.java new file mode 100644 index 00000000..a91f1e6a --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/entity/PushMessageEntity.java @@ -0,0 +1,106 @@ +package com.hzya.frame.plugin.pushMessage.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class PushMessageEntity extends BaseEntity { + + private String pushMethod; + private String warningAppCode; + private String warningApiCode; + private String recipientIdList; + private String warningAppType; + private String sendAppName; + private String receiveAppName; + private String receiveApiName; + private String returnData; + private String receiveApiCode; + private String status; + + public String getPushMethod() { + return pushMethod; + } + + public void setPushMethod(String pushMethod) { + this.pushMethod = pushMethod; + } + + public String getWarningAppCode() { + return warningAppCode; + } + + public void setWarningAppCode(String warningAppCode) { + this.warningAppCode = warningAppCode; + } + + public String getWarningApiCode() { + return warningApiCode; + } + + public void setWarningApiCode(String warningApiCode) { + this.warningApiCode = warningApiCode; + } + + public String getRecipientIdList() { + return recipientIdList; + } + + public void setRecipientIdList(String recipientIdList) { + this.recipientIdList = recipientIdList; + } + + public String getWarningAppType() { + return warningAppType; + } + + public void setWarningAppType(String warningAppType) { + this.warningAppType = warningAppType; + } + + public String getSendAppName() { + return sendAppName; + } + + public void setSendAppName(String sendAppName) { + this.sendAppName = sendAppName; + } + + public String getReceiveAppName() { + return receiveAppName; + } + + public void setReceiveAppName(String receiveAppName) { + this.receiveAppName = receiveAppName; + } + + public String getReceiveApiName() { + return receiveApiName; + } + + public void setReceiveApiName(String receiveApiName) { + this.receiveApiName = receiveApiName; + } + + public String getReturnData() { + return returnData; + } + + public void setReturnData(String returnData) { + this.returnData = returnData; + } + + public String getReceiveApiCode() { + return receiveApiCode; + } + + public void setReceiveApiCode(String receiveApiCode) { + this.receiveApiCode = receiveApiCode; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/entity/PushMessageEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/entity/PushMessageEntity.xml new file mode 100644 index 00000000..af2614b6 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/entity/PushMessageEntity.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java new file mode 100644 index 00000000..3e0a996f --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/plugin/PushMessagePluginInitializer.java @@ -0,0 +1,77 @@ +package com.hzya.frame.plugin.pushMessage.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.pushMessage.dao.IPushMessageDao; +import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity; +import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataService; +import com.hzya.frame.sysnew.pushMessage.dao.ISysPushMessageDao; +import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity; +import com.hzya.frame.sysnew.pushMessage.service.ISysPushMessageService; +import com.hzya.frame.sysnew.sendMessageLog.service.ISysSendMessageLogService; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service("PushMessagePluginInitializer") +public class PushMessagePluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(PushMessagePluginInitializer.class); + + @Autowired + private ISysPushMessageDao sysPushMessageDao; + + @Resource + public ISysSendMessageLogService sysSendMessageLogService; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "PushMessagePlugin"; + } + + @Override + public String getPluginName() { + return "PushMessagePlugin插件"; + } + + @Override + public String getPluginLabel() { + return "PushMessagePlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行定时消息推送========"); + List list = sysPushMessageDao.getAll(); + + for(SysPushMessageEntity entity : list){ + sysSendMessageLogService.sendMessage(entity); + } + return BaseResult.getSuccessMessageEntity("定时推送消息成功"); + }catch (Exception e){ + logger.info("======执行定时消息推送失败:{}========",e.getMessage()); + e.printStackTrace(); + } + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/service/IPushMessageService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/service/IPushMessageService.java new file mode 100644 index 00000000..1109a5bd --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/service/IPushMessageService.java @@ -0,0 +1,10 @@ +package com.hzya.frame.plugin.pushMessage.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IPushMessageService extends IBaseService { + +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/service/impl/PushMessageServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/service/impl/PushMessageServiceImpl.java new file mode 100644 index 00000000..8101cda9 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/pushMessage/service/impl/PushMessageServiceImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.plugin.pushMessage.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.plugin.pushMessage.dao.IPushMessageDao; +import com.hzya.frame.plugin.pushMessage.entity.PushMessageEntity; +import com.hzya.frame.plugin.pushMessage.service.IPushMessageService; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +public class PushMessageServiceImpl extends BaseService implements IPushMessageService { + + private IPushMessageDao pushMessageDao; + + @Autowired + public void setPushMessageDao(IPushMessageDao dao) { + this.pushMessageDao = dao; + this.dao = dao; + } + +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/plugin/SaleConPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/plugin/SaleConPluginInitializer.java new file mode 100644 index 00000000..f406009d --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/plugin/SaleConPluginInitializer.java @@ -0,0 +1,100 @@ +package com.hzya.frame.plugin.u8c.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.u8c.service.ISalesBillingService; +import com.hzya.frame.u8c.sosale.service.ISoSaleService; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + + +public class SaleConPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(SaleConPluginInitializer.class); + +@Autowired +private ISoSaleService soSaleService; + + /*** + * 插件初始化方法 + * @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 "SaleConPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "U8C销售合同同步OA销售合同"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "U8C销售合同同步OA销售合同插件"; + } + + /*** + * 插件类型 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 { + soSaleService.getU8cSaleToOa(requestJson); + return BaseResult.getSuccessMessageEntity("销售订单同步OA成功"); + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/plugin/SalesBillingPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/plugin/SalesBillingPluginInitializer.java new file mode 100644 index 00000000..5aba75cb --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/plugin/SalesBillingPluginInitializer.java @@ -0,0 +1,98 @@ +package com.hzya.frame.plugin.u8c.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.u8c.service.ISalesBillingService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + + +public class SalesBillingPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(SalesBillingPluginInitializer.class); + + @Autowired + private ISalesBillingService salesBillingService; + + /*** + * 插件初始化方法 + * @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 "SalesBillingPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "u8c销售开票审核状态同步插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "u8c销售开票审核状态同步插件"; + } + + /*** + * 插件类型 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 { + JsonResultEntity jsonResultEntity = salesBillingService.doSalesBilling(requestJson); + return jsonResultEntity; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/service/ISalesBillingService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/service/ISalesBillingService.java new file mode 100644 index 00000000..5b0b6184 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/service/ISalesBillingService.java @@ -0,0 +1,17 @@ +package com.hzya.frame.plugin.u8c.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface ISalesBillingService { + + + /** + * @Author lvleigang + * @Description OA同步销售开票审核状态到U8C + * @Date 10:21 上午 2024/8/2 + * @param requestJson + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity doSalesBilling(JSONObject requestJson); +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/service/impl/SalesBillingServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/service/impl/SalesBillingServiceImpl.java new file mode 100644 index 00000000..4b943082 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/u8c/service/impl/SalesBillingServiceImpl.java @@ -0,0 +1,161 @@ +package com.hzya.frame.plugin.u8c.service.impl; + +import cn.hutool.core.map.MapBuilder; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.plugin.u8c.service.ISalesBillingService; +import com.hzya.frame.u8c.salesBilling.entity.U8cSalesBillingEntity; +import com.hzya.frame.u8c.salesBilling.service.IU8cSalesBillingService; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; + +import java.util.List; +import java.util.Map; + + +public class SalesBillingServiceImpl implements ISalesBillingService { + + Logger logger = LoggerFactory.getLogger(SalesBillingServiceImpl.class); + + @Value("${OA.data_source_code}") + private String oa_data_source_code; + @Autowired + private IU8cSalesBillingService iu8cSalesBillingService; + + private final String appId = "800035"; + //这个接口调错了。要用开发的那个审批接口 + //private final String apiCode = "8000350047"; + private final String apiCode = "8000350060"; + private final String publicKey = "ZJYATW/MfYZX7zF0eAh4DJXbyTLwUtwSoSz5Y/o1ksAaN/dCe7eDIk+3zDUT+v578prj"; + private final String secretKey = "+5BUkLQh3iX3VHgEt5bE2IPh+ZeebGvDaEspsvVu739Ar6sFnwg+fpPod4t6XhoTj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="; + + /** + * @param requestJson + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 同步销售开票审核状态 + * @Date 10:21 上午 2024/8/2 + **/ + @Override + public JsonResultEntity doSalesBilling(JSONObject requestJson) { + //查询需要同步的数据 + + try { + U8cSalesBillingEntity u8cSalesBillingEntity = new U8cSalesBillingEntity(); + u8cSalesBillingEntity.setDataSourceCode(oa_data_source_code); + List u8cSalesBillingEntities = iu8cSalesBillingService.queryDoSalesBilling(u8cSalesBillingEntity); + + if (u8cSalesBillingEntities != null && u8cSalesBillingEntities.size() > 0) { + for (int i = 0; i < u8cSalesBillingEntities.size(); i++) { + U8cSalesBillingEntity entity = u8cSalesBillingEntities.get(i); + String params = getSendData(entity); + //发送数据 + String returnData = executeEsb(params,appId,apiCode,publicKey,secretKey); + //解析结果 + boolean flag = analyzeReturnData(returnData); + if(flag){ + entity.setPushStatus("Y"); + }else { + entity.setPushStatus("N"); + } + entity.setDataSourceCode(oa_data_source_code); + iu8cSalesBillingService.updateDoSalesBilling(entity); + } + return BaseResult.getSuccessMessageEntity("同步销售开票审核状态成功"); + } else { + return BaseResult.getSuccessMessageEntity("同步销售开票审核状态成功"); + } + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("同步销售开票审核状态失败" + e.getMessage()); + } + } + + /** + * @Author lvleigang + * @Description 解析返回状态 + * @Date 2:50 下午 2024/8/2 + * @param returnData + * @return boolean + **/ + private boolean analyzeReturnData(String returnData) { + boolean falg = false ; + if (JSONUtil.isTypeJSON(returnData)) { + JSONObject jsonObject = JSONObject.parseObject(returnData); + if(jsonObject != null && jsonObject.get("flag") != null && jsonObject.getBoolean("flag")) { + JSONObject attribute = jsonObject.getJSONObject("attribute"); + if(attribute != null && attribute.get("status") != null && "success".equals(attribute.getString("status"))) { + falg = true; + } + } + } + return falg; + } + + private String getSendData(U8cSalesBillingEntity entity) { + String params = ""; + //{ + // "queryinfo": { + // "code": [ + // "SITH1904180026", + // "SOTH1805240023" + // ], + // "corp": "1000", + // "date_begin": "2019-03-24", + // "date_end": "2019-05-24" + // }, + // "approveinfo": { + // "approvid": "18612329914", + // "approveDate": "2018-04-19", + // "status": "Y", + // "note": "哈哈" + // } + //} + JSONObject data = new JSONObject(); + JSONObject queryinfo = new JSONObject(); + JSONObject approveinfo = new JSONObject(); + JSONArray code = new JSONArray(); + code.add(entity.getCode());//单据号 + queryinfo.put("code", code); + queryinfo.put("corp", entity.getCorp());//公司编码 + queryinfo.put("date_begin", entity.getDateBegin());//单据开始日期 + queryinfo.put("date_end", entity.getDateEnd());//单据结束日期 + approveinfo.put("approvid", entity.getApprovid());//审批人 + approveinfo.put("approveDate", entity.getApprovedate());//审核时间 + approveinfo.put("status", entity.getStatus());//审批状态(Y:通过,N:不通过,R:驳回) + approveinfo.put("note", entity.getNote());//批语 + + data.put("queryinfo", queryinfo); + data.put("approveinfo", approveinfo); + params = data.toJSONString(); + + //用新的审批接口 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("billno",entity.getCode()); + jsonObject.put("corpcode",entity.getCorp()); + jsonObject.put("billType","saleinvoice"); + jsonObject.put("userCode","15715849962"); + jsonObject.put("ckeckResult","Y"); + jsonObject.put("ckeckNote","审批通过"); + params = jsonObject.toString(); + return params; + } + + + public String executeEsb(String params, String appId, String apiCode, String publicKey, String secretKey) { + logger.info("请求apiCode:{},参数:{}", apiCode, params); + Map header = MapBuilder.create(true) + .put("apiCode", apiCode) + .put("publicKey", publicKey) + .put("secretKey", secretKey) + .put("appId", appId) + .build(); + String res = HttpRequest.post("http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(header).body(params).timeout(60000).execute().body(); + return res; + } +} diff --git a/buildpackage/src/main/resources/application-dev.yml b/buildpackage/src/main/resources/application-dev.yml deleted file mode 100644 index 5e9c4b36..00000000 --- a/buildpackage/src/main/resources/application-dev.yml +++ /dev/null @@ -1,42 +0,0 @@ -#######################dev环境####################### -logging: - #日志级别 指定目录级别 - level: - root: warn - encodings: UTF-8 - file: - # 日志保存路径 - path: /home/webservice/zt/log -spring: - datasource: - dynamic: - datasource: - master: - url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true - username: root - password: 62e4295b615a30dbf3b8ee96f41c820b - driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 -savefile: - # 文件保存路径 - path: /home/webservice/zt/file -# path: D:\webservice\file -# pluginpath: D:\webservice\plugin - pluginpath: /home/webservice/zt/plugin -# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\ - tomcatpath: /home/webservice/zt/tomcatV3/webapps/kangarooDataCenterV3/WEB-INF/classes/ -cbs8: - appId: 1P4AGrpz - appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a - url: https://cbs8-openapi-reprd.csuat.cmburl.cn - # 测试用这个 这个是银行给的,和下面的公钥不是一对密钥 - ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44 - # 这个私钥到时候上传到cbs,和下面到是同一对 - #ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46 - ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde - cbs_public_key: 0469146F06BF3B01236E84632441E826 - #电子回单下载临时存放位置 - elec_path: /Users/xiangerlin/Downloads/ -OA: - data_source_code: yc_oa -zt: - url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface \ No newline at end of file diff --git a/buildpackage/src/main/resources/application.yml b/buildpackage/src/main/resources/application.yml index 7b481a9d..146859a0 100644 --- a/buildpackage/src/main/resources/application.yml +++ b/buildpackage/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 9999 + port: 8901 servlet: context-path: /kangarooDataCenterV3 localIP: 127.0.0.1 @@ -93,7 +93,7 @@ mybatis-plus: db-config: id-type: auto # 主键策略 zt: - url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface + url: http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface #JimuReport[minidao配置] minidao : base-package: org.jeecg.modules.jmreport.desreport.dao* diff --git a/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/pluginCfg.xml new file mode 100644 index 00000000..b278a16d --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/pluginCfg.xml @@ -0,0 +1,6 @@ + + +NingboBankPlugin +宁波银行财资大管家插件 +202407250001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..a8d4b5ed --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..448a645d --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..7d4d44a9 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/ningbobank/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/pluginCfg.xml new file mode 100644 index 00000000..d2654f45 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/pluginCfg.xml @@ -0,0 +1,6 @@ + + +OaReceiptPlugin +OaReceiptPlugin插件 +90000026 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..f0695cce --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..a6799dbf --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..ba5fdbe0 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/oaReceipt/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/u8c/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/u8c/pluginCfg.xml new file mode 100644 index 00000000..70c76f15 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/u8c/pluginCfg.xml @@ -0,0 +1,6 @@ + + +SalesBillingPlugin +u8c插件 +202408020001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/u8c/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/u8c/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..c487c28c --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/u8c/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/u8c/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/u8c/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..c011db17 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/u8c/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/common/src/main/java/com/hzya/frame/util/GroovyUtil.java b/common/src/main/java/com/hzya/frame/util/GroovyUtil.java index 52fd2804..0530f6c9 100644 --- a/common/src/main/java/com/hzya/frame/util/GroovyUtil.java +++ b/common/src/main/java/com/hzya/frame/util/GroovyUtil.java @@ -51,6 +51,7 @@ public class GroovyUtil { logger.info("创建newInstance失败:"+ e); throw new BaseSystemException(e); } + logger.info("开始执行脚本:"+parameterJson); Object returnObj = groovyObject.invokeMethod("execute",parameterJson); logger.info("脚本参数:{}",parameterJson); logger.info("执行脚本结束:"+returnObj); diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/util/BipUtil.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/util/BipUtil.java index a7bfe324..992da9d5 100644 --- a/service/src/main/java/com/hzya/frame/bip/v3/v2207/util/BipUtil.java +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/util/BipUtil.java @@ -22,7 +22,7 @@ public class BipUtil { */ public static String sendU9cTOBipEsb(String parm, String apiCode,String token){ - String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"; + String baseUrl = "http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface"; System.out.println("推送参数"+parm); String result = HttpRequest.post(baseUrl) .header("appId", "800023")//头信息,多个头信息多次调用此方法即可 @@ -40,7 +40,7 @@ public class BipUtil { return null; } public static String getBipToken(String userCode, String apiCode){ - String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"; + String baseUrl = "http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface"; String result = HttpRequest.post(baseUrl) .header("appId", "800023")//头信息,多个头信息多次调用此方法即可 .header("apiCode", apiCode)//头信息,多个头信息多次调用此方法即可 @@ -58,6 +58,24 @@ public class BipUtil { } return null; } + public static String sendOaToU8c(String parm, String apiCode){ + String baseUrl = "http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface"; + System.out.println("推送参数"+parm); + String result = HttpRequest.post(baseUrl) + .header("appId", "800035")//头信息,多个头信息多次调用此方法即可 + .header("apiCode", apiCode)//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYATW/MfYZX7zF0eAh4DJXbyTLwUtwSoSz5Y/o1ksAaN/dCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "+5BUkLQh3iX3VHgEt5bE2IPh+ZeebGvDaEspsvVu739Ar6sFnwg+fpPod4t6XhoTj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(parm)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + System.out.println("返回参数"+result); + if(StrUtil.isNotEmpty(result)){ + return analytic(result); + } + return null; + } + public static String analytic(String parm){ JSONObject main = JSON.parseObject(parm); return main.getString("attribute"); diff --git a/service/src/main/java/com/hzya/frame/grpU8/nxproof/oerdjml/service/impl/OerDjmlExtServiceImpl.java b/service/src/main/java/com/hzya/frame/grpU8/nxproof/oerdjml/service/impl/OerDjmlExtServiceImpl.java index d8d4b2c7..78d409be 100644 --- a/service/src/main/java/com/hzya/frame/grpU8/nxproof/oerdjml/service/impl/OerDjmlExtServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/grpU8/nxproof/oerdjml/service/impl/OerDjmlExtServiceImpl.java @@ -49,7 +49,7 @@ public class OerDjmlExtServiceImpl implements IOerDjmlExtService { Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private RestUtil restUtil; - @Value("${savefile.path}") + @Value("${savefile.path:}") public String DSK; @Autowired private ISysApplicationDatabaseService sysApplicationDatabaseService; diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/AccTransactionReq.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/AccTransactionReq.java new file mode 100644 index 00000000..07c8e792 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/AccTransactionReq.java @@ -0,0 +1,190 @@ +package com.hzya.frame.ningboBankTreasury.dto.req; + +import java.util.List; + +/** + * @Description 交易明细查询请求参数 + * @Author xiangerlin + * @Date 2024/7/24 17:52 + **/ +public class AccTransactionReq { + + //客户号 必填 + private String custId; + //账号列表 每次对多1000个账号 必填 + private List bankAccList; + //增量查询标识,0增量查询 1全量查询 + private String queryFlag; + //增量查询起始时间 yyyy-MM-dd HH:mm:ss + private String recTime; + //开始日期 yyyy-MM-dd + private String beginDate; + //结束日期 yyyy-MM-dd + private String endDate; + //起始金额 + private String beginAmt; + //终止金额 + private String endAmt; + //收支方向 0收入 1支出 + private String cdSign; + //每页条数 + private String pageSize; + //当前页数 + private String currentPage; + //查询方式 0分页查询 1下载文件查询 + private String queryType; + //账户标识 0统计助手 1实体账户 + private String bankAccSign;// + //排序方式,asc正序 desc倒序 + private String sortType; + //单账号当日明细最大序号 + private String singleAccTodayMaxOrderNo; + //币种编码 + private String curCode; + //统计编号 + private List subBankAccList; + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public List getBankAccList() { + return bankAccList; + } + + public void setBankAccList(List bankAccList) { + this.bankAccList = bankAccList; + } + + public String getQueryFlag() { + return queryFlag; + } + + public void setQueryFlag(String queryFlag) { + this.queryFlag = queryFlag; + } + + public String getRecTime() { + return recTime; + } + + public void setRecTime(String recTime) { + this.recTime = recTime; + } + + public String getBeginDate() { + return beginDate; + } + + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public String getBeginAmt() { + return beginAmt; + } + + public void setBeginAmt(String beginAmt) { + this.beginAmt = beginAmt; + } + + public String getEndAmt() { + return endAmt; + } + + public void setEndAmt(String endAmt) { + this.endAmt = endAmt; + } + + public String getCdSign() { + return cdSign; + } + + public void setCdSign(String cdSign) { + this.cdSign = cdSign; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public String getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(String currentPage) { + this.currentPage = currentPage; + } + + public String getQueryType() { + return queryType; + } + + public void setQueryType(String queryType) { + this.queryType = queryType; + } + + public String getBankAccSign() { + return bankAccSign; + } + + public void setBankAccSign(String bankAccSign) { + this.bankAccSign = bankAccSign; + } + + public String getSortType() { + return sortType; + } + + public void setSortType(String sortType) { + this.sortType = sortType; + } + + public String getSingleAccTodayMaxOrderNo() { + return singleAccTodayMaxOrderNo; + } + + public void setSingleAccTodayMaxOrderNo(String singleAccTodayMaxOrderNo) { + this.singleAccTodayMaxOrderNo = singleAccTodayMaxOrderNo; + } + + public String getCurCode() { + return curCode; + } + + public void setCurCode(String curCode) { + this.curCode = curCode; + } + + public List getSubBankAccList() { + return subBankAccList; + } + + public void setSubBankAccList(List subBankAccList) { + this.subBankAccList = subBankAccList; + } + public AccTransactionReq() { + + } + + public AccTransactionReq(String custId, List bankAccList) { + this.custId = custId; + this.bankAccList = bankAccList; + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/SingleTransferReq.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/SingleTransferReq.java new file mode 100644 index 00000000..7fbb7f5c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/SingleTransferReq.java @@ -0,0 +1,209 @@ +package com.hzya.frame.ningboBankTreasury.dto.req; + +/** + * @Description 单笔转账请求参数 + * @Author xiangerlin + * @Date 2024/7/26 16:27 + **/ +public class SingleTransferReq { + //客户号 必填 + private String custId; + //付款账号 必填 + private String payAcc; + //用途 必填,长度不能超过70 + private String purpose; + //收款账号 必填 + private String rcvAcc; + //收款方行名 和联行号二者必须填一个 + private String rcvBankName; + //收款方联行号 对公支付必填 + private String rcvBankNo; + //金额 必填 + private String amt; + //同城异地标识 0同城 1异地 + private String areaSign; + //单位代码 必填 + private String corpCode; + //是否同行转账 0他行 1同行 + private String difBank; + //交易流水号 + private String serialNo; + //对公对私标识 0对公 1对丝 + private String isForIndividual; + //是否预约支付 0非预约 1预约 + private String isSubscribe; + //是否短信通知收款人 0不通知 1通知,只支持宁波银行付款的情况 + private String isTellRcv; + //收款方手机号 + private String rcvMobile; + //收款户名 + private String rcvName; + //备注 + private String remark; + //预约转账时间 + private String wishPayTime; + //支付方式 0直接付款 1代理支付 2联动支付 3自动请款 ,为空时默认直接付款 + private String payType; + //代理/联动账号/拨款账号 + private String remarkAcc; + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getPayAcc() { + return payAcc; + } + + public void setPayAcc(String payAcc) { + this.payAcc = payAcc; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getRcvAcc() { + return rcvAcc; + } + + public void setRcvAcc(String rcvAcc) { + this.rcvAcc = rcvAcc; + } + + public String getRcvBankName() { + return rcvBankName; + } + + public void setRcvBankName(String rcvBankName) { + this.rcvBankName = rcvBankName; + } + + public String getRcvBankNo() { + return rcvBankNo; + } + + public void setRcvBankNo(String rcvBankNo) { + this.rcvBankNo = rcvBankNo; + } + + public String getAmt() { + return amt; + } + + public void setAmt(String amt) { + this.amt = amt; + } + + public String getAreaSign() { + return areaSign; + } + + public void setAreaSign(String areaSign) { + this.areaSign = areaSign; + } + + public String getCorpCode() { + return corpCode; + } + + public void setCorpCode(String corpCode) { + this.corpCode = corpCode; + } + + public String getDifBank() { + return difBank; + } + + public void setDifBank(String difBank) { + this.difBank = difBank; + } + + public String getSerialNo() { + return serialNo; + } + + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; + } + + public String getIsForIndividual() { + return isForIndividual; + } + + public void setIsForIndividual(String isForIndividual) { + this.isForIndividual = isForIndividual; + } + + public String getIsSubscribe() { + return isSubscribe; + } + + public void setIsSubscribe(String isSubscribe) { + this.isSubscribe = isSubscribe; + } + + public String getIsTellRcv() { + return isTellRcv; + } + + public void setIsTellRcv(String isTellRcv) { + this.isTellRcv = isTellRcv; + } + + public String getRcvMobile() { + return rcvMobile; + } + + public void setRcvMobile(String rcvMobile) { + this.rcvMobile = rcvMobile; + } + + public String getRcvName() { + return rcvName; + } + + public void setRcvName(String rcvName) { + this.rcvName = rcvName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getWishPayTime() { + return wishPayTime; + } + + public void setWishPayTime(String wishPayTime) { + this.wishPayTime = wishPayTime; + } + + public String getPayType() { + return payType; + } + + public void setPayType(String payType) { + this.payType = payType; + } + + public String getRemarkAcc() { + return remarkAcc; + } + + public void setRemarkAcc(String remarkAcc) { + this.remarkAcc = remarkAcc; + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/TTRemitReq.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/TTRemitReq.java new file mode 100644 index 00000000..bf46a6e6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/req/TTRemitReq.java @@ -0,0 +1,390 @@ +package com.hzya.frame.ningboBankTreasury.dto.req; + +import java.util.List; + +/** + * @Description T/T汇款提交 + * @Author xiangerlin + * @Date 2024/8/1 17:14 + **/ +public class TTRemitReq { + private String custId; + private String serialNo; + private String remitType; + private String transferType; + private String corpCode; + private String remitAddress; + private String bankType; + private String payMode; + private String estimateDate; + private String remitCurCode; + private String smallCurCode; + private String totalAmt; + private String transAmt; + private String subTransCode; + private String goods; + private String transAmt2; + private String subTransCode2; + private String goods2; + private String remitAcc; + private String curRemitAmt; + private String remitAcc2; + private String curRemitAmt2; + private String curRemitAmt3; + private String remitAcc3; + private String isAgent; + private String agentAcc; + private String agentBankSwiftCode; + private String rcvSettleType; + private String rcvBankCode; + private String rcvCountryCode; + private String rcvName; + private String rcvAddress; + private String rcvAcc; + private String costPayer; + private String costAcc; + private String isFullPay; + private String paymentProp; + private String contacts; + private String contactPhone; + private String payUnderFreeTax; + //private List contractDtlList; + private String postscript; + private List fileUploadCodes; + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getSerialNo() { + return serialNo; + } + + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; + } + + public String getRemitType() { + return remitType; + } + + public void setRemitType(String remitType) { + this.remitType = remitType; + } + + public String getTransferType() { + return transferType; + } + + public void setTransferType(String transferType) { + this.transferType = transferType; + } + + public String getCorpCode() { + return corpCode; + } + + public void setCorpCode(String corpCode) { + this.corpCode = corpCode; + } + + public String getRemitAddress() { + return remitAddress; + } + + public void setRemitAddress(String remitAddress) { + this.remitAddress = remitAddress; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getPayMode() { + return payMode; + } + + public void setPayMode(String payMode) { + this.payMode = payMode; + } + + public String getEstimateDate() { + return estimateDate; + } + + public void setEstimateDate(String estimateDate) { + this.estimateDate = estimateDate; + } + + public String getRemitCurCode() { + return remitCurCode; + } + + public void setRemitCurCode(String remitCurCode) { + this.remitCurCode = remitCurCode; + } + + public String getSmallCurCode() { + return smallCurCode; + } + + public void setSmallCurCode(String smallCurCode) { + this.smallCurCode = smallCurCode; + } + + public String getTotalAmt() { + return totalAmt; + } + + public void setTotalAmt(String totalAmt) { + this.totalAmt = totalAmt; + } + + public String getTransAmt() { + return transAmt; + } + + public void setTransAmt(String transAmt) { + this.transAmt = transAmt; + } + + public String getSubTransCode() { + return subTransCode; + } + + public void setSubTransCode(String subTransCode) { + this.subTransCode = subTransCode; + } + + public String getGoods() { + return goods; + } + + public void setGoods(String goods) { + this.goods = goods; + } + + public String getTransAmt2() { + return transAmt2; + } + + public void setTransAmt2(String transAmt2) { + this.transAmt2 = transAmt2; + } + + public String getSubTransCode2() { + return subTransCode2; + } + + public void setSubTransCode2(String subTransCode2) { + this.subTransCode2 = subTransCode2; + } + + public String getGoods2() { + return goods2; + } + + public void setGoods2(String goods2) { + this.goods2 = goods2; + } + + public String getRemitAcc() { + return remitAcc; + } + + public void setRemitAcc(String remitAcc) { + this.remitAcc = remitAcc; + } + + public String getCurRemitAmt() { + return curRemitAmt; + } + + public void setCurRemitAmt(String curRemitAmt) { + this.curRemitAmt = curRemitAmt; + } + + public String getRemitAcc2() { + return remitAcc2; + } + + public void setRemitAcc2(String remitAcc2) { + this.remitAcc2 = remitAcc2; + } + + public String getCurRemitAmt2() { + return curRemitAmt2; + } + + public void setCurRemitAmt2(String curRemitAmt2) { + this.curRemitAmt2 = curRemitAmt2; + } + + public String getCurRemitAmt3() { + return curRemitAmt3; + } + + public void setCurRemitAmt3(String curRemitAmt3) { + this.curRemitAmt3 = curRemitAmt3; + } + + public String getRemitAcc3() { + return remitAcc3; + } + + public void setRemitAcc3(String remitAcc3) { + this.remitAcc3 = remitAcc3; + } + + public String getIsAgent() { + return isAgent; + } + + public void setIsAgent(String isAgent) { + this.isAgent = isAgent; + } + + public String getAgentAcc() { + return agentAcc; + } + + public void setAgentAcc(String agentAcc) { + this.agentAcc = agentAcc; + } + + public String getAgentBankSwiftCode() { + return agentBankSwiftCode; + } + + public void setAgentBankSwiftCode(String agentBankSwiftCode) { + this.agentBankSwiftCode = agentBankSwiftCode; + } + + public String getRcvSettleType() { + return rcvSettleType; + } + + public void setRcvSettleType(String rcvSettleType) { + this.rcvSettleType = rcvSettleType; + } + + public String getRcvBankCode() { + return rcvBankCode; + } + + public void setRcvBankCode(String rcvBankCode) { + this.rcvBankCode = rcvBankCode; + } + + public String getRcvCountryCode() { + return rcvCountryCode; + } + + public void setRcvCountryCode(String rcvCountryCode) { + this.rcvCountryCode = rcvCountryCode; + } + + public String getRcvName() { + return rcvName; + } + + public void setRcvName(String rcvName) { + this.rcvName = rcvName; + } + + public String getRcvAddress() { + return rcvAddress; + } + + public void setRcvAddress(String rcvAddress) { + this.rcvAddress = rcvAddress; + } + + public String getRcvAcc() { + return rcvAcc; + } + + public void setRcvAcc(String rcvAcc) { + this.rcvAcc = rcvAcc; + } + + public String getCostPayer() { + return costPayer; + } + + public void setCostPayer(String costPayer) { + this.costPayer = costPayer; + } + + public String getCostAcc() { + return costAcc; + } + + public void setCostAcc(String costAcc) { + this.costAcc = costAcc; + } + + public String getIsFullPay() { + return isFullPay; + } + + public void setIsFullPay(String isFullPay) { + this.isFullPay = isFullPay; + } + + public String getPaymentProp() { + return paymentProp; + } + + public void setPaymentProp(String paymentProp) { + this.paymentProp = paymentProp; + } + + public String getContacts() { + return contacts; + } + + public void setContacts(String contacts) { + this.contacts = contacts; + } + + public String getContactPhone() { + return contactPhone; + } + + public void setContactPhone(String contactPhone) { + this.contactPhone = contactPhone; + } + + public String getPayUnderFreeTax() { + return payUnderFreeTax; + } + + public void setPayUnderFreeTax(String payUnderFreeTax) { + this.payUnderFreeTax = payUnderFreeTax; + } + + public String getPostscript() { + return postscript; + } + + public void setPostscript(String postscript) { + this.postscript = postscript; + } + + public List getFileUploadCodes() { + return fileUploadCodes; + } + + public void setFileUploadCodes(List fileUploadCodes) { + this.fileUploadCodes = fileUploadCodes; + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/AccTransactionRes.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/AccTransactionRes.java new file mode 100644 index 00000000..c8ed11e6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/AccTransactionRes.java @@ -0,0 +1,472 @@ +package com.hzya.frame.ningboBankTreasury.dto.res; + +/** + * @Description 宁波银行 境内交易明细返回参数 + * @Author xiangerlin + * @Date 2024/7/24 16:53 + **/ +public class AccTransactionRes { + //账号 + private String bankAcc; + private String bankSubAcc; + //户名 + private String accName; + //开户行名 + private String bankName; + //对方户名 + private String oppAccName; + //对方账号 + private String oppAccNo; + //对方开户行名 + private String oppAccBank; + //收支方向 0支出 1支出 + private String cdSign; + //业务类型 收、支、其他 + private String cdSignName; + //交易金额 + private String amt; + //明细余额 + private String bal; + //时间 + private String transTime; + //子流水号 + private String subSerialNo; + //交易流水号 + private String serialNo; + //币种编号 + private String curCode; + //用途 + private String uses; + //摘要 + private String abs; + //回单匹配号 + private String voucherNo; + //银行类别代码 + private String bifCode; + //银行类别 + private String bankType; + //对方银行类别 + private String oppBankType; + //对公、对私标志 0对公 1对私 + private String isForIndividual; + //流水号 这个字段是唯一的 + private String serialId; + //银行交易流水号 + private String bankSerialId; + //集团内交易 + private String groupTrans; + //资金划拨 + private String capitalTrans; + //交易备注 + private String postScript; + private String accType; + private String accTypeName; + //现转标识 + private String cashTfrFlg; + //国 开 行 所属 分 行号 + private String chinaDevelopBankNo; + //国 开 行 所属 账号类型 + private String chinaDevelopAccType; + //支付匹配号 + private String payBillCode; + //业务基础订单号 + private String alipayBaseOrderNumber; + //业务描述 + private String alipayBusinessDescription; + //备注1 + private String labelValue1; + private String labelValue2; + private String labelValue3; + private String labelValue4; + private String downloadNo; + //排序规则 + private String sortRule; + //明细编码 + private String orderNo; + //商品名称 + private String alipayTradeName; + //回单匹配号 + private String matchCode; + //回单个性化描述 + private String receiptInfo; + //凭证号 + private String billNum; + //明细更新时间 + private String recTime; + + public String getBankAcc() { + return bankAcc; + } + + public void setBankAcc(String bankAcc) { + this.bankAcc = bankAcc; + } + + public String getBankSubAcc() { + return bankSubAcc; + } + + public void setBankSubAcc(String bankSubAcc) { + this.bankSubAcc = bankSubAcc; + } + + public String getAccName() { + return accName; + } + + public void setAccName(String accName) { + this.accName = accName; + } + + public String getBankName() { + return bankName; + } + + public void setBankName(String bankName) { + this.bankName = bankName; + } + + public String getOppAccNo() { + return oppAccNo; + } + + public void setOppAccNo(String oppAccNo) { + this.oppAccNo = oppAccNo; + } + + public String getOppAccBank() { + return oppAccBank; + } + + public void setOppAccBank(String oppAccBank) { + this.oppAccBank = oppAccBank; + } + + public String getCdSign() { + return cdSign; + } + + public void setCdSign(String cdSign) { + this.cdSign = cdSign; + } + + public String getCdSignName() { + return cdSignName; + } + + public void setCdSignName(String cdSignName) { + this.cdSignName = cdSignName; + } + + public String getAmt() { + return amt; + } + + public void setAmt(String amt) { + this.amt = amt; + } + + public String getBal() { + return bal; + } + + public void setBal(String bal) { + this.bal = bal; + } + + public String getTransTime() { + return transTime; + } + + public void setTransTime(String transTime) { + this.transTime = transTime; + } + + public String getSubSerialNo() { + return subSerialNo; + } + + public void setSubSerialNo(String subSerialNo) { + this.subSerialNo = subSerialNo; + } + + public String getSerialNo() { + return serialNo; + } + + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; + } + + public String getCurCode() { + return curCode; + } + + public void setCurCode(String curCode) { + this.curCode = curCode; + } + + public String getUses() { + return uses; + } + + public void setUses(String uses) { + this.uses = uses; + } + + public String getAbs() { + return abs; + } + + public void setAbs(String abs) { + this.abs = abs; + } + + public String getVoucherNo() { + return voucherNo; + } + + public void setVoucherNo(String voucherNo) { + this.voucherNo = voucherNo; + } + + public String getBifCode() { + return bifCode; + } + + public void setBifCode(String bifCode) { + this.bifCode = bifCode; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getOppBankType() { + return oppBankType; + } + + public void setOppBankType(String oppBankType) { + this.oppBankType = oppBankType; + } + + public String getIsForIndividual() { + return isForIndividual; + } + + public void setIsForIndividual(String isForIndividual) { + this.isForIndividual = isForIndividual; + } + + public String getSerialId() { + return serialId; + } + + public void setSerialId(String serialId) { + this.serialId = serialId; + } + + public String getBankSerialId() { + return bankSerialId; + } + + public void setBankSerialId(String bankSerialId) { + this.bankSerialId = bankSerialId; + } + + public String getGroupTrans() { + return groupTrans; + } + + public void setGroupTrans(String groupTrans) { + this.groupTrans = groupTrans; + } + + public String getCapitalTrans() { + return capitalTrans; + } + + public void setCapitalTrans(String capitalTrans) { + this.capitalTrans = capitalTrans; + } + + public String getPostScript() { + return postScript; + } + + public void setPostScript(String postScript) { + this.postScript = postScript; + } + + public String getAccType() { + return accType; + } + + public void setAccType(String accType) { + this.accType = accType; + } + + public String getAccTypeName() { + return accTypeName; + } + + public void setAccTypeName(String accTypeName) { + this.accTypeName = accTypeName; + } + + public String getCashTfrFlg() { + return cashTfrFlg; + } + + public void setCashTfrFlg(String cashTfrFlg) { + this.cashTfrFlg = cashTfrFlg; + } + + public String getChinaDevelopBankNo() { + return chinaDevelopBankNo; + } + + public void setChinaDevelopBankNo(String chinaDevelopBankNo) { + this.chinaDevelopBankNo = chinaDevelopBankNo; + } + + public String getChinaDevelopAccType() { + return chinaDevelopAccType; + } + + public void setChinaDevelopAccType(String chinaDevelopAccType) { + this.chinaDevelopAccType = chinaDevelopAccType; + } + + public String getPayBillCode() { + return payBillCode; + } + + public void setPayBillCode(String payBillCode) { + this.payBillCode = payBillCode; + } + + public String getAlipayBaseOrderNumber() { + return alipayBaseOrderNumber; + } + + public void setAlipayBaseOrderNumber(String alipayBaseOrderNumber) { + this.alipayBaseOrderNumber = alipayBaseOrderNumber; + } + + public String getAlipayBusinessDescription() { + return alipayBusinessDescription; + } + + public void setAlipayBusinessDescription(String alipayBusinessDescription) { + this.alipayBusinessDescription = alipayBusinessDescription; + } + + public String getLabelValue1() { + return labelValue1; + } + + public void setLabelValue1(String labelValue1) { + this.labelValue1 = labelValue1; + } + + public String getLabelValue2() { + return labelValue2; + } + + public void setLabelValue2(String labelValue2) { + this.labelValue2 = labelValue2; + } + + public String getLabelValue3() { + return labelValue3; + } + + public void setLabelValue3(String labelValue3) { + this.labelValue3 = labelValue3; + } + + public String getLabelValue4() { + return labelValue4; + } + + public void setLabelValue4(String labelValue4) { + this.labelValue4 = labelValue4; + } + + public String getDownloadNo() { + return downloadNo; + } + + public void setDownloadNo(String downloadNo) { + this.downloadNo = downloadNo; + } + + public String getSortRule() { + return sortRule; + } + + public void setSortRule(String sortRule) { + this.sortRule = sortRule; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getAlipayTradeName() { + return alipayTradeName; + } + + public void setAlipayTradeName(String alipayTradeName) { + this.alipayTradeName = alipayTradeName; + } + + public String getMatchCode() { + return matchCode; + } + + public void setMatchCode(String matchCode) { + this.matchCode = matchCode; + } + + public String getReceiptInfo() { + return receiptInfo; + } + + public void setReceiptInfo(String receiptInfo) { + this.receiptInfo = receiptInfo; + } + + public String getBillNum() { + return billNum; + } + + public void setBillNum(String billNum) { + this.billNum = billNum; + } + + public String getRecTime() { + return recTime; + } + + public void setRecTime(String recTime) { + this.recTime = recTime; + } + + public String getOppAccName() { + return oppAccName; + } + + public void setOppAccName(String oppAccName) { + this.oppAccName = oppAccName; + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/AccTrxResponse.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/AccTrxResponse.java new file mode 100644 index 00000000..a4bfd6f8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/AccTrxResponse.java @@ -0,0 +1,94 @@ +package com.hzya.frame.ningboBankTreasury.dto.res; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; + +import java.util.List; + +/** + * @Description 宁波银行查询交易明细 + * @Author xiangerlin + * @Date 2024/7/24 16:45 + **/ +public class AccTrxResponse { + //返回交易码 0000成功,0001失败 + private String retCode; + //返回信息 + private String retMsg; + //每条页数 + private String pageSize; + //当前页数 + private String currentPage; + //总页数 + private String totalPage; + //总条数 + private String totalSize; + //收款明细列表 + private List list; + + public String getRetCode() { + return retCode; + } + + public void setRetCode(String retCode) { + this.retCode = retCode; + } + + public String getRetMsg() { + return retMsg; + } + + public void setRetMsg(String retMsg) { + this.retMsg = retMsg; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public String getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(String currentPage) { + this.currentPage = currentPage; + } + + public String getTotalPage() { + return totalPage; + } + + public void setTotalPage(String totalPage) { + this.totalPage = totalPage; + } + + public String getTotalSize() { + return totalSize; + } + + public void setTotalSize(String totalSize) { + this.totalSize = totalSize; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public static AccTrxResponse valueOf(String str){ + if (StrUtil.isNotEmpty(str) && JSONUtil.isTypeJSON(str)){ + NingBoResponse ningBoResponse = JSONObject.parseObject(str,NingBoResponse.class); + AccTrxResponse accTrxResponse = ningBoResponse.getData().toJavaObject(AccTrxResponse.class); + return accTrxResponse; + } + return null; + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/NingBoResponse.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/NingBoResponse.java new file mode 100644 index 00000000..c639c437 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/dto/res/NingBoResponse.java @@ -0,0 +1,23 @@ +package com.hzya.frame.ningboBankTreasury.dto.res; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.annotation.JSONField; + +/** + * @Description 宁波银行返回对象 + * @Author xiangerlin + * @Date 2024/7/24 17:46 + **/ +public class NingBoResponse { + + @JSONField(name ="Data") + private JSONObject data; + + public JSONObject getData() { + return data; + } + + public void setData(JSONObject data) { + this.data = data; + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/CurrencyEnum.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/CurrencyEnum.java new file mode 100644 index 00000000..38e61b85 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/CurrencyEnum.java @@ -0,0 +1,72 @@ +package com.hzya.frame.ningboBankTreasury.enums; + +/** + * @Description 币种枚举 + * @Author xiangerlin + * @Date 2024/7/24 17:07 + **/ +public enum CurrencyEnum { + + 人民币("01","人民币","CNY"), + 美元("02","美元","USD"), + 澳元("03","澳元","AUD"), + 欧元("04","欧元","EUR"), + 日元("05","日元","JPY"), + 英镑("06","英镑","GBP"), + 港币("07","港币","HKD"), + 新加坡元("08","新加坡元","SGD"), + 加拿大元("09","加拿大元","CAD"), + 瑞士("10","瑞士","CHF"), + 泰铢("23","泰铢","THB"), + 新台币("92","新台币","TWD"), + ALL("ALL","多币","ALL"); + + private final String code; + private final String name; + //英文代码 CNY USD之类的 + private final String symbol; + CurrencyEnum(String code,String name,String symbol) { + this.code = code; + this.name = name; + this.symbol = symbol; + } + + public String getName() { + return name; + } + public String getCode() { + return code; + } + + public String getSymbol() { + return symbol; + } + + /** + * 根据code获取币种名字 + * @param code + * @return + */ + public static String getNameByCode(String code){ + for (CurrencyEnum currency : values()) { + if (currency.code.equals(code)) { + return currency.name; + } + } + return null; // 或者抛出异常,表示找不到对应的币种 + } + + /** + * 根据code获取币种符号 + * @param code + * @return + */ + public static String getSymbolByCode(String code){ + for (CurrencyEnum currency : values()) { + if (currency.code.equals(code)) { + return currency.symbol; + } + } + return null; // 或者抛出异常,表示找不到对应的币种 + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/PayStatusEnum.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/PayStatusEnum.java new file mode 100644 index 00000000..fa5bd341 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/PayStatusEnum.java @@ -0,0 +1,88 @@ +package com.hzya.frame.ningboBankTreasury.enums; + +/** + * @Description 转账状态 + * @Author xiangerlin + * @Date 2024/7/29 17:11 + **/ +public enum PayStatusEnum { + SUCCESS("0","交易成功"), + // 失败状态 + FAILED_DELETED("-2", "已删除"), + APPROVAL_REJECTED_CLOSED("-3", "审批打回交易关闭"), + TRANSACTION_FAILED("2", "交易失败"), + FUND_ALLOCATION_FAILED("4", "交易失败,资金下拨失败"), + LINKAGE_PAYMENT_FAILED_REFUNDED("5", "联动支付失败,资金退回成功"), + LINKAGE_PAYMENT_FAILED_REFUND_PENDING("6", "联动支付失败,资金退回查证中"), + LINKAGE_PAYMENT_FAILED_REFUND_FAILED("96", "联动支付失败,资金退回失败"), + PAYMENT_REQUEST_FAILED("112", "请款失败"), + + // 其他状态 + REJECTED("-1", "驳回"), + PENDING_VERIFICATION("1", "交易待查证"), + PENDING_SEND("3", "待发送"), + PENDING_APPROVAL("11", "待审批"), + APPROVAL_THROUGH("95", "审批通过"), + TEMPORARY_STORAGE("7", "暂存"), + WITHDRAWN_BY_OPERATOR("-4", "经办撤回"), + PAYMENT_REQUEST_PENDING("111", "请款查证中"), + PAYMENT_REQUEST_SUCCEEDED_PENDING_SEND("113", "请款成功,交易待发送"), + LINKAGE_PAYMENT_SUCCEEDED_PENDING_SEND("114", "联动支付成功,智能支付交易待发送"); + + // 枚举属性 + private final String code; + private final String description; + // 枚举构造函数 + PayStatusEnum(String code, String description) { + this.code = code; + this.description = description; + } + + // 获取状态码 + + + public String getCode() { + return code; + } + + // 获取状态描述 + public String getDescription() { + return description; + } + + // 根据状态码查找枚举 + public static PayStatusEnum fromCode(String code) { + for (PayStatusEnum status : PayStatusEnum.values()) { + if (status.getCode().equals(code)) { + return status; + } + } + throw new IllegalArgumentException("Unknown code: " + code); + } + + public static String getByCode(String code){ + for (PayStatusEnum status : PayStatusEnum.values()) { + if (status.getCode().equals(code)) { + return status.getDescription(); + } + } + throw new IllegalArgumentException("Unknown code: " + code); + } + + /** + * 是否为最终态 + * @param code + * @return + */ + public static boolean isFinally(String code){ + return SUCCESS.code.equals(code) + || FAILED_DELETED.code.equals(code) + || APPROVAL_REJECTED_CLOSED.code.equals(code) + || TRANSACTION_FAILED.code.equals(code) + || FUND_ALLOCATION_FAILED.code.equals(code) + || LINKAGE_PAYMENT_FAILED_REFUNDED.code.equals(code) + || LINKAGE_PAYMENT_FAILED_REFUND_PENDING.code.equals(code) + || LINKAGE_PAYMENT_FAILED_REFUND_FAILED.code.equals(code) + || PAYMENT_REQUEST_FAILED.code.equals(code); + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/TTPayStatusEnum.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/TTPayStatusEnum.java new file mode 100644 index 00000000..c90150c2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/enums/TTPayStatusEnum.java @@ -0,0 +1,78 @@ +package com.hzya.frame.ningboBankTreasury.enums; + +/** + * @Description T/T汇款 支付状态枚举 + * @Author xiangerlin + * @Date 2024/8/2 15:42 + **/ +public enum TTPayStatusEnum{ + + // 成功和失败状态 + SUCCESS("0", "交易成功"), + TRANSACTION_FAILED("2", "交易失败"), + TRANSACTION_SENDING("8", "交易发送中"), + + // 审批状态 + + APPROVAL_IN_PROGRESS("11-94", "审批中"), + APPROVAL_PASSED("95", "审批通过"), + APPROVAL_REJECTED_CLOSED("-3", "审批打回,交易关闭"), + + // 其他状态 + TEMPORARY_STORAGE("7", "暂存"), + DELETED("-2", "删除"), + BANK_PROCESSING("1", "银行处理中"), + APPROVAL_REJECTED("-1", "审批打回"); + + // 枚举属性 + private final String code; + private final String description; + + // 枚举构造函数 + TTPayStatusEnum(String code, String description) { + this.code = code; + this.description = description; + } + + // 获取状态码 + public String getCode() { + return code; + } + + // 获取状态描述 + public String getDescription() { + return description; + } + + + // 根据状态码查找枚举 + public static TTPayStatusEnum fromCode(String code) { + for (TTPayStatusEnum status : TTPayStatusEnum.values()) { + if (status.getCode().equals(code)) { + return status; + } + } + throw new IllegalArgumentException("Unknown code: " + code); + } + + public static String getByCode(String code){ + for (TTPayStatusEnum status : TTPayStatusEnum.values()) { + if (status.getCode().equals(code)) { + return status.getDescription(); + } + } + throw new IllegalArgumentException("Unknown code: " + code); + } + + /** + * 是否为最终态 + * @param code + * @return + */ + public static boolean isFinally(String code){ + return SUCCESS.code.equals(code) + || APPROVAL_REJECTED_CLOSED.code.equals(code) + || DELETED.code.equals(code) + || TRANSACTION_FAILED.code.equals(code); + } +} diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/INingboBankTreasuryService.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/INingboBankTreasuryService.java index c8985f5d..1bb5d45d 100644 --- a/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/INingboBankTreasuryService.java +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/INingboBankTreasuryService.java @@ -1,9 +1,14 @@ package com.hzya.frame.ningboBankTreasury.service; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.ningboBankTreasury.dto.req.AccTransactionReq; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTrxResponse; import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.web.entity.JsonResultEntity; +import java.util.List; + public interface INingboBankTreasuryService { @@ -33,4 +38,22 @@ public interface INingboBankTreasuryService { * */ SysExtensionApiEntity doChangeData(SysExtensionApiEntity entity); + + /** + * 银行原生方法 + * 分页方式 全量查询境内账户交易明细 + * accTransactionReq.custId 客户号 必填 + * accTransactionReq.bankAccList 账号列表 必填 + * @param accTransactionReq + * @return + */ + List queryAccDetails(AccTransactionReq accTransactionReq); + + /** + * esb方法 + * 分页方式 全量查询境内账户交易明细 + * @param jsonObject + * @return + */ + JsonResultEntity queryAccountDetailsEsb(JSONObject jsonObject); } diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/impl/NingboBankTreasuryServiceImpl.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/impl/NingboBankTreasuryServiceImpl.java index 0b107a15..f677303c 100644 --- a/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/impl/NingboBankTreasuryServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/service/impl/NingboBankTreasuryServiceImpl.java @@ -1,11 +1,13 @@ package com.hzya.frame.ningboBankTreasury.service.impl; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.bip.v3.v2207.dps.service.impl.PayMentServiceImpl; +import com.hzya.frame.ningboBankTreasury.dto.req.AccTransactionReq; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTrxResponse; import com.hzya.frame.ningboBankTreasury.service.INingboBankTreasuryService; +import com.hzya.frame.ningboBankTreasury.util.NingboBankUtil; import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; -import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity; -import com.hzya.frame.util.bipV3.SHA256Util; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; import com.nbcb.sdk.OpenSDK; @@ -17,7 +19,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; @@ -30,7 +34,7 @@ public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity * @Author lvleigang - * @Description 单笔查证接口 + * @Description 单笔转账查证接口 * @Date 4:45 下午 2024/7/9 **/ @Override @@ -56,6 +60,7 @@ public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService } //发送数据 try { + logger.info("调用宁波银行接口最终参数:{}",dataJson); String returnData = OpenSDK.send(productID,serviceID,dataJson.replace(" ","")); if(returnData == null || "".equals(returnData)){ returnJson.put("retCode","9999"); @@ -145,6 +150,105 @@ public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService } } + /** + * 分页方式 全量查询境内账户交易明细 + * accTransactionReq.custId 客户号 必填 + * accTransactionReq.bankAccList 账号列表 必填 + * + * @param accTransactionReq + * @return + */ + @Override + public List queryAccDetails(AccTransactionReq accTransactionReq) { + accTransactionReq = defValue(accTransactionReq); + //当前页数 + int currentPage = Integer.valueOf(accTransactionReq.getCurrentPage()); + //总页数 + int totalPage = 0; + JSONObject data = new JSONObject(); + List resList = new ArrayList<>(); + try { + do { + ConfigParam configParam = new ConfigParam("MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgTt6OadouxxxSDg/0SZdOIBqtnFGKrpwmL+quEUf+hfSgCgYIKoEcz1UBgi2hRANCAAQGHNN2NO7btp+w1248yk98E0asGC8sG0bmIzdom4M0xp3vc4IfXjmZ8omUz4oVcjzAuyMSSpJM6uPLcU1SH4HZ","http://cz-test.nbcb.com.cn:7070/nbcb/api","54b3e05c-7983-4e6c-8920-f9ab8a0004a6","MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEXAt6fxeKlpREIyXoT3jDwGU7L6JkKrzdOKP1cMB14rtNwwlyaUGLrtuHVoArAHP3x7XN2rUw0GxSngYQwOAsjQ==",10000,20000); + OpenSDK.dynamicInit(configParam,true); + data.put("Data",JSONObject.toJSONString(accTransactionReq)); + logger.info("查询交易明细请求参数:{}",data.toString()); + String returnData = OpenSDK.send(NingboBankUtil.TMSREPORT, NingboBankUtil.QUERYACCDETAIL,data.toString()); + System.out.println(returnData); + logger.info("查询交易明细返回数据:{}",returnData); + AccTrxResponse accTrxResponse = AccTrxResponse.valueOf(returnData); + if (null != accTrxResponse && NingboBankUtil.isSuccess(accTrxResponse.getRetCode())){ + totalPage = Integer.valueOf(accTrxResponse.getTotalPage()); + resList.addAll(accTrxResponse.getList()); + } + currentPage++;//页码自增 + accTransactionReq.setCurrentPage(String.valueOf(currentPage));//页码 + }while (currentPage <= totalPage);//当前页 <= 总页数 继续循环 + } catch (Exception e) { + logger.error("查询账户交易明细出错:{}",e); + } + return resList; + } + + /** + * esb方法 + * 分页方式 全量查询境内账户交易明细 + * + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity queryAccountDetailsEsb(JSONObject jsonObject) { + JSONObject entity = getstrObj("jsonStr", jsonObject); + String dataJson = entity.getJSONObject("Data").getString("Data"); + AccTransactionReq accTransactionReq = JSONObject.parseObject(dataJson,AccTransactionReq.class ); + accTransactionReq = defValue(accTransactionReq); + //当前页数 + int currentPage = Integer.valueOf(accTransactionReq.getCurrentPage()); + //总页数 + int totalPage = 0; + JSONObject data = new JSONObject(); + List resList = new ArrayList<>(); + try { + do { + data.put("Data",JSONObject.toJSONString(accTransactionReq)); + entity.put("Data",data); + JSONObject param = new JSONObject(); + param.put("jsonStr",entity); + logger.info("查询交易明细请求参数:{}",JSONObject.toJSONString(param)); + JSONObject returnObj = (JSONObject) sendNbBank(param); + logger.info("查询交易明细返回数据:{}",returnObj.toString()); + AccTrxResponse accTrxResponse = AccTrxResponse.valueOf(returnObj.toString()); + if (null != accTrxResponse && NingboBankUtil.isSuccess(accTrxResponse.getRetCode())){ + totalPage = Integer.valueOf(accTrxResponse.getTotalPage()); + resList.addAll(accTrxResponse.getList()); + } + currentPage++;//页码自增 + accTransactionReq.setCurrentPage(String.valueOf(currentPage));//页码 + }while (currentPage <= totalPage);//当前页 <= 总页数 继续循环 + } catch (Exception e) { + logger.error("查询账户交易明细出错:{}",e); + return BaseResult.getFailureMessageEntity("查询账户交易明细出错"+e.getMessage()); + } + return BaseResult.getSuccessMessageEntity("查询账户交易明细成功",resList); + } + + //默认值检查 + private AccTransactionReq defValue(AccTransactionReq accTransactionReq){ + if (StrUtil.isEmpty(accTransactionReq.getPageSize())){ + accTransactionReq.setPageSize("1000"); + } + if (StrUtil.isEmpty(accTransactionReq.getCurrentPage())){ + accTransactionReq.setCurrentPage("1"); + } + if (StrUtil.isEmpty(accTransactionReq.getQueryType())){ + accTransactionReq.setQueryType("0"); + } + if (StrUtil.isEmpty(accTransactionReq.getCdSign())){ + accTransactionReq.setCdSign(NingboBankUtil.SHOURU); + } + return accTransactionReq; + } /** * @param entity * @content 此方法获取初始化参数,拼接请求参数 diff --git a/service/src/main/java/com/hzya/frame/ningboBankTreasury/util/NingboBankUtil.java b/service/src/main/java/com/hzya/frame/ningboBankTreasury/util/NingboBankUtil.java new file mode 100644 index 00000000..bb4c91e7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ningboBankTreasury/util/NingboBankUtil.java @@ -0,0 +1,27 @@ +package com.hzya.frame.ningboBankTreasury.util; + +/** + * @Description 宁波银行 + * @Author xiangerlin + * @Date 2024/7/24 18:15 + **/ +public class NingboBankUtil { + + //产品id + public static final String TMSREPORT = "tmsReport"; + //交易明细查询服务id + public static final String QUERYACCDETAIL = "queryAccDetail"; + public static final String QUERYACCOUNT = "queryAccount"; + //成功编码 + public static final String SUCCESSCODE = "0000"; + + //收入 + public static final String SHOURU = "0"; + //支出 + public static final String ZHICHU = "1"; + + //是否成功 + public static boolean isSuccess(String retCode){ + return SUCCESSCODE.equals(retCode) ? true : false; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/ICapFormDefinitionDao.java b/service/src/main/java/com/hzya/frame/seeyon/dao/ICapFormDefinitionDao.java new file mode 100644 index 00000000..f892fa11 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/ICapFormDefinitionDao.java @@ -0,0 +1,51 @@ +package com.hzya.frame.seeyon.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.seeyon.entity.CapFormDefinitionEntity; +import com.hzya.frame.seeyon.entity.CtpFileEntity; +import com.hzya.frame.seeyon.paybill.entity.PayBillEntity; + +import java.util.List; + +/** + * + * @content OA字段配置表DAO + * @className: Administrator + * @author laborer + * @date 2024-09-09 16:00 + * + */ + +public interface ICapFormDefinitionDao extends IBaseDao { + + /** + * + * @content 通过模版编号获取无流程表单配置信息 + * @className: Administrator + * @author laborer + * @date 2024-09-09 16:02 + * + */ + List getFormFiled(CapFormDefinitionEntity fieldInfo); +/** + * + * @content 通过主键删除单据数据 + * @className: Administrator + * @author laborer + * @date 2024-09-09 17:04 + * + */ + + int deleteByKey(CapFormDefinitionEntity fieldInfo); +/** + * + * @content 通过客户传递的数据值查询古河条件的数据 + * @className: Administrator + * @author laborer + * @date 2024-09-09 17:05 + * + */ + + List getFormFiledByFileValue(CapFormDefinitionEntity fieldInfo); +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/impl/CapFormDefinitionDaoImpl.java b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/CapFormDefinitionDaoImpl.java new file mode 100644 index 00000000..07304f45 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/CapFormDefinitionDaoImpl.java @@ -0,0 +1,39 @@ +package com.hzya.frame.seeyon.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.seeyon.dao.ICapFormDefinitionDao; +import com.hzya.frame.seeyon.dao.ICtpFileDao; +import com.hzya.frame.seeyon.entity.CapFormDefinitionEntity; +import com.hzya.frame.seeyon.entity.CtpFileEntity; +import com.hzya.frame.seeyon.paybill.entity.PayBillEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content OA字段配置表DAO + * @className: Administrator + * @author laborer + * @date 2024-09-09 16:00 + * + */ +@Repository(value = "CapFormDefinitionDaoImpl") +public class CapFormDefinitionDaoImpl extends MybatisGenericDao implements ICapFormDefinitionDao { + @DS("#fieldInfo.dataSourceCode") + @Override + public List getFormFiled(CapFormDefinitionEntity fieldInfo) { + return (List) selectList("com.hzya.frame.seeyon.entity.CapFormDefinitionEntity.CapFormDefinitionEntity_list_base",fieldInfo); + } + @DS("#fieldInfo.dataSourceCode") + @Override + public int deleteByKey(CapFormDefinitionEntity fieldInfo) { + return super.delete("com.hzya.frame.seeyon.entity.CapFormDefinitionEntity.CapFormDefinitionEntity_delete",fieldInfo); + } + @DS("#fieldInfo.dataSourceCode") + @Override + public List getFormFiledByFileValue(CapFormDefinitionEntity fieldInfo) { + return (List) selectList("com.hzya.frame.seeyon.entity.CapFormDefinitionEntity.CapFormDefinitionEntity_list_table_info",fieldInfo); + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dongj/dao/IFormmain0044Dao.java b/service/src/main/java/com/hzya/frame/seeyon/dongj/dao/IFormmain0044Dao.java new file mode 100644 index 00000000..d663715e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dongj/dao/IFormmain0044Dao.java @@ -0,0 +1,12 @@ +package com.hzya.frame.seeyon.dongj.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.seeyon.dongj.entity.Formmain0044Entity; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/7/26 11:01 + **/ +public interface IFormmain0044Dao extends IBaseDao { +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dongj/dao/impl/Formmain0044DaoImpl.java b/service/src/main/java/com/hzya/frame/seeyon/dongj/dao/impl/Formmain0044DaoImpl.java new file mode 100644 index 00000000..6615da88 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dongj/dao/impl/Formmain0044DaoImpl.java @@ -0,0 +1,15 @@ +package com.hzya.frame.seeyon.dongj.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.seeyon.dongj.dao.IFormmain0044Dao; +import com.hzya.frame.seeyon.dongj.entity.Formmain0044Entity; +import org.springframework.stereotype.Repository; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/7/26 11:02 + **/ +@Repository() +public class Formmain0044DaoImpl extends MybatisGenericDao implements IFormmain0044Dao { +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dongj/entity/Formmain0044Entity.java b/service/src/main/java/com/hzya/frame/seeyon/dongj/entity/Formmain0044Entity.java new file mode 100644 index 00000000..6591f817 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dongj/entity/Formmain0044Entity.java @@ -0,0 +1,146 @@ +package com.hzya.frame.seeyon.dongj.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * @Description oa收款明细底表 + * @Author xiangerlin + * @Date 2024/7/26 10:56 + **/ +public class Formmain0044Entity extends BaseEntity { + private String field0001; // 我方账号 + private String field0017; // 我方开户行 + private String field0024; // 我方户名 + private String field0029; // 客户方账号 + private String field0022; // 客户方户名 + private String field0030; // 客户方开户行 + private String field0018; // 交易日期 + private String field0019; // 交易流水号 唯一值 + private String field0020; // 收款金额 + private String field0021; // 摘要 + private String field0025; // 银行类型 + private String field0026; // 银行流水号 + private String field0027; // 币种 + private String field0028; // 用途 + private String start_date; + + public String getField0001() { + return field0001; + } + + public void setField0001(String field0001) { + this.field0001 = field0001; + } + + public String getField0017() { + return field0017; + } + + public void setField0017(String field0017) { + this.field0017 = field0017; + } + + public String getField0024() { + return field0024; + } + + public void setField0024(String field0024) { + this.field0024 = field0024; + } + + public String getField0029() { + return field0029; + } + + public void setField0029(String field0029) { + this.field0029 = field0029; + } + + public String getField0022() { + return field0022; + } + + public void setField0022(String field0022) { + this.field0022 = field0022; + } + + public String getField0030() { + return field0030; + } + + public void setField0030(String field0030) { + this.field0030 = field0030; + } + + public String getField0018() { + return field0018; + } + + public void setField0018(String field0018) { + this.field0018 = field0018; + } + + public String getField0019() { + return field0019; + } + + public void setField0019(String field0019) { + this.field0019 = field0019; + } + + public String getField0020() { + return field0020; + } + + public void setField0020(String field0020) { + this.field0020 = field0020; + } + + public String getField0021() { + return field0021; + } + + public void setField0021(String field0021) { + this.field0021 = field0021; + } + + public String getField0025() { + return field0025; + } + + public void setField0025(String field0025) { + this.field0025 = field0025; + } + + public String getField0026() { + return field0026; + } + + public void setField0026(String field0026) { + this.field0026 = field0026; + } + + public String getField0027() { + return field0027; + } + + public void setField0027(String field0027) { + this.field0027 = field0027; + } + + public String getField0028() { + return field0028; + } + + public void setField0028(String field0028) { + this.field0028 = field0028; + } + + public String getStart_date() { + return start_date; + } + + public void setStart_date(String start_date) { + this.start_date = start_date; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dongj/entity/Formmain0044Entity.xml b/service/src/main/java/com/hzya/frame/seeyon/dongj/entity/Formmain0044Entity.xml new file mode 100644 index 00000000..cad8daea --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dongj/entity/Formmain0044Entity.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + id, + field0001, + field0017, + field0024, + field0029, + field0022, + field0030, + field0018, + field0019, + field0020, + field0021, + field0025, + field0026, + field0027, + field0028 + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/seeyon/dongj/service/IFormmain0044Service.java b/service/src/main/java/com/hzya/frame/seeyon/dongj/service/IFormmain0044Service.java new file mode 100644 index 00000000..5c1a41d2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dongj/service/IFormmain0044Service.java @@ -0,0 +1,16 @@ +package com.hzya.frame.seeyon.dongj.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.seeyon.dongj.entity.Formmain0044Entity; + +import java.util.List; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/7/26 11:03 + **/ +public interface IFormmain0044Service extends IBaseService { + + List querySeridId(Formmain0044Entity entity); +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dongj/service/impl/Formmain0044ServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/dongj/service/impl/Formmain0044ServiceImpl.java new file mode 100644 index 00000000..fcf666f0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dongj/service/impl/Formmain0044ServiceImpl.java @@ -0,0 +1,40 @@ +package com.hzya.frame.seeyon.dongj.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity; +import com.hzya.frame.seeyon.cbs8.service.ICbsLogService; +import com.hzya.frame.seeyon.dongj.dao.IFormmain0044Dao; +import com.hzya.frame.seeyon.dongj.entity.Formmain0044Entity; +import com.hzya.frame.seeyon.dongj.service.IFormmain0044Service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/7/26 11:05 + **/ +@Service +public class Formmain0044ServiceImpl extends BaseService implements IFormmain0044Service { + Logger log = LoggerFactory.getLogger(getClass()); + + private IFormmain0044Dao formmain0044Dao; + + @Autowired + public void setFormmain0044Dao(IFormmain0044Dao dao) { + this.formmain0044Dao = dao; + this.dao = dao; + } + + @DS(value = "#entity.dataSourceCode") + @Override + public List querySeridId(Formmain0044Entity entity) { + List list = formmain0044Dao.query(entity); + return list; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/CapFormDefinitionEntity.java b/service/src/main/java/com/hzya/frame/seeyon/entity/CapFormDefinitionEntity.java new file mode 100644 index 00000000..2ab841bd --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/CapFormDefinitionEntity.java @@ -0,0 +1,71 @@ +package com.hzya.frame.seeyon.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.io.File; + +/** + * + * @content OA字段配置表 + * @className: Administrator + * @author laborer + * @date 2024-09-09 15:48 + * + */ + +public class CapFormDefinitionEntity extends BaseEntity { + private String fieldInfo;//字段属性定义 + private String viewInfo;//视图权限定义 + private String appbindInfo;//应用绑定定义 + private String tableName;//表名 + private String fieldName;//字段名称 + private String fieldValue;//字段值 + + public String getFieldValue() { + return fieldValue; + } + + public void setFieldValue(String fieldValue) { + this.fieldValue = fieldValue; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getFieldInfo() { + return fieldInfo; + } + + public void setFieldInfo(String fieldInfo) { + this.fieldInfo = fieldInfo; + } + + public String getViewInfo() { + return viewInfo; + } + + public void setViewInfo(String viewInfo) { + this.viewInfo = viewInfo; + } + + public String getAppbindInfo() { + return appbindInfo; + } + + public void setAppbindInfo(String appbindInfo) { + this.appbindInfo = appbindInfo; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/CapFormDefinitionEntity.xml b/service/src/main/java/com/hzya/frame/seeyon/entity/CapFormDefinitionEntity.xml new file mode 100644 index 00000000..5c0a498d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/CapFormDefinitionEntity.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + id, + field_info, + view_info, + appbind_info + + + + + + + + + + delete from ${tableName} where ${fieldName} = #{id} + + diff --git a/service/src/main/java/com/hzya/frame/seeyon/receiptFor/dao/IReceiptForDao.java b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/dao/IReceiptForDao.java new file mode 100644 index 00000000..7f6cb7a3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/dao/IReceiptForDao.java @@ -0,0 +1,11 @@ +package com.hzya.frame.seeyon.receiptFor.dao; + +import com.hzya.frame.seeyon.receiptFor.entity.ReceiptForEntity; + +import java.util.List; + +public interface IReceiptForDao{ + public List getOaReceipt(ReceiptForEntity recEntity); + + public int updateState(ReceiptForEntity recEntity); +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/receiptFor/dao/impl/ReceiptForDaoImpl.java b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/dao/impl/ReceiptForDaoImpl.java new file mode 100644 index 00000000..2bdecab3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/dao/impl/ReceiptForDaoImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.seeyon.receiptFor.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.seeyon.receiptFor.dao.IReceiptForDao; +import com.hzya.frame.seeyon.receiptFor.entity.ReceiptForEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("receiptForDao") +public class ReceiptForDaoImpl extends MybatisGenericDao implements IReceiptForDao { + + @DS("#recEntity.dataSourceCode") + @Override + public List getOaReceipt(ReceiptForEntity recEntity){ + return super.selectList(getSqlIdPrifx()+"ReceiptForEntity_list_base",recEntity); + } + + @DS("#recEntity.dataSourceCode") + @Override + public int updateState(ReceiptForEntity recEntity){ + return super.update(getSqlIdPrifx()+"ReceiptForEntity_update_state",recEntity); + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/receiptFor/entity/ReceiptForEntity.java b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/entity/ReceiptForEntity.java new file mode 100644 index 00000000..3205944c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/entity/ReceiptForEntity.java @@ -0,0 +1,293 @@ +package com.hzya.frame.seeyon.receiptFor.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class ReceiptForEntity extends BaseEntity { + + private String djrq;//field0003、单据日期、合同申请日期 + private String dwbm; + private String hbbm;//field0090客商、客商编码、客商档案 + private String lrr; + private String shr; + private String shrq; + private String state; + private String djbh;//field0001、单据号 + + private Long wldx;//field0004、往来对象 + private String deptid;//field0091部门、部门档案、部门编码 + private String ywybm;//field0092业务员、人员档案、业务员编码 + private String bfyhzh;//field0060收款银行账号、客户方账号 + private String skyhmc;//field0062收款银行名称、客户方开户行 + private String dfyhzh;//field0014付款银行账号,我方账号 + private String fkyhmc;//field0051付款银行名称,我方开户行 + + private String bzbm;//field0072币种、默认“CNY”,币种编码 + + private String dfbbje; + private String dfybje; + + private String ddh; + private String bbhl; + private String contractno; + private String djlxbm;//交易类型编码 + private String pj_jsfs;//结算方式编码 + private String scomment;//备注 + private String zyx22;//合同号 + private String zyx24;//合同名称 + private String zyx28;//用途 + private String szxmid;//收支项目 + + public String getSzxmid() { + return szxmid; + } + + public void setSzxmid(String szxmid) { + this.szxmid = szxmid; + } + + public String getZyx28() { + return zyx28; + } + + public void setZyx28(String zyx28) { + this.zyx28 = zyx28; + } + + public String getZyx22() { + return zyx22; + } + + public void setZyx22(String zyx22) { + this.zyx22 = zyx22; + } + + public String getZyx24() { + return zyx24; + } + + public void setZyx24(String zyx24) { + this.zyx24 = zyx24; + } + + public String getScomment() { + return scomment; + } + + public void setScomment(String scomment) { + this.scomment = scomment; + } + + public String getPj_jsfs() { + return pj_jsfs; + } + + public void setPj_jsfs(String pj_jsfs) { + this.pj_jsfs = pj_jsfs; + } + + public String getDjlxbm() { + return djlxbm; + } + + public void setDjlxbm(String djlxbm) { + this.djlxbm = djlxbm; + } + + public String getDfbbje() { + return dfbbje; + } + + public void setDfbbje(String dfbbje) { + this.dfbbje = dfbbje; + } + + public String getDdh() { + return ddh; + } + + public void setDdh(String ddh) { + this.ddh = ddh; + } + + public String getBbhl() { + return bbhl; + } + + public void setBbhl(String bbhl) { + this.bbhl = bbhl; + } + + public String getContractno() { + return contractno; + } + + public void setContractno(String contractno) { + this.contractno = contractno; + } + + private String fph;//field0019发票号 + + private String zy;//field0059摘要 + + private String bzbm_code;//field0073币种编码 + + public String getFph() { + return fph; + } + + public void setFph(String fph) { + this.fph = fph; + } + + public String getZy() { + return zy; + } + + public void setZy(String zy) { + this.zy = zy; + } + + public String getBzbm_code() { + return bzbm_code; + } + + public void setBzbm_code(String bzbm_code) { + this.bzbm_code = bzbm_code; + } + + public String getDjbh() { + return djbh; + } + + public void setDjbh(String djbh) { + this.djbh = djbh; + } + + public Long getWldx() { + return wldx; + } + + public void setWldx(Long wldx) { + this.wldx = wldx; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public String getYwybm() { + return ywybm; + } + + public void setYwybm(String ywybm) { + this.ywybm = ywybm; + } + + public String getBfyhzh() { + return bfyhzh; + } + + public void setBfyhzh(String bfyhzh) { + this.bfyhzh = bfyhzh; + } + + public String getSkyhmc() { + return skyhmc; + } + + public void setSkyhmc(String skyhmc) { + this.skyhmc = skyhmc; + } + + public String getDfyhzh() { + return dfyhzh; + } + + public void setDfyhzh(String dfyhzh) { + this.dfyhzh = dfyhzh; + } + + public String getFkyhmc() { + return fkyhmc; + } + + public void setFkyhmc(String fkyhmc) { + this.fkyhmc = fkyhmc; + } + + public String getBzbm() { + return bzbm; + } + + public void setBzbm(String bzbm) { + this.bzbm = bzbm; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getDfybje() { + return dfybje; + } + + public void setDfybje(String dfybje) { + this.dfybje = dfybje; + } + + public String getDjrq() { + return djrq; + } + + public void setDjrq(String djrq) { + this.djrq = djrq; + } + + public String getDwbm() { + return dwbm; + } + + public void setDwbm(String dwbm) { + this.dwbm = dwbm; + } + + public String getHbbm() { + return hbbm; + } + + public void setHbbm(String hbbm) { + this.hbbm = hbbm; + } + + public String getLrr() { + return lrr; + } + + public void setLrr(String lrr) { + this.lrr = lrr; + } + + public String getShr() { + return shr; + } + + public void setShr(String shr) { + this.shr = shr; + } + + public String getShrq() { + return shrq; + } + + public void setShrq(String shrq) { + this.shrq = shrq; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/receiptFor/entity/ReceiptForEntity.xml b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/entity/ReceiptForEntity.xml new file mode 100644 index 00000000..a13bf8f0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/entity/ReceiptForEntity.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update formmain_0045 set field0089 = #{state} where id = #{id} + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/seeyon/receiptFor/service/IReceiptForService.java b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/service/IReceiptForService.java new file mode 100644 index 00000000..13bfa3a7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/service/IReceiptForService.java @@ -0,0 +1,11 @@ +package com.hzya.frame.seeyon.receiptFor.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.seeyon.receiptFor.entity.ReceiptForEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IReceiptForService extends IBaseService { + + public JsonResultEntity sendReceiptFor(JSONObject requestJson); +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/receiptFor/service/impl/ReceiptForServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/service/impl/ReceiptForServiceImpl.java new file mode 100644 index 00000000..0fad67ad --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/receiptFor/service/impl/ReceiptForServiceImpl.java @@ -0,0 +1,238 @@ +package com.hzya.frame.seeyon.receiptFor.service.impl; + +import cn.hutool.core.util.StrUtil; +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.bip.v3.v2207.util.BipUtil; +import com.hzya.frame.seeyon.receiptFor.dao.IReceiptForDao; +import com.hzya.frame.seeyon.receiptFor.entity.ReceiptForEntity; +import com.hzya.frame.seeyon.receiptFor.service.IReceiptForService; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service("ReceiptForServiceImpl") +public class ReceiptForServiceImpl extends BaseService implements IReceiptForService { + Logger logger = LoggerFactory.getLogger(ReceiptForServiceImpl.class); + @Autowired + private IReceiptForDao receiptForDao; + + @Autowired + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + + @Override + public JsonResultEntity sendReceiptFor(JSONObject requestJson){ + + //获取重推信息id,并记录日志 + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + logger.info("收款单重推解析后:"+requestJsonObj.toString()); + logger.info("收款单重新执行的任务主键:"+interId); + + //更换数据源 + JsonResultEntity resultEntity = new JsonResultEntity(); + ReceiptForEntity entity = new ReceiptForEntity(); + requestJson.put("db_code","djoatest"); + entity.setDataSourceCode(requestJson.getString("db_code")); + + //根据重推信息id,查询该条重推记录信息 + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + entity.setId(rootAppPk); + if(StrUtil.isEmpty(rootAppPk)){ + //entity.setQueryState("查询"); + } + //如果是重推,是否通过entity传入的id,只能查到一条数据。 + //entity.setId("-8845102890648320822"); + List receiptList = receiptForDao.getOaReceipt(entity); + logger.info("收款单查询数据{}",JSONObject.toJSONString(receiptList)); + if(CollectionUtils.isNotEmpty(receiptList)){ + for(ReceiptForEntity rec : receiptList){ + try{ + logger.info("组装数据"); + JSONObject main = bindingAdd(rec); + logger.info("收款认领单推送数据:"+main.toString()); + String result = BipUtil.sendOaToU8c(main.toString(),"8000350034"); + logger.info("收款认领单推送结果:"+result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(rec.getId()); + logDetails.setRootAppBill(rec.getDjbh()); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(rec)); + logDetails.setPluginId("OaReceiptPlugin"); + + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.get("status").equals("success"); + if(flag){ + // 推送成功,更新状态 + rec.setState("Y"); + }else{ + // 推送失败 + rec.setState("N"); + } + rec.setDataSourceCode(requestJson.getString("db_code")); + try{ + if(StrUtil.isEmpty(interId)){ + if(flag){ + //首推成功 + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + //首推失败 + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + if(flag){ + //重推成功 + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + //重推失败,把失败信息,更新到重推表中 + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + }catch (Exception e){ + logger.info("保存日志失败"+e.getMessage()); + receiptForDao.updateState(rec); + e.printStackTrace(); + } + receiptForDao.updateState(rec); +// + } catch (Exception e) { + logger.info("收款单执行失败1"+e); + logger.info("收款单执行失败"+e.getMessage()); + e.printStackTrace(); + } + + } + } + return new JsonResultEntity("成功",true,resultEntity); + } + +// @NotNull +// private JSONObject bindingAdd(ReceiptForEntity rec) { +// String djrq = rec.getDjrq().substring(0,10); +// if(djrq.length()>10){ +// djrq = rec.getDjrq().substring(0,10); +// } +// String shrq = rec.getShrq().substring(0,10); +// if(shrq.length()>10){ +// shrq = rec.getShrq().substring(0,10); +// } +// +// JSONObject childrenJson = new JSONObject(); +// childrenJson.put("dfybje",rec.getDfybje()); +// +// childrenJson.put("dfbbje","24"); +// childrenJson.put("dfybje","12"); +// childrenJson.put("ddh","1231231"); +// childrenJson.put("fph","fph12312"); +// childrenJson.put("zy","zy"); +// childrenJson.put("bzbm_code","CNY"); +// childrenJson.put("bbhl","2"); +// childrenJson.put("contractno","hth123123"); +// +// +// JSONArray childrenArray = new JSONArray(); +// childrenArray.add(childrenJson); +// +// JSONObject parentvo = new JSONObject(); +// parentvo.put("djrq",djrq); +// parentvo.put("dwbm",rec.getDwbm()); +// parentvo.put("hbbm",rec.getHbbm()); +// parentvo.put("lrr",rec.getLrr()); +// parentvo.put("shr",rec.getShr()); +// parentvo.put("shrq",shrq); +// +// JSONObject billvoJson = new JSONObject(); +// billvoJson.put("children",childrenArray); +// billvoJson.put("parentvo",parentvo); +// +// JSONArray billvoArray = new JSONArray(); +// billvoArray.add(billvoJson); +// JSONObject main = new JSONObject(); +// main.put("billvo",billvoArray); +// return main; +// } + + @NotNull + private JSONObject bindingAdd(ReceiptForEntity rec) { +// if(rec.getDjrq()!=null){ +// String djrq = rec.getDjrq().substring(0,10); +// if(djrq.length()>10){ +// djrq = rec.getDjrq().substring(0,10); +// } +// } +// if(rec.getShrq()!=null){ +// String shrq = rec.getShrq().substring(0,10); +// if(shrq.length()>10){ +// shrq = rec.getShrq().substring(0,10); +// } +// } + + JSONObject childrenJson = new JSONObject(); + childrenJson.put("dfybje",rec.getDfybje()); + + //childrenJson.put("dfbbje",rec.getDfbbje()); + childrenJson.put("ddh",rec.getDdh()); + childrenJson.put("fph",rec.getFph()); + childrenJson.put("zy",rec.getZy()); + childrenJson.put("bzbm_code",rec.getBzbm_code()); + childrenJson.put("bbhl",rec.getBbhl()); + childrenJson.put("contractno",rec.getContractno()); + + + JSONArray childrenArray = new JSONArray(); + childrenArray.add(childrenJson); + + JSONObject parentvo = new JSONObject(); + parentvo.put("djrq",rec.getDjrq().substring(0,10)); + parentvo.put("dwbm",rec.getDwbm()); + parentvo.put("hbbm",rec.getHbbm()); + parentvo.put("lrr",rec.getLrr()); + parentvo.put("djlxbm",rec.getDjlxbm());//交易类型编码 + parentvo.put("shr",rec.getShr()); + parentvo.put("shrq",rec.getShrq().substring(0,10)); + + parentvo.put("djbh",rec.getDjbh()); + //parentvo.put("wldx",rec.getWldx()); + parentvo.put("deptid",rec.getDeptid()); + //parentvo.put("ywybm",rec.getYwybm()); + parentvo.put("bfyhzh",rec.getBfyhzh());//本方银行账号 + parentvo.put("skyhmc",rec.getSkyhmc());//收款银行账号 + parentvo.put("pj_jsfs",rec.getPj_jsfs());//结算方式 + parentvo.put("dfyhzh",rec.getDfyhzh());//对方银行账号 + parentvo.put("scomment",rec.getScomment());//备注 + parentvo.put("zyx22",rec.getZyx22());//合同号 + parentvo.put("zyx24",rec.getZyx24());//合同名称 + parentvo.put("zyx28",rec.getZyx28());//用途 + parentvo.put("szxmid",rec.getSzxmid());//收支项目 + parentvo.put("fkyhmc",rec.getFkyhmc()); + parentvo.put("bzbm",rec.getBzbm()); + + JSONObject billvoJson = new JSONObject(); + billvoJson.put("children",childrenArray); + billvoJson.put("parentvo",parentvo); + + JSONArray billvoArray = new JSONArray(); + billvoArray.add(billvoJson); + JSONObject main = new JSONObject(); + main.put("billvo",billvoArray); + return main; + } + +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/INoProcessService.java b/service/src/main/java/com/hzya/frame/seeyon/service/INoProcessService.java new file mode 100644 index 00000000..57e72e80 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/INoProcessService.java @@ -0,0 +1,26 @@ +package com.hzya.frame.seeyon.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * + * @content 无流程表单公用service + * @className: Administrator + * @author laborer + * @date 2024-09-09 14:53 + * + */ +public interface INoProcessService { +/** + * + * @content 无流程删除通用接口 + * @className: Administrator + * @author laborer + * @date 2024-09-09 15:08 + * + */ + + JsonResultEntity DeleteProcessField(JSONObject requestData); +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/ISeeyonExtService.java b/service/src/main/java/com/hzya/frame/seeyon/service/ISeeyonExtService.java index 4f06472d..04a36c07 100644 --- a/service/src/main/java/com/hzya/frame/seeyon/service/ISeeyonExtService.java +++ b/service/src/main/java/com/hzya/frame/seeyon/service/ISeeyonExtService.java @@ -26,4 +26,11 @@ public interface ISeeyonExtService { * @param logEntity */ void ydcSeeyon2u8CallBack(SysMessageManageLogEntity logEntity); + + /** + * 东进 宁波银行交易明细保存到OA底表参数组装 + * @param entity + * @return + */ + SysExtensionApiEntity dongjAccLog(SysExtensionApiEntity entity); } diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/impl/NoProcessServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/service/impl/NoProcessServiceImpl.java new file mode 100644 index 00000000..87ba10be --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/impl/NoProcessServiceImpl.java @@ -0,0 +1,119 @@ +package com.hzya.frame.seeyon.service.impl; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.seeyon.dao.ICapFormDefinitionDao; +import com.hzya.frame.seeyon.entity.CapFormDefinitionEntity; +import com.hzya.frame.seeyon.service.INoProcessService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.checkerframework.checker.units.qual.A; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +/** + * + * @content 无流程表单公用service + * @className: Administrator + * @author laborer + * @date 2024-09-09 14:53 + * + */ + +@Service(value = "NoProcessServiceImpl") +public class NoProcessServiceImpl implements INoProcessService { + private static final Logger logger = LoggerFactory.getLogger(NoProcessServiceImpl.class); + @Autowired + private ICapFormDefinitionDao capFormDefinitionDao; + @Override + public JsonResultEntity DeleteProcessField(JSONObject requestData) { + Listcount =new ArrayList<>(); + JSONObject jsonStrObj = requestData.getJSONObject("jsonStr"); + String formCode = jsonStrObj.getString("formCode"); + String fieldName = jsonStrObj.getString("fieldName"); + String fieldValue = jsonStrObj.getString("fieldValue"); + if(StrUtil.isEmpty(formCode)){ + return new JsonResultEntity("表单编码不能为空:formCode",false); + } + if(StrUtil.isEmpty(fieldName)){ + return new JsonResultEntity("字段名称不能为空:fieldName",false); + } + if(StrUtil.isEmpty(fieldValue)){ + return new JsonResultEntity("字段值不能为空:fieldValue",false); + } + + //通过表单编号获取表单字段信息 + CapFormDefinitionEntity fieldInfo = new CapFormDefinitionEntity(); + fieldInfo.setAppbindInfo(formCode); + fieldInfo.setDataSourceCode("djoatest"); + ListcapFormDefinitionEntityList = capFormDefinitionDao.getFormFiled(fieldInfo); + if(CollectionUtils.isEmpty(capFormDefinitionEntityList)){ + return new JsonResultEntity("通过表单编号查询表单有误,请检查表单编号:"+formCode,false); + } + + try { + capFormDefinitionEntityList.forEach(item->{ + String appbindInfo = item.getAppbindInfo(); + //格式化字段信息 + JSONObject jsonObject = JSONObject.parseObject(appbindInfo); + boolean queryFlag = false; + //如果模版编号相同则继续删除,反正跳过 + if(formCode.equals(jsonObject.getString("formCode"))){ + JSONObject field = JSONObject.parseObject(item.getFieldInfo()); + JSONObject frontFormmain = field.getJSONObject("front_formmain"); + JSONArray formsons = field.getJSONArray("formsons"); + JSONArray fieldInfoTable = frontFormmain.getJSONArray("fieldInfo"); + //验证需要删除的条件字段在表单属性中是否存在 + for (int i = 0; i < fieldInfoTable.size(); i++) { + JSONObject fieldInfoTableObj = fieldInfoTable.getJSONObject(i); + String name = fieldInfoTableObj.getString("name"); + //如果表单属性中存在该字段则验证通过,如果不存在直接返回错误 + if(name.equals(fieldName)){ + queryFlag = true; + + } + } + //验证通过获取数据库表名称进行数据删除 + if(queryFlag){ + String tableName = frontFormmain.getString("tableName"); + //如果主表名称获取主表的主键进行数据删除 + fieldInfo.setTableName(tableName); + fieldInfo.setFieldName(fieldName); + fieldInfo.setFieldValue(fieldValue); + ListdataFormList = capFormDefinitionDao.getFormFiledByFileValue(fieldInfo); + if(CollectionUtils.isNotEmpty(dataFormList)){ + dataFormList.forEach(item1->{ + String id = item1.getId(); + count.add(id); + fieldInfo.setFieldName("id"); + fieldInfo.setId(id); + capFormDefinitionDao.deleteByKey(fieldInfo); + //循环该表单下面的所有子表信息进行子表删除 + if(CollectionUtils.isNotEmpty(formsons)){ + formsons.forEach(formsonsItem->{ + JSONObject jsonObjectBoddy = JSONObject.parseObject(formsonsItem.toString()); + String bodyTableName = jsonObjectBoddy.getString("tableName"); + fieldInfo.setTableName(bodyTableName); + fieldInfo.setFieldName("formmain_id"); + fieldInfo.setId(id); + capFormDefinitionDao.deleteByKey(fieldInfo); + }); + } + }); + } + } + } + }); + } catch (Exception e) { + throw new RuntimeException(e); + } + return new JsonResultEntity("删除成功,删除的数据ID"+ JSON.toJSONString(count),true); + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/impl/SeeyonExtServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/service/impl/SeeyonExtServiceImpl.java index 677a14a2..9ba4a642 100644 --- a/service/src/main/java/com/hzya/frame/seeyon/service/impl/SeeyonExtServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/seeyon/service/impl/SeeyonExtServiceImpl.java @@ -5,8 +5,10 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes; import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity; import com.hzya.frame.seeyon.service.ISeeyonExtService; +import com.hzya.frame.seeyon.util.RestUtil; import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; @@ -14,6 +16,7 @@ import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity; import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogStatusEnum; import com.hzya.frame.u8.util.U8Util; import com.hzya.frame.uuid.UUIDLong; +import org.apache.commons.collections.CollectionUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +24,7 @@ import org.springframework.stereotype.Service; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -36,6 +40,8 @@ public class SeeyonExtServiceImpl implements ISeeyonExtService { @Autowired private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Autowired + private RestUtil restUtil; /** * 英德赛 OA档案传U8 @@ -150,6 +156,20 @@ public class SeeyonExtServiceImpl implements ISeeyonExtService { } } + /** + * 东进 宁波银行交易明细保存到OA底表参数组装 + * + * @param entity + * @return + */ + @Override + public SysExtensionApiEntity dongjAccLog(SysExtensionApiEntity entity) { + String token = restUtil.getToken("", "8000340000"); + Map headers = entity.getHeaders(); + headers.put("token",token); + return entity; + } + //存货参数组装 private SysExtensionApiEntity getInventory(JSONObject businessData,SysExtensionApiEntity param){ if (null != businessData){ diff --git a/service/src/main/java/com/hzya/frame/seeyon/util/RestUtil.java b/service/src/main/java/com/hzya/frame/seeyon/util/RestUtil.java index 2259638a..a74908a1 100644 --- a/service/src/main/java/com/hzya/frame/seeyon/util/RestUtil.java +++ b/service/src/main/java/com/hzya/frame/seeyon/util/RestUtil.java @@ -206,4 +206,57 @@ public class RestUtil { } return null; } + public static String sendU8CToOA(String parm, String apiCode,String userCode){ + String baseUrl = "http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface"; + //获取OAtoken + logger.info("推送参数"+parm); + JSONObject tokenObj = new JSONObject(); + tokenObj.put("password","2cdd6cfc-5b87-47d1-aaea-756a55f6b5a6"); + tokenObj.put("userName","restUser"); + tokenObj.put("loginName",userCode); + tokenObj.put("loginName","yuqh"); + String token = getOaTokenForEsb(tokenObj.toString(),""); + if(StrUtil.isNotEmpty(token)){ + tokenObj = JSON.parseObject(token); + token = tokenObj.getString("id"); + } + + String result = HttpRequest.post(baseUrl) + .header("appId", "800034")//头信息,多个头信息多次调用此方法即可 + .header("apiCode", apiCode)//头信息,多个头信息多次调用此方法即可 + .header("token", token)//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYA0iD/DtdYCBYE1AqHlz4All0gLb96p8G1xNjdGz4tDZlCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "nL860JIPqIuB0jUsJE5RZLcyZfi8ArRSz6rk0h69TDbkf3Qq0Jstwk9FIgbGa6ejj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(parm)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + logger.info("返回参数"+parm); + if(StrUtil.isNotEmpty(result)){ + return analytic(result); + } + return null; + } + + public static String getOaTokenForEsb(String parm, String apiCode){ + String baseUrl = "http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface"; + System.out.println("推送参数"+parm); + String result = HttpRequest.post(baseUrl) + .header("appId", "800034")//头信息,多个头信息多次调用此方法即可 + .header("apiCode", "8000340000")//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYA0iD/DtdYCBYE1AqHlz4All0gLb96p8G1xNjdGz4tDZlCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "nL860JIPqIuB0jUsJE5RZLcyZfi8ArRSz6rk0h69TDbkf3Qq0Jstwk9FIgbGa6ejj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(parm)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + System.out.println("返回参数"+result); + if(StrUtil.isNotEmpty(result)){ + return analytic(result); + } + return null; + } + + public static String analytic(String parm){ + JSONObject main = JSON.parseObject(parm); + return main.getString("attribute"); + } } diff --git a/service/src/main/java/com/hzya/frame/sys/file/upload/service/impl/FileUploadServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/file/upload/service/impl/FileUploadServiceImpl.java index 5869b34a..071fa4e2 100644 --- a/service/src/main/java/com/hzya/frame/sys/file/upload/service/impl/FileUploadServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sys/file/upload/service/impl/FileUploadServiceImpl.java @@ -40,7 +40,7 @@ import java.util.zip.ZipFile; */ @Service(value = "sys_fileUploadService") public class FileUploadServiceImpl extends BaseService implements IFileUploadService { - @Value("${savefile.path}") + @Value("${savefile.path:}") public String DSK; @Value("${savefile.pluginpath:}") diff --git a/service/src/main/java/com/hzya/frame/sys/template/entity/TemplateMapper.xml b/service/src/main/java/com/hzya/frame/sys/template/entity/TemplateMapper.xml index ea3115a2..2b07793f 100644 --- a/service/src/main/java/com/hzya/frame/sys/template/entity/TemplateMapper.xml +++ b/service/src/main/java/com/hzya/frame/sys/template/entity/TemplateMapper.xml @@ -79,7 +79,7 @@ FROM information_schema.TABLES WHERE - TABLE_SCHEMA = 'businesscenter' + TABLE_SCHEMA = 'businesscenter_kjs' and TABLE_NAME = #{tableName} 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 c468ffe1..25ec9090 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 @@ -3,6 +3,7 @@ package com.hzya.frame.sysnew.application.service; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity; import com.hzya.frame.web.entity.JsonResultEntity; import javax.servlet.ServletRequest; @@ -308,6 +309,8 @@ public interface ISysApplicationService extends IBaseService oldheaderMap = new HashMap<>(); + Iterator it = headerObject.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = (Map.Entry) it.next(); + oldheaderMap.put(entry.getKey(), entry.getValue()); + } + + String oldId = resendLogEntity.getId(); + String oldbodys = bodyObject.toString(); + String oldquerys = ""; + //应用key + String publicKey = headerObject.getString("publickey"); + //应用密钥 + String secretKey = headerObject.getString("secretkey"); + //appId + String appId = headerObject.getString("appid"); + //apiCode + String apiCode = headerObject.getString("apicode"); + String ip = headerObject.getString("x-real-ip"); + 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())) { + return BaseResult.getFailureMessageEntity(sendApp.getName() + "应用未启用,请联系管理员"); + } + + SysApplicationEntity receiveApp = getAppByAppId(appId); + if (receiveApp == null) { + return BaseResult.getFailureMessageEntity("根据appId:" + appId + "未匹配到应用,请联系管理员"); + } + //判断应用是否启用 + if (receiveApp.getAppStatus() == null || !"1".equals(receiveApp.getAppStatus())) { + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用未启用,请联系管理员"); + } + //判断应用接口是否启用 + if (receiveApp.getInterfaceStatus() == null || !"1".equals(receiveApp.getInterfaceStatus())) { + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用接口环境未启用,请联系管理员"); + } + + SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode); + if (receiveApi == null) { + return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建"); + } + + SysApplicationApiAuthEntity sysApplicationApiAuthEntity = getApiAuthByNameAppId(sendApp.getId(), receiveApp.getId()); + if (sysApplicationApiAuthEntity == null) { + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用权限配置错误"); + } + if (sysApplicationApiAuthEntity.getSystemAddress() != null && !"".equals(sysApplicationApiAuthEntity.getSystemAddress()) + && !sysApplicationApiAuthEntity.getSystemAddress().contains(ip)) { + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误"); + } + + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = getApiAuthDetailByAppIdApiIdTripartiteSystemId(receiveApp.getId(), receiveApi.getId(), sysApplicationApiAuthEntity.getId()); + if (sysApplicationApiAuthDetailEntity == null) { + 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结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + break; + } catch (Exception e) { + logger.error("invokeException{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("内部方法执行错误,请联系管理员"); + } + } + } + } + + } + headers = sysExtensionApiEntity.getHeaders(); + String querys = sysExtensionApiEntity.getQuerys(); + String bodys = sysExtensionApiEntity.getBodys(); + //设置参数获取参数 + 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)); + } + } + 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(resultToStr(entity)); + } + 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("保存日志开始"); + //重写saveLog方法,利用他原有逻辑判断重推结果,根据重推结果,设置该条日志的状态 + SysMessageManageLogEntity sysMessageManageLogEntity = updateLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headers, headers, oldquerys,querys, body.toString(),true,null,oldId); + 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.getSuccessMessageEntity("重推失败", jsonObject); + } + } else { + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("重推成功", body); + }else { + return BaseResult.getSuccessMessageEntity("重推失败", body); + } + } + } else { + return BaseResult.getSuccessMessageEntity("重推失败", 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 = updateLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headers, headers, oldquerys,querys, body.toString(), true,null,oldId); + 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.getSuccessMessageEntity("重推失败", jsonObject); + } + } else { + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("重推成功", body); + }else { + return BaseResult.getSuccessMessageEntity("重推失败", body); + } + } + } else { + return BaseResult.getSuccessMessageEntity("重推失败", body); + } + } + } + private SysApplicationApiAuthDetailEntity getApiAuthDetailByAppIdApiIdTripartiteSystemId(String appId, String apiId, String tripartiteSystemId) { String str = "appId" + appId + "apiId" + apiId + "tripartiteSystemId" + tripartiteSystemId; Object o = applicationCache.get("4", str); @@ -2273,6 +2663,176 @@ public class SysApplicationServiceImpl extends BaseService doEsbTask(sysMessageManageLogEntity)); + SysPushMessageEntity sysPushMessageEntity = new SysPushMessageEntity(); + sysPushMessageEntity.setSendAppName(sendApp.getName()); + sysPushMessageEntity.setReceiveAppName(receiveApp.getName()); + sysPushMessageEntity.setReceiveApiName(receiveApi.getApiName()); + sysPushMessageEntity.setReceiveApiCode(receiveApi.getApiCode()); + sysPushMessageEntity.setReturnData(sysMessageManageLogEntity.getReturnData()); + sysPushMessageEntity.setStatus(sysMessageManageLogEntity.getStatus()); + //taskExecutor.execute(() -> sendMssage(sysPushMessageEntity)); + return sysMessageManageLogEntity; + } + + private void sendMssage(SysPushMessageEntity sysPushMessageEntity) { + sysSendMessageLogService.sendMessage(sysPushMessageEntity); + } + + private SysMessageManageLogEntity updateLog(SysApplicationEntity sendApp, SysApplicationEntity receiveApp, SysApplicationApiEntity receiveApi, + String oldbodys,String bodys, + Map oldheaderMap,Map headerMap, + Map headers, + String oldquerys, String querys, + String body, boolean flag,String msg,String oldId) { + SysMessageManageLogEntity sysMessageManageLogEntity = new SysMessageManageLogEntity(); + //messageManageId 消息主表主键 + //theme 消息主题 + //messageCode 消息编码 + //sendApp + sysMessageManageLogEntity.setSendApp(sendApp.getId());//发送者应用 + //sendApi 发送者 + sysMessageManageLogEntity.setReceiveCode(receiveApi.getApiCode() != null ? receiveApi.getApiCode().toString() : null);//接收者编码 + sysMessageManageLogEntity.setReceiveApp(receiveApp.getId());//接收者应用 + sysMessageManageLogEntity.setReceiveApi(receiveApi.getId());//接收者 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("body", oldbodys); + jsonObject.put("header", oldheaderMap); + jsonObject.put("querys", oldquerys); + sysMessageManageLogEntity.setSourceData(jsonObject.toString());//源数据 + JSONObject send = new JSONObject(); + send.put("body", bodys); + send.put("header", headers); + send.put("querys", querys); + sysMessageManageLogEntity.setTargetData(send.toString());//目标data + if(receiveApp.getAppType() != null && "4".equals(receiveApp.getAppType())){//宁波银行 + JSONObject jsonObject1 = JSONObject.parseObject(body); + String retCode = jsonObject1.getString("retCode"); + if(retCode != null && "0000".equals(retCode)){ + JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("data")); + String fileBytes = jsonObject2.getString("fileBytes"); + if(fileBytes != null && !"".equals(fileBytes)){ + jsonObject2.put("fileBytes",""); + jsonObject1.put("data",jsonObject2); + sysMessageManageLogEntity.setReturnData(jsonObject1.toJSONString());//返回信息 + }else { + sysMessageManageLogEntity.setReturnData(body);//返回信息 + } + }else { + sysMessageManageLogEntity.setReturnData(body);//返回信息 + } + }else { + sysMessageManageLogEntity.setReturnData(body);//返回信息 + } + + + //校验返回 + if (!flag) { + sysMessageManageLogEntity.setStatus("4");//返回信息 + sysMessageManageLogEntity.setRemark(msg);//返回信息 + } else { + if (receiveApi.getReturnSuccessField() != null && !"".equals(receiveApi.getReturnSuccessField()) + && receiveApi.getReturnSuccessValue() != null && !"".equals(receiveApi.getReturnSuccessValue())) { + if (JSONUtil.isTypeJSON(body)) { + JSONObject cheackdatas = JSONObject.parseObject(body); + JSONObject datas = JSONObject.parseObject(body); + String checkdata = cheackdatas.getString(receiveApi.getReturnSuccessField()); + if (checkdata != null && receiveApi.getReturnSuccessValue().equals(checkdata)) { + sysMessageManageLogEntity.setStatus("3");//返回信息 + if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) { + String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg()); + sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息 + } else { + sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息 + } + }else if(receiveApi.getReturnSuccessValue().equals("not null") && checkdata != null){ + sysMessageManageLogEntity.setStatus("3");//返回信息 + if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) { + String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg()); + sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息 + } else { + sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息 + } + }else { + String fieldname = receiveApi.getReturnSuccessField(); + if(fieldname.contains(".")){ + String[] fileds = fieldname.split("\\."); + boolean flags = false; + for (int i = 0; i < fileds.length; i++) { + if (JSONUtil.isTypeJSON(datas.getString(fileds[i]))) { + datas = datas.getJSONObject(fileds[i]); + if(fileds.length-2 == i ){ + String a = datas.getString(fileds[i+1]); + if (a != null && receiveApi.getReturnSuccessValue().equals(a)) { + flags = true; + break; + }else if(receiveApi.getReturnSuccessValue().equals("not null") && a != null){ + flags = true; + break; + }else { + break; + } + } + } + } + if(flags){ + sysMessageManageLogEntity.setStatus("3");//返回信息 + if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) { + String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg()); + sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息 + } else { + sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息 + } + }else { + sysMessageManageLogEntity.setStatus("4");//返回信息 + if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) { + String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg()); + sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误,返回信息如下:" + returnMsg);//返回信息 + } else { + sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误");//返回信息 + } + } + + }else { + sysMessageManageLogEntity.setStatus("4");//返回信息 + if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) { + String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg()); + sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误,返回信息如下:" + returnMsg);//返回信息 + } else { + sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误");//返回信息 + } + } + } + } else { + sysMessageManageLogEntity.setStatus("4");//返回信息 + sysMessageManageLogEntity.setRemark("接口调用失败,返回格式错误,不是JSON");//返回信息 + } + } else { + sysMessageManageLogEntity.setStatus("4");//返回信息 + if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) { + if (JSONUtil.isTypeJSON(body)) { + JSONObject cheackdatas = JSONObject.parseObject(body); + String checkdata = cheackdatas.getString(receiveApi.getReturnMsg()); + sysMessageManageLogEntity.setRemark("接口调用失败,api返回信息字段未配置,返回信息如下:" + checkdata);//返回信息 + } else { + sysMessageManageLogEntity.setRemark("接口调用失败,返回格式错误,不是JSON");//返回信息 + } + } else { + sysMessageManageLogEntity.setRemark("接口调用失败");//返回信息 + } + } + } + //remark 备注 + sysMessageManageLogEntity.setErrorStatus("2");//返回信息 + sysMessageManageLogEntity.setId(oldId); + sysMessageManageLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + sysMessageManageLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + //sysMessageManageLogEntity.setCreate_time(new Date()); + sysMessageManageLogEntity.setModify_time(new Date()); + sysMessageManageLogEntity.setSts("Y"); + taskExecutor.execute(() -> doEsbTaskNew(sysMessageManageLogEntity)); + + + return sysMessageManageLogEntity; } @@ -2285,6 +2845,10 @@ public class SysApplicationServiceImpl extends BaseService sysOrganEntities = sysOrganDao.queryUserCompany(sysOrganEntity); //返回值 JSONObject res = new JSONObject(); - res.put("token", token); + res.put("zt-token", token); res.put("userInfo", sysUserEntity); res.put("company", sysOrganEntities); diff --git a/service/src/main/java/com/hzya/frame/sysnew/message/dao/ISysMessageDao.java b/service/src/main/java/com/hzya/frame/sysnew/message/dao/ISysMessageDao.java new file mode 100644 index 00000000..94aed6d7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/message/dao/ISysMessageDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sysnew.message.dao; + +import com.hzya.frame.sysnew.message.entity.SysMessageEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * (sys_message: table)表数据库访问层 + * + * @author makejava + * @since 2024-08-30 14:17:11 + */ +public interface ISysMessageDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/message/dao/impl/SysMessageDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/message/dao/impl/SysMessageDaoImpl.java new file mode 100644 index 00000000..7734cd43 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/message/dao/impl/SysMessageDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sysnew.message.dao.impl; + +import com.hzya.frame.sysnew.message.entity.SysMessageEntity; +import com.hzya.frame.sysnew.message.dao.ISysMessageDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * (SysMessage)表数据库访问层 + * + * @author makejava + * @since 2024-08-30 14:17:11 + */ +@Repository(value = "SysMessageDaoImpl") +public class SysMessageDaoImpl extends MybatisGenericDao implements ISysMessageDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/message/entity/SysMessageEntity.java b/service/src/main/java/com/hzya/frame/sysnew/message/entity/SysMessageEntity.java new file mode 100644 index 00000000..a5488938 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/message/entity/SysMessageEntity.java @@ -0,0 +1,136 @@ +package com.hzya.frame.sysnew.message.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * (SysMessage)实体类 + * + * @author makejava + * @since 2024-08-30 14:17:11 + */ +public class SysMessageEntity extends BaseEntity { + + /** 公司id */ + private String companyId; + /** 调用单据类型 */ + private Integer billKindId; + /** 来源业务单据id */ + private String billId; + /** 模版id */ + private String templateId; + /** 1文本消息 2 卡片消息 */ + private String messageType; + /** 消息标题 */ + private String title; + /** 消息内容 */ + private String content; + /** 消息操作区域 */ + private String btns; + /** 发送时间 */ + private Date pushTime; + /** 发送者 */ + private String sendPersonId; + /** 接受者 */ + private String sendToPersonId; + /** 状态 */ + private Integer state; + + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public Integer getBillKindId() { + return billKindId; + } + + public void setBillKindId(Integer billKindId) { + this.billKindId = billKindId; + } + + public String getBillId() { + return billId; + } + + public void setBillId(String billId) { + this.billId = billId; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public String getMessageType() { + return messageType; + } + + public void setMessageType(String messageType) { + this.messageType = messageType; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getBtns() { + return btns; + } + + public void setBtns(String btns) { + this.btns = btns; + } + + public Date getPushTime() { + return pushTime; + } + + public void setPushTime(Date pushTime) { + this.pushTime = pushTime; + } + + public String getSendPersonId() { + return sendPersonId; + } + + public void setSendPersonId(String sendPersonId) { + this.sendPersonId = sendPersonId; + } + + public String getSendToPersonId() { + return sendToPersonId; + } + + public void setSendToPersonId(String sendToPersonId) { + this.sendToPersonId = sendToPersonId; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/message/entity/SysMessageEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/message/entity/SysMessageEntity.xml new file mode 100644 index 00000000..080729bf --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/message/entity/SysMessageEntity.xml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + ,bill_kind_id + ,bill_id + ,template_id + ,message_type + ,title + ,content + ,btns + ,push_time + ,send_person_id + ,send_to_person_id + ,state + + + + + + + + + + + + + + + + + + + insert into sys_message( + + id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + bill_kind_id , + bill_id , + template_id , + message_type , + title , + content , + btns , + push_time , + send_person_id , + send_to_person_id , + state , + sts, + + )values( + + #{id} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{billKindId} , + #{billId} , + #{templateId} , + #{messageType} , + #{title} , + #{content} , + #{btns} , + #{pushTime} , + #{sendPersonId} , + #{sendToPersonId} , + #{state} , + 'Y', + + ) + + + + insert into sys_message(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, bill_id, template_id, message_type, title, content, btns, push_time, send_person_id, send_to_person_id, state, sts) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.billId},#{entity.templateId},#{entity.messageType},#{entity.title},#{entity.content},#{entity.btns},#{entity.pushTime},#{entity.sendPersonId},#{entity.sendToPersonId},#{entity.state}, 'Y') + + + + + insert into sys_message(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, bill_id, template_id, message_type, title, content, btns, push_time, send_person_id, send_to_person_id, state) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.billId},#{entity.templateId},#{entity.messageType},#{entity.title},#{entity.content},#{entity.btns},#{entity.pushTime},#{entity.sendPersonId},#{entity.sendToPersonId},#{entity.state}) + + on duplicate key update + 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), + bill_kind_id = values(bill_kind_id), + bill_id = values(bill_id), + template_id = values(template_id), + message_type = values(message_type), + title = values(title), + content = values(content), + btns = values(btns), + push_time = values(push_time), + send_person_id = values(send_person_id), + send_to_person_id = values(send_to_person_id), + state = values(state) + + +update sys_message set + + 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}, + bill_kind_id = #{billKindId}, + bill_id = #{billId}, + template_id = #{templateId}, + message_type = #{messageType}, + title = #{title}, + content = #{content}, + btns = #{btns}, + push_time = #{pushTime}, + send_person_id = #{sendPersonId}, + send_to_person_id = #{sendToPersonId}, + state = #{state}, + +where id = #{id} + + + +update sys_message set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_message set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and bill_kind_id = #{billKindId} + and bill_id = #{billId} + and template_id = #{templateId} + and message_type = #{messageType} + and title = #{title} + and content = #{content} + and btns = #{btns} + and push_time = #{pushTime} + and send_person_id = #{sendPersonId} + and send_to_person_id = #{sendToPersonId} + and state = #{state} + and sts='Y' + + + + + delete from sys_message where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/message/service/ISysMessageService.java b/service/src/main/java/com/hzya/frame/sysnew/message/service/ISysMessageService.java new file mode 100644 index 00000000..e3e2e2a2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/message/service/ISysMessageService.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sysnew.message.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.message.entity.SysMessageEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * (SysMessage)表服务接口 + * + * @author makejava + * @since 2024-08-30 14:17:11 + */ +public interface ISysMessageService extends IBaseService{ + JsonResultEntity queryEntityPage(JSONObject jsonObject); + + JsonResultEntity queryEntity(JSONObject jsonObject); + + JsonResultEntity saveEntity(JSONObject jsonObject); + + JsonResultEntity getEntity(JSONObject jsonObject); + + JsonResultEntity updateEntity(JSONObject jsonObject); + + JsonResultEntity deleteEntity(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/message/service/impl/SysMessageServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/message/service/impl/SysMessageServiceImpl.java new file mode 100644 index 00000000..0421079b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/message/service/impl/SysMessageServiceImpl.java @@ -0,0 +1,112 @@ +package com.hzya.frame.sysnew.message.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.sysnew.message.entity.SysMessageEntity; +import com.hzya.frame.sysnew.message.dao.ISysMessageDao; +import com.hzya.frame.sysnew.message.service.ISysMessageService; +import com.hzya.frame.sysnew.organ.entity.SysOrganEntity; +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 java.util.List; + +/** + * (SysMessage)表服务实现类 + * + * @author makejava + * @since 2024-08-30 14:17:11 + */ +@Service(value = "sysMessageService") +public class SysMessageServiceImpl extends BaseService implements ISysMessageService { + + private ISysMessageDao sysMessageDao; + + @Autowired + public void setSysMessageDao(ISysMessageDao dao) { + this.sysMessageDao = dao; + this.dao = dao; + } + + @Override + public JsonResultEntity queryEntityPage(JSONObject jsonObject){ + SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class); + if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){ + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = sysMessageDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo<>(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject){ + SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class); + if(entity == null){ + entity = new SysMessageEntity(); + } + List list = sysMessageDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } + + @Override + public JsonResultEntity getEntity(JSONObject jsonObject){ + SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = sysMessageDao.get(entity.getId()); + if(entity == null){ + return BaseResult.getFailureMessageEntity("获取站内消息失败"); + } + return BaseResult.getSuccessMessageEntity("获取站内消息成功", entity); + } + + @Override + public JsonResultEntity saveEntity(JSONObject jsonObject) { + SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + entity.setCreate(); + //保存 + sysMessageDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存消息成功", entity); + } + + @Override + public JsonResultEntity updateEntity(JSONObject jsonObject) { + SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + sysMessageDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改站内消息成功", entity); + } + + @Override + public JsonResultEntity deleteEntity(JSONObject jsonObject) { + SysMessageEntity entity = getData("jsonStr", jsonObject, SysMessageEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + sysMessageDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除站内消息成功"); + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.java b/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.java index c6218dc0..03936860 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.java @@ -1,5 +1,6 @@ package com.hzya.frame.sysnew.messageManageLog.entity; +import com.alibaba.fastjson.JSONObject; import com.hzya.frame.web.entity.BaseEntity; import java.util.Date; @@ -46,6 +47,7 @@ public class SysMessageManageLogEntity extends BaseEntity { private Date createTimeStart; private Date createTimeEnd; private List ids; + public String getReturnType() { return returnType; } @@ -196,5 +198,6 @@ public class SysMessageManageLogEntity extends BaseEntity { public void setCreateTimeEnd(Date createTimeEnd) { this.createTimeEnd = createTimeEnd; } + } diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/dao/ISysMessageTemplateDao.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/dao/ISysMessageTemplateDao.java new file mode 100644 index 00000000..a7a29b66 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/dao/ISysMessageTemplateDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sysnew.messageTemplate.dao; + +import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * (sys_message_template: table)表数据库访问层 + * + * @author makejava + * @since 2024-08-30 14:21:15 + */ +public interface ISysMessageTemplateDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/dao/impl/SysMessageTemplateDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/dao/impl/SysMessageTemplateDaoImpl.java new file mode 100644 index 00000000..10890a7a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/dao/impl/SysMessageTemplateDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sysnew.messageTemplate.dao.impl; + +import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity; +import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * (SysMessageTemplate)表数据库访问层 + * + * @author makejava + * @since 2024-08-30 14:21:15 + */ +@Repository(value = "SysMessageTemplateDaoImpl") +public class SysMessageTemplateDaoImpl extends MybatisGenericDao implements ISysMessageTemplateDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java new file mode 100644 index 00000000..5cda5ede --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.java @@ -0,0 +1,136 @@ +package com.hzya.frame.sysnew.messageTemplate.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * (SysMessageTemplate)实体类 + * + * @author makejava + * @since 2024-08-30 14:21:15 + */ +public class SysMessageTemplateEntity extends BaseEntity { + + /** 公司id */ + private String companyId; + /** 调用单据类型 */ + private String billKindId; + /** 模版类型 */ + private String templateType; + /** 模版名称 */ + private String templateName; + /** 消息标题 */ + private String messageTitle; + /** 消息内容 */ + private String messageContents; + /** 消息操作区域 */ + private String btns; + /** 数据源 */ + private String dataSource; + /** 创建时间 */ + private Date createDate; + /** 创建人 */ + private String createPersonId; + /** 状态 */ + private String state; + /** 删除标志 */ + private Integer isdelete; + + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getBillKindId() { + return billKindId; + } + + public void setBillKindId(String billKindId) { + this.billKindId = billKindId; + } + + public String getTemplateType() { + return templateType; + } + + public void setTemplateType(String templateType) { + this.templateType = templateType; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getMessageTitle() { + return messageTitle; + } + + public void setMessageTitle(String messageTitle) { + this.messageTitle = messageTitle; + } + + public String getMessageContents() { + return messageContents; + } + + public void setMessageContents(String messageContents) { + this.messageContents = messageContents; + } + + public String getBtns() { + return btns; + } + + public void setBtns(String btns) { + this.btns = btns; + } + + public String getDataSource() { + return dataSource; + } + + public void setDataSource(String dataSource) { + this.dataSource = dataSource; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public String getCreatePersonId() { + return createPersonId; + } + + public void setCreatePersonId(String createPersonId) { + this.createPersonId = createPersonId; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Integer getIsdelete() { + return isdelete; + } + + public void setIsdelete(Integer isdelete) { + this.isdelete = isdelete; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml new file mode 100644 index 00000000..80002b16 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/entity/SysMessageTemplateEntity.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + ,bill_kind_id + ,template_type + ,template_name + ,message_title + ,message_contents + ,btns + ,data_source + ,create_date + ,create_person_id + ,state + ,isdelete + + + + + + + + + + + + + + + + + + + + insert into sys_message_template( + + id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + bill_kind_id , + template_type , + template_name , + message_title , + message_contents , + btns , + data_source , + create_date , + create_person_id , + state , + isdelete , + sts, + + )values( + + #{id} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{billKindId} , + #{templateType} , + #{templateName} , + #{messageTitle} , + #{messageContents} , + #{btns} , + #{dataSource} , + #{createDate} , + #{createPersonId} , + #{state} , + #{isdelete} , + 'Y', + + ) + + + + insert into sys_message_template(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, template_type, template_name, message_title, message_contents, btns, data_source, create_date, create_person_id, state, isdelete, sts) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.templateType},#{entity.templateName},#{entity.messageTitle},#{entity.messageContents},#{entity.btns},#{entity.dataSource},#{entity.createDate},#{entity.createPersonId},#{entity.state},#{entity.isdelete}, 'Y') + + + + + insert into sys_message_template(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_kind_id, template_type, template_name, message_title, message_contents, btns, data_source, create_date, create_person_id, state, isdelete) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billKindId},#{entity.templateType},#{entity.templateName},#{entity.messageTitle},#{entity.messageContents},#{entity.btns},#{entity.dataSource},#{entity.createDate},#{entity.createPersonId},#{entity.state},#{entity.isdelete}) + + on duplicate key update + 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), + bill_kind_id = values(bill_kind_id), + template_type = values(template_type), + template_name = values(template_name), + message_title = values(message_title), + message_contents = values(message_contents), + btns = values(btns), + data_source = values(data_source), + create_date = values(create_date), + create_person_id = values(create_person_id), + state = values(state), + isdelete = values(isdelete) + + +update sys_message_template set + + 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}, + bill_kind_id = #{billKindId}, + template_type = #{templateType}, + template_name = #{templateName}, + message_title = #{messageTitle}, + message_contents = #{messageContents}, + btns = #{btns}, + data_source = #{dataSource}, + create_date = #{createDate}, + create_person_id = #{createPersonId}, + state = #{state}, + isdelete = #{isdelete}, + +where id = #{id} + + + +update sys_message_template set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_message_template set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and bill_kind_id = #{billKindId} + and template_type = #{templateType} + and template_name = #{templateName} + and message_title = #{messageTitle} + and message_contents = #{messageContents} + and btns = #{btns} + and data_source = #{dataSource} + and create_date = #{createDate} + and create_person_id = #{createPersonId} + and state = #{state} + and isdelete = #{isdelete} + and sts='Y' + + + + + delete from sys_message_template where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/ISysMessageTemplateService.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/ISysMessageTemplateService.java new file mode 100644 index 00000000..bb553613 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/ISysMessageTemplateService.java @@ -0,0 +1,36 @@ +package com.hzya.frame.sysnew.messageTemplate.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.ibatis.annotations.Select; + +import java.sql.SQLException; + +/** + * (SysMessageTemplate)表服务接口 + * + * @author makejava + * @since 2024-08-30 14:21:15 + */ +public interface ISysMessageTemplateService extends IBaseService{ + JsonResultEntity queryEntityPage(JSONObject jsonObject); + + JsonResultEntity queryEntity(JSONObject jsonObject); + + JsonResultEntity saveEntity(JSONObject jsonObject); + + JsonResultEntity getEntity(JSONObject jsonObject); + + JsonResultEntity updateEntity(JSONObject jsonObject); + + JsonResultEntity deleteEntity(JSONObject jsonObject); + + JsonResultEntity enableDisableEntity(JSONObject jsonObject); + + JsonResultEntity checkSql(JSONObject jsonObject)throws Exception; + + JsonResultEntity spliceMessage(JSONObject jsonObject); + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java new file mode 100644 index 00000000..7f4db12a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/messageTemplate/service/impl/SysMessageTemplateServiceImpl.java @@ -0,0 +1,205 @@ +package com.hzya.frame.sysnew.messageTemplate.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.execsql.service.IExecSqlService; +import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity; +import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao; +import com.hzya.frame.sysnew.messageTemplate.service.ISysMessageTemplateService; +import com.hzya.frame.sysnew.person.dao.ISysPersonDao; +import com.hzya.frame.sysnew.user.entity.SysUserEntity; +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 java.sql.*; +import java.util.HashMap; +import java.util.List; + +/** + * (SysMessageTemplate)表服务实现类 + * + * @author makejava + * @since 2024-08-30 14:21:15 + */ +@Service(value = "sysMessageTemplateService") +public class SysMessageTemplateServiceImpl extends BaseService implements ISysMessageTemplateService { + + private ISysMessageTemplateDao sysMessageTemplateDao; + + @Resource + public IExecSqlService execSqlService; + + @Autowired + public void setSysMessageTemplateDao(ISysMessageTemplateDao dao) { + this.sysMessageTemplateDao = dao; + this.dao = dao; + } + + @Override + public JsonResultEntity queryEntityPage(JSONObject jsonObject) { + SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = sysMessageTemplateDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject){ + SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class); + if(entity == null){ + entity = new SysMessageTemplateEntity(); + } + List list = sysMessageTemplateDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } + + @Override + public JsonResultEntity getEntity(JSONObject jsonObject){ + SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = sysMessageTemplateDao.get(entity.getId()); + if(entity == null){ + return BaseResult.getFailureMessageEntity("获取消息模版失败"); + } + return BaseResult.getSuccessMessageEntity("获取消息模版成功", entity); + } + + @Override + public JsonResultEntity saveEntity(JSONObject jsonObject){ + SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getBillKindId() == null || "".equals(entity.getBillKindId())){ + return BaseResult.getFailureMessageEntity("调用单据类型不允许为空"); + } + if(entity.getTemplateType() == null || "".equals(entity.getTemplateType())){ + return BaseResult.getFailureMessageEntity("模版类型不允许为空"); + } + if(entity.getTemplateName() == null || "".equals(entity.getTemplateName())){ + return BaseResult.getFailureMessageEntity("模版名称不允许为空"); + } + if(entity.getMessageContents() == null || "".equals(entity.getMessageContents())){ + return BaseResult.getFailureMessageEntity("消息内容不允许为空"); + } + if(entity.getDataSource() == null || "".equals(entity.getDataSource())){ + return BaseResult.getFailureMessageEntity("数据源不允许为空"); + } + if(entity.getCreateDate() == null){ + return BaseResult.getFailureMessageEntity("创建时间不允许为空"); + } + if(entity.getCreatePersonId() == null || "".equals(entity.getCreatePersonId())){ + return BaseResult.getFailureMessageEntity("创建人不允许为空"); + } + entity.setCreate(); + sysMessageTemplateDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存消息模版成功",entity); + } + + @Override + public JsonResultEntity updateEntity(JSONObject jsonObject){ + SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if(entity.getBillKindId() == null || "".equals(entity.getBillKindId())){ + return BaseResult.getFailureMessageEntity("调用单据类型不允许为空"); + } + if(entity.getTemplateType() == null || "".equals(entity.getTemplateType())){ + return BaseResult.getFailureMessageEntity("模版类型不允许为空"); + } + if(entity.getTemplateName() == null || "".equals(entity.getTemplateName())){ + return BaseResult.getFailureMessageEntity("模版名称不允许为空"); + } + if(entity.getMessageContents() == null || "".equals(entity.getMessageContents())){ + return BaseResult.getFailureMessageEntity("消息内容不允许为空"); + } + if(entity.getDataSource() == null || "".equals(entity.getDataSource())){ + return BaseResult.getFailureMessageEntity("数据源不允许为空"); + } + if(entity.getCreateDate() == null){ + return BaseResult.getFailureMessageEntity("创建时间不允许为空"); + } + if(entity.getCreatePersonId() == null || "".equals(entity.getCreatePersonId())){ + return BaseResult.getFailureMessageEntity("创建人不允许为空"); + } + entity.setUpdate(); + sysMessageTemplateDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改消息模版成功",entity); + } + + @Override + public JsonResultEntity deleteEntity(JSONObject jsonObject){ + SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + //1、判断这个模版有没有被使用过,使用过就不能删除(待完成) + //将模版id去,预警配置表里查一下,如果有匹配的数据,代表有人正在使用,不能删除 + sysMessageTemplateDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除消息模版成功"); + } + + @Override + public JsonResultEntity enableDisableEntity(JSONObject jsonObject){ + SysMessageTemplateEntity entity = getData("jsonStr", jsonObject, SysMessageTemplateEntity.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("系统错误"); + } + //0启用,1禁用 + if("0".equals(entity.getState())){ + entity.setUpdate(); + sysMessageTemplateDao.update(entity); + return BaseResult.getSuccessMessageEntity("启用模版成功"); + }else{ + //停用消息模版 + entity.setUpdate(); + sysMessageTemplateDao.update(entity); + return BaseResult.getSuccessMessageEntity("停用模版成功"); + } + } + + @Override + public JsonResultEntity checkSql(JSONObject jsonObject) throws Exception { + try { + String sql = JSONObject.parseObject(jsonObject.getString("jsonStr")).getString("sql"); + List> result = execSqlService.execSelectSql(sql, "master"); + return BaseResult.getSuccessMessageEntity("SQL检查成功", result); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("SQL检查失败,原因:" + e.getMessage()); + } + } + + @Override + public JsonResultEntity spliceMessage(JSONObject jsonObject){ + return BaseResult.getSuccessMessageEntity("消息拼接成功"); + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/dao/ISysPushMessageDao.java b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/dao/ISysPushMessageDao.java new file mode 100644 index 00000000..7c9c4303 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/dao/ISysPushMessageDao.java @@ -0,0 +1,7 @@ +package com.hzya.frame.sysnew.pushMessage.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity; + +public interface ISysPushMessageDao extends IBaseDao{ +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/dao/impl/SysPushMessageDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/dao/impl/SysPushMessageDaoImpl.java new file mode 100644 index 00000000..3ede38a6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/dao/impl/SysPushMessageDaoImpl.java @@ -0,0 +1,10 @@ +package com.hzya.frame.sysnew.pushMessage.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sysnew.pushMessage.dao.ISysPushMessageDao; +import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity; +import org.springframework.stereotype.Repository; + +@Repository("sysPushMessageDaoImpl") +public class SysPushMessageDaoImpl extends MybatisGenericDao implements ISysPushMessageDao { +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java new file mode 100644 index 00000000..94eeb61f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.java @@ -0,0 +1,117 @@ +package com.hzya.frame.sysnew.pushMessage.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class SysPushMessageEntity extends BaseEntity { + /** 推送方式 “一次”、“定时” */ + private String pushMethod; + /** 预警应用编码 */ + private Long warningAppCode; + /** 预警接口编码 */ + private Long warningApiCode; + /** 接收者ID列表*/ + private String recipientIdList; + /** 预警应用类型 */ + private String warningAppType; + /** 发送应用名称 */ + private String sendAppName; + /** 接收应用名称 */ + private String receiveAppName; + /** 接收接口名称 */ + private String receiveApiName; + /** 返回信息 */ + private String returnData; + /** 接收接口编码 */ + private Long receiveApiCode; + /** 状态(1、待发送2、发送中3、发送成功4、发送失败) */ + private String status; + + public String getPushMethod() { + return pushMethod; + } + + public void setPushMethod(String pushMethod) { + this.pushMethod = pushMethod; + } + + + public Long getWarningAppCode() { + return warningAppCode; + } + + public void setWarningAppCode(Long warningAppCode) { + this.warningAppCode = warningAppCode; + } + + public Long getWarningApiCode() { + return warningApiCode; + } + + public void setWarningApiCode(Long warningApiCode) { + this.warningApiCode = warningApiCode; + } + + public Long getReceiveApiCode() { + return receiveApiCode; + } + + public void setReceiveApiCode(Long receiveApiCode) { + this.receiveApiCode = receiveApiCode; + } + + public String getRecipientIdList() { + return recipientIdList; + } + + public void setRecipientIdList(String recipientIdList) { + this.recipientIdList = recipientIdList; + } + + public String getWarningAppType() { + return warningAppType; + } + + public void setWarningAppType(String warningAppType) { + this.warningAppType = warningAppType; + } + + public String getSendAppName() { + return sendAppName; + } + + public void setSendAppName(String sendAppName) { + this.sendAppName = sendAppName; + } + + public String getReceiveAppName() { + return receiveAppName; + } + + public void setReceiveAppName(String receiveAppName) { + this.receiveAppName = receiveAppName; + } + + public String getReceiveApiName() { + return receiveApiName; + } + + public void setReceiveApiName(String receiveApiName) { + this.receiveApiName = receiveApiName; + } + + public String getReturnData() { + return returnData; + } + + public void setReturnData(String returnData) { + this.returnData = returnData; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml new file mode 100644 index 00000000..0916a33a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/entity/SysPushMessageEntity.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/ISysPushMessageService.java b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/ISysPushMessageService.java new file mode 100644 index 00000000..67f4583b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/ISysPushMessageService.java @@ -0,0 +1,10 @@ +package com.hzya.frame.sysnew.pushMessage.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface ISysPushMessageService extends IBaseService{ + JsonResultEntity queryEntity(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java new file mode 100644 index 00000000..28a7028d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/pushMessage/service/impl/SysPushMessageServiceImpl.java @@ -0,0 +1,33 @@ +package com.hzya.frame.sysnew.pushMessage.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.sysnew.pushMessage.dao.ISysPushMessageDao; +import com.hzya.frame.sysnew.pushMessage.dao.impl.SysPushMessageDaoImpl; +import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity; +import com.hzya.frame.sysnew.pushMessage.service.ISysPushMessageService; +import com.hzya.frame.sysnew.sendMessageLog.dao.ISysSendMessageLogDao; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("sysPushMessageService") +public class SysPushMessageServiceImpl extends BaseService implements ISysPushMessageService { + + private ISysPushMessageDao sysPushMessageDao; + + @Autowired + public void setSysPushMessageDao(ISysPushMessageDao dao) { + this.sysPushMessageDao = dao; + this.dao = dao; + } + + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject){ + List list = sysPushMessageDao.getAll(); + return BaseResult.getSuccessMessageEntity("success"); + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/dao/ISysSendMessageLogDao.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/dao/ISysSendMessageLogDao.java new file mode 100644 index 00000000..5359eede --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/dao/ISysSendMessageLogDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sysnew.sendMessageLog.dao; + +import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * (sys_send_message_log: table)表数据库访问层 + * + * @author makejava + * @since 2024-08-30 14:19:30 + */ +public interface ISysSendMessageLogDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/dao/impl/SysSendMessageLogDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/dao/impl/SysSendMessageLogDaoImpl.java new file mode 100644 index 00000000..7593f996 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/dao/impl/SysSendMessageLogDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sysnew.sendMessageLog.dao.impl; + +import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity; +import com.hzya.frame.sysnew.sendMessageLog.dao.ISysSendMessageLogDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * (SysSendMessageLog)表数据库访问层 + * + * @author makejava + * @since 2024-08-30 14:19:30 + */ +@Repository(value = "SysSendMessageLogDaoImpl") +public class SysSendMessageLogDaoImpl extends MybatisGenericDao implements ISysSendMessageLogDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java new file mode 100644 index 00000000..6e88baf2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.java @@ -0,0 +1,126 @@ +package com.hzya.frame.sysnew.sendMessageLog.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * (SysSendMessageLog)实体类 + * + * @author makejava + * @since 2024-08-30 14:19:30 + */ +public class SysSendMessageLogEntity extends BaseEntity { + + /** 公司id */ + private String companyId; + /** 来源业务单据 */ + private String billId; + /** 消息类型(1、系统消息、2、单据消息、3、钉钉、4微信、5短信、6、邮件) */ + private String type; + /** 发送给谁(三方系统userID 钉钉微信、邮箱、手机号) */ + private String sendToUserId; + /** 发送给系统内部人员ID */ + private String sendToPersonId; + /** 消息内容 */ + private String sendCount; + /** 发送时间 */ + private Date sendDatetime; + /** 发送人Id */ + private String sendPersonId; + /** 消息发送来源模块 */ + private String sourceModelName; + /** 消息状态(0未读1已读) */ + private Integer state; + /** 三方系统消息结果 */ + private String resultMessage; + + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getBillId() { + return billId; + } + + public void setBillId(String billId) { + this.billId = billId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getSendToUserId() { + return sendToUserId; + } + + public void setSendToUserId(String sendToUserId) { + this.sendToUserId = sendToUserId; + } + + public String getSendToPersonId() { + return sendToPersonId; + } + + public void setSendToPersonId(String sendToPersonId) { + this.sendToPersonId = sendToPersonId; + } + + public String getSendCount() { + return sendCount; + } + + public void setSendCount(String sendCount) { + this.sendCount = sendCount; + } + + public Date getSendDatetime() { + return sendDatetime; + } + + public void setSendDatetime(Date sendDatetime) { + this.sendDatetime = sendDatetime; + } + + public String getSendPersonId() { + return sendPersonId; + } + + public void setSendPersonId(String sendPersonId) { + this.sendPersonId = sendPersonId; + } + + public String getSourceModelName() { + return sourceModelName; + } + + public void setSourceModelName(String sourceModelName) { + this.sourceModelName = sourceModelName; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public String getResultMessage() { + return resultMessage; + } + + public void setResultMessage(String resultMessage) { + this.resultMessage = resultMessage; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml new file mode 100644 index 00000000..144a67e7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/entity/SysSendMessageLogEntity.xml @@ -0,0 +1,353 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + ,bill_id + ,type + ,send_to_user_id + ,send_to_person_id + ,send_count + ,send_datetime + ,send_person_id + ,source_model_name + ,state + ,result_message + + + + + + + + + + + + + + + + + + + insert into sys_send_message_log( + + id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + bill_id , + type , + send_to_user_id , + send_to_person_id , + send_count , + send_datetime , + send_person_id , + source_model_name , + state , + result_message , + sts, + + )values( + + #{id} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{billId} , + #{type} , + #{sendToUserId} , + #{sendToPersonId} , + #{sendCount} , + #{sendDatetime} , + #{sendPersonId} , + #{sourceModelName} , + #{state} , + #{resultMessage} , + 'Y', + + ) + + + + insert into sys_send_message_log(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_id, type, send_to_user_id, send_to_person_id, send_count, send_datetime, send_person_id, source_model_name, state, result_message, sts) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billId},#{entity.type},#{entity.sendToUserId},#{entity.sendToPersonId},#{entity.sendCount},#{entity.sendDatetime},#{entity.sendPersonId},#{entity.sourceModelName},#{entity.state},#{entity.resultMessage}, 'Y') + + + + + insert into sys_send_message_log(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bill_id, type, send_to_user_id, send_to_person_id, send_count, send_datetime, send_person_id, source_model_name, state, result_message) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.billId},#{entity.type},#{entity.sendToUserId},#{entity.sendToPersonId},#{entity.sendCount},#{entity.sendDatetime},#{entity.sendPersonId},#{entity.sourceModelName},#{entity.state},#{entity.resultMessage}) + + on duplicate key update + 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), + bill_id = values(bill_id), + type = values(type), + send_to_user_id = values(send_to_user_id), + send_to_person_id = values(send_to_person_id), + send_count = values(send_count), + send_datetime = values(send_datetime), + send_person_id = values(send_person_id), + source_model_name = values(source_model_name), + state = values(state), + result_message = values(result_message) + + +update sys_send_message_log set + + 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}, + bill_id = #{billId}, + type = #{type}, + send_to_user_id = #{sendToUserId}, + send_to_person_id = #{sendToPersonId}, + send_count = #{sendCount}, + send_datetime = #{sendDatetime}, + send_person_id = #{sendPersonId}, + source_model_name = #{sourceModelName}, + state = #{state}, + result_message = #{resultMessage}, + +where id = #{id} + + + +update sys_send_message_log set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_send_message_log set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and bill_id = #{billId} + and type = #{type} + and send_to_user_id = #{sendToUserId} + and send_to_person_id = #{sendToPersonId} + and send_count = #{sendCount} + and send_datetime = #{sendDatetime} + and send_person_id = #{sendPersonId} + and source_model_name = #{sourceModelName} + and state = #{state} + and result_message = #{resultMessage} + and sts='Y' + + + + + delete from sys_send_message_log where id = #{id} + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java new file mode 100644 index 00000000..929a22b3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/ISysSendMessageLogService.java @@ -0,0 +1,34 @@ +package com.hzya.frame.sysnew.sendMessageLog.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity; +import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * (SysSendMessageLog)表服务接口 + * + * @author makejava + * @since 2024-08-30 14:19:30 + */ +public interface ISysSendMessageLogService extends IBaseService{ + + + JsonResultEntity queryEntityPage(JSONObject jsonObject); + + JsonResultEntity queryEntity(JSONObject jsonObject); + + JsonResultEntity getEntity(JSONObject jsonObject); + + JsonResultEntity saveEntity(JSONObject jsonObject); + + JsonResultEntity updateEntity(JSONObject jsonObject); + + JsonResultEntity deleteEntity(JSONObject jsonObject); + + boolean sendMessage(SysPushMessageEntity entity); + + + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java new file mode 100644 index 00000000..2ff4f682 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/sendMessageLog/service/impl/SysSendMessageLogServiceImpl.java @@ -0,0 +1,410 @@ +package com.hzya.frame.sysnew.sendMessageLog.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao; +import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sysnew.application.apiPara.dao.ISysApplicationApiParaDao; +import com.hzya.frame.sysnew.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.sysnew.messageTemplate.dao.ISysMessageTemplateDao; +import com.hzya.frame.sysnew.messageTemplate.entity.SysMessageTemplateEntity; +import com.hzya.frame.sysnew.pushMessage.entity.SysPushMessageEntity; +import com.hzya.frame.sysnew.sendMessageLog.entity.SysSendMessageLogEntity; +import com.hzya.frame.sysnew.sendMessageLog.dao.ISysSendMessageLogDao; +import com.hzya.frame.sysnew.sendMessageLog.service.ISysSendMessageLogService; +import com.hzya.frame.sysnew.user.dao.ISysUserDao; +import com.hzya.frame.sysnew.user.entity.SysUserEntity; +import com.hzya.frame.sysnew.warningConfig.dao.ISysWarningConfigDao; +import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity; +import com.hzya.frame.sysnew.warningInterface.dao.ISysWarningInterfaceDao; +import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity; +import com.hzya.frame.uuid.UUIDUtils; +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 java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * (SysSendMessageLog)表服务实现类 + * + * @author makejava + * @since 2024-08-30 14:19:30 + */ +@Service(value = "sysSendMessageLogService") +public class SysSendMessageLogServiceImpl extends BaseService implements ISysSendMessageLogService { + + @Resource + private ISysWarningInterfaceDao sysWarningInterfaceDao; + @Resource + private ISysWarningConfigDao sysWarningConfigDao; + @Resource + private ISysMessageTemplateDao sysMessageTemplateDao; + @Resource + private ISysUserDao sysUserDao; + @Resource + private ISysApplicationApiDao sysApplicationApiDao; + @Resource + private ISysApplicationApiParaDao sysApplicationApiParaDao; + + private ISysSendMessageLogDao sysSendMessageLogDao; + + @Autowired + public void setSysSendMessageLogDao(ISysSendMessageLogDao dao) { + this.sysSendMessageLogDao = dao; + this.dao = dao; + } + + @Override + public JsonResultEntity queryEntityPage(JSONObject jsonObject) { + SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class); + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = sysSendMessageLogDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject) { + SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class); + if (entity == null) { + entity = new SysSendMessageLogEntity(); + } + List list = sysSendMessageLogDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } + + @Override + public JsonResultEntity getEntity(JSONObject jsonObject) { + SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不能为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = sysSendMessageLogDao.get(entity.getId()); + if (entity == null) { + return BaseResult.getFailureMessageEntity("获取发送消息日志失败"); + } + return BaseResult.getSuccessMessageEntity("获取发送消息日志成功", entity); + } + + @Override + public JsonResultEntity saveEntity(JSONObject jsonObject) { + SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不能为空"); + } + if (entity.getBillId() == null || "".equals(entity.getBillId())) { + return BaseResult.getFailureMessageEntity("来源业务单据不能为空"); + } + entity.setCreate(); + sysSendMessageLogDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存发送消息日志成功", entity); + } + + @Override + public JsonResultEntity updateEntity(JSONObject jsonObject){ + SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不能为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getBillId() == null || "".equals(entity.getBillId())) { + return BaseResult.getFailureMessageEntity("来源业务单据不能为空"); + } + entity.setUpdate(); + sysSendMessageLogDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改发送消息日志成功", entity); + } + + @Override + public JsonResultEntity deleteEntity(JSONObject jsonObject){ + SysSendMessageLogEntity entity = getData("jsonStr", jsonObject, SysSendMessageLogEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不能为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate();; + sysSendMessageLogDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除发送消息日志成功", entity); + } + + + /** + * sendMessage方法:根据请求错误消息,组装成消息模版,推送到三方业务系统 + * 1、先获取接口调用的日志数据 + * 2、如果日志状态为失败,且该接口预警状态为启用,则进行消息推送 + * 3、根据预警配置,找到消息模版,并生成消息内容 + * 4、根据预警配置,找到预警应用,并推送消息 + * 5、保存消息推送日志 + * */ + @Override + public boolean sendMessage(SysPushMessageEntity entity){ + String status = entity.getStatus(); + Long receiveApiCode = entity.getReceiveApiCode(); + String sendAppName = entity.getSendAppName(); + String receiveApiName = entity.getReceiveApiName(); + String recieveAppName = entity.getReceiveAppName(); + String returnData = entity.getReturnData(); + String warningAppType = entity.getWarningAppType(); + Long warningAppCode = entity.getWarningAppCode(); + Long warningApiCode = entity.getWarningApiCode(); + String sendMsgContent = ""; + + SysWarningInterfaceEntity interfaceEntity = new SysWarningInterfaceEntity(); + SysWarningConfigEntity configEntity = new SysWarningConfigEntity(); + SysMessageTemplateEntity templateEntity = new SysMessageTemplateEntity(); + SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity(); + + interfaceEntity.setApiCode(receiveApiCode); + + if(status == null){ + logger.error("日志状态为空"); + return false; + } + //只有发送失败的日志才会推送消息,成功的日志不推送消息 + if ("4".equals(status)) { + interfaceEntity = sysWarningInterfaceDao.queryOne(interfaceEntity); + if(interfaceEntity == null){ + logger.error("未找到API接口预警信息"); + return false; + } + //只有预警接口状态为启用,才会进行消息推送 + if(interfaceEntity.getStatus() == null || interfaceEntity.getStatus().equals("1") == false){ + logger.error("API接口未启用推送"); + return false; + } + //根据主表id,找到主表记录中的消息模版id + String warningConfigId = interfaceEntity.getWarningConfigId(); + if(warningConfigId == null || "".equals(warningConfigId)){ + logger.error("未找到该接口预警配置信息的主表id"); + return false; + } + configEntity = sysWarningConfigDao.get(warningConfigId); + if(configEntity == null){ + logger.error("未找到该接口预警配置信息"); + return false; + } + String messageTemplateId = configEntity.getMessageTemplateId(); + if(messageTemplateId == null || "".equals(messageTemplateId)){ + logger.error("未找到该接口预警配置信息的消息模版id"); + return false; + } + templateEntity = sysMessageTemplateDao.get(messageTemplateId); + if(templateEntity == null){ + logger.error("未找到该接口预警配置信息的消息模版信息"); + return false; + } + + String messageContent = templateEntity.getMessageContents(); + if(messageContent == null || "".equals(messageContent)){ + logger.error("未找到该接口预警配置信息的消息模版内容"); + return false; + } + //推送消息内容拼接 + sendMsgContent = messageContent.replace("${reciecveAppName}",recieveAppName); + sendMsgContent = sendMsgContent.replace("${sendAppName}",sendAppName); + sendMsgContent = sendMsgContent.replace("${receiveApiName}",receiveApiName); + sendMsgContent = sendMsgContent.replace("${returnData}",returnData); + //消息模版名称 + String templateName = templateEntity.getTemplateName(); + String type = ""; + String bodyParams = ""; + String warningAppId = configEntity.getWarningAppId(); + + //查询预警人员id列表 + String recipientIdList = configEntity.getRecipientId(); + //根据预警人员id列表,获取预警应用人员id列表 + String warningAppReceiverIdList = getWarningAppReceiverIdList(warningAppType,recipientIdList); + + switch (warningAppType){ + case "6WX": + //调用微信推送消息 + break; + case "5DD": + //消息类型:3表示钉钉 + type = "3"; + //获取钉钉发送消息时使用的微应用的AgentID + sysApplicationApiParaEntity.setAppId(warningAppId); + sysApplicationApiParaEntity.setInterfaceKey("agentId"); + String agentId = sysApplicationApiParaDao.queryOne(sysApplicationApiParaEntity).getInterfaceValue(); + //拼接调用钉钉接口的body参数 + bodyParams = splicingDDBody(sendMsgContent,agentId,warningAppReceiverIdList).toString(); + break; + default: + logger.error("未找到该应用类型"); + break; + } + String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"). + header("appId",warningAppCode.toString()). + header("apiCode",warningApiCode.toString()). + header("publicKey","ZJYA7v6DubGMm8EdBPGo+Jj9wCpUeCGJEpfBRLiInq4dvDlCe7eDIk+3zDUT+v578prj"). + header("secretKey","bsAMm6tvJs/BV1SO/9ZzjlW+OQaK0mwyv6rLvktyNy/OdltLuG2zze9bT7ttfAA9j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="). + body(bodyParams). + execute(). + body(); + JSONObject resultJson = JSONObject.parseObject(result); + String body = resultJson.getString("attribute"); + + SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity(); + sysApplicationApiEntity.setApiCode(warningApiCode); + SysApplicationApiEntity warningApiEntity = sysApplicationApiDao.queryOne(sysApplicationApiEntity); + + //根据预警接口编码,以及返回数据,判断消息推送是否成功 + if(warningApiEntity.getReturnSuccessField() != null && !"".equals(warningApiEntity.getReturnSuccessField()) + && warningApiEntity.getReturnSuccessValue() != null && !"".equals(warningApiEntity.getReturnSuccessValue())){ + //先判断返回值是否为JSON格式 + if (JSONUtil.isTypeJSON(body)){ + JSONObject cheackdatas = JSONObject.parseObject(body); + JSONObject datas = JSONObject.parseObject(body); + String checkdata = cheackdatas.getString(warningApiEntity.getReturnSuccessField()); + //判断返回值是否为预警接口预期的返回值(1、返回值匹配2、返回值配置的就是not null3、返回值带.) + if (checkdata != null && warningApiEntity.getReturnSuccessValue().equals(checkdata)) { + logger.info("推送消息成功,开始保存日志"); + }else if(warningApiEntity.getReturnSuccessValue().equals("not null") && checkdata != null){ + logger.info("推送消息成功,开始保存日志"); + }else { + String fieldname = warningApiEntity.getReturnSuccessField(); + if(fieldname.contains(".")){ + String[] fileds = fieldname.split("\\."); + boolean flags = false; + for (int i = 0; i < fileds.length; i++) { + if (JSONUtil.isTypeJSON(datas.getString(fileds[i]))) { + datas = datas.getJSONObject(fileds[i]); + if(fileds.length-2 == i ){ + String a = datas.getString(fileds[i+1]); + if (a != null && warningApiEntity.getReturnSuccessValue().equals(a)) { + flags = true; + break; + }else if(warningApiEntity.getReturnSuccessValue().equals("not null") && a != null){ + flags = true; + break; + }else { + break; + } + } + } + } + if(flags){ + logger.info("推送消息成功,开始保存日志"); + }else { + logger.error("推送消息失败,返回值错误"); + } + + }else { + logger.error("推送消息失败,返回值错误"); + } + } + }else{ + logger.error("接口调用失败,返回格式错误,不是JSON"); + } + }else{ + logger.error("api返回信息字段未配置,开始保存日志"); + } + saveLog(sendMsgContent,type,resultJson.toString(),templateName,recipientIdList,warningAppReceiverIdList); + logger.info("保存日志成功"); + }else{ + logger.error("日志状态为成功,不需要推送消息"); + return false; + } + return true; + } + + + /**保存推送消息日志时,需要循环预警应用人员id列表*/ + public void saveLog(String sendMsgContent,String type,String resultMessage,String templateName,String recipientIdList,String warningAppReceiverIdList){ + SysSendMessageLogEntity logEntity = new SysSendMessageLogEntity(); + logEntity.setSendCount(sendMsgContent); + logEntity.setType(type); + logEntity.setBillId("test1411"); + logEntity.setSendDatetime(new Date()); + + logEntity.setSts("Y"); + logEntity.setCreate_user_id("1"); + logEntity.setModify_user_id("1"); + logEntity.setCreate_time(new Date()); + logEntity.setModify_time(new Date()); + logEntity.setOrg_id("0"); + logEntity.setCompanyId("0"); + + logEntity.setSendPersonId("1"); + logEntity.setResultMessage(resultMessage); + logEntity.setSourceModelName(templateName); + + String[] personIdList = warningAppReceiverIdList.split(","); + String[] userIdList = recipientIdList.split(","); + + for(int i=0;i sysUserList = new ArrayList<>(); + for(String userId : userIdArray){ + sysUserList.add(sysUserDao.get(userId)); + } + switch (warningAppType){ + case "6WX": + //获取微信预警人员id列表 + break; + case "5DD": + //获取钉钉预警人员id列表 + for(SysUserEntity sysUser : sysUserList){ + if(sysUser.getDdUserId()!= null && !"".equals(sysUser.getDdUserId())){ + if(!warningAppReceiverIdList.isEmpty()){ + warningAppReceiverIdList += ","; + } + warningAppReceiverIdList += sysUser.getDdUserId(); + } + } + break; + default: + logger.error("未找到该应用类型"); + break; + } + return warningAppReceiverIdList; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java index c552e1d2..8358eb94 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java @@ -82,6 +82,26 @@ public class SysUserEntity extends BaseEntity { */ private String mobilePhone; + private String ddUserId; + + private String wxUserId; + + public String getDdUserId() { + return ddUserId; + } + + public void setDdUserId(String ddUserId) { + this.ddUserId = ddUserId; + } + + public String getWxUserId() { + return wxUserId; + } + + public void setWxUserId(String wxUserId) { + this.wxUserId = wxUserId; + } + public String getPersonId() { return personId; } diff --git a/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.xml index 90a643c0..82c6d1ed 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.xml @@ -24,6 +24,8 @@ + + @@ -44,7 +46,9 @@ ,modify_time ,sts ,org_id - ,company_id + ,company_id + ,dd_user_id + ,wx_user_id + select + + from sys_warning_config where id = #{ id } and sts='Y' + + + + + + + + + + + + + + + + insert into sys_warning_config( + + id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + message_template_id , + app_id , + warning_app_id , + accept_message_api_code , + remark , + status , + recipient_id , + sts, + + )values( + + #{id} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{messageTemplateId} , + #{appId} , + #{warningAppId} , + #{acceptMessageApiCode} , + #{remark} , + #{status} , + #{recipientId} , + 'Y', + + ) + + + + insert into sys_warning_config(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, message_template_id, app_id, warning_app_id, accept_message_api_code, remark, status, recipient_id, sts) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.messageTemplateId},#{entity.appId},#{entity.warningAppId},#{entity.acceptMessageApiCode},#{entity.remark},#{entity.status},#{entity.recipientId}, 'Y') + + + + + insert into sys_warning_config(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, message_template_id, app_id, warning_app_id, accept_message_api_code, remark, status, recipient_id) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.messageTemplateId},#{entity.appId},#{entity.warningAppId},#{entity.acceptMessageApiCode},#{entity.remark},#{entity.status},#{entity.recipientId}) + + on duplicate key update + 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), + message_template_id = values(message_template_id), + app_id = values(app_id), + warning_app_id = values(warning_app_id), + accept_message_api_code = values(accept_message_api_code), + remark = values(remark), + status = values(status), + recipient_id = values(recipient_id) + + +update sys_warning_config set + + 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}, + message_template_id = #{messageTemplateId}, + app_id = #{appId}, + warning_app_id = #{warningAppId}, + accept_message_api_code = #{acceptMessageApiCode}, + remark = #{remark}, + status = #{status}, + recipient_id = #{recipientId}, + +where id = #{id} + + + +update sys_warning_config set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_warning_config set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and message_template_id = #{messageTemplateId} + and app_id = #{appId} + and warning_app_id = #{warningAppId} + and accept_message_api_code = #{acceptMessageApiCode} + and remark = #{remark} + and status = #{status} + and recipient_id = #{recipientId} + and sts='Y' + + + + + delete from sys_warning_config where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/ISysWarningConfigService.java b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/ISysWarningConfigService.java new file mode 100644 index 00000000..618a0524 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/ISysWarningConfigService.java @@ -0,0 +1,29 @@ +package com.hzya.frame.sysnew.warningConfig.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * 预警配置表(SysWarningConfig)表服务接口 + * + * @author makejava + * @since 2024-09-03 09:28:23 + */ +public interface ISysWarningConfigService extends IBaseService{ + + JsonResultEntity queryEntityPage(JSONObject jsonObject); + + JsonResultEntity queryEntity(JSONObject jsonObject); + + JsonResultEntity saveEntity(JSONObject jsonObject); + + JsonResultEntity getEntity(JSONObject jsonObject); + + JsonResultEntity updateEntity(JSONObject jsonObject); + + JsonResultEntity deleteEntity(JSONObject jsonObject); + + JsonResultEntity enableDisableEntity(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java new file mode 100644 index 00000000..7634e93f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningConfig/service/impl/SysWarningConfigServiceImpl.java @@ -0,0 +1,167 @@ +package com.hzya.frame.sysnew.warningConfig.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity; +import com.hzya.frame.sysnew.warningConfig.dao.ISysWarningConfigDao; +import com.hzya.frame.sysnew.warningConfig.service.ISysWarningConfigService; +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 java.util.List; + +/** + * 预警配置表(SysWarningConfig)表服务实现类 + * + * @author makejava + * @since 2024-09-03 09:28:23 + */ +@Service(value = "sysWarningConfigService") +public class SysWarningConfigServiceImpl extends BaseService implements ISysWarningConfigService { + + private ISysWarningConfigDao sysWarningConfigDao; + + @Autowired + public void setSysWarningConfigDao(ISysWarningConfigDao dao) { + this.sysWarningConfigDao = dao; + this.dao = dao; + } + + @Override + public JsonResultEntity queryEntityPage(JSONObject jsonObject){ + SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class); + if(entity == null || entity.getPageSize() == null || entity.getPageNum() == null){ + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = sysWarningConfigDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功",pageInfo); + } + + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject){ + SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class); + if(entity == null){ + entity = new SysWarningConfigEntity(); + } + List list = sysWarningConfigDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功",list); + } + + @Override + public JsonResultEntity getEntity(JSONObject jsonObject){ + SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = sysWarningConfigDao.get(entity.getId()); + if(entity == null){ + return BaseResult.getFailureMessageEntity("获取预警配置失败"); + } + return BaseResult.getSuccessMessageEntity("获取预警配置成功",entity); + } + + @Override + public JsonResultEntity saveEntity(JSONObject jsonObject){ + SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getMessageTemplateId() == null || "".equals(entity.getMessageTemplateId())){ + return BaseResult.getFailureMessageEntity("消息模版不允许为空"); + } + if(entity.getAppId() == null || "".equals(entity.getAppId())){ + return BaseResult.getFailureMessageEntity("应用ID不允许为空"); + } + if(entity.getWarningAppId() == null || "".equals(entity.getWarningAppId())){ + return BaseResult.getFailureMessageEntity("预警应用类型不允许为空"); + } + if(entity.getStatus() == null || "".equals(entity.getStatus())){ + return BaseResult.getFailureMessageEntity("状态不允许为空"); + } + if(entity.getRecipientId() == null || "".equals(entity.getRecipientId())){ + return BaseResult.getFailureMessageEntity("接收者ID不允许为空"); + } + entity.setCreate(); + sysWarningConfigDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存预警配置成功",entity); + } + + @Override + public JsonResultEntity updateEntity(JSONObject jsonObject){ + SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if(entity.getMessageTemplateId() == null || "".equals(entity.getMessageTemplateId())){ + return BaseResult.getFailureMessageEntity("消息模版不允许为空"); + } + if(entity.getAppId() == null || "".equals(entity.getAppId())){ + return BaseResult.getFailureMessageEntity("应用ID不允许为空"); + } + if(entity.getWarningAppId() == null || "".equals(entity.getWarningAppId())){ + return BaseResult.getFailureMessageEntity("预警应用类型不允许为空"); + } + if(entity.getStatus() == null || "".equals(entity.getStatus())){ + return BaseResult.getFailureMessageEntity("状态不允许为空"); + } + if(entity.getRecipientId() == null || "".equals(entity.getRecipientId())){ + return BaseResult.getFailureMessageEntity("接收者ID不允许为空"); + } + entity.setUpdate(); + sysWarningConfigDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改预警配置成功",entity); + } + + @Override + public JsonResultEntity deleteEntity(JSONObject jsonObject) { + SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + sysWarningConfigDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除预警配置成功"); + } + + @Override + public JsonResultEntity enableDisableEntity(JSONObject jsonObject){ + SysWarningConfigEntity entity = getData("jsonStr", jsonObject, SysWarningConfigEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getStatus() == null || "".equals(entity.getStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //0启用,1禁用 + if("0".equals(entity.getStatus())){ + entity.setUpdate(); + sysWarningConfigDao.update(entity); + return BaseResult.getSuccessMessageEntity("启用模版成功"); + }else{ + //停用消息模版 + entity.setUpdate(); + sysWarningConfigDao.update(entity); + return BaseResult.getSuccessMessageEntity("停用模版成功"); + } + } + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java new file mode 100644 index 00000000..544241f6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/ISysWarningInterfaceDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sysnew.warningInterface.dao; + +import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 预警接口表(sys_warning_interface: table)表数据库访问层 + * + * @author makejava + * @since 2024-09-03 10:06:18 + */ +public interface ISysWarningInterfaceDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java new file mode 100644 index 00000000..655eb183 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/dao/impl/SysWarningInterfaceDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sysnew.warningInterface.dao.impl; + +import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity; +import com.hzya.frame.sysnew.warningInterface.dao.ISysWarningInterfaceDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 预警接口表(SysWarningInterface)表数据库访问层 + * + * @author makejava + * @since 2024-09-03 10:06:19 + */ +@Repository(value = "SysWarningInterfaceDaoImpl") +public class SysWarningInterfaceDaoImpl extends MybatisGenericDao implements ISysWarningInterfaceDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java new file mode 100644 index 00000000..fa2181c9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.java @@ -0,0 +1,76 @@ +package com.hzya.frame.sysnew.warningInterface.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 预警接口表(SysWarningInterface)实体类 + * + * @author makejava + * @since 2024-09-03 10:06:19 + */ +public class SysWarningInterfaceEntity extends BaseEntity { + + /** 公司id */ + private String companyId; + /** api名称 */ + private String apiName; + /** api编码 */ + private Long apiCode; + /** 推送方式(1:推送一次、2:定时) */ + private String pushMethod; + /** 状态(0:停用、1:启用) */ + private String status; + /** 主表id(预警配置表id) */ + private String warningConfigId; + + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getApiName() { + return apiName; + } + + public void setApiName(String apiName) { + this.apiName = apiName; + } + + public Long getApiCode() { + return apiCode; + } + + public void setApiCode(Long apiCode) { + this.apiCode = apiCode; + } + + public String getPushMethod() { + return pushMethod; + } + + public void setPushMethod(String pushMethod) { + this.pushMethod = pushMethod; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getWarningConfigId() { + return warningConfigId; + } + + public void setWarningConfigId(String warningConfigId) { + this.warningConfigId = warningConfigId; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml new file mode 100644 index 00000000..663e7cd1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/entity/SysWarningInterfaceEntity.xml @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + ,api_name + ,api_code + ,push_method + ,status + ,warning_config_id + + + + + + + + + + + + + + + + insert into sys_warning_interface( + + id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + api_name , + api_code , + push_method , + status , + warning_config_id , + sts, + + )values( + + #{id} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{apiName} , + #{apiCode} , + #{pushMethod} , + #{status} , + #{warningConfigId} , + 'Y', + + ) + + + + insert into sys_warning_interface(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, api_name, api_code, push_method, status, warning_config_id, sts) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.apiName},#{entity.apiCode},#{entity.pushMethod},#{entity.status},#{entity.warningConfigId}, 'Y') + + + + + insert into sys_warning_interface(create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, api_name, api_code, push_method, status, warning_config_id) + values + + (#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.apiName},#{entity.apiCode},#{entity.pushMethod},#{entity.status},#{entity.warningConfigId}) + + on duplicate key update + 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), + api_name = values(api_name), + api_code = values(api_code), + push_method = values(push_method), + status = values(status), + warning_config_id = values(warning_config_id) + + +update sys_warning_interface set + + 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}, + api_name = #{apiName}, + api_code = #{apiCode}, + push_method = #{pushMethod}, + status = #{status}, + warning_config_id = #{warningConfigId}, + +where id = #{id} + + + +update sys_warning_interface set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_warning_interface set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and api_name = #{apiName} + and api_code = #{apiCode} + and push_method = #{pushMethod} + and status = #{status} + and warning_config_id = #{warningConfigId} + and sts='Y' + + + + + delete from sys_warning_interface where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java new file mode 100644 index 00000000..09f2ff30 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/ISysWarningInterfaceService.java @@ -0,0 +1,29 @@ +package com.hzya.frame.sysnew.warningInterface.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.ibatis.annotations.Select; + +/** + * 预警接口表(SysWarningInterface)表服务接口 + * + * @author makejava + * @since 2024-09-03 10:06:19 + */ +public interface ISysWarningInterfaceService extends IBaseService{ + JsonResultEntity queryEntityPage(JSONObject jsonObject); + + JsonResultEntity queryEntity(JSONObject jsonObject); + + JsonResultEntity saveEntity(JSONObject jsonObject); + + JsonResultEntity getEntity(JSONObject jsonObject); + + JsonResultEntity updateEntity(JSONObject jsonObject); + + JsonResultEntity deleteEntity(JSONObject jsonObject); + + JsonResultEntity enableDisableEntity(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/impl/SysWarningInterfaceServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/impl/SysWarningInterfaceServiceImpl.java new file mode 100644 index 00000000..70c2e1eb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/warningInterface/service/impl/SysWarningInterfaceServiceImpl.java @@ -0,0 +1,167 @@ +package com.hzya.frame.sysnew.warningInterface.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.sysnew.warningConfig.entity.SysWarningConfigEntity; +import com.hzya.frame.sysnew.warningInterface.entity.SysWarningInterfaceEntity; +import com.hzya.frame.sysnew.warningInterface.dao.ISysWarningInterfaceDao; +import com.hzya.frame.sysnew.warningInterface.service.ISysWarningInterfaceService; +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 java.util.List; + +/** + * 预警接口表(SysWarningInterface)表服务实现类 + * + * @author makejava + * @since 2024-09-03 10:06:19 + */ +@Service(value = "sysWarningInterfaceService") +public class SysWarningInterfaceServiceImpl extends BaseService implements ISysWarningInterfaceService { + + private ISysWarningInterfaceDao sysWarningInterfaceDao; + + @Autowired + public void setSysWarningInterfaceDao(ISysWarningInterfaceDao dao) { + this.sysWarningInterfaceDao = dao; + this.dao = dao; + } + + @Override + public JsonResultEntity queryEntityPage(JSONObject jsonObject){ + SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class); + if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){ + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = sysWarningInterfaceDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo<>(list); + return BaseResult.getSuccessMessageEntity("查询数据成功",pageInfo); + } + + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject){ + SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class); + if(entity == null){ + entity = new SysWarningInterfaceEntity(); + } + List list = sysWarningInterfaceDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功",list); + } + + @Override + public JsonResultEntity getEntity(JSONObject jsonObject){ + SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("查询参数不存在"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = sysWarningInterfaceDao.get(entity.getId()); + if(entity == null){ + return BaseResult.getFailureMessageEntity("获取预警接口失败"); + } + return BaseResult.getSuccessMessageEntity("获取预警接口成功",entity); + } + + @Override + public JsonResultEntity saveEntity(JSONObject jsonObject){ + SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("查询参数不存在"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + if(entity.getApiCode() == null || "".equals(entity.getApiCode())){ + return BaseResult.getFailureMessageEntity("接口编码不能为空"); + } + if(entity.getPushMethod() == null || "".equals(entity.getPushMethod())){ + return BaseResult.getFailureMessageEntity("推送方式不能为空"); + } + if(entity.getStatus() == null || "".equals(entity.getStatus())){ + return BaseResult.getFailureMessageEntity("状态不能为空"); + } + if(entity.getWarningConfigId() == null || "".equals(entity.getWarningConfigId())){ + return BaseResult.getFailureMessageEntity("预警配置id不能为空"); + } + entity.setCreate(); + sysWarningInterfaceDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存预警接口成功",entity); + } + + @Override + public JsonResultEntity updateEntity(JSONObject jsonObject){ + SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("查询参数不存在"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + if(entity.getApiCode() == null || "".equals(entity.getApiCode())){ + return BaseResult.getFailureMessageEntity("接口编码不能为空"); + } + if(entity.getPushMethod() == null || "".equals(entity.getPushMethod())){ + return BaseResult.getFailureMessageEntity("推送方式不能为空"); + } + if(entity.getStatus() == null || "".equals(entity.getStatus())){ + return BaseResult.getFailureMessageEntity("状态不能为空"); + } + if(entity.getWarningConfigId() == null || "".equals(entity.getWarningConfigId())){ + return BaseResult.getFailureMessageEntity("预警配置id不能为空"); + } + entity.setUpdate(); + sysWarningInterfaceDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改预警接口成功",entity); + } + + @Override + public JsonResultEntity deleteEntity(JSONObject jsonObject){ + SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("查询参数不存在"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + sysWarningInterfaceDao.logicRemove(entity); + + return BaseResult.getSuccessMessageEntity("删除预警接口成功"); + } + + @Override + public JsonResultEntity enableDisableEntity(JSONObject jsonObject) { + SysWarningInterfaceEntity entity = getData("jsonStr", jsonObject, SysWarningInterfaceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getStatus() == null || "".equals(entity.getStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //0启用,1禁用 + if("0".equals(entity.getStatus())){ + entity.setUpdate(); + sysWarningInterfaceDao.update(entity); + return BaseResult.getSuccessMessageEntity("启用模版成功"); + }else{ + //停用消息模版 + entity.setUpdate(); + sysWarningInterfaceDao.update(entity); + return BaseResult.getSuccessMessageEntity("停用模版成功"); + } + + } + +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/dao/IOtherInDao.java b/service/src/main/java/com/hzya/frame/u8/otherin/dao/IOtherInDao.java new file mode 100644 index 00000000..b901f09e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/dao/IOtherInDao.java @@ -0,0 +1,37 @@ +package com.hzya.frame.u8.otherin.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.otherin.entity.OtherInEntity; + +import java.util.List; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherInDao extends IBaseDao { + /** + * + * @content 获取U8C其他入库单数据 + * @className: Administrator + * @author laborer + * @date 2024-10-18 14:52 + * + */ + + List getU8otherIn(OtherInEntity entity); +/** + * + * @content 修改状态 + * @className: Administrator + * @author laborer + * @date 2024-10-18 15:10 + * + */ + + int updateState(OtherInEntity sale); +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/dao/IOtherInDetailDao.java b/service/src/main/java/com/hzya/frame/u8/otherin/dao/IOtherInDetailDao.java new file mode 100644 index 00000000..e1b33276 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/dao/IOtherInDetailDao.java @@ -0,0 +1,27 @@ +package com.hzya.frame.u8.otherin.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.otherin.entity.OtherInDetailEntity; + +import java.util.List; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherInDetailDao extends IBaseDao { + /** + * + * @content 获取其他入库单的明细数据 + * @className: Administrator + * @author laborer + * @date 2024-10-18 15:02 + * + */ + + List getU8OtherInLine(OtherInDetailEntity line); +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/dao/impl/OtherInDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/otherin/dao/impl/OtherInDaoImpl.java new file mode 100644 index 00000000..b792d76c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/dao/impl/OtherInDaoImpl.java @@ -0,0 +1,31 @@ +package com.hzya.frame.u8.otherin.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.otherin.dao.IOtherInDao; +import com.hzya.frame.u8.otherin.entity.OtherInEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "OtherInDaoImpl") +public class OtherInDaoImpl extends MybatisGenericDao implements IOtherInDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8otherIn(OtherInEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.otherin.dao.impl.OtherInDaoImpl.entity_list_base",entity); + } + + @Override + public int updateState(OtherInEntity entity) { + return super.update("com.hzya.frame.u8.otherin.dao.impl.OtherInDaoImpl.entity_update",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/dao/impl/OtherInDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/otherin/dao/impl/OtherInDetailDaoImpl.java new file mode 100644 index 00000000..653aa367 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/dao/impl/OtherInDetailDaoImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.u8.otherin.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.otherin.dao.IOtherInDetailDao; +import com.hzya.frame.u8.otherin.entity.OtherInDetailEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "OtherInDetailDaoImpl") +public class OtherInDetailDaoImpl extends MybatisGenericDao implements IOtherInDetailDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8OtherInLine(OtherInDetailEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.otherin.dao.impl.OtherInDetailDaoImpl.entity_list_base",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInDetailEntity.java b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInDetailEntity.java new file mode 100644 index 00000000..0a1acff8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInDetailEntity.java @@ -0,0 +1,68 @@ +package com.hzya.frame.u8.otherin.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public class OtherInDetailEntity extends BaseEntity { +private String cinvcode;//存货编码 +private String iquantity;//数量 +private String itvrowno;//调拨单行号 +private String irowno;//单据体行号 +private String AccCode;//账套编码 +private String AccId;//账套号 + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + + public String getCinvcode() { + return cinvcode; + } + + public void setCinvcode(String cinvcode) { + this.cinvcode = cinvcode; + } + + public String getIquantity() { + return iquantity; + } + + public void setIquantity(String iquantity) { + this.iquantity = iquantity; + } + + public String getItvrowno() { + return itvrowno; + } + + public void setItvrowno(String itvrowno) { + this.itvrowno = itvrowno; + } + + public String getIrowno() { + return irowno; + } + + public void setIrowno(String irowno) { + this.irowno = irowno; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInDetailEntity.xml b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInDetailEntity.xml new file mode 100644 index 00000000..ec758c32 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInDetailEntity.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInEntity.java b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInEntity.java new file mode 100644 index 00000000..8f79a027 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInEntity.java @@ -0,0 +1,120 @@ +package com.hzya.frame.u8.otherin.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ + +public class OtherInEntity extends BaseEntity { + +private String ccode;//入库单号 +private String cbuscode;//调拨单号 +private String crdcode;//入库类别编码 +private String cwhcode;//仓库编码 +private String cmaker;//制单人 +private String AccId;//账套 +private String id;// +private String state;// +private String AccCode;// + private String ids;// + + public String getIds() { + return ids; + } + + public void setIds(String ids) { + this.ids = ids; + } + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + private ListotherInDetailEntityList; + + public List getOtherInDetailEntityList() { + return otherInDetailEntityList; + } + + public void setOtherInDetailEntityList(List otherInDetailEntityList) { + this.otherInDetailEntityList = otherInDetailEntityList; + } + + public String getCcode() { + return ccode; + } + + public void setCcode(String ccode) { + this.ccode = ccode; + } + + public String getCbuscode() { + return cbuscode; + } + + public void setCbuscode(String cbuscode) { + this.cbuscode = cbuscode; + } + + public String getCrdcode() { + return crdcode; + } + + public void setCrdcode(String crdcode) { + this.crdcode = crdcode; + } + + public String getCwhcode() { + return cwhcode; + } + + public void setCwhcode(String cwhcode) { + this.cwhcode = cwhcode; + } + + public String getCmaker() { + return cmaker; + } + + public void setCmaker(String cmaker) { + this.cmaker = cmaker; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInEntity.xml b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInEntity.xml new file mode 100644 index 00000000..836b6b40 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/entity/OtherInEntity.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + update #{AccCode}.dbo.RdRecord08 set sync_flag = #{state} + where id = #{id} + + diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/service/IOtherInDetaiService.java b/service/src/main/java/com/hzya/frame/u8/otherin/service/IOtherInDetaiService.java new file mode 100644 index 00000000..33ef87fb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/service/IOtherInDetaiService.java @@ -0,0 +1,15 @@ +package com.hzya.frame.u8.otherin.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.otherin.entity.OtherInDetailEntity; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherInDetaiService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/service/IOtherInService.java b/service/src/main/java/com/hzya/frame/u8/otherin/service/IOtherInService.java new file mode 100644 index 00000000..68bcda9b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/service/IOtherInService.java @@ -0,0 +1,26 @@ +package com.hzya.frame.u8.otherin.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.otherin.entity.OtherInEntity; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherInService extends IBaseService { +/** + * + * @content 获取U8其他入库单数据推送CRM + * @className: Administrator + * @author laborer + * @date 2024-10-18 13:45 + * + */ + + void getU8OtherInToCrm(JSONObject requestJson); +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/service/impl/OtherInDetaiServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/otherin/service/impl/OtherInDetaiServiceImpl.java new file mode 100644 index 00000000..f20a1c84 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/service/impl/OtherInDetaiServiceImpl.java @@ -0,0 +1,23 @@ +package com.hzya.frame.u8.otherin.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.u8.otherin.entity.OtherInDetailEntity; +import com.hzya.frame.u8.otherin.service.IOtherInDetaiService; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.stereotype.Service; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "OtherInDetaiServiceImpl") +public class OtherInDetaiServiceImpl extends BaseService implements IOtherInDetaiService { + Logger logger = LogManager.getLogger(getClass()); + + +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherin/service/impl/OtherInServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/otherin/service/impl/OtherInServiceImpl.java new file mode 100644 index 00000000..14baac05 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherin/service/impl/OtherInServiceImpl.java @@ -0,0 +1,201 @@ +package com.hzya.frame.u8.otherin.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +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.crm.util.CrmUtil; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.u8.otherin.dao.IOtherInDao; +import com.hzya.frame.u8.otherin.dao.IOtherInDetailDao; +import com.hzya.frame.u8.otherin.entity.OtherInDetailEntity; +import com.hzya.frame.u8.otherin.entity.OtherInEntity; +import com.hzya.frame.u8.otherin.service.IOtherInService; +import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * + * @content 其他入库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "OtherInServiceImpl") +public class OtherInServiceImpl extends BaseService implements IOtherInService { + Logger logger = LogManager.getLogger(getClass()); + @Autowired + private IOtherInDao otherInDao; + @Autowired + private IOtherInDetailDao otherInDetailDao; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; +/** + * + * @content 获取U8其他入库单数据推送CRM + * @className: Administrator + * @author laborer + * @date 2024-10-18 13:46 + * + */ + + @Override + public void getU8OtherInToCrm(JSONObject requestJson) { + //获取重推信息id,并记录日志 + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + logger.info("U8其他入库单重推解析后:"+requestJsonObj.toString()); + logger.info("U8其他入库单推送CRM重新执行的任务主键:"+interId); + + //更换数据源 + JsonResultEntity resultEntity = new JsonResultEntity(); + OtherInEntity entity = new OtherInEntity(); + requestJson.put("db_code","YONYOUU8"); + entity.setDataSourceCode(requestJson.getString("db_code")); + + //根据重推信息id,查询该条重推记录信息 + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + entity.setIds(rootAppPk); + StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询"); + //如果是重推,是否通过entity传入的id,只能查到一条数据。 + //entity.setId("-8845102890648320822"); + List soleList = otherInDao.getU8otherIn(entity); + logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList)); + if(CollectionUtils.isNotEmpty(soleList)){ + soleList.forEach(sale -> { + try{ + //获取明细数据进行拼接 + String id = sale.getId(); + if(!StrUtil.isEmpty(id)){ + OtherInDetailEntity line = new OtherInDetailEntity(); + line.setId(id); + line.setAccId(sale.getAccId()); + line.setDataSourceCode(requestJson.getString("db_code")); + List lineList = otherInDetailDao.getU8OtherInLine(line); + logger.info("其他入库单明细查询数据{}",JSONObject.toJSONString(lineList)); + sale.setOtherInDetailEntityList(lineList); + logger.info("组装数据"); + JSONObject main = bindingAdd(sale); + logger.info("销售出库推送数据:"+main.toString()); + String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); + logger.info("销售出库推送结果:"+result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(sale.getIds()); + logDetails.setRootAppBill(sale.getCcode()); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(sale)); + logDetails.setPluginId("SaleConPlugin"); + + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.getString("code").equals("0"); + if(flag){ + // 推送成功,更新状态 + sale.setState("Y"); + logDetails.setNewTransmitInfo("推送成功"); + }else{ + // 推送失败 + sale.setState("N"); + } + sale.setDataSourceCode(requestJson.getString("db_code")); + try{ + saveLog(interId, logDetails, flag); + }catch (Exception e){ + logger.error("保存日志失败"+e.getMessage()); + otherInDao.updateState(sale); + e.printStackTrace(); + } + otherInDao.updateState(sale); + } + } catch (Exception e) { + logger.error("销售出库执行失败"+e.getMessage()); + e.printStackTrace(); + } + }); + + } + } + /** + * + * @content 保存日志信息 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:27 + * + */ + + private void saveLog(String interId, IntegrationTaskLivingDetailsEntity logDetails, boolean flag) throws Exception { + if(StrUtil.isEmpty(interId)){ + if(flag){ + //首推成功 + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + //首推失败 + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + if(flag){ + //重推成功 + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + //重推失败,把失败信息,更新到重推表中 + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + } + + /** + * + * @content 组装推送参数 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:13 + * + */ + + private JSONObject bindingAdd(OtherInEntity sale) { + JSONObject main = new JSONObject(); + main.put("AccId",sale.getAccId()); + main.put("billid",sale.getId()); + main.put("LoginDate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); + JSONObject head = new JSONObject(); + head.put("ccode",sale.getCcode()); + head.put("cbuscode",sale.getCbuscode()); + head.put("crdcode",sale.getCrdcode()); + head.put("cwhcode",sale.getCwhcode()); + head.put("cmaker",sale.getCmaker()); + JSONArray body = new JSONArray(); + List lineList = sale.getOtherInDetailEntityList(); + if(CollectionUtils.isNotEmpty(lineList)){ + lineList.forEach(line -> { + JSONObject lineObj = new JSONObject(); + lineObj.put("cinvcode",line.getCinvcode()); + lineObj.put("iquantity",line.getIquantity()); + lineObj.put("itvrowno",line.getItvrowno()); + lineObj.put("irowno",line.getIrowno()); + body.add(lineObj); + }); + } + main.put("head",head); + main.put("body",body); + return main; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/dao/IOtherOutDao.java b/service/src/main/java/com/hzya/frame/u8/otherout/dao/IOtherOutDao.java new file mode 100644 index 00000000..558a3f4f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/dao/IOtherOutDao.java @@ -0,0 +1,37 @@ +package com.hzya.frame.u8.otherout.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.otherout.entity.OtherOutEntity; + +import java.util.List; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherOutDao extends IBaseDao { + /** + * + * @content 获取销售出库单数据 + * @className: Administrator + * @author laborer + * @date 2024-10-18 15:18 + * + */ + + List getU8SaleOut(OtherOutEntity entity); +/** + * + * @content 修改推送状态 + * @className: Administrator + * @author laborer + * @date 2024-10-18 15:22 + * + */ + + int updateState(OtherOutEntity sale); +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/dao/IOtherOutDetailDao.java b/service/src/main/java/com/hzya/frame/u8/otherout/dao/IOtherOutDetailDao.java new file mode 100644 index 00000000..b9a2ac71 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/dao/IOtherOutDetailDao.java @@ -0,0 +1,28 @@ +package com.hzya.frame.u8.otherout.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.otherout.entity.OtherOutDetailEntity; + +import java.util.List; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherOutDetailDao extends IBaseDao { + /** + * + * @content 获取U8其他出库单行数据 + * @param line + * @className: Administrator + * @author laborer + * @date 2024-10-18 15:20 + * + */ + + List getU8otherOutLine(OtherOutDetailEntity line); +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/dao/impl/OtherOutDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/otherout/dao/impl/OtherOutDaoImpl.java new file mode 100644 index 00000000..7a938b59 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/dao/impl/OtherOutDaoImpl.java @@ -0,0 +1,31 @@ +package com.hzya.frame.u8.otherout.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.otherout.dao.IOtherOutDao; +import com.hzya.frame.u8.otherout.entity.OtherOutEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "OtherOutDaoImpl") +public class OtherOutDaoImpl extends MybatisGenericDao implements IOtherOutDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8SaleOut(OtherOutEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.otherout.dao.impl.OtherOutDaoImpl.entity_list_base",entity); + } + @DS("#entity.dataSourceCode") + @Override + public int updateState(OtherOutEntity entity) { + return super.update("com.hzya.frame.u8.otherout.dao.impl.OtherOutDaoImpl.entity_update",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/dao/impl/OtherOutDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/otherout/dao/impl/OtherOutDetailDaoImpl.java new file mode 100644 index 00000000..19881cad --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/dao/impl/OtherOutDetailDaoImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.u8.otherout.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.otherout.dao.IOtherOutDetailDao; +import com.hzya.frame.u8.otherout.entity.OtherOutDetailEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "OtherOutDetailDaoImpl") +public class OtherOutDetailDaoImpl extends MybatisGenericDao implements IOtherOutDetailDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8otherOutLine(OtherOutDetailEntity entity) { + return (List) selectList("com.hzya.frame.u8.otherout.dao.impl.OtherOutDetailDaoImpl.entity_list_base",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/entity/OtherOutDetailEntity.java b/service/src/main/java/com/hzya/frame/u8/otherout/entity/OtherOutDetailEntity.java new file mode 100644 index 00000000..6b61fbf5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/entity/OtherOutDetailEntity.java @@ -0,0 +1,49 @@ +package com.hzya.frame.u8.otherout.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public class OtherOutDetailEntity extends BaseEntity { + private String cinvcode;//存货编码 + private String iquantity;//数量 + private String AccCode;//账套编码 + private String AccId;//账套号 + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + public String getCinvcode() { + return cinvcode; + } + + public void setCinvcode(String cinvcode) { + this.cinvcode = cinvcode; + } + + public String getIquantity() { + return iquantity; + } + + public void setIquantity(String iquantity) { + this.iquantity = iquantity; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/entity/OtherOutDetailEntity.xml b/service/src/main/java/com/hzya/frame/u8/otherout/entity/OtherOutDetailEntity.xml new file mode 100644 index 00000000..d63d9416 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/entity/OtherOutDetailEntity.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + select * from ( + select + '001' as AccId, + 'UFDATA_001_2023' as AccCode, + id, + '1001'+CAST( id AS VARCHAR(100)) as ids, + ccode, + cbuscode, + crdcode, + cwhcode, + cmaker, + cCusCode, + cHandler + from UFDATA_001_2023.dbo.RdRecord09 + + union all + select + '002' as AccId, + 'UFDATA_002_2024' as AccCode, + id, + '1002'+CAST( id AS VARCHAR(100)) as ids, + ccode, + cbuscode, + crdcode, + cwhcode, + cmaker, + cCusCode, + cHandler + from UFDATA_002_2024.dbo.RdRecord09 + + union all + select + '004' as AccId, + 'UFDATA_004_2024' as AccCode, + id, + '1004'+CAST( id AS VARCHAR(100)) as ids, + ccode, + cbuscode, + crdcode, + cwhcode, + cmaker, + cCusCode, + cHandler + from UFDATA_004_2024.dbo.RdRecord09 + + union all + select + '005' as AccId, + 'UFDATA_005_2024' as AccCode, + id, + '1005'+CAST( id AS VARCHAR(100)) as ids, + ccode, + cbuscode, + crdcode, + cwhcode, + cmaker, + cCusCode, + cHandler + from UFDATA_005_2024.dbo.RdRecord09 + + union all + select + '201' as AccId, + 'UFDATA_201_2023' as AccCode, + id, + '1201'+CAST( id AS VARCHAR(100)) as ids, + ccode, + cbuscode, + crdcode, + cwhcode, + cmaker, + cCusCode, + cHandler + from UFDATA_201_2023.dbo.RdRecord09 + )m1 where cHandler is not null + and ids = #{ids} + + + + update RdRecord09 set sync_flag = #{state} + where id = #{id} + + diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/service/IOtherOutDetaiService.java b/service/src/main/java/com/hzya/frame/u8/otherout/service/IOtherOutDetaiService.java new file mode 100644 index 00000000..7ff3b718 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/service/IOtherOutDetaiService.java @@ -0,0 +1,15 @@ +package com.hzya.frame.u8.otherout.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.otherout.entity.OtherOutDetailEntity; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherOutDetaiService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/service/IOtherOutService.java b/service/src/main/java/com/hzya/frame/u8/otherout/service/IOtherOutService.java new file mode 100644 index 00000000..b82ab5cb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/service/IOtherOutService.java @@ -0,0 +1,26 @@ +package com.hzya.frame.u8.otherout.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.otherout.entity.OtherOutEntity; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IOtherOutService extends IBaseService { +/** + * + * @content 获取其他出库单信息推送到CRM + * @className: Administrator + * @author laborer + * @date 2024-10-18 13:46 + * + */ + + void getU8OtherOutToCrm(JSONObject requestJson); +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/service/impl/OtherOutDetaiServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/otherout/service/impl/OtherOutDetaiServiceImpl.java new file mode 100644 index 00000000..e08cb3e2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/service/impl/OtherOutDetaiServiceImpl.java @@ -0,0 +1,23 @@ +package com.hzya.frame.u8.otherout.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.u8.otherout.entity.OtherOutDetailEntity; +import com.hzya.frame.u8.otherout.service.IOtherOutDetaiService; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.stereotype.Service; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "OtherOutDetaiServiceImpl") +public class OtherOutDetaiServiceImpl extends BaseService implements IOtherOutDetaiService { + Logger logger = LogManager.getLogger(getClass()); + + +} diff --git a/service/src/main/java/com/hzya/frame/u8/otherout/service/impl/OtherOutServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/otherout/service/impl/OtherOutServiceImpl.java new file mode 100644 index 00000000..52ed5576 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/otherout/service/impl/OtherOutServiceImpl.java @@ -0,0 +1,190 @@ +package com.hzya.frame.u8.otherout.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +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.crm.util.CrmUtil; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.u8.otherout.dao.IOtherOutDao; +import com.hzya.frame.u8.otherout.dao.IOtherOutDetailDao; +import com.hzya.frame.u8.otherout.entity.OtherOutDetailEntity; +import com.hzya.frame.u8.otherout.entity.OtherOutEntity; +import com.hzya.frame.u8.otherout.service.IOtherOutService; + +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * + * @content 其他出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "OtherOutServiceImpl") +public class OtherOutServiceImpl extends BaseService implements IOtherOutService { + Logger logger = LogManager.getLogger(getClass()); + @Autowired + private IOtherOutDao otherOutDao; + @Autowired + private IOtherOutDetailDao otherOutDetailDao; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Override + public void getU8OtherOutToCrm(JSONObject requestJson) { + //获取重推信息id,并记录日志 + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + logger.info("U8销售出库单重推解析后:"+requestJsonObj.toString()); + logger.info("U8销售出库单推送CRM重新执行的任务主键:"+interId); + + //更换数据源 + JsonResultEntity resultEntity = new JsonResultEntity(); + OtherOutEntity entity = new OtherOutEntity(); + requestJson.put("db_code","YONYOUU8"); + entity.setDataSourceCode(requestJson.getString("db_code")); + + //根据重推信息id,查询该条重推记录信息 + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + entity.setIds(rootAppPk); + StrUtil.isEmpty(rootAppPk); + //如果是重推,是否通过entity传入的id,只能查到一条数据。 + List soleList = otherOutDao.getU8SaleOut(entity); + logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList)); + if(CollectionUtils.isNotEmpty(soleList)){ + soleList.forEach(sale -> { + try{ + //获取明细数据进行拼接 + String id = sale.getId(); + if(!StrUtil.isEmpty(id)){ + OtherOutDetailEntity line = new OtherOutDetailEntity(); + line.setId(id); + line.setAccId(id); + line.setDataSourceCode(requestJson.getString("db_code")); + List lineList = otherOutDetailDao.getU8otherOutLine(line); + logger.info("销售出库单明细查询数据{}",JSONObject.toJSONString(lineList)); + sale.setOtherOutDetailEntityList(lineList); + logger.info("组装数据"); + JSONObject main = bindingAdd(sale); + logger.info("销售出库推送数据:"+main.toString()); + String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); + logger.info("销售出库推送结果:"+result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(sale.getIds()); + logDetails.setRootAppBill(sale.getCcode()); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(sale)); + logDetails.setPluginId("SaleConPlugin"); + + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.getString("code").equals("0"); + if(flag){ + logDetails.setNewTransmitInfo("推送成功"); + // 推送成功,更新状态 + sale.setState("Y"); + }else{ + // 推送失败 + sale.setState("N"); + } + sale.setDataSourceCode(requestJson.getString("db_code")); + try{ + saveLog(interId, logDetails, flag); + }catch (Exception e){ + logger.error("保存日志失败"+e.getMessage()); + otherOutDao.updateState(sale); + e.printStackTrace(); + } + otherOutDao.updateState(sale); + } + } catch (Exception e) { + logger.error("销售出库执行失败"+e.getMessage()); + e.printStackTrace(); + } + }); + + } + } + /** + * + * @content 保存日志信息 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:27 + * + */ + + private void saveLog(String interId, IntegrationTaskLivingDetailsEntity logDetails, boolean flag) throws Exception { + if(StrUtil.isEmpty(interId)){ + if(flag){ + //首推成功 + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + //首推失败 + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + if(flag){ + //重推成功 + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + //重推失败,把失败信息,更新到重推表中 + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + } + + /** + * + * @content 组装推送参数 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:13 + * + */ + + private JSONObject bindingAdd(OtherOutEntity sale) { + JSONObject main = new JSONObject(); + main.put("AccId",sale.getAccId()); + main.put("billid",sale.getId()); + main.put("LoginDate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); + JSONObject head = new JSONObject(); + head.put("ccode",sale.getCcode()); + head.put("cbuscode",sale.getCbuscode()); + head.put("crdcode",sale.getCrdcode()); + head.put("cwhcode",sale.getCwhcode()); + head.put("cmaker",sale.getCmaker()); + JSONArray body = new JSONArray(); + List lineList = sale.getOtherOutDetailEntityList(); + if(CollectionUtils.isNotEmpty(lineList)){ + lineList.forEach(line -> { + JSONObject lineObj = new JSONObject(); + lineObj.put("cinvcode",line.getCinvcode()); + lineObj.put("iquantity",line.getIquantity()); + + body.add(lineObj); + }); + } + main.put("head",head); + main.put("body",body); + return main; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/dao/IReceiptDao.java b/service/src/main/java/com/hzya/frame/u8/receipt/dao/IReceiptDao.java new file mode 100644 index 00000000..d0175d05 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/dao/IReceiptDao.java @@ -0,0 +1,37 @@ +package com.hzya.frame.u8.receipt.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.receipt.entity.ReceiptEntity; + +import java.util.List; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IReceiptDao extends IBaseDao { + /** + * + * @content 获取U8销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 13:53 + * + */ + + List getU8Receipt(ReceiptEntity entity); +/** + * + * @content 修改推送状态 + * @className: Administrator + * @author laborer + * @date 2024-10-18 14:07 + * + */ + + int updateState(ReceiptEntity sale); +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/dao/IReceiptDetailDao.java b/service/src/main/java/com/hzya/frame/u8/receipt/dao/IReceiptDetailDao.java new file mode 100644 index 00000000..47805b0d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/dao/IReceiptDetailDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.u8.receipt.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.receipt.entity.ReceiptDetailEntity; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IReceiptDetailDao extends IBaseDao { +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/dao/impl/ReceiptDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/receipt/dao/impl/ReceiptDaoImpl.java new file mode 100644 index 00000000..268a12e7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/dao/impl/ReceiptDaoImpl.java @@ -0,0 +1,31 @@ +package com.hzya.frame.u8.receipt.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.receipt.dao.IReceiptDao; +import com.hzya.frame.u8.receipt.entity.ReceiptEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "ReceiptDaoImpl") +public class ReceiptDaoImpl extends MybatisGenericDao implements IReceiptDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8Receipt(ReceiptEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.receipt.dao.impl.ReceiptDaoImpl.entity_list_base",entity); + } + @DS("#entity.dataSourceCode") + @Override + public int updateState(ReceiptEntity entity) { + return super.update("com.hzya.frame.u8.receipt.dao.impl.ReceiptDaoImpl.entity_update",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/dao/impl/ReceiptDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/receipt/dao/impl/ReceiptDetailDaoImpl.java new file mode 100644 index 00000000..d537c29a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/dao/impl/ReceiptDetailDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.u8.receipt.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.receipt.dao.IReceiptDetailDao; +import com.hzya.frame.u8.receipt.entity.ReceiptDetailEntity; +import org.springframework.stereotype.Repository; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "ReceiptDetailDaoImpl") +public class ReceiptDetailDaoImpl extends MybatisGenericDao implements IReceiptDetailDao { +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptDetailEntity.java b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptDetailEntity.java new file mode 100644 index 00000000..0966cf2b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptDetailEntity.java @@ -0,0 +1,32 @@ +package com.hzya.frame.u8.receipt.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public class ReceiptDetailEntity extends BaseEntity { + private String AccCode;//账套编码 + private String AccId;//账套号 + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptDetailEntity.xml b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptDetailEntity.xml new file mode 100644 index 00000000..a63ae040 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptDetailEntity.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptEntity.java b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptEntity.java new file mode 100644 index 00000000..826cd5bf --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptEntity.java @@ -0,0 +1,126 @@ +package com.hzya.frame.u8.receipt.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ + +public class ReceiptEntity extends BaseEntity { + + private String iID;//主键 + private String cvouchid;//收款单号 + private String dvouchdate;//单据日期 + private String ccuscode;//客户编码 + private String ccusname;//客户名称 + private String iamount_f;//金额 + private String csscode;//收款方式 + private String syncFlag;//标识 + private String AccId;//账套 + private String state;//状态 + private String AccCode;//账套编码 + private String ids;// + + public String getIds() { + return ids; + } + + public void setIds(String ids) { + this.ids = ids; + } + + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + + public String getiID() { + return iID; + } + + public void setiID(String iID) { + this.iID = iID; + } + + public String getCvouchid() { + return cvouchid; + } + + public void setCvouchid(String cvouchid) { + this.cvouchid = cvouchid; + } + + public String getDvouchdate() { + return dvouchdate; + } + + public void setDvouchdate(String dvouchdate) { + this.dvouchdate = dvouchdate; + } + + public String getCcuscode() { + return ccuscode; + } + + public void setCcuscode(String ccuscode) { + this.ccuscode = ccuscode; + } + + public String getCcusname() { + return ccusname; + } + + public void setCcusname(String ccusname) { + this.ccusname = ccusname; + } + + public String getIamount_f() { + return iamount_f; + } + + public void setIamount_f(String iamount_f) { + this.iamount_f = iamount_f; + } + + public String getCsscode() { + return csscode; + } + + public void setCsscode(String csscode) { + this.csscode = csscode; + } + + public String getSyncFlag() { + return syncFlag; + } + + public void setSyncFlag(String syncFlag) { + this.syncFlag = syncFlag; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptEntity.xml b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptEntity.xml new file mode 100644 index 00000000..2fa5e46c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/entity/ReceiptEntity.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + update #{AccCode}.dbo.Ap_CloseBill set sync_flag = #{state} + where iID = #{iID} + + diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/service/IReceiptDetaiService.java b/service/src/main/java/com/hzya/frame/u8/receipt/service/IReceiptDetaiService.java new file mode 100644 index 00000000..0f2802b1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/service/IReceiptDetaiService.java @@ -0,0 +1,15 @@ +package com.hzya.frame.u8.receipt.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.receipt.entity.ReceiptDetailEntity; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IReceiptDetaiService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/service/IReceiptService.java b/service/src/main/java/com/hzya/frame/u8/receipt/service/IReceiptService.java new file mode 100644 index 00000000..da0daad5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/service/IReceiptService.java @@ -0,0 +1,27 @@ +package com.hzya.frame.u8.receipt.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.receipt.entity.ReceiptEntity; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface IReceiptService extends IBaseService { +/** + * + * @content 获取U8收款单推送CRM + * @param requestJson + * @className: Administrator + * @author laborer + * @date 2024-10-18 13:47 + * + */ + + void getU8ReceiptCrm(JSONObject requestJson); +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/service/impl/ReceiptDetaiServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/receipt/service/impl/ReceiptDetaiServiceImpl.java new file mode 100644 index 00000000..1e5c87c3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/service/impl/ReceiptDetaiServiceImpl.java @@ -0,0 +1,23 @@ +package com.hzya.frame.u8.receipt.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.u8.receipt.entity.ReceiptDetailEntity; +import com.hzya.frame.u8.receipt.service.IReceiptDetaiService; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.stereotype.Service; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "ReceiptDetaiServiceImpl") +public class ReceiptDetaiServiceImpl extends BaseService implements IReceiptDetaiService { + Logger logger = LogManager.getLogger(getClass()); + + +} diff --git a/service/src/main/java/com/hzya/frame/u8/receipt/service/impl/ReceiptServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/receipt/service/impl/ReceiptServiceImpl.java new file mode 100644 index 00000000..b36f983e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/receipt/service/impl/ReceiptServiceImpl.java @@ -0,0 +1,168 @@ +package com.hzya.frame.u8.receipt.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.crm.util.CrmUtil; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.u8.receipt.dao.IReceiptDao; +import com.hzya.frame.u8.receipt.entity.ReceiptEntity; +import com.hzya.frame.u8.receipt.service.IReceiptService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * + * @content 销售收款单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "ReceiptServiceImpl") +public class ReceiptServiceImpl extends BaseService implements IReceiptService { + Logger logger = LogManager.getLogger(getClass()); + @Autowired + private IReceiptDao saleOutDao; + + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Override + public void getU8ReceiptCrm(JSONObject requestJson) { + //获取重推信息id,并记录日志 + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + logger.info("U8销售收款单重推解析后:"+requestJsonObj.toString()); + logger.info("U8销售收款单推送CRM重新执行的任务主键:"+interId); + + //更换数据源 + JsonResultEntity resultEntity = new JsonResultEntity(); + ReceiptEntity entity = new ReceiptEntity(); + requestJson.put("db_code","YONYOUU8"); + entity.setDataSourceCode(requestJson.getString("db_code")); + + //根据重推信息id,查询该条重推记录信息 + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + entity.setIds(rootAppPk); + StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询"); + //如果是重推,是否通过entity传入的id,只能查到一条数据。 + //entity.setId("-8845102890648320822"); + List soleList = saleOutDao.getU8Receipt(entity); + logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList)); + if(CollectionUtils.isNotEmpty(soleList)){ + soleList.forEach(sale -> { + try{ + //获取明细数据进行拼接 + String id = sale.getiID(); + if(!StrUtil.isEmpty(id)){ + logger.info("组装数据"); + JSONObject main = bindingAdd(sale); + logger.info("销售出库推送数据:"+main.toString()); + String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); + logger.info("销售出库推送结果:"+result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(sale.getIds()); + logDetails.setRootAppBill(sale.getCvouchid()); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(sale)); + logDetails.setPluginId("SaleConPlugin"); + + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.getString("code").equals("0"); + if(flag){ + logDetails.setNewTransmitInfo("推送成功"); + // 推送成功,更新状态 + sale.setState("Y"); + }else{ + // 推送失败 + sale.setState("N"); + } + sale.setDataSourceCode(requestJson.getString("db_code")); + try{ + saveLog(interId, logDetails, flag); + }catch (Exception e){ + logger.error("保存日志失败"+e.getMessage()); + saleOutDao.updateState(sale); + e.printStackTrace(); + } + saleOutDao.updateState(sale); + } + } catch (Exception e) { + logger.error("销售出库执行失败"+e.getMessage()); + e.printStackTrace(); + } + }); + + } + } + /** + * + * @content 保存日志信息 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:27 + * + */ + + private void saveLog(String interId, IntegrationTaskLivingDetailsEntity logDetails, boolean flag) throws Exception { + if(StrUtil.isEmpty(interId)){ + if(flag){ + //首推成功 + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + //首推失败 + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + if(flag){ + //重推成功 + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + //重推失败,把失败信息,更新到重推表中 + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + } + + /** + * + * @content 组装推送参数 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:13 + * + */ + + private JSONObject bindingAdd(ReceiptEntity sale) { + JSONObject main = new JSONObject(); + main.put("AccId",sale.getAccId()); + main.put("billid",sale.getiID()); + main.put("LoginDate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); + JSONObject head = new JSONObject(); + head.put("cvouchid",sale.getCvouchid()); + head.put("dvouchdate",sale.getDvouchdate()); + head.put("ccuscode",sale.getCcuscode()); + head.put("iamount",sale.getCcusname()); + head.put("csscode",sale.getCsscode()); + head.put("syncFlag",sale.getSyncFlag()); + main.put("head",head); + return main; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/dao/ISaleInvDao.java b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/ISaleInvDao.java new file mode 100644 index 00000000..ec87015a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/ISaleInvDao.java @@ -0,0 +1,37 @@ +package com.hzya.frame.u8.saleinv.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.saleinv.entity.SaleInvEntity; + +import java.util.List; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface ISaleInvDao extends IBaseDao { + /** + * + * @content 获取U8销售发票信息 + * @className: Administrator + * @author laborer + * @date 2024-10-18 14:22 + * + */ + + List getU8SaleInv(SaleInvEntity entity); +/** + * + * @content 修改推送状态 + * @className: Administrator + * @author laborer + * @date 2024-10-18 14:43 + * + */ + + int updateState(SaleInvEntity entity); +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/dao/ISaleInvDetailDao.java b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/ISaleInvDetailDao.java new file mode 100644 index 00000000..c409cac7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/ISaleInvDetailDao.java @@ -0,0 +1,27 @@ +package com.hzya.frame.u8.saleinv.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.saleinv.entity.SaleInvDetailEntity; + +import java.util.List; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface ISaleInvDetailDao extends IBaseDao { + /** + * + * @content 获取U8销售发票明细数据 + * @className: Administrator + * @author laborer + * @date 2024-10-18 14:37 + * + */ + + List getU8InvDetail(SaleInvDetailEntity line); +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/dao/impl/SaleInvDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/impl/SaleInvDaoImpl.java new file mode 100644 index 00000000..df12cd47 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/impl/SaleInvDaoImpl.java @@ -0,0 +1,32 @@ +package com.hzya.frame.u8.saleinv.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.saleinv.dao.ISaleInvDao; +import com.hzya.frame.u8.saleinv.entity.SaleInvEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "SaleInvDaoImpl") +public class SaleInvDaoImpl extends MybatisGenericDao implements ISaleInvDao { + @DS("#entity.dataSourceCode") + + @Override + public List getU8SaleInv(SaleInvEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDaoImpl.entity_list_base",entity); + } + + @Override + public int updateState(SaleInvEntity entity) { + return super.update("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDaoImpl.entity_update", entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/dao/impl/SaleInvDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/impl/SaleInvDetailDaoImpl.java new file mode 100644 index 00000000..bdb14a41 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/dao/impl/SaleInvDetailDaoImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.u8.saleinv.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.saleinv.dao.ISaleInvDetailDao; +import com.hzya.frame.u8.saleinv.entity.SaleInvDetailEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Repository(value = "SaleInvDetailDaoImpl") +public class SaleInvDetailDaoImpl extends MybatisGenericDao implements ISaleInvDetailDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8InvDetail(SaleInvDetailEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDetailDaoImpl.entity_list_base",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvDetailEntity.java b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvDetailEntity.java new file mode 100644 index 00000000..9f4925de --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvDetailEntity.java @@ -0,0 +1,67 @@ +package com.hzya.frame.u8.saleinv.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public class SaleInvDetailEntity extends BaseEntity { + private String cdlcode;//发货单号 + private String idlsum;//发货单金额 + private String idlrowno;//发货单行号 + private String SBVID;//主表主键 + private String AccCode;//账套编码 + private String AccId;//账套号 + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + public String getCdlcode() { + return cdlcode; + } + + public void setCdlcode(String cdlcode) { + this.cdlcode = cdlcode; + } + + public String getIdlsum() { + return idlsum; + } + + public void setIdlsum(String idlsum) { + this.idlsum = idlsum; + } + + public String getIdlrowno() { + return idlrowno; + } + + public void setIdlrowno(String idlrowno) { + this.idlrowno = idlrowno; + } + + public String getSBVID() { + return SBVID; + } + + public void setSBVID(String SBVID) { + this.SBVID = SBVID; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvDetailEntity.xml b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvDetailEntity.xml new file mode 100644 index 00000000..81564d34 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvDetailEntity.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvEntity.java b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvEntity.java new file mode 100644 index 00000000..9181c0aa --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvEntity.java @@ -0,0 +1,107 @@ +package com.hzya.frame.u8.saleinv.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ + +public class SaleInvEntity extends BaseEntity { + private String csbvcode;//销售发票号 + private String ddate;//销售发票日期 + private String isum;//发票金额 + private String SBVID;//发票主键 + private String AccId;//账套 + private String state;// + private String syncFlag;// + private String ids;// + + public String getIds() { + return ids; + } + + public void setIds(String ids) { + this.ids = ids; + } + private List saleInvDetailEntityList; + private String AccCode;//账套编码 + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + + public List getSaleInvDetailEntityList() { + return saleInvDetailEntityList; + } + + public void setSaleInvDetailEntityList(List saleInvDetailEntityList) { + this.saleInvDetailEntityList = saleInvDetailEntityList; + } + + public String getCsbvcode() { + return csbvcode; + } + + public void setCsbvcode(String csbvcode) { + this.csbvcode = csbvcode; + } + + public String getDdate() { + return ddate; + } + + public void setDdate(String ddate) { + this.ddate = ddate; + } + + public String getIsum() { + return isum; + } + + public void setIsum(String isum) { + this.isum = isum; + } + + public String getSBVID() { + return SBVID; + } + + public void setSBVID(String SBVID) { + this.SBVID = SBVID; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getSyncFlag() { + return syncFlag; + } + + public void setSyncFlag(String syncFlag) { + this.syncFlag = syncFlag; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvEntity.xml b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvEntity.xml new file mode 100644 index 00000000..887ad0da --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/entity/SaleInvEntity.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + update #{AccCode}.dbo.SaleBillVouch set sync_flag = #{state} + where SBVID = #{SBVID} + + + diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/service/ISaleInvDetaiService.java b/service/src/main/java/com/hzya/frame/u8/saleinv/service/ISaleInvDetaiService.java new file mode 100644 index 00000000..dba6b3e3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/service/ISaleInvDetaiService.java @@ -0,0 +1,15 @@ +package com.hzya.frame.u8.saleinv.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.saleinv.entity.SaleInvDetailEntity; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface ISaleInvDetaiService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/service/ISaleInvService.java b/service/src/main/java/com/hzya/frame/u8/saleinv/service/ISaleInvService.java new file mode 100644 index 00000000..d5587da1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/service/ISaleInvService.java @@ -0,0 +1,27 @@ +package com.hzya.frame.u8.saleinv.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.saleinv.entity.SaleInvEntity; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface ISaleInvService extends IBaseService { +/** + * + * @content 获取U8销售发票数据,并推送到CRM + * @param requestJson + * @className: Administrator + * @author laborer + * @date 2024-10-18 13:48 + * + */ + + void getU8SaleInvToCrm(JSONObject requestJson); +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/service/impl/SaleInvDetaiServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/saleinv/service/impl/SaleInvDetaiServiceImpl.java new file mode 100644 index 00000000..9a95b6a5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/service/impl/SaleInvDetaiServiceImpl.java @@ -0,0 +1,23 @@ +package com.hzya.frame.u8.saleinv.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.u8.saleinv.entity.SaleInvDetailEntity; +import com.hzya.frame.u8.saleinv.service.ISaleInvDetaiService; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.stereotype.Service; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "SaleInvDetaiServiceImpl") +public class SaleInvDetaiServiceImpl extends BaseService implements ISaleInvDetaiService { + Logger logger = LogManager.getLogger(getClass()); + + +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleinv/service/impl/SaleInvServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/saleinv/service/impl/SaleInvServiceImpl.java new file mode 100644 index 00000000..76cffc9a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleinv/service/impl/SaleInvServiceImpl.java @@ -0,0 +1,191 @@ +package com.hzya.frame.u8.saleinv.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +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.crm.util.CrmUtil; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.u8.saleinv.dao.ISaleInvDao; +import com.hzya.frame.u8.saleinv.dao.ISaleInvDetailDao; +import com.hzya.frame.u8.saleinv.entity.SaleInvDetailEntity; +import com.hzya.frame.u8.saleinv.entity.SaleInvEntity; +import com.hzya.frame.u8.saleinv.service.ISaleInvService; + +import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * + * @content 销售发票 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "SaleInvServiceImpl") +public class SaleInvServiceImpl extends BaseService implements ISaleInvService { + Logger logger = LogManager.getLogger(getClass()); + @Autowired + private ISaleInvDao saleInvDao; + @Autowired + private ISaleInvDetailDao saleInvDetailDao; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Override + public void getU8SaleInvToCrm(JSONObject requestJson) { + //获取重推信息id,并记录日志 + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + logger.info("U8销售发票单重推解析后:"+requestJsonObj.toString()); + logger.info("U8销售发票单推送CRM重新执行的任务主键:"+interId); + + //更换数据源 + JsonResultEntity resultEntity = new JsonResultEntity(); + SaleInvEntity entity = new SaleInvEntity(); + requestJson.put("db_code","YONYOUU8"); + entity.setDataSourceCode(requestJson.getString("db_code")); + + //根据重推信息id,查询该条重推记录信息 + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + entity.setIds(rootAppPk); + StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询"); + //如果是重推,是否通过entity传入的id,只能查到一条数据。 + //entity.setId("-8845102890648320822"); + List soleList = saleInvDao.getU8SaleInv(entity); + logger.info("销售发票查询数据{}",JSONObject.toJSONString(soleList)); + if(CollectionUtils.isNotEmpty(soleList)){ + soleList.forEach(sale -> { + try{ + //获取明细数据进行拼接 + String id = sale.getSBVID(); + if(!StrUtil.isEmpty(id)){ + SaleInvDetailEntity line = new SaleInvDetailEntity(); + line.setSBVID(id); + line.setAccId(id); + line.setDataSourceCode(requestJson.getString("db_code")); + List lineList = saleInvDetailDao.getU8InvDetail(line); + logger.info("销售发票单明细查询数据{}",JSONObject.toJSONString(lineList)); + sale.setSaleInvDetailEntityList(lineList); + logger.info("组装数据"); + JSONObject main = bindingAdd(sale); + logger.info("销售发票推送数据:"+main.toString()); + String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); + logger.info("销售发票推送结果:"+result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(sale.getIds()); + logDetails.setRootAppBill(sale.getCsbvcode()); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(sale)); + logDetails.setPluginId("SaleConPlugin"); + + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.getString("code").equals("0"); + if(flag){ + logDetails.setNewTransmitInfo("推送成功"); + // 推送成功,更新状态 + sale.setState("Y"); + }else{ + // 推送失败 + sale.setState("N"); + } + sale.setDataSourceCode(requestJson.getString("db_code")); + try{ + saveLog(interId, logDetails, flag); + }catch (Exception e){ + logger.error("保存日志失败"+e.getMessage()); + saleInvDao.updateState(sale); + e.printStackTrace(); + } + saleInvDao.updateState(sale); + } + } catch (Exception e) { + logger.error("销售发票执行失败"+e.getMessage()); + e.printStackTrace(); + } + }); + + } + } + /** + * + * @content 保存日志信息 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:27 + * + */ + + private void saveLog(String interId, IntegrationTaskLivingDetailsEntity logDetails, boolean flag) throws Exception { + if(StrUtil.isEmpty(interId)){ + if(flag){ + //首推成功 + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + //首推失败 + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + if(flag){ + //重推成功 + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + //重推失败,把失败信息,更新到重推表中 + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + } + + /** + * + * @content 组装推送参数 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:13 + * + */ + + private JSONObject bindingAdd(SaleInvEntity sale) { + JSONObject main = new JSONObject(); + main.put("AccId",sale.getAccId()); + main.put("billid",sale.getId()); + main.put("LoginDate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); + JSONObject head = new JSONObject(); + head.put("csbvcode",sale.getCsbvcode()); + head.put("ddate",sale.getDdate()); + head.put("syncFlag",sale.getSyncFlag()); + head.put("isum",sale.getIsum()); + JSONArray body = new JSONArray(); + main.put("head",head); + List lineList = sale.getSaleInvDetailEntityList(); + if(CollectionUtils.isNotEmpty(lineList)){ + lineList.forEach(line -> { + JSONObject lineObj = new JSONObject(); + lineObj.put("cdlcode",line.getCdlcode()); + lineObj.put("idlsum",line.getIdlsum()); + lineObj.put("idlrowno",line.getIdlrowno()); + body.add(lineObj); + }); + } + main.put("body",body); + return main; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/dao/ISaleOutDao.java b/service/src/main/java/com/hzya/frame/u8/saleout/dao/ISaleOutDao.java new file mode 100644 index 00000000..d11d03ed --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/dao/ISaleOutDao.java @@ -0,0 +1,32 @@ +package com.hzya.frame.u8.saleout.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.saleout.entity.SaleOutEntity; + +import java.util.List; + +/** + * @Description U8发货单 + * @Author xiangerlin + * @Date 2024/8/22 15:07 + **/ +public interface ISaleOutDao extends IBaseDao { + /** + * @content 获取U8销售出库单数据 + * @className: Administrator + * @author laborer + * @date 2024-10-18 10:49 + */ + + List getU8SaleOut(SaleOutEntity entity); +/** + * + * @content 推送修改状态 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:23 + * + */ + + int updateState(SaleOutEntity sale); +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/dao/ISaleOutDetailDao.java b/service/src/main/java/com/hzya/frame/u8/saleout/dao/ISaleOutDetailDao.java new file mode 100644 index 00000000..d4f51fac --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/dao/ISaleOutDetailDao.java @@ -0,0 +1,25 @@ +package com.hzya.frame.u8.saleout.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity; + +import java.util.List; + +/** + * @Description u8发货单明细行 + * @Author xiangerlin + * @Date 2024/8/22 16:22 + **/ +public interface ISaleOutDetailDao extends IBaseDao { + /** + * + * @content 获取u8发货单明细行 + * @return + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:04 + * + */ + + List getU8SaleOutLine(SaleOutDetailEntity entity); +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/dao/impl/SaleOutDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/saleout/dao/impl/SaleOutDaoImpl.java new file mode 100644 index 00000000..cac9899e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/dao/impl/SaleOutDaoImpl.java @@ -0,0 +1,28 @@ +package com.hzya.frame.u8.saleout.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.saleout.dao.ISaleOutDao; +import com.hzya.frame.u8.saleout.entity.SaleOutEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @Description u8发货单 + * @Author xiangerlin + * @Date 2024/8/22 15:09 + **/ +@Repository(value = "SaleOutDaoImpl") +public class SaleOutDaoImpl extends MybatisGenericDao implements ISaleOutDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8SaleOut(SaleOutEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.saleout.dao.impl.SaleOutDaoImpl.entity_list_base",entity); + } + @DS("#entity.dataSourceCode") + @Override + public int updateState(SaleOutEntity entity) { + return super.update("com.hzya.frame.u8.saleout.dao.impl.SaleOutDaoImpl.entity_list_base",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/dao/impl/SaleOutDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/u8/saleout/dao/impl/SaleOutDetailDaoImpl.java new file mode 100644 index 00000000..894ed33c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/dao/impl/SaleOutDetailDaoImpl.java @@ -0,0 +1,23 @@ +package com.hzya.frame.u8.saleout.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.saleout.dao.ISaleOutDetailDao; +import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/8/22 16:24 + **/ +@Repository(value = "SaleOutDetailDaoImpl") +public class SaleOutDetailDaoImpl extends MybatisGenericDao implements ISaleOutDetailDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8SaleOutLine(SaleOutDetailEntity entity) { + return (List) super.selectList("com.hzya.frame.u8.saleout.dao.impl.SaleOutDetailDaoImpl.entity_list_base",entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutDetailEntity.java b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutDetailEntity.java new file mode 100644 index 00000000..89d9cafb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutDetailEntity.java @@ -0,0 +1,76 @@ +package com.hzya.frame.u8.saleout.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 销售出库单明细 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public class SaleOutDetailEntity extends BaseEntity { + private String cinvcode;//存货编码 + private String cinvname;//存货名称 + private String iquantity;//数量 + private String inum;//辅计量单位数量 + private String idlrowno;//发货单行号 + private String AccCode;//账套编码 + private String AccId;//账套号 + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + public String getCinvcode() { + return cinvcode; + } + + public void setCinvcode(String cinvcode) { + this.cinvcode = cinvcode; + } + + public String getCinvname() { + return cinvname; + } + + public void setCinvname(String cinvname) { + this.cinvname = cinvname; + } + + public String getIquantity() { + return iquantity; + } + + public void setIquantity(String iquantity) { + this.iquantity = iquantity; + } + + public String getInum() { + return inum; + } + + public void setInum(String inum) { + this.inum = inum; + } + + public String getIdlrowno() { + return idlrowno; + } + + public void setIdlrowno(String idlrowno) { + this.idlrowno = idlrowno; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutDetailEntity.xml b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutDetailEntity.xml new file mode 100644 index 00000000..7ec7acfb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutDetailEntity.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutEntity.java b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutEntity.java new file mode 100644 index 00000000..ace3d86d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutEntity.java @@ -0,0 +1,102 @@ +package com.hzya.frame.u8.saleout.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hzya.frame.web.entity.BaseEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.List; + +/** + * + * @content 销售出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ + +public class SaleOutEntity extends BaseEntity { + private String cdlcode;//发货单号 + private String outtype;//出库方式 + private String ccode;//出库单号 + private String ddate;//出库日期 + private String AccId;//账套 + private String state;//状态 + private String AccCode;//账套编码 + private String ids;// + + public String getIds() { + return ids; + } + + public void setIds(String ids) { + this.ids = ids; + } + + public String getAccCode() { + return AccCode; + } + + public void setAccCode(String accCode) { + AccCode = accCode; + } + + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getAccId() { + return AccId; + } + + public void setAccId(String accId) { + AccId = accId; + } + + private ListsaleOutDetailEntityList; + + public List getSaleOutDetailEntityList() { + return saleOutDetailEntityList; + } + + public void setSaleOutDetailEntityList(List saleOutDetailEntityList) { + this.saleOutDetailEntityList = saleOutDetailEntityList; + } + + public String getCdlcode() { + return cdlcode; + } + + public void setCdlcode(String cdlcode) { + this.cdlcode = cdlcode; + } + + public String getOuttype() { + return outtype; + } + + public void setOuttype(String outtype) { + this.outtype = outtype; + } + + public String getCcode() { + return ccode; + } + + public void setCcode(String ccode) { + this.ccode = ccode; + } + + public String getDdate() { + return ddate; + } + + public void setDdate(String ddate) { + this.ddate = ddate; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutEntity.xml b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutEntity.xml new file mode 100644 index 00000000..6c7e4035 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/entity/SaleOutEntity.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + update #{AccCode}.dbo.rdrecords32 set sync_flag = #{state} + where id = #{id} + + diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/service/ISaleOutDetaiService.java b/service/src/main/java/com/hzya/frame/u8/saleout/service/ISaleOutDetaiService.java new file mode 100644 index 00000000..64fda28b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/service/ISaleOutDetaiService.java @@ -0,0 +1,15 @@ +package com.hzya.frame.u8.saleout.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity; + +/** + * + * @content 销售出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface ISaleOutDetaiService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/service/ISaleOutService.java b/service/src/main/java/com/hzya/frame/u8/saleout/service/ISaleOutService.java new file mode 100644 index 00000000..3ab5a256 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/service/ISaleOutService.java @@ -0,0 +1,26 @@ +package com.hzya.frame.u8.saleout.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.saleout.entity.SaleOutEntity; + +/** + * + * @content 销售出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +public interface ISaleOutService extends IBaseService { +/** + * + * @content 获取U8销售出库单到CRM + * @className: Administrator + * @author laborer + * @date 2024-10-18 10:15 + * + */ + + void getU8SaleOutToCrm(JSONObject requestJson); +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/service/impl/SaleOutDetaiServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/saleout/service/impl/SaleOutDetaiServiceImpl.java new file mode 100644 index 00000000..073d0d46 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/service/impl/SaleOutDetaiServiceImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.u8.saleout.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.u8.saleout.dao.ISaleOutDetailDao; +import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity; +import com.hzya.frame.u8.saleout.service.ISaleOutDetaiService; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + * @content 销售出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "SaleOutDetaiServiceImpl") +public class SaleOutDetaiServiceImpl extends BaseService implements ISaleOutDetaiService { + Logger logger = LogManager.getLogger(getClass()); + + +} diff --git a/service/src/main/java/com/hzya/frame/u8/saleout/service/impl/SaleOutServiceImpl.java b/service/src/main/java/com/hzya/frame/u8/saleout/service/impl/SaleOutServiceImpl.java new file mode 100644 index 00000000..c60a6654 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8/saleout/service/impl/SaleOutServiceImpl.java @@ -0,0 +1,204 @@ +package com.hzya.frame.u8.saleout.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.crm.util.CrmUtil; +import com.hzya.frame.seeyon.util.RestUtil; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.u8.saleout.dao.ISaleOutDao; +import com.hzya.frame.u8.saleout.dao.ISaleOutDetailDao; +import com.hzya.frame.u8.saleout.dao.impl.SaleOutDetailDaoImpl; +import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity; +import com.hzya.frame.u8.saleout.entity.SaleOutEntity; +import com.hzya.frame.u8.saleout.service.ISaleOutService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * + * @content 销售出库单 + * @className: Administrator + * @author laborer + * @date 2024-10-18 9:27 + * + */ +@Service(value = "SaleOutServiceImpl") +public class SaleOutServiceImpl extends BaseService implements ISaleOutService { + Logger logger = LogManager.getLogger(getClass()); + @Autowired + private ISaleOutDao saleOutDao; + @Autowired + private ISaleOutDetailDao saleOutDetailDao; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + + /** + * + * @content 获取U8销售出库单到CRM + * @className: Administrator + * @author laborer + * @date 2024-10-18 10:15 + * + */ + + @Override + public void getU8SaleOutToCrm(JSONObject requestJson) { + //获取重推信息id,并记录日志 + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + logger.info("U8销售出库单重推解析后:"+requestJsonObj.toString()); + logger.info("U8销售出库单推送CRM重新执行的任务主键:"+interId); + + //更换数据源 + JsonResultEntity resultEntity = new JsonResultEntity(); + SaleOutEntity entity = new SaleOutEntity(); + requestJson.put("db_code","YONYOUU8"); + entity.setDataSourceCode(requestJson.getString("db_code")); + + //根据重推信息id,查询该条重推记录信息 + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + entity.setIds(rootAppPk); + StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询"); + //如果是重推,是否通过entity传入的id,只能查到一条数据。 + //entity.setId("-8845102890648320822"); + List soleList = saleOutDao.getU8SaleOut(entity); + logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList)); + if(CollectionUtils.isNotEmpty(soleList)){ + soleList.forEach(sale -> { + try{ + //获取明细数据进行拼接 + String id = sale.getId(); + if(!StrUtil.isEmpty(id)){ + SaleOutDetailEntity line = new SaleOutDetailEntity(); + line.setId(id); + line.setAccId(id); + line.setDataSourceCode(requestJson.getString("db_code")); + List lineList = saleOutDetailDao.getU8SaleOutLine(line); + logger.info("销售出库单明细查询数据{}",JSONObject.toJSONString(lineList)); + sale.setSaleOutDetailEntityList(lineList); + logger.info("组装数据"); + JSONObject main = bindingAdd(sale); + logger.info("销售出库推送数据:"+main.toString()); + String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); + logger.info("销售出库推送结果:"+result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(sale.getIds()); + logDetails.setRootAppBill(sale.getCcode()); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(sale)); + logDetails.setPluginId("SaleConPlugin"); + + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.getString("code").equals("0"); + if(flag){ + logDetails.setNewTransmitInfo("推送成功"); + // 推送成功,更新状态 + sale.setState("Y"); + }else{ + // 推送失败 + sale.setState("N"); + } + sale.setDataSourceCode(requestJson.getString("db_code")); + try{ + saveLog(interId, logDetails, flag); + }catch (Exception e){ + logger.error("保存日志失败"+e.getMessage()); + saleOutDao.updateState(sale); + e.printStackTrace(); + } + saleOutDao.updateState(sale); + } + } catch (Exception e) { + logger.error("销售出库执行失败"+e.getMessage()); + e.printStackTrace(); + } + }); + + } + } +/** + * + * @content 保存日志信息 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:27 + * + */ + + private void saveLog(String interId, IntegrationTaskLivingDetailsEntity logDetails, boolean flag) throws Exception { + if(StrUtil.isEmpty(interId)){ + if(flag){ + //首推成功 + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + //首推失败 + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + if(flag){ + //重推成功 + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + //重推失败,把失败信息,更新到重推表中 + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + } + + /** + * + * @content 组装推送参数 + * @className: Administrator + * @author laborer + * @date 2024-10-18 11:13 + * + */ + + private JSONObject bindingAdd(SaleOutEntity sale) { + JSONObject main = new JSONObject(); + main.put("AccId",sale.getAccId()); + main.put("billid",sale.getId()); + main.put("LoginDate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); + JSONObject head = new JSONObject(); + head.put("cdlcode",sale.getCdlcode()); + head.put("couttype",sale.getOuttype()); + head.put("ccode",sale.getCcode()); + head.put("ddate",sale.getDdate()); + JSONArray body = new JSONArray(); + List lineList = sale.getSaleOutDetailEntityList(); + if(CollectionUtils.isNotEmpty(lineList)){ + lineList.forEach(line -> { + JSONObject lineObj = new JSONObject(); + lineObj.put("cinvcode",line.getCinvcode()); + lineObj.put("cinvname",line.getCinvname()); + lineObj.put("iquantity",line.getIquantity()); + lineObj.put("inum",line.getInum()); + lineObj.put("idlrowno",line.getIdlrowno()); + body.add(lineObj); + }); + } + main.put("head",head); + main.put("body",body); + return main; + } +} diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/IEncapsulationDao.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/IEncapsulationDao.java new file mode 100644 index 00000000..77f0a933 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/IEncapsulationDao.java @@ -0,0 +1,19 @@ +package com.hzya.frame.u8c.Encapsulation.dao; + + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; + +import java.util.List; + +/** + * (bd_corp: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-06 14:47:17 + */ +public interface IEncapsulationDao extends IBaseDao { + + List queryCgrkddh(EncapsulationEntity encapsulationEntity); +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/impl/EncapsulationDaoImpl.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/impl/EncapsulationDaoImpl.java new file mode 100644 index 00000000..eff12797 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/impl/EncapsulationDaoImpl.java @@ -0,0 +1,32 @@ +package com.hzya.frame.u8c.Encapsulation.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntity; +import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntityVo; +import com.hzya.frame.u8c.Encapsulation.dao.IEncapsulationDao; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +/** + * (BdCorp)表数据库访问层 + * + * @author makejava + * @since 2023-09-06 14:47:17 + */ +@Repository("encapsulationDaoImpl") +public class EncapsulationDaoImpl extends MybatisGenericDao implements IEncapsulationDao { + + @DS("#entity.dataSourceCode") + @Override + public List queryCgrkddh(EncapsulationEntity entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryCgrkddh", entity); + return o; + } + + +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.java new file mode 100644 index 00000000..8dfd22a0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.java @@ -0,0 +1,53 @@ +package com.hzya.frame.u8c.Encapsulation.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * (BdCorp)实体类 + * + * @author makejava + * @since 2023-09-06 14:47:18 + */ +public class EncapsulationEntity extends BaseEntity { + //单据号 + private String code; + //来源单据类型 + private String type; + //公司 + private String unitcode; + //单据类型 + private String cbilltypecode; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCbilltypecode() { + return cbilltypecode; + } + + public void setCbilltypecode(String cbilltypecode) { + this.cbilltypecode = cbilltypecode; + } + + public String getUnitcode() { + return unitcode; + } + + public void setUnitcode(String unitcode) { + this.unitcode = unitcode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.xml b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.xml new file mode 100644 index 00000000..51c91685 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/IEncapsulationService.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/IEncapsulationService.java new file mode 100644 index 00000000..c6605b4a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/IEncapsulationService.java @@ -0,0 +1,104 @@ +package com.hzya.frame.u8c.Encapsulation.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; + +/** + * (BdCorp)表服务接口 + * + * @author makejava + * @since 2023-09-06 14:47:18 + */ +public interface IEncapsulationService extends IBaseService { + /** + * @Author lvleigang + * @Description 采购订单删除接口 + * 0、根据采购订单号查询入库单号,1、库存采购入库单取消签字,2、库存采购入库单删除,3、采购订单弃审,4、采购订单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object purchaseOrderDelete(JSONObject jsonObject); + SysExtensionApiEntity addPurchaseOrderDelete(SysExtensionApiEntity jsonObject); + + /** + * @Author lvleigang + * @Description 采购入库单删除接口 + * 1、库存采购入库单取消签字,2、库存采购入库单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object purchaseWarehousingDelete(JSONObject jsonObject); + SysExtensionApiEntity addPurchaseWarehousingDelete(SysExtensionApiEntity jsonObject); + + /** + * @Author lvleigang + * @Description 销售订单删除接口 + * 0、根据销售钉订单号查询出销售出库单号,1、库存销售出库单取消签字,2、库存销售出库单删除,3、销售订单取消审批,4、销售订单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object salesOrderDelete(JSONObject jsonObject); + SysExtensionApiEntity addSalesOrderDelete(SysExtensionApiEntity jsonObject); + + /** + * @Author lvleigang + * @Description 调拨订单删除接口 + * 0、根据调拨订单号查询调拨入库,调拨出库单据,1、库存调拨出库取消签字 2、库存调拨出库删除 3、调拨入库取消签字 4、调拨入库删除 5、调拨订单弃审 6、调拨订单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object transferOrderDelete(JSONObject jsonObject); + SysExtensionApiEntity addTransferOrderDelete(SysExtensionApiEntity jsonObject); + + /** + * @Author lvleigang + * @Description 产成品入库删除接口 + * 1、库存产成品入库单取消签字 2、库存产成品入库单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object finishedProductsAreStoredDelete(JSONObject jsonObject); + SysExtensionApiEntity addFinishedProductsAreStoredDelete(SysExtensionApiEntity jsonObject); + + /** + * @Author lvleigang + * @Description 材料出库删除接口 + * 1、库存材料出库取消签字 2、库存材料出库单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object materialDeliveryDelete(JSONObject jsonObject); + SysExtensionApiEntity addMaterialDeliveryDelete(SysExtensionApiEntity jsonObject); + + /** + * @Author lvleigang + * @Description 其他出库单删除接口 + * 1、库存其他出库取消签字 2、库存其他出库删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object otherWarehouseOrdersDelete(JSONObject jsonObject); + SysExtensionApiEntity addOtherWarehouseOrdersDelete(SysExtensionApiEntity jsonObject); + + /** + * @Author lvleigang + * @Description 其他入库单删除接口 + * 1、库存其他入库单取消签字. 2、库存其他入库删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object otherWarehouseReceiptDelete(JSONObject jsonObject); + SysExtensionApiEntity addOtherWarehouseReceiptDelete(SysExtensionApiEntity jsonObject); + + +} diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/impl/EncapsulationImpl.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/impl/EncapsulationImpl.java new file mode 100644 index 00000000..9ba924c7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/impl/EncapsulationImpl.java @@ -0,0 +1,1338 @@ +package com.hzya.frame.u8c.Encapsulation.service.impl; + +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao; +import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; +import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.u8c.Encapsulation.dao.IEncapsulationDao; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; +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.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * (BdCorp)表服务实现类 + * + * @author makejava + * @since 2023-09-06 14:47:18 + */ +@Service("encapsulationImpl") +public class EncapsulationImpl extends BaseService implements IEncapsulationService { + + private IEncapsulationDao encapsulationDao; + + @Autowired + public void setEncapsulationDao(IEncapsulationDao dao) { + this.encapsulationDao = dao; + this.dao = dao; + } + @Resource + private ISysApplicationDatabaseDao sysApplicationDatabaseDao; + @Value("${zt.url}") + private String ztUrl; + private final Object lock = new Object(); + + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 采购订单删除接口 8000350080 + * 0、根据采购订单号查询入库单号,1、库存采购入库单取消签字 8000350061,2、库存采购入库单删除 8000350058,3、采购订单弃审 8000350059,4、采购订单删除 8000350056 + * + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object purchaseOrderDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("cgrkqxqz"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("cgrksc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("cgddqs"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单弃审接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("cgddsc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单删除接口编号为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + //根据采购订单号查询入库单号 + EncapsulationEntity encapsulationEntity = new EncapsulationEntity(); + encapsulationEntity.setCode(jsonObject.getString("code")); + encapsulationEntity.setDataSourceCode(jsonObject.getString("dataSourceCode")); + encapsulationEntity.setType("21"); + List encapsulationEntities = encapsulationDao.queryCgrkddh(encapsulationEntity); + if(encapsulationEntities == null || encapsulationEntities.size() != 1){ + returnObject.put("status", "falied"); + returnObject.put("errormsg", "查到多条采购入库单"); + return returnObject; + } + //执行库存采购入库单取消签字接口 + String cgrkdqxqz = getsendBody("1", jsonObject, encapsulationEntities.get(0).getCode(),encapsulationEntities.get(0).getUnitcode()); + boolean cgrkdqxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("cgrkqxqz"), jsonObject.getString("cgrkqxqz").substring(0,6), cgrkdqxqz); + if (!cgrkdqxqzflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单取消签字失败"); + return returnObject; + } + //执行库存采购入库单删除 + String cgrkdsc = getsendBody("2", jsonObject, encapsulationEntities.get(0).getCode(),encapsulationEntities.get(0).getUnitcode()); + boolean cgrkdscfiag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("cgrksc"), jsonObject.getString("cgrksc").substring(0,6), cgrkdsc); + if (!cgrkdscfiag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单删除失败"); + return returnObject; + } + //执行采购订单弃审 + String cgddqs = getsendBody("3", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean cgddqsflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("cgddqs"), jsonObject.getString("cgddqs").substring(0,6), cgddqs); + if (!cgddqsflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单弃审失败"); + return returnObject; + } + //执行采购订单删除 + String cgddsc = getsendBody("4", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean cgddscflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("cgddsc"), jsonObject.getString("cgddsc").substring(0,6), cgddsc); + if (cgddscflag) { + returnObject.put("status", "success"); + returnObject.put("errormsg", "采购订单删除成功"); + return returnObject; + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单删除失败"); + return returnObject; + } + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addPurchaseOrderDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("cgrkqxqz",headers.get("cgrkqxqz")); + jsonObject.put("cgrksc",headers.get("cgrksc")); + jsonObject.put("cgddqs",headers.get("cgddqs")); + jsonObject.put("cgddsc",headers.get("cgddsc")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 采购入库单删除接口 8000350081 + * 1、库存采购入库单取消签字 8000350061,2、库存采购入库单删除 8000350058 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object purchaseWarehousingDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("cgrkqxqz"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("cgrksc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + //执行库存采购入库单取消签字接口 + String cgrkdqxqz = getsendBody("1", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean cgrkdqxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("cgrkqxqz"), jsonObject.getString("cgrkqxqz").substring(0,6), cgrkdqxqz); + if (!cgrkdqxqzflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单取消签字失败"); + return returnObject; + } + + //执行库存采购入库单删除接口 + String cgrkdsc = getsendBody("2", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean cgrkdscfiag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("cgrksc"), jsonObject.getString("cgrksc").substring(0,6), cgrkdsc); + if (cgrkdscfiag) { + returnObject.put("status", "success"); + returnObject.put("errormsg", "采购入库单删除成功"); + return returnObject; + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单删除失败"); + return returnObject; + } + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addPurchaseWarehousingDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("cgrkqxqz",headers.get("cgrkqxqz")); + jsonObject.put("cgrksc",headers.get("cgrksc")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 销售订单删除接口 8000350082 + * 0、根据销售钉订单号查询出销售出库单号,1、库存销售出库单取消签字 8000350062 ,2、库存销售出库单删除 8000350063 ,3、销售订单取消审批 8000350064 ,4、销售订单删除 8000350065,4、oa删除合同 8000340012 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object salesOrderDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("kcxsckqxqz"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("kcxscksc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("xsddqxsp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单取消审批接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("xsddsc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("xsht"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "oa合同删除接口编号为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + //根据销售钉订单号查询出销售出库单号 + EncapsulationEntity encapsulationEntity = new EncapsulationEntity(); + encapsulationEntity.setCode(jsonObject.getString("code")); + encapsulationEntity.setDataSourceCode(jsonObject.getString("dataSourceCode")); + encapsulationEntity.setType("30"); + List encapsulationEntities = encapsulationDao.queryCgrkddh(encapsulationEntity); + if(encapsulationEntities == null || encapsulationEntities.size() != 1){ + returnObject.put("status", "falied"); + returnObject.put("errormsg", "查到多条销售出库单"); + return returnObject; + } + //库存销售出库单取消签字, + String cgrkdqxqz = getsendBody("1", jsonObject, encapsulationEntities.get(0).getCode(), encapsulationEntities.get(0).getUnitcode()); + boolean cgrkdqxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcxsckqxqz"), jsonObject.getString("kcxsckqxqz").substring(0,6), cgrkdqxqz); + if (!cgrkdqxqzflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单取消签字失败"); + return returnObject; + } + //库存销售出库单删除 + String cgrkdsc = getsendBody("2", jsonObject, encapsulationEntities.get(0).getCode(), encapsulationEntities.get(0).getUnitcode()); + boolean cgrkdscfiag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcxscksc"), jsonObject.getString("kcxscksc").substring(0,6), cgrkdsc); + if (!cgrkdscfiag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单删除失败"); + return returnObject; + } + //销售订单取消审批,, + String cgddqs = getsendBody("3", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean cgddqsflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("xsddqxsp"), jsonObject.getString("xsddqxsp").substring(0,6), cgddqs); + if (!cgddqsflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单取消审批失败"); + return returnObject; + } + //销售订单删除 + String cgddsc = getsendBody("4", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean cgddscflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("xsddsc"), jsonObject.getString("xsddsc").substring(0,6), cgddsc); + if (cgddscflag) { + //oa删除合同 + String scht = getsendBody("4", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean schtflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("xsht"), jsonObject.getString("xsht").substring(0,6), scht); + if (schtflag) { + returnObject.put("status", "success"); + returnObject.put("errormsg", "销售订单删除成功"); + return returnObject; + } else { + returnObject.put("status", "success"); + returnObject.put("errormsg", "销售订单删除成功,oa合同删除失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单删除失败"); + return returnObject; + } + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addSalesOrderDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("kcxsckqxqz",headers.get("kcxsckqxqz")); + jsonObject.put("kcxscksc",headers.get("kcxscksc")); + jsonObject.put("xsddqxsp",headers.get("xsddqxsp")); + jsonObject.put("xsddsc",headers.get("xsddsc")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 调拨订单删除接口 8000350083 + * + * 0、根据调拨订单号查询调拨入库,调拨出库单据,1、库存调拨出库取消签字 8000350066 2、库存调拨出库删除 8000350067 + * 3、调拨入库取消签字 8000350068 4、调拨入库删除 8000350069 5、调拨订单弃审 8000350070 6、调拨订单删除 8000350071 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object transferOrderDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("kcdbckqxqz"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存调拨出库取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("kcdbcksc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存调拨出库删除删除接口编号为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("dbrkqxqz"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨入库取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dbrksc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨入库删除接口编号为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("dbddqs"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨订单弃审接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dbddsc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨订单删除接口编号为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + //根据调拨订单号查询调拨入库 + EncapsulationEntity rk = new EncapsulationEntity(); + rk.setCode(jsonObject.getString("code")); + rk.setDataSourceCode(jsonObject.getString("dataSourceCode")); + rk.setCbilltypecode("4E"); + List rklist = encapsulationDao.queryCgrkddh(rk); + if(rklist == null || rklist.size() != 1){ + returnObject.put("status", "falied"); + returnObject.put("errormsg", "查到多条调拨入库单"); + return returnObject; + } + //根据调拨订单号查询调拨出库 + EncapsulationEntity ck = new EncapsulationEntity(); + ck.setCode(jsonObject.getString("code")); + ck.setDataSourceCode(jsonObject.getString("dataSourceCode")); + ck.setCbilltypecode("4Y"); + List cklist = encapsulationDao.queryCgrkddh(ck); + if(cklist == null || cklist.size() != 1){ + returnObject.put("status", "falied"); + returnObject.put("errormsg", "查到多条调拨出库单"); + return returnObject; + } + //调拨入库取消签字 + String dbrk = getsendBody("1", jsonObject, rklist.get(0).getCode(),rklist.get(0).getUnitcode()); + boolean dbrkflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("dbrkqxqz"), jsonObject.getString("dbrkqxqz").substring(0,6), dbrk); + if (!dbrkflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨入库取消签字失败"); + return returnObject; + } + //调拨入库删除 + String dbrksc = getsendBody("2", jsonObject, rklist.get(0).getCode(), rklist.get(0).getUnitcode()); + boolean dbrkscflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("dbrksc"), jsonObject.getString("dbrksc").substring(0,6), dbrksc); + if (!dbrkscflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨入库删除失败"); + return returnObject; + } + //库存调拨出库取消签字 + String dbck = getsendBody("1", jsonObject, cklist.get(0).getCode(), cklist.get(0).getUnitcode()); + boolean dbckflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcdbckqxqz"), jsonObject.getString("kcdbckqxqz").substring(0,6), dbck); + if (!dbckflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存调拨出库取消签字失败"); + return returnObject; + } + //库存调拨出库删除 + String dbcksc = getsendBody("2", jsonObject, cklist.get(0).getCode(), cklist.get(0).getUnitcode()); + boolean dbckscflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcdbcksc"), jsonObject.getString("kcdbcksc").substring(0,6), dbcksc); + if (!dbckscflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存调拨出库删除失败"); + return returnObject; + } + //调拨订单弃审 + String dbdd = getsendBody("3", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean dbddflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("dbddqs"), jsonObject.getString("dbddqs").substring(0,6), dbdd); + if (!dbddflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨订单弃审失败"); + return returnObject; + } + //调拨订单删除 + String dbddsc = getsendBody("4", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean dbddscflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("dbddsc"), jsonObject.getString("dbddsc").substring(0,6), dbddsc); + if (!dbddscflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "调拨订单删除失败"); + return returnObject; + } + + returnObject.put("status", "success"); + returnObject.put("errormsg", "调拨订单删除成功"); + return returnObject; + + + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addTransferOrderDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("kcdbckqxqz",headers.get("kcdbckqxqz")); + jsonObject.put("kcdbcksc",headers.get("kcdbcksc")); + jsonObject.put("dbrkqxqz",headers.get("dbrkqxqz")); + jsonObject.put("dbrksc",headers.get("dbrksc")); + jsonObject.put("dbddqs",headers.get("dbddqs")); + jsonObject.put("dbddsc",headers.get("dbddsc")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 产成品入库删除接口 8000350084 + * 1、库存产成品入库单取消签字 8000350072 2、库存产成品入库单删除 8000350073 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object finishedProductsAreStoredDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("kcccprkqxqz"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存产成品入库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("kcccprksc"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存产成品入库单删除接口编号为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + + //库存产成品入库单取消签字 + String qxqz = getsendBody("1", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean qxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcccprkqxqz"), jsonObject.getString("kcccprkqxqz").substring(0,6), qxqz); + if (!qxqzflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存产成品入库单取消签字失败"); + return returnObject; + } + //库存产成品入库单删除 + String sc = getsendBody("2", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean scflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcccprksc"), jsonObject.getString("kcccprksc").substring(0,6), sc); + if (!scflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存产成品入库单删除失败"); + return returnObject; + } + + returnObject.put("status", "success"); + returnObject.put("errormsg", "库存产成品入库删除成功"); + return returnObject; + + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addFinishedProductsAreStoredDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("kcccprkqxqz",headers.get("kcccprkqxqz")); + jsonObject.put("kcccprksc",headers.get("kcccprksc")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 材料出库删除接口 8000350085 + * 1、库存材料出库取消签字 8000350074 2、库存材料出库单删除 8000350075 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object materialDeliveryDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("qxqzApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存材料出库取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("scApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存材料出库单删除接口编号为空"); + return returnObject; + } + + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + + //库存材料出库取消签字 + String qxqz = getsendBody("1", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean qxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("qxqzApi"), jsonObject.getString("qxqzApi").substring(0,6), qxqz); + if (!qxqzflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存材料出库取消签字失败"); + return returnObject; + } + //库存材料出库单删除 + String sc = getsendBody("2", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean scflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("scApi"), jsonObject.getString("scApi").substring(0,6), sc); + if (!scflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存材料出库单删除失败"); + return returnObject; + } + + returnObject.put("status", "success"); + returnObject.put("errormsg", "库存材料出库删除成功"); + return returnObject; + + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addMaterialDeliveryDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("qxqzApi",headers.get("qxqzApi")); + jsonObject.put("scApi",headers.get("scApi")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 其他出库单删除接口 8000350086 + * 1、库存其他出库取消签字 8000350076 2、库存其他出库删除 8000350077 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object otherWarehouseOrdersDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("qxqzApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他出库取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("scApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他出库删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + + //库存其他出库取消签字 + String qxqz = getsendBody("1", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean qxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("qxqzApi"), jsonObject.getString("qxqzApi").substring(0,6), qxqz); + if (!qxqzflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他出库取消签字失败"); + return returnObject; + } + //库存其他出库删除 + String sc = getsendBody("2", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean scflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("scApi"), jsonObject.getString("scApi").substring(0,6), sc); + if (!scflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他出库删除失败"); + return returnObject; + } + + returnObject.put("status", "success"); + returnObject.put("errormsg", "库存其他出库删除成功"); + return returnObject; + + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addOtherWarehouseOrdersDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("qxqzApi",headers.get("qxqzApi")); + jsonObject.put("scApi",headers.get("scApi")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 其他入库单删除接口 8000350087 + * 1、库存其他入库单取消签字.8000350078 2、库存其他入库删除 8000350079 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object otherWarehouseReceiptDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("qxqzApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他入库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("scApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他入库删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + + //库存其他入库单取消签字 + String qxqz = getsendBody("1", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean qxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("qxqzApi"), jsonObject.getString("qxqzApi").substring(0,6), qxqz); + if (!qxqzflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他入库单取消签字失败"); + return returnObject; + } + //库存其他入库删除 + String sc = getsendBody("2", jsonObject, jsonObject.getString("code"), jsonObject.getString("corp")); + boolean scflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("scApi"), jsonObject.getString("scApi").substring(0,6), sc); + if (!scflag) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存其他入库删除失败"); + return returnObject; + } + returnObject.put("status", "success"); + returnObject.put("errormsg", "库存其他入库删除成功"); + return returnObject; + } + /** + * @param entity + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 数据表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public SysExtensionApiEntity addOtherWarehouseReceiptDelete(SysExtensionApiEntity entity) { + try { + Map headers = entity.getHeaders(); + SysApplicationEntity applicationEntity = entity.getReceiveApp(); + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setDbStatus("1"); + sysApplicationDatabaseEntity.setAppId(applicationEntity.getId()); + sysApplicationDatabaseEntity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(sysApplicationDatabaseEntity); + if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ + String parm = entity.getBodys(); + JSONObject jsonObject = JSONObject.parseObject(parm); + jsonObject.put("dataSourceCode",sysDataSourceEntities.get(0).getSourceCode()); + jsonObject.put("publicKey",entity.getSendApp().getPublicKey()); + jsonObject.put("secretKey",entity.getSendApp().getSecretKey()); + + jsonObject.put("qxqzApi",headers.get("qxqzApi")); + jsonObject.put("scApi",headers.get("scApi")); + entity.setBodys(jsonObject.toJSONString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return entity; + } + + //拼装数据 + private String getsendBody(String type, JSONObject object, String code,String unitcode) { + JSONObject jsonObject1 = new JSONObject(); + + switch (type) { + case "1": //取消签字参数类型1、库存采购入库单取消签字 2\库存销售出库单取消签字 3\库存调拨出库取消签字4\调拨入库取消签字 5\库存产成品入库单取消签字 + //6\库存材料出库取消签字 7\库存其他出库取消签字 8\库存其他入库单取消签字 + JSONObject unsignInfo = new JSONObject(); + unsignInfo.put("coperator", object.getString("coperator")); + + JSONObject queryInfo = new JSONObject(); + queryInfo.put("date_end", object.getString("date_end")); + queryInfo.put("date_begin", object.getString("date_begin")); + queryInfo.put("corp", unitcode); + queryInfo.put("billcode", code); + + jsonObject1.put("unsignInfo", unsignInfo); + jsonObject1.put("queryInfo", queryInfo); + break; + case "2": //删除接口1、库存采购入库单删除 2\库存销售出库单删除 3\库存调拨出库删除 4\调拨入库删除 5\库存产成品入库单删除 + //6\库存材料出库单删除 7\库存其他出库删除 8\库存其他入库删除 + JSONObject unsignInfo2 = new JSONObject(); + unsignInfo2.put("coperator", object.getString("coperator")); + + JSONObject queryInfo2 = new JSONObject(); + queryInfo2.put("date_end", object.getString("date_end")); + queryInfo2.put("date_begin", object.getString("date_begin")); + queryInfo2.put("corp", unitcode); + queryInfo2.put("billcode", code); + + jsonObject1.put("deleteInfo", unsignInfo2); + jsonObject1.put("queryInfo", queryInfo2); + break; + case "3": //弃审 1、采购订单弃审 2\销售订单取消审批 3\调拨订单弃审 + JSONObject unsignInfo3 = new JSONObject(); + unsignInfo3.put("approvid", object.getString("coperator")); + + JSONObject queryInfo3 = new JSONObject(); + queryInfo3.put("date_end", object.getString("date_end")); + queryInfo3.put("date_begin", object.getString("date_begin")); + queryInfo3.put("corp", unitcode); + queryInfo3.put("code", code); + + jsonObject1.put("approveinfo", unsignInfo3); + jsonObject1.put("queryinfo", queryInfo3); + break; + case "4": //删除 1\采购订单删除 2\销售订单删除 3\调拨订单删除 + JSONObject unsignInfo4 = new JSONObject(); + unsignInfo4.put("coperator", object.getString("coperator")); + + JSONObject queryInfo4 = new JSONObject(); + queryInfo4.put("date_end", object.getString("date_end")); + queryInfo4.put("date_begin", object.getString("date_begin")); + queryInfo4.put("corp", unitcode); + queryInfo4.put("code", code); + + jsonObject1.put("deleteinfo", unsignInfo4); + jsonObject1.put("queryinfo", queryInfo4); + break; + case "5": //删除 oa销售合同 + jsonObject1.put("formCode", "formmain_0047"); + jsonObject1.put("fieldName", "field0001"); + jsonObject1.put("fieldValue", code); + break; + default: + } + return jsonObject1.toJSONString(); + } + + /** + * @param publicKey + * @param secretKey + * @param apiCode + * @param appId + * @param bodys + * @return java.lang.String + * @Author lvleigang + * @Description 发送接口 + * @Date 3:05 下午 2024/9/4 + **/ + private boolean sendPost(String publicKey, String secretKey, String apiCode, String appId, String bodys) { + + StringBuilder returnBody = new StringBuilder(); + Integer outTime = 6000; + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpPost post = new HttpPost(ztUrl); + CloseableHttpResponse response = null; + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build(); + post.setConfig(requestConfig);//设置请求参数【超时时间】 + post.setHeader("publicKey", publicKey); + post.setHeader("secretKey", secretKey); + post.setHeader("apiCode", apiCode); + post.setHeader("appId", appId); + + 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) { + returnBody.append(EntityUtils.toString(entity, "UTF-8")); + } + logger.info("返回结果:" + returnBody); + } catch (Exception e) { + logger.error("请求错误:" + e.getMessage()); + returnBody.append(e.getMessage()); + } finally { + try { + // 关闭响应对象 + if (response != null) { + response.close(); + } + // 关闭响应对象 + if (closeableHttpClient != null) { + closeableHttpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + + if (returnBody != null && !"".equals(returnBody)) { + if (JSONUtil.isTypeJSON(returnBody.toString())) { + JSONObject jsonObject1 = JSONObject.parseObject(returnBody.toString()); + if (jsonObject1.getString("status") != null && "200".equals(jsonObject1.getString("status"))) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + +} diff --git a/service/src/main/java/com/hzya/frame/u8c/salesBilling/dao/IU8cSalesBillingDao.java b/service/src/main/java/com/hzya/frame/u8c/salesBilling/dao/IU8cSalesBillingDao.java new file mode 100644 index 00000000..ce8ccd13 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/salesBilling/dao/IU8cSalesBillingDao.java @@ -0,0 +1,20 @@ +package com.hzya.frame.u8c.salesBilling.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.u8c.salesBilling.entity.U8cSalesBillingEntity; + +import java.util.List; + +/** + * 脚本表(u8c_sales_billing: table)表数据库访问层 + * + * @author makejava + * @since 2024-08-02 11:07:43 + */ +public interface IU8cSalesBillingDao extends IBaseDao { + List queryDoSalesBilling(U8cSalesBillingEntity entity); + + int updateDoSalesBilling(U8cSalesBillingEntity entity); +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/salesBilling/dao/impl/U8cSalesBillingDaoImpl.java b/service/src/main/java/com/hzya/frame/u8c/salesBilling/dao/impl/U8cSalesBillingDaoImpl.java new file mode 100644 index 00000000..411317d0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/salesBilling/dao/impl/U8cSalesBillingDaoImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.u8c.salesBilling.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.u8c.salesBilling.dao.IU8cSalesBillingDao; +import com.hzya.frame.u8c.salesBilling.entity.U8cSalesBillingEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository(value = "U8cSalesBillingDaoImpl") +public class U8cSalesBillingDaoImpl extends MybatisGenericDao implements IU8cSalesBillingDao{ + @DS("#entity.dataSourceCode") + @Override + public List queryDoSalesBilling(U8cSalesBillingEntity entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryDoSalesBilling", entity); + return o; + } + + + @DS("#entity.dataSourceCode") + @Override + public int updateDoSalesBilling(U8cSalesBillingEntity entity) { + Integer o = super.update(getSqlIdPrifx() + "updateDoSalesBilling", entity); + return o; + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/salesBilling/entity/U8cSalesBillingEntity.java b/service/src/main/java/com/hzya/frame/u8c/salesBilling/entity/U8cSalesBillingEntity.java new file mode 100644 index 00000000..ff4c1951 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/salesBilling/entity/U8cSalesBillingEntity.java @@ -0,0 +1,111 @@ +package com.hzya.frame.u8c.salesBilling.entity; + + +import com.hzya.frame.web.entity.BaseEntity; + +public class U8cSalesBillingEntity extends BaseEntity { + + /** 单据号 */ + private String code; + /** 公司编码 */ + private String corp; + /** 单据开始日期 */ + private String dateBegin; + /** 单据结束日期 */ + private String dateEnd; + /** 审批人 */ + private String approvid; + /** 审核时间 */ + private String approvedate; + /** 审批状态(Y:通过,N:不通过,R:驳回) */ + private String status; + /** 批语 */ + private String note; + //数据源 + private String dataSourceCode; + //推送状态 Y成功N失败 + private String pushStatus; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCorp() { + return corp; + } + + public void setCorp(String corp) { + this.corp = corp; + } + + public String getDateBegin() { + return dateBegin; + } + + public void setDateBegin(String dateBegin) { + this.dateBegin = dateBegin; + } + + public String getDateEnd() { + return dateEnd; + } + + public void setDateEnd(String dateEnd) { + this.dateEnd = dateEnd; + } + + public String getApprovid() { + return approvid; + } + + public void setApprovid(String approvid) { + this.approvid = approvid; + } + + public String getApprovedate() { + return approvedate; + } + + public void setApprovedate(String approvedate) { + this.approvedate = approvedate; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } + + @Override + public String getDataSourceCode() { + return dataSourceCode; + } + + @Override + public void setDataSourceCode(String dataSourceCode) { + this.dataSourceCode = dataSourceCode; + } + + public String getPushStatus() { + return pushStatus; + } + + public void setPushStatus(String pushStatus) { + this.pushStatus = pushStatus; + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/salesBilling/entity/U8cSalesBillingEntity.xml b/service/src/main/java/com/hzya/frame/u8c/salesBilling/entity/U8cSalesBillingEntity.xml new file mode 100644 index 00000000..65943310 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/salesBilling/entity/U8cSalesBillingEntity.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + update formmain_0049 set + field0044 = #{pushStatus} + where id = #{id} + + + diff --git a/service/src/main/java/com/hzya/frame/u8c/salesBilling/service/IU8cSalesBillingService.java b/service/src/main/java/com/hzya/frame/u8c/salesBilling/service/IU8cSalesBillingService.java new file mode 100644 index 00000000..80b7b9e5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/salesBilling/service/IU8cSalesBillingService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.u8c.salesBilling.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.u8c.salesBilling.entity.U8cSalesBillingEntity; + +import java.util.List; + +public interface IU8cSalesBillingService extends IBaseService { + List queryDoSalesBilling(U8cSalesBillingEntity u8cSalesBillingEntity); + + int updateDoSalesBilling(U8cSalesBillingEntity entity); +} diff --git a/service/src/main/java/com/hzya/frame/u8c/salesBilling/service/impl/U8cSalesBillingServiceImpl.java b/service/src/main/java/com/hzya/frame/u8c/salesBilling/service/impl/U8cSalesBillingServiceImpl.java new file mode 100644 index 00000000..56ea26f8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/salesBilling/service/impl/U8cSalesBillingServiceImpl.java @@ -0,0 +1,35 @@ +package com.hzya.frame.u8c.salesBilling.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.u8c.salesBilling.dao.IU8cSalesBillingDao; +import com.hzya.frame.u8c.salesBilling.entity.U8cSalesBillingEntity; +import com.hzya.frame.u8c.salesBilling.service.IU8cSalesBillingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service(value = "u8cSalesBillingService") +public class U8cSalesBillingServiceImpl extends BaseService implements IU8cSalesBillingService { + + private IU8cSalesBillingDao u8cSalesBillingDao; + + @Autowired + public void setU8cSalesBillingDao(IU8cSalesBillingDao dao) { + this.u8cSalesBillingDao = dao; + this.dao = dao; + } + @Override + public List queryDoSalesBilling(U8cSalesBillingEntity entity) { + List u8cSalesBillingEntityList = u8cSalesBillingDao.queryDoSalesBilling(entity); + return u8cSalesBillingEntityList; + } + + @Override + public int updateDoSalesBilling(U8cSalesBillingEntity entity) { + return u8cSalesBillingDao.updateDoSalesBilling(entity); + } +} diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/dao/ISoSaleDao.java b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/ISoSaleDao.java new file mode 100644 index 00000000..7f7dbdff --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/ISoSaleDao.java @@ -0,0 +1,36 @@ +package com.hzya.frame.u8c.sosale.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8c.sosale.entity.SoSaleEntity; + +import java.util.List; + +/** + * 脚本表(u8c_sales_billing: table)表数据库访问层 + * + * @author makejava + * @since 2024-08-02 11:07:43 + */ +public interface ISoSaleDao extends IBaseDao { +/** + * + * @content 获取U8C主表数据 + * @className: Administrator + * @author laborer + * @date 2024-10-16 15:30 + * + */ + + List getU8cSale(SoSaleEntity entity); +/** + * + * @content 修改推送状态 + * @className: Administrator + * @author laborer + * @date 2024-10-16 16:00 + * + */ + + int updateState(SoSaleEntity sale); +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/dao/ISoSaleLineDao.java b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/ISoSaleLineDao.java new file mode 100644 index 00000000..15647b24 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/ISoSaleLineDao.java @@ -0,0 +1,28 @@ +package com.hzya.frame.u8c.sosale.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8c.sosale.entity.SoSaleEntity; +import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity; + +import java.util.List; + +/** + * 脚本表(u8c_sales_billing: table)表数据库访问层 + * + * @author makejava + * @since 2024-08-02 11:07:43 + */ +public interface ISoSaleLineDao extends IBaseDao { +/** + * + * @content 获取U8C明细数据 + * @className: Administrator + * @author laborer + * @date 2024-10-16 15:52 + * + */ + + List getU8cSaleLine(SoSaleLineEntity line); + +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/dao/impl/SoSaleDaoImpl.java b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/impl/SoSaleDaoImpl.java new file mode 100644 index 00000000..e520ccc9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/impl/SoSaleDaoImpl.java @@ -0,0 +1,32 @@ +package com.hzya.frame.u8c.sosale.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8c.sosale.dao.ISoSaleDao; +import com.hzya.frame.u8c.sosale.entity.SoSaleEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository(value = "SoSaleDaoImpl") +public class SoSaleDaoImpl extends MybatisGenericDao implements ISoSaleDao { +/** + * + * @content 获取UC8C销售订单表头数据 + * @className: Administrator + * @author laborer + * @date 2024-10-16 15:30 + * + */ +@DS("#entity.dataSourceCode") + @Override + public List getU8cSale(SoSaleEntity entity) { + return (List) super.selectList("com.hzya.frame.u8c.sosale.dao.impl.SoSaleDaoImpl.querySaleMain",entity); + } + @DS("#entity.dataSourceCode") + @Override + public int updateState(SoSaleEntity entity) { + return super.update("com.hzya.frame.u8c.sosale.dao.impl.SoSaleDaoImpl.updateState",entity); + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/dao/impl/SoSaleLineDaoImpl.java b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/impl/SoSaleLineDaoImpl.java new file mode 100644 index 00000000..9ae963fc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/dao/impl/SoSaleLineDaoImpl.java @@ -0,0 +1,21 @@ +package com.hzya.frame.u8c.sosale.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8c.sosale.dao.ISoSaleDao; +import com.hzya.frame.u8c.sosale.dao.ISoSaleLineDao; +import com.hzya.frame.u8c.sosale.entity.SoSaleEntity; +import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository(value = "SoSaleLineDaoImpl") +public class SoSaleLineDaoImpl extends MybatisGenericDao implements ISoSaleLineDao { + @DS("#entity.dataSourceCode") + @Override + public List getU8cSaleLine(SoSaleLineEntity entity) { + return (List) super.selectList("com.hzya.frame.u8c.sosale.dao.impl.SoSaleLineDaoImpl.querySaleLine", entity); + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleEntity.java b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleEntity.java new file mode 100644 index 00000000..ea5ea748 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleEntity.java @@ -0,0 +1,245 @@ +package com.hzya.frame.u8c.sosale.entity; + + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +public class SoSaleEntity extends BaseEntity { + private String csaleId;//销售订单主表ID + private String billCode;//单据编号 + private String state; + private String vreceiptcode;// 单据编号 + private String user_code; // 审核人编码 + private String user_name; // 审核人名称 + private String dapprovedate; // 审核日期 + private String custcode;// 客户编码 + private String custname;// 客户名称 + private String vsalestrucode;// 销售组织编码 + private String vsalestruname;// 销售组织名称 + private String bodycode; // 库存组织编码 + private String bodyname; // 库存组织名称 + private String creceiptcustomerid ;// 收货单位 + private String shcode;// 收货单位编码 + private String shname;// 收货单位名称 + private String creceiptcorpid ;// 开票单位 + private String kpcode;// 开票单位编码 + private String kpname;// 开票单位名称 + private String ctransmodeid;// 运输方式 + private String busicode;//业务类型编码 + private String businame;//业务类型名称 + private String vnote;// 备注 + private String unitname;// + private String unitcode;// + + public String getUnitname() { + return unitname; + } + + public void setUnitname(String unitname) { + this.unitname = unitname; + } + + public String getUnitcode() { + return unitcode; + } + + public void setUnitcode(String unitcode) { + this.unitcode = unitcode; + } + + public String getVreceiptcode() { + return vreceiptcode; + } + + public void setVreceiptcode(String vreceiptcode) { + this.vreceiptcode = vreceiptcode; + } + + public String getUser_code() { + return user_code; + } + + public void setUser_code(String user_code) { + this.user_code = user_code; + } + + public String getUser_name() { + return user_name; + } + + public void setUser_name(String user_name) { + this.user_name = user_name; + } + + public String getDapprovedate() { + return dapprovedate; + } + + public void setDapprovedate(String dapprovedate) { + this.dapprovedate = dapprovedate; + } + + public String getCustcode() { + return custcode; + } + + public void setCustcode(String custcode) { + this.custcode = custcode; + } + + public String getCustname() { + return custname; + } + + public void setCustname(String custname) { + this.custname = custname; + } + + public String getVsalestrucode() { + return vsalestrucode; + } + + public void setVsalestrucode(String vsalestrucode) { + this.vsalestrucode = vsalestrucode; + } + + public String getVsalestruname() { + return vsalestruname; + } + + public void setVsalestruname(String vsalestruname) { + this.vsalestruname = vsalestruname; + } + + public String getBodycode() { + return bodycode; + } + + public void setBodycode(String bodycode) { + this.bodycode = bodycode; + } + + public String getBodyname() { + return bodyname; + } + + public void setBodyname(String bodyname) { + this.bodyname = bodyname; + } + + public String getCreceiptcustomerid() { + return creceiptcustomerid; + } + + public void setCreceiptcustomerid(String creceiptcustomerid) { + this.creceiptcustomerid = creceiptcustomerid; + } + + public String getShcode() { + return shcode; + } + + public void setShcode(String shcode) { + this.shcode = shcode; + } + + public String getShname() { + return shname; + } + + public void setShname(String shname) { + this.shname = shname; + } + + public String getCreceiptcorpid() { + return creceiptcorpid; + } + + public void setCreceiptcorpid(String creceiptcorpid) { + this.creceiptcorpid = creceiptcorpid; + } + + public String getKpcode() { + return kpcode; + } + + public void setKpcode(String kpcode) { + this.kpcode = kpcode; + } + + public String getKpname() { + return kpname; + } + + public void setKpname(String kpname) { + this.kpname = kpname; + } + + public String getCtransmodeid() { + return ctransmodeid; + } + + public void setCtransmodeid(String ctransmodeid) { + this.ctransmodeid = ctransmodeid; + } + + public String getBusicode() { + return busicode; + } + + public void setBusicode(String busicode) { + this.busicode = busicode; + } + + public String getBusiname() { + return businame; + } + + public void setBusiname(String businame) { + this.businame = businame; + } + + public String getVnote() { + return vnote; + } + + public void setVnote(String vnote) { + this.vnote = vnote; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + private ListsaleLineList; + + public List getSaleLineList() { + return saleLineList; + } + + public void setSaleLineList(List saleLineList) { + this.saleLineList = saleLineList; + } + + public String getCsaleId() { + return csaleId; + } + + public void setCsaleId(String csaleId) { + this.csaleId = csaleId; + } + + public String getBillCode() { + return billCode; + } + + public void setBillCode(String billCode) { + this.billCode = billCode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleEntity.xml b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleEntity.xml new file mode 100644 index 00000000..c709d6dd --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleEntity.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update so_sale set + vdef1 = #{state} + where csaleid = #{csaleId} + + + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleLineEntity.java b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleLineEntity.java new file mode 100644 index 00000000..10cc9da9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleLineEntity.java @@ -0,0 +1,143 @@ +package com.hzya.frame.u8c.sosale.entity; + + +import com.hzya.frame.web.entity.BaseEntity; + +public class SoSaleLineEntity extends BaseEntity { + private String csaleId;//销售订单主表ID + private String cinvbasdocid; + private String invcode; + private String invname; + private String invspec; + private String invtype; + private String measname ; + private String nnumber;// 数量 + private String noriginalcurprice;// 无税单价 + private String ntaxrate; // 税率 + private String noriginalcurtaxprice; // 含税单价 + private String noriginalcurmny; // 无税金额 + private String noriginalcursummny; // 价税合计 + private String blargessflag; // 是否赠品 + private String frownote; + + public String getCinvbasdocid() { + return cinvbasdocid; + } + + public void setCinvbasdocid(String cinvbasdocid) { + this.cinvbasdocid = cinvbasdocid; + } + + public String getInvcode() { + return invcode; + } + + public void setInvcode(String invcode) { + this.invcode = invcode; + } + + public String getInvname() { + return invname; + } + + public void setInvname(String invname) { + this.invname = invname; + } + + public String getInvspec() { + return invspec; + } + + public void setInvspec(String invspec) { + this.invspec = invspec; + } + + public String getInvtype() { + return invtype; + } + + public void setInvtype(String invtype) { + this.invtype = invtype; + } + + public String getMeasname() { + return measname; + } + + public void setMeasname(String measname) { + this.measname = measname; + } + + public String getNnumber() { + return nnumber; + } + + public void setNnumber(String nnumber) { + this.nnumber = nnumber; + } + + public String getNoriginalcurprice() { + return noriginalcurprice; + } + + public void setNoriginalcurprice(String noriginalcurprice) { + this.noriginalcurprice = noriginalcurprice; + } + + public String getNtaxrate() { + return ntaxrate; + } + + public void setNtaxrate(String ntaxrate) { + this.ntaxrate = ntaxrate; + } + + public String getNoriginalcurtaxprice() { + return noriginalcurtaxprice; + } + + public void setNoriginalcurtaxprice(String noriginalcurtaxprice) { + this.noriginalcurtaxprice = noriginalcurtaxprice; + } + + public String getNoriginalcurmny() { + return noriginalcurmny; + } + + public void setNoriginalcurmny(String noriginalcurmny) { + this.noriginalcurmny = noriginalcurmny; + } + + public String getNoriginalcursummny() { + return noriginalcursummny; + } + + public void setNoriginalcursummny(String noriginalcursummny) { + this.noriginalcursummny = noriginalcursummny; + } + + public String getBlargessflag() { + return blargessflag; + } + + public void setBlargessflag(String blargessflag) { + this.blargessflag = blargessflag; + } + + public String getFrownote() { + return frownote; + } + + public void setFrownote(String frownote) { + this.frownote = frownote; + } + + public String getCsaleId() { + return csaleId; + } + + public void setCsaleId(String csaleId) { + this.csaleId = csaleId; + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleLineEntity.xml b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleLineEntity.xml new file mode 100644 index 00000000..cd8f39aa --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/entity/SoSaleLineEntity.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/service/ISoSaleService.java b/service/src/main/java/com/hzya/frame/u8c/sosale/service/ISoSaleService.java new file mode 100644 index 00000000..63002409 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/service/ISoSaleService.java @@ -0,0 +1,22 @@ +package com.hzya.frame.u8c.sosale.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8c.sosale.entity.SoSaleEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +import java.util.List; + +public interface ISoSaleService extends IBaseService { + +/** + * + * @content 获取U8C销售订单同步OA销售合同 + * @className: Administrator + * @author laborer + * @date 2024-10-16 15:22 + * + */ + + JsonResultEntity getU8cSaleToOa(JSONObject requestJson); +} diff --git a/service/src/main/java/com/hzya/frame/u8c/sosale/service/impl/SoSaleServiceImpl.java b/service/src/main/java/com/hzya/frame/u8c/sosale/service/impl/SoSaleServiceImpl.java new file mode 100644 index 00000000..b2ea2c04 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/sosale/service/impl/SoSaleServiceImpl.java @@ -0,0 +1,333 @@ +package com.hzya.frame.u8c.sosale.service.impl; + +import cn.hutool.core.lang.UUID; +import cn.hutool.core.util.StrUtil; +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.bip.v3.v2207.util.BipUtil; +import com.hzya.frame.seeyon.util.RestUtil; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.u8c.sosale.dao.ISoSaleDao; +import com.hzya.frame.u8c.sosale.dao.ISoSaleLineDao; +import com.hzya.frame.u8c.sosale.entity.SoSaleEntity; +import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity; +import com.hzya.frame.u8c.sosale.service.ISoSaleService; +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.Date; +import java.util.List; + +@Service(value = "SoSaleServiceImpl") +public class SoSaleServiceImpl extends BaseService implements ISoSaleService { + Logger logger = LoggerFactory.getLogger(SoSaleServiceImpl.class); + @Autowired + private ISoSaleDao u8cSaleDao; + @Autowired + private ISoSaleLineDao saleLineDao; + @Autowired + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + + /** + * + * @content 获取U8C销售订单同步OA销售合同 + * @className: Administrator + * @author laborer + * @date 2024-10-16 15:22 + * + */ + @Override + public JsonResultEntity getU8cSaleToOa(JSONObject requestJson) { + + //获取重推信息id,并记录日志 + JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); + String interId = requestJsonObj.getString("integration_task_living_details_id"); + logger.info("U8C销售订单推送OA重推解析后:"+requestJsonObj.toString()); + logger.info("U8C销售订单推送OA重新执行的任务主键:"+interId); + + //更换数据源 + JsonResultEntity resultEntity = new JsonResultEntity(); + SoSaleEntity entity = new SoSaleEntity(); + requestJson.put("db_code","dongjinU8C"); + entity.setDataSourceCode(requestJson.getString("db_code")); + + //根据重推信息id,查询该条重推记录信息 + IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity(); + if(StrUtil.isNotEmpty(interId)){ + oldMsg = taskLivingDetailsService.get(interId); + } + String rootAppPk = oldMsg.getRootAppPk(); + entity.setId(rootAppPk); + StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询"); +//如果是重推,是否通过entity传入的id,只能查到一条数据。 + //entity.setId("-8845102890648320822"); + List soleList = u8cSaleDao.getU8cSale(entity); + logger.info("销售订单查询数据{}",JSONObject.toJSONString(soleList)); + if(CollectionUtils.isNotEmpty(soleList)){ + soleList.forEach(sale -> { + try{ + //获取明细数据进行拼接 + String csaleId = sale.getCsaleId(); + if(!StrUtil.isEmpty(csaleId)){ + SoSaleLineEntity line = new SoSaleLineEntity(); + line.setCsaleId(csaleId); + line.setDataSourceCode(requestJson.getString("db_code")); + List lineList = saleLineDao.getU8cSaleLine(line); + logger.info("销售订单明细查询数据{}",JSONObject.toJSONString(lineList)); + sale.setSaleLineList(lineList); + logger.info("组装数据"); + JSONObject main = bindingAdd(sale); + logger.info("销售订单推送数据:"+main.toString()); + String result = RestUtil.sendU8CToOA(main.toString(),"8000340003",sale.getUser_code()); + logger.info("销售订单推送结果:"+result); + IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); + logDetails.setRootAppPk(sale.getCsaleId()); + logDetails.setRootAppBill(sale.getBillCode()); + logDetails.setNewTransmitInfo(result); + logDetails.setNewPushDate(new Date()); + logDetails.setRootAppNewData(JSON.toJSONString(sale)); + logDetails.setPluginId("SaleConPlugin"); + + JSONObject resultObj = JSON.parseObject(result); + boolean flag = resultObj.getString("code").equals("0"); + if(flag){ + // 推送成功,更新状态 + sale.setState("Y"); + }else{ + // 推送失败 + sale.setState("N"); + } + sale.setDataSourceCode(requestJson.getString("db_code")); + try{ + if(StrUtil.isEmpty(interId)){ + if(flag){ + //首推成功 + taskLivingDetailsService.saveLogToSuccess(logDetails); + }else{ + //首推失败 + taskLivingDetailsService.saveLogToFail(logDetails); + } + }else{ + logDetails.setId(interId); + if(flag){ + //重推成功 + taskLivingDetailsService.saveLogFailToSuccess(logDetails); + }else{ + //重推失败,把失败信息,更新到重推表中 + taskLivingDetailsService.updateLogFailToSuccess(logDetails); + } + } + }catch (Exception e){ + logger.info("保存日志失败"+e.getMessage()); + u8cSaleDao.updateState(sale); + e.printStackTrace(); + } + u8cSaleDao.updateState(sale); + } + } catch (Exception e) { + logger.info("销售订单执行失败"+e.getMessage()); + e.printStackTrace(); + } + }); + + } + return new JsonResultEntity("成功",true,resultEntity); + } +/** + * + * @content 组装销售订单数据 + * @className: Administrator + * @author laborer + * @date 2024-10-16 15:34 + * + */ + + private JSONObject bindingAdd(SoSaleEntity rec) { + JSONObject main = new JSONObject(); + main.put("formCode","formmain_0047"); +// main.put("loginName",rec.getUser_code()); + main.put("loginName","yuqh"); + main.put("rightId","-8974880151631871438.3094438342688065626"); + JSONArray dataList = new JSONArray(); + JSONObject dataListObj = new JSONObject(); + + JSONObject masterTable = new JSONObject(); + JSONArray subTables = new JSONArray(); + dataListObj.put("masterTable", masterTable); + masterTable.put("name","formmain_0047"); + JSONObject record = new JSONObject(); + record.put("id", UUID.randomUUID().getMostSignificantBits()); + JSONArray fields = new JSONArray(); + JSONObject field0001 = new JSONObject();//单据号 + field0001.put("showValue",rec.getBillCode()); + field0001.put("name","field0001"); + field0001.put("value",rec.getBillCode()); + fields.add(field0001); + + JSONObject field0004 = new JSONObject();//单据日期 + field0004.put("showValue",rec.getDapprovedate()); + field0004.put("name","field0004"); + field0004.put("value",rec.getDapprovedate()); + fields.add(field0004); + + JSONObject field0033 = new JSONObject();//合同编号 + field0033.put("showValue",rec.getBillCode()); + field0033.put("name","field0033"); + field0033.put("value",rec.getBillCode()); + fields.add(field0033); + + JSONObject field0014 = new JSONObject();//客户名称 + field0014.put("showValue",rec.getCustname()); + field0014.put("name","field0014"); + field0014.put("value",rec.getBillCode()); + fields.add(field0014); + + JSONObject field0045 = new JSONObject();//客户编码 + field0045.put("showValue",rec.getCustcode()); + field0045.put("name","field0045"); + field0045.put("value",rec.getCustcode()); + fields.add(field0045); + + JSONObject field0005 = new JSONObject();//销售组织 + field0005.put("showValue",rec.getVsalestruname()); + field0005.put("name","field0005"); + field0005.put("value",rec.getBillCode()); + fields.add(field0005); + + JSONObject field0006 = new JSONObject();//库存组织 + field0006.put("showValue",rec.getBodyname()); + field0006.put("name","field0006"); + field0006.put("value",rec.getBodyname()); + fields.add(field0006); + + JSONObject field0007 = new JSONObject();//收货单位 + field0007.put("showValue",rec.getShname()); + field0007.put("name","field0007"); + field0007.put("value",rec.getShname()); + fields.add(field0007); + + JSONObject field0009 = new JSONObject();//开票单位 + field0009.put("showValue",rec.getKpname()); + field0009.put("name","field0009"); + field0009.put("value",rec.getKpname()); + fields.add(field0009); + + JSONObject field0013 = new JSONObject();//业务流程 + field0013.put("showValue",rec.getBusiname()); + field0013.put("name","field0013"); + field0013.put("value",rec.getBusiname()); + fields.add(field0013); + + JSONObject field0018 = new JSONObject();//备注 + field0018.put("showValue",rec.getVnote()); + field0018.put("name","field0018"); + field0018.put("value",rec.getVnote()); + fields.add(field0018); + + record.put("fields",fields); + masterTable.put("record",record); + JSONArray records = new JSONArray(); + JSONObject subTablesObj = new JSONObject(); + + if(CollectionUtils.isNotEmpty(rec.getSaleLineList())){ + rec.getSaleLineList().forEach(line->{ + JSONObject body = new JSONObject(); + body.put("id",UUID.randomUUID().getMostSignificantBits()); + JSONArray bodyDetails = new JSONArray(); + JSONObject field0020 = new JSONObject();//存货编号 + field0020.put("showValue",line.getInvcode()); + field0020.put("name","field0020"); + field0020.put("value",line.getInvcode()); + bodyDetails.add(field0020); + JSONObject field0021 = new JSONObject();//存货名称 + field0021.put("showValue",line.getInvname()); + field0021.put("name","field0021"); + field0021.put("value",line.getInvname()); + bodyDetails.add(field0021); + + JSONObject field0022 = new JSONObject();//规格 + field0022.put("showValue",line.getInvspec()); + field0022.put("name","field0022"); + field0022.put("value",line.getInvspec()); + bodyDetails.add(field0022); + + JSONObject field0023 = new JSONObject();//型号 + field0023.put("showValue",line.getInvtype()); + field0023.put("name","field0023"); + field0023.put("value",line.getInvtype()); + bodyDetails.add(field0023); + + JSONObject field0024 = new JSONObject();//单位 + field0024.put("showValue",line.getMeasname()); + field0024.put("name","field0024"); + field0024.put("value",line.getMeasname()); + bodyDetails.add(field0024); + + JSONObject field0025 = new JSONObject();//数量 + field0025.put("showValue",line.getNnumber()); + field0025.put("name","field0025"); + field0025.put("value",line.getNnumber()); + bodyDetails.add(field0025); + + JSONObject field0026 = new JSONObject();//无税单价 + field0026.put("showValue",line.getNoriginalcurprice()); + field0026.put("name","field0026"); + field0026.put("value",line.getNoriginalcurprice()); + bodyDetails.add(field0026); + + JSONObject field0027 = new JSONObject();//税率 + field0027.put("showValue",line.getNtaxrate()); + field0027.put("name","field0027"); + field0027.put("value",line.getNtaxrate()); + bodyDetails.add(field0027); + + JSONObject field0028 = new JSONObject();//含税单价 + field0028.put("showValue",line.getNoriginalcurtaxprice()); + field0028.put("name","field0028"); + field0028.put("value",line.getNoriginalcurtaxprice()); + bodyDetails.add(field0028); + + JSONObject field0029 = new JSONObject();//无税金额 + field0029.put("showValue",line.getNoriginalcurmny()); + field0029.put("name","field0029"); + field0029.put("value",line.getNoriginalcurmny()); + bodyDetails.add(field0029); + + JSONObject field0030 = new JSONObject();//价税合计 + field0030.put("showValue",line.getNoriginalcursummny()); + field0030.put("name","field0030"); + field0030.put("value",line.getNoriginalcursummny()); + bodyDetails.add(field0030); + + JSONObject field0031 = new JSONObject();//是否赠品 + field0031.put("showValue",line.getBlargessflag()); + field0031.put("name","field0031"); + field0031.put("value",line.getBlargessflag()); + bodyDetails.add(field0031); + + JSONObject field0032 = new JSONObject();//合同编号 + field0032.put("showValue",line.getFrownote()); + field0032.put("name","field0032"); + field0032.put("value",line.getFrownote()); + bodyDetails.add(field0032); + body.put("fields",bodyDetails); + records.add(body); + + }); + subTablesObj.put("records",records); + subTablesObj.put("name","formson_0048"); + subTables.add(subTablesObj); + } + dataListObj.put("subTables", subTables); + dataList.add(dataListObj); + main.put("dataList",dataList); + return main; + } +} diff --git a/service/src/test/java/com/hzya/frame/Tetst01.java b/service/src/test/java/com/hzya/frame/Tetst01.java index 28ac6e3e..6b874fae 100644 --- a/service/src/test/java/com/hzya/frame/Tetst01.java +++ b/service/src/test/java/com/hzya/frame/Tetst01.java @@ -1,10 +1,15 @@ package com.hzya.frame; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.ningboBankTreasury.dto.res.AccTrxResponse; +import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; -import javax.annotation.Resource; +import java.util.List; /** @@ -16,4 +21,102 @@ import javax.annotation.Resource; public class Tetst01 { + //产品号 + private static String productID = "tmsReport"; + //服务号 + private static String serviceID = "queryAccDetail"; + + @Test + public void trxParseTest(){ + String str = "{\n" + + " \"Data\": {\n" + + " \"retCode\": \"0000\",\n" + + " \"retMsg\": \"查询成功\",\n" + + " \"pageSize\": \"50\",\n" + + " \"currentPage\": \"1\",\n" + + " \"totalPage\": \"1\",\n" + + " \"totalSize\": \"4\",\n" + + " \"list\": [{\n" + + " \"bankAcc\": \"53170122000051772\",\n" + + " \"bankSubAcc\": \"\",\n" + + " \"accName\": \"宁波富市智梵织焦投资有限公司\",\n" + + " \"bankName\": \"宁波银行股份有限公司江北支行\",\n" + + " \"oppAccNo\": \"\",\n" + + " \"oppAccBank\": \"\",\n" + + " \"cdSign\": \"0\",\n" + + " \"cdSignName\": \"收\",\n" + + " \"amt\": \"999999.00\",\n" + + " \"bal\": \"51643875.40\",\n" + + " \"transTime\": \"2024-05-04 09:13:18\",\n" + + " \"subSerialNo\": \"3200000021\",\n" + + " \"serialNo\": \"\",\n" + + " \"curCode\": \"01\",\n" + + " \"uses\": \"\",\n" + + " \"abs\": \"现金存入\",\n" + + " \"voucherNo\": \"12405044020000446120240504\",\n" + + " \"bifCode\": \"9038\",\n" + + " \"bankType\": \"宁波银行\",\n" + + " \"oppBankType\": \"\",\n" + + " \"isForIndividual\": \"0\",\n" + + " \"serialId\": \"445439D1462C3600F9235B9C2BEF48E6\",\n" + + " \"bankSerialId\": \"124050440200004461\",\n" + + " \"groupTrans\": \"否\",\n" + + " \"capitalTrans\": \"否\",\n" + + " \"postScript\": \"\",\n" + + " \"accType\": \"\",\n" + + " \"accTypeName\": \"\",\n" + + " \"cashTfrFlg\": \"现金\",\n" + + " \"chinaDevelopBankNo\": \"\",\n" + + " \"chinaDevelopAccType\": \"\",\n" + + " \"payBillCode\": \"\",\n" + + " \"alipayBaseOrderNumber\": \"\",\n" + + " \"alipayBusinessDescription\": \"\",\n" + + " \"labelValue1\": \"\",\n" + + " \"labelValue2\": \"\",\n" + + " \"labelValue3\": \"\",\n" + + " \"labelValue4\": \"\",\n" + + " \"downloadNo\": \"\",\n" + + " \"sortRule\": \"202405043200000021202405040000647193\",\n" + + " \"orderNo\": \"202405040000647193\",\n" + + " \"alipayTradeName\": \"\",\n" + + " \"matchCode\": \"5317012200005177220240504999999.0012405044020000446120240504\",\n" + + " \"receiptInfo\": \"\",\n" + + " \"billNum\": \"\",\n" + + " \"recTime\": \"2024-05-04 09:48:47\"\n" + + " }]\n" + + " }\n" + + "}"; + AccTrxResponse accTrxResponse = AccTrxResponse.valueOf(str); + System.out.println("1111"); + } + /** + * 宁波银行交易明细 + */ + @Test + public void queryAccDetail(){ + JSONObject jsonObject = new JSONObject(); + JSONObject data = new JSONObject(); + data.put("custId", "0000070401");//客户号 + List strs = (List) Convert.toList("123456"); + JSONArray jsonArray = new JSONArray(); + for(String str :strs){ + str = StringUtils.deleteWhitespace(str); + jsonArray.add(str); + } + data.put("bankAccList", jsonArray); + data.put("beginDate", DateUtil.today());//开始日期 + data.put("endDate", DateUtil.today());//结束日期 + data.put("pageSize", "1000");//每页条数 + data.put("currentPage", 1);//当前页数 + data.put("queryType", "0");//查询方式0-分页查询 + data.put("cdSign","0");//收支方向,0收入1支出 + jsonObject.put("Data", data); + String param = jsonObject.toString(); + System.out.println(param); + try { + //String res = OpenSDK.send(productID, serviceID, jsonObject.toJSONString()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } } diff --git a/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java b/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java index 46af2a3c..01be7c99 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java @@ -128,8 +128,8 @@ public class EntranceServiceImpl implements IEntranceService { //} // 接口权限验证 结束 } catch (NotLoginException e) { - logger.error("token无效"); - return BaseResult.getFailureMessageEntity("token无效"); + logger.error("zt-token无效"); + return BaseResult.getFailureMessageEntity("zt-token无效"); } } JSONObject jsonObject = new JSONObject(); @@ -183,10 +183,10 @@ public class EntranceServiceImpl implements IEntranceService { Method[] methods = object.getClass().getMethods(); logger.info("methodsLength:" + methods.length); if (methods == null || methods.length == 0) { - logger.info("当前methods:" + methods + "methodsLength = " + methods.length); + logger.error("当前methods:" + methods + "methodsLength = " + methods.length); throw new BaseSystemException(service + "未找到" + serviceMethod + "方法"); } else { - logger.info("当前methods222222:" + methods + "methodsLength = " + methods.length); + logger.info("当前methods:" + methods + "methodsLength = " + methods.length); } for (Method m : methods) { //logger.info("当前mnAME:" + m.getName() + " :serviceMethod = " + serviceMethod.trim()); @@ -271,10 +271,10 @@ public class EntranceServiceImpl implements IEntranceService { Method[] methods = object.getClass().getMethods(); logger.info("methodsLength:" + methods.length); if (methods == null || methods.length == 0) { - logger.info("当前methods:" + methods + "methodsLength = " + methods.length); + logger.error("当前methods:" + methods + "methodsLength = " + methods.length); return BaseResult.getFailureMessageEntity(service + "未找到" + serviceMethod + "方法"); } else { - logger.error("当前methods2:" + methods + "methodsLength = " + methods.length); + logger.info("当前methods:" + methods + "methodsLength = " + methods.length); } for (Method m : methods) { //logger.info("当前mnAME:" + m.getName() + " :serviceMethod = " + serviceMethod.trim()); diff --git a/webapp/src/main/java/com/hzya/frame/webapp/web/exception/ExceptionController.java b/webapp/src/main/java/com/hzya/frame/webapp/web/exception/ExceptionController.java index 3e966cf1..6488d4fd 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/web/exception/ExceptionController.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/web/exception/ExceptionController.java @@ -63,13 +63,13 @@ public class ExceptionController { if (notLoginException.getType().equals(NotLoginException.NOT_TOKEN)) { message = "未提供token"; } else if (notLoginException.getType().equals(NotLoginException.INVALID_TOKEN)) { - message = "token无效"; + message = "zt-token无效"; } else if (notLoginException.getType().equals(NotLoginException.TOKEN_TIMEOUT)) { - message = "token已过期"; + message = "zt-token已过期"; } else if (notLoginException.getType().equals(NotLoginException.BE_REPLACED)) { - message = "token已被顶下线"; + message = "zt-token已被顶下线"; } else if (notLoginException.getType().equals(NotLoginException.KICK_OUT)) { - message = "token已被踢下线"; + message = "zt-token已被踢下线"; } else { message = "当前会话未登录"; } diff --git a/webapp/src/main/java/com/hzya/frame/webapp/web/filter/SaTokenConfigure.java b/webapp/src/main/java/com/hzya/frame/webapp/web/filter/SaTokenConfigure.java index b325e29f..3411d439 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/web/filter/SaTokenConfigure.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/web/filter/SaTokenConfigure.java @@ -18,7 +18,7 @@ public class SaTokenConfigure { @Primary public SaTokenConfig getSaTokenConfigPrimary() { SaTokenConfig config = new SaTokenConfig(); - config.setTokenName("token"); // token名称 (同时也是cookie名称) + config.setTokenName("zt-token"); // token名称 (同时也是cookie名称) config.setTimeout(30 * 24 * 60 * 60); // token有效期,单位s 默认30天 config.setActivityTimeout(-1); // token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 config.setIsConcurrent(true); // 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)