diff --git a/buildpackage/pom.xml b/buildpackage/pom.xml index 8feb8f73..338977d9 100644 --- a/buildpackage/pom.xml +++ b/buildpackage/pom.xml @@ -37,7 +37,7 @@ - kangarooDataCenterV3 + kangarooDataCenter diff --git a/buildpackage/src/main/resources/application.properties b/buildpackage/src/main/resources/application.properties index 0e2cc4b2..a84ef232 100644 --- a/buildpackage/src/main/resources/application.properties +++ b/buildpackage/src/main/resources/application.properties @@ -1,11 +1,11 @@ #应用名 -spring.application.name=kangarooDataCenterV3 +spring.application.name=kangarooDataCenter #端口 server.port=9999 #编码集 server.tomcat.uri-encoding=utf-8 #工程访问名称 -server.servlet.context-path=/kangarooDataCenterV3 +server.servlet.context-path=/kangarooDataCenter #json日期格式化 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.time-zone=GMT+8 diff --git a/common/src/main/java/com/hzya/frame/basedao/service/impl/GeneralServiceImpl.java b/common/src/main/java/com/hzya/frame/basedao/service/impl/GeneralServiceImpl.java index c6d6c6f9..5c28922d 100644 --- a/common/src/main/java/com/hzya/frame/basedao/service/impl/GeneralServiceImpl.java +++ b/common/src/main/java/com/hzya/frame/basedao/service/impl/GeneralServiceImpl.java @@ -637,10 +637,7 @@ public class GeneralServiceImpl implements GeneralService { @Override public JsonResultEntity selectDictionaryshop(JSONObject object) { //校验数据(只校验表名称) - if (!checkStr(object.getString("tableName"))) { - return BaseResult.getFailureMessageEntity("表名不存在"); - } - String tablename = object.getString("tableName"); + String tablename = "sys_dictionaryshop_new"; JSONObject jsonObject = object.getJSONObject("jsonStr"); List whereCriteria = new ArrayList<>(); whereCriteria.add(new WhereCriterion("(", "sts", ConditionType.等于.getValue(), "Y", ")", ConnectType.AND)); diff --git a/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java b/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java index 83ad0318..468e0c3c 100644 --- a/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java +++ b/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java @@ -61,7 +61,7 @@ public class ExecSqlServiceImpl implements IExecSqlService { logger.info("=============execSelectSql方法要执行的sql:============" + select_sql); if (!select_sql.contains("update") && !select_sql.contains("delete") && !select_sql.contains("insert") && !select_sql.contains("create")) { - list = sqlSession.selectList("com.hzya.frame.sys.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql", entity); + list = sqlSession.selectList("com.hzya.frame.sysnew.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql", entity); logger.info("===========execSelectSql方法返回的结果条数=============" + list.size()); } //sqlSession.close(); @@ -87,7 +87,7 @@ public class ExecSqlServiceImpl implements IExecSqlService { logger.info("=============execUpdateSql方法要执行的sql:============" + sql); ExecSqlEntity entity = new ExecSqlEntity(); entity.setSql(sql); - int result = sqlSession.update("com.hzya.frame.sys.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_update", entity); + int result = sqlSession.update("com.hzya.frame.sysnew.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_update", entity); logger.info("update受影响行数:" + result); //sqlSession.close(); return result; @@ -117,7 +117,7 @@ public class ExecSqlServiceImpl implements IExecSqlService { logger.info("=============execInsertSql方法要执行的sql:============" + sql); ExecSqlEntity entity = new ExecSqlEntity(); entity.setSql(sql); - int result = sqlSession.insert("com.hzya.frame.sys.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_insert", entity); + int result = sqlSession.insert("com.hzya.frame.sysnew.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql_insert", entity); logger.info("insert受影响行数:" + result); //sqlSession.close(); return result; diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDao.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDao.java new file mode 100644 index 00000000..0ad05a4c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDao.java @@ -0,0 +1,17 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; + +import java.util.List; + + +public interface IBipOrgsDao extends IBaseDao { + + /** + * 查询BIP业务单元 + * @param BipOrgsEntity + * @return + */ + List thirdInterfaceGetOrgs(BipOrgsEntity BipOrgsEntity); +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDetailsDao.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDetailsDao.java new file mode 100644 index 00000000..e0e6ea3f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipOrgsDetailsDao.java @@ -0,0 +1,17 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsDetailsEntity; + +import java.util.List; + + +public interface IBipOrgsDetailsDao extends IBaseDao { + + /** + * 查询BIP业务单元银行账户 + * @param BipOrgsDetailsEntity + * @return + */ + List thirdInterfaceGetOrgsDetails(BipOrgsDetailsEntity BipOrgsDetailsEntity); +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDao.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDao.java new file mode 100644 index 00000000..ba069080 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDao.java @@ -0,0 +1,18 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; + +import java.util.List; + + +public interface IBipSupplierDao extends IBaseDao { + + /** + * 查询BIP供应商 + * @param bipSupplierEntity + * @return + */ + List thirdInterfaceGetSupplier(BipSupplierEntity bipSupplierEntity); +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDetailsDao.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDetailsDao.java new file mode 100644 index 00000000..2edaa29e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/IBipSupplierDetailsDao.java @@ -0,0 +1,18 @@ +package com.hzya.frame.bip.v3.v2207.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; + +import java.util.List; + + +public interface IBipSupplierDetailsDao extends IBaseDao { + + /** + * 查询BIP供应商明细 + * @param bipSupplierDetailsEntity + * @return + */ + List thirdInterfaceGetSupplierDetails(BipSupplierDetailsEntity bipSupplierDetailsEntity); +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDaoImpl.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDaoImpl.java new file mode 100644 index 00000000..478c54ca --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDaoImpl.java @@ -0,0 +1,24 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipOrgsDaoImpl") +public class BipOrgsDaoImpl extends MybatisGenericDao implements IBipOrgsDao { + /** + * 查询BIP业务单元 + * @param BipOrgsEntity + * @return + */ + @DS("oracle91") + @Override + public List thirdInterfaceGetOrgs(BipOrgsEntity BipOrgsEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipOrgsDaoImpl.thirdInterfaceGetOrgs",BipOrgsEntity); + } +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDetailsDaoImpl.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDetailsDaoImpl.java new file mode 100644 index 00000000..5d51da6d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipOrgsDetailsDaoImpl.java @@ -0,0 +1,19 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDetailsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsDetailsEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipOrgsDetailsDaoImpl") +public class BipOrgsDetailsDaoImpl extends MybatisGenericDao implements IBipOrgsDetailsDao { + @DS("oracle91") + @Override + public List thirdInterfaceGetOrgsDetails(BipOrgsDetailsEntity bipOrgsDetailsEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipOrgsDetailsDaoImpl.thirdInterfaceGetOrgsDetails",bipOrgsDetailsEntity); + } +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDaoImpl.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDaoImpl.java new file mode 100644 index 00000000..9abe9ee7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDaoImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import cn.hutool.http.HttpRequest; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import com.hzya.frame.util.HttpUtil; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipSupplierDaoImpl") +public class BipSupplierDaoImpl extends MybatisGenericDao implements IBipSupplierDao { + /** + * 查询BIP供应商 + * @param bipSupplierEntity + * @return + */ + @DS("oracle91") + @Override + public List thirdInterfaceGetSupplier(BipSupplierEntity bipSupplierEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipSupplierDaoImpl.thirdInterfaceGetSupplier",bipSupplierEntity); + } +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDetailsDaoImpl.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDetailsDaoImpl.java new file mode 100644 index 00000000..89443371 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dao/impl/BipSupplierDetailsDaoImpl.java @@ -0,0 +1,20 @@ +package com.hzya.frame.bip.v3.v2207.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository("bipSupplierDetailsDaoImpl") +public class BipSupplierDetailsDaoImpl extends MybatisGenericDao implements IBipSupplierDetailsDao { + @DS("oracle91") + @Override + public List thirdInterfaceGetSupplierDetails(BipSupplierDetailsEntity bipSupplierDetailsEntity) { + return super.query("com.hzya.frame.bip.v3.v2207.dao.impl.BipSupplierDetailsDaoImpl.thirdInterfaceGetSupplierDetails",bipSupplierDetailsEntity); + } +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/IPayMentService.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/IPayMentService.java new file mode 100644 index 00000000..e94d59fe --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/IPayMentService.java @@ -0,0 +1,38 @@ +package com.hzya.frame.bip.v3.v2207.dps.service; + +import com.alibaba.fastjson.JSONObject; + + +public interface IPayMentService { + + /** + * + * @content 获取杭泰OA付款单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 11:59 + * **/ + String sendOAPayMentToCFS(JSONObject jsonObject,String type); + + /** + * + * @content 获取CFS登录校验码 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 13:37 + * **/ + String sendCFSToken(String name,String password); + + /** + * + * @content 获取杭泰OA报销单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 16:17 + * **/ + String sendExpenseToCFS(JSONObject jsonObject); + +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/impl/PayMentServiceImpl.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/impl/PayMentServiceImpl.java new file mode 100644 index 00000000..1b9308a5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/service/impl/PayMentServiceImpl.java @@ -0,0 +1,389 @@ +package com.hzya.frame.bip.v3.v2207.dps.service.impl; + +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.bip.v3.v2207.dps.service.IPayMentService; +import com.hzya.frame.dateutil.DateUtil; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.xml.sax.InputSource; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.StringReader; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + + +@Service(value = "payMentServiceImpl") +public class PayMentServiceImpl implements IPayMentService { + + private static final Logger logger = LoggerFactory.getLogger(PayMentServiceImpl.class); + + private static final String NAME="admin"; + private static final String PASSWORD="aHRzejg4OA=="; + private static final String CFSURL="http://101.132.140.208:26883/erp/services/";//测试端口:26893,正式端口:26883 + + /** + * + * @content 杭泰OA付款单传递CFS 注:付款单,资金归集,资金拨付,同名账户划转和借款单都用同一个接口 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/13 10:40 + * **/ + public String sendOAPayMentToCFS(JSONObject jsonStr,String type){ + logger.info("开始执行杭泰OA付款单传递CFS"); + try { + String cfsToken = sendCFSToken(NAME, PASSWORD); + if(null!=cfsToken) { + String jsonStrObj = jsonStr.getString("jsonStr"); + JSONObject jsonObjectMain = JSON.parseObject(jsonStrObj); + String erpVoucherNo = jsonObjectMain.getString("erpVoucherNo");//OA主键 + String purpose = jsonObjectMain.getString("purpose");//摘要 + String isForindividual = "0";//是否对私付款 + StringBuffer stringBuffer = new StringBuffer(); + String documentType=null; + switch (type){ + case "pay"://付款单 + documentType="01"; + break; + case "fundc"://资金归集 + documentType="02"; + break; + case "funda"://资金拨付 + documentType="03"; + break; + case "acc"://同名账户划转 + documentType="04"; + break; + case "loan"://借款单 + documentType="05"; + break; + default: + break; + } + JSONArray jsonStrList = jsonObjectMain.getJSONArray("details"); + if (null != jsonStrList && jsonStrList.size() > 0) { + for (Object seeyonEntity : jsonStrList) { + JSONObject jsonObjectFormson = JSON.parseObject(JSON.toJSONString(seeyonEntity)); + String payerAccName = jsonObjectFormson.getString("payerAccName");//转出方账户名(付款账户) + String payerAccNo = jsonObjectFormson.getString("payerAccNo");//转出方账号(付款账号) + String curCode = jsonObjectFormson.getString("curCode");//付款方币种 + String payeeAccName = jsonObjectFormson.getString("payeeAccName");//收款人帐户名称 + String payeeAccNo = jsonObjectFormson.getString("payeeAccNo");//收款方账户号 + BigDecimal amount = jsonObjectFormson.getBigDecimal("amount");//发生额 + String payeeBankCode = jsonObjectFormson.getString("payeeBankCode");//联行号 + String isQuick = jsonObjectFormson.getString("isQuick");//加急标志 + String payType = jsonObjectFormson.getString("payType");//结算方式 + String businessType = jsonObjectFormson.getString("businessType");//业务类别 + stringBuffer.append("\n"); + stringBuffer.append("" + nullConvert(documentType) + "\n"); + stringBuffer.append("" + nullConvert(erpVoucherNo) + "\n"); + //stringBuffer.append(""+"浙江杭泰数智能源开发有限公司"+"\n"); + stringBuffer.append(""+nullConvert(payerAccName)+"\n"); + //stringBuffer.append("" +"71010122002702903"+ "\n"); + stringBuffer.append("" + nullConvert(payerAccNo) + "\n"); + stringBuffer.append("" + nullConvert(curCode) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccName) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccNo) + "\n"); + stringBuffer.append("" + nullConvert(String.valueOf(amount)) + "\n"); + //stringBuffer.append(""+"301331000029"+"\n"); + stringBuffer.append(""+nullConvert(payeeBankCode)+"\n"); + stringBuffer.append("" + nullConvert(isQuick) + "\n"); + stringBuffer.append("" + nullConvert(isForindividual) + "\n"); + stringBuffer.append("" + nullConvert(payType) + "\n"); + stringBuffer.append("" + nullConvert(purpose) + "\n"); + stringBuffer.append("" + nullConvert(businessType) + "\n"); + stringBuffer.append("" + nullConvert(jsonObjectFormson.getString("debitByCustomer")) + "\n");//借方客商辅助核算编码 + stringBuffer.append("" + nullConvert(payeeAccNo) + "\n");//借方银行账户辅助核算编码 + stringBuffer.append("" + nullConvert(jsonObjectFormson.getString("debitByPersonnel")) + "\n");//借方人员辅助核算编码 + stringBuffer.append("" + nullConvert(jsonObjectFormson.getString("creditByCustomer")) + "\n");//贷方客商辅助核算编码 + stringBuffer.append("" + nullConvert(payerAccNo) + "\n");//贷方银行辅助核算编码 + stringBuffer.append("\n"); + } + } else { + stringBuffer.append("\n"); + stringBuffer.append("" + nullConvert(erpVoucherNo) + ""); + stringBuffer.append("" + nullConvert(purpose) + ""); + stringBuffer.append("" + nullConvert(isForindividual) + ""); + stringBuffer.append("\n"); + } + String result=null; + String xml= requestXML(cfsToken,"BkPaymentMainExchange",stringBuffer,"OA付款单同步发送"); + String url = "HTSZ_OA_BkPaymentMainWebService?wsdl"; + switch (type){ + case "pay"://付款单 + logger.info("OA付款单发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA付款单发送CFS的返回参数为:{}", result); + break; + case "fundc"://资金归集 + logger.info("OA资金归集发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA资金归集发送CFS的返回参数为:{}", result); + break; + case "funda"://资金调拨 + logger.info("OA资金拨付发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA资金拨付发送CFS的返回参数为:{}", result); + break; + case "acc"://同名账户划转 + logger.info("OA同名账户划转发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA同名账户划转发送CFS的返回参数为:{}", result); + break; + case "loan"://借款单 + logger.info("OA借还款发送CFS的请求参数为:{}", xml); + result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA借还款发送CFS的返回参数为:{}", result); + break; + default: + break; + } + return analyzeXML(result,"pay"); + }else{ + logger.info("请先登录CFS登录接口获取Token"); + return null; + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("杭泰OA付款单传递CFS错误,原因为:{}", e.getMessage()); + } + return null; + } + + /** + * + * @content 获取CFS登录校验码 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/13 15:38 + * **/ + public String sendCFSToken(String name,String password) { + try { + String xml="\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + "LogOn\n" + + ""+DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss")+"\n" + + "OA\n" + + "CFS\n" + + "OA登录验证发送\n" + + "\n" + + "\n" + + ""+name+"\n" + + ""+password+"\n" + + "\n" + + "\n" + + " ]]>\n" + + " \n" + + " \n" + + " \n" + + ""; + logger.info("CFS登录的请求参数为:{}",xml); + String url="HTSZ_OA_LogOnWebService?wsdl"; + String result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("CFS登录的返回参数为:{}",result); + return analyzeXML(result,"login"); + }catch (Exception e){ + e.printStackTrace(); + logger.info("获取CFS登录失败,原因为:{}",e.getMessage()); + } + return null; + } + + /** + * + * @content 获取杭泰OA报销单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 16:17 + * **/ + @Override + public String sendExpenseToCFS(JSONObject jsonStr) { + logger.info("开始执行杭泰OA报销单传递CFS"); + try { + String token = sendCFSToken(NAME, PASSWORD); + if(null != token){ + String jsonStrObj = jsonStr.getString("jsonStr"); + JSONObject jsonObjectMain = JSON.parseObject(jsonStrObj); + String erpVoucherNo = jsonObjectMain.getString("erpVoucherNo");//OA主键 + String purpose = jsonObjectMain.getString("purpose");//摘要 + StringBuffer stringBuffer = new StringBuffer(); + JSONArray jsonStrList = jsonObjectMain.getJSONArray("details"); + if(null != jsonStrList && jsonStrList.size()>0){ + for (Object o : jsonStrList) { + JSONObject jsonObjectDetails = JSON.parseObject(JSON.toJSONString(o)); + String payerAccName = jsonObjectDetails.getString("payerAccName");//转出方账户名(付款账户) + String payerAccNo = jsonObjectDetails.getString("payerAccNo");//转出方账号(付款账号) + String curCode = jsonObjectDetails.getString("curCode");//付款方币种 + String payeeAccName = jsonObjectDetails.getString("payeeAccName");//收款人帐户名称 + String payeeAccNo = jsonObjectDetails.getString("payeeAccNo");//收款方账户号 + BigDecimal amount = jsonObjectDetails.getBigDecimal("amount");//发生额 + String payeeBankCode = jsonObjectDetails.getString("payeeBankCode");//联行号 + String isQuick = jsonObjectDetails.getString("isQuick");//加急标志 + String payType = jsonObjectDetails.getString("payType");//结算方式 + stringBuffer.append("\n"); + stringBuffer.append("" + nullConvert(erpVoucherNo) + "\n"); + stringBuffer.append("" + nullConvert(payerAccName) + "\n"); + //stringBuffer.append(""+"浙江杭泰数智能源开发有限公司"+"\n"); + stringBuffer.append("" + nullConvert(payerAccNo) + "\n"); + //stringBuffer.append("" +"71010122002702903"+ "\n"); + stringBuffer.append("" + nullConvert(curCode) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccName) + "\n"); + stringBuffer.append("" + nullConvert(payeeAccNo) + "\n"); + stringBuffer.append("" + nullConvert(String.valueOf(amount)) + "\n"); + stringBuffer.append("" + nullConvert(payeeBankCode) + "\n"); + //stringBuffer.append(""+"301331000029"+"\n"); + stringBuffer.append("" + nullConvert(isQuick) + "\n"); + stringBuffer.append("" + nullConvert(payType) + "\n"); + stringBuffer.append("" + nullConvert(purpose) + "\n"); + stringBuffer.append("\n"); + } + } else { + stringBuffer.append("\n"); + stringBuffer.append("" + erpVoucherNo + "\n"); + stringBuffer.append("" + purpose + "\n"); + stringBuffer.append("\n"); + } + String xml= requestXML(token,"BkExpenseExchange",stringBuffer,"OA费用报销单同步发送"); + logger.info("OA报销单发送CFS的请求参数为:{}", xml); + String url = "HTSZ_OA_BkExpenseWebService?wsdl"; + String result = HttpRequest.post(CFSURL+url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("OA报销单发送CFS的返回参数为:{}", result); + return analyzeXML(result,"pay"); + } + }catch (Exception e){ + logger.info("杭泰OA报销单传递CFS错误,原因为:{}", e.getMessage()); + } + return null; + } + + //null转成空字符串 + private static String nullConvert(String str){ + if (null == str){ + return ""; + } + return str; + } + + private String requestXML(String token,String code,StringBuffer stringBuffer,String remark){ + String xml = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + "" + code + "\n" + + "" + DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss") + "\n" + + "OA\n" + + "CFS\n" + + "" + remark + "\n" + + "" + token + "\n" + + "\n" + + "\n" + + "\n"; + if (stringBuffer != null) { + xml += stringBuffer.toString(); + xml += "\n" + + "\n" + + "\n" + + " ]]>\n" + + " \n" + + " \n" + + " \n" + + ""; + } else { + xml += "\n" + + "\n" + + "\n" + + "]]>\n" + + " \n" + + " \n" + + " \n" + + ""; + } + return xml; + } + + /** + * + * @content 解析CFS返回的xml格式 + * @Param + * @Return + * @Author hecan + * @Date 2023/10/19 14:07 + * **/ + private static String analyzeXML(String result,String type){ + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + org.w3c.dom.Document document = builder.parse(new InputSource(new StringReader(result))); + org.w3c.dom.Element bodyElement = (org.w3c.dom.Element) document.getElementsByTagName("ns:return").item(0); + if (null!=bodyElement) { + String textContent = bodyElement.getTextContent(); + Document documentContext = DocumentHelper.parseText(textContent); + Element rootElement = documentContext.getRootElement(); + Element body = rootElement.element("body"); + if (null != body) { + switch (type) { + case "login"://登录 + Element sessionId = body.element("sessionId"); + if (null != sessionId) { + logger.info("CFS登录的登录校验码为:{}", sessionId.getText()); + return sessionId.getText(); + } else { + logger.info("CFS登录的登录校验码没有获取到,请重新获取"); + return null; + } + case "pay"://付款单和报销单 + Element list = body.element("list"); + List elements = list.elements(); + String serialNo = null; + String statusMsg = null; + String erpVoucherNoCfs = null; + for (Element element : elements) { + serialNo = element.element("serialNo").getText(); + statusMsg = element.element("statusMsg").getText(); + erpVoucherNoCfs = element.element("erpVoucherNo").getText(); + } + JSONObject jsonObject=new JSONObject(); + jsonObject.put("erpVoucherNoCfs",erpVoucherNoCfs); + jsonObject.put("statusMsg",statusMsg); + jsonObject.put("serialNo",serialNo); + //return "当前单据:" + erpVoucherNoCfs + ",传递CFS返回信息:" + statusMsg + ",流水号:" + serialNo; + return jsonObject.toJSONString(); + default: + break; + } + } + } + }catch (Exception e){ + logger.info("解析CFS返回的xml格式错误:{}",e.getMessage()); + } + return null; + } + + +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/task/ElectronicTask.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/task/ElectronicTask.java new file mode 100644 index 00000000..9ce1040b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/dps/task/ElectronicTask.java @@ -0,0 +1,210 @@ +package com.hzya.frame.bip.v3.v2207.dps.task; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.bip.v3.v2207.dps.service.IPayMentService; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.seeyon.dao.ICtpAttachmentDao; +import com.hzya.frame.seeyon.dao.ISeeYonDao; +import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; +import com.hzya.frame.seeyon.entity.SeeyonEntity; +import com.hzya.frame.uuid.UUIDLong; +import com.hzya.frame.web.exception.BaseSystemException; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.xml.sax.InputSource; + +import javax.annotation.Resource; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.File; +import java.io.StringReader; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + + +@EnableScheduling +@Component +public class ElectronicTask { + static Logger logger= LoggerFactory.getLogger(ElectronicTask.class); + + @Resource + private IPayMentService payMentService; + @Resource + private ISeeYonDao seeYonDao; + @Resource + private ICtpAttachmentDao ctpAttachmentDao; + + + //@Scheduled(cron = "0 20 10 * * ?") + public void sendElectronicToCFS() { + logger.info("CFS电子回单共享开始执行---------->"); + try { + String token = payMentService.sendCFSToken("admin", "aHRzejg4OA=="); + if(null!=token) { + List seeyonEntities = seeYonDao.selectOAListByTypeformmain_0327(new SeeyonEntity()); + if (seeyonEntities != null && seeyonEntities.size() > 0) { + for (SeeyonEntity seeyonEntity : seeyonEntities) { + String bankAcc = seeyonEntity.getField0137();//付款账号 + //String bankAcc="03005389347"; + String erpVoucherNo = seeyonEntity.getId();//OA付款单号 + String xml = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + "BkReceiptQueryExchange\n" + + "" + DateUtil.dateToString(new Date(), "yyyy-mm-dd hh:mm:ss") + "\n" + + "CFS\n" + + "OA\n" + + "OA电子回单共享发送\n" + + "" + token + "\n" + + "\n" + + "\n" + + "" + bankAcc + "\n" + + "" + erpVoucherNo + "\n" + + "\n" + + "\n" + + " ]]>\n" + + " \n" + + " \n" + + " \n" + + ""; + logger.info("CFS电子回单共享请求参数为:{}", xml); + String url = "http://101.132.140.208:26893/erp/services/HTSZ_OA_BkReceiptQueryWebService?wsdl"; + String result = HttpRequest.post(url).header("Content-Type", "soap/xml").timeout(30000).body(xml).execute().body(); + logger.info("CFS电子回单共享请求参数为:{}", result); + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + org.w3c.dom.Document document = builder.parse(new InputSource(new StringReader(result))); + org.w3c.dom.Element bodyElement = (org.w3c.dom.Element) document.getElementsByTagName("ns:return").item(0); + if (null != bodyElement) { + String textContent = bodyElement.getTextContent(); + Document documentContext = DocumentHelper.parseText(textContent); + Element rootElement = documentContext.getRootElement(); + Element body = rootElement.element("body"); + if("0000".equalsIgnoreCase(rootElement.element("head").element("returnCode").getText())){ + if (null != body) { + Element listElc = body.element("list"); + List elementsElc = listElc.elements(); + for (Element element : elementsElc) { + String fielPath = element.element("filePath").getText();//电子回单附件路径 + if (fielPath != null && fielPath!="") { + // String fielPath="C:\\Users\\笃曙\\Desktop\\15HZ000342CIBN2023091100066856211000001.pdf"; + File file = new File(fielPath); + JSONObject jsonObject = fileUpload(file); + logger.info("上传返回的附件id为:{}", jsonObject.getString("fileUrl")); + if (jsonObject.getString("fileUrl") != null) { + //表单的附件字段=ctpAttachment的Sub_reference,表单的Summary_id=ctpAttachment的att_reference + String sub_reference = String.valueOf(UUIDLong.longUUID()); + seeyonEntity.setField0264(sub_reference); + seeYonDao.updateFormformmain_0327(seeyonEntity); + //根据附件id查询附件业务数据 + String file_url = jsonObject.getString("fileUrl"); + CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); + ctpAttachmentEntity.setFile_url(file_url); + String att_reference = seeyonEntity.getSummary_id();//Summary_id + ctpAttachmentEntity.setSub_reference(sub_reference); + ctpAttachmentEntity.setAtt_reference(att_reference); + List ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity); + //如果没有查询到数据,就新增附件业务,否则更新 + if (ctpAttachmentEntities.size() == 0) { + String category = jsonObject.getString("category"); + String type = jsonObject.getString("type"); + String filename = jsonObject.getString("filename"); + String mime_type = jsonObject.getString("mimeType"); + String attachment_size = jsonObject.getString("size"); + String id = String.valueOf(UUIDLong.longUUID()); + ctpAttachmentEntity.setCategory(category); + ctpAttachmentEntity.setFilename(filename); + ctpAttachmentEntity.setType(type); + ctpAttachmentEntity.setMime_type(mime_type); + ctpAttachmentEntity.setAttachment_size(attachment_size); + ctpAttachmentEntity.setId(id); + ctpAttachmentEntity.setCategory("66"); + ctpAttachmentEntity.setCreatedate(new Date()); + ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity); + } else { + if (ctpAttachmentEntities.size() > 1) { + throw new BaseSystemException("OA附件业务表中查到多条记录"); + } + //更新数据到OA附件业务表中 + ctpAttachmentDao.updateCtpAttachment(ctpAttachmentEntity); + } + } + } + } + } + }else{ + logger.info("CFS电子回单返回得错误编码:{},以及返回的错误信息:{}",rootElement.element("head").element("returnCode").getText(),rootElement.element("head").element("returnMsg").getText()); + } + } + } + } + } + }catch (Exception e){ + logger.info("CFS电子回单共享错误:{}",e.getMessage()); + } + } + + + public static JSONObject fileUpload(File file) { + if (null != file) { + try { + HashMap paramMap = new HashMap<>(); + paramMap.put("file", file); + String url = "/seeyon/rest/attachment?token=@token@";//如果后面加上applicationCategory=1&extensions=&firstSave=true,附件业务自动生成一条记录 + url = url.replaceAll("@token@", getToken()); + String result = HttpUtil.post("http://60.204.152.210" + url, paramMap); + if (StrUtil.isNotBlank(result)) { + logger.info("附件上传结果"+result); + JSONObject jsonObject = JSONObject.parseObject(result); + String atts = jsonObject.get("atts").toString(); + if (StrUtil.isNotEmpty(atts)) { + JSONArray jsonArray = JSONArray.parseArray(atts); + JSONObject res = (JSONObject) jsonArray.get(0); + /* String fileUrl = res.getString("fileUrl"); + logger.info("附件id:" + fileUrl); + return fileUrl;*/ + return res; + } + } + }catch (Exception e){ + logger.error("附件上传失败"+e.getMessage()); + } + } + return null; + } + + private static String getToken() { + //获取oatoken + HashMap hashMap = new HashMap<>(); + hashMap.put("userName", "hzyaRest"); + hashMap.put("password", "a5ce21b8-91db-4cec-b3e3-3e44719655fd"); + hashMap.put("loginName","bdmanager"); + String result = HttpUtil.post("http://60.204.152.210" + "/seeyon/rest/token", JSON.toJSONString(hashMap)); + JSONObject jsonObject = JSONObject.parseObject(result); + if (null != jsonObject) { + logger.info(result); + logger.info("======token:{}======" + jsonObject.getString("id")); + return jsonObject.getString("id"); + } + return null; + } +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.java new file mode 100644 index 00000000..67f3d8e3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.java @@ -0,0 +1,65 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/**** + * BIP组织账户 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-10-24 10:03 + * @param + * @return + **/ +public class BipOrgsDetailsEntity extends BaseEntity { + + /*开户行编码*/ + private String bankCode; + /*开户行名称*/ + private String bankName; + /*账户*/ + private String accnum; + /*与组织关联的字段*/ + private String controlorg; + /*联行号*/ + private String cnapsCode; + + public String getCnapsCode() { + return cnapsCode; + } + + public void setCnapsCode(String cnapsCode) { + this.cnapsCode = cnapsCode; + } + + public String getControlorg() { + return controlorg; + } + + public void setControlorg(String controlorg) { + this.controlorg = controlorg; + } + + public String getBankCode() { + return bankCode; + } + + public void setBankCode(String bankCode) { + this.bankCode = bankCode; + } + + public String getBankName() { + return bankName; + } + + public void setBankName(String bankName) { + this.bankName = bankName; + } + + public String getAccnum() { + return accnum; + } + + public void setAccnum(String accnum) { + this.accnum = accnum; + } +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.xml b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.xml new file mode 100644 index 00000000..14fcaaa6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsDetailsEntity.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + bankdoc.code as bankCode,bankdoc.name as bankName,bankaccbas.accnum,bankaccbas.controlorg,bankaccbas.combinenum as cnapsCode + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.java new file mode 100644 index 00000000..ec5d7572 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.java @@ -0,0 +1,63 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * @description: BIP组织 entity + * @tableName: org_orgs + * @entityName: BipOrgsEntity + * @author: gjh + * @history: 1.0 + */ +public class BipOrgsEntity extends BaseEntity { + /*单位编码*/ + private String code; + /*开户单位*/ + private String name; + /*BIPID*/ + private String tripartiteId; + private String pk_financeorg; + private String orgsts; + + public String getOrgsts() { + return orgsts; + } + + public void setOrgsts(String orgsts) { + this.orgsts = orgsts; + } + + public String getPk_financeorg() { + return pk_financeorg; + } + + public void setPk_financeorg(String pk_financeorg) { + this.pk_financeorg = pk_financeorg; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTripartiteId() { + return tripartiteId; + } + + public void setTripartiteId(String tripartiteId) { + this.tripartiteId = tripartiteId; + } + + +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.xml b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.xml new file mode 100644 index 00000000..272541a7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipOrgsEntity.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + orgs.pk_financeorg as tripartiteId, + orgs.name , + orgs.code, + max(org_bank.ts)as ts + + + + + bankdoc.code as bankCode,bankdoc.name as bankName,bankaccbas.accnum,bankaccbas.controlorg + + + + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.java new file mode 100644 index 00000000..48c6d9c4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.java @@ -0,0 +1,77 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +public class BipSupplierDetailsEntity extends BaseEntity { + + private String code; + private String name; + /*开户行*/ + private String splitbank; + /*银行账号*/ + private String bankaccno; + /*是否默认*/ + private String isdefault; + /*联行号*/ + private String combinno; + + private String tripartiteId; + + public String getCombinno() { + return combinno; + } + + public void setCombinno(String combinno) { + this.combinno = combinno; + } + + public String getTripartiteId() { + return tripartiteId; + } + + public void setTripartiteId(String tripartiteId) { + this.tripartiteId = tripartiteId; + } + + public String getIsdefault() { + return isdefault; + } + + public void setIsdefault(String isdefault) { + this.isdefault = isdefault; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSplitbank() { + return splitbank; + } + + public void setSplitbank(String splitbank) { + this.splitbank = splitbank; + } + + public String getBankaccno() { + return bankaccno; + } + + public void setBankaccno(String bankaccno) { + this.bankaccno = bankaccno; + } + + +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.xml b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.xml new file mode 100644 index 00000000..64933d2f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierDetailsEntity.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + splitbank,bankaccno,combinno,name,code + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.java new file mode 100644 index 00000000..53190872 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.java @@ -0,0 +1,92 @@ +package com.hzya.frame.bip.v3.v2207.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * @description: BIP供应商 entity + * @tableName: BD_SUPPLIER + * @entityName: BipSupplierEntity + * @author: gjh + * @history: 1.0 + */ +public class BipSupplierEntity extends BaseEntity { + + private String code; + private String name; + /*税号*/ + private String taxpayerid; + /*地址*/ + private String def1; + /*电话*/ + private String def2; + /*联系人*/ + private String def3; + private String tripartiteId; + + public String getTripartiteId() { + return tripartiteId; + } + + public void setTripartiteId(String tripartiteId) { + this.tripartiteId = tripartiteId; + } + + private String ts; + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTaxpayerid() { + return taxpayerid; + } + + public void setTaxpayerid(String taxpayerid) { + this.taxpayerid = taxpayerid; + } + + public String getDef1() { + return def1; + } + + public void setDef1(String def1) { + this.def1 = def1; + } + + public String getDef2() { + return def2; + } + + public void setDef2(String def2) { + this.def2 = def2; + } + + public String getDef3() { + return def3; + } + + public void setDef3(String def3) { + this.def3 = def3; + } + +} diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.xml b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.xml new file mode 100644 index 00000000..2854fcd2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/entity/BipSupplierEntity.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + supplier.code,supplier.name,supplier.taxpayerid,bank.def1,bank.def2,bank.def3,supplier.ts, supplier.pk_cust_sup as tripartiteId + + + + splitbank,bankaccno,name,code + + + + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207Service.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207Service.java new file mode 100644 index 00000000..d5bb362b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/service/IBipV32207Service.java @@ -0,0 +1,49 @@ +package com.hzya.frame.bip.v3.v2207.service; + + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IBipV32207Service extends IBaseService{ + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取token + **/ + JsonResultEntity thirdInterfaceGetToken(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取供应商 + **/ + @DS("oracle91") + JsonResultEntity thirdInterfaceGetSupplier(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 新增供应商 + **/ + JsonResultEntity thirdInterfaceSaveSupplier(JSONObject jsonObject); + + /** + * 供应商传递OA + * @param jsonObject + * @return + */ + JsonResultEntity thirdInterfaceSendOa(JSONObject jsonObject) throws Exception; + + /** + * 获取BIP组织数据 + * @param jsonObject + * @return + */ + JsonResultEntity thirdInterfaceGetOrgs(JSONObject jsonObject); +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207ServiceImpl.java b/service/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207ServiceImpl.java new file mode 100644 index 00000000..b570fa64 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/bip/v3/v2207/service/impl/BipV32207ServiceImpl.java @@ -0,0 +1,484 @@ +package com.hzya.frame.bip.v3.v2207.service.impl; + + +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.google.gson.Gson; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDetailsDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao; +import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipOrgsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierDetailsEntity; +import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity; +import com.hzya.frame.bip.v3.v2207.service.IBipV32207Service; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.seeyon.service.impl.SeeYonInterFaceImpl; +import com.hzya.frame.sys.integrationtask.entity.IntegrationTaskEntity; +import com.hzya.frame.util.PluginUtils; +import com.hzya.frame.util.bipV3.Encryption; +import com.hzya.frame.util.bipV3.SHA256Util; +import com.hzya.frame.util.oldNcc.CompressUtil; +import com.hzya.frame.util.oldNcc.Decryption; +import com.hzya.frame.util.oldNcc.ResultMessageUtil; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +import java.net.URLEncoder; +import java.util.*; +import java.util.stream.Collectors; + + +@Service(value = "bipV32207Service") +public class BipV32207ServiceImpl extends BaseService implements IBipV32207Service { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + //定义项目开始同步日期 + private String ts = "2023-09-30 15:47:08"; + //组织的同步日期 + private String orgsts = "2023-09-30 15:47:08"; + @Autowired + private IBipSupplierDao bipSupplierDao; + + @Autowired + private IBipSupplierDetailsDao bipSupplierDetailsDao; + + @Autowired + private IBipOrgsDao bipOrgsDao; + + @Autowired + private IBipOrgsDetailsDao bipOrgsDetailsDao; + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取token + **/ + @Override + public JsonResultEntity thirdInterfaceGetToken(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + String client_id = jsonObject.getString("client_id"); + String pubKey = jsonObject.getString("pubKey"); + String client_secret = jsonObject.getString("client_secret"); + String username = jsonObject.getString("username"); + String pwd = jsonObject.getString("pwd"); + String busi_center = jsonObject.getString("busi_center"); + String dsname = jsonObject.getString("dsname"); + String baseUrl = jsonObject.getString("baseUrl"); + Map paramMap = new HashMap(); + // 密码模式认证 + paramMap.put("grant_type", "password"); + // 第三方应用id + paramMap.put("client_id", client_id); + // 第三方应用secret 公钥加密 + try { + paramMap.put("client_secret", URLEncoder.encode(Encryption.pubEncrypt(pubKey, client_secret), "utf-8")); + } catch (Exception e) { + e.printStackTrace(); + } + // ncc用户名 + paramMap.put("username", username); + // 密码 公钥加密 + try { + paramMap.put("password", URLEncoder.encode(Encryption.pubEncrypt(pubKey, pwd), "utf-8")); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("获取token失败"); + } + // 账套编码 + paramMap.put("biz_center", busi_center); + // 签名 + String sign = SHA256Util.getSHA256(client_id + client_secret + username + pwd + pubKey, pubKey); + paramMap.put("signature", sign); + paramMap.put("dsname", dsname); + String url = baseUrl + "/nccloud/opm/accesstoken"; + String mediaType = "application/x-www-form-urlencoded"; + String token = null; + try { + token = doPostHutool(url, paramMap, mediaType, null, "", "token"); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("获取token失败"); + } + if (JSONUtil.isTypeJSON(token)) { + JSONObject jsonObject1 = JSONObject.parseObject(token); + return BaseResult.getSuccessMessageEntity("获取token成功", jsonObject1); + } else { + return BaseResult.getSuccessMessageEntity("获取token成功", token); + } + } + + /** + * 发送post请求 + * + * @param baseUrl + * @param paramMap + * @param mediaType + * @param headers + * @param json + * @return + */ + private String doPostHutool(String baseUrl, Map paramMap, String mediaType, Map headers, String json, String type) { + String result = null; + + try { + StringBuffer sb = new StringBuffer(); + sb.append(baseUrl); + if (paramMap != null) { + sb.append("?"); + for (Map.Entry entry : paramMap.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + sb.append(key + "=" + value).append("&"); + } + } + if ("bill".equals(type)) { + sb.append("?"); + for (Map.Entry entry : headers.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + sb.append(key + "=" + value).append("&"); + } + } + baseUrl = sb.toString().substring(0, sb.toString().length() - 1); + HttpRequest re = HttpRequest.post(baseUrl); + re.addHeaders(headers); + result = re.body(json) + .timeout(2000000)//超时,毫秒 + .execute().body(); + + } catch (Exception e) { + e.printStackTrace(); + } + + + return result; + } + + /** + * @param key + * @param object + * @return com.alibaba.fastjson.JSONObject + * @Author lvleigang + * @Description 获取对象转换成jsonobj + * @Date 11:51 下午 2023/7/10 + **/ + public JSONObject getstrObj(String key, JSONObject object) { + if (checkStr(object.getString(key))) { + return object.getJSONObject(key); + } + return new JSONObject(); + } + + /** + * @param str + * @return void + * @Author lvleigang + * @Description 校验字符串 + * @Date 11:41 上午 2022/12/7 + **/ + protected Boolean checkStr(String str) { + Boolean flag = true; + if (str == null || "".equals(str)) { + flag = false; + } + return flag; + } + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 获取供应商 + **/ + @Override + public JsonResultEntity thirdInterfaceGetSupplier(JSONObject jsonObject) { + BipSupplierEntity bipSupplierEntity = getData("jsonStr", jsonObject, BipSupplierEntity.class); + //设置查询区间 + bipSupplierEntity.setTs(ts); + logger.info("查询供应商数据,当前TS:"+ts); + List bipSupplierEntities = bipSupplierDao.thirdInterfaceGetSupplier(bipSupplierEntity); + //更新TS时间 + ts = DateUtil.dateToString(new Date(),"yyyy-MM-dd HH:mm:ss"); + logger.info("TS已更新:"+ts); + //System.out.println("查询供应商明细"); + logger.info("查询供应商明细"+JSON.toJSONString(bipSupplierEntities)); + List jsonObjectList=new ArrayList<>(); + //[{"code":"SL20231101727","dataSourceCode":"master","name":"无锡恒君安管理咨询有限公司","taxpayerid":"91320205MAD2HAQN6Q","tripartiteId":"0001A31000000002M3TS","ts":"2023-11-16 14:05:10"}] + + List bipSupplierDetails = null; + for (BipSupplierEntity supplierEntity : bipSupplierEntities) { + List list=new ArrayList<>(); + JSONObject jsonObjectResult=new JSONObject(); + jsonObjectResult.put("code",supplierEntity.getCode()); + jsonObjectResult.put("name",supplierEntity.getName()); + jsonObjectResult.put("taxpayerid",supplierEntity.getTaxpayerid()); + jsonObjectResult.put("def1",supplierEntity.getDef1()); + jsonObjectResult.put("def2",supplierEntity.getDef2()); + jsonObjectResult.put("def3",supplierEntity.getDef3()); + jsonObjectResult.put("tripartiteId",supplierEntity.getTripartiteId()); + //根据供应商编码和名称查询明细 + String code = supplierEntity.getCode(); + String name = supplierEntity.getName(); + //System.out.println("根据供应处名称,编码获取明细数据:code:"+code +"name:"+name); + logger.info("根据供应处名称,编码获取明细数据:code:"+code +"name:"+name); + BipSupplierDetailsEntity bipSupplierDetailsEntity = new BipSupplierDetailsEntity(); + bipSupplierDetailsEntity.setCode(code); + bipSupplierDetailsEntity.setName(name); + logger.info("根据供应商编码,名称查询银行档案 {}",JSON.toJSONString(bipSupplierDetailsEntity)); + List bipSupplierDetailsEntities = queryBipSupplierDetails(bipSupplierDetailsEntity) ; +// /bipSupplierDetails.stream().filter(that-> code.equalsIgnoreCase(that.getCode() ) && name.equalsIgnoreCase(that.getName() ) ).collect(Collectors.toList()); + logger.info("根据供应处名称,编码获取明细数据 bipSupplierDetailsEntities值:{}",JSON.toJSONString(bipSupplierDetailsEntities)); + if (bipSupplierDetailsEntities.size()>0 && null!=bipSupplierDetailsEntities){ + bipSupplierDetailsEntities.get(0).setIsdefault("-8073674727882144390"); + for (BipSupplierDetailsEntity supplierDetailsEntity : bipSupplierDetailsEntities) { + JSONObject jsonObjectDetails=new JSONObject(); + jsonObjectDetails.put("splitbank",supplierDetailsEntity.getSplitbank()); + jsonObjectDetails.put("bankaccno",supplierDetailsEntity.getBankaccno()); + jsonObjectDetails.put("combinno",supplierDetailsEntity.getCombinno()); + jsonObjectDetails.put("isdefault",supplierDetailsEntity.getIsdefault()); + list.add(jsonObjectDetails); + } + } + jsonObjectResult.put("details",list); + jsonObjectList.add(jsonObjectResult); + } + return BaseResult.getSuccessMessageEntity("查询成功",jsonObjectList); + } + @DS("oracle91") + private List queryBipSupplierDetails(BipSupplierDetailsEntity bipSupplierDetailsEntity){ +// BipSupplierDetailsEntity bipSupplierDetailsEntity=new BipSupplierDetailsEntity(); +// bipSupplierDetailsEntity.setCode(supplierEntity.getCode()); +// bipSupplierDetailsEntity.setName(supplierEntity.getName()); + + List bipSupplierDetailsEntities = bipSupplierDetailsDao.thirdInterfaceGetSupplierDetails(bipSupplierDetailsEntity); + return bipSupplierDetailsEntities; + } + + + /** + * 获取BIP组织数据 + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity thirdInterfaceGetOrgs(JSONObject jsonObject) { + BipOrgsEntity bipOrgsEntity = getData("jsonStr", jsonObject, BipOrgsEntity.class); + //设置查询区间 + bipOrgsEntity.setOrgsts(orgsts); + logger.info("查询组织数据,当前TS:" + orgsts); + List bipOrgsEntities = bipOrgsDao.thirdInterfaceGetOrgs(bipOrgsEntity); + //更新TS时间 + orgsts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"); + logger.info("组织TS已更新:" + orgsts); + logger.info("查询组织明细" + JSON.toJSONString(bipOrgsEntities)); + List jsonObjectList = new ArrayList<>(); + if (null != bipOrgsEntities && bipOrgsEntities.size() > 0) { + for (BipOrgsEntity orgsEntity : bipOrgsEntities) { + List list = new ArrayList<>(); + JSONObject jsonObjectResult = new JSONObject(); + jsonObjectResult.put("code", orgsEntity.getCode());//单位编码 + jsonObjectResult.put("name", orgsEntity.getName());//单位名称 + jsonObjectResult.put("tripartiteId", orgsEntity.getTripartiteId());//BIPID + //根据组织主键查询明细 + String tripartiteId = orgsEntity.getTripartiteId(); + //System.out.println("根据供应处名称,编码获取明细数据:code:"+code +"name:"+name); + logger.info("根据组织主键获取明细数据:pk_financeorg:{}", tripartiteId); + BipOrgsDetailsEntity bipOrgsDetailsEntity = new BipOrgsDetailsEntity(); + bipOrgsDetailsEntity.setControlorg(tripartiteId); + List bipOrgsDetailsEntities = queryBipOrgsDetails(bipOrgsDetailsEntity); + if (bipOrgsDetailsEntities.size() > 0 && null != bipOrgsDetailsEntities) { + for (BipOrgsDetailsEntity orgsDetailsEntity : bipOrgsDetailsEntities) { + JSONObject jsonObjectDetails = new JSONObject(); + jsonObjectDetails.put("bankCode", orgsDetailsEntity.getBankCode());//开户行编码 + jsonObjectDetails.put("bankName", orgsDetailsEntity.getBankName());//开户行名称 + jsonObjectDetails.put("accnum", orgsDetailsEntity.getAccnum());//账户 + jsonObjectDetails.put("cnapsCode", orgsDetailsEntity.getCnapsCode());//联行号 + list.add(jsonObjectDetails); + } + } + jsonObjectResult.put("details", list); + jsonObjectList.add(jsonObjectResult); + } + } + return BaseResult.getSuccessMessageEntity("查询成功", jsonObjectList); + } + private List queryBipOrgsDetails(BipOrgsDetailsEntity bipOrgsDetailsEntity){ + List bipOrgsDetailsEntities = bipOrgsDetailsDao.thirdInterfaceGetOrgsDetails(bipOrgsDetailsEntity); + return bipOrgsDetailsEntities; + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Description 新增供应商 + **/ + @Override + public JsonResultEntity thirdInterfaceSaveSupplier(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //认证access_token + String access_token = jsonObject.getString("access_token"); + //认证security_key + String security_key = jsonObject.getString("security_key"); + //服务器ip:port + String baseUrl = jsonObject.getString("baseUrl"); + //api方法 + String apiUrl = jsonObject.getString("apiUrl"); + //发送的数据 + String sendData =jsonObject.getString("sendData"); + //对应于在第三方应用注册当中的app_id + String client_id = jsonObject.getString("client_id"); + //公钥 + String pubKey = jsonObject.getString("pubKey"); + //接口调用业务标识 + String busi_id = jsonObject.getString("busi_id"); + //重复调用检查 + String repeat_check = jsonObject.getString("repeat_check"); + //返回值压缩加密级别 + String secret_level = jsonObject.getString("secret_level") == null ? "L0": jsonObject.getString("secret_level") ; + try { + String returnStr = sendApi(access_token, security_key, baseUrl,apiUrl,sendData,client_id,pubKey,busi_id,repeat_check,secret_level); + if(JSONUtil.isTypeJSON(returnStr)){ + JSONObject jsonObject1 = JSONObject.parseObject(returnStr); + return BaseResult.getSuccessMessageEntity("发送数据成功",jsonObject1); + }else { + return BaseResult.getSuccessMessageEntity("发送数据成功",returnStr); + } + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("发送数据错误"); + } + } + + /** + * 供应商传递OA + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity thirdInterfaceSendOa(JSONObject jsonObject) throws Exception { + JSONObject jsonObjectStr = getstrObj("jsonStr", jsonObject); + PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(jsonObjectStr.getString("plug_id")); + String s = pluginBaseEntity.executeBusiness(jsonObjectStr); + return BaseResult.getSuccessMessageEntity("传递成功"); + } + + + /** + * @param access_token 认证access_token + * @param security_key 认证security_key + * @param baseUrl 服务器ip:port + * @param apiUrl api方法 + * @param putParameter 发送的数据 + * @param client_id 对应于在第三方应用注册当中的app_id + * @param pubKey 公钥 + * @param busi_id 接口调用业务标识 + * @param repeat_check 重复调用检查 + * @param secret_level 返回值压缩加密级别 + * @return java.lang.String + * @Author lvleigang + * @Description 发起api接口 + * @Date 9:52 上午 2023/8/22 + **/ + private String sendApi(String access_token, String security_key, String baseUrl, String apiUrl, String putParameter, String client_id, String pubKey, String busi_id, String repeat_check, String secret_level) throws Exception{ + // header 参数 + Map headermap = new HashMap<>(); + headermap.put("access_token", access_token); + headermap.put("client_id", client_id); + StringBuffer sb = new StringBuffer(); + sb.append(client_id); + if (StringUtils.isNotBlank(putParameter)) { + sb.append(putParameter); + } + sb.append(pubKey); + String sign = SHA256Util.getSHA256(sb.toString(), pubKey); + headermap.put("signature", sign); + if (StringUtils.isNotBlank(busi_id)) { + headermap.put("busi_id", busi_id); + } + if (StringUtils.isNotBlank(repeat_check)) { + headermap.put("repeat_check", repeat_check); + } + String mediaType = "application/json;charset=utf-8"; + // 表体数据json + // 根据安全级别选择加密或压缩请求表体参数 + String json = dealRequestBody(putParameter, security_key, secret_level); + // 返回值 + String sendUrl = baseUrl + apiUrl; + String result = doPostHutool(sendUrl, null, mediaType, headermap, json, "bill"); + String changeData = dealResponseBody(result, security_key, secret_level); + return changeData; + } + + // 返回值进行过加密和压缩,对返回值进行解压和解密 + private static String dealResponseBody(String source, String security_key, String level) throws Exception { + String result = null; + if (org.apache.commons.lang3.StringUtils.isEmpty(level) || SecretConst.LEVEL0.equals(level)) { + result = source; + } else if (SecretConst.LEVEL1.equals(level)) { + result = Decryption.symDecrypt(security_key, source); + } else if (SecretConst.LEVEL2.equals(level)) { + result = CompressUtil.gzipDecompress(source); + } else if (SecretConst.LEVEL3.equals(level)) { + result = CompressUtil.gzipDecompress(Decryption.symDecrypt(security_key, source)); + } else if (SecretConst.LEVEL4.equals(level)) { + result = Decryption.symDecrypt(security_key, CompressUtil.gzipDecompress(source)); + } else { + throw new Exception("无效的安全等级"); + } + + return result; + } + + // 根据安全级别设置,表体是否加密或压缩 + private static String dealRequestBody(String source, String security_key, String level) throws Exception { + String result = null; + if (org.apache.commons.lang3.StringUtils.isEmpty(level) || SecretConst.LEVEL0.equals(level)) { + result = source; + } else if (SecretConst.LEVEL1.equals(level)) { + result = Encryption.symEncrypt(security_key, source); + } else if (SecretConst.LEVEL2.equals(level)) { + result = CompressUtil.gzipCompress(source); + } else if (SecretConst.LEVEL3.equals(level)) { + result = Encryption.symEncrypt(security_key, CompressUtil.gzipCompress(source)); + } else if (SecretConst.LEVEL4.equals(level)) { + result = CompressUtil.gzipCompress(Encryption.symEncrypt(security_key, source)); + } else { + throw new Exception("无效的安全等级"); + } + + return result; + } + + class SecretConst { + /** + * LEVEL0 不压缩、不加密 + */ + public static final String LEVEL0 = "L0"; + /** + * LEVEL1 只加密、不压缩 + */ + public static final String LEVEL1 = "L1"; + /** + * LEVEL2 只压缩、不加密 + */ + public static final String LEVEL2 = "L2"; + /** + * LEVEL3 先压缩、后加密 + */ + public static final String LEVEL3 = "L3"; + /** + * LEVEL4 先加密、后压缩 + */ + public static final String LEVEL4 = "L4"; + } +} diff --git a/service/src/main/java/com/hzya/frame/dd/IDDInterfaceService.java b/service/src/main/java/com/hzya/frame/dd/IDDInterfaceService.java new file mode 100644 index 00000000..604f8a6f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/dd/IDDInterfaceService.java @@ -0,0 +1,31 @@ +package com.hzya.frame.dd; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.stereotype.Service; + +/*** + * 对接钉钉相关功能接口实现类,用于内部应用调用,返回指定格式数据 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-29 9:38 + * @param + * @return + **/ + +public interface IDDInterfaceService { + + /*** + * 推送钉钉方法 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-29 9:46 + * @param + * @return void + **/ + String senddd(JSONObject requestJson); + + +} diff --git a/service/src/main/java/com/hzya/frame/dd/impl/DdInterfaceServiceImpl.java b/service/src/main/java/com/hzya/frame/dd/impl/DdInterfaceServiceImpl.java new file mode 100644 index 00000000..b9c0b3fa --- /dev/null +++ b/service/src/main/java/com/hzya/frame/dd/impl/DdInterfaceServiceImpl.java @@ -0,0 +1,174 @@ +package com.hzya.frame.dd.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.JsonObject; +import com.hzya.frame.dd.IDDInterfaceService; +import com.hzya.frame.seeyon.dao.ISeeYonDao; +import com.hzya.frame.seeyon.entity.SeeyonEntity; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import com.hzya.frame.web.exception.BaseSystemException; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author 👻👻👻👻👻👻👻👻👻👻 gjh + * @version 1.0 + * @content + * @date 2023-08-29 9:48 + */ +@Service(value = "ddInterfaceService") +public class DdInterfaceServiceImpl implements IDDInterfaceService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + //TODO 此处参数暂时使用变量使用!后续应该使用应用参数动态设置 + + private final String appSecret = "DuRw6EEEvhGXfr6Q8wN_x4025qKjrffIGCXF9KeCKKIID-LVSsR6_8KWMei6sug1"; + private final String appKey = "dingxewtjaserj292ggu"; + //TODO 此处参数暂时使用变量使用!后续应该使用应用参数动态设置 + @Autowired + private ISeeYonDao seeYonDao; + @Override + public String senddd(JSONObject requestJson) { + JSONObject jsonStrObj = requestJson.getJSONObject("jsonStr"); + + if(ObjectUtils.isEmpty(jsonStrObj)){ + throw new BaseSystemException("请传入jsonStr参数"); + } + String code = jsonStrObj.getString("code"); + if(StringUtils.isEmpty(code)){ + throw new BaseSystemException("请传入接口编号参数:code"); + } + String url = getDdUrlByType(code); + String accessTokenCode = "0001"; + //如果请求的是token接口,不需要拼接access_token参数 + String result = null; + //如果是单据接口,需要增加access_token参数,在此处定义变量赋值 + String access_token = getToken(); + if(accessTokenCode.equalsIgnoreCase(code)){ + url+= "?appkey="+appKey+"&appsecret="+appSecret; + result = HttpUtil.get(url); + JSONObject jsonObject = analysisDDResult(result); + access_token = jsonObject.getString("access_token"); + }else{ + url+= "?access_token="+access_token; + JSONObject data = jsonStrObj.getJSONObject("data"); + if("0004".equals(code) || "0003".equals(code)|| "0005".equals(code)){ + logger.info("调用钉钉请求前参数:{}",data.toString()); + if("0003".equals(code)){ + String formInstanceId = data.getString("formInstanceId"); + //如果表单ID不等于空走编辑动作 + if(StrUtil.isNotEmpty(formInstanceId)){ + result = HttpRequest.put(url).header("x-acs-dingtalk-access-token",access_token).body(data.toString()).execute().body(); + }else{ + result = HttpRequest.post(url).header("x-acs-dingtalk-access-token",access_token).body(data.toString()).execute().body(); + } + } + + logger.info("调用钉钉返回参数:{}",result); + }else{ + result = HttpRequest.post(url).header("access_token",access_token).body(data.toJSONString()).execute().body(); + } + + } + return result; + } + + + + /***** + * 暂时写个固定获取token方法 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-29 14:52 + * @param + * @return java.lang.String + **/ + private String getToken(){ + String url = getDdUrlByType("0001"); + url+= "?appkey="+appKey+"&appsecret="+appSecret; + String result = HttpUtil.get(url); + JSONObject jsonObject = analysisDDResult(result); + String access_token = jsonObject.getString("access_token"); + return access_token; + } + /**** + * 解析钉钉接口返回的数据,转换成json对象 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-29 11:55 + * @param + * @return com.alibaba.fastjson.JSONObject + **/ + private JSONObject analysisDDResult(String result){ + //解析result + JSONObject jsonObject = JSON.parseObject(result); + //定义钉钉返回成功的标记 + String okCode = "0"; + //钉钉返回的接口成功标记 + String errorCode = jsonObject.getString("errcode"); + //钉钉接口返回的提示信息 + String errmsg = jsonObject.getString("errmsg"); + //钉钉Result + String ddResult = jsonObject.getString("result"); + //如果返回值是0,则表示调用成功了 + if(okCode.equalsIgnoreCase(errorCode)){ + return jsonObject; + }else{ + throw new BaseSystemException("调用钉钉接口失败!错误代码:"+errorCode+"错误信息:"+errmsg); + } + } + + + /***** + * 把所有做过的钉钉接口在此处做备注,通过给外部系统的编号获取 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-29 9:54 + * @param + * @return java.lang.String + **/ + private String getDdUrlByType(String code){ + StringBuffer urlBuffer = null; + if("0003".equals(code)|| "0004".equals(code)|| "0005".equals(code)){ + urlBuffer = new StringBuffer("https://api.dingtalk.com"); + }else{ + urlBuffer = new StringBuffer("https://oapi.dingtalk.com"); + } + switch (code){ + case "0001": + //获取钉钉tokenURL + urlBuffer.append("/gettoken") ; + break; + //通知审批通过URL + case "0002": + urlBuffer.append("/topapi/attendance/approve/finish") ; + break; + //销售合同URL,无流程表单统一Url + case "0003": + urlBuffer.append("/v1.0/yida/forms/instances") ; + break; + case "0004": + urlBuffer.append("/v1.0/yida/forms/instances/search") ; + break; + case "0005": + urlBuffer.append("/v1.0/yida/forms/instances") ; +// urlBuffer.append("/v1.0/yida/processes/instances/start") ; + break; + default: + throw new BaseSystemException("获取钉钉URL错误!请确认URL编号"); + } + return urlBuffer.toString(); + } + +} diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/DbFiledsDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/DbFiledsDto.java new file mode 100644 index 00000000..ae094e16 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/DbFiledsDto.java @@ -0,0 +1,83 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +public class DbFiledsDto { + + /** + * 1\修改 2、新增 + */ + private String dataType; + + /** + * 中文名 + */ + private String chName; + /** + * 英文名 + */ + private String enName; + /** + * 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + */ + private String filedType; + /** + * 长度 + */ + private String filedLength; + + public DbFiledsDto() { + } + + public DbFiledsDto(String dataType,String chName, String enName, String filedType, String filedLength) { + this.dataType = dataType; + this.chName = chName; + this.enName = enName; + this.filedType = filedType; + this.filedLength = filedLength; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } + + public String getFiledLength() { + return filedLength; + } + + public void setFiledLength(String filedLength) { + this.filedLength = filedLength; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java new file mode 100644 index 00000000..0370431c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java @@ -0,0 +1,69 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; + +import java.util.List; + +public class MdmDataDto { + + private String id; + private String tableName; + private String documentRule; + private Integer documentRuleNum; + /** + * 类型 1、主表 2、明细 + */ + private String dbType; + + private List mdmDataFiledDtos; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public List getMdmDataFiledDtos() { + return mdmDataFiledDtos; + } + + public void setMdmDataFiledDtos(List mdmDataFiledDtos) { + this.mdmDataFiledDtos = mdmDataFiledDtos; + } + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Integer getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Integer documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java new file mode 100644 index 00000000..d9e40e8d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; + +import java.util.List; + +public class MdmDataFiledDto { + + private String filedsName; + private String filedsValue; + + public String getFiledsName() { + return filedsName; + } + + public void setFiledsName(String filedsName) { + this.filedsName = filedsName; + } + + public String getFiledsValue() { + return filedsValue; + } + + public void setFiledsValue(String filedsValue) { + this.filedsValue = filedsValue; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbFiledVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbFiledVo.java new file mode 100644 index 00000000..70da08eb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbFiledVo.java @@ -0,0 +1,37 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity.MdmModuleDbFiledsRuleFilesEntity; + +import java.util.List; + +public class MdmDbFiledVo { + private String id; + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public MdmDbFiledVo() { + } + + public MdmDbFiledVo(String id, String name) { + this.id = id; + this.name = name; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbVo.java new file mode 100644 index 00000000..ed01bc0b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbVo.java @@ -0,0 +1,57 @@ +package com.hzya.frame.mdm.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity.MdmModuleDbFiledsRuleFilesEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +public class MdmDbVo { + + //主数据主表 + private MdmModuleDbEntity mainMdmModuleDb; + //主数据子表 + private List sublistMdmModuleDb; + //控件字段规则属性 + private List moduleDbFiledsRuleFiles; + //单据编码规则 + private List mdmTableCodeRuleEntityList; + + + public List getMdmTableCodeRuleEntityList() { + return mdmTableCodeRuleEntityList; + } + + public void setMdmTableCodeRuleEntityList(List mdmTableCodeRuleEntityList) { + this.mdmTableCodeRuleEntityList = mdmTableCodeRuleEntityList; + } + + public List getModuleDbFiledsRuleFiles() { + return moduleDbFiledsRuleFiles; + } + + public void setModuleDbFiledsRuleFiles(List moduleDbFiledsRuleFiles) { + this.moduleDbFiledsRuleFiles = moduleDbFiledsRuleFiles; + } + + public MdmModuleDbEntity getMainMdmModuleDb() { + return mainMdmModuleDb; + } + + public void setMainMdmModuleDb(MdmModuleDbEntity mainMdmModuleDb) { + this.mainMdmModuleDb = mainMdmModuleDb; + } + + public List getSublistMdmModuleDb() { + return sublistMdmModuleDb; + } + + public void setSublistMdmModuleDb(List sublistMdmModuleDb) { + this.sublistMdmModuleDb = sublistMdmModuleDb; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java new file mode 100644 index 00000000..586e4d7d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java @@ -0,0 +1,41 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; + +import java.util.List; + +public class MdmDetailViewVo { + //模版信息 + private MdmModuleEntity mdmModuleEntity; + //主数据主表 + private MdmModuleDbEntity mainMdmModuleDb; + //主数据子表 + private List sublistMdmModuleDb; + + public MdmModuleEntity getMdmModuleEntity() { + return mdmModuleEntity; + } + + public void setMdmModuleEntity(MdmModuleEntity mdmModuleEntity) { + this.mdmModuleEntity = mdmModuleEntity; + } + + public MdmModuleDbEntity getMainMdmModuleDb() { + return mainMdmModuleDb; + } + + public void setMainMdmModuleDb(MdmModuleDbEntity mainMdmModuleDb) { + this.mainMdmModuleDb = mainMdmModuleDb; + } + + public List getSublistMdmModuleDb() { + return sublistMdmModuleDb; + } + + public void setSublistMdmModuleDb(List sublistMdmModuleDb) { + this.sublistMdmModuleDb = sublistMdmModuleDb; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java new file mode 100644 index 00000000..af840e9f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java @@ -0,0 +1,33 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleRole.entity.MdmModuleRoleEntity; + +import java.util.List; + +public class MdmDistributeDto { + + //id + private String id; + + + private List mdmModuleDistributeEntities; + + public List getMdmModuleDistributeEntities() { + return mdmModuleDistributeEntities; + } + + public void setMdmModuleDistributeEntities(List mdmModuleDistributeEntities) { + this.mdmModuleDistributeEntities = mdmModuleDistributeEntities; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeVo.java new file mode 100644 index 00000000..dcf828ec --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeVo.java @@ -0,0 +1,55 @@ +package com.hzya.frame.mdm.entity; + +public class MdmDistributeVo { + + /** + * 数据 + */ + private String formmainId; + + /** + * 应用id + */ + private String appId; + /** + * 状态 1、发送成功 2、发送中 3、发送失败 4、未发送 + */ + private String status; + /** + *描述 + */ + private String msg; + + public String getFormmainId() { + return formmainId; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java new file mode 100644 index 00000000..762303a8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java @@ -0,0 +1,205 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; + +import java.util.List; + +public class MdmDto { + + //id + private String id; + //3、新增4、修改 5、查看 + private String showType; + //分页 + private Integer pageNum; + private Integer pageSize; + /** + * 显示字段 + */ + private String viewFiled; + /** + * 上级id字段 + */ + private String upIdFiled; + //主数据名称 + private String mdmName; + //主数据编码 + private Integer mdmCode; + //主数据类型 + private String mdmType; + //描述 + private String remark; + //描述 + private String[] ids; + //单据编码规则 + private List mdmTableCodeRuleEntityList; + //主数据主表 + private MdmModuleDbEntity mainMdmModuleDb; + //主数据子表 + private List sublistMdmModuleDb; + + private String tableName; + private String value; + + private String label; + private String lableValue; + + private String upId; + + + public String getLableValue() { + return lableValue; + } + + public void setLableValue(String lableValue) { + this.lableValue = lableValue; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public MdmModuleDbEntity getMainMdmModuleDb() { + return mainMdmModuleDb; + } + + public void setMainMdmModuleDb(MdmModuleDbEntity mainMdmModuleDb) { + this.mainMdmModuleDb = mainMdmModuleDb; + } + + public List getSublistMdmModuleDb() { + return sublistMdmModuleDb; + } + + public void setSublistMdmModuleDb(List sublistMdmModuleDb) { + this.sublistMdmModuleDb = sublistMdmModuleDb; + } + + public String getMdmName() { + return mdmName; + } + + public void setMdmName(String mdmName) { + this.mdmName = mdmName; + } + + public Integer getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Integer mdmCode) { + this.mdmCode = mdmCode; + } + + public String getMdmType() { + return mdmType; + } + + public void setMdmType(String mdmType) { + this.mdmType = mdmType; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getShowType() { + return showType; + } + + public void setShowType(String showType) { + this.showType = showType; + } + + public List getMdmTableCodeRuleEntityList() { + return mdmTableCodeRuleEntityList; + } + + public void setMdmTableCodeRuleEntityList(List mdmTableCodeRuleEntityList) { + this.mdmTableCodeRuleEntityList = mdmTableCodeRuleEntityList; + } + + public String getViewFiled() { + return viewFiled; + } + + public void setViewFiled(String viewFiled) { + this.viewFiled = viewFiled; + } + + public String getUpIdFiled() { + return upIdFiled; + } + + public void setUpIdFiled(String upIdFiled) { + this.upIdFiled = upIdFiled; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getUpId() { + return upId; + } + + public void setUpId(String upId) { + this.upId = upId; + } + + public String[] getIds() { + return ids; + } + + public void setIds(String[] ids) { + this.ids = ids; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewDto.java new file mode 100644 index 00000000..4386ac8c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewDto.java @@ -0,0 +1,81 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; + +import java.util.List; + +public class MdmModuleViewDto { + + //id + private String id; + //模版 + private MdmModuleViewEntity mdmModuleViewEntity; + //新增 + private List addFiled; + //修改 + private List editFiled; + //查看 + private List showFiled; + //查询 + private List queryFiled; + //列表 + private List listFiled; + + public MdmModuleViewEntity getMdmModuleViewEntity() { + return mdmModuleViewEntity; + } + + public void setMdmModuleViewEntity(MdmModuleViewEntity mdmModuleViewEntity) { + this.mdmModuleViewEntity = mdmModuleViewEntity; + } + + public List getAddFiled() { + return addFiled; + } + + public void setAddFiled(List addFiled) { + this.addFiled = addFiled; + } + + public List getEditFiled() { + return editFiled; + } + + public void setEditFiled(List editFiled) { + this.editFiled = editFiled; + } + + public List getShowFiled() { + return showFiled; + } + + public void setShowFiled(List showFiled) { + this.showFiled = showFiled; + } + + public List getQueryFiled() { + return queryFiled; + } + + public void setQueryFiled(List queryFiled) { + this.queryFiled = queryFiled; + } + + public List getListFiled() { + return listFiled; + } + + public void setListFiled(List listFiled) { + this.listFiled = listFiled; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java new file mode 100644 index 00000000..e41fc9ae --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java @@ -0,0 +1,123 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; + +import java.util.List; + +public class MdmModuleViewVo { + + + //模版 + private MdmModuleViewEntity mdmModuleViewEntity; + //新增 + private List addFiled; + //修改 + private List editFiled; + //查看 + private List showFiled; + //查询 + private List queryFiled; + //列表 + private List listFiled; + + //新增 + private List dbAddFiled; + //修改 + private List dbEditFiled; + //查看 + private List dbShowFiled; + //查询 + private List dbQueryFiled; + //列表 + private List dbListFiled; + + public List getAddFiled() { + return addFiled; + } + + public void setAddFiled(List addFiled) { + this.addFiled = addFiled; + } + + public List getEditFiled() { + return editFiled; + } + + public void setEditFiled(List editFiled) { + this.editFiled = editFiled; + } + + public List getShowFiled() { + return showFiled; + } + + public void setShowFiled(List showFiled) { + this.showFiled = showFiled; + } + + public List getQueryFiled() { + return queryFiled; + } + + public void setQueryFiled(List queryFiled) { + this.queryFiled = queryFiled; + } + + public List getListFiled() { + return listFiled; + } + + public void setListFiled(List listFiled) { + this.listFiled = listFiled; + } + + public MdmModuleViewEntity getMdmModuleViewEntity() { + return mdmModuleViewEntity; + } + + public void setMdmModuleViewEntity(MdmModuleViewEntity mdmModuleViewEntity) { + this.mdmModuleViewEntity = mdmModuleViewEntity; + } + + public List getDbAddFiled() { + return dbAddFiled; + } + + public void setDbAddFiled(List dbAddFiled) { + this.dbAddFiled = dbAddFiled; + } + + public List getDbEditFiled() { + return dbEditFiled; + } + + public void setDbEditFiled(List dbEditFiled) { + this.dbEditFiled = dbEditFiled; + } + + public List getDbShowFiled() { + return dbShowFiled; + } + + public void setDbShowFiled(List dbShowFiled) { + this.dbShowFiled = dbShowFiled; + } + + public List getDbQueryFiled() { + return dbQueryFiled; + } + + public void setDbQueryFiled(List dbQueryFiled) { + this.dbQueryFiled = dbQueryFiled; + } + + public List getDbListFiled() { + return dbListFiled; + } + + public void setDbListFiled(List dbListFiled) { + this.dbListFiled = dbListFiled; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java new file mode 100644 index 00000000..bda7c895 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java @@ -0,0 +1,69 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.sys.entity.TemplateKeyValue; + +import java.util.List; + +public class MdmQuery { + + //分页 + private Integer pageNum; + private Integer pageSize; + //表名 + private String tableName; + //查询条件 + private List queryCondition; + //返回字段 + private List returnField; + //明细表查询条件 + private List detailQueryCondition; + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public List getQueryCondition() { + return queryCondition; + } + + public void setQueryCondition(List queryCondition) { + this.queryCondition = queryCondition; + } + + public List getReturnField() { + return returnField; + } + + public void setReturnField(List returnField) { + this.returnField = returnField; + } + + public List getDetailQueryCondition() { + return detailQueryCondition; + } + + public void setDetailQueryCondition(List detailQueryCondition) { + this.detailQueryCondition = detailQueryCondition; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmRoleDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmRoleDto.java new file mode 100644 index 00000000..1a235852 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmRoleDto.java @@ -0,0 +1,32 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleRole.entity.MdmModuleRoleEntity; + +import java.util.List; + +public class MdmRoleDto { + + //id + private String id; + + + private List mdmModuleRoleEntities; + + public List getMdmModuleRoleEntities() { + return mdmModuleRoleEntities; + } + + public void setMdmModuleRoleEntities(List mdmModuleRoleEntities) { + this.mdmModuleRoleEntities = mdmModuleRoleEntities; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewButtonVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewButtonVo.java new file mode 100644 index 00000000..4722a7b8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewButtonVo.java @@ -0,0 +1,34 @@ +package com.hzya.frame.mdm.entity; + +public class MdmViewButtonVo { + + //按钮类型 + private String buttonType; + //按钮名 + private String buttonName; + + public String getButtonType() { + return buttonType; + } + + public void setButtonType(String buttonType) { + this.buttonType = buttonType; + } + + public String getButtonName() { + return buttonName; + } + + public void setButtonName(String buttonName) { + this.buttonName = buttonName; + } + + public MdmViewButtonVo() { + } + + public MdmViewButtonVo(String buttonType, String buttonName) { + this.buttonType = buttonType; + this.buttonName = buttonName; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java new file mode 100644 index 00000000..f1e25c5a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java @@ -0,0 +1,114 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; + +import java.util.List; + +public class MdmViewFiledVo { + + //字段id + private String id; + //表名 + private String dbName; + //类型 1、主表 2、明细 + private String dbType; + //主数据模版ID + private String mdmId; + //模版数据库id + private String dbId; + //中文名 + private String chName; + //英文名 + private String enName; + //排序 + private Integer sorts; + /** + * 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + */ + private String filedType; + //字段规则 + private List ruleList; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public List getRuleList() { + return ruleList; + } + + public void setRuleList(List ruleList) { + this.ruleList = ruleList; + } + + public Integer getSorts() { + return sorts; + } + + public void setSorts(Integer sorts) { + this.sorts = sorts; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java new file mode 100644 index 00000000..25749a1b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java @@ -0,0 +1,73 @@ +package com.hzya.frame.mdm.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +public class MdmViewVo { + + private String id; + //模版信息 + private MdmModuleEntity mdmModuleEntity; + //模版展示信息 + private MdmModuleViewEntity mdmModuleViewEntity; + //查询条件 + private List queryList; + //列表 + private List listList; + //按钮 + private List buttonList; + + public List getQueryList() { + return queryList; + } + + public void setQueryList(List queryList) { + this.queryList = queryList; + } + + public List getListList() { + return listList; + } + + public void setListList(List listList) { + this.listList = listList; + } + + public List getButtonList() { + return buttonList; + } + + public void setButtonList(List buttonList) { + this.buttonList = buttonList; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MdmModuleEntity getMdmModuleEntity() { + return mdmModuleEntity; + } + + public void setMdmModuleEntity(MdmModuleEntity mdmModuleEntity) { + this.mdmModuleEntity = mdmModuleEntity; + } + + public MdmModuleViewEntity getMdmModuleViewEntity() { + return mdmModuleViewEntity; + } + + public void setMdmModuleViewEntity(MdmModuleViewEntity mdmModuleViewEntity) { + this.mdmModuleViewEntity = mdmModuleViewEntity; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmVo.java new file mode 100644 index 00000000..a382ed00 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmVo.java @@ -0,0 +1,122 @@ +package com.hzya.frame.mdm.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +public class MdmVo { + + //id + private String id; + //主数据名称 + private String mdmName; + //主数据编码 + private String mdmCode; + //主数据类型 1、档案 2、单据 + private String mdmType; + //主数据类型 1、档案 2、单据 + private String mdmTypeName; + //描述 + private String remark; + + /** logo(地址或者id) */ + private String mdmLogo; + private String createUserId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + private String modifyUserId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date modifyTime; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMdmName() { + return mdmName; + } + + public void setMdmName(String mdmName) { + this.mdmName = mdmName; + } + + public String getMdmCode() { + return mdmCode; + } + + public void setMdmCode(String mdmCode) { + this.mdmCode = mdmCode; + } + + public String getMdmType() { + return mdmType; + } + + public void setMdmType(String mdmType) { + this.mdmType = mdmType; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getMdmTypeName() { + return mdmTypeName; + } + + public void setMdmTypeName(String mdmTypeName) { + this.mdmTypeName = mdmTypeName; + } + + public String getCreateUserId() { + return createUserId; + } + + public void setCreateUserId(String createUserId) { + this.createUserId = createUserId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getModifyUserId() { + return modifyUserId; + } + + public void setModifyUserId(String modifyUserId) { + this.modifyUserId = modifyUserId; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public String getMdmLogo() { + return mdmLogo; + } + + public void setMdmLogo(String mdmLogo) { + this.mdmLogo = mdmLogo; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java new file mode 100644 index 00000000..b3356d45 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java @@ -0,0 +1,53 @@ +package com.hzya.frame.mdm.mdmModule.dao; + +import com.hzya.frame.mdm.entity.MdmDataDto; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmQuery; +import com.hzya.frame.mdm.entity.MdmVo; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.entity.FormmainDeleteDto; +import com.hzya.frame.sys.entity.ModuleDto; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 主数据模版(mdm_module: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:25:41 + */ +public interface IMdmModuleDao extends IBaseDao { + + List queryMdm(MdmDto entity); + + Integer checkTable(Map maps); + + Integer createTable(Map maps); + Integer createTableDistribute(Map maps); + Integer alterTable(Map maps); + Integer alterTableName(Map maps); + + List> queryMdmShowData(MdmQuery entity); + + Integer checkData(Map map); + + Integer updateForm(MdmDataDto mdmDataDto); + Integer saveForm(MdmDataDto mdmDataDto); + + Integer deleteTemplateById(FormmainDeleteDto formmainDeleteDto); + + List> queryDataAll(MdmDto entity); + + List> queryTemplateData(ModuleDto entity); + + HashMap queryTemplateDataOne(MdmDto entity); + + List> queryTemplateDataMore(MdmDto entity); + List> querySelectData(MdmDto entity); + + Integer deleteChilder(FormmainDeleteDto formmainDeleteDto); +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java new file mode 100644 index 00000000..247ce809 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java @@ -0,0 +1,137 @@ +package com.hzya.frame.mdm.mdmModule.dao.impl; + +import com.hzya.frame.mdm.entity.MdmDataDto; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmQuery; +import com.hzya.frame.mdm.entity.MdmVo; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiDto; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiVo; +import com.hzya.frame.sys.entity.FormmainDeleteDto; +import com.hzya.frame.sys.entity.FormmainDto; +import com.hzya.frame.sys.entity.ModuleDto; +import com.hzya.frame.sys.entity.TemplateQuery; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 主数据模版(MdmModule)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:25:42 + */ +@Repository(value = "MdmModuleDaoImpl") +public class MdmModuleDaoImpl extends MybatisGenericDao implements IMdmModuleDao { + + @Override + public List queryMdm(MdmDto entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryMdm", entity); + return o; + } + + @Override + public Integer checkTable(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkTable", maps); + return o; + + } + + @Override + public Integer createTable(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "createTable", maps); + return o; + } + @Override + public Integer createTableDistribute(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "createTableDistribute", maps); + return o; + } + @Override + public Integer alterTable(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTable", maps); + return o; + } + + @Override + public Integer alterTableName(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTableName", maps); + return o; + + } + @Override + public Integer checkData(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkData", maps); + return o; + + } + @Override + public List> querySelectData(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "querySelectData", entity); + return o; + + } + + @Override + public List> queryTemplateDataMore(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryTemplateDataMore", entity); + return o; + + } + + @Override + public List> queryMdmShowData(MdmQuery entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryMdmShowData", entity); + return o; + } + @Override + public List> queryDataAll(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryDataAll", entity); + return o; + } + + @Override + public List> queryTemplateData(ModuleDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryTemplateData", entity); + return o; + + } + @Override + public Integer updateForm(MdmDataDto mdmDataDto) { + Integer o = super.update(getSqlIdPrifx() + "updateForm", mdmDataDto); + return o; + + } + @Override + public Integer saveForm(MdmDataDto mdmDataDto) { + Integer o = super.update(getSqlIdPrifx() + "saveForm", mdmDataDto); + return o; + + } + + @Override + public Integer deleteTemplateById(FormmainDeleteDto entity) { + Integer o = super.delete(getSqlIdPrifx() + "deleteTemplateById", entity); + return o; + + } + + @Override + public Integer deleteChilder(FormmainDeleteDto entity) { + Integer o = super.delete(getSqlIdPrifx() + "deleteChilder", entity); + return o; + + } + + @Override + public HashMap queryTemplateDataOne(MdmDto entity) { + HashMap o = (HashMap) super.selectOne(getSqlIdPrifx() + "queryTemplateDataOne", entity); + return o; + + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.java new file mode 100644 index 00000000..021797ed --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.java @@ -0,0 +1,76 @@ +package com.hzya.frame.mdm.mdmModule.entity; + +import java.util.Date; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 主数据模版(MdmModule)实体类 + * + * @author makejava + * @since 2023-10-17 15:25:42 + */ +public class MdmModuleEntity extends BaseEntity { + + + /** logo(地址或者id) */ + private String mdmLogo; + /** + * 主数据名称 + */ + private String mdmName; + /** + * 主数据编码 + */ + private Integer mdmCode; + /** + * 主数据类型 1、档案 2、单据 + */ + private String mdmType; + /** + * 描述 + */ + private String remark; + + + public String getMdmName() { + return mdmName; + } + + public void setMdmName(String mdmName) { + this.mdmName = mdmName; + } + + public Integer getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Integer mdmCode) { + this.mdmCode = mdmCode; + } + + public String getMdmType() { + return mdmType; + } + + public void setMdmType(String mdmType) { + this.mdmType = mdmType; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getMdmLogo() { + return mdmLogo; + } + + public void setMdmLogo(String mdmLogo) { + this.mdmLogo = mdmLogo; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml new file mode 100644 index 00000000..c5e8ba94 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -0,0 +1,699 @@ + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_name + ,mdm_logo + ,mdm_code + ,mdm_type + ,remark + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + + + insert into mdm_module( + + id , + mdm_name , + mdm_logo , + mdm_code , + mdm_code , + mdm_type , + remark , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmName} , + #{mdmLogo} , + #{mdmCode} , + (SELECT IFNULL(MAX(b.mdm_code)+1,10001) AS mdmCode FROM mdm_module b ), + #{mdmType} , + #{remark} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_module(mdm_name,mdm_logo, mdm_code, mdm_type, remark, sorts, create_user_id, create_time, modify_user_id, + modify_time, sts, org_id, sts) + values + + (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module(mdm_name, mdm_logo, mdm_code, mdm_type, remark, sorts, create_user_id, create_time, modify_user_id, + modify_time, sts, org_id) + values + + (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_name = values(mdm_name), + mdm_logo = values(mdm_logo), + mdm_code = values(mdm_code), + mdm_type = values(mdm_type), + remark = values(remark), + sorts = values(sorts), + 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) + + + + update mdm_module set + + mdm_name = #{mdmName}, + mdm_logo = #{mdmLogo}, + mdm_code = #{mdmCode}, + mdm_type = #{mdmType}, + remark = #{remark}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_name = #{mdmName} + and mdm_logo = #{mdmLogo} + and mdm_code = #{mdmCode} + and mdm_type = #{mdmType} + and remark = #{remark} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module where id = #{id} + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into ${tableName}( + + + + + ${item.filedsName}, + + + create_user_id, + modify_user_id, + + + + sorts, + create_time, + modify_time, + sts, + + document_rule, + document_rule_num, + + + )values + ( + + + + + #{item.filedsValue}, + + + #{item.filedsValue}, + #{item.filedsValue}, + + + + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from ${tableName} a WHERE + a.sts = 'Y' ), + now(), + now(), + 'Y', + + ( concat(#{documentRule}, + (SELECT + IF + ( + LENGTH( (SELECT + IFNULL(MAX(b.document_rule_num),0)+1 + FROM + ${tableName} b + WHERE + DATE_FORMAT( b.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) ) <= ${documentRuleNum}, + LPAD( (SELECT + IFNULL(MAX(c.document_rule_num),0)+1 + FROM + ${tableName} c + WHERE + DATE_FORMAT( c.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )), ${documentRuleNum}, '0' ), + (SELECT + IFNULL(MAX(d.document_rule_num),0)+1 + FROM + ${tableName} d + WHERE + DATE_FORMAT( d.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) + ) + ) + )), + (SELECT + IF + ( + LENGTH( (SELECT + IFNULL(MAX(e.document_rule_num),0)+1 + FROM + ${tableName} e + WHERE + DATE_FORMAT( e.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) ) <= ${documentRuleNum}, + LPAD( (SELECT + IFNULL(MAX(f.document_rule_num),0)+1 + FROM + ${tableName} f + WHERE + DATE_FORMAT( f.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )), ${documentRuleNum}, '0' ), + (SELECT + IFNULL(MAX(g.document_rule_num),0)+1 + FROM + ${tableName} g + WHERE + DATE_FORMAT( g.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) + ) + ) + + + ) + + + update ${tableName} set + + + + + ${item.filedsName} = #{item.filedsValue}, + + + modify_user_id = #{item.filedsValue}, + + + + modify_time = now(), + + where id = #{id} + + + + update ${tableName} set + sts='N',modify_time = now(),modify_user_id = #{loginId} + + and id = #{id} + and formmain_id = #{formmain_id} + and sts='Y' + + + + + + update ${tableName} set + sts='N',modify_time = now(),modify_user_id = #{loginId} + + + and ${upIdFiled} like concat(#{upIdFiledValue},'%') + + and sts='Y' + + + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java new file mode 100644 index 00000000..837cb3e4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModule.service; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 主数据模版(MdmModule)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:25:44 + */ +public interface IMdmModuleService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java new file mode 100644 index 00000000..b82af615 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModule.service.impl; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 主数据模版(MdmModule)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:25:44 + */ +@Service(value = "mdmModuleService") +public class MdmModuleServiceImpl extends BaseService implements IMdmModuleService { + + private IMdmModuleDao mdmModuleDao; + + @Autowired + public void setMdmModuleDao(IMdmModuleDao dao) { + this.mdmModuleDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java new file mode 100644 index 00000000..b2a48a17 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleDb.dao; + +import com.hzya.frame.mdm.entity.MdmDistributeVo; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.entity.ModuleDto; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 模版数据库表(mdm_module_db: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:26:49 + */ +public interface IMdmModuleDbDao extends IBaseDao { + + HashMap getServiceDataById(Map queryData); + + List> getServiceByFormmainId(Map queryData); + List> getServiceByDistributeId(Map queryData); + List getServiceByDistributeIdNoCase(Map queryData); + + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java new file mode 100644 index 00000000..76eeaf7e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java @@ -0,0 +1,51 @@ +package com.hzya.frame.mdm.mdmModuleDb.dao.impl; + +import com.hzya.frame.mdm.entity.MdmDistributeVo; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; +import com.hzya.frame.sys.entity.ModuleDto; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 模版数据库表(MdmModuleDb)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:26:49 + */ +@Repository(value = "MdmModuleDbDaoImpl") +public class MdmModuleDbDaoImpl extends MybatisGenericDao implements IMdmModuleDbDao { + + @Override + public HashMap getServiceDataById(Map maps) { + HashMap o = (HashMap) super.selectOne(getSqlIdPrifx() + "getServiceDataById", maps); + return o; + + } + + @Override + public List> getServiceByFormmainId(Map maps) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "getServiceByFormmainId", maps); + return o; + + } + @Override + public List> getServiceByDistributeId(Map maps) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "getServiceByDistributeId", maps); + return o; + + } + @Override + public List getServiceByDistributeIdNoCase(Map maps) { + List o = (List) super.selectList(getSqlIdPrifx() + "getServiceByDistributeIdNoCase", maps); + return o; + + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.java new file mode 100644 index 00000000..9d50b509 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.java @@ -0,0 +1,77 @@ +package com.hzya.frame.mdm.mdmModuleDb.entity; + +import java.util.Date; +import java.util.List; + +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 模版数据库表(MdmModuleDb)实体类 + * + * @author makejava + * @since 2023-10-17 15:26:49 + */ +public class MdmModuleDbEntity extends BaseEntity { + + /** + * 主数据模版ID + */ + private String mdmId; + /** + * 表名 + */ + private String dbName; + /** + * 类型 1、主表 2、明细 + */ + private String dbType; + /** + * 备注 + */ + private String remark; + + //主数据子表字段 + private List sublistMdmModuleDbFileds; + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public List getSublistMdmModuleDbFileds() { + return sublistMdmModuleDbFileds; + } + + public void setSublistMdmModuleDbFileds(List sublistMdmModuleDbFileds) { + this.sublistMdmModuleDbFileds = sublistMdmModuleDbFileds; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml new file mode 100644 index 00000000..bb1e58d9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml @@ -0,0 +1,326 @@ + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,db_name + ,db_type + ,remark + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_db( + + id , + mdm_id , + db_name , + db_type , + remark , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{dbName} , + #{dbType} , + #{remark} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_db a WHERE a.sts = + 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_db(mdm_id, db_name, db_type, remark, sorts, create_user_id, create_time, modify_user_id, + modify_time, sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_db(mdm_id, db_name, db_type, remark, sorts, create_user_id, create_time, modify_user_id, + modify_time, sts, org_id) + values + + (#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + db_name = values(db_name), + db_type = values(db_type), + remark = values(remark), + sorts = values(sorts), + 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) + + + + update mdm_module_db set + + mdm_id = #{mdmId}, + db_name = #{dbName}, + db_type = #{dbType}, + remark = #{remark}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_db set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_db set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and db_name = #{dbName} + and db_type = #{dbType} + and remark = #{remark} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_db where id = #{id} + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/service/IMdmModuleDbService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/service/IMdmModuleDbService.java new file mode 100644 index 00000000..c041826d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/service/IMdmModuleDbService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleDb.service; + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 模版数据库表(MdmModuleDb)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:26:51 + */ +public interface IMdmModuleDbService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/service/impl/MdmModuleDbServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/service/impl/MdmModuleDbServiceImpl.java new file mode 100644 index 00000000..b017b6a0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/service/impl/MdmModuleDbServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleDb.service.impl; + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; +import com.hzya.frame.mdm.mdmModuleDb.service.IMdmModuleDbService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 模版数据库表(MdmModuleDb)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:26:51 + */ +@Service(value = "mdmModuleDbService") +public class MdmModuleDbServiceImpl extends BaseService implements IMdmModuleDbService { + + private IMdmModuleDbDao mdmModuleDbDao; + + @Autowired + public void setMdmModuleDbDao(IMdmModuleDbDao dao) { + this.mdmModuleDbDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java new file mode 100644 index 00000000..174e6a09 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleDbFileds.dao; + +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 模版数据库字段表(mdm_module_db_fileds: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:28:06 + */ +public interface IMdmModuleDbFiledsDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java new file mode 100644 index 00000000..362f1f76 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.mdm.mdmModuleDbFileds.dao.impl; + +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +/** + * 模版数据库字段表(MdmModuleDbFileds)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:28:07 + */ +@Repository(value = "MdmModuleDbFiledsDaoImpl") +public class MdmModuleDbFiledsDaoImpl extends MybatisGenericDao implements IMdmModuleDbFiledsDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java new file mode 100644 index 00000000..998924ea --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java @@ -0,0 +1,124 @@ +package com.hzya.frame.mdm.mdmModuleDbFileds.entity; + +import java.util.Date; +import java.util.List; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 模版数据库字段表(MdmModuleDbFileds)实体类 + * + * @author makejava + * @since 2023-10-17 15:28:07 + */ +public class MdmModuleDbFiledsEntity extends BaseEntity { + + /** + * 主数据模版ID + */ + private String mdmId; + /** + * 模版数据库id + */ + private String dbId; + /** + * 中文名 + */ + private String chName; + /** + * 英文名 + */ + private String enName; + /** + * 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + */ + private String filedType; + /** + * 长度 + */ + private String filedLength; + /** + * roletype + */ + private String roletype; + /** + * roletype + */ + private String roleValue; + //字段规则 + private List mdmModuleDbFiledsRules; + + public List getMdmModuleDbFiledsRules() { + return mdmModuleDbFiledsRules; + } + + public void setMdmModuleDbFiledsRules(List mdmModuleDbFiledsRules) { + this.mdmModuleDbFiledsRules = mdmModuleDbFiledsRules; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } + + public String getFiledLength() { + return filedLength; + } + + public void setFiledLength(String filedLength) { + this.filedLength = filedLength; + } + + public String getRoletype() { + return roletype; + } + + public void setRoletype(String roletype) { + this.roletype = roletype; + } + + public String getRoleValue() { + return roleValue; + } + + public void setRoleValue(String roleValue) { + this.roleValue = roleValue; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml new file mode 100644 index 00000000..0b770263 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,db_id + ,ch_name + ,en_name + ,filed_type + ,filed_length + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_db_fileds( + + id , + mdm_id , + db_id , + ch_name , + en_name , + filed_type , + filed_length , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{dbId} , + #{chName} , + #{enName} , + #{filedType} , + #{filedLength} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_db_fileds a WHERE + a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, filed_length, sorts, + create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.filedLength},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_db_fileds(mdm_id, db_id, ch_name, en_name, filed_type, filed_length, sorts, + create_user_id, create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.mdmId},#{entity.dbId},#{entity.chName},#{entity.enName},#{entity.filedType},#{entity.filedLength},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + db_id = values(db_id), + ch_name = values(ch_name), + en_name = values(en_name), + filed_type = values(filed_type), + filed_length = values(filed_length), + sorts = values(sorts), + 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) + + + + update mdm_module_db_fileds set + + mdm_id = #{mdmId}, + db_id = #{dbId}, + ch_name = #{chName}, + en_name = #{enName}, + filed_type = #{filedType}, + filed_length = #{filedLength}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and db_id = #{dbId} + and ch_name = #{chName} + and en_name = #{enName} + and filed_type = #{filedType} + and filed_length = #{filedLength} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_db_fileds where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/service/IMdmModuleDbFiledsService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/service/IMdmModuleDbFiledsService.java new file mode 100644 index 00000000..78f21fbb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/service/IMdmModuleDbFiledsService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleDbFileds.service; + +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 模版数据库字段表(MdmModuleDbFileds)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:28:09 + */ +public interface IMdmModuleDbFiledsService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/service/impl/MdmModuleDbFiledsServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/service/impl/MdmModuleDbFiledsServiceImpl.java new file mode 100644 index 00000000..016eea5e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/service/impl/MdmModuleDbFiledsServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleDbFileds.service.impl; + +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao; +import com.hzya.frame.mdm.mdmModuleDbFileds.service.IMdmModuleDbFiledsService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 模版数据库字段表(MdmModuleDbFileds)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:28:09 + */ +@Service(value = "mdmModuleDbFiledsService") +public class MdmModuleDbFiledsServiceImpl extends BaseService implements IMdmModuleDbFiledsService { + + private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao; + + @Autowired + public void setMdmModuleDbFiledsDao(IMdmModuleDbFiledsDao dao) { + this.mdmModuleDbFiledsDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java new file mode 100644 index 00000000..7b81046f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 模版数据库字段规则表(mdm_module_db_fileds_rule: table)表数据库访问层 + * + * @author makejava + * @since 2023-11-04 11:16:44 + */ +public interface IMdmModuleDbFiledsRuleDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java new file mode 100644 index 00000000..1a0d4f6b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.impl; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 模版数据库字段规则表(MdmModuleDbFiledsRule)表数据库访问层 + * + * @author makejava + * @since 2023-11-04 11:16:44 + */ +@Repository(value = "MdmModuleDbFiledsRuleDaoImpl") +public class MdmModuleDbFiledsRuleDaoImpl extends MybatisGenericDao implements IMdmModuleDbFiledsRuleDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.java new file mode 100644 index 00000000..8d71cc18 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.java @@ -0,0 +1,96 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 模版数据库字段规则表(MdmModuleDbFiledsRule)实体类 + * + * @author makejava + * @since 2023-11-04 11:16:44 + */ +public class MdmModuleDbFiledsRuleEntity extends BaseEntity { + + /** 主数据模版ID */ + private String mdmId; + /** 前端分拣用 */ + private String formName; + /** 模版数据库id */ + private String dbId; + /** 模版数据库字段id */ + private String filedId; + /** 规则名称 */ + private String ruleName; + /** 规则编码 */ + private String ruleCode; + /** 规则值 */ + private String ruleValue; + /** 规则类型1、表单属性 2、控件属性 */ + private String ruleType; + + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getFormName() { + return formName; + } + + public void setFormName(String formName) { + this.formName = formName; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + + public String getFiledId() { + return filedId; + } + + public void setFiledId(String filedId) { + this.filedId = filedId; + } + + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + + public String getRuleCode() { + return ruleCode; + } + + public void setRuleCode(String ruleCode) { + this.ruleCode = ruleCode; + } + + public String getRuleValue() { + return ruleValue; + } + + public void setRuleValue(String ruleValue) { + this.ruleValue = ruleValue; + } + + public String getRuleType() { + return ruleType; + } + + public void setRuleType(String ruleType) { + this.ruleType = ruleType; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml new file mode 100644 index 00000000..2c1a935e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,form_name + ,db_id + ,filed_id + ,rule_name + ,rule_code + ,rule_value + ,rule_type + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_db_fileds_rule( + + id , + mdm_id , + form_name , + db_id , + filed_id , + rule_name , + rule_code , + rule_value , + rule_type , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{formName} , + #{dbId} , + #{filedId} , + #{ruleName} , + #{ruleCode} , + #{ruleValue} , + #{ruleType} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_db_fileds_rule a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_module_db_fileds_rule(mdm_id, form_name, db_id, filed_id, rule_name, rule_code, rule_value, rule_type, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.formName},#{entity.dbId},#{entity.filedId},#{entity.ruleName},#{entity.ruleCode},#{entity.ruleValue},#{entity.ruleType},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, 'Y') + + + + + insert into mdm_module_db_fileds_rule(mdm_id, form_name, db_id, filed_id, rule_name, rule_code, rule_value, rule_type, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.mdmId},#{entity.formName},#{entity.dbId},#{entity.filedId},#{entity.ruleName},#{entity.ruleCode},#{entity.ruleValue},#{entity.ruleType},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + form_name = values(form_name), + db_id = values(db_id), + filed_id = values(filed_id), + rule_name = values(rule_name), + rule_code = values(rule_code), + rule_value = values(rule_value), + rule_type = values(rule_type), + sorts = values(sorts), + 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) + + +update mdm_module_db_fileds_rule set + + mdm_id = #{mdmId}, + form_name = #{formName}, + db_id = #{dbId}, + filed_id = #{filedId}, + rule_name = #{ruleName}, + rule_code = #{ruleCode}, + rule_value = #{ruleValue}, + rule_type = #{ruleType}, + sorts = #{sorts}, + 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}, + +where id = #{id} + + + +update mdm_module_db_fileds_rule set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_module_db_fileds_rule set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and form_name = #{formName} + and db_id = #{dbId} + and filed_id = #{filedId} + and rule_name = #{ruleName} + and rule_code = #{ruleCode} + and rule_value = #{ruleValue} + and rule_type = #{ruleType} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_db_fileds_rule where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/service/IMdmModuleDbFiledsRuleService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/service/IMdmModuleDbFiledsRuleService.java new file mode 100644 index 00000000..b679d0d3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/service/IMdmModuleDbFiledsRuleService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRule.service; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 模版数据库字段规则表(MdmModuleDbFiledsRule)表服务接口 + * + * @author makejava + * @since 2023-11-04 11:16:44 + */ +public interface IMdmModuleDbFiledsRuleService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/service/impl/MdmModuleDbFiledsRuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/service/impl/MdmModuleDbFiledsRuleServiceImpl.java new file mode 100644 index 00000000..941a5171 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/service/impl/MdmModuleDbFiledsRuleServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRule.service.impl; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.service.IMdmModuleDbFiledsRuleService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 模版数据库字段规则表(MdmModuleDbFiledsRule)表服务实现类 + * + * @author makejava + * @since 2023-11-04 11:16:44 + */ +@Service(value = "mdmModuleDbFiledsRuleService") +public class MdmModuleDbFiledsRuleServiceImpl extends BaseService implements IMdmModuleDbFiledsRuleService { + + private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; + + @Autowired + public void setMdmModuleDbFiledsRuleDao(IMdmModuleDbFiledsRuleDao dao) { + this.mdmModuleDbFiledsRuleDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/dao/IMdmModuleDbFiledsRuleFilesDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/dao/IMdmModuleDbFiledsRuleFilesDao.java new file mode 100644 index 00000000..8335ffae --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/dao/IMdmModuleDbFiledsRuleFilesDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.dao; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity.MdmModuleDbFiledsRuleFilesEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 模版数据库字段规则档案表(mdm_module_db_fileds_rule_files: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:30:12 + */ +public interface IMdmModuleDbFiledsRuleFilesDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/dao/impl/MdmModuleDbFiledsRuleFilesDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/dao/impl/MdmModuleDbFiledsRuleFilesDaoImpl.java new file mode 100644 index 00000000..f5f0d497 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/dao/impl/MdmModuleDbFiledsRuleFilesDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.dao.impl; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity.MdmModuleDbFiledsRuleFilesEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.dao.IMdmModuleDbFiledsRuleFilesDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +/** + * 模版数据库字段规则档案表(MdmModuleDbFiledsRuleFiles)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:30:12 + */ +@Repository(value = "MdmModuleDbFiledsRuleFilesDaoImpl") +public class MdmModuleDbFiledsRuleFilesDaoImpl extends MybatisGenericDao implements IMdmModuleDbFiledsRuleFilesDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/entity/MdmModuleDbFiledsRuleFilesEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/entity/MdmModuleDbFiledsRuleFilesEntity.java new file mode 100644 index 00000000..7f9bf614 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/entity/MdmModuleDbFiledsRuleFilesEntity.java @@ -0,0 +1,66 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity; + +import java.util.Date; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 模版数据库字段规则档案表(MdmModuleDbFiledsRuleFiles)实体类 + * + * @author makejava + * @since 2023-10-17 15:30:13 + */ +public class MdmModuleDbFiledsRuleFilesEntity extends BaseEntity { + + /** + * 规则名称 + */ + private String ruleName; + /** + * 规则编码 + */ + private String ruleCode; + /** + * 规则类型 1、表单属性 2、控件属性 + */ + private String ruleType; + /** + * 规则值 + */ + private String ruleValue; + + + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + + public String getRuleCode() { + return ruleCode; + } + + public void setRuleCode(String ruleCode) { + this.ruleCode = ruleCode; + } + + public String getRuleType() { + return ruleType; + } + + public void setRuleType(String ruleType) { + this.ruleType = ruleType; + } + + public String getRuleValue() { + return ruleValue; + } + + public void setRuleValue(String ruleValue) { + this.ruleValue = ruleValue; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/entity/MdmModuleDbFiledsRuleFilesEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/entity/MdmModuleDbFiledsRuleFilesEntity.xml new file mode 100644 index 00000000..9a750608 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/entity/MdmModuleDbFiledsRuleFilesEntity.xml @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + id + ,rule_name + ,rule_code + ,rule_type + ,rule_value + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_db_fileds_rule_files( + + id , + rule_name , + rule_code , + rule_type , + rule_value , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{ruleName} , + #{ruleCode} , + #{ruleType} , + #{ruleValue} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from + mdm_module_db_fileds_rule_files a WHERE a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_db_fileds_rule_files(rule_name, rule_code, rule_type, rule_value, sorts, create_user_id, + create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.ruleName},#{entity.ruleCode},#{entity.ruleType},#{entity.ruleValue},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_db_fileds_rule_files(rule_name, rule_code, rule_type, rule_value, sorts, create_user_id, + create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.ruleName},#{entity.ruleCode},#{entity.ruleType},#{entity.ruleValue},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + rule_name = values(rule_name), + rule_code = values(rule_code), + rule_type = values(rule_type), + rule_value = values(rule_value), + sorts = values(sorts), + 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) + + + + update mdm_module_db_fileds_rule_files set + + rule_name = #{ruleName}, + rule_code = #{ruleCode}, + rule_type = #{ruleType}, + rule_value = #{ruleValue}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_db_fileds_rule_files set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_db_fileds_rule_files set sts= 'N' ,modify_time = #{modify_time},modify_user_id = + #{modify_user_id} + + and id = #{id} + and rule_name = #{ruleName} + and rule_code = #{ruleCode} + and rule_type = #{ruleType} + and rule_value = #{ruleValue} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_db_fileds_rule_files where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/service/IMdmModuleDbFiledsRuleFilesService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/service/IMdmModuleDbFiledsRuleFilesService.java new file mode 100644 index 00000000..75e81394 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/service/IMdmModuleDbFiledsRuleFilesService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.service; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity.MdmModuleDbFiledsRuleFilesEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 模版数据库字段规则档案表(MdmModuleDbFiledsRuleFiles)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:30:14 + */ +public interface IMdmModuleDbFiledsRuleFilesService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/service/impl/MdmModuleDbFiledsRuleFilesServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/service/impl/MdmModuleDbFiledsRuleFilesServiceImpl.java new file mode 100644 index 00000000..c056dd51 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRuleFiles/service/impl/MdmModuleDbFiledsRuleFilesServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.service.impl; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity.MdmModuleDbFiledsRuleFilesEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.dao.IMdmModuleDbFiledsRuleFilesDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.service.IMdmModuleDbFiledsRuleFilesService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 模版数据库字段规则档案表(MdmModuleDbFiledsRuleFiles)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:30:15 + */ +@Service(value = "mdmModuleDbFiledsRuleFilesService") +public class MdmModuleDbFiledsRuleFilesServiceImpl extends BaseService implements IMdmModuleDbFiledsRuleFilesService { + + private IMdmModuleDbFiledsRuleFilesDao mdmModuleDbFiledsRuleFilesDao; + + @Autowired + public void setMdmModuleDbFiledsRuleFilesDao(IMdmModuleDbFiledsRuleFilesDao dao) { + this.mdmModuleDbFiledsRuleFilesDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java new file mode 100644 index 00000000..1bb97fe8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleDistribute.dao; + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据功能应用分发表(mdm_module_distribute: table)表数据库访问层 + * + * @author makejava + * @since 2023-11-06 15:27:41 + */ +public interface IMdmModuleDistributeDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java new file mode 100644 index 00000000..e4070581 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmModuleDistribute.dao.impl; + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层 + * + * @author makejava + * @since 2023-11-06 15:27:42 + */ +@Repository(value = "MdmModuleDistributeDaoImpl") +public class MdmModuleDistributeDaoImpl extends MybatisGenericDao implements IMdmModuleDistributeDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java new file mode 100644 index 00000000..d65a44eb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java @@ -0,0 +1,116 @@ +package com.hzya.frame.mdm.mdmModuleDistribute.entity; + +import java.util.Date; +import java.util.List; + +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 主数据功能应用分发表(MdmModuleDistribute)实体类 + * + * @author makejava + * @since 2023-11-06 15:27:42 + */ +public class MdmModuleDistributeEntity extends BaseEntity { + + /** 主数据模版ID */ + private String mdmId; + /** 应用id */ + private String appId; + /** 新增接口 */ + private String addApi; + /** 删除接口 */ + private String deleteApi; + /** 新增使用类型 */ + private String addType; + /** 删除使用类型 */ + private String deleteType; + /** 新增插件 */ + private String addPlug; + /** 删除插件 */ + private String deletePlug; + private List addList; + private List deleteList; + + public List getAddList() { + return addList; + } + + public void setAddList(List addList) { + this.addList = addList; + } + + public List getDeleteList() { + return deleteList; + } + + public void setDeleteList(List deleteList) { + this.deleteList = deleteList; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getAddApi() { + return addApi; + } + + public void setAddApi(String addApi) { + this.addApi = addApi; + } + + public String getDeleteApi() { + return deleteApi; + } + + public void setDeleteApi(String deleteApi) { + this.deleteApi = deleteApi; + } + + public String getAddType() { + return addType; + } + + public void setAddType(String addType) { + this.addType = addType; + } + + public String getDeleteType() { + return deleteType; + } + + public void setDeleteType(String deleteType) { + this.deleteType = deleteType; + } + + public String getAddPlug() { + return addPlug; + } + + public void setAddPlug(String addPlug) { + this.addPlug = addPlug; + } + + public String getDeletePlug() { + return deletePlug; + } + + public void setDeletePlug(String deletePlug) { + this.deletePlug = deletePlug; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml new file mode 100644 index 00000000..78643815 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,app_id + ,add_api + ,delete_api + ,add_type + ,delete_type + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,add_plug + ,delete_plug + + + + + + + + + + + + + + + + insert into mdm_module_distribute( + + id , + mdm_id , + app_id , + add_api , + delete_api , + add_type , + delete_type , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + add_plug , + delete_plug , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{appId} , + #{addApi} , + #{deleteApi} , + #{addType} , + #{deleteType} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{addPlug} , + #{deletePlug} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_module_distribute(mdm_id, app_id, add_api, delete_api, add_type, delete_type, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, add_plug, delete_plug, sts) + values + + (#{entity.mdmId},#{entity.appId},#{entity.addApi},#{entity.deleteApi},#{entity.addType},#{entity.deleteType},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.addPlug},#{entity.deletePlug}, 'Y') + + + + + insert into mdm_module_distribute(mdm_id, app_id, add_api, delete_api, add_type, delete_type, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, add_plug, delete_plug) + values + + (#{entity.mdmId},#{entity.appId},#{entity.addApi},#{entity.deleteApi},#{entity.addType},#{entity.deleteType},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.addPlug},#{entity.deletePlug}) + + on duplicate key update + mdm_id = values(mdm_id), + app_id = values(app_id), + add_api = values(add_api), + delete_api = values(delete_api), + add_type = values(add_type), + delete_type = values(delete_type), + sorts = values(sorts), + 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), + add_plug = values(add_plug), + delete_plug = values(delete_plug) + + +update mdm_module_distribute set + + mdm_id = #{mdmId}, + app_id = #{appId}, + add_api = #{addApi}, + delete_api = #{deleteApi}, + add_type = #{addType}, + delete_type = #{deleteType}, + sorts = #{sorts}, + 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}, + add_plug = #{addPlug}, + delete_plug = #{deletePlug}, + +where id = #{id} + + + +update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and app_id = #{appId} + and add_api = #{addApi} + and delete_api = #{deleteApi} + and add_type = #{addType} + and delete_type = #{deleteType} + and sorts = #{sorts} + and sts = #{sts} + and add_plug = #{addPlug} + and delete_plug = #{deletePlug} + and sts='Y' + + + + + delete from mdm_module_distribute where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java new file mode 100644 index 00000000..474d58c9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.mdm.mdmModuleDistribute.service; + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 主数据功能应用分发表(MdmModuleDistribute)表服务接口 + * + * @author makejava + * @since 2023-11-06 15:27:42 + */ +public interface IMdmModuleDistributeService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java new file mode 100644 index 00000000..0ccdb809 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.mdm.mdmModuleDistribute.service.impl; + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; +import com.hzya.frame.mdm.mdmModuleDistribute.service.IMdmModuleDistributeService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 主数据功能应用分发表(MdmModuleDistribute)表服务实现类 + * + * @author makejava + * @since 2023-11-06 15:27:42 + */ +@Service(value = "mdmModuleDistributeService") +public class MdmModuleDistributeServiceImpl extends BaseService implements IMdmModuleDistributeService { + + private IMdmModuleDistributeDao mdmModuleDistributeDao; + + @Autowired + public void setMdmModuleDistributeDao(IMdmModuleDistributeDao dao) { + this.mdmModuleDistributeDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java new file mode 100644 index 00000000..90278a9f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleDistributeDetail.dao; + +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据功能应用分发明细表(mdm_module_distribute_detail: table)表数据库访问层 + * + * @author makejava + * @since 2023-11-07 09:11:31 + */ +public interface IMdmModuleDistributeDetailDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java new file mode 100644 index 00000000..daeb3dc5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.impl; + +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表数据库访问层 + * + * @author makejava + * @since 2023-11-07 09:11:31 + */ +@Repository(value = "MdmModuleDistributeDetailDaoImpl") +public class MdmModuleDistributeDetailDaoImpl extends MybatisGenericDao implements IMdmModuleDistributeDetailDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java new file mode 100644 index 00000000..89f45fe7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java @@ -0,0 +1,144 @@ +package com.hzya.frame.mdm.mdmModuleDistributeDetail.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 主数据功能应用分发明细表(MdmModuleDistributeDetail)实体类 + * + * @author makejava + * @since 2023-11-07 09:11:31 + */ +public class MdmModuleDistributeDetailEntity extends BaseEntity { + + /** 主数据模版ID */ + private String mdmId; + /** 应用分发id */ + private String distributeId; + /** 接口id */ + private String apiId; + /** 源API字段 */ + private String sourceField; + /** 源API字段名 */ + private String sourceName; + /** 目标API字段 */ + private String targetField; + /** 目标API字段名 */ + private String targetName; + /** 目标API字段默认值 */ + private String defaultVaule; + /** 源字段层级 */ + private String sourceFieldPath; + /** 目标字段层级 */ + private String targetFieldPath; + private String targetPath; + private String sourcePath; + /** 连线信息 */ + private String coordinate; + + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getDistributeId() { + return distributeId; + } + + public void setDistributeId(String distributeId) { + this.distributeId = distributeId; + } + + public String getApiId() { + return apiId; + } + + public void setApiId(String apiId) { + this.apiId = apiId; + } + + public String getSourceField() { + return sourceField; + } + + public void setSourceField(String sourceField) { + this.sourceField = sourceField; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getTargetField() { + return targetField; + } + + public void setTargetField(String targetField) { + this.targetField = targetField; + } + + public String getTargetName() { + return targetName; + } + + public void setTargetName(String targetName) { + this.targetName = targetName; + } + + public String getDefaultVaule() { + return defaultVaule; + } + + public void setDefaultVaule(String defaultVaule) { + this.defaultVaule = defaultVaule; + } + + public String getSourceFieldPath() { + return sourceFieldPath; + } + + public void setSourceFieldPath(String sourceFieldPath) { + this.sourceFieldPath = sourceFieldPath; + } + + public String getTargetFieldPath() { + return targetFieldPath; + } + + public void setTargetFieldPath(String targetFieldPath) { + this.targetFieldPath = targetFieldPath; + } + + public String getTargetPath() { + return targetPath; + } + + public void setTargetPath(String targetPath) { + this.targetPath = targetPath; + } + + public String getSourcePath() { + return sourcePath; + } + + public void setSourcePath(String sourcePath) { + this.sourcePath = sourcePath; + } + + public String getCoordinate() { + return coordinate; + } + + public void setCoordinate(String coordinate) { + this.coordinate = coordinate; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml new file mode 100644 index 00000000..325c175e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,distribute_id + ,api_id + ,source_field + ,source_name + ,target_field + ,target_name + ,default_vaule + ,source_field_path + ,target_field_path + ,target_path + ,source_path + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,coordinate + + + + + + + + + + + + + + + + insert into mdm_module_distribute_detail( + + id , + mdm_id , + distribute_id , + api_id , + source_field , + source_name , + target_field , + target_name , + default_vaule , + source_field_path , + target_field_path , + target_path , + source_path , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + coordinate , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{distributeId} , + #{apiId} , + #{sourceField} , + #{sourceName} , + #{targetField} , + #{targetName} , + #{defaultVaule} , + #{sourceFieldPath} , + #{targetFieldPath} , + #{targetPath} , + #{sourcePath} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{coordinate} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute_detail a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, source_field, source_name, target_field, target_name, default_vaule, source_field_path, target_field_path, target_path, source_path, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, coordinate, sts) + values + + (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.sourceField},#{entity.sourceName},#{entity.targetField},#{entity.targetName},#{entity.defaultVaule},#{entity.sourceFieldPath},#{entity.targetFieldPath},#{entity.targetPath},#{entity.sourcePath},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.coordinate}, 'Y') + + + + + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, source_field, source_name, target_field, target_name, default_vaule, source_field_path, target_field_path, target_path, source_path, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, coordinate) + values + + (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.sourceField},#{entity.sourceName},#{entity.targetField},#{entity.targetName},#{entity.defaultVaule},#{entity.sourceFieldPath},#{entity.targetFieldPath},#{entity.targetPath},#{entity.sourcePath},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.coordinate}) + + on duplicate key update + mdm_id = values(mdm_id), + distribute_id = values(distribute_id), + api_id = values(api_id), + source_field = values(source_field), + source_name = values(source_name), + target_field = values(target_field), + target_name = values(target_name), + default_vaule = values(default_vaule), + source_field_path = values(source_field_path), + target_field_path = values(target_field_path), + target_path = values(target_path), + source_path = values(source_path), + sorts = values(sorts), + 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), + coordinate = values(coordinate) + + +update mdm_module_distribute_detail set + + mdm_id = #{mdmId}, + distribute_id = #{distributeId}, + api_id = #{apiId}, + source_field = #{sourceField}, + source_name = #{sourceName}, + target_field = #{targetField}, + target_name = #{targetName}, + default_vaule = #{defaultVaule}, + source_field_path = #{sourceFieldPath}, + target_field_path = #{targetFieldPath}, + target_path = #{targetPath}, + source_path = #{sourcePath}, + sorts = #{sorts}, + 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}, + coordinate = #{coordinate}, + +where id = #{id} + + + +update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and distribute_id = #{distributeId} + and api_id = #{apiId} + and source_field = #{sourceField} + and source_name = #{sourceName} + and target_field = #{targetField} + and target_name = #{targetName} + and default_vaule = #{defaultVaule} + and source_field_path = #{sourceFieldPath} + and target_field_path = #{targetFieldPath} + and target_path = #{targetPath} + and source_path = #{sourcePath} + and sorts = #{sorts} + and sts = #{sts} + and coordinate = #{coordinate} + and sts='Y' + + + + + delete from mdm_module_distribute_detail where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java new file mode 100644 index 00000000..1239a232 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.mdm.mdmModuleDistributeDetail.service; + +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务接口 + * + * @author makejava + * @since 2023-11-07 09:11:31 + */ +public interface IMdmModuleDistributeDetailService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java new file mode 100644 index 00000000..71aef349 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.mdm.mdmModuleDistributeDetail.service.impl; + +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.service.IMdmModuleDistributeDetailService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务实现类 + * + * @author makejava + * @since 2023-11-07 09:11:31 + */ +@Service(value = "mdmModuleDistributeDetailService") +public class MdmModuleDistributeDetailServiceImpl extends BaseService implements IMdmModuleDistributeDetailService { + + private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; + + @Autowired + public void setMdmModuleDistributeDetailDao(IMdmModuleDistributeDetailDao dao) { + this.mdmModuleDistributeDetailDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/dao/IMdmModuleRoleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/dao/IMdmModuleRoleDao.java new file mode 100644 index 00000000..405d975f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/dao/IMdmModuleRoleDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleRole.dao; + +import com.hzya.frame.mdm.mdmModuleRole.entity.MdmModuleRoleEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据功能角色表(mdm_module_role: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:32:25 + */ +public interface IMdmModuleRoleDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/dao/impl/MdmModuleRoleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/dao/impl/MdmModuleRoleDaoImpl.java new file mode 100644 index 00000000..7a5b8602 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/dao/impl/MdmModuleRoleDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.mdm.mdmModuleRole.dao.impl; + +import com.hzya.frame.mdm.mdmModuleRole.entity.MdmModuleRoleEntity; +import com.hzya.frame.mdm.mdmModuleRole.dao.IMdmModuleRoleDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +/** + * 主数据功能角色表(MdmModuleRole)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:32:25 + */ +@Repository(value = "MdmModuleRoleDaoImpl") +public class MdmModuleRoleDaoImpl extends MybatisGenericDao implements IMdmModuleRoleDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/entity/MdmModuleRoleEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/entity/MdmModuleRoleEntity.java new file mode 100644 index 00000000..992ed5e7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/entity/MdmModuleRoleEntity.java @@ -0,0 +1,52 @@ +package com.hzya.frame.mdm.mdmModuleRole.entity; + +import java.util.Date; +import java.util.List; + +import com.hzya.frame.mdm.mdmModuleRoleButton.entity.MdmModuleRoleButtonEntity; +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 主数据功能角色表(MdmModuleRole)实体类 + * + * @author makejava + * @since 2023-10-17 15:32:25 + */ +public class MdmModuleRoleEntity extends BaseEntity { + + /** + * 主数据模版ID + */ + private String mdmId; + /** + * 角色id + */ + private String roleId; + + //角色按钮 + private List mdmModuleRoleButtonEntities; + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public List getMdmModuleRoleButtonEntities() { + return mdmModuleRoleButtonEntities; + } + + public void setMdmModuleRoleButtonEntities(List mdmModuleRoleButtonEntities) { + this.mdmModuleRoleButtonEntities = mdmModuleRoleButtonEntities; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/entity/MdmModuleRoleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/entity/MdmModuleRoleEntity.xml new file mode 100644 index 00000000..aed8c808 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/entity/MdmModuleRoleEntity.xml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,role_id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_role( + + id , + mdm_id , + role_id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{roleId} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_role a WHERE a.sts + = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_role(mdm_id, role_id, sorts, create_user_id, create_time, modify_user_id, modify_time, + sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.roleId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_role(mdm_id, role_id, sorts, create_user_id, create_time, modify_user_id, modify_time, + sts, org_id) + values + + (#{entity.mdmId},#{entity.roleId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + role_id = values(role_id), + sorts = values(sorts), + 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) + + + + update mdm_module_role set + + mdm_id = #{mdmId}, + role_id = #{roleId}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_role set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_role set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and role_id = #{roleId} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_role where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/service/IMdmModuleRoleService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/service/IMdmModuleRoleService.java new file mode 100644 index 00000000..dfca9fc8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/service/IMdmModuleRoleService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleRole.service; + +import com.hzya.frame.mdm.mdmModuleRole.entity.MdmModuleRoleEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 主数据功能角色表(MdmModuleRole)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:32:26 + */ +public interface IMdmModuleRoleService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/service/impl/MdmModuleRoleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/service/impl/MdmModuleRoleServiceImpl.java new file mode 100644 index 00000000..da3d0b94 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRole/service/impl/MdmModuleRoleServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleRole.service.impl; + +import com.hzya.frame.mdm.mdmModuleRole.entity.MdmModuleRoleEntity; +import com.hzya.frame.mdm.mdmModuleRole.dao.IMdmModuleRoleDao; +import com.hzya.frame.mdm.mdmModuleRole.service.IMdmModuleRoleService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 主数据功能角色表(MdmModuleRole)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:32:27 + */ +@Service(value = "mdmModuleRoleService") +public class MdmModuleRoleServiceImpl extends BaseService implements IMdmModuleRoleService { + + private IMdmModuleRoleDao mdmModuleRoleDao; + + @Autowired + public void setMdmModuleRoleDao(IMdmModuleRoleDao dao) { + this.mdmModuleRoleDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/dao/IMdmModuleRoleButtonDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/dao/IMdmModuleRoleButtonDao.java new file mode 100644 index 00000000..37e5690a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/dao/IMdmModuleRoleButtonDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleRoleButton.dao; + +import com.hzya.frame.mdm.mdmModuleRoleButton.entity.MdmModuleRoleButtonEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据功能角色按钮表(mdm_module_role_button: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:33:09 + */ +public interface IMdmModuleRoleButtonDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/dao/impl/MdmModuleRoleButtonDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/dao/impl/MdmModuleRoleButtonDaoImpl.java new file mode 100644 index 00000000..322c53e4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/dao/impl/MdmModuleRoleButtonDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.mdm.mdmModuleRoleButton.dao.impl; + +import com.hzya.frame.mdm.mdmModuleRoleButton.entity.MdmModuleRoleButtonEntity; +import com.hzya.frame.mdm.mdmModuleRoleButton.dao.IMdmModuleRoleButtonDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +/** + * 主数据功能角色按钮表(MdmModuleRoleButton)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:33:10 + */ +@Repository(value = "MdmModuleRoleButtonDaoImpl") +public class MdmModuleRoleButtonDaoImpl extends MybatisGenericDao implements IMdmModuleRoleButtonDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/entity/MdmModuleRoleButtonEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/entity/MdmModuleRoleButtonEntity.java new file mode 100644 index 00000000..fa71faf2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/entity/MdmModuleRoleButtonEntity.java @@ -0,0 +1,92 @@ +package com.hzya.frame.mdm.mdmModuleRoleButton.entity; + +import java.util.Date; +import java.util.List; + +import com.hzya.frame.sys.userRole.entity.UserRole; +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 主数据功能角色按钮表(MdmModuleRoleButton)实体类 + * + * @author makejava + * @since 2023-10-17 15:33:10 + */ +public class MdmModuleRoleButtonEntity extends BaseEntity { + + /** + * 主数据模版ID + */ + private String mdmId; + /** + * 模块角色id + */ + private String moduleRoleId; + /** + * 角色id + */ + private String roleId; + /** + * 按钮类型 + */ + private String buttonType; + /** + * 按钮名 + */ + private String buttonName; + + /** + * 角色ids + */ + private List roleIds; + + public List getRoleIds() { + return roleIds; + } + + public void setRoleIds(List roleIds) { + this.roleIds = roleIds; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getModuleRoleId() { + return moduleRoleId; + } + + public void setModuleRoleId(String moduleRoleId) { + this.moduleRoleId = moduleRoleId; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getButtonType() { + return buttonType; + } + + public void setButtonType(String buttonType) { + this.buttonType = buttonType; + } + + public String getButtonName() { + return buttonName; + } + + public void setButtonName(String buttonName) { + this.buttonName = buttonName; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/entity/MdmModuleRoleButtonEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/entity/MdmModuleRoleButtonEntity.xml new file mode 100644 index 00000000..5830309d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/entity/MdmModuleRoleButtonEntity.xml @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,module_role_id + ,role_id + ,button_type + ,button_name + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_role_button( + + id , + mdm_id , + module_role_id , + role_id , + button_type , + button_name , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{moduleRoleId} , + #{roleId} , + #{buttonType} , + #{buttonName} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_role_button a + WHERE a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_role_button(mdm_id, module_role_id, role_id, button_type, button_name, sorts, + create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.moduleRoleId},#{entity.roleId},#{entity.buttonType},#{entity.buttonName},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_role_button(mdm_id, module_role_id, role_id, button_type, button_name, sorts, + create_user_id, create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.mdmId},#{entity.moduleRoleId},#{entity.roleId},#{entity.buttonType},#{entity.buttonName},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + module_role_id = values(module_role_id), + role_id = values(role_id), + button_type = values(button_type), + button_name = values(button_name), + sorts = values(sorts), + 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) + + + + update mdm_module_role_button set + + mdm_id = #{mdmId}, + module_role_id = #{moduleRoleId}, + role_id = #{roleId}, + button_type = #{buttonType}, + button_name = #{buttonName}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_role_button set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_role_button set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and module_role_id = #{moduleRoleId} + and role_id = #{roleId} + and button_type = #{buttonType} + and button_name = #{buttonName} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_role_button where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/service/IMdmModuleRoleButtonService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/service/IMdmModuleRoleButtonService.java new file mode 100644 index 00000000..3f956fd2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/service/IMdmModuleRoleButtonService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleRoleButton.service; + +import com.hzya.frame.mdm.mdmModuleRoleButton.entity.MdmModuleRoleButtonEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 主数据功能角色按钮表(MdmModuleRoleButton)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:33:11 + */ +public interface IMdmModuleRoleButtonService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/service/impl/MdmModuleRoleButtonServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/service/impl/MdmModuleRoleButtonServiceImpl.java new file mode 100644 index 00000000..bc5bfc73 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleRoleButton/service/impl/MdmModuleRoleButtonServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleRoleButton.service.impl; + +import com.hzya.frame.mdm.mdmModuleRoleButton.entity.MdmModuleRoleButtonEntity; +import com.hzya.frame.mdm.mdmModuleRoleButton.dao.IMdmModuleRoleButtonDao; +import com.hzya.frame.mdm.mdmModuleRoleButton.service.IMdmModuleRoleButtonService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 主数据功能角色按钮表(MdmModuleRoleButton)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:33:12 + */ +@Service(value = "mdmModuleRoleButtonService") +public class MdmModuleRoleButtonServiceImpl extends BaseService implements IMdmModuleRoleButtonService { + + private IMdmModuleRoleButtonDao mdmModuleRoleButtonDao; + + @Autowired + public void setMdmModuleRoleButtonDao(IMdmModuleRoleButtonDao dao) { + this.mdmModuleRoleButtonDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/dao/IMdmModuleUserViewDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/dao/IMdmModuleUserViewDao.java new file mode 100644 index 00000000..1e2f0494 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/dao/IMdmModuleUserViewDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleUserView.dao; + +import com.hzya.frame.mdm.mdmModuleUserView.entity.MdmModuleUserViewEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据用户视图表(mdm_module_user_view: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:33:47 + */ +public interface IMdmModuleUserViewDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/dao/impl/MdmModuleUserViewDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/dao/impl/MdmModuleUserViewDaoImpl.java new file mode 100644 index 00000000..37970aee --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/dao/impl/MdmModuleUserViewDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.mdm.mdmModuleUserView.dao.impl; + +import com.hzya.frame.mdm.mdmModuleUserView.entity.MdmModuleUserViewEntity; +import com.hzya.frame.mdm.mdmModuleUserView.dao.IMdmModuleUserViewDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +/** + * 主数据用户视图表(MdmModuleUserView)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:33:47 + */ +@Repository(value = "MdmModuleUserViewDaoImpl") +public class MdmModuleUserViewDaoImpl extends MybatisGenericDao implements IMdmModuleUserViewDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/entity/MdmModuleUserViewEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/entity/MdmModuleUserViewEntity.java new file mode 100644 index 00000000..7a1ef8e3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/entity/MdmModuleUserViewEntity.java @@ -0,0 +1,54 @@ +package com.hzya.frame.mdm.mdmModuleUserView.entity; + +import java.util.Date; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 主数据用户视图表(MdmModuleUserView)实体类 + * + * @author makejava + * @since 2023-10-17 15:33:48 + */ +public class MdmModuleUserViewEntity extends BaseEntity { + + /** + * 主数据模版ID + */ + private String mdmId; + /** + * 用户id + */ + private String userId; + /** + * 视图明细id + */ + private String viewDetailId; + + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getViewDetailId() { + return viewDetailId; + } + + public void setViewDetailId(String viewDetailId) { + this.viewDetailId = viewDetailId; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/entity/MdmModuleUserViewEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/entity/MdmModuleUserViewEntity.xml new file mode 100644 index 00000000..ed59ddb5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/entity/MdmModuleUserViewEntity.xml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,user_id + ,view_detail_id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_user_view( + + id , + mdm_id , + user_id , + view_detail_id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{userId} , + #{viewDetailId} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_user_view a WHERE + a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_user_view(mdm_id, user_id, view_detail_id, sorts, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.userId},#{entity.viewDetailId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_user_view(mdm_id, user_id, view_detail_id, sorts, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id) + values + + (#{entity.mdmId},#{entity.userId},#{entity.viewDetailId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + user_id = values(user_id), + view_detail_id = values(view_detail_id), + sorts = values(sorts), + 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) + + + + update mdm_module_user_view set + + mdm_id = #{mdmId}, + user_id = #{userId}, + view_detail_id = #{viewDetailId}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_user_view set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_user_view set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and user_id = #{userId} + and view_detail_id = #{viewDetailId} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_user_view where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/service/IMdmModuleUserViewService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/service/IMdmModuleUserViewService.java new file mode 100644 index 00000000..05ee428b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/service/IMdmModuleUserViewService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleUserView.service; + +import com.hzya.frame.mdm.mdmModuleUserView.entity.MdmModuleUserViewEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 主数据用户视图表(MdmModuleUserView)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:33:48 + */ +public interface IMdmModuleUserViewService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/service/impl/MdmModuleUserViewServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/service/impl/MdmModuleUserViewServiceImpl.java new file mode 100644 index 00000000..d3984f4b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleUserView/service/impl/MdmModuleUserViewServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleUserView.service.impl; + +import com.hzya.frame.mdm.mdmModuleUserView.entity.MdmModuleUserViewEntity; +import com.hzya.frame.mdm.mdmModuleUserView.dao.IMdmModuleUserViewDao; +import com.hzya.frame.mdm.mdmModuleUserView.service.IMdmModuleUserViewService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 主数据用户视图表(MdmModuleUserView)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:33:49 + */ +@Service(value = "mdmModuleUserViewService") +public class MdmModuleUserViewServiceImpl extends BaseService implements IMdmModuleUserViewService { + + private IMdmModuleUserViewDao mdmModuleUserViewDao; + + @Autowired + public void setMdmModuleUserViewDao(IMdmModuleUserViewDao dao) { + this.mdmModuleUserViewDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java new file mode 100644 index 00000000..b9bedcc9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleView.dao; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据视图表(mdm_module_view: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:34:17 + */ +public interface IMdmModuleViewDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java new file mode 100644 index 00000000..c9a5af9f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.mdm.mdmModuleView.dao.impl; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +/** + * 主数据视图表(MdmModuleView)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:34:17 + */ +@Repository(value = "MdmModuleViewDaoImpl") +public class MdmModuleViewDaoImpl extends MybatisGenericDao implements IMdmModuleViewDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java new file mode 100644 index 00000000..83d451fd --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java @@ -0,0 +1,66 @@ +package com.hzya.frame.mdm.mdmModuleView.entity; + +import java.util.Date; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 主数据视图表(MdmModuleView)实体类 + * + * @author makejava + * @since 2023-10-17 15:34:17 + */ +public class MdmModuleViewEntity extends BaseEntity { + + /** + * 主数据模版ID + */ + private String mdmId; + /** + * 显示类型 1、树 2、列表 + */ + private String viewName; + /** + * 显示字段 + */ + private String viewFiled; + /** + * 上级id字段 + */ + private String upIdFiled; + + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getViewName() { + return viewName; + } + + public void setViewName(String viewName) { + this.viewName = viewName; + } + + public String getViewFiled() { + return viewFiled; + } + + public void setViewFiled(String viewFiled) { + this.viewFiled = viewFiled; + } + + public String getUpIdFiled() { + return upIdFiled; + } + + public void setUpIdFiled(String upIdFiled) { + this.upIdFiled = upIdFiled; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml new file mode 100644 index 00000000..c9f3e025 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,view_name + ,view_filed + ,up_id_filed + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_view( + + id , + mdm_id , + view_name , + view_filed , + up_id_filed , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{viewName} , + #{viewFiled} , + #{upIdFiled} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_view a WHERE a.sts + = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_view(mdm_id, view_name, view_filed, up_id_filed, sorts, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.viewName},#{entity.viewFiled},#{entity.upIdFiled},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_view(mdm_id, view_name, view_filed, up_id_filed, sorts, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id) + values + + (#{entity.mdmId},#{entity.viewName},#{entity.viewFiled},#{entity.upIdFiled},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + view_name = values(view_name), + view_filed = values(view_filed), + up_id_filed = values(up_id_filed), + sorts = values(sorts), + 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) + + + + update mdm_module_view set + + mdm_id = #{mdmId}, + view_name = #{viewName}, + view_filed = #{viewFiled}, + up_id_filed = #{upIdFiled}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_view set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_view set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and view_name = #{viewName} + and view_filed = #{viewFiled} + and up_id_filed = #{upIdFiled} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_view where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/service/IMdmModuleViewService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/service/IMdmModuleViewService.java new file mode 100644 index 00000000..ffcd3338 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/service/IMdmModuleViewService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleView.service; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 主数据视图表(MdmModuleView)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:34:18 + */ +public interface IMdmModuleViewService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/service/impl/MdmModuleViewServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/service/impl/MdmModuleViewServiceImpl.java new file mode 100644 index 00000000..7029f030 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/service/impl/MdmModuleViewServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleView.service.impl; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; +import com.hzya.frame.mdm.mdmModuleView.service.IMdmModuleViewService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 主数据视图表(MdmModuleView)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:34:19 + */ +@Service(value = "mdmModuleViewService") +public class MdmModuleViewServiceImpl extends BaseService implements IMdmModuleViewService { + + private IMdmModuleViewDao mdmModuleViewDao; + + @Autowired + public void setMdmModuleViewDao(IMdmModuleViewDao dao) { + this.mdmModuleViewDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/dao/IMdmModuleViewDetailDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/dao/IMdmModuleViewDetailDao.java new file mode 100644 index 00000000..c5623fb1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/dao/IMdmModuleViewDetailDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleViewDetail.dao; + +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据视图明细表(mdm_module_view_detail: table)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:34:58 + */ +public interface IMdmModuleViewDetailDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/dao/impl/MdmModuleViewDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/dao/impl/MdmModuleViewDetailDaoImpl.java new file mode 100644 index 00000000..4dd7e229 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/dao/impl/MdmModuleViewDetailDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.mdm.mdmModuleViewDetail.dao.impl; + +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +/** + * 主数据视图明细表(MdmModuleViewDetail)表数据库访问层 + * + * @author makejava + * @since 2023-10-17 15:34:58 + */ +@Repository(value = "MdmModuleViewDetailDaoImpl") +public class MdmModuleViewDetailDaoImpl extends MybatisGenericDao implements IMdmModuleViewDetailDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java new file mode 100644 index 00000000..c9151239 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java @@ -0,0 +1,66 @@ +package com.hzya.frame.mdm.mdmModuleViewDetail.entity; + +import java.util.Date; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 主数据视图明细表(MdmModuleViewDetail)实体类 + * + * @author makejava + * @since 2023-10-17 15:34:59 + */ +public class MdmModuleViewDetailEntity extends BaseEntity { + + /** + * 主数据模版ID + */ + private String mdmId; + /** + * 视图id + */ + private String viewId; + /** + * 字段 id + */ + private String viewFiled; + /** + * 类型1、查询2、列表3、新增4、修改 5、查看 + */ + private String viewType; + + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getViewId() { + return viewId; + } + + public void setViewId(String viewId) { + this.viewId = viewId; + } + + public String getViewFiled() { + return viewFiled; + } + + public void setViewFiled(String viewFiled) { + this.viewFiled = viewFiled; + } + + public String getViewType() { + return viewType; + } + + public void setViewType(String viewType) { + this.viewType = viewType; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.xml new file mode 100644 index 00000000..1c2617c6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.xml @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,view_id + ,view_filed + ,view_type + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + insert into mdm_module_view_detail( + + id , + mdm_id , + view_id , + view_filed , + view_type , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{viewId} , + #{viewFiled} , + #{viewType} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_view_detail a + WHERE a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_view_detail(mdm_id, view_id, view_filed, view_type, sorts, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.mdmId},#{entity.viewId},#{entity.viewFiled},#{entity.viewType},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into mdm_module_view_detail(mdm_id, view_id, view_filed, view_type, sorts, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id) + values + + (#{entity.mdmId},#{entity.viewId},#{entity.viewFiled},#{entity.viewType},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + mdm_id = values(mdm_id), + view_id = values(view_id), + view_filed = values(view_filed), + view_type = values(view_type), + sorts = values(sorts), + 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) + + + + update mdm_module_view_detail set + + mdm_id = #{mdmId}, + view_id = #{viewId}, + view_filed = #{viewFiled}, + view_type = #{viewType}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update mdm_module_view_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update mdm_module_view_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and view_id = #{viewId} + and view_filed = #{viewFiled} + and view_type = #{viewType} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from mdm_module_view_detail where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/service/IMdmModuleViewDetailService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/service/IMdmModuleViewDetailService.java new file mode 100644 index 00000000..cf055f0a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/service/IMdmModuleViewDetailService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.mdm.mdmModuleViewDetail.service; + +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.basedao.service.IBaseService; + +/** + * 主数据视图明细表(MdmModuleViewDetail)表服务接口 + * + * @author makejava + * @since 2023-10-17 15:35:00 + */ +public interface IMdmModuleViewDetailService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/service/impl/MdmModuleViewDetailServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/service/impl/MdmModuleViewDetailServiceImpl.java new file mode 100644 index 00000000..fb83c460 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/service/impl/MdmModuleViewDetailServiceImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.mdmModuleViewDetail.service.impl; + +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; +import com.hzya.frame.mdm.mdmModuleViewDetail.service.IMdmModuleViewDetailService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; + +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * 主数据视图明细表(MdmModuleViewDetail)表服务实现类 + * + * @author makejava + * @since 2023-10-17 15:35:00 + */ +@Service(value = "mdmModuleViewDetailService") +public class MdmModuleViewDetailServiceImpl extends BaseService implements IMdmModuleViewDetailService { + + private IMdmModuleViewDetailDao mdmModuleViewDetailDao; + + @Autowired + public void setMdmModuleViewDetailDao(IMdmModuleViewDetailDao dao) { + this.mdmModuleViewDetailDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/dao/IMdmTableCodeRuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/dao/IMdmTableCodeRuleDao.java new file mode 100644 index 00000000..a900d337 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/dao/IMdmTableCodeRuleDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmTableCodeRule.dao; + +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 模版数据表编码规则表(mdm_table_code_rule: table)表数据库访问层 + * + * @author makejava + * @since 2023-11-06 16:12:34 + */ +public interface IMdmTableCodeRuleDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/dao/impl/MdmTableCodeRuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/dao/impl/MdmTableCodeRuleDaoImpl.java new file mode 100644 index 00000000..b7452719 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/dao/impl/MdmTableCodeRuleDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmTableCodeRule.dao.impl; + +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 模版数据表编码规则表(MdmTableCodeRule)表数据库访问层 + * + * @author makejava + * @since 2023-11-06 16:12:35 + */ +@Repository(value = "MdmTableCodeRuleDaoImpl") +public class MdmTableCodeRuleDaoImpl extends MybatisGenericDao implements IMdmTableCodeRuleDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/entity/MdmTableCodeRuleEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/entity/MdmTableCodeRuleEntity.java new file mode 100644 index 00000000..cca012ab --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/entity/MdmTableCodeRuleEntity.java @@ -0,0 +1,76 @@ +package com.hzya.frame.mdm.mdmTableCodeRule.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 模版数据表编码规则表(MdmTableCodeRule)实体类 + * + * @author makejava + * @since 2023-11-06 16:12:35 + */ +public class MdmTableCodeRuleEntity extends BaseEntity { + + /** 主数据模版ID */ + private String mdmId; + /** db_id */ + private String dbId; + /** 规则 */ + private String dbName; + /** 类型 1、连接符号 2、字符串 3、日期 4、流水号 */ + private String dbType; + /** 备注 */ + private String remark; + /** 规则值 */ + private String dbValue; + + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getDbValue() { + return dbValue; + } + + public void setDbValue(String dbValue) { + this.dbValue = dbValue; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/entity/MdmTableCodeRuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/entity/MdmTableCodeRuleEntity.xml new file mode 100644 index 00000000..9f5c3cc8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/entity/MdmTableCodeRuleEntity.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,db_id + ,db_name + ,db_type + ,remark + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,db_value + + + + + + + + + + + + + + + + insert into mdm_table_code_rule( + + id , + mdm_id , + db_id , + db_name , + db_type , + remark , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + db_value , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{dbId} , + #{dbName} , + #{dbType} , + #{remark} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{dbValue} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_table_code_rule a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_table_code_rule(mdm_id, db_id, db_name, db_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, db_value, sts) + values + + (#{entity.mdmId},#{entity.dbId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.dbValue}, 'Y') + + + + + insert into mdm_table_code_rule(mdm_id, db_id, db_name, db_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, db_value) + values + + (#{entity.mdmId},#{entity.dbId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.dbValue}) + + on duplicate key update + mdm_id = values(mdm_id), + db_id = values(db_id), + db_name = values(db_name), + db_type = values(db_type), + remark = values(remark), + sorts = values(sorts), + 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), + db_value = values(db_value) + + +update mdm_table_code_rule set + + mdm_id = #{mdmId}, + db_id = #{dbId}, + db_name = #{dbName}, + db_type = #{dbType}, + remark = #{remark}, + sorts = #{sorts}, + 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}, + db_value = #{dbValue}, + +where id = #{id} + + + +update mdm_table_code_rule set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_table_code_rule set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and db_id = #{dbId} + and db_name = #{dbName} + and db_type = #{dbType} + and remark = #{remark} + and sorts = #{sorts} + and sts = #{sts} + and db_value = #{dbValue} + and sts='Y' + + + + + delete from mdm_table_code_rule where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/service/IMdmTableCodeRuleService.java b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/service/IMdmTableCodeRuleService.java new file mode 100644 index 00000000..d1872516 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/service/IMdmTableCodeRuleService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.mdm.mdmTableCodeRule.service; + +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 模版数据表编码规则表(MdmTableCodeRule)表服务接口 + * + * @author makejava + * @since 2023-11-06 16:12:35 + */ +public interface IMdmTableCodeRuleService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/service/impl/MdmTableCodeRuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/service/impl/MdmTableCodeRuleServiceImpl.java new file mode 100644 index 00000000..e2020e70 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmTableCodeRule/service/impl/MdmTableCodeRuleServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.mdm.mdmTableCodeRule.service.impl; + +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; +import com.hzya.frame.mdm.mdmTableCodeRule.service.IMdmTableCodeRuleService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 模版数据表编码规则表(MdmTableCodeRule)表服务实现类 + * + * @author makejava + * @since 2023-11-06 16:12:35 + */ +@Service(value = "mdmTableCodeRuleService") +public class MdmTableCodeRuleServiceImpl extends BaseService implements IMdmTableCodeRuleService { + + private IMdmTableCodeRuleDao mdmTableCodeRuleDao; + + @Autowired + public void setMdmTableCodeRuleDao(IMdmTableCodeRuleDao dao) { + this.mdmTableCodeRuleDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java new file mode 100644 index 00000000..dcc8ec74 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java @@ -0,0 +1,260 @@ +package com.hzya.frame.mdm.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * 主数据服务接口 + */ +public interface IMdmService { + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表查询接口分页 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmPage(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表查询接口列表 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmList(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据基本信息 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModule(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据基本信息保存 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doSaveMdmModule(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleDb(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源的服务 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleServer(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源的服务 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleServerFiled(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询主表字段 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleServerMainFiled(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存数据源 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity saveMdmModuleDb(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询显示信息 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleView(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置修改显示信息 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doSaveMdmModuleView(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询权限配置 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleRule(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存权限配置 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doSaveMdmModuleRule(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleDistribute(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doSaveMdmModuleDistribute(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 树、查询条件、列表字段、按钮 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShow(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据查询所有字段 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowAll(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 查询数据(list 或者 分页) + * @Date 1:33 下午 2023/7/12 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryTemplateData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowData(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowDistribute(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据业务数据树结构 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowTreeData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据业务数据树结构 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmOptionData(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowDetails(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据修改 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity updateMdmShowDetailsData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据新增 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity saveMdmShowDetailsData(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据删除业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 处理分发数据 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doMdmDistribute(JSONObject jsonObject); + +} diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java new file mode 100644 index 00000000..b6c3383b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java @@ -0,0 +1,2950 @@ +package com.hzya.frame.mdm.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.mdm.entity.DbFiledsDto; +import com.hzya.frame.mdm.entity.MdmDataDto; +import com.hzya.frame.mdm.entity.MdmDataFiledDto; +import com.hzya.frame.mdm.entity.MdmDbFiledVo; +import com.hzya.frame.mdm.entity.MdmDbVo; +import com.hzya.frame.mdm.entity.MdmDetailViewVo; +import com.hzya.frame.mdm.entity.MdmDistributeDto; +import com.hzya.frame.mdm.entity.MdmDistributeVo; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmModuleViewDto; +import com.hzya.frame.mdm.entity.MdmModuleViewVo; +import com.hzya.frame.mdm.entity.MdmQuery; +import com.hzya.frame.mdm.entity.MdmRoleDto; +import com.hzya.frame.mdm.entity.MdmViewButtonVo; +import com.hzya.frame.mdm.entity.MdmViewFiledVo; +import com.hzya.frame.mdm.entity.MdmViewVo; +import com.hzya.frame.mdm.entity.MdmVo; +import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.dao.IMdmModuleDbFiledsRuleFilesDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRuleFiles.entity.MdmModuleDbFiledsRuleFilesEntity; +import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.mdm.mdmModuleRole.dao.IMdmModuleRoleDao; +import com.hzya.frame.mdm.mdmModuleRole.entity.MdmModuleRoleEntity; +import com.hzya.frame.mdm.mdmModuleRoleButton.dao.IMdmModuleRoleButtonDao; +import com.hzya.frame.mdm.mdmModuleRoleButton.entity.MdmModuleRoleButtonEntity; +import com.hzya.frame.mdm.mdmModuleUserView.dao.IMdmModuleUserViewDao; +import com.hzya.frame.mdm.mdmModuleUserView.entity.MdmModuleUserViewEntity; +import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import com.hzya.frame.mdm.service.IMdmService; +import com.hzya.frame.sys.application.entity.SysApplicationDto; +import com.hzya.frame.sys.application.entity.SysApplicationVo; +import com.hzya.frame.sys.entity.FormmainDeleteDto; +import com.hzya.frame.sys.entity.ModuleDto; +import com.hzya.frame.sys.entity.TemplateKeyValue; +import com.hzya.frame.sys.entity.TemplateQuery; +import com.hzya.frame.sys.module.dao.IModuleMapper; +import com.hzya.frame.sys.module.entity.Module; +import com.hzya.frame.sys.roleModule.dao.IRoleModuleMapper; +import com.hzya.frame.sys.roleModule.entity.RoleModule; +import com.hzya.frame.sys.template.entity.Template; +import com.hzya.frame.sys.testReturn.entity.TestReturn; +import com.hzya.frame.sys.userRole.dao.IUserRoleMapper; +import com.hzya.frame.sys.userRole.entity.UserRole; +import com.hzya.frame.sys.userTemplateView.entity.UserTemplateView; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.checkerframework.checker.units.qual.A; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 主数据服务实现类 + */ +@Service(value = "mdmService") +public class MdmServiceImpl implements IMdmService { + @Resource + protected IModuleMapper moduleMapper; + @Resource + protected IRoleModuleMapper roleModuleMapper; + @Resource + private IMdmModuleDao mdmModuleDao; //主数据模版 + @Resource + private IMdmModuleDbDao mdmModuleDbDao;//模版数据库表 + @Resource + private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao;//模版数据库字段表 + @Resource + private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao;//模版数据库字段规则表 + @Resource + private IMdmModuleDbFiledsRuleFilesDao mdmModuleDbFiledsRuleFilesDao;//模版数据库字段规则档案表 + @Resource + private IMdmModuleDistributeDao mdmModuleDistributeDao;//主数据功能应用分发表 + @Resource + private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao;//主数据功能应用分发明细表 + @Resource + private IMdmModuleRoleDao mdmModuleRoleDao;//主数据功能角色表 + @Resource + private IMdmModuleRoleButtonDao mdmModuleRoleButtonDao;//主数据功能角色按钮表 + @Resource + private IMdmModuleUserViewDao mdmModuleUserViewDao;//主数据用户视图表 + @Resource + private IMdmModuleViewDao mdmModuleViewDao;//主数据视图表 + @Resource + private IMdmModuleViewDetailDao mdmModuleViewDetailDao;//主数据视图明细表 + @Resource + private IMdmTableCodeRuleDao mdmTableCodeRuleDao;//模版数据表编码规则表 + @Resource + protected IUserRoleMapper userRoleMapper; + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表查询接口分页 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmPage(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List mdmVos = mdmModuleDao.queryMdm(entity); + PageInfo pageInfo = new PageInfo(mdmVos); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表查询接口列表 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmList(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + List mdmVos = mdmModuleDao.queryMdm(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mdmVos); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据基本信息 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModule(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + MdmModuleEntity mdmModuleEntity = mdmModuleDao.queryOne(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleEntity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据基本信息保存 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doSaveMdmModule(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmName() == null || "".equals(entity.getMdmName())) { + return BaseResult.getFailureMessageEntity("请先输入主数据名称"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + //新增 + entity.setId(UUIDUtils.getUUID()); + entity.setSts("Y"); + entity.setCreate_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setCreate_time(new Date()); + entity.setModify_time(new Date()); + mdmModuleDao.save(entity); + } else { + //修改 + entity.setSts("Y"); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_time(new Date()); + mdmModuleDao.update(entity); + } + return BaseResult.getSuccessMessageEntity("保存数据成功", entity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleDb(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + //判断分页 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmDbVo mdmDbVo = new MdmDbVo(); + + //查询设置的规则表 + MdmModuleDbFiledsRuleFilesEntity mdmModuleDbFiledsRuleFilesEntity = new MdmModuleDbFiledsRuleFilesEntity(); + mdmModuleDbFiledsRuleFilesEntity.setSts("Y"); + List moduleDbFiledsRuleFiles = mdmModuleDbFiledsRuleFilesDao.queryBase(mdmModuleDbFiledsRuleFilesEntity); + mdmDbVo.setModuleDbFiledsRuleFiles(moduleDbFiledsRuleFiles); + //查询设置的规则表 + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setSts("Y"); + mdmTableCodeRuleEntity.setMdmId(entity.getId()); + List mdmTableCodeRuleEntityList = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity); + mdmDbVo.setMdmTableCodeRuleEntityList(mdmTableCodeRuleEntityList); + //查询数据源表 + MdmModuleDbEntity queryDb = new MdmModuleDbEntity(); + queryDb.setMdmId(entity.getId()); + queryDb.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(queryDb); + List mdmModuleDbFiledsEntityList = null; + List mdmModuleDbFiledsRuleEntityList = null; + //存在表查询数据下的字段 + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity(); + queryDbFiled.setMdmId(entity.getId()); + queryDbFiled.setSts("Y"); + mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(queryDbFiled); + //存在字段查询字段的属性 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + MdmModuleDbFiledsRuleEntity queryDbFiledRule = new MdmModuleDbFiledsRuleEntity(); + queryDbFiledRule.setMdmId(entity.getId()); + queryDbFiledRule.setSts("Y"); + mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(queryDbFiledRule); + } + } + //组装数据 + setMdmDb(mdmDbVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList); + return BaseResult.getSuccessMessageEntity("查询数据成功", mdmDbVo); + } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源的服务 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleServer(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + //判断分页 + if (entity == null) { + entity = new MdmModuleDbEntity(); + } + //查询数据源表 + entity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleDbEntityList); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源的服务的字段 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleServerFiled(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + //判断分页 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表 + entity.setSts("Y"); + List dblist = mdmModuleDbDao.queryBase(entity); + if(dblist != null && dblist.size() == 1 ){ + MdmModuleDbFiledsEntity queryDbFiled= new MdmModuleDbFiledsEntity(); + queryDbFiled.setSts("Y"); + queryDbFiled.setDbId(dblist.get(0).getId()); + List list = mdmModuleDbFiledsDao.queryBase(queryDbFiled); + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setChName("id"); + mdmModuleDbFiledsEntity.setEnName("id"); + list.add(0,mdmModuleDbFiledsEntity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + }else { + return BaseResult.getFailureMessageEntity("服务不存在"); + } + } + + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询主表字段 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleServerMainFiled(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + //判断分页 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表 + entity.setSts("Y"); + entity.setDbType("1"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(entity); + if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 1){ + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntityList.get(0).getId()); + List list = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + }else if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 0){ + return BaseResult.getFailureMessageEntity("请先配置数据源"); + }else { + return BaseResult.getFailureMessageEntity("查询数据失败"); + } + } + + /** + * @param mdmDbVo 返回对象 + * @param mdmModuleDbEntityList 数据表 + * @param mdmModuleDbFiledsEntityList 字段 + * @param mdmModuleDbFiledsRuleEntityList 字段属性 + * @return void + * @Author lvleigang + * @Description 组装返回数据 + * @Date 4:51 下午 2023/10/18 + **/ + private void setMdmDb(MdmDbVo mdmDbVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList) { + //主数据主表 + MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); + //主数据子表 + List sublistMdmModuleDb = new ArrayList<>(); + //主数据主表字段 + List mainMdmModuleDbFileds = new ArrayList<>(); + + + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 2、明细 + mainMdmModuleDb = mdmModuleDbEntityList.get(i); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + } + } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //2、明细 + sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + List sublistMdmModuleDbFileds = new ArrayList<>(); + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); + } + } + } + } + mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); + mdmDbVo.setMainMdmModuleDb(mainMdmModuleDb); + mdmDbVo.setSublistMdmModuleDb(sublistMdmModuleDb); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存数据源 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity saveMdmModuleDb(JSONObject object) { + //判断新增还是修改,保存数据生成表结构 + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMainMdmModuleDb() == null || entity.getMainMdmModuleDb().getDbName() == null || "".equals(entity.getMainMdmModuleDb().getDbName())) { + return BaseResult.getFailureMessageEntity("请先输入主表名称"); + } + //主数据主表 + MdmModuleDbEntity mainMdmModuleDb = entity.getMainMdmModuleDb(); + //主数据主表字段 + List mainMdmModuleDbFileds = mainMdmModuleDb.getSublistMdmModuleDbFileds(); + //主数据子表 + List sublistMdmModuleDb = entity.getSublistMdmModuleDb(); + //判断主表新增还是修改 + if (mainMdmModuleDb.getId() == null || "".equals(mainMdmModuleDb.getId())) { + //新增 需要校验表是否存在 + if (checkTable(mainMdmModuleDb.getDbName())) { + return BaseResult.getFailureMessageEntity("主表表名已经存在"); + } + } + //判断明细表 + if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { + for (int i = 0; i < sublistMdmModuleDb.size(); i++) { + if (sublistMdmModuleDb.get(i).getId() == null || "".equals(sublistMdmModuleDb.get(i).getId())) { + if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() == null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() == 0) { + return BaseResult.getFailureMessageEntity("请先设置子表" + sublistMdmModuleDb.get(i).getDbName() + "的字段"); + } + //新增 需要校验表是否存在 + if (checkTable(sublistMdmModuleDb.get(i).getDbName())) { + return BaseResult.getFailureMessageEntity("子表" + sublistMdmModuleDb.get(i).getDbName() + "已经存在"); + } + } + } + } + //设置保存主表和字段以及字段的属性 + setMainTable(entity, mainMdmModuleDb, mainMdmModuleDbFileds); + //设置保存子表数据 + setsublistTable(entity, mainMdmModuleDb, sublistMdmModuleDb); + //保存规则 + List mdmTableCodeRuleEntityList = entity.getMdmTableCodeRuleEntityList(); + MdmTableCodeRuleEntity deleteOldData = new MdmTableCodeRuleEntity(); + deleteOldData.setDbId(mainMdmModuleDb.getId()); + deleteOldData.setMdmId(entity.getId()); + deleteOldData.setSts("Y"); + deleteOldData.setModify_user_id(StpUtil.getLoginIdAsString()); + deleteOldData.setModify_time(new Date()); + mdmTableCodeRuleDao.logicRemoveMultiCondition(deleteOldData); + if(mdmTableCodeRuleEntityList != null && mdmTableCodeRuleEntityList.size() > 0){ + for (int i = 0; i < mdmTableCodeRuleEntityList.size(); i++) { + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = mdmTableCodeRuleEntityList.get(i); + mdmTableCodeRuleEntity.setMdmId(entity.getId()); + mdmTableCodeRuleEntity.setDbId(mainMdmModuleDb.getId()); + mdmTableCodeRuleEntity.setId(UUIDUtils.getUUID()); + mdmTableCodeRuleEntity.setSts("Y"); + mdmTableCodeRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmTableCodeRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmTableCodeRuleEntity.setCreate_time(new Date()); + mdmTableCodeRuleEntity.setModify_time(new Date()); + mdmTableCodeRuleDao.save(mdmTableCodeRuleEntity); + } + } + return BaseResult.getSuccessMessageEntity("保存数据源成功"); + } + + /** + * @param entity + * @param mainMdmModuleDb + * @param sublistMdmModuleDb + * @return void + * @Author lvleigang + * @Description 设置保存子表数据 + * @Date 11:08 上午 2023/10/19 + **/ + private void setsublistTable(MdmDto entity, MdmModuleDbEntity mainMdmModuleDb, List sublistMdmModuleDb) { + //存在明细表 + if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { + for (int i = 0; i < sublistMdmModuleDb.size(); i++) { + MdmModuleDbEntity mdmModuleDbEntity = sublistMdmModuleDb.get(i); + mdmModuleDbEntity.setMdmId(entity.getId()); + mdmModuleDbEntity.setDbType("2"); + boolean flag = false; + + //新增还是修改 + if (mdmModuleDbEntity.getId() != null && !"".equals(mdmModuleDbEntity.getId())) { + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbEntity.setModify_time(new Date()); + mdmModuleDbDao.update(mdmModuleDbEntity); + } else { + flag = true; + mdmModuleDbEntity.setId(UUIDUtils.getUUID()); + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbEntity.setCreate_time(new Date()); + mdmModuleDbEntity.setModify_time(new Date()); + mdmModuleDbDao.save(mdmModuleDbEntity); + } + List dbFiledsDtos = new ArrayList<>(); + + //字段 + List sublistMdmModuleDbFileds = mdmModuleDbEntity.getSublistMdmModuleDbFileds(); + if (sublistMdmModuleDbFileds != null && sublistMdmModuleDbFileds.size() > 0) { + for (int i1 = 0; i1 < sublistMdmModuleDbFileds.size(); i1++) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = sublistMdmModuleDbFileds.get(i1); + mdmModuleDbFiledsEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntity.getId()); + if (mdmModuleDbFiledsEntity.getId() != null && !"".equals(mdmModuleDbFiledsEntity.getId())) { + DbFiledsDto dbFiledsDto = new DbFiledsDto("1", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); + dbFiledsDtos.add(dbFiledsDto); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsEntity.setModify_time(new Date()); + mdmModuleDbFiledsDao.update(mdmModuleDbFiledsEntity); + } else { + DbFiledsDto dbFiledsDto = new DbFiledsDto("2", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); + dbFiledsDtos.add(dbFiledsDto); + mdmModuleDbFiledsEntity.setId(UUIDUtils.getUUID()); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsEntity.setCreate_time(new Date()); + mdmModuleDbFiledsEntity.setModify_time(new Date()); + mdmModuleDbFiledsDao.save(mdmModuleDbFiledsEntity); + } + //修改或保存属性 + List mdmModuleDbFiledsRules = mdmModuleDbFiledsEntity.getMdmModuleDbFiledsRules(); + if (mdmModuleDbFiledsRules != null && mdmModuleDbFiledsRules.size() > 0) { + for (int a = 0; a < mdmModuleDbFiledsRules.size(); a++) { + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = mdmModuleDbFiledsRules.get(a); + mdmModuleDbFiledsRuleEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsRuleEntity.setDbId(mdmModuleDbEntity.getId()); + mdmModuleDbFiledsRuleEntity.setFiledId(mdmModuleDbFiledsEntity.getId()); + if (mdmModuleDbFiledsRuleEntity.getId() != null && !"".equals(mdmModuleDbFiledsRuleEntity.getId())) { + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); + mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntity); + } else { + mdmModuleDbFiledsRuleEntity.setId(UUIDUtils.getUUID()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsRuleEntity.setCreate_time(new Date()); + mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); + mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntity); + } + } + } + } + } + + if (flag) { + //新增 + Map maps = new HashMap<>(); + maps.put("dbType", "2");//表类型 + maps.put("tableName", mdmModuleDbEntity.getDbName());//表名 + maps.put("tableRemark", mdmModuleDbEntity.getRemark());//表备注 + maps.put("databaseFields", dbFiledsDtos);//字段 + DbFiledsDto dbFiledsDto = new DbFiledsDto("1", "上级id", "formmain_id", "3", "50"); + dbFiledsDtos.add(dbFiledsDto); + mdmModuleDao.createTable(maps); + } else { + //修改 + Map tablename = new HashMap<>(); + tablename.put("tableName", mdmModuleDbEntity.getDbName());//表名 + tablename.put("tableRemark", mdmModuleDbEntity.getRemark());//表备注 + mdmModuleDao.alterTableName(tablename); + Map maps = new HashMap<>(); + maps.put("tableName", mdmModuleDbEntity.getDbName());//表名 + maps.put("tableRemark", mdmModuleDbEntity.getRemark());//表备注 + maps.put("databaseFields", dbFiledsDtos);//字段 + mdmModuleDao.alterTable(maps); + } + } + } + } + + /** + * @param entity + * @param mainMdmModuleDb + * @param mainMdmModuleDbFileds + * @return void + * @Author lvleigang + * @Description 设置保存主表和字段以及字段的属性 + * @Date 10:34 上午 2023/10/19 + **/ + private void setMainTable(MdmDto entity, MdmModuleDbEntity mainMdmModuleDb, List mainMdmModuleDbFileds) { + //先保存或修改主表数据 + mainMdmModuleDb.setMdmId(entity.getId()); + mainMdmModuleDb.setDbType("1"); + boolean flag = false; + + if (mainMdmModuleDb.getId() != null && !"".equals(mainMdmModuleDb.getId())) { + mainMdmModuleDb.setSts("Y"); + mainMdmModuleDb.setModify_user_id(StpUtil.getLoginIdAsString()); + mainMdmModuleDb.setModify_time(new Date()); + mdmModuleDbDao.update(mainMdmModuleDb); + //删除规则表 + MdmModuleDbFiledsRuleEntity delectFiledsRule = new MdmModuleDbFiledsRuleEntity(); + delectFiledsRule.setMdmId(entity.getId()); + delectFiledsRule.setModify_user_id(StpUtil.getLoginIdAsString()); + delectFiledsRule.setModify_time(new Date()); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(delectFiledsRule); + } else { + flag = true; + mainMdmModuleDb.setId(UUIDUtils.getUUID()); + mainMdmModuleDb.setSts("Y"); + mainMdmModuleDb.setCreate_user_id(StpUtil.getLoginIdAsString()); + mainMdmModuleDb.setModify_user_id(StpUtil.getLoginIdAsString()); + mainMdmModuleDb.setCreate_time(new Date()); + mainMdmModuleDb.setModify_time(new Date()); + mdmModuleDbDao.save(mainMdmModuleDb); + } + List dbFiledsDtos = new ArrayList<>(); + + //保存主表字段 因为字段不允许删除,所以不用先删除再新增 + if (mainMdmModuleDbFileds != null && mainMdmModuleDbFileds.size() > 0) { + for (int i = 0; i < mainMdmModuleDbFileds.size(); i++) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = mainMdmModuleDbFileds.get(i); + mdmModuleDbFiledsEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsEntity.setDbId(mainMdmModuleDb.getId()); + if (mdmModuleDbFiledsEntity.getId() != null && !"".equals(mdmModuleDbFiledsEntity.getId())) { + DbFiledsDto dbFiledsDto = new DbFiledsDto("1", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); + dbFiledsDtos.add(dbFiledsDto); + + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsEntity.setModify_time(new Date()); + mdmModuleDbFiledsDao.update(mdmModuleDbFiledsEntity); + } else { + DbFiledsDto dbFiledsDto = new DbFiledsDto("2", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); + dbFiledsDtos.add(dbFiledsDto); + mdmModuleDbFiledsEntity.setId(UUIDUtils.getUUID()); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsEntity.setCreate_time(new Date()); + mdmModuleDbFiledsEntity.setModify_time(new Date()); + mdmModuleDbFiledsDao.save(mdmModuleDbFiledsEntity); + } + //修改或保存属性 + List mdmModuleDbFiledsRules = mdmModuleDbFiledsEntity.getMdmModuleDbFiledsRules(); + if (mdmModuleDbFiledsRules != null && mdmModuleDbFiledsRules.size() > 0) { + for (int a = 0; a < mdmModuleDbFiledsRules.size(); a++) { + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = mdmModuleDbFiledsRules.get(a); + mdmModuleDbFiledsRuleEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsRuleEntity.setDbId(mainMdmModuleDb.getId()); + mdmModuleDbFiledsRuleEntity.setFiledId(mdmModuleDbFiledsEntity.getId()); + if (mdmModuleDbFiledsRuleEntity.getId() != null && !"".equals(mdmModuleDbFiledsRuleEntity.getId())) { + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); + mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntity); + } else { + mdmModuleDbFiledsRuleEntity.setId(UUIDUtils.getUUID()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDbFiledsRuleEntity.setCreate_time(new Date()); + mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); + mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntity); + } + } + } + } + } + if (flag) { + //新增 + Map maps = new HashMap<>(); + maps.put("dbType", "1");//表类型 + maps.put("tableName", mainMdmModuleDb.getDbName());//表名 + maps.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 + maps.put("databaseFields", dbFiledsDtos);//字段 + mdmModuleDao.createTable(maps); + Map mapsDistribute = new HashMap<>(); + mapsDistribute.put("tableName", mainMdmModuleDb.getDbName() + "_distribute");//表名 + List distribute = getDistribute(); + maps.put("databaseFields", distribute);//字段 + mapsDistribute.put("tableRemark", mainMdmModuleDb.getRemark() + "分发表");//表备注 + mdmModuleDao.createTableDistribute(mapsDistribute); + } else { + //修改 + Map tablename = new HashMap<>(); + tablename.put("tableName", mainMdmModuleDb.getDbName());//表名 + tablename.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 + mdmModuleDao.alterTableName(tablename); + Map maps = new HashMap<>(); + maps.put("tableName", mainMdmModuleDb.getDbName());//表名 + maps.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 + maps.put("databaseFields", dbFiledsDtos);//字段 + //mdmModuleDao.alterTable(maps); + } + } + + /** + * @Author lvleigang + * @Description 设置分发表字段 + * @Date 8:49 上午 2023/11/9 + * @param + * @return java.util.List + **/ + private List getDistribute() { + List dbFiledsDtos = new ArrayList<>(); + dbFiledsDtos.add(new DbFiledsDto("1", "数据id","formmain_id", "3", "50")); + dbFiledsDtos.add(new DbFiledsDto("1", "应用id","app_id", "3", "50")); + dbFiledsDtos.add(new DbFiledsDto("1", "状态1、发送成功 2、发送中 3、发送失败","status", "3", "50")); + dbFiledsDtos.add(new DbFiledsDto("1", "描述","msg", "3", "50")); + return dbFiledsDtos; + } + + /** + * @param tableName + * @return java.lang.Long + * @Author lvleigang + * @Description 校验表是否存在 + * @Date 3:58 下午 2023/7/11 + **/ + private boolean checkTable(String tableName) { + Map maps = new HashMap<>(); + maps.put("tableName", tableName); + Integer i = mdmModuleDao.checkTable(maps); + if (i != null && i > 0) { + return true; + } + return false; + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询显示信息 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleView(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleViewVo mdmModuleViewVo = new MdmModuleViewVo(); + //查询设置各种类型字段 + //查询模版数据源 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + setFiledType(mdmModuleViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList); + } + //查询数据库设置的字段 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(entity.getId()); + mdmModuleViewEntity.setSts("Y"); + List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); + if (moduleViewEntityList != null && moduleViewEntityList.size() == 1) { + mdmModuleViewVo.setMdmModuleViewEntity(moduleViewEntityList.get(0)); + //查询明细 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getId()); + mdmModuleViewDetailEntity.setViewId(moduleViewEntityList.get(0).getId()); + mdmModuleViewDetailEntity.setSts("Y"); + List mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + setDbFiledType(mdmModuleViewVo, mdmModuleViewDetailEntityList); + } else { + mdmModuleViewVo.setMdmModuleViewEntity(new MdmModuleViewEntity()); + mdmModuleViewVo.setDbAddFiled(new ArrayList<>()); + mdmModuleViewVo.setDbEditFiled(new ArrayList<>()); + mdmModuleViewVo.setDbShowFiled(new ArrayList<>()); + mdmModuleViewVo.setDbQueryFiled(new ArrayList<>()); + mdmModuleViewVo.setDbListFiled(new ArrayList<>()); + } + return BaseResult.getSuccessMessageEntity("查询视图成功", mdmModuleViewVo); + } + + private void setDbFiledType(MdmModuleViewVo mdmModuleViewVo, List mdmModuleViewDetailEntityList) { + //新增 + List addFiled = new ArrayList<>(); + //修改 + List editFiled = new ArrayList<>(); + //查看 + List showFiled = new ArrayList<>(); + //查询 + List queryFiled = new ArrayList<>(); + //列表 + List listFiled = new ArrayList<>(); + if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { + for (int i = 0; i < mdmModuleViewDetailEntityList.size(); i++) { + switch (mdmModuleViewDetailEntityList.get(i).getViewType()) { + //1、查询2、列表3、新增4、修改 5、查看 + case "1": + queryFiled.add(mdmModuleViewDetailEntityList.get(i)); + break; + case "2": + listFiled.add(mdmModuleViewDetailEntityList.get(i)); + break; + case "3": + addFiled.add(mdmModuleViewDetailEntityList.get(i)); + break; + case "4": + editFiled.add(mdmModuleViewDetailEntityList.get(i)); + break; + case "5": + showFiled.add(mdmModuleViewDetailEntityList.get(i)); + break; + default: + } + } + } + mdmModuleViewVo.setDbAddFiled(addFiled); + mdmModuleViewVo.setDbEditFiled(editFiled); + mdmModuleViewVo.setDbShowFiled(showFiled); + mdmModuleViewVo.setDbQueryFiled(queryFiled); + mdmModuleViewVo.setDbListFiled(listFiled); + } + + /** + * @param mdmModuleViewVo + * @param mdmModuleDbEntityList + * @param mdmModuleDbFiledsEntityList + * @return void + * @Author lvleigang + * @Description 设置对应的字段类型 + * @Date 2023/10/25 + **/ + private void setFiledType(MdmModuleViewVo mdmModuleViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList) { + //新增 + List addFiled = new ArrayList<>(); + //修改 + List editFiled = new ArrayList<>(); + //查看 + List showFiled = new ArrayList<>(); + //查询 + List queryFiled = new ArrayList<>(); + //列表 + List listFiled = new ArrayList<>(); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 + addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } else { + //2、明细 + queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } + } + } + } + } + mdmModuleViewVo.setAddFiled(addFiled); + mdmModuleViewVo.setEditFiled(editFiled); + mdmModuleViewVo.setShowFiled(showFiled); + mdmModuleViewVo.setQueryFiled(queryFiled); + mdmModuleViewVo.setListFiled(listFiled); + } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置修改显示信息 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doSaveMdmModuleView(JSONObject object) { + MdmModuleViewDto entity = getData("jsonStr", object, MdmModuleViewDto.class); + //判断是否有数据 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmModuleViewEntity() == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + boolean flag = false; + //保存主数据视图表 + MdmModuleViewEntity mdmModuleViewEntity = entity.getMdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(entity.getId()); + mdmModuleViewEntity.setSts("Y"); + mdmModuleViewEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleViewEntity.setModify_time(new Date()); + if (mdmModuleViewEntity.getId() != null && !"".equals(mdmModuleViewEntity.getId())) { + flag = false; + //修改 + mdmModuleViewDao.update(mdmModuleViewEntity); + } else { + flag = true; + //新增 + mdmModuleViewEntity.setId(UUIDUtils.getUUID()); + mdmModuleViewEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmModuleViewEntity.setCreate_time(new Date()); + mdmModuleViewDao.save(mdmModuleViewEntity); + } + //保存视图字段表 + //先删除明细表 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleViewDetailEntity.setModify_time(new Date()); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + //1、查询2、列表3、新增4、修改 5、查看 + saveDbViewFiled(entity, mdmModuleViewEntity, entity.getQueryFiled(), "1"); + saveDbViewFiled(entity, mdmModuleViewEntity, entity.getListFiled(), "2"); + saveDbViewFiled(entity, mdmModuleViewEntity, entity.getAddFiled(), "3"); + saveDbViewFiled(entity, mdmModuleViewEntity, entity.getEditFiled(), "4"); + saveDbViewFiled(entity, mdmModuleViewEntity, entity.getShowFiled(), "5"); + MdmModuleEntity moduleEntity = new MdmModuleEntity(); + moduleEntity.setId(entity.getId()); + moduleEntity.setSts("Y"); + + moduleEntity = mdmModuleDao.queryOne(moduleEntity); + if (flag) { + //新增菜单 + Module module = new Module(); + module.setCreate(); + module.setServiceName("mdmService");//Spring bean名称 + module.setLvl("2");//等级 + module.setName("integrationOptionAdmin"+moduleEntity.getMdmCode());//名称 + module.setCode(moduleEntity.getMdmCode().toString());//编码 + module.setFormType("0");//类型 0、menu 1、tree 2、list 3、view + module.setLevel("2");//模块操作级别Superadministrator + module.setIcon(null);//模块图标 + module.setUpIds("c3dda399207843eeac91770ac18e91e3");//上级id + module.setTableName(null);//bean表名称映射key + module.setKeyModular(null);//是否关键模块(Y是N否) + module.setTarget(null);//跳转目标 + module.setRemark("主数据" + moduleEntity.getMdmName());//备注 + module.setOpenType("1");//菜单打开方式 + module.setFormId(entity.getId());//表单ID + module.setAppId(null);//应用id + module.setPath("integrationOptionAdmin/"+moduleEntity.getMdmCode());//路由地址 + //module.setPath("integrationOptionAdmin");//路由地址 + module.setComponent("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component + module.setHidden("false");//隐藏 + module.setRedirect(null);//redirevt + module.setAlwaysShow(null);//alwaysShow + module.setTitle(moduleEntity.getMdmName());//标题 + module.setNoCache(null);//nocache缓存 + module.setLabel(moduleEntity.getMdmName());//label + JSONObject object1 = new JSONObject(); + object1.put("mdmId", moduleEntity.getId());//主数据id + object1.put("mdmCode", moduleEntity.getMdmCode());//主数据编码 + object1.put("viewType", mdmModuleViewEntity.getViewName());//1、树 2、列表 + module.setOptions(object1.toString());//菜单mate参数 + moduleMapper.entity_insert(module); + } else { + //修改菜单 注意因为可能修改显示类型,所以需要修改菜单的属性 + Module module = new Module(); + module.setFormId(entity.getId()); + module.setSts("Y"); + List moduleList = moduleMapper.entity_list_base(module); + if (moduleList != null && moduleList.size() == 1) { + module = moduleList.get(0); + module.setUpdate(); + module.setTitle(moduleEntity.getMdmName());//标题 + module.setLabel(moduleEntity.getMdmName());//label + JSONObject object1 = new JSONObject(); + object1.put("mdmId", moduleEntity.getId());//主数据id + object1.put("mdmCode", moduleEntity.getMdmCode());//主数据id + object1.put("viewType", mdmModuleViewEntity.getViewName());//1、树 2、列表 + module.setOptions(object1.toString());//菜单mate参数 + moduleMapper.entity_update(module); + } else { + return BaseResult.getFailureMessageEntity("显示信息保存成功,菜单配置失败请检查"); + } + } + return BaseResult.getSuccessMessageEntity("保存显示信息成功"); + } + + /** + * @param entity + * @param mdmModuleViewEntity + * @param mdmDbFiledVoList + * @param type + * @return void + * @Author lvleigang + * @Description 保存数据 + * @Date 1:37 下午 2023/10/25 + **/ + private void saveDbViewFiled(MdmModuleViewDto entity, MdmModuleViewEntity mdmModuleViewEntity, List mdmDbFiledVoList, String type) { + if (mdmDbFiledVoList != null && mdmDbFiledVoList.size() > 0) { + for (int i = 0; i < mdmDbFiledVoList.size(); i++) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setId(UUIDUtils.getUUID()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + mdmModuleViewDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleViewDetailEntity.setCreate_time(new Date()); + mdmModuleViewDetailEntity.setModify_time(new Date()); + mdmModuleViewDetailEntity.setMdmId(entity.getId()); + mdmModuleViewDetailEntity.setViewId(mdmModuleViewEntity.getId()); + mdmModuleViewDetailEntity.setViewFiled(mdmDbFiledVoList.get(i).getId()); + mdmModuleViewDetailEntity.setViewType(type); + mdmModuleViewDetailEntity.setSort(String.valueOf(i + 1)); + mdmModuleViewDetailDao.save(mdmModuleViewDetailEntity); + } + } + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询权限配置 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleRule(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模块下的角色列表 + MdmModuleRoleEntity mdmModuleRoleEntity = new MdmModuleRoleEntity(); + mdmModuleRoleEntity.setSts("Y"); + mdmModuleRoleEntity.setMdmId(entity.getId()); + List mdmModuleRoleEntities = mdmModuleRoleDao.queryBase(mdmModuleRoleEntity); + if (mdmModuleRoleEntities != null && mdmModuleRoleEntities.size() > 0) { + MdmModuleRoleButtonEntity mdmModuleRoleButtonEntity = new MdmModuleRoleButtonEntity(); + mdmModuleRoleButtonEntity.setSts("Y"); + mdmModuleRoleButtonEntity.setMdmId(entity.getId()); + List mdmModuleRoleButtonEntities = mdmModuleRoleButtonDao.queryBase(mdmModuleRoleButtonEntity); + if (mdmModuleRoleButtonEntities != null && mdmModuleRoleButtonEntities.size() > 0) { + for (int i = 0; i < mdmModuleRoleEntities.size(); i++) { + List list = new ArrayList<>(); + for (int i1 = 0; i1 < mdmModuleRoleButtonEntities.size(); i1++) { + if (mdmModuleRoleEntities.get(i).getRoleId().equals(mdmModuleRoleButtonEntities.get(i1).getRoleId())) { + list.add(mdmModuleRoleButtonEntities.get(i1)); + } + } + mdmModuleRoleEntities.get(i).setMdmModuleRoleButtonEntities(list); + } + } + } + return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleRoleEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存权限配置 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doSaveMdmModuleRule(JSONObject object) { + MdmRoleDto entity = getData("jsonStr", object, MdmRoleDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询菜单 + Module module = new Module(); + module.setFormId(entity.getId()); + List moduleList = moduleMapper.entity_list_base(module); + if (moduleList != null && moduleList.size() == 1) { + module = moduleList.get(0); + } else { + return BaseResult.getFailureMessageEntity("菜单错误请检查菜单"); + } + //先删除 + RoleModule roleModule = new RoleModule(); + roleModule.setSts("Y"); + roleModule.setUpdate(); + roleModule.setModuleId(module.getId()); + roleModuleMapper.entity_logicDelete_Multi_Condition(roleModule); + MdmModuleRoleEntity mdmModuleRoleEntity = new MdmModuleRoleEntity(); + mdmModuleRoleEntity.setMdmId(entity.getId()); + mdmModuleRoleEntity.setSts("Y"); + mdmModuleRoleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleRoleEntity.setModify_time(new Date()); + mdmModuleRoleDao.logicRemoveMultiCondition(mdmModuleRoleEntity); + MdmModuleRoleButtonEntity mdmModuleRoleButtonEntity = new MdmModuleRoleButtonEntity(); + mdmModuleRoleButtonEntity.setMdmId(entity.getId()); + mdmModuleRoleButtonEntity.setSts("Y"); + mdmModuleRoleButtonEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleRoleButtonEntity.setModify_time(new Date()); + mdmModuleRoleButtonDao.logicRemoveMultiCondition(mdmModuleRoleButtonEntity); + + if (entity.getMdmModuleRoleEntities() != null && entity.getMdmModuleRoleEntities().size() > 0) { + for (int i = 0; i < entity.getMdmModuleRoleEntities().size(); i++) { + + MdmModuleRoleEntity moduleRoleEntity = entity.getMdmModuleRoleEntities().get(i); + moduleRoleEntity.setMdmId(entity.getId()); + moduleRoleEntity.setSts("Y"); + moduleRoleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + moduleRoleEntity.setModify_time(new Date()); + if (moduleRoleEntity.getId() != null && !"".equals(moduleRoleEntity.getId())) { + //修改 + mdmModuleRoleDao.update(moduleRoleEntity); + } else { + //新增 + moduleRoleEntity.setId(UUIDUtils.getUUID()); + moduleRoleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + moduleRoleEntity.setCreate_time(new Date()); + mdmModuleRoleDao.save(moduleRoleEntity); + } + if (moduleRoleEntity.getMdmModuleRoleButtonEntities() != null && moduleRoleEntity.getMdmModuleRoleButtonEntities().size() > 0) { + for (int i1 = 0; i1 < moduleRoleEntity.getMdmModuleRoleButtonEntities().size(); i1++) { + MdmModuleRoleButtonEntity moduleRoleButtonEntity = moduleRoleEntity.getMdmModuleRoleButtonEntities().get(i1); + moduleRoleButtonEntity.setMdmId(entity.getId()); + moduleRoleButtonEntity.setSts("Y"); + moduleRoleButtonEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + moduleRoleButtonEntity.setModify_time(new Date()); + moduleRoleButtonEntity.setModuleRoleId(moduleRoleEntity.getRoleId()); + moduleRoleButtonEntity.setRoleId(moduleRoleEntity.getRoleId()); + if (moduleRoleButtonEntity.getId() != null && !"".equals(moduleRoleButtonEntity.getId())) { + //修改 + mdmModuleRoleButtonDao.update(moduleRoleButtonEntity); + } else { + //新增 + moduleRoleButtonEntity.setId(UUIDUtils.getUUID()); + moduleRoleButtonEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + moduleRoleButtonEntity.setCreate_time(new Date()); + mdmModuleRoleButtonDao.save(moduleRoleButtonEntity); + } + } + } + //再添加 + RoleModule saveRole = new RoleModule(); + saveRole.setCreate(); + saveRole.setRoleId(moduleRoleEntity.getRoleId()); + saveRole.setModuleId(module.getId()); + roleModuleMapper.entity_insert(saveRole); + } + } + return BaseResult.getSuccessMessageEntity("保存成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleDistribute(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模块下的应用列表 + MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + mdmModuleDistributeEntity.setSts("Y"); + mdmModuleDistributeEntity.setMdmId(entity.getId()); + List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); + if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setSts("Y"); + mdmModuleDistributeDetailEntity.setMdmId(entity.getId()); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + if (mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0) { + for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + List addlist = new ArrayList<>(); + List deletelist = new ArrayList<>(); + for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { + if (mdmModuleDistributeEntities.get(i).getAddApi().equals(mdmModuleDistributeDetailEntities.get(i1).getApiId()) + && mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())) { + addlist.add(mdmModuleDistributeDetailEntities.get(i1)); + } + if (mdmModuleDistributeEntities.get(i).getDeleteApi().equals(mdmModuleDistributeDetailEntities.get(i1).getApiId()) + && mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())) { + deletelist.add(mdmModuleDistributeDetailEntities.get(i1)); + } + } + mdmModuleDistributeEntities.get(i).setAddList(addlist); + mdmModuleDistributeEntities.get(i).setDeleteList(deletelist); + } + } + } + return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleDistributeEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doSaveMdmModuleDistribute(JSONObject object) { + MdmDistributeDto entity = getData("jsonStr", object, MdmDistributeDto.class); + //判断是否有数据 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //if(entity.getMdmModuleDistributeEntities() == null ){ + // return BaseResult.getFailureMessageEntity("参数不允许为空"); + //} + //先删除 + MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + mdmModuleDistributeEntity.setMdmId(entity.getId()); + mdmModuleDistributeEntity.setSts("Y"); + mdmModuleDistributeEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDistributeEntity.setModify_time(new Date()); + mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); + + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setMdmId(entity.getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + mdmModuleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + mdmModuleDistributeDetailEntity.setModify_time(new Date()); + mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + + //保存主数据 + List mdmModuleDistributeEntities = entity.getMdmModuleDistributeEntities(); + + if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { + for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + MdmModuleDistributeEntity moduleDistributeEntity = mdmModuleDistributeEntities.get(i); + moduleDistributeEntity.setMdmId(entity.getId()); + moduleDistributeEntity.setSts("Y"); + moduleDistributeEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + moduleDistributeEntity.setModify_time(new Date()); + if (moduleDistributeEntity.getId() != null && !"".equals(moduleDistributeEntity.getId())) { + //修改 + mdmModuleDistributeDao.update(moduleDistributeEntity); + } else { + //新增 + moduleDistributeEntity.setId(UUIDUtils.getUUID()); + moduleDistributeEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + moduleDistributeEntity.setCreate_time(new Date()); + mdmModuleDistributeDao.save(moduleDistributeEntity); + } + if (moduleDistributeEntity.getAddList() != null && moduleDistributeEntity.getAddList().size() > 0) { + for (int i1 = 0; i1 < moduleDistributeEntity.getAddList().size(); i1++) { + MdmModuleDistributeDetailEntity moduleDistributeDetailEntity = moduleDistributeEntity.getAddList().get(i1); + moduleDistributeDetailEntity.setMdmId(entity.getId()); + moduleDistributeDetailEntity.setSts("Y"); + moduleDistributeDetailEntity.setApiId(moduleDistributeEntity.getAddApi()); + moduleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); + moduleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + moduleDistributeDetailEntity.setModify_time(new Date()); + if (moduleDistributeDetailEntity.getId() != null && !"".equals(moduleDistributeDetailEntity.getId())) { + //修改 + mdmModuleDistributeDetailDao.update(moduleDistributeDetailEntity); + } else { + //新增 + moduleDistributeDetailEntity.setId(UUIDUtils.getUUID()); + moduleDistributeDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + moduleDistributeDetailEntity.setCreate_time(new Date()); + mdmModuleDistributeDetailDao.save(moduleDistributeDetailEntity); + } + } + } + if (moduleDistributeEntity.getDeleteList() != null && moduleDistributeEntity.getDeleteList().size() > 0) { + for (int i1 = 0; i1 < moduleDistributeEntity.getDeleteList().size(); i1++) { + MdmModuleDistributeDetailEntity moduleDistributeDetailEntity = moduleDistributeEntity.getDeleteList().get(i1); + moduleDistributeDetailEntity.setMdmId(entity.getId()); + moduleDistributeDetailEntity.setSts("Y"); + moduleDistributeDetailEntity.setApiId(moduleDistributeEntity.getDeleteApi()); + moduleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); + moduleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + moduleDistributeDetailEntity.setModify_time(new Date()); + if (moduleDistributeDetailEntity.getId() != null && !"".equals(moduleDistributeDetailEntity.getId())) { + //修改 + mdmModuleDistributeDetailDao.update(moduleDistributeDetailEntity); + } else { + //新增 + moduleDistributeDetailEntity.setId(UUIDUtils.getUUID()); + moduleDistributeDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + moduleDistributeDetailEntity.setCreate_time(new Date()); + mdmModuleDistributeDetailDao.save(moduleDistributeDetailEntity); + } + } + } + } + } + return BaseResult.getSuccessMessageEntity("保存发布设置成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 树、查询条件、列表字段、按钮 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShow(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(entity.getMdmCode()); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //获取用户角色id + UserRole updateUser = new UserRole(); + updateUser.setUserId(StpUtil.getLoginIdAsString()); + updateUser.setSts("Y"); + List userRoleList = userRoleMapper.entity_list_base(updateUser); + if (userRoleList == null || userRoleList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmViewVo mdmViewVo = new MdmViewVo(); + mdmModuleEntity = mdmModuleEntities.get(0); + mdmViewVo.setMdmModuleEntity(mdmModuleEntity); + //查询展示类型 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewEntity.setSts("Y"); + List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); + if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleViewEntity = moduleViewEntityList.get(0); + mdmViewVo.setMdmModuleViewEntity(mdmModuleViewEntity); + + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表下面的字段 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询字段下的规则 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); + if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询设置的查询字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setViewType("1"); + List queryList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + //设置字段 + List queryListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, queryList,false); + mdmViewVo.setQueryList(queryListVo); + + //查询用户设置字段 + MdmModuleUserViewEntity mdmModuleUserViewEntity = new MdmModuleUserViewEntity(); + mdmModuleUserViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleUserViewEntity.setSts("Y"); + mdmModuleUserViewEntity.setUserId(StpUtil.getLoginIdAsString()); + List mdmModuleUserViewEntities = mdmModuleUserViewDao.queryBase(mdmModuleUserViewEntity); + + //查询设置的查询字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity1 = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity1.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDetailEntity1.setSts("Y"); + mdmModuleViewDetailEntity1.setViewType("2"); + List listList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity1); + List dolistList = new ArrayList<>(); + + if (mdmModuleUserViewEntities != null && mdmModuleUserViewEntities.size() > 0) { + dolistList = getDolist(listList, mdmModuleUserViewEntities); + if (dolistList == null || dolistList.size() == 0) { + dolistList = listList; + } + } else { + dolistList = listList; + } + List listListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, dolistList,true); + mdmViewVo.setListList(listListVo); + + //获取按钮 + MdmModuleRoleButtonEntity mdmModuleRoleButtonEntity = new MdmModuleRoleButtonEntity(); + mdmModuleRoleButtonEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleRoleButtonEntity.setSts("Y"); + mdmModuleRoleButtonEntity.setRoleIds(userRoleList); + List mdmModuleRoleButtonEntities = mdmModuleRoleButtonDao.queryBase(mdmModuleRoleButtonEntity); + List buttonList = setButton(mdmModuleRoleButtonEntities); + mdmViewVo.setButtonList(buttonList); + + return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据查询所有字段 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowAll(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询设置各种类型字段 + //查询模版数据源 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + List listFiled = new ArrayList<>(); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + // + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } else { + //2、明细 + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } + } + } + } + } + } + return BaseResult.getSuccessMessageEntity("查询视图成功", listFiled); + } + + /** + * @param mdmModuleRoleButtonEntities + * @return java.util.List + * @Author lvleigang + * @Description 设置返回按钮 + * @Date 4:48 下午 2023/10/26 + **/ + private List setButton(List mdmModuleRoleButtonEntities) { + List mdmViewButtonVoList = new ArrayList<>(); + if (mdmModuleRoleButtonEntities != null && mdmModuleRoleButtonEntities.size() > 0) { + for (int i = 0; i < mdmModuleRoleButtonEntities.size(); i++) { + mdmViewButtonVoList.add(new MdmViewButtonVo(mdmModuleRoleButtonEntities.get(i).getButtonType(), mdmModuleRoleButtonEntities.get(i).getButtonName())); + } + } + return mdmViewButtonVoList; + } + + /** + * @param allRecords + * @param checkedMeters + * @return java.util.List + * @Author lvleigang + * @Description 取出重复字段数据 + * @Date 4:34 下午 2023/10/26 + **/ + private List getDolist(List allRecords, List checkedMeters) { + List meterPlan = allRecords.stream() + .filter(item -> checkedMeters.stream() + .map(e -> { + if (!Objects.equals(item.getViewFiled(), e.getViewDetailId())) { + return null; + } else { + return item.getViewFiled(); + } + }) + .collect(Collectors.toList()) + .contains(item.getViewFiled())) + .collect(Collectors.toList()); + return meterPlan; + } + + /** + * @param mdmModuleDbEntityList 数据源 + * @param mdmModuleDbFiledsEntityList 数据源下的字段表 + * @param mdmModuleDbFiledsRuleEntityList 数据源字段的规则表 + * @param queryList 需要的字段 + * @return java.util.List + * @Author lvleigang + * @Description 根据字段设置返回前台字段 + * @Date 4:11 下午 2023/10/26 + **/ + private List setQueryList(List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList, List queryList,boolean flag) { + List mdmViewFiledVos = new ArrayList<>(); + + if (queryList != null && queryList.size() > 0) { + for (int i = 0; i < queryList.size(); i++) { + MdmViewFiledVo mdmViewFiledVo = new MdmViewFiledVo(); + mdmViewFiledVo.setId(queryList.get(i).getViewFiled());//字段id + mdmViewFiledVo.setSorts(i + 2);//排序 + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (queryList.get(i).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { + mdmViewFiledVo.setFiledType(mdmModuleDbFiledsEntityList.get(i1).getFiledType());//英文名 + mdmViewFiledVo.setEnName(mdmModuleDbFiledsEntityList.get(i1).getEnName());//英文名 + mdmViewFiledVo.setChName(mdmModuleDbFiledsEntityList.get(i1).getChName());//中文名 + for (int i2 = 0; i2 < mdmModuleDbEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i2).getId())) { + mdmViewFiledVo.setDbType(mdmModuleDbEntityList.get(i2).getDbType());//类型 1、主表 2、明细 + mdmViewFiledVo.setMdmId(mdmModuleDbEntityList.get(i2).getMdmId());//主数据模版ID + mdmViewFiledVo.setDbId(mdmModuleDbEntityList.get(i2).getId());//模版数据库id + mdmViewFiledVo.setDbName(mdmModuleDbEntityList.get(i2).getDbName());//表名 + + break; + } + } + break; + } + } + //设置字段规则 + List ruleList = new ArrayList<>(); + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntityList.size(); i1++) { + if (queryList.get(i).getViewFiled().equals(mdmModuleDbFiledsRuleEntityList.get(i1).getFiledId())) { + ruleList.add(mdmModuleDbFiledsRuleEntityList.get(i1)); + } + } + } + mdmViewFiledVo.setRuleList(ruleList); + mdmViewFiledVos.add(mdmViewFiledVo); + } + } + MdmViewFiledVo mdmViewFiledVo = new MdmViewFiledVo(); + mdmViewFiledVo.setSorts(1);//排序 + mdmViewFiledVo.setFiledType("3"); + mdmViewFiledVo.setEnName("document_rule");//英文名 + mdmViewFiledVo.setChName("单据编码");//中文名 + mdmViewFiledVo.setDbType("1");//类型 1、主表 2、明细 + if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0){ + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){ + mdmViewFiledVo.setDbName(mdmModuleDbEntityList.get(i).getDbName());//表名 + } + } + } + List msgRule = new ArrayList<>(); + MdmModuleDbFiledsRuleEntity msgRuleTitie = new MdmModuleDbFiledsRuleEntity(); + msgRuleTitie.setFormName("optionRuleForm"); + msgRuleTitie.setRuleCode("title"); + msgRuleTitie.setRuleName("显示名"); + msgRuleTitie.setRuleType("2"); + msgRuleTitie.setRuleValue("单据编码"); + MdmModuleDbFiledsRuleEntity msgRulerow = new MdmModuleDbFiledsRuleEntity(); + msgRulerow.setFormName("optionRuleForm"); + msgRulerow.setRuleCode("row"); + msgRulerow.setRuleName("宽度"); + msgRulerow.setRuleType("2"); + msgRulerow.setRuleValue("12"); + MdmModuleDbFiledsRuleEntity msgRuletype = new MdmModuleDbFiledsRuleEntity(); + msgRuletype.setFormName("optionRuleForm"); + msgRuletype.setRuleCode("type"); + msgRuletype.setRuleName("数据类型"); + msgRuletype.setRuleType("2"); + msgRuletype.setRuleValue("input"); + MdmModuleDbFiledsRuleEntity msgRulerequired = new MdmModuleDbFiledsRuleEntity(); + msgRulerequired.setFormName("optionRuleForm"); + msgRulerequired.setRuleCode("required"); + msgRulerequired.setRuleName("必填"); + msgRulerequired.setRuleType("2"); + MdmModuleDbFiledsRuleEntity withs = new MdmModuleDbFiledsRuleEntity(); + withs.setFormName("optionRuleForm"); + withs.setRuleCode("width"); + withs.setRuleName("宽度"); + withs.setRuleType("2"); + withs.setRuleValue("200"); + msgRule.add(withs); + msgRule.add(msgRulerequired); + msgRule.add(msgRuletype); + msgRule.add(msgRulerow); + msgRule.add(msgRuleTitie); + mdmViewFiledVo.setRuleList(msgRule); + mdmViewFiledVos.add(0,mdmViewFiledVo); + + //添加分发数量 + if(flag){ + addFfsl(mdmModuleDbEntityList,mdmViewFiledVos); + } + return mdmViewFiledVos; + } + + private void addFfsl(List mdmModuleDbEntityList, List mdmViewFiledVos) { + + MdmViewFiledVo mdmViewFiledVo = new MdmViewFiledVo(); + mdmViewFiledVo.setSorts(1);//排序 + mdmViewFiledVo.setFiledType("1"); + mdmViewFiledVo.setEnName("qwqwasdasdzxasda");//英文名 + mdmViewFiledVo.setChName("分发数量");//中文名 + mdmViewFiledVo.setDbType("1");//类型 1、主表 2、明细 + if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0){ + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){ + mdmViewFiledVo.setDbName(mdmModuleDbEntityList.get(i).getDbName());//表名 + } + } + } + List msgRule = new ArrayList<>(); + MdmModuleDbFiledsRuleEntity msgRuleTitie = new MdmModuleDbFiledsRuleEntity(); + msgRuleTitie.setFormName("optionRuleForm"); + msgRuleTitie.setRuleCode("title"); + msgRuleTitie.setRuleName("显示名"); + msgRuleTitie.setRuleType("2"); + msgRuleTitie.setRuleValue("分发数量"); + MdmModuleDbFiledsRuleEntity msgRulerow = new MdmModuleDbFiledsRuleEntity(); + msgRulerow.setFormName("optionRuleForm"); + msgRulerow.setRuleCode("row"); + msgRulerow.setRuleName("宽度"); + msgRulerow.setRuleType("2"); + msgRulerow.setRuleValue("6"); + MdmModuleDbFiledsRuleEntity msgRuletype = new MdmModuleDbFiledsRuleEntity(); + msgRuletype.setFormName("optionRuleForm"); + msgRuletype.setRuleCode("type"); + msgRuletype.setRuleName("数据类型"); + msgRuletype.setRuleType("2"); + msgRuletype.setRuleValue("input"); + MdmModuleDbFiledsRuleEntity msgRulerequired = new MdmModuleDbFiledsRuleEntity(); + msgRulerequired.setFormName("optionRuleForm"); + msgRulerequired.setRuleCode("required"); + msgRulerequired.setRuleName("必填"); + msgRulerequired.setRuleType("2"); + msgRule.add(msgRulerequired); + msgRule.add(msgRuletype); + msgRule.add(msgRulerow); + msgRule.add(msgRuleTitie); + mdmViewFiledVo.setRuleList(msgRule); + mdmViewFiledVos.add(mdmViewFiledVo); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowData(JSONObject object) { + MdmQuery entity = getData("jsonStr", object, MdmQuery.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List> businessResult = mdmModuleDao.queryMdmShowData(entity); + PageInfo pageInfo = new PageInfo(businessResult); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowDistribute(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(entity.getMdmCode()); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); + mdmModuleDbEntity.setDbType("1"); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleDbEntity = mdmModuleDbEntityList.get(0); + Map queryData = new HashMap<>(); + queryData.put("tableName", mdmModuleDbEntity.getDbName()+"_distribute");//表名 + queryData.put("id", entity.getId());//字段 + List datas = mdmModuleDbDao.getServiceByDistributeIdNoCase(queryData); + List returnData = new ArrayList<>(); + + //查询分发表 + MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId()); + mdmModuleDistributeEntity.setSts("Y"); + List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); + if(datas != null && datas.size() > 0){ + if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){ + for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + boolean flag = false; + for (int i1 = 0; i1 < datas.size(); i1++) { + if(datas.get(i1).getAppId().equals(mdmModuleDistributeEntities.get(i).getAppId())){ + flag = true; + break; + } + } + if(!flag){ + MdmDistributeVo mdmDistributeVo = new MdmDistributeVo(); + mdmDistributeVo.setAppId(mdmModuleDistributeEntities.get(i).getAppId()); + mdmDistributeVo.setStatus("4"); + mdmDistributeVo.setMsg("未发送"); + returnData.add(mdmDistributeVo); + } + } + } + returnData.addAll(datas); + }else { + if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){ + for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + MdmDistributeVo mdmDistributeVo = new MdmDistributeVo(); + mdmDistributeVo.setAppId(mdmModuleDistributeEntities.get(i).getAppId()); + mdmDistributeVo.setStatus("4"); + mdmDistributeVo.setMsg("未发送"); + returnData.add(mdmDistributeVo); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功",returnData); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询数据(list 或者 分页) + * @Date 1:33 下午 2023/7/12 + **/ + @Override + public JsonResultEntity queryTemplateData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + //校验是否有servecr传参 + if (!checkStr(entity.getTableName())) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkStr(entity.getValue())) { + return BaseResult.getFailureMessageEntity("请先传递存储字段"); + } + if (!checkStr(entity.getLabel())) { + return BaseResult.getFailureMessageEntity("请先传递显示字段"); + } + if (entity.getPageNum() != null && entity.getPageSize() != null) { + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List> mapList = mdmModuleDao.querySelectData(entity); + PageInfo pageInfo = new PageInfo(mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } else { + List> mapList = mdmModuleDao.querySelectData(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mapList); + } + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 业务数据树形结构,数据查询 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowTreeData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + //if (entity.getTableName() == null || "".equals(entity.getTableName())) { + // return BaseResult.getFailureMessageEntity("系统错误"); + //} + if (entity.getLabel() == null || "".equals(entity.getLabel())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getUpId() == null || "".equals(entity.getUpId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() != null && !"".equals(entity.getMdmCode())) { + //查询模版 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(entity.getMdmCode()); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); + mdmModuleDbEntity.setDbType("1"); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleDbEntity = mdmModuleDbEntityList.get(0); + entity.setTableName(mdmModuleDbEntity.getDbName()); + } + + + if (checkStr(entity.getId())) { + if (!checkStr(entity.getValue())) { + return BaseResult.getFailureMessageEntity("请先传递存储字段"); + } + if(entity.getId().contains(",")){ + String[] strArray = entity.getId().split(","); // 使用逗号和空格作为分隔符 + entity.setIds(strArray); + List> mapList = mdmModuleDao.queryTemplateDataMore(entity); + if (mapList == null || mapList.size() == 0) { + List> returnList = new ArrayList<>(); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + List> returnList = gettochilder(strArray,0,mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + }else { + HashMap mapList = mdmModuleDao.queryTemplateDataOne(entity); + if (mapList == null || mapList.size() == 0) { + List> returnList = new ArrayList<>(); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + List> returnList = new ArrayList<>(); + returnList.add(mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + }else { + List> mapList = mdmModuleDao.queryDataAll(entity); + List> returnList = new ArrayList<>(); + + if (mapList != null && mapList.size() > 0) { + for (int i = 0; i < mapList.size(); i++) { + //默认为根 + if (mapList.get(i).get(entity.getUpId()) == null || "".equals(mapList.get(i).get(entity.getUpId()))) { + List> children = getchilder(mapList.get(i).get("qsdfg").toString(), mapList, entity); + HashMap re = new HashMap<>(); + re.put("id", mapList.get(i).get("qsdfg")); + re.put("label", mapList.get(i).get(entity.getLabel())); + re.put("upID", mapList.get(i).get(entity.getUpId())); + if (children != null && children.size() > 0) { + re.put("children", children); + } + returnList.add(re); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功",returnList); + } + } + + private List> gettochilder(String[] strArray, int i, List> mapList) { + List> maps = new ArrayList<>(); + for (int i1 = 0; i1 < mapList.size(); i1++) { + if(strArray[i].equals(mapList.get(i1).get("id").toString())){ + if(strArray.length >= (i+2) ) { + mapList.get(i1).put("children",gettochilder(strArray,i+1,mapList)); + } + maps.add(mapList.get(i1)); + break; + } + } + return maps; + } + + private HashMap getFathers(List> mapListAll, HashMap mapList, MdmDto entity) { + if (mapList.get("upID") == null) { + return mapList; + } + HashMap retList = new HashMap<>(); + if (mapListAll != null && mapListAll.size() > 0) { + for (int i = 0; i < mapListAll.size(); i++) { + //等于上级id的时候 + if (mapListAll.get(i).get("qsdfg").equals(mapList.get("upID"))) { + retList.put("id", mapListAll.get(i).get("qsdfg")); + retList.put("label", mapListAll.get(i).get(entity.getLabel())); + retList.put("upID", mapListAll.get(i).get(entity.getUpId())); + List> returnList = new ArrayList<>(); + returnList.add(mapList); + retList.put("children", returnList); + break; + } + } + } + HashMap a = getFathers(mapListAll, retList, entity); + return a; + } + + private List> getchilder(String stringObjectHashMap, List> mapList, MdmDto entity) { + List> returnList = new ArrayList<>(); + if (mapList != null && mapList.size() > 0) { + for (int i = 0; i < mapList.size(); i++) { + //等于上级id的时候 + if (stringObjectHashMap.equals(mapList.get(i).get(entity.getUpId()))) { + List> children = getchilder(mapList.get(i).get(entity.getUpId())+","+mapList.get(i).get("qsdfg"), mapList, entity); + HashMap re = new HashMap<>(); + re.put("id", mapList.get(i).get("qsdfg")); + re.put("label", mapList.get(i).get(entity.getLabel())); + re.put("upID", mapList.get(i).get(entity.getUpId())); + if (children != null && children.size() > 0) { + re.put("children", children); + } + returnList.add(re); + } + } + } + return returnList; + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowDetails(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getShowType() == null || "".equals(entity.getShowType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(entity.getMdmCode()); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmDetailViewVo mdmViewVo = new MdmDetailViewVo(); + mdmModuleEntity = mdmModuleEntities.get(0); + mdmViewVo.setMdmModuleEntity(mdmModuleEntity); + + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表下面的字段 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询字段下的规则 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); + if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setViewType(entity.getShowType());//设置显示字段类型 + List mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + //组装数据 + assembleMdmShowDetails(mdmViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, mdmModuleViewDetailEntityList, entity.getShowType()); + return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); + } + + /** + * @param mdmViewVo 返回对象 + * @param mdmModuleDbEntityList 数据源表 + * @param mdmModuleDbFiledsEntityList 数据源字段 + * @param mdmModuleDbFiledsRuleEntityList 数据源字段规则 + * @param mdmModuleViewDetailEntityList 数据源显示字段 + * @return void + * @Author lvleigang + * @Description 组装显示字段 + * @Date 9:10 上午 2023/11/6 + **/ + private void assembleMdmShowDetails(MdmDetailViewVo mdmViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList, List mdmModuleViewDetailEntityList, String showType) { + //主数据主表 + MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); + List mainMdmModuleDbFileds = new ArrayList<>(); + //主数据子表 + List sublistMdmModuleDb = new ArrayList<>(); + + if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { + //先循环数据源表,设置出数据字段 + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 2、明细 + mainMdmModuleDb = mdmModuleDbEntityList.get(i); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { + if(mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())){ + mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + } + } + } + } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //2、明细 + sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + List sublistMdmModuleDbFileds = new ArrayList<>(); + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { + if(mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())){ + sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + + } + } + mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); + } + } + } + mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); + mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); + //主数据子表 + List mdmModuleDb = new ArrayList<>(); + if(sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0){ + for (int i = 0; i < sublistMdmModuleDb.size(); i++) { + if(sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() != null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() > 0 ){ + mdmModuleDb.add(sublistMdmModuleDb.get(i)); + } + } + } + if("5".equals(showType)){ + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setDbName(mainMdmModuleDb.getDbName() + "_distribute"); + mdmModuleDbEntity.setRemark(mainMdmModuleDb.getRemark() + "分发表"); + mdmModuleDbEntity.setDbType("2"); + List mdmModuleDbFiledsEntityList1 = getDistributeRole(); + mdmModuleDbEntity.setSublistMdmModuleDbFileds(mdmModuleDbFiledsEntityList1); + mdmModuleDb.add(mdmModuleDbEntity); + } + mdmViewVo.setSublistMdmModuleDb(mdmModuleDb); + + + + } else { + mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); + mdmViewVo.setSublistMdmModuleDb(sublistMdmModuleDb); + } + } + + private List getDistributeRole() { + List mdmModuleDbFiledsEntityList = new ArrayList<>(); + //app + MdmModuleDbFiledsEntity appFiled = new MdmModuleDbFiledsEntity(); + appFiled.setChName("应用"); + appFiled.setEnName("app_id"); + appFiled.setFiledLength("50"); + appFiled.setFiledType("3"); + List appRule = new ArrayList<>(); + MdmModuleDbFiledsRuleEntity appRuleTitie = new MdmModuleDbFiledsRuleEntity(); + appRuleTitie.setFormName("optionRuleForm"); + appRuleTitie.setRuleCode("title"); + appRuleTitie.setRuleName("显示名"); + appRuleTitie.setRuleType("2"); + appRuleTitie.setRuleValue("应用"); + MdmModuleDbFiledsRuleEntity appRulerow = new MdmModuleDbFiledsRuleEntity(); + appRulerow.setFormName("optionRuleForm"); + appRulerow.setRuleCode("row"); + appRulerow.setRuleName("宽度"); + appRulerow.setRuleType("2"); + appRulerow.setRuleValue("6"); + MdmModuleDbFiledsRuleEntity appRuletype = new MdmModuleDbFiledsRuleEntity(); + appRuletype.setFormName("optionRuleForm"); + appRuletype.setRuleCode("type"); + appRuletype.setRuleName("数据类型"); + appRuletype.setRuleType("2"); + appRuletype.setRuleValue("select"); + MdmModuleDbFiledsRuleEntity appRulerequired = new MdmModuleDbFiledsRuleEntity(); + appRulerequired.setFormName("optionRuleForm"); + appRulerequired.setRuleCode("required"); + appRulerequired.setRuleName("必填"); + appRulerequired.setRuleType("2"); + MdmModuleDbFiledsRuleEntity appRuleservice = new MdmModuleDbFiledsRuleEntity(); + appRuleservice.setFormName("typeOptionRuleForm"); + appRuleservice.setRuleCode("service"); + appRuleservice.setRuleName("服务名称"); + appRuleservice.setRuleType("2"); + appRuleservice.setRuleValue("sys_application"); + MdmModuleDbFiledsRuleEntity appRulelabel = new MdmModuleDbFiledsRuleEntity(); + appRulelabel.setFormName("typeOptionRuleForm"); + appRulelabel.setRuleCode("label"); + appRulelabel.setRuleName("label"); + appRulelabel.setRuleType("2"); + appRulelabel.setRuleValue("name"); + MdmModuleDbFiledsRuleEntity appRulevalue = new MdmModuleDbFiledsRuleEntity(); + appRulevalue.setFormName("typeOptionRuleForm"); + appRulevalue.setRuleCode("value"); + appRulevalue.setRuleName("value"); + appRulevalue.setRuleType("2"); + appRulevalue.setRuleValue("id"); + appRule.add(appRulevalue); + appRule.add(appRulelabel); + appRule.add(appRuleservice); + appRule.add(appRulerequired); + appRule.add(appRuletype); + appRule.add(appRulerow); + appRule.add(appRuleTitie); + appFiled.setMdmModuleDbFiledsRules(appRule); + mdmModuleDbFiledsEntityList.add(appFiled); + + + //status + MdmModuleDbFiledsEntity statusFiled = new MdmModuleDbFiledsEntity(); + statusFiled.setChName("状态"); + statusFiled.setEnName("status"); + statusFiled.setFiledLength("50"); + statusFiled.setFiledType("3"); + List statusRule = new ArrayList<>(); + MdmModuleDbFiledsRuleEntity statusRuleTitie = new MdmModuleDbFiledsRuleEntity(); + statusRuleTitie.setFormName("optionRuleForm"); + statusRuleTitie.setRuleCode("title"); + statusRuleTitie.setRuleName("显示名"); + statusRuleTitie.setRuleType("2"); + statusRuleTitie.setRuleValue("状态"); + MdmModuleDbFiledsRuleEntity statusRulerow = new MdmModuleDbFiledsRuleEntity(); + statusRulerow.setFormName("optionRuleForm"); + statusRulerow.setRuleCode("row"); + statusRulerow.setRuleName("宽度"); + statusRulerow.setRuleType("2"); + statusRulerow.setRuleValue("6"); + MdmModuleDbFiledsRuleEntity statusRuletype = new MdmModuleDbFiledsRuleEntity(); + statusRuletype.setFormName("optionRuleForm"); + statusRuletype.setRuleCode("type"); + statusRuletype.setRuleName("数据类型"); + statusRuletype.setRuleType("2"); + statusRuletype.setRuleValue("input"); + MdmModuleDbFiledsRuleEntity statusRulerequired = new MdmModuleDbFiledsRuleEntity(); + statusRulerequired.setFormName("optionRuleForm"); + statusRulerequired.setRuleCode("required"); + statusRulerequired.setRuleName("必填"); + statusRulerequired.setRuleType("2"); + statusRule.add(statusRulerequired); + statusRule.add(statusRuletype); + statusRule.add(statusRulerow); + statusRule.add(statusRuleTitie); + statusFiled.setMdmModuleDbFiledsRules(statusRule); + mdmModuleDbFiledsEntityList.add(statusFiled); + + + + //msg + MdmModuleDbFiledsEntity msgFiled = new MdmModuleDbFiledsEntity(); + msgFiled.setChName("描述"); + msgFiled.setEnName("msg"); + msgFiled.setFiledLength("200"); + msgFiled.setFiledType("3"); + List msgRule = new ArrayList<>(); + MdmModuleDbFiledsRuleEntity msgRuleTitie = new MdmModuleDbFiledsRuleEntity(); + msgRuleTitie.setFormName("optionRuleForm"); + msgRuleTitie.setRuleCode("title"); + msgRuleTitie.setRuleName("显示名"); + msgRuleTitie.setRuleType("2"); + msgRuleTitie.setRuleValue("描述"); + MdmModuleDbFiledsRuleEntity msgRulerow = new MdmModuleDbFiledsRuleEntity(); + msgRulerow.setFormName("optionRuleForm"); + msgRulerow.setRuleCode("row"); + msgRulerow.setRuleName("宽度"); + msgRulerow.setRuleType("2"); + msgRulerow.setRuleValue("6"); + MdmModuleDbFiledsRuleEntity msgRuletype = new MdmModuleDbFiledsRuleEntity(); + msgRuletype.setFormName("optionRuleForm"); + msgRuletype.setRuleCode("type"); + msgRuletype.setRuleName("数据类型"); + msgRuletype.setRuleType("2"); + msgRuletype.setRuleValue("input"); + MdmModuleDbFiledsRuleEntity msgRulerequired = new MdmModuleDbFiledsRuleEntity(); + msgRulerequired.setFormName("optionRuleForm"); + msgRulerequired.setRuleCode("required"); + msgRulerequired.setRuleName("必填"); + msgRulerequired.setRuleType("2"); + msgRule.add(msgRulerequired); + msgRule.add(msgRuletype); + msgRule.add(msgRulerow); + msgRule.add(msgRuleTitie); + msgFiled.setMdmModuleDbFiledsRules(msgRule); + mdmModuleDbFiledsEntityList.add(msgFiled); + return mdmModuleDbFiledsEntityList; + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询数据(list 或者 分页) + * @Date 1:33 下午 2023/7/12 + **/ + @Override + public JsonResultEntity queryMdmOptionData(JSONObject object) { + ModuleDto entity = getData("jsonStr", object, ModuleDto.class); + //校验是否有servecr传参 + if (!checkStr(entity.getService())) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkStr(entity.getValue())) { + return BaseResult.getFailureMessageEntity("请先传递存储字段"); + } + if (!checkStr(entity.getLabel())) { + return BaseResult.getFailureMessageEntity("请先传递显示字段"); + } + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setId(entity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setTableName(mdmModuleDbEntityList.get(0).getDbName()); + if (entity.getPageNum() != null && entity.getPageSize() != null) { + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List> mapList = mdmModuleDao.queryTemplateData(entity); + PageInfo pageInfo = new PageInfo(mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } else { + List> mapList = mdmModuleDao.queryTemplateData(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mapList); + } + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowDetailsData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(entity.getMdmCode()); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String tablename = null; + JSONObject jsonObject = new JSONObject(); + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + //查询数据 + Map queryData = new HashMap<>(); + queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 + if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){ + queryData.put("detailFlag", false);//是否明细 + queryData.put("id", entity.getId());//字段 + HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); + jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(),datas); + tablename = mdmModuleDbEntityList.get(i).getDbName()+"_distribute"; + }else { + queryData.put("detailFlag", true);//是否明细 + queryData.put("id", entity.getId());//字段 + List> datas = mdmModuleDbDao.getServiceByFormmainId(queryData); + jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(),datas); + } + } + if(tablename != null && !"".equals(tablename)){ + Map queryData = new HashMap<>(); + queryData.put("tableName", tablename);//表名 + queryData.put("id", entity.getId());//字段 + List> datas = mdmModuleDbDao.getServiceByDistributeId(queryData); + jsonObject.put(tablename,datas); + } + + + return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject); + } + + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据修改 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity updateMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "data")) { + return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); + } + JSONObject saveData = jsonObject.getJSONObject("data"); + //校验唯一 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String res = checkDataOnly(jsonObject.getInteger("mdmCode"),saveData,true,mdmModuleEntity,mdmModuleDbEntityList); + + if (res == null || "".equals(res)) { + return BaseResult.getSuccessMessageEntity("修改数据成功"); + } else { + return BaseResult.getFailureMessageEntity(res); + } + } + + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据新增 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity saveMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "data")) { + return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); + } + JSONObject saveData = jsonObject.getJSONObject("data"); + //校验唯一 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String res = checkDataOnly(jsonObject.getInteger("mdmCode"),saveData,false,mdmModuleEntity,mdmModuleDbEntityList); + + if (res == null || "".equals(res)) { + return BaseResult.getSuccessMessageEntity("保存数据成功"); + } else { + return BaseResult.getFailureMessageEntity(res); + } + } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据修改 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity deleteMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "id")) { + return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); + } + //校验唯一 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + + //查询视图,如果树形,删除下级及子集 + //查询展示类型 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewEntity.setSts("Y"); + List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); + if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleViewEntity = moduleViewEntityList.get(0); + + + //删除自己 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setId(jsonObject.getString("id")); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + if(mdmModuleViewEntity != null && mdmModuleViewEntity.getViewName() != null && "1".equals(mdmModuleViewEntity.getViewName() ) && + mdmModuleViewEntity.getUpIdFiled() != null && !"".equals(mdmModuleViewEntity.getUpIdFiled() )){ + formmainDeleteDto.setUpIdFiled(mdmModuleViewEntity.getUpIdFiled()); + + Map queryData = new HashMap<>(); + queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 + queryData.put("detailFlag", false);//是否明细 + queryData.put("id", jsonObject.getString("id"));//字段 + HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); + String upValue = null; + if(datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != null){ + upValue = datas.get(mdmModuleViewEntity.getUpIdFiled()).toString(); + } + if(upValue != null ){ + formmainDeleteDto.setUpIdFiledValue(upValue+","+jsonObject.getString("id")); + }else { + formmainDeleteDto.setUpIdFiledValue(jsonObject.getString("id")); + } + mdmModuleDao.deleteChilder(formmainDeleteDto); + } + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + + }else { + //删除明细 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setFormmain_id(jsonObject.getString("id")); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + } + } + return BaseResult.getSuccessMessageEntity("删除数据成功"); + } + + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 处理分发数据 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doMdmDistribute(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "id")) { + return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); + } + if (!checkData(jsonObject, "appID")) { + return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); + } + if (!checkData(jsonObject, "dataType")) { + return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); + } + //TODO 后续完成下发或者删除业务 + return BaseResult.getSuccessMessageEntity("处理分发数据成功"); + } + + /** + * @Author lvleigang + * @Description 校验数据 + * @Date 11:20 上午 2023/11/6 + * @param mdmCode + * @param saveData + * @param mdmModuleEntity + * @param mdmModuleDbEntityList + * @param flag 修改 新增 + * @return java.lang.String + **/ + private String checkDataOnly(Integer mdmCode, JSONObject saveData,boolean flag,MdmModuleEntity mdmModuleEntity,List mdmModuleDbEntityList) { + StringBuffer str = new StringBuffer(); + + //查询字段 + //查询字段下的必填规则 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setRoletype("required"); + mdmModuleDbFiledsEntity.setRoleValue("true"); + List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + + if(mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0){ + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if(mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){ + if(jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))){ + if(str.toString() != null && !"".equals(str.toString())){ + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark()+"的"+mdmModuleDbFiledsEntityList.get(i1).getChName()+"不为空"); + } + } + } + }else { + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if(jsonArray != null && jsonArray.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if(mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){ + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + if(jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))){ + if(str.toString() != null && !"".equals(str.toString())){ + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark()+"的"+mdmModuleDbFiledsEntityList.get(i1).getChName()+"不为空"); + break; + } + } + } + } + } + } + } + } + + if (str == null || "".equals(str.toString())) { + //校验数据 + MdmModuleDbFiledsEntity onlyFiledsEntity = new MdmModuleDbFiledsEntity(); + onlyFiledsEntity.setMdmId(mdmModuleEntity.getId()); + onlyFiledsEntity.setSts("Y"); + onlyFiledsEntity.setRoletype("fieldsSole"); + onlyFiledsEntity.setRoleValue("true"); + + List onlyEntityList = mdmModuleDbFiledsDao.queryBase(onlyFiledsEntity); + + if(onlyEntityList != null && onlyEntityList.size() > 0){ + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { + if(onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){ + //校验唯一 + Map map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntityList.get(i).getDbName()); + if(flag){ + map.put("id",jsonObject.getString("id")); + } + map.put("filedName",onlyEntityList.get(i1).getEnName()); + map.put("filedValue",jsonObject.getString(onlyEntityList.get(i1).getEnName())); + Integer count = mdmModuleDao.checkData(map); + if(count > 0){ + if(str.toString() != null && !"".equals(str.toString())){ + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark()+"的"+mdmModuleDbFiledsEntityList.get(i1).getChName()+"已存在"); + } + } + } + }else { + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if(jsonArray != null && jsonArray.size() > 0){ + for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { + if(onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){ + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + + //校验唯一 + Map map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntityList.get(i).getDbName()); + if(flag){ + map.put("id",jsonObject.getString("id")); + } + map.put("filedName",onlyEntityList.get(i1).getEnName()); + map.put("filedValue",jsonObject.getString(onlyEntityList.get(i1).getEnName())); + Integer count = mdmModuleDao.checkData(map); + if(count > 0){ + if(str.toString() != null && !"".equals(str.toString())){ + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark()+"的"+mdmModuleDbFiledsEntityList.get(i1).getChName()+"已存在"); + break; + } + } + } + } + } + } + } + } + } + + + //保存数据 + if (str == null || "".equals(str.toString())) { + String id = UUIDUtils.getUUID(); + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + //保存数据 + MdmDataDto mdmDataDto = new MdmDataDto(); + mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); + mdmModuleDbFiledsEntity1.setSts("Y"); + List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); + //查询单据规则 + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmTableCodeRuleEntity.setDbId(mdmModuleDbEntityList.get(i).getId()); + mdmTableCodeRuleEntity.setSts("Y"); + List mdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity); + StringBuffer document_rule = new StringBuffer(); + Integer document_rule_num = 0; + if(mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0){ + for (int i1 = 0; i1 < mdmTableCodeRuleEntities.size(); i1++) { + //1、连接符号 2、字符串 3、日期 4、流水号 + if("1".equals(mdmTableCodeRuleEntities.get(i1).getDbType())){ + document_rule.append("-"); + }else if("2".equals(mdmTableCodeRuleEntities.get(i1).getDbType())){ + document_rule.append(mdmTableCodeRuleEntities.get(i1).getDbValue()); + }else if("3".equals(mdmTableCodeRuleEntities.get(i1).getDbType())){ + SimpleDateFormat sdf = new SimpleDateFormat(mdmTableCodeRuleEntities.get(i1).getDbValue());//要转换的时间格式 + String stra = sdf.format(new Date()); + document_rule.append(stra); + }else if("4".equals(mdmTableCodeRuleEntities.get(i1).getDbType())){ + document_rule_num = mdmTableCodeRuleEntities.get(i1).getDbValue().length(); + } + } + } + List mdmDataFiledDtos = new ArrayList<>(); + for (int i1 = 0; i1 < fileds.size(); i1++) { + if(jsonObject.get(fileds.get(i1).getEnName()) != null ){ + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); + mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); + mdmDataFiledDtos.add(mdmDataFiledDto); + } + } + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName("logid"); + mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); + mdmDataFiledDtos.add(mdmDataFiledDto); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + if(flag){ + mdmDataDto.setId(jsonObject.getString("id")); + id = jsonObject.getString("id"); + int a = mdmModuleDao.updateForm(mdmDataDto); + }else { + + mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); + mdmDataDto.setDocumentRule(document_rule.toString()); + mdmDataDto.setDocumentRuleNum(document_rule_num); + MdmDataFiledDto ids = new MdmDataFiledDto(); + ids.setFiledsName("id"); + ids.setFiledsValue(id); + mdmDataFiledDtos.add(ids); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + int a = mdmModuleDao.saveForm(mdmDataDto); + } + } + } + + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //删除明细 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setFormmain_id(id); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if(jsonArray != null && jsonArray.size() > 0){ + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); + mdmModuleDbFiledsEntity1.setSts("Y"); + List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); + + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + //保存数据 + MdmDataDto mdmDataDto = new MdmDataDto(); + mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + List mdmDataFiledDtos = new ArrayList<>(); + for (int i1 = 0; i1 < fileds.size(); i1++) { + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); + mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); + mdmDataFiledDtos.add(mdmDataFiledDto); + } + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName("logid"); + mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); + mdmDataFiledDtos.add(mdmDataFiledDto); + + MdmDataFiledDto formain_id = new MdmDataFiledDto(); + formain_id.setFiledsName("formmain_id"); + formain_id.setFiledsValue(id); + mdmDataFiledDtos.add(formain_id); + + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + if(jsonObject.getString("id") != null ){ + MdmDataFiledDto sts = new MdmDataFiledDto(); + sts.setFiledsName("sts"); + sts.setFiledsValue("Y"); + mdmDataFiledDtos.add(sts); + mdmDataDto.setId(jsonObject.getString("id")); + int a = mdmModuleDao.updateForm(mdmDataDto); + }else { + MdmDataFiledDto ids = new MdmDataFiledDto(); + ids.setFiledsName("id"); + ids.setFiledsValue(UUIDUtils.getUUID()); + mdmDataFiledDtos.add(ids); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); + int a = mdmModuleDao.saveForm(mdmDataDto); + } + } + } + } + } + } + return str.toString(); + } + + /** + * @param jsonObject + * @return boolean + * @Author lvleigang + * @Description 校验是否有值 + * @Date 2:20 下午 2023/7/10 + **/ + private boolean checkData(JSONObject jsonObject, String key) { + if (jsonObject != null + && jsonObject.getString(key) != null + && !"".equals(jsonObject.getString(key))) { + return true; + } + return false; + } + + protected T getData(String key, JSONObject jsonObject, Class clz) { + if (checkStr(jsonObject.getString(key))) { + return jsonObject.getJSONObject(key).toJavaObject(clz); + } + return null; + } + + /** + * @param key + * @param object + * @return com.alibaba.fastjson.JSONObject + * @Author lvleigang + * @Description 获取对象转换成jsonobj + * @Date 11:51 下午 2023/7/10 + **/ + protected JSONObject getstrObj(String key, JSONObject object) { + if (checkStr(object.getString(key))) { + return object.getJSONObject(key); + } + return new JSONObject(); + } + + /** + * @param str + * @return void + * @Author lvleigang + * @Description 校验字符串 + * @Date 11:41 上午 2022/12/7 + **/ + protected Boolean checkStr(String str) { + Boolean flag = true; + if (str == null || "".equals(str)) { + flag = false; + } + return flag; + } + + /** + * @param str + * @return void + * @Author lvleigang + * @Description 校验字符串 + * @Date 11:41 上午 2022/12/7 + **/ + protected Boolean checkInt(Integer str) { + Boolean flag = true; + if (str == null) { + flag = false; + } + return flag; + } + +} diff --git a/service/src/main/java/com/hzya/frame/nc/entity/NcInterface.java b/service/src/main/java/com/hzya/frame/nc/entity/NcInterface.java new file mode 100644 index 00000000..81018a0c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/nc/entity/NcInterface.java @@ -0,0 +1,27 @@ +package com.hzya.frame.nc.entity; + +import com.alibaba.fastjson2.JSON; +import com.hzya.frame.web.entity.BaseEntity; +import lombok.ToString; + +/** + * @Content + * @Author 👻👻👻👻👻👻👻👻👻👻 gjh + * @Date 2023-06-14 10:20 + * @Version 1.0 + */ +//@ToString(callSuper=true) +public class NcInterface extends BaseEntity { + + + public static void main(String[] args) { + NcInterface s = new NcInterface(); + s.setId("2"); + s.setLimit(1L); + s.setSts("Y"); + String str = JSON.toJSONString(s); + //System.out.println(str); + NcInterface s2 = JSON.parseObject(str,NcInterface.class); + //System.out.println(JSON.toJSONString(s2)); + } +} diff --git a/service/src/main/java/com/hzya/frame/nc/entity/NcInterfaceMapper.xml b/service/src/main/java/com/hzya/frame/nc/entity/NcInterfaceMapper.xml new file mode 100644 index 00000000..fe940407 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/nc/entity/NcInterfaceMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + ID as id, + code as code, + name as name, + classify as classify, + description as description, + production_company as production_company, + picture_path as picture_path, + sys_type as sys_type, + sorts as sorts, + org_id as org_id, + sts as sts, + create_user_id as create_user_id, + create_time as create_time, + modify_time as modify_time, + modify_user_id as modify_user_id + + + + + update sys_user SET view_name = '超级管理员221' WHERE login_name = 'admin' + + diff --git a/service/src/main/java/com/hzya/frame/nc/service/INcInterfaceService.java b/service/src/main/java/com/hzya/frame/nc/service/INcInterfaceService.java new file mode 100644 index 00000000..d8691dfe --- /dev/null +++ b/service/src/main/java/com/hzya/frame/nc/service/INcInterfaceService.java @@ -0,0 +1,26 @@ +package com.hzya.frame.nc.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * @Content + * @Author 👻👻👻👻👻👻👻👻👻👻 gjh + * @Date 2023-06-13 14:13 + * @Version 1.0 + */ +public interface INcInterfaceService { + + void queryNccBasicArchives(JSONObject req); + + //@DSTransactional() + //JsonResultEntity updateUser(JSONObject jsonObject); + + @DS("dataSource1") + int updateUser1(JSONObject jsonObject); + + @DS("dataSource2") + int updateUser2(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/nc/service/Test01.java b/service/src/main/java/com/hzya/frame/nc/service/Test01.java new file mode 100644 index 00000000..4df37ded --- /dev/null +++ b/service/src/main/java/com/hzya/frame/nc/service/Test01.java @@ -0,0 +1,10 @@ +package com.hzya.frame.nc.service; + +/** + * @Content + * @Author 👻👻👻👻👻👻👻👻👻👻 gjh + * @Date 2023-06-15 15:20 + * @Version 1.0 + */ +public interface Test01 { +} diff --git a/service/src/main/java/com/hzya/frame/nc/service/impl/NcInterfaceServiceImpl.java b/service/src/main/java/com/hzya/frame/nc/service/impl/NcInterfaceServiceImpl.java new file mode 100644 index 00000000..0b9a3577 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/nc/service/impl/NcInterfaceServiceImpl.java @@ -0,0 +1,146 @@ +package com.hzya.frame.nc.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +//import com.hzya.frame.demo.bean.Test; +//import com.hzya.frame.demo.mapper.TestMapper; +import com.hzya.frame.nc.entity.NcInterface; +import com.hzya.frame.nc.service.INcInterfaceService; +import com.hzya.frame.sys.user.service.IUserService; +import com.hzya.frame.web.action.ApplicationContextUtil; +import com.hzya.frame.web.entity.JsonResultEntity; +import com.hzya.frame.web.exception.BaseSystemException; +import org.apache.ibatis.session.SqlSessionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + + +/** + * @Content + * @Author 👻👻👻👻👻👻👻👻👻👻 gjh + * @Date 2023-06-13 14:29 + * @Version 1.0 + */ +@Service(value = "ncInterfaceService") +public class NcInterfaceServiceImpl implements INcInterfaceService { + public final static Logger log = LoggerFactory.getLogger(NcInterfaceServiceImpl.class); +// @Resource +// private TestMapper testMapper; + @Resource + private IUserService userService; + @Override + public void queryNccBasicArchives(JSONObject req) { + JSONObject jsonStrObj = req.getJSONObject("jsonStr"); + //基础档案类型 + String type = jsonStrObj.getString("type"); + //查询的参数 + JSONObject queryParameters = jsonStrObj.getJSONObject("queryParameters"); + switch (type) { + case "1": + //供应商视图 + String view_name = "v_hzya_nc_supplier"; + //验证参数是否存在视图内 + checkingParametersKeyEffective(view_name, queryParameters); + break; + case "2": + break; + case "3": + break; + default: + throw new BaseSystemException("未匹配到档案类型!请确认档案类型 1、客户2、供应商3、人员、4项目"); + } + + + } + + /**** + * 根据视图名称,验证查询前参数是否有效 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-08 16:20 + * @param + * @return void + **/ + private void checkingParametersKeyEffective(String view_name, JSONObject queryParameters) { + //查询视图所有列 + List viewFields = new ArrayList<>(); + StringBuffer buffer = new StringBuffer(); + + for (String key : queryParameters.keySet()) { + boolean flag = viewFields.contains(key); + //不包含key的时候,说明查询参数在视图内不存在,需要抛出去异常 + if (!flag) { + buffer.append("参数code:" + key + "在视图内不存在!请检查后在传递查询。\n"); + } + } + if (buffer.length() > 1) { + throw new BaseSystemException(buffer.toString()); + } + } + + +// @Override +// public JsonResultEntity updateUser(JSONObject jsonObject) { +// +// NcInterface s2 = JSON.parseObject(jsonObject.getString("jsonStr"),NcInterface.class); +// //System.out.println(JSON.toJSONString(s2)); +// userService.updateEntity(jsonObject); +//// int as = 1/0; +// JsonResultEntity jsonResultEntity = new JsonResultEntity(); +// +// +// jsonResultEntity.setFlag(true); +//// throw new RuntimeException("系统异常"); +// return jsonResultEntity; +// } + + @Override +// @DS("dataSource1") + public int updateUser1(JSONObject jsonObject) { +// List whereList = new ArrayList<>(); +// WhereCriterion loginCondition = new WhereCriterion("", "login_name", ConditionType.等于.getValue(), "admin", "", ConnectType.AND); +// whereList.add(loginCondition); +// List modifyExamples = new ArrayList<>(); +// ModifyCriterion modifyCriterion = new ModifyCriterion(); +// modifyCriterion.setFiledName("view_name"); +// modifyCriterion.setFiledValue("超级管理员1"); +// modifyCriterion.setStringValue(true); +// modifyExamples.add(modifyCriterion); + + SqlSessionFactory s = ApplicationContextUtil.getBeanByClass(SqlSessionFactory.class); + if (s == null) { + s = (SqlSessionFactory) ApplicationContextUtil.getBeanByName("mySqlSessionFactory"); + } + + Integer result = s.openSession().update("com.hzya.frame.nc.entity.NcInterface.test_update_user"); +// Integer result = baseDaoUtilImpl.update("sys_user",modifyExamples,whereList); + log.info("ya251修改人员结果:" + result); + return result; + } + + @Override +// @DS("dataSource2") + public int updateUser2(JSONObject jsonObject) { +// List whereList = new ArrayList<>(); +// WhereCriterion loginCondition = new WhereCriterion("", "login_name", ConditionType.等于.getValue(), "admin", "", ConnectType.AND); +// whereList.add(loginCondition); +// List modifyExamples = new ArrayList<>(); +// ModifyCriterion modifyCriterion = new ModifyCriterion(); +// modifyCriterion.setFiledName("view_name"); +// modifyCriterion.setFiledValue("超级管理员3"); +// modifyCriterion.setStringValue(true); +// modifyExamples.add(modifyCriterion); +// DataSourceUtil.getDefaultSqlSession() + SqlSessionFactory s = ApplicationContextUtil.getBeanByClass(SqlSessionFactory.class); + Integer result = s.openSession().update("test_update_user"); +// Integer result = baseDaoUtilImpl.update("sys_user",modifyExamples,whereList); + log.info("ya237修改人员结果:" + result); + return result; + } + +} diff --git a/service/src/main/java/com/hzya/frame/ncc/v202005/service/INccV202005Service.java b/service/src/main/java/com/hzya/frame/ncc/v202005/service/INccV202005Service.java new file mode 100644 index 00000000..7b5890b8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ncc/v202005/service/INccV202005Service.java @@ -0,0 +1,35 @@ +package com.hzya.frame.ncc.v202005.service; + + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface INccV202005Service { + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询列表 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity thirdInterfaceGetToken(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取ncc数据 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity getNccDataDetail(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取ncc数据 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity getNccData(JSONObject jsonObject); +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ncc/v202005/service/impl/NccV202005ServiceImpl.java b/service/src/main/java/com/hzya/frame/ncc/v202005/service/impl/NccV202005ServiceImpl.java new file mode 100644 index 00000000..4b96a09a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ncc/v202005/service/impl/NccV202005ServiceImpl.java @@ -0,0 +1,216 @@ +package com.hzya.frame.ncc.v202005.service.impl; + + +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.ncc.v202005.service.INccV202005Service; +import com.hzya.frame.util.oldNcc.Encryption; +import com.hzya.frame.util.oldNcc.SHA256Util; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.stereotype.Service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Map; + + +@Service(value="nccV202005Service") +public class NccV202005ServiceImpl implements INccV202005Service { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + + @Override + public JsonResultEntity thirdInterfaceGetToken(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + + String client_id = jsonObject.getString("client_id"); + String pubKey = jsonObject.getString("pubKey"); + String client_secret = jsonObject.getString("client_secret"); + String username = jsonObject.getString("username"); + String pwd = jsonObject.getString("pwd"); + String busi_center = jsonObject.getString("busi_center"); + String dsname = jsonObject.getString("dsname"); + String baseUrl = jsonObject.getString("baseUrl"); + Map paramMap = new HashMap(); + // 密码模式认证 + paramMap.put("grant_type", "password"); + // 第三方应用id + paramMap.put("client_id", client_id); + // 第三方应用secret 公钥加密 + try { + paramMap.put("client_secret", URLEncoder.encode(Encryption.pubEncrypt(pubKey, client_secret), "utf-8")); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("获取token失败"); + } + // ncc用户名 + paramMap.put("username", username); + // 密码 公钥加密 + try { + paramMap.put("password", URLEncoder.encode(Encryption.pubEncrypt(pubKey, pwd), "utf-8")); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("获取token失败"); + } + // 账套编码 + paramMap.put("biz_center", busi_center); + // 签名 + String sign = SHA256Util.getSHA256(client_id + client_secret + username + pwd + pubKey); + paramMap.put("signature", sign); + paramMap.put("dsname", dsname); + String url = baseUrl + "/nccloud/opm/accesstoken"; + String mediaType = "application/x-www-form-urlencoded"; + String token = doPost(url, paramMap, mediaType, null, ""); + //System.out.println("token:" + token); + if(JSONUtil.isTypeJSON(token)){ + JSONObject jsonObject1 = JSONObject.parseObject(token); + return BaseResult.getSuccessMessageEntity("获取token成功",jsonObject1); + }else { + return BaseResult.getSuccessMessageEntity("获取token成功",token); + } + } + + @Override + public JsonResultEntity getNccData(JSONObject object) { + String token = "{\"head\":{\"primal_money\":\"489.00\",\"bill_date\":\"2023-08-15 06:10:01\",\"pk_currtype\":\"1002Z0100000000001K1\",\"bill_type\":\"F4\",\"trade_type\":\"D4\",\"billmaker_date\":\"2023-08-15 06:10:01\",\"objecttype\":\"0\",\"source_flag\":\"2\",\"pk_org\":\"0001W310000000002WN9\"},\"body\":[{\"bill_date\":\"2023-08-15 06:10:01\",\"pk_customer\":\"1001W3100000000007PV\",\"pk_account\":\"1001W3100000000007RQ\",\"pk_recproject\":\"1001W3100000000007QR\",\"pk_currtype\":\"1002Z0100000000001K1\",\"bill_type\":\"F4\",\"trade_type\":\"D4\",\"creationtime\":\"2023-08-15 06:10:01\",\"objecttype\":\"0\",\"pk_org\":\"0001W310000000002WN9\",\"direction\":\"1\",\"rec_primal\":\"489.00\"}]}"; + JSONObject jsonObject1 = JSONObject.parseObject(token); + return BaseResult.getSuccessMessageEntity("获取数据成功",jsonObject1); + } + @Override + public JsonResultEntity getNccDataDetail(JSONObject object) { + String token = "{\"primal_money\":\"489.00\",\"bill_date\":\"2023-08-15 06:10:01\",\"pk_currtype\":\"1002Z0100000000001K1\",\"bill_type\":\"F4\",\"trade_type\":\"D4\",\"billmaker_date\":\"2023-08-15 06:10:01\",\"objecttype\":\"0\",\"source_flag\":\"2\",\"pk_org\":\"0001W310000000002WN9\",\"bill_date1\":\"2023-08-15 06:10:01\",\"pk_customer\":\"1001W3100000000007PV\",\"pk_account\":\"1001W3100000000007RQ\",\"pk_recproject\":\"1001W3100000000007QR\",\"pk_currtype1\":\"1002Z0100000000001K1\",\"bill_type1\":\"F4\",\"trade_type1\":\"D4\",\"creationtime\":\"2023-08-15 06:10:01\",\"objecttype1\":\"0\",\"pk_org1\":\"0001W310000000002WN9\",\"direction\":\"1\",\"rec_primal\":\"489.00\"}"; + JSONObject jsonObject1 = JSONObject.parseObject(token); + return BaseResult.getSuccessMessageEntity("获取数据成功",jsonObject1); + } + + /** + * 发送post请求 + * + * @param baseUrl + * @param paramMap + * @param mediaType + * @param headers + * @param json + * @return + */ + private String doPost(String baseUrl, Map paramMap, String mediaType, Map headers, String json) { + + HttpURLConnection urlConnection = null; + InputStream in = null; + OutputStream out = null; + BufferedReader bufferedReader = null; + String result = null; + try { + StringBuffer sb = new StringBuffer(); + sb.append(baseUrl); + if (paramMap != null) { + sb.append("?"); + for (Map.Entry entry : paramMap.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + sb.append(key + "=" + value).append("&"); + } + baseUrl = sb.toString().substring(0, sb.toString().length() - 1); + } + + URL urlObj = new URL(baseUrl); + urlConnection = (HttpURLConnection) urlObj.openConnection(); + urlConnection.setConnectTimeout(50000); + urlConnection.setRequestMethod("POST"); + urlConnection.setDoOutput(true); + urlConnection.setDoInput(true); + urlConnection.setUseCaches(false); + urlConnection.addRequestProperty("content-type", mediaType); + if (headers != null) { + for (String key : headers.keySet()) { + urlConnection.addRequestProperty(key, headers.get(key)); + } + } + out = urlConnection.getOutputStream(); + out.write(json.getBytes("utf-8")); + out.flush(); + int resCode = urlConnection.getResponseCode(); + if (resCode == HttpURLConnection.HTTP_OK || resCode == HttpURLConnection.HTTP_CREATED || resCode == HttpURLConnection.HTTP_ACCEPTED) { + in = urlConnection.getInputStream(); + } else { + in = urlConnection.getErrorStream(); + } + bufferedReader = new BufferedReader(new InputStreamReader(in, "utf-8")); + StringBuffer temp = new StringBuffer(); + String line = bufferedReader.readLine(); + while (line != null) { + temp.append(line).append("\r\n"); + line = bufferedReader.readLine(); + } + String ecod = urlConnection.getContentEncoding(); + if (ecod == null) { + ecod = Charset.forName("utf-8").name(); + } + result = new String(temp.toString().getBytes("utf-8"), ecod); + } catch (Exception e) { + //System.out.println(e); + } finally { + if (null != bufferedReader) { + try { + bufferedReader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != out) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != in) { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + urlConnection.disconnect(); + } + return result; + } + /** + * @Author lvleigang + * @Description 获取对象转换成jsonobj + * @Date 11:51 下午 2023/7/10 + * @param key + * @param object + * @return com.alibaba.fastjson.JSONObject + **/ + protected JSONObject getstrObj(String key, JSONObject object) { + if (checkStr(object.getString(key)) ) { + return object.getJSONObject(key); + } + return new JSONObject(); + } + + /** + * @param str + * @return void + * @Author lvleigang + * @Description 校验字符串 + * @Date 11:41 上午 2022/12/7 + **/ + protected Boolean checkStr(String str) { + Boolean flag = true; + if (str == null || "".equals(str)) { + flag = false; + } + return flag; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/ICtpAttachmentDao.java b/service/src/main/java/com/hzya/frame/seeyon/dao/ICtpAttachmentDao.java new file mode 100644 index 00000000..73ae2711 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/ICtpAttachmentDao.java @@ -0,0 +1,21 @@ +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.CtpAttachmentEntity; + +import java.util.List; + +public interface ICtpAttachmentDao extends IBaseDao { + //更新数据 + @DS("ht_oa_sqlserver") + int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity); + + //根据fiel_url查询附件业务记录,如果存在则更新,如果不存在则新增 + @DS("ht_oa_sqlserver") + List queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity); + + //新增 + @DS("ht_oa_sqlserver") + CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity); +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonDao.java b/service/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonDao.java new file mode 100644 index 00000000..02d6888a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonDao.java @@ -0,0 +1,108 @@ +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.SeeyonEntity; + +import java.util.List; + +/** + * com.hzya.frame.seeyon.dao + * + * @author yqh + * @date 2023-08 -30 10:43 + */ + +public interface ISeeYonDao extends IBaseDao { + /*** + * @Content:通过类型获取OA基本档案数据 + * @Author 👻👻👻👻yqh👻👻👻👻 + * @Date 2023年8月30日11:33:17 + * @Param seeyon + * @return + **/ + @DS("ht_oa_sqlserver") + List selectOAListByTypeformson_0324(SeeyonEntity seeyon); + @DS("ht_oa_sqlserver") + List selectOAListByTypeformson_0352(SeeyonEntity seeyon); + @DS("ht_oa_sqlserver") + List selectOAListByTypeMain(SeeyonEntity seeyon); + /** + * 通过关联关系获取附件主键 + * @param seeyonEntity + * @return + */ + @DS("ht_oa_sqlserver") + List selectFileUrl(SeeyonEntity seeyonEntity); +/*** + * @Content:修改数据状态,避免重复抓取 + * @Author 👻👻👻👻yqh👻👻👻👻 + * @Date + * @Param + * @return + **/ + int updateFormStete(SeeyonEntity s); + + /** + * + * @content 查询付款单中得电子回单 + * @Param + * @Return + * @Author hecan + * @Date 2023/11/9 14:23 + * **/ + @DS("ht_oa_sqlserver") + List selectOAListByTypeformmain_0327(SeeyonEntity seeyon); + @DS("ht_oa_sqlserver") + int updateFormformmain_0327(SeeyonEntity seeyon); + + /** + * + * @content 根据付款方id查询付款名 + * @Param + * @Return + * @Author hecan + * @Date 2023/11/9 14:23 + * **/ + @DS("ht_oa_sqlserver") + List selectOAListByField0258(SeeyonEntity seeyon); + + /** + * + * @content 查询速网U8C中的所有组织 + * @Param + * @Return + * @Author hecan + * @Date 2023/11/13 11:56 + * **/ + @DS("sowow_sqlserver_test") + List selectOAListByCorp(SeeyonEntity seeyon); + + /** + * + * @content 修改OA中的字段为速网U8C销售订单主键 + * @Param + * @Return + * @Author hecan + * @Date 2023/11/15 11:28 + * **/ + @DS("swoa_mysql") + int updateFormformmain_0237(SeeyonEntity seeyonEntity); + @DS("swoa_mysql") + int updateFormformson_0238(SeeyonEntity seeyonEntity); + //根据销售订单编码查询档案主键 + @DS("swoa_mysql") + SeeyonEntity selectOAListByformmain_0237(SeeyonEntity seeyonEntity); + + /** + * + * @content 修改付款单报销单等单据的推送状态 + * @Param + * @Return + * @Author hecan + * @Date 2023/12/20 8:59 + * **/ + @DS("ht_oa_sqlserver") + int updatepush(SeeyonEntity seeyon); + +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonInterFaceDao.java b/service/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonInterFaceDao.java new file mode 100644 index 00000000..2edbc648 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonInterFaceDao.java @@ -0,0 +1,37 @@ +package com.hzya.frame.seeyon.dao; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.seeyon.entity.SeeYonInterFaceEntity; + +import java.util.List; +import java.util.Map; + +/** + * @author 👻👻👻👻👻👻👻👻👻👻 gjh + * @version 1.0 + * @content + * @date 2023-08-30 10:27 + */ +public interface ISeeYonInterFaceDao { + /*** + * 查询OA档案数据,暂时只根据ID查询,只返回ID集合,此方法暂时用于更新无流程表单判断 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-30 10:54 + * @param + * @return java.util.List + **/ + List queryArchives(SeeYonInterFaceEntity seeYonInterFaceEntity); + + /*** + * 答应我写注释好吗 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2024-01-18 16:01 + * @param jsonObject 根据模版ID获取数据 + * @return java.util.List + **/ + List queryDefinitionInfo(SeeYonInterFaceEntity jsonObject); + List> queryDefinitionData(SeeYonInterFaceEntity jsonObject); + +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/impl/CtpAttachmentDaoImpl.java b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/CtpAttachmentDaoImpl.java new file mode 100644 index 00000000..2d11fe25 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/CtpAttachmentDaoImpl.java @@ -0,0 +1,31 @@ +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.ICtpAttachmentDao; +import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository(value = "ctpAttachmentDaoImpl") +public class +CtpAttachmentDaoImpl extends MybatisGenericDao implements ICtpAttachmentDao { + @DS("ht_oa_sqlserver") + @Override + public int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) { + return super.update("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_update",ctpAttachmentEntity); + } + + @DS("ht_oa_sqlserver") + @Override + public List queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_list_base",ctpAttachmentEntity); + } + + @DS("ht_oa_sqlserver") + @Override + public CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) { + return super.save("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_insert",ctpAttachmentEntity); + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonDaoImpl.java b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonDaoImpl.java new file mode 100644 index 00000000..332ae7fc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonDaoImpl.java @@ -0,0 +1,94 @@ +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.ISeeYonDao; +import com.hzya.frame.seeyon.entity.SeeyonEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * com.hzya.frame.seeyon.dao.impl + * + * @author yqh + * @date 2023-08 -30 10:44 + */ +@DS("htsqlserver") +@Repository(value = "seeYonDaoImpl") +public class SeeYonDaoImpl extends MybatisGenericDao implements ISeeYonDao { + @DS("ht_oa_sqlserver") + @Override + public List selectOAListByTypeformson_0352(SeeyonEntity seeyon) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_formson_0352",seeyon); + } + @DS("ht_oa_sqlserver") + @Override + public List selectOAListByTypeformson_0324(SeeyonEntity seeyon) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_formson_0324",seeyon); + } + @DS("ht_oa_sqlserver") + @Override + public List selectOAListByTypeMain(SeeyonEntity seeyon) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_main",seeyon); + } + @DS("ht_oa_sqlserver") + @Override + public List selectFileUrl(SeeyonEntity seeyon) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_ctp_attachment",seeyon); + } + @DS("ht_oa_sqlserver") + @Override + public int updateFormStete(SeeyonEntity s) { + return super.update("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_update",s); + } + + @DS("ht_oa_sqlserver") + @Override + public List selectOAListByTypeformmain_0327(SeeyonEntity seeyon) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_formmain_0327",seeyon); + } + + @DS("ht_oa_sqlserver") + @Override + public int updateFormformmain_0327(SeeyonEntity seeyon) { + return super.update("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_update_formmain_0327",seeyon); + } + + @DS("ht_oa_sqlserver") + @Override + public List selectOAListByField0258(SeeyonEntity seeyon) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_field0258",seeyon); + } + + @DS("sowow_sqlserver_test") + @Override + public List selectOAListByCorp(SeeyonEntity seeyon) { + return (List) super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_corp",seeyon); + } + + @Override + @DS("swoa_mysql") + public int updateFormformmain_0237(SeeyonEntity seeyonEntity) { + return super.update("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_update_formmain_0237",seeyonEntity); + } + + @Override + @DS("swoa_mysql") + public int updateFormformson_0238(SeeyonEntity seeyonEntity) { + return super.update("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_update_formson_0238",seeyonEntity); + } + + @Override + @DS("swoa_mysql") + public SeeyonEntity selectOAListByformmain_0237(SeeyonEntity seeyonEntity) { + return (SeeyonEntity) super.selectOne("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_list_base_formmain_0237",seeyonEntity); + } + + @DS("ht_oa_sqlserver") + @Override + public int updatepush(SeeyonEntity seeyon) { + return super.update("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_update_push",seeyon); + } + +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonInterFaceDaoImpl.java b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonInterFaceDaoImpl.java new file mode 100644 index 00000000..4091f0be --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonInterFaceDaoImpl.java @@ -0,0 +1,43 @@ +package com.hzya.frame.seeyon.dao.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.seeyon.dao.ISeeYonInterFaceDao; +import com.hzya.frame.seeyon.entity.SeeYonInterFaceEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +/** + * @author 👻👻👻👻👻👻👻👻👻👻 gjh + * @version 1.0 + * @content + * @date 2023-08-30 10:27 + */ +@Repository(value = "seeYonInterFaceDao") +public class SeeYonInterFaceDaoImpl extends MybatisGenericDao implements ISeeYonInterFaceDao { + + + @Override + @DS("ht_oa_sqlserver") + public List queryArchives(SeeYonInterFaceEntity seeYonInterFaceEntity) { + List list = super.query("com.hzya.frame.seeyon.dao.impl.SeeYonInterFaceDaoImpl.queryArchives",seeYonInterFaceEntity); + return list; + } + + @Override + @DS("#seeYonInterFaceEntity.dataSourceCode") + public List queryDefinitionInfo(SeeYonInterFaceEntity seeYonInterFaceEntity) { + + return super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonInterFaceDaoImpl.queryDefinitionInfo",seeYonInterFaceEntity); + } + + @Override + @DS("#seeYonInterFaceEntity.dataSourceCode") + public List> queryDefinitionData(SeeYonInterFaceEntity seeYonInterFaceEntity) { + List> list = super.selectList("com.hzya.frame.seeyon.dao.impl.SeeYonInterFaceDaoImpl.queryDefinitionData",seeYonInterFaceEntity); + return list ; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/CfsLogEntity.java b/service/src/main/java/com/hzya/frame/seeyon/entity/CfsLogEntity.java new file mode 100644 index 00000000..31c22e17 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/CfsLogEntity.java @@ -0,0 +1,65 @@ +package com.hzya.frame.seeyon.entity; + +/** + * @Description 保存交行日志用 + * @Author xiangerlin + * @Date 2024/3/18 14:07 + **/ +public class CfsLogEntity { + + private String tab_name_ch;//中文表名 + private String tab_name_en;//英文表名 + private OAWorkflowEventDataEntity oaWorkflowEventDataEntity;//无流程表单数据 + + private String result;//交通银行返回的参数(解析后的) + public CfsLogEntity() { + + } + + /** + * + * @param tab_name_ch 中文表名 + * @param tab_name_en 英文表名 + * @param oaWorkflowEventDataEntity 无流程表单数据 + */ + public CfsLogEntity(String tab_name_ch, String tab_name_en, OAWorkflowEventDataEntity oaWorkflowEventDataEntity,String result) { + this.tab_name_ch = tab_name_ch; + this.tab_name_en = tab_name_en; + this.oaWorkflowEventDataEntity = oaWorkflowEventDataEntity; + this.result=result; + } + + public String getTab_name_ch() { + return tab_name_ch; + } + + public void setTab_name_ch(String tab_name_ch) { + this.tab_name_ch = tab_name_ch; + } + + public String getTab_name_en() { + return tab_name_en; + } + + public void setTab_name_en(String tab_name_en) { + this.tab_name_en = tab_name_en; + } + + + + public OAWorkflowEventDataEntity getOaWorkflowEventDataEntity() { + return oaWorkflowEventDataEntity; + } + + public void setOaWorkflowEventDataEntity(OAWorkflowEventDataEntity oaWorkflowEventDataEntity) { + this.oaWorkflowEventDataEntity = oaWorkflowEventDataEntity; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/CtpAttachmentEntity.java b/service/src/main/java/com/hzya/frame/seeyon/entity/CtpAttachmentEntity.java new file mode 100644 index 00000000..1b482263 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/CtpAttachmentEntity.java @@ -0,0 +1,124 @@ +package com.hzya.frame.seeyon.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.Date; + +/** + * + * @content OA附件业务表 + * @Param + * @Return + * @Author hecan + * @Date 2023/11/1 14:58 + * **/ +public class CtpAttachmentEntity extends BaseEntity { + private String id;//主键ID + private String sub_reference;//次数据ID此id为真正写在流程表单中的ID + private String category; //应用分类、 + private String type;//分类 + private String filename;//附件名称 + private String file_url;//附件链接 + private String mime_type;// + private Date createdate;//创建时间 + private String attachment_size;//附件大小 + private String sort;//序号 + private String att_reference;//流程表的ID(col_summary) + private String uuid; + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSub_reference() { + return sub_reference; + } + + public void setSub_reference(String sub_reference) { + this.sub_reference = sub_reference; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public String getFile_url() { + return file_url; + } + + public void setFile_url(String file_url) { + this.file_url = file_url; + } + + public String getMime_type() { + return mime_type; + } + + public void setMime_type(String mime_type) { + this.mime_type = mime_type; + } + + public Date getCreatedate() { + return createdate; + } + + public void setCreatedate(Date createdate) { + this.createdate = createdate; + } + + public String getAttachment_size() { + return attachment_size; + } + + public void setAttachment_size(String attachment_size) { + this.attachment_size = attachment_size; + } + + public String getSort() { + return sort; + } + + public void setSort(String sort) { + this.sort = sort; + } + + public String getAtt_reference() { + return att_reference; + } + + public void setAtt_reference(String att_reference) { + this.att_reference = att_reference; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/CtpAttachmentEntity.xml b/service/src/main/java/com/hzya/frame/seeyon/entity/CtpAttachmentEntity.xml new file mode 100644 index 00000000..f4747121 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/CtpAttachmentEntity.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + id, + sub_reference, + category, + type, + filename, + file_url, + mime_type, + createdate, + attachment_size, + sort, + att_reference + + + + + + + + + + insert into CTP_ATTACHMENT( + + id, + sub_reference, + category, + type, + filename, + file_url, + mime_type, + attachment_size, + sort, + att_reference, + createdate + + )values + ( + + #{id}, + #{sub_reference}, + #{category}, + #{type}, + #{filename}, + #{file_url}, + #{mime_type}, + #{attachment_size}, + #{sort}, + #{att_reference}, + #{createdate} + + ) + + + + + update CTP_ATTACHMENT set + + sub_reference = #{sub_reference}, + att_reference = #{att_reference} + + where file_url = #{file_url} + + + + diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/OAWorkflowEventDataEntity.java b/service/src/main/java/com/hzya/frame/seeyon/entity/OAWorkflowEventDataEntity.java new file mode 100644 index 00000000..421bd2fb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/OAWorkflowEventDataEntity.java @@ -0,0 +1,143 @@ +package com.hzya.frame.seeyon.entity; + + +import java.util.Map; + +/** + * @Content OA监听事件提供的表单内容 + * @Author 👻👻👻👻👻👻👻👻👻👻 gjh + * @Date 2020-12-24 8:38 + * @Version 1.0 + */ +public class OAWorkflowEventDataEntity { + private String id;//业务表单id + private String eventType;//流程类型 + /** 流程ID*/ + private String summaryId; + /** 节点ID*/ + private String affairId; + private String currentActivityId; + /** 表单表的FORM ID,用此字段标记是哪个流程*/ + private String formApp; + /****/ + private String formViewOperation; + private Object summaryObj; + private String deeCfgId; + private String currentNodeLast; + private Map businessData; + private Map extData; + private String businessDataStr; + + private String OnProcessFinished; + public String getSummaryId() { + return summaryId; + } + + public void setSummaryId(String summaryId) { + this.summaryId = summaryId; + } + + public String getAffairId() { + return affairId; + } + + public void setAffairId(String affairId) { + this.affairId = affairId; + } + + public String getCurrentActivityId() { + return currentActivityId; + } + + public void setCurrentActivityId(String currentActivityId) { + this.currentActivityId = currentActivityId; + } + + public String getFormApp() { + return formApp; + } + + public void setFormApp(String formApp) { + this.formApp = formApp; + } + + public String getFormViewOperation() { + return formViewOperation; + } + + public void setFormViewOperation(String formViewOperation) { + this.formViewOperation = formViewOperation; + } + + public Object getSummaryObj() { + return summaryObj; + } + + public void setSummaryObj(Object summaryObj) { + this.summaryObj = summaryObj; + } + + public String getDeeCfgId() { + return deeCfgId; + } + + public void setDeeCfgId(String deeCfgId) { + this.deeCfgId = deeCfgId; + } + + public String getCurrentNodeLast() { + return currentNodeLast; + } + + public void setCurrentNodeLast(String currentNodeLast) { + this.currentNodeLast = currentNodeLast; + } + + public Map getBusinessData() { + return businessData; + } + + public void setBusinessData(Map businessData) { + this.businessData = businessData; + } + + public Map getExtData() { + return extData; + } + + public void setExtData(Map extData) { + this.extData = extData; + } + + public String getBusinessDataStr() { + return businessDataStr; + } + + public void setBusinessDataStr(String businessDataStr) { + this.businessDataStr = businessDataStr; + } + + public String getOnProcessFinished() { + return OnProcessFinished; + } + + public void setOnProcessFinished(String onProcessFinished) { + OnProcessFinished = onProcessFinished; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/SeeYonInterFaceEntity.java b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeYonInterFaceEntity.java new file mode 100644 index 00000000..cf2ab11d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeYonInterFaceEntity.java @@ -0,0 +1,102 @@ +package com.hzya.frame.seeyon.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +/** + * @author 👻👻👻👻👻👻👻👻👻👻 gjh + * @version 1.0 + * @content + * @date 2023-08-30 10:38 + */ +public class SeeYonInterFaceEntity extends BaseEntity { + private String tabName; + //三方系统ID + private String tripartiteId; + //OA对应字段 + private String oaField; + //模板info + private String field_info; + //模版ID + private String formAppId; + //主表集合 + private List formMainIds; + //主表ID,用于查询明细数据 + private String formMainId; + //事件类型 + private String eventType; + //表单名称 + private String name; + public String getTabName() { + return tabName; + } + + public void setTabName(String tabName) { + this.tabName = tabName; + } + + public String getTripartiteId() { + return tripartiteId; + } + + public void setTripartiteId(String tripartiteId) { + this.tripartiteId = tripartiteId; + } + + public String getOaField() { + return oaField; + } + + public void setOaField(String oaField) { + this.oaField = oaField; + } + + public String getField_info() { + return field_info; + } + + public void setField_info(String field_info) { + this.field_info = field_info; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFormAppId() { + return formAppId; + } + + public void setFormAppId(String formAppId) { + this.formAppId = formAppId; + } + + public List getFormMainIds() { + return formMainIds; + } + + public void setFormMainIds(List formMainIds) { + this.formMainIds = formMainIds; + } + + public String getFormMainId() { + return formMainId; + } + + public void setFormMainId(String formMainId) { + this.formMainId = formMainId; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/SeeYonInterFaceEntity.xml b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeYonInterFaceEntity.xml new file mode 100644 index 00000000..4190704d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeYonInterFaceEntity.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + id as id + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.java b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.java new file mode 100644 index 00000000..773386d0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.java @@ -0,0 +1,684 @@ +package com.hzya.frame.seeyon.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +/** + * com.hzya.frame.seeyon.entity + * + * @author yqh + * @date 2023-08 -30 10:45 + */ + +public class SeeyonEntity extends BaseEntity { + private String field0026;//合同评审编号 + private String field0001;//关联合同 + private String field0003;//合同编号 + private String field0016;//创建日期 + private String field0002;//合同名称 + private String field0004;//入账公司 + private String field0005;//供应商 + private String field0006;//合同类型 + private String field0015;//合同签订日期 + private String field0009;//合同开始时间 + private String field0010;//合同结束时间 + private String field0012;//是否固定金额 + private String field0013;//合同总金额 + private String field0027;//是否重大合同 + private String field0008;//项目 + private String field0032;//合同附件 + private String field0033;//其他附件 + private String field0034;//业务板块一级 + private String field0035;//合同分类 + private String field0038;//开票信息查询 + private String field0039;//付款信息查询 + private String field0044;//合同数量 + private String field0047;//业务板块二级 + private String field0048;//内容概要与评审理由 + private String field0049;//是否多方 + private String field0050;//是否多项目 + private String field0054;//合同已付金额 + private String field0055;//发票已收金额 + private String field0056;//审批中付款金额 + private String field0057;//审批中已收发票金额 + private String field0017;//行号 + private String field0018;//标的物名称 + private String field0019;//标的物编码 + private String field0021;//规格型号 + private String field0022;//总数量 + private String field0023;//单价 + private String field0024;//不含税金额 + private String field0025;//含税金额 + private String field0036;//税率 + private String field0037;//税务编码 + private String field0040;//已开票数量 + private String field0041;//剩余数量 + private String field0042;//在途数量 + private String field0051;//标的物明细表项目 + private String field0052;//相对方 + private String field0053;//其他相关方名称 + private String tableName;//表名称 + private List formson_0324;//合同标的物明细(明细表1) + private List formson_0352;// 相对方(明细表2) + private String formmain_id;//主表ID + private String file_url;//附件ID + private String sub_reference;//附件管理关系 + private String filename;//附件名称 + private String attachment_size;//文件大小 + private String field0067;//状态 + private String field0066;//业务板块三级 + private String loginName;//登录名 + private String dduid;//钉钉id + + private String field0137;//付款账号 + private String field0264;//CFS电子回单 + private String summary_id;//col_summary表id + private String name;//姓名 + private String pk_corp;//公司主键 + private String field0120;//OA关联速网U8C主键的字段 + + private String field0121;//oa对接erp明细主键 + private String details_id;//销售订单明细id + private String da_id;//销售订单档案id + + private String pushField;//杭泰推送标识字段 + private String pushValue;//推送的值 + private String updateTime; + private String field0066Id; + private String field0047Id; + private String field0034Id; + private String field0103;//钉钉ID + + public String getField0103() { + return field0103; + } + + public void setField0103(String field0103) { + this.field0103 = field0103; + } + + public String getField0066Id() { + return field0066Id; + } + + public void setField0066Id(String field0066Id) { + this.field0066Id = field0066Id; + } + + public String getField0047Id() { + return field0047Id; + } + + public void setField0047Id(String field0047Id) { + this.field0047Id = field0047Id; + } + + public String getField0034Id() { + return field0034Id; + } + + public void setField0034Id(String field0034Id) { + this.field0034Id = field0034Id; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getPushField() { + return pushField; + } + + public void setPushField(String pushField) { + this.pushField = pushField; + } + + public String getPushValue() { + return pushValue; + } + + public void setPushValue(String pushValue) { + this.pushValue = pushValue; + } + + public String getDa_id() { + return da_id; + } + + public void setDa_id(String da_id) { + this.da_id = da_id; + } + + public String getDetails_id() { + return details_id; + } + + public void setDetails_id(String details_id) { + this.details_id = details_id; + } + + public String getField0121() { + return field0121; + } + + public void setField0121(String field0121) { + this.field0121 = field0121; + } + + public String getField0120() { + return field0120; + } + + public void setField0120(String field0120) { + this.field0120 = field0120; + } + + public String getPk_corp() { + return pk_corp; + } + + public void setPk_corp(String pk_corp) { + this.pk_corp = pk_corp; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getField0264() { + return field0264; + } + + public void setField0264(String field0264) { + this.field0264 = field0264; + } + + public String getSummary_id() { + return summary_id; + } + + public void setSummary_id(String summary_id) { + this.summary_id = summary_id; + } + + public String getField0137() { + return field0137; + } + + public void setField0137(String field0137) { + this.field0137 = field0137; + } + + public String getDduid() { + return dduid; + } + + public void setDduid(String dduid) { + this.dduid = dduid; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getField0067() { + return field0067; + } + + public void setField0067(String field0067) { + this.field0067 = field0067; + } + + public String getAttachment_size() { + return attachment_size; + } + + public void setAttachment_size(String attachment_size) { + this.attachment_size = attachment_size; + } + + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public String getSub_reference() { + return sub_reference; + } + + public void setSub_reference(String sub_reference) { + this.sub_reference = sub_reference; + } + + public String getFile_url() { + return file_url; + } + + public void setFile_url(String file_url) { + this.file_url = file_url; + } + + public String getFormmain_id() { + return formmain_id; + } + + public void setFormmain_id(String formmain_id) { + this.formmain_id = formmain_id; + } + + public List getFormson_0324() { + return formson_0324; + } + + public void setFormson_0324(List formson_0324) { + this.formson_0324 = formson_0324; + } + + public List getFormson_0352() { + return formson_0352; + } + + public void setFormson_0352(List formson_0352) { + this.formson_0352 = formson_0352; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getField0026() { + return field0026; + } + + public void setField0026(String field0026) { + this.field0026 = field0026; + } + + public String getField0001() { + return field0001; + } + + public void setField0001(String field0001) { + this.field0001 = field0001; + } + + public String getField0003() { + return field0003; + } + + public void setField0003(String field0003) { + this.field0003 = field0003; + } + + public String getField0016() { + return field0016; + } + + public void setField0016(String field0016) { + this.field0016 = field0016; + } + + public String getField0002() { + return field0002; + } + + public void setField0002(String field0002) { + this.field0002 = field0002; + } + + public String getField0004() { + return field0004; + } + + public void setField0004(String field0004) { + this.field0004 = field0004; + } + + public String getField0005() { + return field0005; + } + + public void setField0005(String field0005) { + this.field0005 = field0005; + } + + public String getField0006() { + return field0006; + } + + public void setField0006(String field0006) { + this.field0006 = field0006; + } + + public String getField0015() { + return field0015; + } + + public void setField0015(String field0015) { + this.field0015 = field0015; + } + + public String getField0009() { + return field0009; + } + + public void setField0009(String field0009) { + this.field0009 = field0009; + } + + public String getField0010() { + return field0010; + } + + public void setField0010(String field0010) { + this.field0010 = field0010; + } + + public String getField0012() { + return field0012; + } + + public void setField0012(String field0012) { + this.field0012 = field0012; + } + + public String getField0013() { + return field0013; + } + + public void setField0013(String field0013) { + this.field0013 = field0013; + } + + public String getField0027() { + return field0027; + } + + public void setField0027(String field0027) { + this.field0027 = field0027; + } + + public String getField0008() { + return field0008; + } + + public void setField0008(String field0008) { + this.field0008 = field0008; + } + + public String getField0032() { + return field0032; + } + + public void setField0032(String field0032) { + this.field0032 = field0032; + } + + public String getField0033() { + return field0033; + } + + public void setField0033(String field0033) { + this.field0033 = field0033; + } + + public String getField0034() { + return field0034; + } + + public void setField0034(String field0034) { + this.field0034 = field0034; + } + + public String getField0035() { + return field0035; + } + + public void setField0035(String field0035) { + this.field0035 = field0035; + } + + public String getField0038() { + return field0038; + } + + public void setField0038(String field0038) { + this.field0038 = field0038; + } + + public String getField0039() { + return field0039; + } + + public void setField0039(String field0039) { + this.field0039 = field0039; + } + + public String getField0044() { + return field0044; + } + + public void setField0044(String field0044) { + this.field0044 = field0044; + } + + public String getField0047() { + return field0047; + } + + public void setField0047(String field0047) { + this.field0047 = field0047; + } + + public String getField0048() { + return field0048; + } + + public void setField0048(String field0048) { + this.field0048 = field0048; + } + + public String getField0049() { + return field0049; + } + + public void setField0049(String field0049) { + this.field0049 = field0049; + } + + public String getField0050() { + return field0050; + } + + public void setField0050(String field0050) { + this.field0050 = field0050; + } + + public String getField0054() { + return field0054; + } + + public void setField0054(String field0054) { + this.field0054 = field0054; + } + + public String getField0055() { + return field0055; + } + + public void setField0055(String field0055) { + this.field0055 = field0055; + } + + public String getField0056() { + return field0056; + } + + public void setField0056(String field0056) { + this.field0056 = field0056; + } + + public String getField0057() { + return field0057; + } + + public void setField0057(String field0057) { + this.field0057 = field0057; + } + + public String getField0017() { + return field0017; + } + + public void setField0017(String field0017) { + this.field0017 = field0017; + } + + 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 getField0021() { + return field0021; + } + + public void setField0021(String field0021) { + this.field0021 = field0021; + } + + public String getField0022() { + return field0022; + } + + public void setField0022(String field0022) { + this.field0022 = field0022; + } + + public String getField0023() { + return field0023; + } + + public void setField0023(String field0023) { + this.field0023 = field0023; + } + + public String getField0024() { + return field0024; + } + + public void setField0024(String field0024) { + this.field0024 = field0024; + } + + public String getField0025() { + return field0025; + } + + public void setField0025(String field0025) { + this.field0025 = field0025; + } + + public String getField0036() { + return field0036; + } + + public void setField0036(String field0036) { + this.field0036 = field0036; + } + + public String getField0037() { + return field0037; + } + + public void setField0037(String field0037) { + this.field0037 = field0037; + } + + public String getField0040() { + return field0040; + } + + public void setField0040(String field0040) { + this.field0040 = field0040; + } + + public String getField0041() { + return field0041; + } + + public void setField0041(String field0041) { + this.field0041 = field0041; + } + + public String getField0042() { + return field0042; + } + + public void setField0042(String field0042) { + this.field0042 = field0042; + } + + public String getField0051() { + return field0051; + } + + public void setField0051(String field0051) { + this.field0051 = field0051; + } + + public String getField0052() { + return field0052; + } + + public void setField0052(String field0052) { + this.field0052 = field0052; + } + + public String getField0053() { + return field0053; + } + + public void setField0053(String field0053) { + this.field0053 = field0053; + } + + public String getField0066() { + return field0066; + } + + public void setField0066(String field0066) { + this.field0066 = field0066; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.xml b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.xml new file mode 100644 index 00000000..83714c7d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + + splitbank,bankaccno,name,code + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update formmain_0327 set field0264 = #{field0264} where id = #{id} + + + + + update formmain_0323 set field0067 = 'Y' + where id = #{id} + + + + + update formmain_0237 set field0120 = #{field0120} + where field0010 = #{field0010} + + + + + update formson_0238 set field0121 = #{field0121} + where field0012 = #{field0012} and formmain_id=#{formmain_id} + + + + + update ${tableName} set ${pushField} = #{pushValue} + where id=#{id} + + + diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/ICfsLogService.java b/service/src/main/java/com/hzya/frame/seeyon/service/ICfsLogService.java new file mode 100644 index 00000000..235d1840 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/ICfsLogService.java @@ -0,0 +1,20 @@ +package com.hzya.frame.seeyon.service; + +import com.hzya.frame.seeyon.entity.CfsLogEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * @Description oa单据推送交行日志 + * @Author xiangerlin + * @Date 2024/3/18 13:40 + **/ +public interface ICfsLogService { + + /** + * 保存日志 + * @param entity + * @return + */ + JsonResultEntity importCfsLog(CfsLogEntity entity); + +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/ISeeYonInterFace.java b/service/src/main/java/com/hzya/frame/seeyon/service/ISeeYonInterFace.java new file mode 100644 index 00000000..c98fabbd --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/ISeeYonInterFace.java @@ -0,0 +1,145 @@ +package com.hzya.frame.seeyon.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity; +import com.hzya.frame.seeyon.entity.SeeyonEntity; +import com.hzya.frame.seeyon.service.impl.CfsLogServiceImpl; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; + +import java.util.List; +import java.util.Map; + +/** + * 致远OA接口类 + * @author 👻👻👻👻👻👻👻👻👻👻 gjh + * @version 1.0 + * @content + * @date 2023-08-22 9:29 + */ +public interface ISeeYonInterFace { + + /*** + * 发起OA表单方法 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-22 9:31 + * @param requestData 请求json + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity thirdInterfaceSend(JSONObject requestData); + + /*** + * @Content:通过类型获取OA数据1 + * @Author 👻👻👻👻yqh👻👻👻👻 + * @Date2023年8月30日10:20:17seeYonPlugInInterfaceEntrance + * @Param requestData + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + + JsonResultEntity thirdInterfacegetOADataByType(JSONObject requestData); + + /*** + * @Content: 提供给OA的标准接口方法,包含参数 entity 为OA 的data信息, , eventType 为事件类型 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2020-12-24 10:36 + * @Param [entity, eventType] + * eventType: + * 发起前事件 onBeforeStart , + * 发起事件 onStart , + * 终止前事件 onBeforeStop , + * 终止事件 onStop, + * 撤销前事件 onBeforeCancel, + * 撤销事件 onCancel, + * 结束事件 onProcessFinished, + * 处理前事件 onBeforeFinishWorkitem, + * 处理事件 onFinishWorkitem, + * 回退前事件 onBeforeStepBack, + * 回退事件 onStepBack, + * 取回前事件 onBeforeTakeBack, + * 取回事件 onTakeBack, + * @return string + **/ + JsonResultEntity thirdInterfaceSeeYonPlugInInterfaceEntrance(JSONObject requestData); +// String seeYonPlugInInterfaceEntrance(OAWorkflowEventDataEntity entity,String eventType); + + /*** + * @Content:通过附件关系获取fileurl + * @Author 👻👻👻👻yqh👻👻👻👻 + * @Date 2023年9月4日13:03:35 + * @Param requestData + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + + /**** + * 客户服务器无法外网连接数据库,临时使用初始化方法 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-09-05 8:43 + * @param + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity thirdInterfaceInitBipSupplierToOa(JSONObject jsonObject) throws Exception; + List getFileUrl(String sub_reference); + /*** + * + * @content:推送无流程表单同步钉钉 + * @author 👻👻👻👻👻👻👻👻 yuqh + * @date 2023年9月2日12:56:18 + * @param + * @return void + **/ + JsonResultEntity sendConDocTodd(JSONObject requestJson); + /*** + * + * @content:流程表单传递钉钉 + * @author 👻👻👻👻👻👻👻👻 yuqh + * @date 2023年9月5日09:38:38 + * @param + * @return void + **/ + JsonResultEntity sendProcessDocument(JSONObject requestJson); + + /** + * + * @content 杭泰OA付款单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/12 15:50 + * **/ + + String sendpayMentToCFS(Map businessData); + + /** + * + * @content 杭泰OA报销单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 15:26 + * **/ + String sendBusinessExpenseToCFS(Map map,String formApp); + + /** + * + * @content 杭泰OA资金归集,资金拨付,同名账户划转,借款单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/12/20 10:04 + * **/ + String sendOtherFourReceipt(Map map,String formApp); + + + /*** + * 致远OA业务流程集成补推方法,需要传递参数 + * @param jsonObject formAppId 表单模版ID CAP_FORM_DEFINITION, formMainIds 集合 dataSourceCode 数据源编码 + * @return ht_oa_sqlserver + * @throws Exception + */ + JsonResultEntity thirdInterfaceSeeYonDefinitionRePush(JSONObject jsonObject) throws Exception; + + void setCfslogService(ICfsLogService cfsLogService); +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/impl/CfsLogServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/service/impl/CfsLogServiceImpl.java new file mode 100644 index 00000000..7cacaa50 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/impl/CfsLogServiceImpl.java @@ -0,0 +1,107 @@ +package com.hzya.frame.seeyon.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.seeyon.entity.CfsLogEntity; +import com.hzya.frame.seeyon.service.ICfsLogService; +import com.hzya.frame.seeyon.service.ISeeYonInterFace; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; + +/** + * @Description oa单据推送交行日志 + * @Author xiangerlin + * @Date 2024/3/18 13:40 + **/ +@Service +public class CfsLogServiceImpl implements ICfsLogService { + + + @Autowired + protected ISeeYonInterFace seeYonInterFace; + + @PostConstruct + public void init() { + seeYonInterFace.setCfslogService(this); + } + /** + * 保存日志 + * + * @param entity + * @return + */ + @Override + public JsonResultEntity importCfsLog(CfsLogEntity entity) { + JSONArray jsonArray = new JSONArray(); + JSONObject data = new JSONObject(); + data.put("tab_name_ch",entity.getTab_name_ch()); + data.put("tab_name_en",entity.getTab_name_en()); + data.put("bill_code",getCode(entity)); + data.put("form_app_id",entity.getOaWorkflowEventDataEntity().getFormApp()); + data.put("event_type","onProcessFinished"); + data.put("id",entity.getOaWorkflowEventDataEntity().getId()); + data.put("title","");//流程标题,这个字段暂时取不到 + data.put("result",entity.getResult());//返回的报文 + if (StrUtil.isNotEmpty(entity.getResult())){ + JSONObject resultObj = JSONObject.parseObject(entity.getResult()); + String statusMsg = resultObj.getString("statusMsg");//交行返回的状态 + String serialNo = resultObj.getString("serialNo");//交行返回的流水号 + data.put("status_msg",statusMsg); + data.put("serial_no",serialNo); + } + jsonArray.add(data); + JSONObject jsonStr = new JSONObject(); + jsonStr.put("type","archives"); + jsonStr.put("templateCode","formmain_0527"); + jsonStr.put("attribute",jsonArray); + //1、解析数据 + //2、保存日志 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("jsonStr",jsonStr); + JsonResultEntity jsonResultEntity = seeYonInterFace.thirdInterfaceSend(jsonObject); + return jsonResultEntity; + } + + private String getCode(CfsLogEntity entity){ + if (null != entity && null != entity.getOaWorkflowEventDataEntity()){ + String tableName = entity.getTab_name_en(); + String jsonStr = entity.getOaWorkflowEventDataEntity().getBusinessDataStr(); + JSONObject jsonObject = JSONObject.parseObject(jsonStr); + if (null != jsonObject){ + String bill_code=null; + switch (tableName){ + case "formmain_0307"://差旅报销单 + bill_code=jsonObject.getJSONObject("formmain_0307").getString("field0094"); + break; + case "formmain_0294"://招待费报销单 + bill_code=jsonObject.getJSONObject("formmain_0294").getString("field0053"); + break; + case "formmain_0314"://日常费用报销单 + bill_code=jsonObject.getJSONObject("formmain_0314").getString("field0220"); + break; + case "formmain_0362"://资金归集 + bill_code=jsonObject.getJSONObject("formmain_0362").getString("field0047"); + break; + case "formmain_0464"://资金拨付 + bill_code=jsonObject.getJSONObject("formmain_0464").getString("field0045"); + break; + case "formmain_0467"://同名账户划转 + bill_code=jsonObject.getJSONObject("formmain_0467").getString("field0045"); + break; + case "formmain_0293"://借款单(借还款) + bill_code=jsonObject.getJSONObject("formmain_0293").getString("field0056"); + break; + case "formmain_0327"://对公付款单 + bill_code = jsonObject.getJSONObject("formmain_0327").getString("field0146"); + } + return bill_code; + } + } + return null; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/impl/SeeYonInterFaceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/service/impl/SeeYonInterFaceImpl.java new file mode 100644 index 00000000..9811a360 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/impl/SeeYonInterFaceImpl.java @@ -0,0 +1,3709 @@ +package com.hzya.frame.seeyon.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.bip.v3.v2207.dps.service.IPayMentService; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.dd.IDDInterfaceService; +import com.hzya.frame.seeyon.dao.ISeeYonDao; +import com.hzya.frame.seeyon.dao.ISeeYonInterFaceDao; +import com.hzya.frame.seeyon.entity.CfsLogEntity; +import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity; +import com.hzya.frame.seeyon.entity.SeeYonInterFaceEntity; +import com.hzya.frame.seeyon.entity.SeeyonEntity; +import com.hzya.frame.seeyon.service.ICfsLogService; +import com.hzya.frame.seeyon.service.ISeeYonInterFace; +import com.hzya.frame.stringutil.StringUtil; +import com.hzya.frame.sys.service.IExcApiService; +import com.hzya.frame.u8c.Invmandoc.dao.IBdInvmandocDao; +import com.hzya.frame.u8c.Invmandoc.entity.BdInvmandocEntity; +import com.hzya.frame.u8c.Invmandoc.service.impl.BdInvmandocServiceImpl; + +import com.hzya.frame.u8c.bdCumandoc.dao.IBdCumandocDao; +import com.hzya.frame.u8c.bdCumandoc.entity.BdCumandocEntity; +import com.hzya.frame.u8c.bdcorp.entity.BdCorpEntity; +import com.hzya.frame.u8c.bdcorp.service.IBdCorpService; +import com.hzya.frame.u8c.util.U8cHttpUtil; +import com.hzya.frame.uuid.UUIDLong; +import com.hzya.frame.web.action.ApplicationContextUtil; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import com.hzya.frame.web.exception.BaseSystemException; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.checkerframework.checker.units.qual.K; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; + +/** + * @author 👻👻👻👻👻👻👻👻👻👻 gjh + * @version 1.0 + * @content + * @date 2023-08-22 9:30 + */ +@Service(value = "seeYonInterFace") +public class SeeYonInterFaceImpl implements ISeeYonInterFace { + private static final Logger logger = LoggerFactory.getLogger(SeeYonInterFaceImpl.class); + /*** rest 用户名*/ + private static final String RESTUSERNAME = "hzyaRest"; + /*** rest 密码*/ + private static final String RESTPASSWORD = "a5ce21b8-91db-4cec-b3e3-3e44719655fd"; + // TODO 此处URL暂时写死,后续根据传递的应用ID获取 + private static final String sendUrl = "http://60.204.152.210/seeyon/"; + //速网esb地址 + private static final String baseUrl = "http://hzya.ufyct.com:9067/kangarooDataCenter/entranceController/externalCallInterface"; + @Resource + private IExcApiService iExcApiService ; + + private ICfsLogService cfsLogService; + @Override + public void setCfslogService(ICfsLogService cfsLogService) { + this.cfsLogService = cfsLogService; + } + + /** + * 定义所支持的事件静态代码块 + */ + private static final StringBuffer eventTypeBuffer = new StringBuffer(); + + { + eventTypeBuffer.append("发起前事件 onBeforeStart ,"); + eventTypeBuffer.append("发起事件 onStart ,"); + eventTypeBuffer.append("终止前事件 onBeforeStop ,"); + eventTypeBuffer.append("终止事件 onStop,"); + eventTypeBuffer.append("撤销前事件 onBeforeCancel,"); + eventTypeBuffer.append("撤销事件 onCancel,"); + eventTypeBuffer.append("结束事件 onProcessFinished,"); + eventTypeBuffer.append("处理前事件 onBeforeFinishWorkitem,"); + eventTypeBuffer.append("处理事件 onFinishWorkitem,"); + eventTypeBuffer.append("回退前事件 onBeforeStepBack,"); + eventTypeBuffer.append("回退事件 onStepBack,"); + eventTypeBuffer.append("取回前事件 onBeforeTakeBack,"); + eventTypeBuffer.append("取回事件 onTakeBack,"); + } + + //基础档案类型 + private final String ARCHIVESTYPE = "archives"; + //流程表单类型 + private final String FLOWTYPE = "flow"; + //创建基础档案 + private final String CREATEARCHIVES = "create"; + //更新基础档案 + private final String UPDATEARCHIVES = "update"; + //创建基础档案 + private final String CREATEARCHIVESURL = "rest/form/import/"; + //创建基础档案 + private final String UPDATEARCHIVESURL = "rest/form/update"; + @Resource + private ISeeYonInterFaceDao seeYonInterFaceDao; + + @Resource + private IPayMentService payMentService; + + @Autowired + private ISeeYonDao seeYonDao; + @Autowired + private IBdInvmandocDao invmandocDao; + @Autowired + private IBdCorpService corpService; + @Autowired + private IBdCumandocDao bdCumandocDao; + /** + * 钉钉相关接口service + */ + @Resource + private IDDInterfaceService iddInterfaceService; + //上一次同步时间 + private String LAST_SYNCHRONISED_TIME = ""; + /**** + * @Content:发起无流程表单接口实现 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2019/12/23 17:03 + * @Param [templateCode 模版编码, sendLoginName 发送人登录帐号 ,xmlData ] + * @return java.lang.Integer + **/ + public static JsonResultEntity saveNoProcess(String templateCode , String interfaceUrl,String sendLoginName, String xmlData) { + String token = getToken(RESTUSERNAME, RESTPASSWORD, sendLoginName); + Map res = new HashMap(); + res.put("loginName", sendLoginName); + res.put("dataXml", xmlData); + res.put("token", token); + String result = HttpRequest.post(sendUrl + interfaceUrl + templateCode).header("token", token).body(JSON.toJSONString(res)).execute().body(); + logger.info("无流程表单执行结果:" + result); + return BaseResult.getFailureMessageEntity("执行成功", result); + } + + public static JsonResultEntity upDateNoProcess(String interfaceUrl, String templateCode, String sendLoginName, String moduleId, String xmlData) { + String token = getToken(RESTUSERNAME, RESTPASSWORD, sendLoginName); + Map res = new HashMap(); + res.put("loginName", sendLoginName); + res.put("dataXml", xmlData); + res.put("token", token); + res.put("moduleId", moduleId); + res.put("templateCode", templateCode); + logger.info("更新无流程表单参数:{}",JSON.toJSONString(res)); + String result = HttpRequest.put(sendUrl + interfaceUrl).header("token", token).body(JSON.toJSONString(res)).execute().body(); + logger.info("更新无流程表单执行结果:" + result); + return BaseResult.getFailureMessageEntity("执行成功", result); + } + + // { +// "moduleId":"5701605966502512923", +// "templateCode":"formmain_0360", +// "loginName":"seeyon", +// "dataXml":"<![CDATA[1438373948291346275]]><![CDATA[9218745623489128746]]><![CDATA[6897123456789123456]]><![CDATA[5729461284567891234]]>" +// } + private static String getToken(String userName, String password, String loginName) { + JSONObject jsonObject = new JSONObject(); + /** 获取token*/ + + jsonObject.put("userName", userName); + jsonObject.put("password", password); + jsonObject.put("loginName", loginName); + logger.info("请求获取token开始---------------------------------------------"); + logger.info("请求参数" + jsonObject.toJSONString()); + String result = HttpUtil.post(sendUrl + "rest/token", jsonObject.toJSONString()); + logger.info("获取token结果---------------------------------------------" + result); + logger.info("获取token结果---------------------------------------------" + result); + jsonObject = JSONObject.parseObject(result); + if ("".equals(result) || result == null) { + logger.info("获取token失败!"); + throw new RuntimeException("获取token失败!"); + } else { + String token = jsonObject.get("id").toString(); + return token; + } + } + + /*** + * 发起OA表单方法 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-22 9:32 + * @param + * @return com.hzya.frame.web.entity.BaseResult + **/ + @Override + public JsonResultEntity thirdInterfaceSend(JSONObject requestData) { + JSONObject jsonStr = requestData.getJSONObject("jsonStr"); + if (ObjectUtils.isEmpty(jsonStr)) { + throw new BaseSystemException("jsonStr为空!请传递参数"); + } + //类型 flow archives + String type = jsonStr.getString("type"); + if (StringUtils.isEmpty(type)) { + throw new BaseSystemException("请传递类型!type 流程表单:flow 基础档案:archives"); + } + //模版编号 + String templateCode = jsonStr.getString("templateCode"); + if (StringUtils.isEmpty(templateCode)) { + throw new BaseSystemException("请传入模版编号!templateCode不允许为空"); + } + JSONObject data = jsonStr.getJSONObject("data"); + String attributeArrayStr = jsonStr.getString("attribute"); + if (StringUtils.isEmpty(attributeArrayStr)) { + throw new BaseSystemException("attribute不允许为空"); + } + List attributeArray = JSON.parseArray(attributeArrayStr, JSONObject.class); + JsonResultEntity result = null; + if (ARCHIVESTYPE.equalsIgnoreCase(type)) { + switch (templateCode){ + //供应商 + case "formmain_0360": + for (JSONObject jsonObject : attributeArray) { + //根据ID获取OA档案是否有数据,如果有数据则调用更新接口 + String tripartiteId = jsonObject.getString("tripartiteId"); + //如果三方系统ID为空则直接发起OA的基础档案 + if (StringUtils.isEmpty(tripartiteId)) { + String dataXml = createTempData(jsonObject, CREATEARCHIVES); + String loginName = "seeyon"; + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + result = saveNoProcess( "formmain_0360", "rest/form/import/", loginName, dataXml); + logger.info("发起无流程表单结果:" + result); + } else { + SeeYonInterFaceEntity seeYonInterFaceEntity = new SeeYonInterFaceEntity(); + seeYonInterFaceEntity.setTripartiteId(tripartiteId); + seeYonInterFaceEntity.setTabName(templateCode); + seeYonInterFaceEntity.setOaField("field0012"); + List archives = seeYonInterFaceDao.queryArchives(seeYonInterFaceEntity); + //如果根据三方系统ID有查询到数据,则走更新 + if (null != archives && archives.size() > 0) { + String dataXml = createTempData(jsonObject, UPDATEARCHIVES); + String loginName = "seeyon"; + String moduleId = archives.get(0).getId(); + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + result = upDateNoProcess(UPDATEARCHIVESURL, "formmain_0360", loginName, moduleId, dataXml); + logger.info("更新无流程表单结果:" + result); + } else { + String dataXml = createTempData(jsonObject, CREATEARCHIVES); + String loginName = "seeyon"; + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + result = saveNoProcess( "formmain_0360","rest/form/import/", loginName, dataXml); + logger.info("发起无流程表单结果:" + result); + } + } + } + break; + //组织 + case "formmain_0380": + for (JSONObject jsonObject : attributeArray) { + //根据ID获取OA档案是否有数据,如果有数据则调用更新接口 + String tripartiteId = jsonObject.getString("tripartiteId"); + //如果三方系统ID为空则直接发起OA的基础档案 + if (StringUtils.isEmpty(tripartiteId)) { + String dataXml = createOrgTempData(jsonObject, CREATEARCHIVES); + String loginName = "seeyon"; + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + result = saveNoProcess( "formmain_0380", "rest/form/import/", loginName, dataXml); + logger.info("BIP组织发起无流程表单结果:" + result); + } else { + SeeYonInterFaceEntity seeYonInterFaceEntity = new SeeYonInterFaceEntity(); + seeYonInterFaceEntity.setTripartiteId(tripartiteId); + seeYonInterFaceEntity.setTabName(templateCode); + seeYonInterFaceEntity.setOaField("field0008"); + List archives = seeYonInterFaceDao.queryArchives(seeYonInterFaceEntity); + //如果根据三方系统ID有查询到数据,则走更新 + if (null != archives && archives.size() > 0) { + String dataXml = createOrgTempData(jsonObject, UPDATEARCHIVES); + String loginName = "seeyon"; + String moduleId = archives.get(0).getId(); + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + result = upDateNoProcess(UPDATEARCHIVESURL, "formmain_0380", loginName, moduleId, dataXml); + logger.info("BIP组织更新无流程表单结果:" + result); + } else { + String dataXml = createOrgTempData(jsonObject, CREATEARCHIVES); + String loginName = "seeyon"; + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + result = saveNoProcess( "formmain_0380","rest/form/import/", loginName, dataXml); + logger.info("BIP组织发起无流程表单结果:" + result); + } + } + } + break; + //保存交行cfs日志 + case "formmain_0527": + for (JSONObject jsonObject : attributeArray){ + String dataXml = createCfsTempData(jsonObject, CREATEARCHIVES); + String loginName = "seeyon"; + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + result = saveNoProcess( "formmain_0527","rest/form/import/", loginName, dataXml); + logger.info("BIP组织发起无流程表单结果:" + result); + } + break; + } + } + if (FLOWTYPE.equalsIgnoreCase(type)) { + } + return result; + } + + + @Override + public JsonResultEntity thirdInterfaceSeeYonPlugInInterfaceEntrance(JSONObject requestData){ + String jsonStr = requestData.getString("jsonStr"); + JSONObject jsonObject = requestData.getJSONObject("jsonStr"); + OAWorkflowEventDataEntity entity = JSON.parseObject(jsonStr,OAWorkflowEventDataEntity.class); + logger.info("监听OA事件入参:"+jsonObject.toJSONString()); + JSONObject formBeanData = jsonObject.getJSONObject("businessDataStr"); + String eventType = jsonObject.getString("eventType") ; + /** 流程ID*/ + String summaryId = entity.getSummaryId(); + /** 节点ID*/ + String affairId = entity.getAffairId(); + String currentActivityId = entity.getCurrentActivityId(); + /****/ + String formViewOperation = entity.getFormViewOperation(); + Object summaryObj = entity.getSummaryObj(); + String deeCfgId = entity.getDeeCfgId(); + String currentNodeLast = entity.getCurrentNodeLast(); + Map businessData = JSON.parseObject(entity.getBusinessDataStr(), Map.class); + Map extData = entity.getExtData(); + /** 表单表的FORM ID,用此字段标记是哪个流程*/ + String formApp = entity.getFormApp(); + + + + + String result = null; + /** 根据事件类型处理相关事件*/ + switch (eventType) { + /** 发起前事件*/ + case "onBeforeStart": + break; + /** 发起事件*/ + case "onStart": + break; + /** 终止前事件*/ + case "onBeforeStop": + break; + /** 终止事件*/ + case "onStop": + break; + /** 撤销前事件*/ + case "onBeforeCancel": + break; + /** 撤销事件*/ + case "onCancel": + break; + /** 结束事件*/ + case "onProcessFinished": + /** 根据form处理相关业务表单的数据*/ + switch (formApp) { + // todo 杭泰 + case "8829094357593836499": + //发起钉钉审批单据 + result = ddApproveFinish(businessData); + break; + //杭泰正式环境审批单 + case "9158638526010969190"://出差申请单 + //发起钉钉审批单据 + result = ddApproveFinish(formBeanData);//考勤 + logger.info("考勤返回数据"+result); + result = boundData(businessData,formApp);//流程结束归档钉钉 + logger.info("归档钉钉返回数据"+result); + break; + case "-1294748925451877119"://本地测试环境 + result = ddApproveFinish(businessData); + break; + case "-2680578642756943477"://对公付款单 + result = boundData(businessData,formApp); + logger.info("对公付款单返回数据:{}",result); + result = sendpayMentToCFS(businessData); + logger.info("对公付款单传递CFS返回数据:{}",result); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("对公付款单","formmain_0327",entity,result)); + break; + case "-8072984621869285290"://开票申请 + result = boundData(businessData,formApp); + break; + case "-321958445006631163"://差旅费报销单 + result = boundData(businessData,formApp); + logger.info("差旅费报销单返回数据:{}",result); + result=sendBusinessExpenseToCFS(businessData, formApp); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("差旅报销单","formmain_0307",entity,result)); + break; + case "-4485599744122928342"://招待费报销单 + result = boundData(businessData,formApp); + logger.info("招待费报销单返回数据:{}",result); + result=sendBusinessExpenseToCFS(businessData, formApp); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("招待费报销单","formmain_0294",entity,result)); + break; + case "4728403652378707515"://日常费用报销单 + result = boundData(businessData,formApp); + logger.info("日常费用报销单返回数据:{}",result); + result=sendBusinessExpenseToCFS(businessData, formApp); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("日常费用报销单","formmain_0314",entity,result)); + break; + case "910366613209564645"://资金归集 + result=sendOtherFourReceipt(businessData,formApp); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("资金归集","formmain_0362",entity,result)); + break; + case "-102527561419044497"://资金拨付 + result=sendOtherFourReceipt(businessData,formApp); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("资金拨付","formmain_0464",entity,result)); + break; + case "-1193625514072190978"://同名账户划转 + result=sendOtherFourReceipt(businessData,formApp); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("同名账户划转","formmain_0467",entity,result)); + break; + case "4645133897573090505"://借款单(借还款) + result=sendOtherFourReceipt(businessData,formApp); + //保存日志 + cfsLogService.importCfsLog(new CfsLogEntity("借款单(借还款)","formmain_0293",entity,result)); + break; + //todo 速网 + case "9052446288734537446"://速网存货档案 + result=boundDataSW(businessData,formApp); + break; + case "-7835496631017455043"://速网客商档案 + result=boundDataSW(businessData,formApp); + break; + case "-4417416588206651590"://速网销售订单 + result=boundDataSW(businessData,formApp); + break; + case "7910359204154002618"://速网采购订单 + result = boundDataSW(businessData,formApp); + break; + case "852319851043310560"://采购付款单 + result = boundDataSW(businessData,formApp); + break; + case "-4882495686115769173"://出入库申请单 + result = boundDataSW(businessData,formApp); + break; + default: + return BaseResult.getFailureMessageEntity("未匹配到表单!当前formID:" + formApp, "", ""); + } + break; + /** 处理前事件*/ + case "onBeforeFinishWorkitem": + /** 根据form处理相关业务表单的数据*/ + switch (formApp) { + case "8829094357593836499": + //发起钉钉单据 + ddApproveFinish(businessData); + break; + default: + + return BaseResult.getFailureMessageEntity("未匹配到表单!当前formID:" + formApp, ""); + } + break; + /** 处理事件*/ + case "onFinishWorkitem": + break; + /** 回退前事件*/ + case "onBeforeStepBack": + break; + /** 回退事件*/ + case "onStepBack": + break; + /** 取回前事件*/ + case "onBeforeTakeBack": + break; + /** 取回事件*/ + case "onTakeBack": + break; + default: +// throw new RuntimeException("传入了非法事件类型!请参照:" + eventTypeBuffer.toString()); + return BaseResult.getFailureMessageEntity("传入了非法事件类型!请参照:" + eventTypeBuffer.toString(), "", ""); + } + return BaseResult.getSuccessMessageEntity("传递成功", result); + } + + + private String ddApproveFinish(JSONObject formBeanData) { + JSONObject forMainData = formBeanData.getJSONObject("formmain_0302"); + JSONObject finishData = new JSONObject(); + String to_time = forMainData.getString("field0038"); + String from_time = forMainData.getString("field0036"); + finishData.put("userid", forMainData.get("field0083")); + finishData.put("biz_type", "2"); + finishData.put("from_time", from_time); + finishData.put("to_time", to_time); + finishData.put("duration_unit", "day"); + finishData.put("tag_name", "出差"); + finishData.put("calculate_model", "1"); + finishData.put("approve_id", "approve_id"); + finishData.put("jump_url", "jump_url"); + JSONObject ddData = new JSONObject(); + ddData.put("code", "0002"); + ddData.put("data", finishData.toJSONString()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("jsonStr", ddData.toJSONString()); + return iddInterfaceService.senddd(jsonObject); + } + + /** + * 组装传递钉钉参数,通过表单ID区分杭泰 + * @param businessData + * @param formApp + * @return + */ + private String boundData(Map businessData, String formApp) { + String result = ""; + JSONObject finishData = new JSONObject(); + try { + switch (formApp){ + case "-2680578642756943477"://对公付款单 + finishData = boundDataPay(businessData,formApp); + break; + case "-8072984621869285290"://开票申请 + finishData = boundDataInv(businessData,formApp); + break; + case "9158638526010969190"://出差申请单 + finishData = boundDataBusinessTravel(businessData,formApp); + break; + case "-321958445006631163"://差旅费报销单 + finishData = boundDataTravelExpense(businessData,formApp); + break; + case "-4485599744122928342"://招待费报销单 + finishData = boundDataEntertain(businessData,formApp); + break; + case "4728403652378707515"://日常费用报销单 + finishData = boundDatacurrentExpense(businessData,formApp); + break; + default: + break; + } + } catch (Exception e) { + e.printStackTrace(); + return e.getMessage(); + } + JSONObject jsonObject = new JSONObject(); + JSONObject data = new JSONObject(); + data.put("data",finishData); + data.put("code","0003"); + jsonObject.put("jsonStr",data); + + return iddInterfaceService.senddd(jsonObject); + } + /** + * 组装传递钉钉参数,通过表单ID区分杭泰 + * @param businessData + * @param formApp + * @return + */ + private String boundDataSW(Map businessData, String formApp) { + String result = ""; + try { + switch (formApp){ + case "-7835496631017455043"://客商档案-速网 + result = boundSWcustDoc(businessData,formApp); + break; + case "9052446288734537446"://存货档案-速网 + result = boundSWinvDoc(businessData,formApp); + break; + case "-4417416588206651590"://销售订单-速网 + result = boundSWSaleOrder(businessData,formApp); + break; + case "7910359204154002618"://采购订单-速网 + result = boundSWPUOrder(businessData,formApp); + break; + case "852319851043310560"://采购付款单-速网 + result = boundSWPUPy(businessData,formApp); + break; + case "-4882495686115769173"://出入库申请单 + result = boundSWWarehouse(businessData,formApp); + break; + + default: + break; + } + } catch (Exception e) { + e.printStackTrace(); + return e.getMessage(); + } + return result; + } + /*** + * @Content:出入库申请单 + * @Author 👻👻👻👻yqh👻👻👻👻 + * @Date 2023年11月22日13:51:47 + * @Param + * @return + **/ + private String boundSWWarehouse(Map businessData, String formApp) { + JSONObject result = new JSONObject(); + Object mainObj = businessData.get("formmain_0218"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + String field0061 = businessDatamain.getString("field0061"); + //通过类型判断推送不同的单据 + switch (field0061){ + case "8474321469568075747"://盘点如果其他出库明细不为空 生成U8C其他出库单,如果其他入库明细不为空生成U8C其他入库单 + result = warehouseCheck(businessData); + break; + case "5763280962704524077"://(报废)需要先生成U8C从A仓库到B仓库的调拨单(仓库通过DEE选择) 再生成B仓库的其他出库单 + result = scrap(businessData); + break; + case "-4669957817622313882"://(调拨),就生成U8C A公司调拨到B公司的调拨单仓库在表体,自己选择 + result = allotOrder(businessData); + break; + default: + logger.info("未匹配单该单据类型,不予推送该出入库申请单"); + break; + } + return result.toString(); + } + + /** + * (报废)需要先生成U8C从A仓库到B仓库的调拨单(仓库通过DEE选择) 再生成B仓库的其他出库单 + * @param businessData + * @return + */ + private JSONObject scrap(Map businessData) { + JSONObject result = new JSONObject(); + Object mainObj = businessData.get("formmain_0218"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + Object formson_0236obj = businessData.get("formson_0236"); + + //调拨订单 + JSONArray formson_0236Arr = JSON.parseArray(JSON.toJSONString(formson_0236obj)); + for(Object obj : formson_0236Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + String invId = body.getString("field0110"); + if(StrUtil.isEmpty(invId)){ + logger.info("未加载到调拨订单数据"); + } + //第一 组装数据推送调拨订单 + result = bindAllotOrder(businessDatamain,body); + //第一 组装数据推送其他出库单,因接口公用存在,在此拼接公用参数 + businessDatamain.put("field0124",body.getString("field0148"));//公司 + body.put("field0101",body.getString("field0107"));//仓库 + body.put("field0154",body.getString("field0151"));//库存组织 + body.put("field0108",body.getString("field0110"));//存货 + body.put("field0126",body.getString("field0077"));//应出数量 + body.put("field0058",body.getString("field0077"));//实出数量 + body.put("field0172",body.getString("field0173"));//是否批次 + + result = otherOutWarehouse(businessDatamain,body); + } + return result; + } + + /*** + * @Content:调拨 + * @Author 👻👻👻👻yqh👻👻👻👻 + * @Date 2023年11月23日09:06:34 + * @Param + * @return + **/ + private JSONObject allotOrder(Map businessData) { + JSONObject result = new JSONObject(); + Object mainObj = businessData.get("formmain_0218"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + Object formson_0236obj = businessData.get("formson_0236"); + + //调拨订单 + JSONArray formson_0236Arr = JSON.parseArray(JSON.toJSONString(formson_0236obj)); + for(Object obj : formson_0236Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + String invId = body.getString("field0110"); + if(StrUtil.isEmpty(invId)){ + logger.info("未加载到调拨订单数据"); + } + //组装数据推送调拨订单 + result = bindAllotOrder(businessDatamain,body); + } + return result; + } + + /** + * 组装数据推送调拨订单 + * @param businessDatamain + * @param body + * @return + */ + private JSONObject bindAllotOrder(JSONObject businessDatamain, JSONObject body) { + JSONObject result = new JSONObject(); + JSONObject sendData = new JSONObject(); + JSONArray billvo = new JSONArray(); + sendData.put("billvo",billvo); + JSONObject main = new JSONObject(); + billvo.add(main); + JSONObject parentvo = new JSONObject(); + JSONArray childrenvo = new JSONArray(); + main.put("parentvo",parentvo); + parentvo.put("cbiztypeid",businessDatamain.getString("field0133"));//业务流程 + parentvo.put("coperatorid",businessDatamain.getString("field0136"));//制单人 + parentvo.put("dbilldate",businessDatamain.getString("field0003"));//单据日期 + + parentvo.put("cincorpid",body.getString("field0148"));//调入公司 + parentvo.put("cincbid",body.getString("field0151"));//调入组织 + parentvo.put("cinwhid",body.getString("field0107"));//调入仓库 + parentvo.put("coutcorpid",body.getString("field0142"));//调出公司 + parentvo.put("coutcbid",body.getString("field0145"));//调出组织 + parentvo.put("coutwhid",body.getString("field0105"));//调出仓库 + parentvo.put("coutcurrtype",body.getString("field0167"));//币种 +// parentvo.put("vbdef1",businessDatamain.getString("field0162"));//店铺 +// parentvo.put("vbdef2",businessDatamain.getString("field0165"));//平台 +// parentvo.put("vbdef3",businessDatamain.getString("field0096"));//品牌 +// parentvo.put("vbdef4",businessDatamain.getString("field0097"));//业务中心 +// parentvo.put("vbdef5",businessDatamain.getString("field0098"));//业务模式 +// parentvo.put("pk_defdoc1",businessDatamain.getString("field0160"));//店铺 +// parentvo.put("pk_defdoc2",businessDatamain.getString("field0163"));//平台 +// parentvo.put("pk_defdoc3",businessDatamain.getString("field0118"));//品牌 +// parentvo.put("pk_defdoc4",businessDatamain.getString("field0120"));//业务中心 +// parentvo.put("pk_defdoc5",businessDatamain.getString("field0122"));//业务模式 + + parentvo.put("vdef10",businessDatamain.getString("field0097"));//业务中心 + parentvo.put("vdef11",businessDatamain.getString("field0098"));//业务模式 + parentvo.put("vdef12",businessDatamain.getString("field0162"));//店铺 + parentvo.put("vdef13",businessDatamain.getString("field0096"));//品牌 + parentvo.put("vdef14",businessDatamain.getString("field0165"));//平台 + + parentvo.put("pk_defdoc10",businessDatamain.getString("field0120"));//业务中心 + parentvo.put("pk_defdoc11",businessDatamain.getString("field0122"));//业务模式 + parentvo.put("pk_defdoc12",businessDatamain.getString("field0160"));//店铺 + parentvo.put("pk_defdoc13",businessDatamain.getString("field0118"));//品牌 + parentvo.put("pk_defdoc14",businessDatamain.getString("field0163"));//平台 + main.put("childrenvo",childrenvo); + //组装明细数据 + JSONObject childrenvoObj = new JSONObject(); + childrenvoObj.put("cinvbasid",body.getString("field0072"));//存货ID + childrenvoObj.put("nnum",body.getString("field0077"));//数量 + childrenvoObj.put("nnotaxprice",body.getString("field0080"));//无税单价 + childrenvoObj.put("nprice",body.getString("field0082"));//含税单价 + childrenvoObj.put("nnotaxmny",body.getString("field0083"));//无税金额 + childrenvoObj.put("ntaxrate",body.getString("field0171"));//税率 + childrenvoObj.put("nmny",body.getString("field0170"));//含税金额 + childrenvo.add(childrenvoObj); + main.put("childrenvo",childrenvo); + String apiCode = "8000050005"; + logger.info("调拨订单请求参数:{}",sendData.toString()); + result = U8cHttpUtil.sendOATOU8CEsb(sendData.toString(),apiCode); + return result; + } + + /*** + * @Content:出入库申请单-盘点 + * @Author 👻👻👻👻yqh👻👻👻👻 + * @Date 2023年11月22日13:52:08 + * @Param + * @return + **/ + private JSONObject warehouseCheck(Map businessData) { + JSONObject result = new JSONObject(); + Object mainObj = businessData.get("formmain_0218"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + Object formson_0219obj = businessData.get("formson_0219"); + + //其他入库单 + Object formson_0235obj = businessData.get("formson_0235"); + JSONArray formson_0235Arr = JSON.parseArray(JSON.toJSONString(formson_0235obj)); + for(Object obj : formson_0235Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + String invId = body.getString("field0063"); + if(StrUtil.isEmpty(invId)){ + logger.info("未加载到其他出库单数据"); + } + //组装数据推送其他出入单信息 + result = otherInWarehouse(businessDatamain,body); + } + //其他出库单 + JSONArray formson_0219Arr = JSON.parseArray(JSON.toJSONString(formson_0219obj)); + if(null != formson_0219Arr && formson_0219Arr.size()>0){ + for(Object obj : formson_0219Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + String invId = body.getString("field0108"); + if(StrUtil.isEmpty(invId)){ + logger.info("未加载到其他出库单数据"); + } + //组装数据推送其他出库单信息 + result = otherOutWarehouse(businessDatamain,body); + } + } + + + return result; + } + + /** + * 组装数据推送其他入库单信息 + * @param businessDatamain + * @param body + * @return + */ + private JSONObject otherInWarehouse(JSONObject businessDatamain, JSONObject body) { + JSONObject result = new JSONObject(); + JSONObject sendData = new JSONObject(); + JSONArray GeneralBillVO_4A = new JSONArray(); + sendData.put("GeneralBillVO_4A",GeneralBillVO_4A); + JSONObject main = new JSONObject(); + GeneralBillVO_4A.add(main); + JSONObject parentvo = new JSONObject(); + JSONArray childrenvo = new JSONArray(); + main.put("parentvo",parentvo); + parentvo.put("pk_corp",businessDatamain.getString("field0124"));//公司 + parentvo.put("coperatorid",businessDatamain.getString("field0136"));//制单人 + parentvo.put("dbilldate",businessDatamain.getString("field0003"));//单据日期 + parentvo.put("cwarehouseid",body.getString("field0102"));//仓库 + parentvo.put("pk_calbody",body.getString("field0157"));//库存组织 + parentvo.put("cdispatcherid",businessDatamain.getString("field0128"));//收发类别 + parentvo.put("cdptid",businessDatamain.getString("field0139"));//部门 +// parentvo.put("cbizid ",businessDatamain.getString(""));//业务员 + parentvo.put("vnote",businessDatamain.getString("field0006"));//备注 + parentvo.put("vdef10",businessDatamain.getString("field0097"));//业务中心 + parentvo.put("vdef11",businessDatamain.getString("field0098"));//业务模式 + parentvo.put("vdef12",businessDatamain.getString("field0162"));//店铺 + parentvo.put("vdef13",businessDatamain.getString("field0096"));//品牌 + parentvo.put("vdef14",businessDatamain.getString("field0165"));//平台 + + parentvo.put("pk_defdoc10",businessDatamain.getString("field0120"));//业务中心 + parentvo.put("pk_defdoc11",businessDatamain.getString("field0122"));//业务模式 + parentvo.put("pk_defdoc12",businessDatamain.getString("field0160"));//店铺 + parentvo.put("pk_defdoc13",businessDatamain.getString("field0118"));//品牌 + parentvo.put("pk_defdoc14",businessDatamain.getString("field0163"));//平台 + main.put("childrenvo",childrenvo); + //组装明细数据 + JSONObject childrenvoObj = new JSONObject(); + childrenvoObj.put("bonroadflag","N");//是否在途 不知道干啥的 默认否 + childrenvoObj.put("cinventoryid",body.getString("field0109"));//存货ID + childrenvoObj.put("flargess","N");//是否赠品,文档未标注,默认否 + childrenvoObj.put("nshouldinnum",body.getString("field0125"));//应收数量 + childrenvoObj.put("ninnum",body.getString("field0069"));//实收数量 + childrenvo.add(childrenvoObj); + main.put("childrenvo",childrenvo); + String apiCode = ""; + String wholemanaflag = body.getString("field0166"); + //入库:根据是否批次管理进行判断 + // 1、如果有批次管理就传递保存签字状态,同时传递一个批次号到U8C 用OA制单日期 格式为yyyyMMdd + // 2、没有批次管理就传递签字状态 + if("Y".equals(wholemanaflag)){ + Date field0003 = businessDatamain.getDate("field0003"); + if(null != field0003){ + String vbatchcode = DateUtil.dateToString(field0003,"yyyyMMdd"); + childrenvoObj.put("vbatchcode",vbatchcode); + } + + } + apiCode = "8000050004";//其他入保存即签字 + logger.info("其他入库单请求数据:{}",sendData.toString()); + result = U8cHttpUtil.sendOATOU8CEsb(sendData.toString(),apiCode); + return result; + } + + /** + * 组装数据推送其他出库单信息 + * @param businessDatamain + * @param body + * @return + */ + private JSONObject otherOutWarehouse(JSONObject businessDatamain, JSONObject body) { + JSONObject result = new JSONObject(); + JSONObject sendData = new JSONObject(); + JSONArray GeneralBillVO_4I = new JSONArray(); + sendData.put("GeneralBillVO_4I",GeneralBillVO_4I); + JSONObject main = new JSONObject(); + GeneralBillVO_4I.add(main); + JSONObject parentvo = new JSONObject(); + JSONArray childrenvo = new JSONArray(); + main.put("parentvo",parentvo); + parentvo.put("pk_corp",businessDatamain.getString("field0124"));//公司 + parentvo.put("coperatorid",businessDatamain.getString("field0136"));//制单人 + parentvo.put("dbilldate",businessDatamain.getString("field0003"));//单据日期 + parentvo.put("cwarehouseid",body.getString("field0101"));//仓库 + parentvo.put("pk_calbody",body.getString("field0154"));//库存组织 + parentvo.put("cdispatcherid",businessDatamain.getString("field0131"));//收发类别 + parentvo.put("cdptid",businessDatamain.getString("field0139"));//部门 +// parentvo.put("cbizid ",businessDatamain.getString(""));//业务员 + parentvo.put("vdef10",businessDatamain.getString("field0097"));//业务中心 + parentvo.put("vdef11",businessDatamain.getString("field0098"));//业务模式 + parentvo.put("vdef12",businessDatamain.getString("field0162"));//店铺 + parentvo.put("vdef13",businessDatamain.getString("field0096"));//品牌 + parentvo.put("vdef14",businessDatamain.getString("field0165"));//平台 + + parentvo.put("pk_defdoc10",businessDatamain.getString("field0120"));//业务中心 + parentvo.put("pk_defdoc11",businessDatamain.getString("field0122"));//业务模式 + parentvo.put("pk_defdoc12",businessDatamain.getString("field0160"));//店铺 + parentvo.put("pk_defdoc13",businessDatamain.getString("field0118"));//品牌 + parentvo.put("pk_defdoc14",businessDatamain.getString("field0163"));//平台 + main.put("childrenvo",childrenvo); + //组装明细数据 + JSONObject childrenvoObj = new JSONObject(); + childrenvoObj.put("bonroadflag","N");//是否在途 不知道干啥的 默认否 + childrenvoObj.put("cinventoryid",body.getString("field0108"));//存货ID + childrenvoObj.put("flargess","N");//是否赠品,文档未标注,默认否 + childrenvoObj.put("nshouldoutnum",body.getString("field0126"));//应出数量 + String apiCode = ""; + //1、出入库逻辑 + // 出库:根据是否批次管理进行判断 + // 1、如果有批次 传保存状态 传递应发 实发不不传递 + // 2、没有批次,保存即签字状态 + String field0172 = body.getString("field0172"); + if("Y".equals(field0172)){ + apiCode = "8000050013"; + }else{ + apiCode = "8000050006"; + childrenvoObj.put("noutnum",body.getString("field0058"));//实出数量 + } +// childrenvoObj.put("noutnum","0");//实出数量 +// childrenvoObj.put("vbatchcode","20231123");//批次 + childrenvo.add(childrenvoObj); + main.put("childrenvo",childrenvo); + + logger.info("其他出库单请求数据:{}",sendData.toString()); + result = U8cHttpUtil.sendOATOU8CEsb(sendData.toString(),apiCode); + return result; + } + + /** + * 存货档案-速网 + * @param businessData + * @param formApp + * @return + */ + private String boundSWinvDoc(Map businessData, String formApp) { + StringBuffer resultB = new StringBuffer(); + Object mainObj = businessData.get("formmain_0231"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject custDoc = new JSONObject(); + JSONObject invbasdoc = new JSONObject(); + //组装主表数据 + JSONObject parentvo = new JSONObject(); + parentvo.put("pk_invcl",businessDatamain.getString("field0020"));//存货分类主键 + parentvo.put("invcode",businessDatamain.getString("field0005"));//存货编码 + parentvo.put("invname",businessDatamain.getString("field0006"));//存货名称 +// parentvo.put("def1",businessDatamain.getString("field0033"));//旺店通存货分类名称 + parentvo.put("def1",businessDatamain.getString("field0009"));//旺店通存货分类名称 +// parentvo.put("pk_defdoc1",businessDatamain.getString("field0009"));//旺店通存货分类名称 +// parentvo.put("def3",businessDatamain.getString("field0031"));//公司主键 + parentvo.put("def3",businessDatamain.getString("field0029"));//公司主键 +// parentvo.put("pk_defdoc3",businessDatamain.getString("field0029"));//公司名称 + parentvo.put("invmnecode",businessDatamain.getString("field0007"));//货品编码(spu) + parentvo.put("def5",businessDatamain.getString("field0028"));//物料对应客商 客商主键 + parentvo.put("pk_measdoc",businessDatamain.getString("field0022"));//主计量单位 +// parentvo.put("pk_taxitems","40040000000000000082");//税目 固定传13 + parentvo.put("pk_taxitems",businessDatamain.getString("field0026"));//税目 固定传13 + parentvo.put("def6",businessDatamain.getString("field0017"));//标准零售价 + + parentvo.put("invpinpai",businessDatamain.getString("field0035"));//品牌 + parentvo.put("invbarcode",businessDatamain.getString("field0060"));//条形码 + parentvo.put("graphid",businessDatamain.getString("field0061"));//品牌自带编码 + parentvo.put("def2",businessDatamain.getString("field0036"));//三级分类 + parentvo.put("def4",businessDatamain.getString("field0043"));//GIV + parentvo.put("def5",businessDatamain.getString("field0011"));//主供应商 + parentvo.put("def12",businessDatamain.getString("field0056"));//是否专供 + parentvo.put("def7",businessDatamain.getString("field0057"));//是否在售 + parentvo.put("def8",businessDatamain.getString("field0039"));//四级分类 + parentvo.put("invshortname",businessDatamain.getString("field0053"));//存货简称 + parentvo.put("invspec",businessDatamain.getString("field0044"));//单品规格 + parentvo.put("invtype",businessDatamain.getString("field0045"));//规格码 + parentvo.put("def9",businessDatamain.getString("field0059"));//箱规1 + parentvo.put("length",businessDatamain.getString("field0047"));//长[mm] + parentvo.put("height",businessDatamain.getString("field0048"));//高[mm] + parentvo.put("width",businessDatamain.getString("field0049"));//宽[mm] + parentvo.put("unitweight",businessDatamain.getString("field0050"));//单品净重[g] + parentvo.put("def10",businessDatamain.getString("field0051"));//产地 + parentvo.put("def11",businessDatamain.getString("field0058"));//是否进口 + + custDoc.put("parentvo",parentvo); + JSONArray childrenvo = new JSONArray(); + custDoc.put("childrenvo",childrenvo); + invbasdoc.put("invbasdoc",custDoc); + logger.info("存货档案请求参数:{}",invbasdoc); + JSONObject jsonObjectAttribute = U8cHttpUtil.sendOATOU8CEsb(invbasdoc.toString(), "8000050002"); + logger.info("存货档案新增即保存返回参数解析之后得到的attribute值为:{}",jsonObjectAttribute); + resultB.append("存货档案新增:"+jsonObjectAttribute); + String success = jsonObjectAttribute.getString("status"); + if("success".equals(success)){ + JSONArray jsonArray = jsonObjectAttribute.getJSONArray("data"); + if(jsonArray.size()>0 && null!=jsonArray){ + for (Object object : jsonArray) { + JSONObject body = JSON.parseObject(JSON.toJSONString(object)); + String parentvoResult = body.getString("parentvo"); + JSONObject jsonObjectParentvo = JSONObject.parseObject(parentvoResult); + String pkInvbasdoc = jsonObjectParentvo.getString("pk_invbasdoc"); + logger.info("获取到的存货档案主键为:{}",pkInvbasdoc); + JSONArray invbasdocvoArr = new JSONArray(); + //查询所有公司,给每个公司都进行分配 +// List seeyonEntities = seeYonDao.selectOAListByCorp(new SeeyonEntity()); +// if(seeyonEntities.size()>0 && seeyonEntities !=null){ +// for (SeeyonEntity seeyonEntity : seeyonEntities) { +// JSONObject custbasvo = new JSONObject(); +// +// } +// } + JSONObject custbasvo = new JSONObject(); + custbasvo.put("pk_corp","all");//公司 + custbasvo.put("pk_measdoc","all");//所有库存组织 + custbasvo.put("pk_invbasdoc",pkInvbasdoc.trim());//存货档案编码 + invbasdocvoArr.add(custbasvo); + JSONObject sendParm = new JSONObject(); + sendParm.put("invbasdocvo",invbasdocvoArr); + logger.info("存货档案分配请求参数:{}",sendParm.toString()); + JSONObject jsonObject = U8cHttpUtil.sendOATOU8CEsb(sendParm.toString(), "8000050008"); + logger.info("存货档案分配返回参数解析之后得到的attribute值为:{}",jsonObject); + return resultB.append("存货档案分配:"+jsonObject).toString(); + } + } + return resultB.toString(); + } + return resultB.toString(); + } + + /** + * 客商档案-速网 + * @param businessData + * @param formApp + * @return + */ + private String boundSWcustDoc(Map businessData, String formApp) { + StringBuffer resultB = new StringBuffer(); + String result = ""; + JSONObject sourceData = new JSONObject(); + Object mainObj = businessData.get("formmain_0229"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject custDoc = new JSONObject(); + //组装主表数据 + JSONObject parentvo = new JSONObject(); + parentvo.put("custcode",businessDatamain.getString("field0020"));//客商编号 +// parentvo.put("custcode","01.01.098");//客商编号 + parentvo.put("custname",businessDatamain.getString("field0008"));//客商名称 + parentvo.put("custprop","0");//客商类型 0 - 外部单位,1 - 内部核算单位,2 - 内部法人单位,3 - 内部渠道成员 + parentvo.put("pk_areacl",businessDatamain.getString("field0036"));//地区分类 主键 + parentvo.put("taxpayerid",businessDatamain.getString("field0023"));//纳税人登记号 + parentvo.put("custshortname",businessDatamain.getString("field0008"));//客商简称 + parentvo.put("phone1",businessDatamain.getString("field0012"));//联系人电话 + parentvo.put("linkman1",businessDatamain.getString("field0011"));//联系人 + + parentvo.put("def1",businessDatamain.getString("field0061"));//省 + parentvo.put("def2",businessDatamain.getString("field0062"));//市 + parentvo.put("def3",businessDatamain.getString("field0063"));//区 + parentvo.put("def4",businessDatamain.getString("field0047"));//详细地址 + parentvo.put("mobilephone1",businessDatamain.getString("field0053"));//固定电话 + parentvo.put("legalbody",businessDatamain.getString("field0052"));//法人 + parentvo.put("def6",businessDatamain.getString("field0054"));//批准日期 + parentvo.put("def7",businessDatamain.getString("field0055"));//生效日期 + String field0072 = businessDatamain.getString("field0072"); + //todo 2024年2月28日09:10:22客户安东辉提出,如果标记为长期客户,则默认失效时间为 + if(StrUtil.isNotEmpty(field0072) && "7747067566458293711".equals(field0072)){ + String def8 = "9999-12-31"; + parentvo.put("def8",def8);//失效日期 + }else{ + parentvo.put("def8",businessDatamain.getString("field0056"));//失效日期 + } + +// parentvo.put("def9",businessDatamain.getString("field0070"));//结算币种 + parentvo.put("def10",businessDatamain.getString("field0058"));//经济类型 + parentvo.put("def11",businessDatamain.getString("field0064"));//内部联系人 + parentvo.put("def5",businessDatamain.getString("field0060"));//注册日期 + custDoc.put("parentvo",parentvo); + JSONArray banks = new JSONArray(); + //OA银行信息存在与主表上面 ,如果银行账号不为空才设置 + if(businessDatamain.getString("field0010")!=null && !"".equals(businessDatamain.getString("field0010")) + && businessDatamain.getString("field0037")!=null && !"".equals(businessDatamain.getString("field0037"))){ + JSONObject sendBody = new JSONObject(); + sendBody.put("accname",businessDatamain.getString("field0037"));//银行名称 传编码 + sendBody.put("account",businessDatamain.getString("field0010"));//银行账户 + sendBody.put("pk_accbank",businessDatamain.getString("field0038"));//开户行 + sendBody.put("defflag","Y");//是否默认 + sendBody.put("pk_currtype","CNY");//币种 填写编码 + sendBody.put("status","2");//修改状态 1修改 2新增 3删除 + banks.add(sendBody); + } + custDoc.put("banks",banks); + sourceData.put("cbdocvo",custDoc); + logger.info("客商档案请求参数:{}",sourceData); + JSONObject jsonObjectAttribute = U8cHttpUtil.sendOATOU8CEsb(sourceData.toString(), "8000050003"); + logger.info("客商档案新增即保存返回参数解析之后得到的attribute值为:{}",jsonObjectAttribute); + resultB.append("客商档案新增:"+jsonObjectAttribute); + String success = jsonObjectAttribute.getString("status"); + //传递成功之后进行分配,反之直接返回错误信息 + if ("success".equals(success)) { + JSONArray jsonArray = jsonObjectAttribute.getJSONArray("data"); + if (jsonArray.size() > 0 && null != jsonArray) { + for (Object object : jsonArray) { + JSONObject body = JSON.parseObject(JSON.toJSONString(object)); + String parentvoResult = body.getString("parentvo"); + JSONObject jsonObjectParentvo = JSONObject.parseObject(parentvoResult); + String pkCubasdoc = jsonObjectParentvo.getString("pk_cubasdoc"); + logger.info("获取到的客商档案主键为:{}", pkCubasdoc); + JSONArray custbasvoArr = new JSONArray(); + //查询所有公司,给每个公司都进行分配 + List seeyonEntities = seeYonDao.selectOAListByCorp(new SeeyonEntity()); + if (seeyonEntities.size() > 0 && seeyonEntities != null) { + for (SeeyonEntity seeyonEntity : seeyonEntities) { + JSONObject custbasvo = new JSONObject(); + //判断OA客商类型决定分配类型到组织 客商类型 -943875574826447587 客户 -516832932909398145 供应商 5622861136659237947 客商 + //如果未成功匹配,就只暂时不处理,让让接口报错(正常来说不存在匹配不到的情况)除非OA非必填 + String custprop = ""; + String custType = businessDatamain.getString("field0021"); + if(StrUtil.isNotEmpty(custType)){ + if("-943875574826447587".equals(custType)){ + custprop = "0"; + } + if("-516832932909398145".equals(custType)){ + custprop = "1"; + } + if("5622861136659237947".equals(custType)){ + custprop = "2"; + } + } + custbasvo.put("custprop",custprop);//客商属性 0:客户,1:供应商,2:客商 + custbasvo.put("pk_corp", seeyonEntity.getPk_corp().trim());//公司 + custbasvo.put("pk_cubasdoc", pkCubasdoc.trim());//客商基本档案主键 + custbasvoArr.add(custbasvo); + } + } + JSONObject sendParm = new JSONObject(); + sendParm.put("custbasvo", custbasvoArr); + logger.info("客商档案分配请求参数:{}", sendParm); + JSONObject jsonObject = U8cHttpUtil.sendOATOU8CEsb(sendParm.toString(), "8000050007"); + logger.info("客商档案分配返回参数解析之后得到的attribute值为:{}",jsonObject); + return resultB.append("客商档案分配:"+result).toString(); + } + } + } + return resultB.toString(); + } + + /** + * 采购付款单-速网 + * @param businessData + * @param formApp + * @return + */ + private String boundSWPUPy(Map businessData, String formApp)throws Exception { + JSONObject result = new JSONObject(); + JSONObject data = new JSONObject(); + JSONObject sourceData = new JSONObject(); + Object mainObj = businessData.get("formmain_0209"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject puPay = new JSONObject(); +// String dateStr = businessDatamain.getString("field0023"); + String dateStr = businessDatamain.getString("field0002"); + Date billDate = DateUtil.stringToDate(dateStr,"yyyy-MM-dd"); + String date = DateUtil.dateToString(billDate,"yyyy-MM-dd"); + //组装主表数据 + JSONObject parentvo = new JSONObject(); + parentvo.put("lrr",businessDatamain.getString("field0137"));//录入人 + parentvo.put("djlxbm","D3");//单据类型编码 field0101 + parentvo.put("dwbm",businessDatamain.getString("field0153"));//单位编码 + parentvo.put("djrq",date);//业务单据日期 + parentvo.put("shrq",date);//审核日期 + parentvo.put("deptid",businessDatamain.getString("field0161"));//部门 + + parentvo.put("shr",businessDatamain.getString("field0137"));//审核人 + parentvo.put("qrr",businessDatamain.getString("field0137"));//签字确认人 + parentvo.put("ybje",businessDatamain.getString("field0019"));//原币金额 + parentvo.put("bbje",businessDatamain.getString("field0019"));//本币金额 + parentvo.put("pj_jsfs",businessDatamain.getString("field0155"));// 结算方式 + //自定义项名称 + parentvo.put("zyx1",businessDatamain.getString("field0175"));//银行档案 + parentvo.put("zyx10",businessDatamain.getString("field0150"));//业务中心 + parentvo.put("zyx11",businessDatamain.getString("field0147"));//业务模式 + parentvo.put("zyx12",businessDatamain.getString("field0138"));//店铺 + parentvo.put("zyx13",businessDatamain.getString("field0144"));//品牌 + parentvo.put("zyx14",businessDatamain.getString("field0141"));//平台 + + + parentvo.put("zyx1",businessDatamain.getString("field0158"));// 银行 + parentvo.put("zyx2",businessDatamain.getString("field0165"));// R其他货币资金 + parentvo.put("hbbm",businessDatamain.getString("field0157"));//客商 + parentvo.put("prepay","N");//预收付款标志 如果是随订单预付款,必须打勾这个字段 默认Y + + puPay.put("parentvo",parentvo); + //报销信息明细表(明细表1) + Object formson_0210obj = businessData.get("formson_0210"); + JSONArray formson_0210Arr = JSON.parseArray(JSON.toJSONString(formson_0210obj)); + //formson_0224 + JSONArray childrenvo = new JSONArray(); + String orderBillCode = ""; + String xslxbm = ""; + for(Object obj : formson_0210Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject sendBody = new JSONObject(); + orderBillCode = body.getString("field0012");//采购订单号 + xslxbm = body.getString("field0164"); + sendBody.put("billdate",date);//单据日期 + sendBody.put("fx","1");//方向 + sendBody.put("ddh",orderBillCode);//订单号 + sendBody.put("jfbbje",body.getString("field0014"));//本币金额 + sendBody.put("jfybje",body.getString("field0014"));//原币金额 + + sendBody.put("hbbm",businessDatamain.getString("field0157"));//客商档案 +// sendBody.put("ddh",vordercode);//订单号 + childrenvo.add(sendBody); + } + parentvo.put("xslxbm",xslxbm);//销售订单业务流程 + parentvo.put("zyx15",orderBillCode);//采购订单号 + puPay.put("children",childrenvo); + JSONArray billvoArr = new JSONArray(); + billvoArr.add(puPay); + JSONObject billvo = new JSONObject(); + billvo.put("billvo",billvoArr); + logger.info("采购付款单请求参数:{}",billvo.toString()); + String apiCode = "8000050000"; + result = U8cHttpUtil.sendOATOU8CEsb(billvo.toString(),apiCode); + logger.info("采购付款单返回参数:{}",result.toString()); + return result.toString(); + } + + /** + * 采购订单-速网 + * @param businessData + * @param formApp + * @return + */ + private String boundSWPUOrder(Map businessData, String formApp) throws Exception{ + JSONObject result = new JSONObject(); + Object mainObj = businessData.get("formmain_0222"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + Object formson_0223obj = businessData.get("formson_0223"); + String parm = boundSWPUOrderMain(businessDatamain,formson_0223obj); + //推送采购订单到U8C + String apiCode = "8000050009"; + logger.info("采购订单推送参数:{}",parm); + result = U8cHttpUtil.sendOATOU8CEsb(parm,apiCode); + logger.info("采购订单返回参数:{}",result); + //判断该采购订单是否随订单进行付款 + String field0065 = businessDatamain.getString("field0065"); + String status = result.getString("status"); + if(StrUtil.isNotEmpty(field0065) && "1".equals(field0065)){ + if(!"falied".equals(status)){ + try { + Object formson_0224obj = businessData.get("formson_0224"); + String parmPay = boundSWPUOrderMainPay(businessDatamain,formson_0224obj,result); + apiCode = "8000050000"; + logger.info("采购付款单请求参数:{}",parmPay); + result = U8cHttpUtil.sendOATOU8CEsb(parmPay,apiCode); + logger.info("采购付款单返回参数:{}",result); + } catch (Exception e) { + e.printStackTrace(); + } + }else { + logger.info("采购订单传递失败:{}",result.getString("errormsg")); + } + } + return result.toString(); + } + //付款单信息 + private String boundSWPUOrderMainPay(JSONObject businessDatamain, Object formson_0224obj,JSONObject attribute)throws Exception{ + JSONObject main = new JSONObject(); + JSONObject puPay = new JSONObject(); + JSONArray billvo = new JSONArray(); + String failed = attribute.getString("failed"); + + JSONArray dataArr = attribute.getJSONArray("data"); + for(Object data:dataArr){ + JSONObject dataObj = JSON.parseObject(data.toString()); + JSONObject resultParentvo = dataObj.getJSONObject("parentvo"); + String corderid = resultParentvo.getString("corderid"); + String vordercode = resultParentvo.getString("vordercode"); + String dateStr = businessDatamain.getString("field0004"); + Date billDate = DateUtil.stringToDate(dateStr,"yyyy-MM-dd"); + String date = DateUtil.dateToString(billDate,"yyyy-MM-dd"); + //组装主表数据 + JSONObject parentvo = new JSONObject(); + parentvo.put("lrr",businessDatamain.getString("field0082"));//录入人 + parentvo.put("djlxbm","D3");//单据类型编码 field0101 + parentvo.put("dwbm",businessDatamain.getString("field0101"));//单位编码 + parentvo.put("djrq",date);//业务单据日期 + parentvo.put("shrq",date);//审核日期 +// parentvo.put("xslxbm",businessDatamain.getString("field0118"));//业务流程 + + parentvo.put("shr",businessDatamain.getString("field0082"));//审核人 + parentvo.put("qrr",businessDatamain.getString("field0082"));//签字确认人 + parentvo.put("ybje",businessDatamain.getString("field0017"));//原币金额 + parentvo.put("bbje",businessDatamain.getString("field0017"));//本币金额 + parentvo.put("pj_jsfs",businessDatamain.getString("field0128"));// 结算方式 + parentvo.put("deptid",businessDatamain.getString("field0109"));// 部门 + parentvo.put("bzbm",businessDatamain.getString("field0113"));// 币种 + //自定义项名称 + parentvo.put("zyx1",businessDatamain.getString("field0198"));//银行档案 + parentvo.put("zyx10",businessDatamain.getString("field0093"));//业务中心 + parentvo.put("zyx11",businessDatamain.getString("field0096"));//业务模式 + parentvo.put("zyx12",businessDatamain.getString("field0087"));//店铺 + parentvo.put("zyx13",businessDatamain.getString("field0090"));//品牌 + parentvo.put("zyx14",businessDatamain.getString("field0084"));//平台 + parentvo.put("zyx15",vordercode);//采购订单号 + + parentvo.put("zyx1",businessDatamain.getString("field0131"));// 银行 + parentvo.put("zyx2",businessDatamain.getString("field0161"));// 其他货币资金 + parentvo.put("hbbm",businessDatamain.getString("field0134"));//客商 + parentvo.put("prepay","Y");//预收付款标志 如果是随订单预付款,必须打勾这个字段 默认Y + + puPay.put("parentvo",parentvo); + JSONObject sendBody = new JSONObject(); + sendBody.put("billdate",date);//单据日期 + sendBody.put("fx","1");//方向 +// sendBody.put("jfbbje",businessDatamain.getString("field0066"));//本币金额 + sendBody.put("jfybje",businessDatamain.getString("field0066"));//原币金额 + JSONArray childrenvo = new JSONArray(); + sendBody.put("ddlx",corderid);//来源单据id +// sendBody.put("ddhh",corder_bid);//来源单据行id + sendBody.put("hbbm",businessDatamain.getString("field0134"));//客商档案 + sendBody.put("ddh",vordercode);//订单号 + childrenvo.add(sendBody); + //报销信息明细表(明细表1) +// JSONArray formson_0224Arr = JSON.parseArray(JSON.toJSONString(formson_0224obj)); + //formson_0224 +// JSONArray childrenvo = new JSONArray(); +// for(Object obj : formson_0224Arr){ +// JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); +// //如果付款原币金额为空,则不传递当前明细行,杜绝有空行存在 +// if(StrUtil.isEmpty(body.getString("field0054"))){ +// continue; +// } +// +// } + puPay.put("children",childrenvo); +// } + + } + billvo.add(puPay); + main.put("billvo",billvo); + return main.toString(); + } + + //采购订单信息 + private String boundSWPUOrderMain(JSONObject businessDatamain,Object formson_0223obj)throws Exception{ + JSONObject data = new JSONObject(); + JSONObject sourceData = new JSONObject(); + + JSONObject puOrder = new JSONObject(); + //组装主表数据 + JSONObject parentvo = new JSONObject(); + parentvo.put("cbiztype",businessDatamain.getString("field0118"));//业务流程 + parentvo.put("cdeptid",businessDatamain.getString("field0109"));//采购部门 +// parentvo.put("cdeptid","1007F81000000000K1Q0");//采购部门-速网先默认 用完注释 + parentvo.put("coperator",businessDatamain.getString("field0082"));//制单人 + //采购组织 + BdCorpEntity poCorp = new BdCorpEntity(); + String pkCorp = businessDatamain.getString("field0101"); +// String poCode = businessDatamain.getString("field0122"); +// if(StrUtil.isNotEmpty(pkCorp) && StrUtil.isNotEmpty(poCode)){ +// poCorp.setPkCorp(pkCorp); +// poCorp.setCode(poCode); +// poCorp = corpService.getPoPkByOrg(poCorp); +// if(null != poCorp){ +// parentvo.put("cpurorganization",poCorp.getPkPurorg());//采购组织 +// } +// } + parentvo.put("cpurorganization",businessDatamain.getString("field0121"));//采购组织 + parentvo.put("cvendormangid",businessDatamain.getString("field0103"));//供应商 + parentvo.put("pk_corp",pkCorp);//所属公司 + parentvo.put("vordercode",businessDatamain.getString("field0112"));//订单编号 + parentvo.put("dorderdate",businessDatamain.getString("field0004"));//订单日期 + parentvo.put("vmemo",businessDatamain.getString("field0025"));//备注 + +// if("0001F81000000000IGUU".equals(businessDatamain.getString("field0195"))){ +// parentvo.put("pk_defdoc18", businessDatamain.getString("field0201"));//是否补单主键 +// parentvo.put("vdef18", "是");//是否补单主键 +// } +// if("0001F81000000000IGUV".equals(businessDatamain.getString("field0195"))){ +// parentvo.put("pk_defdoc18", businessDatamain.getString("field0195"));//是否补单主键 +// parentvo.put("vdef18", "否");//是否补单主键 +// } + //自定义项主键 + parentvo.put("pk_defdoc10",businessDatamain.getString("field0093"));//业务中心 + parentvo.put("pk_defdoc11",businessDatamain.getString("field0096"));//业务模式 + parentvo.put("pk_defdoc12",businessDatamain.getString("field0087"));//店铺 + parentvo.put("pk_defdoc13",businessDatamain.getString("field0090"));//品牌 + parentvo.put("pk_defdoc14",businessDatamain.getString("field0084"));//平台 + parentvo.put("pk_defdoc15",businessDatamain.getString("field0155"));//收货仓库主键 + //自定义项名称 + parentvo.put("vdef10",businessDatamain.getString("field0095"));//业务中心 + parentvo.put("vdef11",businessDatamain.getString("field0098"));//业务模式 + parentvo.put("vdef12",businessDatamain.getString("field0089"));//店铺 + parentvo.put("vdef13",businessDatamain.getString("field0092"));//品牌 + parentvo.put("vdef14",businessDatamain.getString("field0086"));//平台 + parentvo.put("vdef15",businessDatamain.getString("field0155"));//收货仓库名称 + parentvo.put("ccurrencytypeid",businessDatamain.getString("field0113"));//原币币种ID + + + puOrder.put("parentvo",parentvo); + //报销信息明细表(明细表1) + + JSONArray formson_0223Arr = JSON.parseArray(JSON.toJSONString(formson_0223obj)); + //formson_0205 + JSONArray childrenvo = new JSONArray(); + for(Object obj : formson_0223Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject sendBody = new JSONObject(); + sendBody.put("pk_corp",body.getString("field0043"));//公司主键 + sendBody.put("vdef1",body.getString("field0154"));//折扣一金额 + //通过所属公司与存货编码获取存货管理档案主键 + BdInvmandocEntity invmandoc = new BdInvmandocEntity(); + invmandoc.setInvcode(body.getString("field0104")); + invmandoc.setPkCorp(pkCorp); + List bdInvmandocEntityList = invmandocDao.queryBdInvmandocByInvcode(invmandoc); + if(null != bdInvmandocEntityList && bdInvmandocEntityList.size()>0 ){ + for(BdInvmandocEntity inv : bdInvmandocEntityList){ + String pkInvmandoc = inv.getPkInvmandoc(); + if(null != invmandoc){ + sendBody.put("cmangid",pkInvmandoc);//存货信息 + break; + } + } + + } + String fale = "Y"; + logger.info("是否赠品:{}",body.getString("field0197")); + if ("2544055901016641496".equals(body.getString("field0197")) || null ==body.getString("field0197")) { //否 + fale = "N"; + } + sendBody.put("blargess", fale);//是否赠品 N Y + +// //获取收货库存组织主键 + String stockCode = body.getString("field0125"); + if(StrUtil.isNotEmpty(pkCorp) && StrUtil.isNotEmpty(stockCode)){ +// poCorp.setPkCorp(pkCorp); + poCorp.setCode(stockCode); + poCorp = corpService.getStockPkByOrg(poCorp); + if(null != poCorp){ + sendBody.put("pk_arrvcorp",poCorp.getPkCorp());//收货公司 + sendBody.put("pk_arrvstoorg",poCorp.getPkCalbody());//收货库存组织 + } + } + sendBody.put("ntaxrate",body.getString("field0135"));//税率 +// sendBody.put("pk_arrvstoorg",body.getString("field0126"));//收货库存组织 + sendBody.put("ccurrencytypeid",businessDatamain.getString("field0113"));//原币币种ID + sendBody.put("nordernum",body.getString("field0028"));//订货数量 + sendBody.put("norgtaxprice",body.getString("field0117"));//原币含税单价 + sendBody.put("noriginalcurprice",body.getString("field0116"));//原币无税单价 + sendBody.put("cwarehouseid",body.getString("field0116"));//原币无税单价 + childrenvo.add(sendBody); + } + puOrder.put("childrenvo",childrenvo); + sourceData.put("puordervo",puOrder); +// logger.info("采购订单请求参数:{}",sourceData); + return sourceData.toString(); + } + + /** + * 销售订单-速网 + * @param businessData + * @param formApp + * @return + */ + private String boundSWSaleOrder(Map businessData, String formApp) { + try { + Object mainObj = businessData.get("formmain_0202"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject jsonObject=new JSONObject(); + //判断单子是否是退货订单 1:是 0:否 + if("0".equals(businessDatamain.getString("field0105"))){ + jsonObject= boundSWSaleOrderMerge(businessData,"N"); + }else { + jsonObject= boundSWSaleOrderMerge(businessData, "Y"); + if ("success".equals(jsonObject.getString("status"))) { + //销售订单关闭 + boundSWSaleGeneral(businessData); + } + } + return jsonObject.toString(); + }catch (Exception e){ + e.printStackTrace(); + logger.info("销售订单操作失败:{}",e.getMessage()); + } + return null; + } + + private JSONObject boundSWSaleOrderMerge(Map businessData,String type)throws Exception { + StringBuffer stringBuffer=new StringBuffer(); + JSONObject sourceData = new JSONObject(); + Object mainObj = businessData.get("formmain_0202"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + String id = businessDatamain.getString("id");//oaid + String field0010= businessDatamain.getString("field0010"); + JSONObject saleorder = new JSONObject(); + String pkCorp = businessDatamain.getString("field0112"); + //组装主表数据 + JSONObject parentvo = new JSONObject(); + parentvo.put("vdef12", businessDatamain.getString("field0074"));//店铺 名称 + parentvo.put("pk_defdoc12", businessDatamain.getString("field0108"));//店铺 主键 + parentvo.put("vdef2", businessDatamain.getString("field0075"));//收件人姓名 + parentvo.put("vdef3", businessDatamain.getString("field0076"));//收件人手机 + parentvo.put("vdef4", businessDatamain.getString("field0077"));//邮费 + parentvo.put("vdef8", businessDatamain.getString("field0081"));//地址 + parentvo.put("vdef9", businessDatamain.getString("field0149"));//送样类型 + parentvo.put("vdef17", businessDatamain.getString("field0210"));//销售折让 + parentvo.put("vreceiptcode",field0010);//单据号 + parentvo.put("cbiztype", businessDatamain.getString("field0132"));//业务类型 主键 + parentvo.put("dbilldate", businessDatamain.getString("field0002"));//单据日期 + parentvo.put("pk_corp",pkCorp );//所属公司编码 主键 + //客户主键,需要通过所属公司以及客户编码获取客户管理档案主键 + String custCode = businessDatamain.getString("field0109"); + BdCumandocEntity cumandoc = new BdCumandocEntity(); + cumandoc.setPkCorp(pkCorp); + cumandoc.setCustcode(custCode); + ListbdCumandocEntityList = bdCumandocDao.selectIdByCodeAndCorp(cumandoc); + if(null != bdCumandocEntityList && bdCumandocEntityList.size()>0){ + for(BdCumandocEntity bdCumandocEntity : bdCumandocEntityList){ + if(null != bdCumandocEntity){ + String cumandocId = bdCumandocEntity.getPkCumandoc(); + parentvo.put("ccustomerid", cumandocId);//客户编码 主键 + } + } + } + parentvo.put("cdeptid", businessDatamain.getString("field0142"));//执行部门 主键 + parentvo.put("csalecorpid", businessDatamain.getString("field0137"));//销售组织 主键不能为空 + parentvo.put("ccalbodyid", businessDatamain.getString("field0202"));//库存组织 主键//todo +// parentvo.put("ccalbodyid", "1007F81000000000JEGU");//库存组织 主键//todo 等待修改 + parentvo.put("creceiptcorpid", businessDatamain.getString("field0110"));//开票单位 客户主键 + parentvo.put("ndiscountrate", businessDatamain.getString("field0093"));//整单折扣 + parentvo.put("bretinvflag", type);//退货标记 N Y + parentvo.put("vnote", businessDatamain.getString("field0188"));//备注 + parentvo.put("coperatorid", businessDatamain.getString("field0129"));//制单人 主键 + parentvo.put("vdef10", businessDatamain.getString("field0091"));//业务中心 名称 + parentvo.put("vdef9", businessDatamain.getString("field0149"));//送样类型 名称 + parentvo.put("vdef11", businessDatamain.getString("field0095"));//业务模式 名称 + parentvo.put("vdef13", businessDatamain.getString("field0096"));//品牌 名称 + parentvo.put("vdef14", businessDatamain.getString("field0097"));//平台 名称 + + parentvo.put("vdef15", businessDatamain.getString("field0146"));//原单单号 + parentvo.put("vdef16", businessDatamain.getString("field0131"));//原单主键 + +// if("0001F81000000000IGUU".equals(businessDatamain.getString("field0201"))){ +// parentvo.put("pk_defdoc18", businessDatamain.getString("field0201"));//是否补单主键 +// parentvo.put("vdef18", "是");//是否补单主键 +// } +// if("0001F81000000000IGUV".equals(businessDatamain.getString("field0201"))){ +// parentvo.put("pk_defdoc18", businessDatamain.getString("field0201"));//是否补单主键 +// parentvo.put("vdef18", "否");//是否补单主键 +// } + + parentvo.put("pk_defdoc10", businessDatamain.getString("field0125"));//业务中心 主键 + parentvo.put("pk_defdoc9", businessDatamain.getString("field0147"));//送样类型 主键 + parentvo.put("pk_defdoc11", businessDatamain.getString("field0123"));//业务模式 主键 + parentvo.put("pk_defdoc13", businessDatamain.getString("field0120"));//品牌 主键 + parentvo.put("pk_defdoc14", businessDatamain.getString("field0122"));//平台 主键 + if(StrUtil.isNotEmpty(businessDatamain.getString("field0155"))){ + parentvo.put("vdef5",businessDatamain.getString("field0155"));//省 + }else{ + parentvo.put("vdef5","无");//省 + } + if(StrUtil.isNotEmpty(businessDatamain.getString("field0156"))){ + parentvo.put("vdef6",businessDatamain.getString("field0156"));//市 + }else{ + parentvo.put("vdef6","无");//市 + } + if(StrUtil.isNotEmpty(businessDatamain.getString("field0157"))){ + parentvo.put("vdef7",businessDatamain.getString("field0157"));//区/县 + }else { + parentvo.put("vdef7","无");//区/县 + } + + + parentvo.put("vdef8",businessDatamain.getString("field0081"));//详细地址 + + saleorder.put("parentvo", parentvo); + //报销信息明细表(明细表1) + Object formson_0203obj = businessData.get("formson_0203"); + JSONArray childrenvo = new JSONArray(); + JSONArray formson_0203Arr = JSON.parseArray(JSON.toJSONString(formson_0203obj)); + if (formson_0203Arr.size() > 0 && null != formson_0203Arr) { + for (Object obj : formson_0203Arr) { + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject sendBody = new JSONObject(); + //通过所属公司与存货编码获取存货管理档案主键 + BdInvmandocEntity invmandoc = new BdInvmandocEntity(); + invmandoc.setInvcode(body.getString("field0012")); + if(StrUtil.isNotEmpty(businessDatamain.getString("field0177"))){ + invmandoc.setPkCorp(businessDatamain.getString("field0177"));//todo 2024年1月24日09:51:27 实施提出需要将存货传递为库存公司的管理主键 + }else { + invmandoc.setPkCorp(pkCorp); + } + + List bdInvmandocEntityList = invmandocDao.queryBdInvmandocByInvcode(invmandoc); + if(null != bdInvmandocEntityList && bdInvmandocEntityList.size()>0 ){ + for(BdInvmandocEntity inv : bdInvmandocEntityList){ + String pkInvmandoc = inv.getPkInvmandoc(); + if(null != invmandoc){ + sendBody.put("cinventoryid", pkInvmandoc);//存货编码 主键 + break; + } + } + + } + sendBody.put("cunitid", body.getString("field0116"));//单位 + sendBody.put("creccalbodyid", body.getString("field0202"));//收货库存组织 +// sendBody.put("creccalbodyid", "1007F81000000000JEGU");//收货库存组织 + + if(StrUtil.isNotEmpty(businessDatamain.getString("field0177"))&&!businessDatamain.getString("field0177").equals(pkCorp)){ + sendBody.put("cconsigncorpid", businessDatamain.getString("field0177"));//发货公司 + } + if("0".equals(businessDatamain.getString("field0105"))){ + sendBody.put("nnumber", body.getString("field0018"));//数量 + }else{ + sendBody.put("nnumber", "-"+body.getString("field0018"));//数量 + } + String fale = "Y"; + logger.info("是否赠品:{}",body.getString("field0023")); + if ("1289206401434863591".equals(body.getString("field0023")) || null ==body.getString("field0023")) { //否 + fale = "N"; + } + sendBody.put("blargessflag", fale);//是否赠品 N Y + sendBody.put("noriginalcurprice", body.getString("field0139"));//不含税单价 + String field0182 = body.getString("field0182"); + if("是".equals(field0182)){ + sendBody.put("blargessflag", "Y");//是否赠品 + } + sendBody.put("ntaxrate", "13%");//税率 + sendBody.put("noriginalcurtaxprice", body.getString("field0168"));//含税单价 + //sendBody.put("noriginalcursummny", body.getString("field0082"));//原币价税合计 + sendBody.put("cbodywarehouseid", body.getString("field0114"));//附表仓库 + sendBody.put("cadvisecalbodyid",businessDatamain.getString("field0136"));//发货库存组织 主键 + sendBody.put("vostatus", body.getString("new"));//状态 调用修改接口时使用,传值:修改时update、删除时delete、新增时new) + + childrenvo.add(sendBody); + } + } + saleorder.put("childrenvo", childrenvo); + sourceData.put("saleorder", saleorder); + logger.info("销售订单保存即审核请求参数:{}", sourceData); + JSONObject jsonObjectAttribute = U8cHttpUtil.sendOATOU8CEsb(sourceData.toString(), "8000050001"); + logger.info("销售订单保存即审核返回参数解析之后得到的attribute值为:{}", jsonObjectAttribute); + stringBuffer.append("销售订单保存即审核:" + jsonObjectAttribute); + SeeyonEntity seeyon = new SeeyonEntity(); + String success = jsonObjectAttribute.getString("status"); + if ("success".equals(success)) { + JSONArray jsonArray = jsonObjectAttribute.getJSONArray("data"); + if (jsonArray.size() > 0 && null != jsonArray) { + for (Object object : jsonArray) { + JSONObject body = JSON.parseObject(JSON.toJSONString(object)); + String parentvoResult = body.getString("parentvo"); + JSONObject jsonObjectParentvo = JSONObject.parseObject(parentvoResult); + String csaleid = jsonObjectParentvo.getString("csaleid"); + logger.info("获取到的销售订单主键为:{}", csaleid); + String corderBid=null; + String inventoryCode=null; + String childrenvoDetsils = body.getString("childrenvo"); + JSONArray jsonArrayDetails = JSONArray.parseArray(childrenvoDetsils); + if (jsonArrayDetails.size() > 0 && null != jsonArrayDetails) { + for (Object jsonArrayDetail : jsonArrayDetails) { + JSONObject details = JSON.parseObject(JSON.toJSONString(jsonArrayDetail)); + corderBid = details.getString("corder_bid"); + inventoryCode = details.getString("inventory_code");//存货编码 + logger.info("获取到的销售订单明细主键为:{},存货编码为:{}", corderBid,inventoryCode); + //根据销售订单单据编号查询销售订单档案主键id + seeyon.setField0010(field0010); + SeeyonEntity seeyonEntity = seeYonDao.selectOAListByformmain_0237(seeyon); + if(null !=seeyonEntity){ + //更新OA销售订单档案明细 + seeyon.setField0121(corderBid); + seeyon.setFormmain_id(seeyonEntity.getDa_id()); + seeyon.setField0012(inventoryCode); + seeYonDao.updateFormformson_0238(seeyon); + } + } + } + //更新OA销售订单档案 + seeyon.setField0120(csaleid); + seeyon.setField0010(field0010); + seeYonDao.updateFormformmain_0237(seeyon); + } + } + } else { + //更新OA销售订单档案 + seeyon.setField0120("2"); + seeyon.setField0010(field0010); + seeYonDao.updateFormformmain_0237(seeyon); + } + return jsonObjectAttribute; + } + + /** + * + * @content 销售订单关闭 + * @Param + * @Return + * @Author hecan + * @Date 2023/11/13 14:19 + * **/ + private String boundSWSaleGeneral(Map businessData) { + Object mainObj = businessData.get("formmain_0202"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject saleGeneral = new JSONObject(); + //组装关闭信息 + JSONObject closeinfo = new JSONObject(); + closeinfo.put("coperator",businessDatamain.get("field0128"));//操作员编码 + closeinfo.put("date_closeoropen",businessDatamain.get(""));//关闭/打开日期 + //组装查询信息 + JSONObject queryinfo = new JSONObject(); + queryinfo.put("code",businessDatamain.get("field0010"));//单据号 + queryinfo.put("corp",businessDatamain.get("field0111"));//公司编码 + queryinfo.put("date_begin",businessDatamain.get("field0002"));//单据开始日期 + queryinfo.put("date_end",businessDatamain.get("field0002"));//单据结束日期 + queryinfo.put("inventory",businessDatamain.get(""));//存货 + queryinfo.put("maker",businessDatamain.get(""));//制单人 + queryinfo.put("vendor",businessDatamain.get(""));//供应商 + saleGeneral.put("closeinfo",closeinfo); + saleGeneral.put("queryinfo",queryinfo); + //明细表 行关闭信息 + JSONArray rowCloseOpenInfo = new JSONArray(); + Object formson_0203obj = businessData.get("formson_0203"); + JSONArray detailsArr = JSON.parseArray(JSON.toJSONString(formson_0203obj)); + if(detailsArr.size() > 0 && detailsArr!= null) { + for (Object obj : detailsArr) { + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject sendBody = new JSONObject(); + sendBody.put("bifinventoryfinish", body.getString(""));//是否出库关闭 + sendBody.put("bifinvoicefinish", body.getString(""));//是否开票关闭 + sendBody.put("bifreceivefinish", body.getString(""));//是否发货关闭 + sendBody.put("bsquareendflag", body.getString(""));//是否结算关闭 + sendBody.put("crowno", body.getString(""));//表体行号(非整单关闭打开时必传) + sendBody.put("incoconfclose", body.getString(""));//是否收入确认关闭 + sendBody.put("isRowClose", body.getString(""));//是否行关闭 + rowCloseOpenInfo.add(sendBody); + } + } + saleGeneral.put("rowCloseOpenInfo",rowCloseOpenInfo); + logger.info("销售订单关闭请求参数:{}",saleGeneral); + String result = HttpRequest.post(baseUrl) + .header("usercode", "tbadmin")//头信息,多个头信息多次调用此方法即可 + .header("password", "c4ca4238a0b923820dcc509a6f75849b")//头信息,多个头信息多次调用此方法即可 + .header("trantype", "code")//头信息,多个头信息多次调用此方法即可 + .header("system", "SOWOW")//头信息,多个头信息多次调用此方法即可 + .header("appId", "800005")//头信息,多个头信息多次调用此方法即可 + .header("apiCode", "8000050011")//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(saleGeneral.toString())//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + logger.info("销售订单关闭返回参数:{}",result); + return result; + } + + /** + * 日常费用报销单 + * @param businessData + * @param formApp + * @return + */ + private JSONObject boundDatacurrentExpense(Map businessData, String formApp) { + JSONObject data = new JSONObject(); + Object mainObj = businessData.get("formmain_0314"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + //todo 所有日期传递时间戳 + //组装主表数据 + JSONObject main = new JSONObject(); + main.put("textField_lm5r47lv",businessDatamain.get("field0220"));//单据编号 + main.put("textField_lm5r47lx",businessDatamain.get("field0228"));//公司编码 + JSONArray field0275Arr = new JSONArray(); + String field0275 = businessDatamain.get("field0275").toString(); + field0275Arr.add(field0275); + + main.put("employeeField_lm5r47lz",field0275Arr);//申请人 + main.put("dateField_lm5r47m0",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0125"))));//申请日期 + + JSONArray field0290Arr = new JSONArray(); + String field0290 = businessDatamain.get("field0290").toString(); + field0290Arr.add(field0290); + + main.put("departmentSelectField_lm5r47m2",field0290Arr);//申请人部门 + main.put("textField_lm5r47m4",businessDatamain.get("field0188"));//入账公司 + main.put("textField_lm5r47m6",businessDatamain.get("field0187"));//申请人电话 + main.put("textField_lm5r47m8",businessDatamain.get("field0277"));//是否有借款 + main.put("textField_lm5r47ma",businessDatamain.get("field0199"));//申请说明 + main.put("textField_lm5r47mc",businessDatamain.get("field0230"));//费用预算年度 + main.put("textField_lm5r47me",businessDatamain.get("field0250"));//付款金额合计大写 + main.put("textField_lm5r47mg",businessDatamain.get("field0251"));//报销金额合计大写 + main.put("numberField_lm5r47mh",businessDatamain.get("field0252"));//报销金额合计小写 + main.put("numberField_lm5r47mj",businessDatamain.get("field0253"));//付款金额合计小写 + + //报销信息明细表(明细表1) + Object formson_0315obj = businessData.get("formson_0315"); + JSONArray formson_0315Arr = JSON.parseArray(JSON.toJSONString(formson_0315obj)); + //formson_0315 + JSONArray tableField_lm5r47mkArr = new JSONArray(); + for(Object obj : formson_0315Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5r47mk = new JSONObject(); + tableField_lm5r47mk.put("textField_lm5r47mm",body.getString("field0201"));//费用类别一级 + tableField_lm5r47mk.put("numberField_lm5r47mo",body.getString("field0237"));//年度当前可用余额 + tableField_lm5r47mk.put("numberField_lm5r47mq",body.getString("field0203"));//报销金额 + tableField_lm5r47mk.put("numberField_lm5r47ms",body.getString("field0204"));//不含税金额 + tableField_lm5r47mk.put("textField_lm5r47mu",body.getString("field0238"));//费用归属部门 + tableField_lm5r47mk.put("textField_lm5r47mw",body.getString("field0239"));//预算组织 + tableField_lm5r47mk.put("textField_lm5r47my",body.getString("field0240"));//项目 + tableField_lm5r47mk.put("textField_lm5r47n0",body.getString("field0242"));//备注 + tableField_lm5r47mk.put("textField_lm5r47n2",body.getString("field0243"));//年度费用预算ID + tableField_lm5r47mk.put("textField_lm5r47n4",body.getString("field0244"));//预算状态 + tableField_lm5r47mk.put("textField_lm5r47n6",body.getString("field0245"));//项目编码 + tableField_lm5r47mk.put("textField_lm5r47n8",body.getString("field0246"));//费用类别ID + tableField_lm5r47mk.put("attachmentField_lm5r47na",null);//发票上传 + tableField_lm5r47mk.put("textField_lm5r47nc",body.getString("field0256"));//票据编码 + tableField_lm5r47mk.put("textField_lm5r47ne",body.getString("field0257"));//费用名称 + tableField_lm5r47mk.put("textField_lm5r47ng",body.getString("field0258"));//发票号码 + tableField_lm5r47mk.put("numberField_lm5r47ni",body.getString("field0259"));//税率 + tableField_lm5r47mk.put("numberField_lm5r47nk",body.getString("field0260"));//税额 + tableField_lm5r47mk.put("textField_lm5r47nm",body.getString("field0261"));//费用类别二级 + tableField_lm5r47mk.put("textField_lm5okztj",body.getString("field0262"));//乘车人 + tableField_lm5r47mk.put("dateField_lm5okztl",DateUtil.dateStrToLong(String.valueOf(body.get("field0263"))));//日期 + tableField_lm5r47mk.put("dateField_lm5okztn",DateUtil.dateStrToLong(String.valueOf(body.get("field0264"))));//开始时间 + tableField_lm5r47mk.put("dateField_lm5okztp",DateUtil.dateStrToLong(String.valueOf(body.get("field0265"))));//到达时间 + tableField_lm5r47mk.put("numberField_lm5okztr",body.getString("field0266"));//发票金额 + tableField_lm5r47mk.put("textField_lm5okztt",body.getString("field0267"));//报销明细序号 + + tableField_lm5r47mkArr.add(tableField_lm5r47mk); + main.put("tableField_lm5r47mk",tableField_lm5r47mkArr); + } + + + //汇款信息明细表(明细表2) + Object formson_0317obj = businessData.get("formson_0317"); + JSONArray formson_0317Arr = JSON.parseArray(JSON.toJSONString(formson_0317obj)); + //formson_0317 + + JSONArray tableField_lm5r47nnArr = new JSONArray(); + for(Object obj : formson_0317Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5r47nn = new JSONObject(); + tableField_lm5r47nn.put("textField_lm5okztv",body.getString("field0213"));//汇款信息序号 + tableField_lm5r47nn.put("textField_lm5okztx",body.getString("field0214"));//付款方式 + tableField_lm5r47nn.put("numberField_lm5okztz",body.getString("field0215"));//付款金额 + tableField_lm5r47nn.put("textField_lm5okzu1",body.getString("field0268"));//付款方开户名称 + tableField_lm5r47nn.put("textField_lm5okzu3",body.getString("field0269"));//付款方账号 + tableField_lm5r47nn.put("textField_lm5okzu7",body.getString("field0216"));//收款人开户名称 + tableField_lm5r47nn.put("textField_lm5okzu9",body.getString("field0217"));//收款人账号 + + tableField_lm5r47nnArr.add(tableField_lm5r47nn); + main.put("tableField_lm5r47nn",tableField_lm5r47nnArr); + } + + + data.put("formDataJson",main.toString()); + data.put("userId",businessDatamain.get("field0275")); + data.put("appType","APP_LLACU34DHTK2F07IEYVB"); + data.put("systemToken","IT5662C1PXUCS1NV6E40B61DNPLQ2PL30AQKLVA"); + data.put("formUuid","FORM-J1A66U81Y9ZD0ELKCXNT5DV0A4L83MJK3R5MLQ"); + return data; + } + + /** + * 招待费报销单 + * @param businessData + * @param formApp + * @return + */ + private JSONObject boundDataEntertain(Map businessData, String formApp) { + JSONObject data = new JSONObject(); + //todo 所有日期传递时间戳 + Object mainObj = businessData.get("formmain_0294"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + //组装主表数据 + JSONObject main = new JSONObject(); + main.put("textField_lm5okzr8",businessDatamain.get("field0093"));//关联招待申请单 + main.put("textField_lm5okzra",businessDatamain.get("field0053"));//单据编号 + JSONArray field0157Arr = new JSONArray(); + String field0157 = businessDatamain.get("field0157").toString(); + field0157Arr.add(field0157); + + main.put("employeeField_lm5okzrc",field0157Arr);//申请人 + main.put("dateField_lm5okzre",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0041"))));//申请日期 + JSONArray field0172Arr = new JSONArray(); + String field0172 = businessDatamain.get("field0172").toString(); + field0172Arr.add(field0172); + + main.put("departmentSelectField_lm5okzrg",field0172Arr);//申请人部门 + main.put("textField_lm5okzri",businessDatamain.get("field0080"));//入账公司 + main.put("textField_lm5okzrk",businessDatamain.get("field0081"));//申请人电话 + main.put("textField_lm5okzrm",businessDatamain.get("field0082"));//客户单位 + main.put("textField_lm5okzro",businessDatamain.get("field0083"));//客户人数 + main.put("textField_lm5okzrq",businessDatamain.get("field0084"));//陪同人数 + main.put("textField_lm5okzrs",businessDatamain.get("field0089"));//招待标准 + main.put("textField_lm5okzru",businessDatamain.get("field0090"));//报销说明 + main.put("numberField_lm5okzrw",businessDatamain.get("field0104"));//银行支付合计 + main.put("textField_lm5okzry",businessDatamain.get("field0108"));//公司编码 + main.put("numberField_lm5okzs0",businessDatamain.get("field0110"));//费用预算年度 + main.put("textField_lm5okzs2",businessDatamain.get("field0114"));//付款金额合计大写 + main.put("textField_lm5okzs4",businessDatamain.get("field0115"));//报销信息合计大写 + main.put("numberField_lm5okzs6",businessDatamain.get("field0116"));//报销金额合计小写 + main.put("numberField_lm5okzs8",businessDatamain.get("field0117"));//付款信息合计小写 + main.put("textField_lm5okzsa",businessDatamain.get("field0118"));//项目 + main.put("textField_lm5okzsc",businessDatamain.get("field0120"));//项目编码 + main.put("textField_lm5okzse",businessDatamain.get("field0158"));//招待级别 + main.put("textField_lm5okzsg",businessDatamain.get("field0142"));//借款合计大写 + main.put("numberField_lm5okzsi",businessDatamain.get("field0143"));//借款合计小写 + main.put("textField_lm5okzsk",businessDatamain.get("field0149"));//借款合计大写1 + main.put("numberField_lm5okzsm",businessDatamain.get("field0150"));//借款合计小写1 + //报销信息(明细表1) + Object formson_0295obj = businessData.get("formson_0295"); + JSONArray formson_0295Arr = JSON.parseArray(JSON.toJSONString(formson_0295obj)); + //formson_0295 + + + + JSONArray tableField_lm5okzsnArr = new JSONArray(); + for(Object obj : formson_0295Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5okzsn = new JSONObject(); + tableField_lm5okzsn.put("textField_lm5okzsp",body.getString("field0094"));//费用类型 + tableField_lm5okzsn.put("numberField_lm5okzsr",body.getString("field0096"));//报销金额 + tableField_lm5okzsn.put("numberField_lm5okzst",body.getString("field0097"));//不含税金额 + tableField_lm5okzsn.put("textField_lm5okzsv",body.getString("field0030"));//费用归属部门 + tableField_lm5okzsn.put("numberField_lm5okzsx",body.getString("field0076"));//预算金额 + tableField_lm5okzsn.put("textField_lm5okzsz",body.getString("field0079"));//预算信息备注 + tableField_lm5okzsn.put("numberField_lm5okzt1",body.getString("field0107"));//剩余预算金额 + tableField_lm5okzsn.put("textField_lm5okzt3",body.getString("field0109"));//费用类别ID + tableField_lm5okzsn.put("textField_lm5okzt5",body.getString("field0111"));//年度费用预算ID + tableField_lm5okzsn.put("attachmentField_lm5okzt7",body.getString("field0119"));//发票上传 + tableField_lm5okzsn.put("textField_lm5okzt9",body.getString("field0122"));//发票号码 + tableField_lm5okzsn.put("textField_lm5okztb",body.getString("field0123"));//票据编码 + tableField_lm5okzsn.put("textField_lm5okztd",body.getString("field0124"));//费用名称 + tableField_lm5okzsn.put("numberField_lm5okztf",body.getString("field0126"));//税率 + tableField_lm5okzsn.put("numberField_lm5okzth",body.getString("field0127"));//税额 + tableField_lm5okzsn.put("textField_lm5okztj",body.getString("field0129"));//乘车人 + tableField_lm5okzsn.put("dateField_lm5okztl",DateUtil.dateStrToLong(String.valueOf(body.get("field0130"))));//日期 + tableField_lm5okzsn.put("dateField_lm5okztn",DateUtil.dateStrToLong(String.valueOf(body.get("field0131"))));//出发时间 + tableField_lm5okzsn.put("dateField_lm5okztp",DateUtil.dateStrToLong(String.valueOf(body.get("field0132"))));//到达时间 + tableField_lm5okzsn.put("numberField_lm5okztr",body.getString("field0133"));//发票金额 + tableField_lm5okzsn.put("textField_lm5okztt",body.getString("field0134"));//报销信息序号 + tableField_lm5okzsnArr.add(tableField_lm5okzsn); + main.put("tableField_lm5okzsn",tableField_lm5okzsnArr); + } + + + //汇款信息明细表(明细表2) + Object formson_0297obj = businessData.get("formson_0297"); + JSONArray formson_0297Arr = JSON.parseArray(JSON.toJSONString(formson_0297obj)); + //formson_0297 + + JSONArray tableField_lm5qyiz4Arr = new JSONArray(); + for(Object obj : formson_0297Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5qyiz4 = new JSONObject(); + tableField_lm5qyiz4.put("textField_lm5okztv",body.getString("field0060"));//汇款信息序号 + tableField_lm5qyiz4.put("textField_lm5okztx",body.getString("field0069"));//付款方式 + tableField_lm5qyiz4.put("numberField_lm5okztz",body.getString("field0100"));//付款金额 + tableField_lm5qyiz4.put("textField_lm5okzu1",body.getString("field0098"));//开户行 + tableField_lm5qyiz4.put("textField_lm5okzu3",body.getString("field0073"));//开户行账号 + tableField_lm5qyiz4.put("textField_lm5okzu5",body.getString("field0070"));//银行支付 + tableField_lm5qyiz4.put("textField_lm5okzu7",body.getString("field0135"));//收款人开户名称 + tableField_lm5qyiz4.put("textField_lm5okzu9",body.getString("field0136"));//收款人账号 + tableField_lm5qyiz4Arr.add(tableField_lm5qyiz4); + main.put("tableField_lm5qyiz4",tableField_lm5qyiz4Arr); + } + + + data.put("formDataJson",main.toString()); + data.put("userId",businessDatamain.get("field0157")); + data.put("appType","APP_LLACU34DHTK2F07IEYVB"); + data.put("systemToken","IT5662C1PXUCS1NV6E40B61DNPLQ2PL30AQKLVA"); + data.put("formUuid","FORM-5Q966D91ORYDL2GYBAE4F77GWL922H2SKO5MLR"); + return data; + } + + /** + * 差旅费报销单 + * @param businessData + * @param formApp + * @return + */ + private JSONObject boundDataTravelExpense(Map businessData, String formApp) { + JSONObject data = new JSONObject(); + //todo 所有日期传递时间戳 + Object mainObj = businessData.get("formmain_0307"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + //组装主表数据 + JSONObject main = new JSONObject(); + main.put("textField_lm5ng0oz",businessDatamain.get("field0094"));//单据编号 + JSONArray field0279Arr = new JSONArray(); + String field0279 = businessDatamain.get("field0279").toString(); + field0279Arr.add(field0279); + main.put("employeeField_lm5ng0p3",field0279Arr);//申请人 + + main.put("dateField_lm5ng0p5",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0125"))));//申请日期 + JSONArray field0307Arr = new JSONArray(); + String field0307 = businessDatamain.get("field0307").toString(); + field0307Arr.add(field0307); + + main.put("departmentSelectField_lm5ng0p7",field0307Arr);//申请人部门 + main.put("textField_lm5ng0p9",businessDatamain.get("field0187"));//电话 + main.put("textField_lm5ng0pb",businessDatamain.get("field0221"));//关联出差申请 + main.put("textField_lm5ng0pd",businessDatamain.get("field0188"));//入账公司 + main.put("textField_lm5ng0pf",businessDatamain.get("field0189"));//出差国别 + main.put("dateField_lm5ng0ph",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0193"))));//出差开始时间 +// main.put("cascadeDateField_lm5ng0pl",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0194"))));//出差结束时间 + main.put("numberField_lm5ng0pn",businessDatamain.get("field0195"));//出差天数 + main.put("textField_lm5ng0pp",businessDatamain.get("field0199"));//出差说明 + main.put("textField_lm5ng0pr",businessDatamain.get("field0236"));//出差申请单号 + main.put("textField_lm5ng0pt",businessDatamain.get("field0234"));//商旅单号 + main.put("textField_lm5ng0pv",businessDatamain.get("field0155"));//费用预算ID + main.put("textField_lm5ng0px",businessDatamain.get("field0280"));//1.4出差类型 + main.put("textField_lm5ng0pz",businessDatamain.get("field0056"));//1.5出差审批 + main.put("textField_lm5ng0q1",businessDatamain.get("field0137"));//2.7费用类别 + main.put("textField_lm5ng0q3",businessDatamain.get("field0149"));//2.8预算年度 + main.put("textField_lm5ng0q5",businessDatamain.get("field0159"));//2.10预算部门 + main.put("numberField_lm5ng0q9",businessDatamain.get("field0181"));//3.1费用金额合计 + main.put("numberField_lm5ng0qb",businessDatamain.get("field0177"));//3.2未税金额合计 + main.put("numberField_lm5ng0qd",businessDatamain.get("field0178"));//3.3税额合计 + main.put("numberField_lm5ng0qf",businessDatamain.get("field0075"));//3.4实际出差天数 + main.put("numberField_lm5ng0qh",businessDatamain.get("field0074"));//3.5出差补助合计 + main.put("numberField_lm5ng0qj",businessDatamain.get("field0145"));//3.6实际住宿天数 + main.put("numberField_lm5ng0ql",businessDatamain.get("field0072"));//3.7住宿费合计 + main.put("textField_lm5ng0qn",businessDatamain.get("field0174"));//3.8备注 + main.put("numberField_lm5ng0qp",businessDatamain.get("field0076"));//3.9报销金额 + main.put("numberField_lm5ng0qr",businessDatamain.get("field0078"));//3.10借支金额 + main.put("numberField_lm5ng0qt",businessDatamain.get("field0080"));//3.11冲抵金额 + main.put("numberField_lm5ng0qv",businessDatamain.get("field0079"));//3.12归还金额 + main.put("numberField_lm5ng0qx",businessDatamain.get("field0081"));//3.13本次支付金额 + main.put("textField_lm5ng0qz",businessDatamain.get("field0082"));//3.14本次支付金额大写 + main.put("numberField_lm5ng0r1",businessDatamain.get("field0117"));//3.15单据总数 + main.put("textField_lm5ng0r3",businessDatamain.get("field0281"));//3.16支付方式 + main.put("dateField_lm5ng0r5",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0118"))));//3.17支付日期 + main.put("textField_lm5ng0r7",businessDatamain.get("field0131"));//3.18银行账户 + main.put("textField_lm5ng0r9",businessDatamain.get("field0132"));//3.19开户银行 + main.put("textField_lm5ng0rb",businessDatamain.get("field0133"));//3.20银行账号 + main.put("textField_lm5ng0rd",businessDatamain.get("field0084"));//4.1审批领导 + main.put("textField_lm5ng0rf",businessDatamain.get("field0085"));//4.2会计 + main.put("textField_lm5ng0rh",businessDatamain.get("field0086"));//4.3出纳 + main.put("textField_lm5ng0rj",businessDatamain.get("field0119"));//0.2借款编号 + main.put("numberField_lm5ng0rl",businessDatamain.get("field0123"));//0.3欠款金额 + main.put("textField_lm5ng0rn",businessDatamain.get("field0282"));//0.4报销单类型 + main.put("textField_lm5ng0rp",businessDatamain.get("field0283"));//0.5支出类型 + main.put("textField_lm5ng0rr",businessDatamain.get("field0139"));//0.6职务级别 + main.put("textField_lm5ng0rt",businessDatamain.get("field0140"));//0.7补贴标准 + main.put("textField_lm5ng0rv",businessDatamain.get("field0141"));//0.8住宿标准 + main.put("textField_lm5ng0rx",businessDatamain.get("field0284"));//0.9管控类型 + main.put("textField_lm5ng0rz",businessDatamain.get("field0285"));//0.10预算状态 + main.put("textField_lm5ng0s1",businessDatamain.get("field0186"));//0.11凭证编号 + main.put("textField_lm5ng0s3",businessDatamain.get("field0120"));//强控填写提示 + main.put("textField_lm5ng0s5",businessDatamain.get("field0168"));//弱控填写提示 + main.put("textField_lm5ng0s7",businessDatamain.get("field0220"));//公司编码 + main.put("textField_lm5ng0s9",businessDatamain.get("field0243"));//报销金额合计大写 + main.put("numberField_lm5ng0sd",businessDatamain.get("field0244"));//报销金额合计小写 + main.put("textField_lm5ng0sf",businessDatamain.get("field0245"));//付款金额合计大写 + main.put("numberField_lm5ng0sh",businessDatamain.get("field0246"));//付款金额合计小写 + main.put("textField_lm5ng0sj",businessDatamain.get("field0247"));//筛选入账公司 + main.put("textField_lm5ng0sl",businessDatamain.get("field0248"));//项目 + main.put("textField_lm5ng0sn",businessDatamain.get("field0249"));//项目编码 + main.put("textField_lm5ng0sp",businessDatamain.get("field0264"));//差旅标准 + + + //报销明细(明细表1) + Object formson_0308obj = businessData.get("formson_0308"); + JSONArray formson_0308Arr = JSON.parseArray(JSON.toJSONString(formson_0308obj)); + //formson_0308 + + + JSONArray tableField_lm5ng0sqbArr = new JSONArray(); + for(Object obj :formson_0308Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5ng0sq = new JSONObject(); + tableField_lm5ng0sq.put("textField_lm5ng0ss",body.getString("field0027"));//L1.0序号 + tableField_lm5ng0sq.put("dateField_lm5ng0sw",DateUtil.dateStrToLong(String.valueOf(body.get("field0061"))));//L1.1出发时间 + tableField_lm5ng0sq.put("dateField_lm5ng0sy",DateUtil.dateStrToLong(String.valueOf(body.get("field0066"))));//L1.2到达时间 + tableField_lm5ng0sq.put("textField_lm5ng0t0",body.getString("field0062"));//L1.3出发地 + tableField_lm5ng0sq.put("textField_lm5ng0t2",body.getString("field0063"));//L1.4目的地 + tableField_lm5ng0sq.put("numberField_lm5ng0t4",body.getString("field0064"));//L1.5单据数 + tableField_lm5ng0sq.put("textField_lm5ng0t6",body.getString("field0179"));//L1.6费用项目 + tableField_lm5ng0sq.put("textField_lm5ng0t8",body.getString("field0180"));//L1.7费用金额 + tableField_lm5ng0sq.put("numberField_lm5ng0ta",body.getString("field0182"));//L1.8税率 + tableField_lm5ng0sq.put("numberField_lm5ng0tc",body.getString("field0183"));//L1.9未税金额 + tableField_lm5ng0sq.put("numberField_lm5ng0te",body.getString("field0184"));//L1.10税额 + tableField_lm5ng0sq.put("attachmentField_lm5ng0tg",body.getString("field0161"));//L1.11附件 + tableField_lm5ng0sq.put("dateField_lm5ng0ti",DateUtil.dateStrToLong(String.valueOf(body.get("field0126"))));//L1.11交通日期 + tableField_lm5ng0sq.put("textField_lm5ng0tk",body.getString("field0127"));//L1.12事由 + tableField_lm5ng0sq.put("textField_lm5ng0tm",body.getString("field0128"));//L1.13交通类别 + tableField_lm5ng0sqbArr.add(tableField_lm5ng0sq); + main.put("tableField_lm5ng0sq",tableField_lm5ng0sqbArr); + } + + + //报销信息明细表(明细表2) + Object formson_0309obj = businessData.get("formson_0309"); + JSONArray formson_0309Arr = JSON.parseArray(JSON.toJSONString(formson_0309obj)); + //formson_0309 + + + + JSONArray tableField_lm5ng0tnArr = new JSONArray(); + for(Object obj : formson_0309Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5ng0tn = new JSONObject(); + tableField_lm5ng0tn.put("textField_lm5ng0tp",body.getString("field0227"));//费用类别 + tableField_lm5ng0tn.put("numberField_lm5ng0tr",body.getString("field0222"));//预估金额 + tableField_lm5ng0tn.put("numberField_lm5ng0tt",body.getString("field0228"));//年度当前可用余额 + tableField_lm5ng0tn.put("numberField_lm5ng0tv",body.getString("field0203"));//报销金额 + tableField_lm5ng0tn.put("numberField_lm5ng0tx",body.getString("field0204"));//不含税金额 + tableField_lm5ng0tn.put("textField_lm5ng0tz",body.getString("field0223"));//费用归属部门 + tableField_lm5ng0tn.put("textField_lm5ng0u1",body.getString("field0226"));//成本中心 + tableField_lm5ng0tn.put("textField_lm5ng0u3",body.getString("field0229"));//年度费用预算ID + tableField_lm5ng0tn.put("textField_lm5ng0u5",body.getString("field0230"));//预算状态 + tableField_lm5ng0tn.put("textField_lm5ng0u7",body.getString("field0231"));//费用类别ID + tableField_lm5ng0tn.put("textField_lm5ng0u9",body.getString("field0201"));//管控类型 + tableField_lm5ng0tn.put("attachmentField_lm5ng0ub",null);//发票上传 + tableField_lm5ng0tn.put("textField_lm5ng0ud",body.getString("field0253"));//票据编码 + tableField_lm5ng0tn.put("textField_lm5ng0uf",body.getString("field0254"));//费用名称 + tableField_lm5ng0tn.put("textField_lm5ng0uh",body.getString("field0255"));//发票号码 + tableField_lm5ng0tn.put("numberField_lm5ng0uj",body.getString("field0256"));//税额 + tableField_lm5ng0tn.put("numberField_lm5ng0ul",body.getString("field0257"));//税率 + tableField_lm5ng0tn.put("textField_lm5ng0un",body.getString("field0258"));//乘车人 + tableField_lm5ng0tn.put("dateField_lm5ng0up",DateUtil.dateStrToLong(String.valueOf(body.get("field0259"))));//日期 + tableField_lm5ng0tn.put("dateField_lm5ng0ur",DateUtil.dateStrToLong(String.valueOf(body.get("field0260"))));//出发时间 + tableField_lm5ng0tn.put("dateField_lm5ng0ut",DateUtil.dateStrToLong(String.valueOf(body.get("field0261"))));//到达时间 + tableField_lm5ng0tn.put("numberField_lm5ng0uv",body.getString("field0262"));//发票金额 + tableField_lm5ng0tn.put("textField_lm5ng0ux",body.getString("field0263"));//报销信息序号 + tableField_lm5ng0tnArr.add(tableField_lm5ng0tn); + main.put("tableField_lm5ng0tn",tableField_lm5ng0tnArr); + } + + + //汇款信息明细表(明细表3) + Object formson_0311obj = businessData.get("formson_0311"); + JSONArray formson_0311Arr = JSON.parseArray(JSON.toJSONString(formson_0311obj)); + //formson_0311 + + + + JSONArray tableField_lm5ng0uybArr = new JSONArray(); + for(Object obj : formson_0311Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5ng0uy = new JSONObject(); + tableField_lm5ng0uy.put("textField_lm5ng0v0",body.getString("field0213"));//汇款信息序号 + tableField_lm5ng0uy.put("textField_lm5ng0v2",body.getString("field0214"));//付款方式 + tableField_lm5ng0uy.put("numberField_lm5ng0v4",body.getString("field0215"));//付款金额 + tableField_lm5ng0uy.put("textField_lm5ng0v6",body.getString("field0265"));//付款方开户名称 + tableField_lm5ng0uy.put("textField_lm5ng0v8",body.getString("field0266"));//付款方账号 + tableField_lm5ng0uy.put("textField_lm5ng0va",body.getString("field0216"));//收款人开户名称 + tableField_lm5ng0uy.put("textField_lm5ng0vc",body.getString("field0218"));//收款人账号 + tableField_lm5ng0uybArr.add(tableField_lm5ng0uy); + main.put("tableField_lm5ng0uy", tableField_lm5ng0uybArr); + } + + data.put("formDataJson",main.toString()); + data.put("userId",businessDatamain.get("field0279")); + data.put("appType","APP_LLACU34DHTK2F07IEYVB"); + data.put("systemToken","IT5662C1PXUCS1NV6E40B61DNPLQ2PL30AQKLVA"); + data.put("formUuid","FORM-4V966QC1U7ZDP7WVBLX9EDIYNM7U2P1SFN5ML1"); + return data; + } + + /** + * 开票申请 + * @param businessData + * @param formApp + * @return + */ + private JSONObject boundDataInv(Map businessData, String formApp)throws Exception { + JSONObject data = new JSONObject(); + //todo 所有日期传递时间戳 + //组装主表数据 + Object mainObj = businessData.get("formmain_0331"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject main = new JSONObject(); + main.put("textField_lm4pqj9b",businessDatamain.get("field0117"));//单据编号 + main.put("textField_lm4pqj9d",businessDatamain.get("field0113"));//关联合同档案 + + JSONArray field0115Arr = new JSONArray(); + String field0115 = businessDatamain.get("field0136").toString();//这个存放的直接定钉钉主键,固直接用field0136 + field0115Arr.add(field0115); + main.put("employeeField_lm4pqj9f",field0115Arr);//申请人 + main.put("dateField_lm4pqj9g",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0114"))));//申请日期 + + JSONArray field0144Arr = new JSONArray(); + String field0144 = businessDatamain.get("field0144").toString(); + field0144Arr.add(field0144); + + main.put("departmentSelectField_lm4pqj9h",field0144Arr);//申请人部门 + main.put("textField_lm4pqj9j",businessDatamain.get("field0112"));//申请人电话 + main.put("textField_lm4pqj9l",businessDatamain.get("field0108"));//开票公司 + main.put("textField_lm4pqj9n",businessDatamain.get("field0137"));//税控发票类型 + main.put("textField_lm4pqj9p",businessDatamain.get("field0111"));//收件人邮箱 + main.put("textField_lm4pqj9r",businessDatamain.get("field0106"));//客户名称 + main.put("textField_lm4pqj9t",businessDatamain.get("field0105"));//税号 + main.put("textField_lm4pqj9v",businessDatamain.get("field0103"));//开户行 + main.put("textField_lmefk8vz",businessDatamain.get("field0102"));//账号 + main.put("textField_lm4pqj9x",businessDatamain.get("field0100"));//地址 + main.put("textField_lm4pqj9z",businessDatamain.get("field0101"));//电话 + main.put("textField_lm4pqja1",businessDatamain.get("field0098"));//发票代码 + main.put("textField_lm4pqja3",businessDatamain.get("field0141"));//是否含税录入 + main.put("numberField_lm4pqja5",businessDatamain.get("field0094"));//合计不含税金额 + main.put("numberField_lm4pqja7",businessDatamain.get("field0095"));//合计含税金额 + main.put("numberField_lm4pqja9",businessDatamain.get("field0096"));//价税合计 + main.put("textareaField_lm4pqjad",businessDatamain.get("field0092"));//发票备注 + main.put("textField_lm4pqjaf",businessDatamain.get("field0142"));//是否邮寄 + main.put("textareaField_lm4pqjah",businessDatamain.get("field0090"));//开票说明 + main.put("numberField_lm4pqjaj",businessDatamain.get("field0121"));//本次开票数量合计 + String field0123 = String.valueOf(businessDatamain.get("field0123")); + main.put("dateField_lm4pqjal",DateUtil.dateStrToLong(field0123));//合同签订日期 + main.put("textField_lm4pqjan",businessDatamain.get("field0138"));//业务板块一级 + main.put("textField_lm4pqjap",businessDatamain.get("field0139"));//业务板块二级 + main.put("textField_lm4pqjar",businessDatamain.get("field0126"));//邮寄地址 + main.put("textField_lm4pqjat",businessDatamain.get("field0132"));//借款合计大写 + main.put("numberField_lm4pqjav",businessDatamain.get("field0133"));//借款合计小写 + //销售发票明细表 + Object formson_0332obj = businessData.get("formson_0332"); + JSONArray formson_0332Arr = JSON.parseArray(JSON.toJSONString(formson_0332obj)); + + + JSONArray tableField_lm4pqjawtArr = new JSONArray(); + for(Object obj :formson_0332Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm4pqjaw = new JSONObject(); + tableField_lm4pqjaw.put("textField_lm4pqjay",body.getString("field0079"));//序号 + tableField_lm4pqjaw.put("textField_lm4pqjb0",body.getString("field0080"));//合同标的物名称 + tableField_lm4pqjaw.put("textField_lm4pqjb2",body.getString("field0081"));//标的物编码 + tableField_lm4pqjaw.put("textField_lm4pqjb4",body.getString("field0083"));//规格型号 + tableField_lm4pqjaw.put("numberField_lm4pqjb6",body.getString("field0084"));//数量 + tableField_lm4pqjaw.put("numberField_lm4pqjb8",body.getString("field0122"));//本次开票数量 + tableField_lm4pqjaw.put("numberField_lm4pqjba",body.getString("field0085"));//单价 + tableField_lm4pqjaw.put("numberField_lm4pqjbc",body.getString("field0086"));//不含税金额 + tableField_lm4pqjaw.put("numberField_lm4pqjbe",body.getString("field0087"));//含税金额 + tableField_lm4pqjaw.put("numberField_lm4pqjbg",body.getString("field0118"));//税率 + tableField_lm4pqjaw.put("textField_lm4pqjbi",body.getString("field0119"));//税务编码 + tableField_lm4pqjawtArr.add(tableField_lm4pqjaw); + main.put("tableField_lm4pqjaw",tableField_lm4pqjawtArr); + } + + Object formson_0365obj = businessData.get("formson_0365"); + JSONArray formson_0365Arr = JSON.parseArray(JSON.toJSONString(formson_0365obj)); + //formson_0365 + JSONArray tableField_lm4pqjbjArr = new JSONArray(); + for(Object obj :formson_0365Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm4pqjbj = new JSONObject(); + tableField_lm4pqjbj.put("textField_lm4pqjbl",body.getString("field0127"));//序号1 + tableField_lm4pqjbj.put("textField_lm4pqjbn",body.getString("field0128"));//借款日期 + tableField_lm4pqjbj.put("numberField_lm4pqjbp",body.getString("field0129"));//借款金额 + tableField_lm4pqjbj.put("textField_lm4pqjbr",body.getString("field0130"));//借款单 + tableField_lm4pqjbj.put("textareaField_lm4pqjbt",body.getString("field0131"));//用途 + tableField_lm4pqjbjArr.add(tableField_lm4pqjbj); + main.put("tableField_lm4pqjbj",tableField_lm4pqjbjArr); + } + + + data.put("formDataJson",main.toString()); + data.put("userId",businessDatamain.get("field0136")); + data.put("appType","APP_LLACU34DHTK2F07IEYVB"); + data.put("systemToken","IT5662C1PXUCS1NV6E40B61DNPLQ2PL30AQKLVA"); + data.put("formUuid","FORM-ZK866D911PWD088REOMK541LMX6E30J5QP4MLI"); + return data; + } + + /** + * 对公付款单 + * @param businessData + * @param formApp + * @return + */ + private JSONObject boundDataPay(Map businessData, String formApp)throws Exception { + JSONObject data = new JSONObject(); + //todo 所有日期传递时间戳 + //组装主表数据 + Object mainObj = businessData.get("formmain_0327"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject main = new JSONObject(); + main.put("textField_lm4os547",businessDatamain.get("field0146"));//单据编号 + main.put("textField_lm4os549",businessDatamain.get("field0034"));//关联合同编号 + JSONArray field0236Arr = new JSONArray(); + String field0236 = businessDatamain.get("field0236").toString(); + field0236Arr.add(field0236); + //申请人需要单独处理 传递钉钉ID,格式为["user01","user02"] 存放钉钉主键 + main.put("employeeField_lm4os54b",field0236Arr);//申请人 +// String field0041 = businessDatamain.get("field0041").toString(); +// Long field0041long = null ; +// if(StrUtil.isNotEmpty(field0041)){ +// field0041long = DateUtil.stringToDate(field0041,"yyyy-MM-dd HH:mm:ss").getTime(); +// } + main.put("dateField_lm4os54j",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0041"))));//申请日期 + main.put("textField_lm4os54l",businessDatamain.get("field0110"));//申请人电话 + JSONArray field0253Arr = new JSONArray(); + String field0253 = businessDatamain.get("field0253").toString(); + field0253Arr.add(field0253); + main.put("departmentSelectField_lm4os54n",field0253Arr);//申请人部门 + + main.put("textField_lm4os54u",businessDatamain.get("field0116"));//入账公司 + main.put("textField_lm4os54w",businessDatamain.get("field0239"));//付款类型一级 + main.put("textField_lm4os54y",businessDatamain.get("field0240"));//付款类型二级 + main.put("textField_lm4os550",businessDatamain.get("field0119"));//供应商 + main.put("textField_lm4os552",businessDatamain.get("field0121"));//本次付款金额 + main.put("textField_lm4os554",businessDatamain.get("field0122"));//本次付款比例 + main.put("textField_lm4os556",businessDatamain.get("field0242"));//是否固定金额 + main.put("numberField_lm4os55a",businessDatamain.get("field0123"));//合同总金额 + main.put("textareaField_lm4os55c",businessDatamain.get("field0124"));//报账说明 + main.put("attachmentField_lm4os55e","");//附件 + main.put("textField_lm4os55g",businessDatamain.get("field0149"));//公司编码 + main.put("textField_lm4os55i",businessDatamain.get("field0151"));//供应商编码 + main.put("textField_lm4os55k",businessDatamain.get("field0152"));//户名 + main.put("textField_lm4os55s",businessDatamain.get("field0153"));//开户行编码 + main.put("textField_lm4os55u",businessDatamain.get("field0154"));//开户行名称 + main.put("textField_lm4os55w",businessDatamain.get("field0155"));//账号 +// String field0158 = businessData.get("field0158").toString(); +// Long field0158long = null ; +// if(StrUtil.isNotEmpty(field0158)){ +// field0158long = DateUtil.stringToDate(field0158,"yyyy-MM-dd HH:mm:ss").getTime(); +// } + main.put("dateField_lm4os55y",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0158"))));//合同签订日期 + main.put("textField_lm4os560",businessDatamain.get("field0238"));//是否有合同 + main.put("textField_lm4os562",businessDatamain.get("field0166"));//合同已付金额 + main.put("numberField_lm4os564",businessDatamain.get("field0167"));//发票已收金额 + main.put("numberField_lm4os566",businessDatamain.get("field0168"));//审批中付款金额 + main.put("numberField_lm4os568",businessDatamain.get("field0169"));//审批中已收发票金额 + main.put("textField_lm4os56a",businessDatamain.get("field0184"));//发票金额合计大写 + main.put("numberField_lm4os56c",businessDatamain.get("field0185"));//发票金额合计小写 + main.put("textField_lm4os56e",businessDatamain.get("field0186"));//项目编码 + main.put("textField_lm4os56g",businessDatamain.get("field0243"));//业务场景 + main.put("textField_lm4os56i",businessDatamain.get("field0244"));//是否多项目 + main.put("attachmentField_lm4os56k",null);//合同附件 + main.put("textField_lm4os56m",businessDatamain.get("field0201"));//借款合计大写 + main.put("numberField_lm4os56o",businessDatamain.get("field0202"));//借款合计小写 + main.put("textField_lm4os56q",businessDatamain.get("field0208"));//借款合计大写1 + main.put("numberField_lm4os56s",businessDatamain.get("field0209"));//借款合计小写1 + //汇款信息明细表(明细表1) + Object formson_0329obj = businessData.get("formson_0329"); + JSONArray formson_0329Arr = JSON.parseArray(JSON.toJSONString(formson_0329obj)); + //formson_0329 + JSONArray tableField_lm4os56tArr = new JSONArray(); + //循环拼接汇款明细数据 + for(Object obj :formson_0329Arr){ + JSONObject formson_0329 = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm4os56t = new JSONObject(); + tableField_lm4os56t.put("textField_lm4os56v",formson_0329.get("field0133"));//汇款信息序号 + tableField_lm4os56t.put("textField_lm4os56x",formson_0329.get("field0134"));//付款方式 + tableField_lm4os56t.put("numberField_lm4os56z",formson_0329.get("field0135"));//付款金额 + tableField_lm4os56t.put("textField_lm4os571",formson_0329.get("field0136"));//收款单位 + tableField_lm4os56t.put("textField_lm4os573",formson_0329.get("field0137"));//付款账号 + tableField_lm4os56tArr.add(tableField_lm4os56t); + } + main.put("tableField_lm4os56t",tableField_lm4os56tArr); + //扣款信息明细表(明细表2) + Object formson_0330obj = businessData.get("formson_0330"); + JSONArray formson_0330Arr = JSON.parseArray(JSON.toJSONString(formson_0330obj)); + //formson_0330 + JSONArray tableField_lm4os574Arr = new JSONArray(); + for(Object obj :formson_0330Arr){ + JSONObject formson_0330 = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm4os574 = new JSONObject(); + tableField_lm4os574.put("textField_lm4os576",formson_0330.get("field0140"));//一级支出类别 + tableField_lm4os574.put("textField_lm4os578",formson_0330.get("field0147"));//隐藏-扣款信息款项类别二级 + tableField_lm4os574.put("textField_lm4os57a",formson_0330.get("field0142"));//项目号 + tableField_lm4os574.put("numberField_lm4os57e",formson_0330.get("field0143"));//不含税金额 + tableField_lm4os574.put("numberField_lm4os57g",formson_0330.get("field0144"));//含税金额 + tableField_lm4os574.put("numberField_lm4os57i",formson_0330.get("field0145"));//价税合计 + tableField_lm4os574.put("textField_lm4os57k",formson_0330.get("field0163"));//扣款信息序号 + tableField_lm4os574Arr.add(tableField_lm4os574); + main.put("tableField_lm4os574",tableField_lm4os574Arr); + } + + //发票明细表(明细表3) + Object formson_0348obj = businessData.get("formson_0348"); + JSONArray formson_0348Arr = JSON.parseArray(JSON.toJSONString(formson_0348obj)); + //formson_0348 + JSONArray tableField_lm4os57lArr = new JSONArray(); + for(Object obj :formson_0348Arr){ + JSONObject formson_0348 = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm4os57l = new JSONObject(); + tableField_lm4os57l.put("textField_lm4os57n",formson_0348.get("field0170"));//发票信息序号 + tableField_lm4os57l.put("textField_lm4os57p",formson_0348.get("field0171"));//发票号码 + tableField_lm4os57l.put("textField_lm4os57r",formson_0348.get("field0172"));//发票代码 + tableField_lm4os57l.put("numberField_lm4os57t",formson_0348.get("field0173"));//发票金额 + tableField_lm4os57l.put("numberField_lm4os57v",formson_0348.get("field0174"));//发票税额 + tableField_lm4os57l.put("attachmentField_lm4os57x","");//上传发票 + tableField_lm4os57l.put("textField_lm4os57z",formson_0348.get("field0179"));//售方名称 + tableField_lm4os57l.put("textField_lm4os581",formson_0348.get("field0180"));//购方名称 + tableField_lm4os57l.put("textField_lm4os583",formson_0348.get("field0181"));//购方税号 + tableField_lm4os57l.put("textField_lm4os585",formson_0348.get("field0182"));//发票入账公司 + tableField_lm4os57l.put("textField_lm4os587",formson_0348.get("field0183"));//税号 + tableField_lm4os57l.put("textField_lm4os58b",formson_0348.get("field0188"));//发票类型 + tableField_lm4os57lArr.add(tableField_lm4os57l); + main.put("tableField_lm4os57l",tableField_lm4os57lArr); + } + + //项目明细表(明细表4) + Object formson_0354obj = businessData.get("formson_0354"); + JSONArray formson_0354Arr = JSON.parseArray(JSON.toJSONString(formson_0354obj)); + //formson_0354 + + JSONArray tableField_lm4os58cArr = new JSONArray(); + for(Object obj :formson_0354Arr){ + JSONObject formson_0354 = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm4os58c = new JSONObject(); + tableField_lm4os58c.put("textField_lm4os57n",formson_0354.getString("field0192"));//项目信息序号 + tableField_lm4os58c.put("textField_lm4os57p",formson_0354.getString("field0191"));//项目明细表项目 + tableField_lm4os58c.put("textField_lm4os57r",formson_0354.getString("field0193"));//发票拆分金额 + tableField_lm4os58cArr.add(tableField_lm4os58c); + main.put("tableField_lm4os58c",tableField_lm4os58cArr); + } + data.put("formDataJson",main.toString()); + data.put("userId",businessDatamain.get("field0236")); +// data.put("userId","182411126520375411"); + data.put("appType","APP_LLACU34DHTK2F07IEYVB"); + data.put("systemToken","IT5662C1PXUCS1NV6E40B61DNPLQ2PL30AQKLVA"); + data.put("formUuid","FORM-JD8668C1KMYDNNEW6OPQE8M8K2YU2SJURO4ML0"); +// return null; + return data; + } + + /** + * 出差申请单 + * @param businessData + * @param formApp + * @return + */ + private JSONObject boundDataBusinessTravel(Map businessData, String formApp) { + JSONObject data = new JSONObject(); + //todo 所有日期传递时间戳 + //组装主表数据 + Object mainObj = businessData.get("formmain_0302"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + + JSONObject main = new JSONObject(); + main.put("textField_lm5n374e",businessDatamain.get("field0001"));//单据编号 + JSONArray field0085Arr = new JSONArray(); + String field0085 = businessDatamain.get("field0085").toString(); + field0085Arr.add(field0085); + //申请人需要单独处理 传递钉钉ID,格式为["user01","user02"] 存放钉钉主键 + main.put("employeeField_lm5n374g",field0085Arr);//申请人 + main.put("dateField_lm5n374i",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0027"))));//申请日期 + + JSONArray field0088Arr = new JSONArray(); + String field0088 = businessDatamain.get("field0088").toString(); + field0088Arr.add(field0088); + + main.put("departmentSelectField_lm5n374j",field0088Arr);//申请人部门 + main.put("textField_lm5n374k",businessDatamain.get("field0030"));//电话 + main.put("textField_lm5n374m",businessDatamain.get("field0086"));//入账公司 + main.put("textField_lm5n374o",businessDatamain.get("field0032"));//出差国别 + main.put("dateField_lm5n374q",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0036"))));//出差开始时间 + main.put("dateField_lm5n374s",DateUtil.dateStrToLong(String.valueOf(businessDatamain.get("field0038"))));//出差结束时间 + main.put("numberField_lm5n374u",businessDatamain.get("field0039"));//出差天数 + main.put("textField_lm5n374w",businessDatamain.get("field0059"));//选择商旅账号 + main.put("textField_lm5n374y",businessDatamain.get("field0064"));//出差事由 + main.put("textField_lm5n3750",businessDatamain.get("field0065"));//公司编码 + main.put("textField_lm5n3752",businessDatamain.get("field0031"));//项目名称 + main.put("textField_lm5n3754",businessDatamain.get("field0006"));//出发地 + main.put("textField_lm5n3756",businessDatamain.get("field0007"));//目的地 + main.put("textField_lm5n3758",businessDatamain.get("field0079"));//项目 + main.put("textField_lm5n375a",businessDatamain.get("field0080"));//项目编码 + + //行程信息(明细表1) + Object formson_0303obj = businessData.get("formson_0303"); + JSONArray formson_0303Arr = JSON.parseArray(JSON.toJSONString(formson_0303obj)); + //formson_0303 + JSONArray tableField_lm5n375bArr = new JSONArray(); + for(Object obj : formson_0303Arr){ + JSONObject body = JSON.parseObject(JSON.toJSONString(obj)); + JSONObject tableField_lm5n375b = new JSONObject(); + tableField_lm5n375b.put("textField_lm5n375d",body.getString("field0072"));//序号 + tableField_lm5n375b.put("textField_lm5n375f",body.getString("field0050"));//费用名称 + tableField_lm5n375b.put("textField_lm5n375h",body.getString("field0070"));//行程类别 + tableField_lm5n375b.put("textField_lm5n375j",body.getString("field0071"));//是否往返 + tableField_lm5n375b.put("employeeField_lm5n375l",body.getString("field0073"));//出行人员 + tableField_lm5n375b.put("dateField_lm5n375n",DateUtil.dateStrToLong(String.valueOf(body.get("field0074"))));//开始时间 + tableField_lm5n375b.put("dateField_lm5n375p",DateUtil.dateStrToLong(String.valueOf(body.get("field0074"))));//结束时间 + tableField_lm5n375b.put("textField_lm5n375r",body.getString("field0076"));//出发城市 + tableField_lm5n375b.put("textField_lm5n375t",body.getString("field0077"));//到达城市 + tableField_lm5n375b.put("textField_lm5n375v",body.getString("field0041"));//费用归属部门 + tableField_lm5n375b.put("numberField_lm5n375x",body.getString("field0046"));//金额 + tableField_lm5n375b.put("textField_lm5n375z",body.getString("field0048"));//备注 + tableField_lm5n375b.put("textField_lm5n3761",body.getString("field0066"));//费用类别ID + tableField_lm5n375b.put("textField_lm5n3763",body.getString("field0082"));//是否线下预定 + tableField_lm5n375bArr.add(tableField_lm5n375b); + main.put("tableField_lm5n375b",tableField_lm5n375bArr); + } + + + + data.put("formDataJson",main.toString()); + data.put("userId",businessDatamain.get("field0085")); + data.put("appType","APP_LLACU34DHTK2F07IEYVB"); + data.put("systemToken","IT5662C1PXUCS1NV6E40B61DNPLQ2PL30AQKLVA"); + data.put("formUuid","FORM-JH9660C1NWYD9IFGCZAJT6P8F6TT25GY2N5ML3"); + return data; + } + + @Override + public JsonResultEntity thirdInterfaceInitBipSupplierToOa(JSONObject jsonObject) throws Exception { + + logger.info("执行同步供应商方法"); + + String bipApiId = "a0a64273e60b4ccdb245683dfefdade5"; + JSONObject bipResult = iExcApiService.execute(bipApiId); + logger.info("bip数据" + bipResult.toJSONString()); + // + JSONArray attributes = bipResult.getJSONArray("attribute"); + + ApplicationContextUtil.getBeanByClass(IExcApiService.class); +// ApplicationContextUtil.getBeanByName("seeYonInterFace222"); +// ApplicationContextUtil.getBeanByClass(ISeeYonInterFace.class); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("type", "archives"); + jsonObject1.put("templateCode", "formmain_0360"); + jsonObject1.put("attribute", attributes); + JSONObject req = new JSONObject(); + req.put("jsonStr", jsonObject1.toJSONString()); + thirdInterfaceSend(req); + + return BaseResult.getSuccessMessageEntity("同步供应商成功"); + } + + /** + * 通过关联关系获取附件主键 + * @param sub_reference + * @return + */ + @Override + public List getFileUrl(String sub_reference) { + SeeyonEntity seeyonEntity = new SeeyonEntity(); + if(StrUtil.isNotEmpty(sub_reference)){ + seeyonEntity.setSub_reference(sub_reference); + return seeYonDao.selectFileUrl(seeyonEntity); + } + return null; + } + + + //通知单审批通过 + private String ddApproveFinish(Map businessData) { + JSONObject finishData = new JSONObject(); + String to_time = null ; + String from_time = null; + if(null != businessData.get("field0036")){ + from_time = DateUtil.dateToString(Long.valueOf(businessData.get("field0036").toString()),"YYYY-MM-dd"); + } + if(null != businessData.get("field0038")){ + to_time = DateUtil.dateToString(Long.valueOf(businessData.get("field0038").toString()),"YYYY-MM-dd"); + } + finishData.put("userid",businessData.get("field0083")); + finishData.put("biz_type","2"); + finishData.put("from_time",from_time); + finishData.put("to_time",to_time); + finishData.put("duration_unit","day"); + finishData.put("tag_name","出差"); + finishData.put("calculate_model","1"); + //出差单ID + finishData.put("approve_id","approve_id"); + //出差单URL,和钉钉确认不处理 + finishData.put("jump_url","jump_url"); + JSONObject ddData = new JSONObject(); + ddData.put("code","0002"); + ddData.put("data",finishData.toJSONString()); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("jsonStr",ddData.toJSONString()); + return iddInterfaceService.senddd(jsonObject); + } + + @Override + public JsonResultEntity thirdInterfacegetOADataByType(JSONObject requestData) { + if (StrUtil.isBlank(LAST_SYNCHRONISED_TIME)) { + LAST_SYNCHRONISED_TIME = cn.hutool.core.date.DateUtil.now(); + } + //暂存时间 + String tempTime = LAST_SYNCHRONISED_TIME; + //返回主表信息 + SeeyonEntity seeyon = new SeeyonEntity(); + seeyon.setTableName("formmain_0323"); + seeyon.setUpdateTime(tempTime); + List seeyonEntityList = seeYonDao.selectOAListByTypeMain(seeyon); + //如果返回数据不为空,则继续查询相关明细信息 + if (null != seeyonEntityList && seeyonEntityList.size() > 0) { + // 设置上一次同步时间 + LAST_SYNCHRONISED_TIME = cn.hutool.core.date.DateUtil.now(); + for (SeeyonEntity s : seeyonEntityList) { + //获取合同标的物明细(明细表1) + List formson0324List = seeYonDao.selectOAListByTypeformson_0324(s); + s.setFormson_0324(formson0324List); + //相对方(明细表2) + List formson0352List = seeYonDao.selectOAListByTypeformson_0352(s); + s.setFormson_0352(formson0352List); +// seeYonDao.updateFormStete(s); + } + } + return BaseResult.getSuccessMessageEntity("数据获取成功", seeyonEntityList); + } + + // @Test + public void testSaveNoProcess() { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code", "03000119"); + jsonObject.put("name", "杭州陶瓷品市场亮晶晶酒店用品商行"); + JSONArray jsonArray = new JSONArray(); + JSONObject details1 = new JSONObject(); + details1.put("序号1", 1); + details1.put("账户类型", "基本户"); + details1.put("开户行名称", "开户行名称"); + details1.put("银行账号", "123"); + + JSONObject details2 = new JSONObject(); + details2.put("序号1", 2); + details2.put("账户类型", "基本户"); + details2.put("开户行名称", "开户行名称"); + details2.put("银行账号", "123"); + jsonArray.add(details1); + jsonArray.add(details2); + jsonObject.put("details", jsonArray); + //System.out.println(jsonObject.toJSONString()); + String dataXml = createTempData(jsonObject,CREATEARCHIVES); + String loginName = "seeyon"; + Map res = new HashMap(); + res.put("loginName", loginName); + res.put("dataXml", dataXml); + JsonResultEntity result = saveNoProcess("formmain_0360", UPDATEARCHIVES,loginName, dataXml); + logger.info("发起无流程表单结果:" + result); + } + + private String createTempData(JSONObject jsonObject, String type) { + String detailsStr = jsonObject.getString("details"); + StringBuffer stringBuffer = null; + if (!StringUtils.isEmpty(detailsStr)) { + List attributeArray = JSON.parseArray(detailsStr, JSONObject.class); + if (null != attributeArray && attributeArray.size() > 0) { + stringBuffer = new StringBuffer(); + for (JSONObject object : attributeArray) { + //如果是更新类型的,增加title标签 + if (type.equalsIgnoreCase(UPDATEARCHIVES)) { + stringBuffer.append(" "); + + //stringBuffer.append(" "); + stringBuffer.append(" <![CDATA["+UUIDLong.absLongUUID()+"]]> "); + stringBuffer.append(" <![CDATA["+UUIDLong.absLongUUID()+"]]> "); + stringBuffer.append(" <![CDATA["+UUIDLong.absLongUUID()+"]]> "); + stringBuffer.append(" <![CDATA["+UUIDLong.absLongUUID()+"]]> "); + stringBuffer.append(" "); + + } else { + + stringBuffer.append(" "); + //stringBuffer.append(" "); + stringBuffer.append("" + 1 + " "); + stringBuffer.append(""); + stringBuffer.append(" "); + stringBuffer.append(" "); + stringBuffer.append(""); + } + + } + } + + } + + String str = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n"; + if (stringBuffer != null) { + str += stringBuffer.toString(); + str += " \n" + + " \n" + + " \n" + + " \n" + + ""; + } else { + str += " \n" + + " \n" + + " \n" + + " \n" + + ""; + } + + + return str; + } + + + /** + * 组织模板 + * @param jsonObject + * @param type + * @return + */ + private String createOrgTempData(JSONObject jsonObject, String type) { + String detailsStr = jsonObject.getString("details"); + StringBuffer stringBuffer = null; + if (!StringUtils.isEmpty(detailsStr)) { + List attributeArray = JSON.parseArray(detailsStr, JSONObject.class); + if (null != attributeArray && attributeArray.size() > 0) { + stringBuffer = new StringBuffer(); + for (JSONObject object : attributeArray) { + //如果是更新类型的,增加title标签 + if (type.equalsIgnoreCase(UPDATEARCHIVES)) { + stringBuffer.append(" "); + stringBuffer.append(" <![CDATA[" + UUIDLong.absLongUUID() + "]]> "); + //stringBuffer.append(" <![CDATA[" + UUIDLong.absLongUUID() + "]]> "); + stringBuffer.append(" <![CDATA[" + UUIDLong.absLongUUID() + "]]> "); + stringBuffer.append(" <![CDATA[" + UUIDLong.absLongUUID() + "]]> "); + stringBuffer.append(" <![CDATA[" + UUIDLong.absLongUUID() + "]]> "); + stringBuffer.append(" "); + + } else { + stringBuffer.append(" "); + stringBuffer.append(" "); + // stringBuffer.append(" " + 1 + " "); + stringBuffer.append(" "); + stringBuffer.append(" "); + stringBuffer.append(" "); + stringBuffer.append(" "); + } + + } + } + + } + + String str = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " " + + " " + + " " + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n"; + if (stringBuffer != null) { + str += stringBuffer.toString(); + str += " \n" + + " \n" + + " \n" + + " \n" + + ""; + } else { + str += " \n" + + " \n" + + " \n" + + " \n" + + ""; + } + return str; + } + + //交行CFS日志 + private String createCfsTempData(JSONObject jsonObject, String type){ + String xml = ""; + String tabNameCh = StringUtil.nullConvert(jsonObject.getString("tab_name_ch")); + String tabNameEn = StringUtil.nullConvert(jsonObject.getString("tab_name_en")); + String id = StringUtil.nullConvert(jsonObject.getString("id")); + String billCode = StringUtil.nullConvert(jsonObject.getString("bill_code")); + String title = StringUtil.nullConvert(jsonObject.getString("title")); + String eventType = StringUtil.nullConvert(jsonObject.getString("event_type")); + String formApp = StringUtil.nullConvert(jsonObject.getString("form_app_id")); + String statusMsg = StringUtil.nullConvert(jsonObject.getString("status_msg")); + String serialNo = StringUtil.nullConvert(jsonObject.getString("serial_no")); + String result = StringUtil.nullConvert(jsonObject.getString("result")); + String dataXml = StrUtil.format(xml,tabNameCh,tabNameEn,id,billCode,title,eventType,formApp,statusMsg,serialNo,result); + return dataXml; + } + /*** + * + * @content:推送无流程表单同步钉钉 + * @author 👻👻👻👻👻👻👻👻 yuqh + * @date 2023年9月2日12:56:18 + * @param + * @return void + **/ + @Override + public JsonResultEntity sendConDocTodd(JSONObject requestJson) { + //todo 临时直接传递参数 + return BaseResult.getSuccessMessageEntity("传递钉钉成功→普通表单",iddInterfaceService.senddd(requestJson)); + } + /*** + * + * @content:流程表单传递钉钉 + * @author 👻👻👻👻👻👻👻👻 yuqh + * @date 2023年9月5日09:38:38 + * @param + * @return void + **/ + @Override + public JsonResultEntity sendProcessDocument(JSONObject requestJson) { + return BaseResult.getSuccessMessageEntity("传递钉钉成功→流程表单",iddInterfaceService.senddd(requestJson)); + } + + /** + * + * @content 杭泰OA付款单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/12 15:57 + * **/ + @Override + public String sendpayMentToCFS(Map businessData) { + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0327"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0146"));//OA业务主键 + //付款摘要 + StringBuffer purposeBuff = new StringBuffer("付"); + Object formson_0329obj = businessData.get("formson_0329"); + JSONArray formson0329List = JSON.parseArray(JSON.toJSONString(formson_0329obj)); + boolean flag = false; + if (formson0329List != null && formson0329List.size() > 0) { + JSONArray formson0329Array = new JSONArray(); + for (Object o : formson0329List) { + JSONObject formson_0330Json = JSON.parseObject(JSON.toJSONString(o)); + //判断开户银行是否是交通银行 + if(null !=formson_0330Json.getString("field0211") && (formson_0330Json.getString("field0211").contains("交通银行") || formson_0330Json.getString("field0211").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails = new JSONObject(); + jsonObjectDetails.put("payerAccName", businessDatamain.getString("field0116"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo", formson_0330Json.getString("field0137"));//转出方账号 + jsonObjectDetails.put("curCode", "CNY");//付款方币种 + jsonObjectDetails.put("payeeAccName", formson_0330Json.getString("field0136"));//收款人帐户名称 + purposeBuff.append(formson_0330Json.getString("field0136")); + jsonObjectDetails.put("payeeAccNo", formson_0330Json.getString("field0210"));//收款人帐户号 + jsonObjectDetails.put("amount", formson_0330Json.getString("field0135"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode", formson_0330Json.getString("field0257"));//收款人联行号 + jsonObjectDetails.put("payType", "34");//结算方式 + jsonObjectDetails.put("businessType", "04");//业务类别 + jsonObjectDetails.put("isForindividual", "0");//是否对私付款 + jsonObjectDetails.put("creditByCustomer", businessDatamain.getString("field0149"));//贷方客商辅助核算编码 + jsonObjectDetails.put("debitByBankAcc", formson_0330Json.getString("field0137"));//借方银行账户辅助核算编码 + String isQuick = null; + if (null !=formson_0330Json.getBigDecimal("field0135") && formson_0330Json.getBigDecimal("field0135").compareTo(BigDecimal.valueOf(50000)) == 1) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick", isQuick);//加急标志 + formson0329Array.add(jsonObjectDetails); + map.put("details", formson0329Array); + } + } + purposeBuff.append("对公付款单款项,单据号-"); + purposeBuff.append(businessDatamain.getString("field0146")); + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr", map); + logger.info("对公付款单传递CFS在SeeYonInterFaceImpl中的请求参数为:"+JSONObject.toJSONString(jsonObject)); + String result = payMentService.sendOAPayMentToCFS(jsonObject,"pay"); + //String result="{\"statusMsg\":\"当前为对公交易,收款方联行号不能为空!\",\"erpVoucherNoCfs\":\"DG202402280158\",\"serialNo\":\"\"}"; + logger.info("对公付款单传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新付款单推送标识----------"); + //更新付款单的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0327"); + seeyonEntity.setPushField("field0255"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("付款信息保存成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) && (null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------付款单推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------付款单推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + logger.info("杭泰OA付款单数据获取失败,原因为:"+e.getMessage()); + } + return null; + } + + /** + * + * @content 杭泰OA报销单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/10/16 15:27 + * **/ + @Override + public String sendBusinessExpenseToCFS(Map businessData,String formApp) { + try { + String result=null; + switch (formApp){ + case "-321958445006631163"://差旅报销单 + result= travelReimbursement(businessData,formApp); + break; + case "-4485599744122928342"://招待报销单 + result= hospitalityReimbursement(businessData,formApp); + break; + case "4728403652378707515"://日常报销单 + result=routineReimbursement(businessData,formApp); + break; + default: + break; + } + return result; + }catch (Exception e){ + e.printStackTrace(); + logger.info("杭泰报销单失败:{}"+e.getMessage()); + } + return null; + } + + //差旅报销单 + private String travelReimbursement(Map businessData, String formApp){ + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0307"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0094"));//OA业务主键 + StringBuffer purposeBuff = new StringBuffer("付"); + Object formson0311Obj = businessData.get("formson_0311"); + JSONArray formson_0311List = JSON.parseArray(JSON.toJSONString(formson0311Obj)); + boolean flag=false; + if(formson_0311List!=null && formson_0311List.size()>0){ + JSONArray formson_0311Array = new JSONArray(); + for (Object o : formson_0311List) { + JSONObject formson_0311Json = JSON.parseObject(JSON.toJSONString(o)); + if(null !=formson_0311Json.getString("field0265") && (formson_0311Json.getString("field0265").contains("交通银行") || formson_0311Json.getString("field0265").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails=new JSONObject(); + //根据收款方id查询收款方名称 + SeeyonEntity seeyonEntity = new SeeyonEntity(); + seeyonEntity.setId(businessDatamain.getString("field0015")); + List seeyonEntities = seeYonDao.selectOAListByField0258(seeyonEntity); + if (seeyonEntities.size() > 0) { + jsonObjectDetails.put("payeeAccName", seeyonEntities.get(0).getName());//收款人帐户名称 + } else { + jsonObjectDetails.put("payeeAccName", businessDatamain.getString("field0015"));//收款人帐户名称 + } + jsonObjectDetails.put("payerAccName",businessDatamain.getString("field0188"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo",formson_0311Json.getString("field0266"));//转出方账号 + jsonObjectDetails.put("curCode","CNY");//付款方币种 + //jsonObjectDetails.put("payeeAccName",formson_0311Json.getString("field0313"));//收款人帐户名称 + purposeBuff.append(jsonObjectDetails.getString("payeeAccName")); + jsonObjectDetails.put("payeeAccNo",formson_0311Json.getString("field0218"));//收款人帐户号 + jsonObjectDetails.put("amount",formson_0311Json.getString("field0215"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode",formson_0311Json.getString("field0311"));//收款人联行号 + jsonObjectDetails.put("payType","34");//结算方式 + String isQuick=null; + if (null !=formson_0311Json.getBigDecimal("field0215") && formson_0311Json.getBigDecimal("field0215").compareTo(BigDecimal.valueOf(50000)) == 1) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick",isQuick);//加急标志 + formson_0311Array.add(jsonObjectDetails); + map.put("details",formson_0311Array); + } + } + purposeBuff.append("差旅报销款项,单据号-"); + purposeBuff.append(businessDatamain.getString("field0094")); + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr",map); + String result= payMentService.sendExpenseToCFS(jsonObject); + //String result="{\"statusMsg\":\"成功\",\"erpVoucherNoCfs\":\"-9050113785393100178\",\"serialNo\":\"1111\"}"; + logger.info("差旅报销单传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新差旅报销单推送标识----------"); + //更新付款单的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0307"); + seeyonEntity.setPushField("field0309"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("报销交易信息验证成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) && (null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------差旅报销单推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------差旅报销单推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + e.printStackTrace(); + logger.info("差旅报销单开始从SeeYonInterFaceImpl传递CFS失败,原因为:{}",e.getMessage()); + } + return null; + } + + //招待报销单 + private String hospitalityReimbursement(Map businessData, String formApp){ + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0294"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0053"));//OA业务主键 + StringBuffer purposeBuff = new StringBuffer("付"); + Object formson_0297Obj = businessData.get("formson_0297"); + JSONArray formson_0297List = JSON.parseArray(JSON.toJSONString(formson_0297Obj)); + boolean flag=false; + if(formson_0297List!=null && formson_0297List.size()>0){ + JSONArray formson0297Array = new JSONArray(); + for (Object o : formson_0297List) { + JSONObject formson_0297Json = JSON.parseObject(JSON.toJSONString(o)); + if(null != formson_0297Json.getString("field0098") && (formson_0297Json.getString("field0098").contains("交通银行") || formson_0297Json.getString("field0098").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails=new JSONObject(); + //根据收款方id查询收款方名称 + SeeyonEntity seeyonEntity = new SeeyonEntity(); + seeyonEntity.setId(businessDatamain.getString("field0002")); + List seeyonEntities = seeYonDao.selectOAListByField0258(seeyonEntity); + if (seeyonEntities.size() > 0) { + jsonObjectDetails.put("payeeAccName", seeyonEntities.get(0).getName());//收款人帐户名称 + } else { + jsonObjectDetails.put("payeeAccName", businessDatamain.getString("field0002"));//收款人帐户名称 + } + jsonObjectDetails.put("payerAccName",businessDatamain.getString("field0080"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo",formson_0297Json.getString("field0073"));//转出方账号 + jsonObjectDetails.put("curCode","CNY");//付款方币种 + //jsonObjectDetails.put("payeeAccName",formson_0297Json.getString("field0178"));//收款人帐户名称 + purposeBuff.append(jsonObjectDetails.getString("payeeAccName")); + jsonObjectDetails.put("payeeAccNo",formson_0297Json.getString("field0136"));//收款人帐户号 + jsonObjectDetails.put("amount",formson_0297Json.getString("field0100"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode",formson_0297Json.getString("field0176"));//收款人联行号 + jsonObjectDetails.put("payType","34");//结算方式 + String isQuick=null; + if (null !=formson_0297Json.getBigDecimal("field0100") && formson_0297Json.getBigDecimal("field0100").compareTo(BigDecimal.valueOf(50000)) == 1) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick",isQuick);//加急标志 + formson0297Array.add(jsonObjectDetails); + map.put("details",formson0297Array); + } + } + purposeBuff.append("招待报销款项,单据号-"); + purposeBuff.append(businessDatamain.getString("field0053")); + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr",map); + String result= payMentService.sendExpenseToCFS(jsonObject); + //String result="{\"statusMsg\":\"成功\",\"erpVoucherNoCfs\":\"-9050113785393100178\",\"serialNo\":\"1111\"}"; + logger.info("招待报销单传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新招待报销单推送标识----------"); + //更新付款单的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0294"); + seeyonEntity.setPushField("field0174"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("报销交易信息验证成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) && (null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------招待报销单推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------招待报销单推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + e.printStackTrace(); + logger.info("招待报销单开始从SeeYonInterFaceImpl传递CFS失败,原因为:{}",e.getMessage()); + } + return null; + } + + //日常报销单 + private String routineReimbursement(Map businessData, String formApp){ + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0314"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0220"));//OA业务主键 + StringBuffer purposeBuff = new StringBuffer("付"); + Object formson_0317Obj = businessData.get("formson_0317"); + JSONArray formson_0317List = JSON.parseArray(JSON.toJSONString(formson_0317Obj)); + boolean flag=false; + if(formson_0317List!=null && formson_0317List.size()>0){ + JSONArray formson_0317Array = new JSONArray(); + for (Object o : formson_0317List) { + JSONObject formson_0317Json = JSON.parseObject(JSON.toJSONString(o)); + if(null != formson_0317Json.getString("field0268") && (formson_0317Json.getString("field0268").contains("交通银行") || formson_0317Json.getString("field0268").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails=new JSONObject(); + //根据收款方id查询收款方名称 + SeeyonEntity seeyonEntity = new SeeyonEntity(); + seeyonEntity.setId(businessDatamain.getString("field0015")); + List seeyonEntities = seeYonDao.selectOAListByField0258(seeyonEntity); + if (seeyonEntities.size() > 0) { + jsonObjectDetails.put("payeeAccName", seeyonEntities.get(0).getName());//收款人帐户名称 + } else { + jsonObjectDetails.put("payeeAccName", businessDatamain.getString("field0015"));//收款人帐户名称 + } + jsonObjectDetails.put("payerAccName",businessDatamain.getString("field0188"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo",formson_0317Json.getString("field0269"));//转出方账号 + jsonObjectDetails.put("curCode","CNY");//付款方币种 + //jsonObjectDetails.put("payeeAccName",formson_0317Json.getString("field0299"));//收款人帐户名称 + purposeBuff.append(jsonObjectDetails.getString("payeeAccName")); + jsonObjectDetails.put("payeeAccNo",formson_0317Json.getString("field0217"));//收款人帐户号 + jsonObjectDetails.put("amount",formson_0317Json.getString("field0215"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode",formson_0317Json.getString("field0297"));//收款人联行号 + jsonObjectDetails.put("payType","34");//结算方式 + String isQuick=null; + if (null !=formson_0317Json.getBigDecimal("field0215") && formson_0317Json.getBigDecimal("field0215").compareTo(BigDecimal.valueOf(50000)) == 1) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick",isQuick);//加急标志 + formson_0317Array.add(jsonObjectDetails); + map.put("details",formson_0317Array); + } + } + purposeBuff.append("日常报销款项,单据号-"); + purposeBuff.append(businessDatamain.getString("field0220")); + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr",map); + String result= payMentService.sendExpenseToCFS(jsonObject); + logger.info("日常报销单传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新日常报销单推送标识----------"); + //更新付款单的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0314"); + seeyonEntity.setPushField("field0295"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("报销交易信息验证成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) &&(null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------日常报销单推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------日常报销单推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + e.printStackTrace(); + logger.info("日常报销单开始从SeeYonInterFaceImpl传递CFS失败,原因为:{}",e.getMessage()); + } + return null; + } + + /** + * + * @content 杭泰OA资金归集,资金拨付,同名账户划转,借款单传递CFS + * @Param + * @Return + * @Author hecan + * @Date 2023/12/20 9:12 + * **/ + @Override + public String sendOtherFourReceipt(Map map, String formApp) { + try { + String result=null; + switch (formApp){ + case "910366613209564645"://资金归集 + result= fundCollection(map,formApp); + break; + case "-102527561419044497"://资金拨付 + result=fundAllocation(map,formApp); + break; + case "-1193625514072190978"://同名账户划转 + result=accountTransfer(map,formApp); + break; + case "4645133897573090505"://借款单(借还款) + result= loanRepayment(map,formApp); + break; + default: + break; + } + return result; + }catch (Exception e){ + e.printStackTrace(); + logger.info("杭泰OA资金归集,资金拨付,同名账户划转,借款单传递CFS错误,原因为{}",e.getMessage()); + } + return null; + } + + @Override + public JsonResultEntity thirdInterfaceSeeYonDefinitionRePush(JSONObject jsonObject) throws Exception { + JSONObject requestData = jsonObject.getJSONObject("jsonStr"); + JSONArray resultEntityArray = new JSONArray(); + if(null == requestData){ + throw new BaseSystemException("参数传递错误需要jsonStr!"); + } + //表单模版ID + String formAppId = requestData.getString("formAppId"); + //事件事件类型 + String eventType = requestData.getString("eventType"); + //数据源编码 + String dataSourceCode = requestData.getString("dataSourceCode"); + //主表ID集合 formMainIds + JSONArray formMainIds = requestData.getJSONArray("formMainIds"); + if(StrUtil.isEmpty(eventType)){ + throw new BaseSystemException("需要传递eventType 参照致远OA事件!"); + } + if(StrUtil.isEmpty(formAppId)){ + throw new BaseSystemException("需要传递formAppId 参照致远OA 表 CAP_FORM_DEFINITION!"); + } + if(StrUtil.isEmpty(dataSourceCode)){ + throw new BaseSystemException("需要传递dataSourceCode 参照中台表 sys_data_source!"); + } + if(null == formMainIds || formMainIds.size() == 0){ + throw new BaseSystemException("需要传递业务主表数据id集合,不允许全量推送!"); + } + + SeeYonInterFaceEntity seeYonInterFaceEntity = new SeeYonInterFaceEntity(); + BeanUtil.copyProperties(requestData,seeYonInterFaceEntity); + List seeYonInterFaceEntityList = seeYonInterFaceDao.queryDefinitionInfo(seeYonInterFaceEntity); + System.out.println(seeYonInterFaceEntityList); + if(null != seeYonInterFaceEntityList && seeYonInterFaceEntityList.size() >0){ + for(SeeYonInterFaceEntity interFaceEntity : seeYonInterFaceEntityList){ + String field_info = interFaceEntity.getField_info(); + JSONObject infoJson = JSON.parseObject(field_info); + //获取主表信息 + JSONObject formMain = infoJson.getJSONObject("front_formmain"); + //获取明细表信息 + JSONArray formSons = infoJson.getJSONArray("formsons"); + //主表tableName + String formMainTableName = formMain.getString("tableName"); + + /** 设置主表查询条件*/ + interFaceEntity.setTabName(formMainTableName); + interFaceEntity.setDataSourceCode(dataSourceCode); + interFaceEntity.setFormMainIds( formMainIds.toJavaList(String.class) ); + + List> forMainList = seeYonInterFaceDao.queryDefinitionData(interFaceEntity); + for (Map forMainRow : forMainList) { + //定义致远OA事件对象 + JSONObject seeYonBean = new JSONObject(); + //定义主表对象 + JSONObject formMainObj = new JSONObject(); + //获取主表ID + String forMainId = String.valueOf(forMainRow.get("ID")); + //组装主表数据 + for (Map.Entry entry : forMainRow.entrySet()) { + formMainObj.put(entry.getKey().toLowerCase(),entry.getValue()); + } + //组装明细表数据 + if(null != formSons && formSons.size() > 0){ + for(Object formSon : formSons){ + JSONObject son = JSON.parseObject(JSON.toJSONString(formSon)); + //明细数据 + String sonTableName = son.getString("tableName"); + SeeYonInterFaceEntity details = new SeeYonInterFaceEntity(); + details.setFormMainId(forMainId); + details.setTabName(sonTableName); + details.setDataSourceCode(dataSourceCode); + JSONArray jsonArray = new JSONArray(); + List> forSonList = seeYonInterFaceDao.queryDefinitionData(details); + for (Map forSons : forSonList) { + //组装明细数据 + JSONObject forSonJson = new JSONObject(); + for (Map.Entry entry : forSons.entrySet()) { + forSonJson.put(entry.getKey().toLowerCase(),entry.getValue()); + } + jsonArray.add(forSonJson); + } + //设置明细表数据 + seeYonBean.put(sonTableName,jsonArray); + } + } + + seeYonBean.put(formMainTableName,formMainObj); + JSONObject rePushRequestData = new JSONObject(); + JSONObject object = new JSONObject(); + object.put("formApp",formAppId); + object.put("eventType",eventType); + object.put("businessDataStr",seeYonBean.toJSONString()); + object.put("affairId",""); + object.put("summaryId",""); + object.put("currentActivityId",""); + object.put("id",forMainId); + logger.info("Method:thirdInterfaceSeeYonDefinitionRePush 组装seeYonBean DATA: {}",seeYonBean.toJSONString()); + + rePushRequestData.put("jsonStr",object); + + + JsonResultEntity resultEntity = thirdInterfaceSeeYonPlugInInterfaceEntrance(rePushRequestData); + if(null != resultEntity){ + resultEntityArray.add(resultEntity.getAttribute()); + }else{ + JSONObject jsonResultEntity = new JSONObject(); + jsonResultEntity.put("msg","从新推送失败"); + jsonResultEntity.put("id",forMainId); + resultEntityArray.add(jsonResultEntity); + + } + + } + } + } + return BaseResult.getSuccessMessageEntity("从新推送执行结束",resultEntityArray); + } + + //资金归集 + private String fundCollection(Map businessData, String formApp){ + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0362"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0047"));//OA业务主键 + StringBuffer purposeBuff = new StringBuffer("付"); + purposeBuff.append(businessDatamain.getString("field0001")); + Object formson_0378obj = businessData.get("formson_0378"); + JSONArray formson_0378List = JSON.parseArray(JSON.toJSONString(formson_0378obj)); + boolean flag = false; + if (formson_0378List != null && formson_0378List.size() > 0) { + JSONArray formson_0378Array = new JSONArray(); + for (Object o : formson_0378List) { + JSONObject formson_0330Json = JSON.parseObject(JSON.toJSONString(o)); + //判断开户银行是否是交通银行 + if(null !=formson_0330Json.getString("field0007") && (formson_0330Json.getString("field0007").contains("交通银行") || formson_0330Json.getString("field0007").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails = new JSONObject(); + jsonObjectDetails.put("payerAccName", formson_0330Json.getString("field0003"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo", formson_0330Json.getString("field0008"));//转出方账号 + jsonObjectDetails.put("curCode", "CNY");//付款方币种 + jsonObjectDetails.put("payeeAccName", businessDatamain.getString("field0001"));//收款人帐户名称 + jsonObjectDetails.put("payeeAccNo", businessDatamain.getString("field0023"));//收款人帐户号 + jsonObjectDetails.put("amount", formson_0330Json.getString("field0004"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode", businessDatamain.getString("field0046"));//收款人联行号 + jsonObjectDetails.put("payType", "34");//结算方式 + jsonObjectDetails.put("businessType", "04");//业务类别 + jsonObjectDetails.put("isForindividual", "0");//是否对私付款 + jsonObjectDetails.put("debitByCustomer", businessDatamain.getString("field0037"));//借方客商辅助核算编码 + jsonObjectDetails.put("creditByCustomer", formson_0330Json.getString("field0036"));//贷方客商辅助核算编码 + jsonObjectDetails.put("creditByBankAcc", formson_0330Json.getString("field0008"));//贷方银行账户辅助核算编码 + String isQuick = null; + if (null !=formson_0330Json.getBigDecimal("field0004") && (formson_0330Json.getBigDecimal("field0004").compareTo(BigDecimal.valueOf(50000)) == 1)) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick", isQuick);//加急标志 + formson_0378Array.add(jsonObjectDetails); + map.put("details", formson_0378Array); + } + } + purposeBuff.append("资金归集款项,单据号-"); + purposeBuff.append(businessDatamain.getString("field0047"));//单据编号 + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr", map); + String result = payMentService.sendOAPayMentToCFS(jsonObject,"fundc"); + logger.info("资金归集传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新资金归集推送标识----------"); + //更新资金归集的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0362"); + seeyonEntity.setPushField("field0045"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("付款信息保存成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) && (null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------资金归集推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------资金归集推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + logger.info("杭泰OA资金归集数据获取失败,原因为:"+e.getMessage()); + } + return null; + } + + //资金拨付 + private String fundAllocation(Map businessData, String formApp){ + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0464"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0045"));//OA业务主键 + StringBuffer purposeBuff = new StringBuffer("付"); + Object formson_0465obj = businessData.get("formson_0465"); + JSONArray formson_0465List = JSON.parseArray(JSON.toJSONString(formson_0465obj)); + boolean flag = false; + if (formson_0465List != null && formson_0465List.size() > 0) { + JSONArray formson_0465Array = new JSONArray(); + for (Object o : formson_0465List) { + JSONObject formson_0330Json = JSON.parseObject(JSON.toJSONString(o)); + //判断开户银行是否是交通银行 + if(null != businessDatamain.getString("field0022") && (businessDatamain.getString("field0022").contains("交通银行") || businessDatamain.getString("field0022").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails = new JSONObject(); + jsonObjectDetails.put("payerAccName", businessDatamain.getString("field0001"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo", businessDatamain.getString("field0023"));//转出方账号 + jsonObjectDetails.put("curCode", "CNY");//付款方币种 + jsonObjectDetails.put("payeeAccName", formson_0330Json.getString("field0003"));//收款人帐户名称 + purposeBuff.append(formson_0330Json.getString("field0003")); + jsonObjectDetails.put("payeeAccNo", formson_0330Json.getString("field0008"));//收款人帐户号 + jsonObjectDetails.put("amount", formson_0330Json.getString("field0004"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode", formson_0330Json.getString("field0044"));//收款人联行号 + jsonObjectDetails.put("payType", "34");//结算方式 + jsonObjectDetails.put("businessType", "04");//业务类别 + jsonObjectDetails.put("isForindividual", "0");//是否对私付款 + jsonObjectDetails.put("debitByCustomer", formson_0330Json.getString("field0036"));//借方客商辅助核算编码 + jsonObjectDetails.put("creditByCustomer", businessDatamain.getString("field0037"));//贷方客商辅助核算编码 + jsonObjectDetails.put("creditByBankAcc", formson_0330Json.getString("field0023"));//贷方银行账户辅助核算编码 + + String isQuick = null; + if (null !=formson_0330Json.getBigDecimal("field0004") && formson_0330Json.getBigDecimal("field0004").compareTo(BigDecimal.valueOf(50000)) == 1) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick", isQuick);//加急标志 + formson_0465Array.add(jsonObjectDetails); + map.put("details", formson_0465Array); + } + } + purposeBuff.append("资金拨付款项,单据号-"); + purposeBuff.append(businessDatamain.getString("field0045"));//单据编号 + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr", map); + String result = payMentService.sendOAPayMentToCFS(jsonObject,"funda"); + logger.info("资金拨付传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新资金拨付推送标识----------"); + //更新资金拨付的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0464"); + seeyonEntity.setPushField("field0043"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("付款信息保存成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) &&(null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------资金拨付推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------资金拨付推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + logger.info("杭泰OA资金拨付数据获取失败,原因为:"+e.getMessage()); + } + return null; + } + + //同名账户划转 + private String accountTransfer(Map businessData, String formApp){ + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0467"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0045"));//OA业务主键 + StringBuffer purposeBuff = new StringBuffer("付"); + Object formson_0469obj = businessData.get("formson_0469"); + JSONArray formson_0469List = JSON.parseArray(JSON.toJSONString(formson_0469obj)); + boolean flag = false; + if (formson_0469List != null && formson_0469List.size() > 0) { + JSONArray formson_0469Array = new JSONArray(); + for (Object o : formson_0469List) { + JSONObject formson_0469Json = JSON.parseObject(JSON.toJSONString(o)); + //判断开户银行是否是交通银行 + if(null!= formson_0469Json.getString("field0015") && (formson_0469Json.getString("field0015").contains("交通银行") || formson_0469Json.getString("field0015").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails = new JSONObject(); + jsonObjectDetails.put("payerAccName", businessDatamain.getString("field0021"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo", formson_0469Json.getString("field0016"));//转出方账号 + jsonObjectDetails.put("curCode", "CNY");//付款方币种 + jsonObjectDetails.put("payeeAccName", businessDatamain.getString("field0021"));//收款人帐户名称 + jsonObjectDetails.put("payeeAccNo", formson_0469Json.getString("field0019"));//收款人帐户号 + purposeBuff.append(formson_0469Json.getString("field0019")); + jsonObjectDetails.put("amount", formson_0469Json.getString("field0020"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode", formson_0469Json.getString("field0044"));//收款人联行号 + jsonObjectDetails.put("payType", "34");//结算方式 + jsonObjectDetails.put("businessType", "04");//业务类别 + jsonObjectDetails.put("isForindividual", "0");//是否对私付款 + jsonObjectDetails.put("debitByBankAcc", formson_0469Json.getString("field0019"));//借方银行账户辅助核算编码 + jsonObjectDetails.put("creditByCustomer", businessDatamain.getString("field0038"));//贷方客商辅助核算编码 + jsonObjectDetails.put("creditByBankAcc", formson_0469Json.getString("field0016"));//贷方银行账户辅助核算编码 + String isQuick = null; + if (null !=formson_0469Json.getBigDecimal("field0020") && formson_0469Json.getBigDecimal("field0020").compareTo(BigDecimal.valueOf(50000)) == 1) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick", isQuick);//加急标志 + formson_0469Array.add(jsonObjectDetails); + map.put("details", formson_0469Array); + } + } + purposeBuff.append("同名账户划转款项,单据号-"); + purposeBuff.append(businessDatamain.getString("field0045"));//单据编号 + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr", map); + String result = payMentService.sendOAPayMentToCFS(jsonObject,"acc"); + logger.info("同名账户划转传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新同名账户划转推送标识----------"); + //更新资金拨付的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0467"); + seeyonEntity.setPushField("field0043"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("付款信息保存成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) && (null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------同名账户划转推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------同名账户划转推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + logger.info("杭泰OA同名账户划转数据获取失败,原因为:"+e.getMessage()); + } + return null; + } + + //借还款 + private String loanRepayment(Map businessData, String formApp){ + try { + JSONObject jsonObject=new JSONObject(); + Object mainObj = businessData.get("formmain_0293"); + JSONObject businessDatamain = JSON.parseObject(JSON.toJSONString(mainObj)); + JSONObject map=new JSONObject(); + map.put("erpVoucherNo",businessDatamain.getString("field0056"));//OA业务主键 + StringBuffer purposeBuff = new StringBuffer("付"); + Object formson_0399obj = businessData.get("formson_0399"); + JSONArray formson_0399List = JSON.parseArray(JSON.toJSONString(formson_0399obj)); + boolean flag = false; + if (formson_0399List != null && formson_0399List.size() > 0) { + JSONArray formson_0399Array = new JSONArray(); + for (Object o : formson_0399List) { + JSONObject formson_0399Json = JSON.parseObject(JSON.toJSONString(o)); + //判断开户银行是否是交通银行 + if(null !=formson_0399Json.getString("field0078") && (formson_0399Json.getString("field0078").contains("交通银行") || formson_0399Json.getString("field0078").contains("上海银行"))){ + flag=true; + } + JSONObject jsonObjectDetails = new JSONObject(); + //根据转出方得id查询转出方名称 + SeeyonEntity seeyonEntity = new SeeyonEntity(); + seeyonEntity.setId(businessDatamain.getString("field0006")); + List seeyonEntities = seeYonDao.selectOAListByField0258(seeyonEntity); + if (seeyonEntities.size() > 0) { + jsonObjectDetails.put("payeeAccName", seeyonEntities.get(0).getName());//收款人帐户名称 + } + jsonObjectDetails.put("payerAccName", businessDatamain.getString("field0074"));//转出方帐户名 + jsonObjectDetails.put("payerAccNo", formson_0399Json.getString("field0079"));//转出方账号 + jsonObjectDetails.put("curCode", "CNY");//付款方币种 + //jsonObjectDetails.put("payeeAccName", businessDatamain.getString("field0006"));//收款人帐户名称 + purposeBuff.append(jsonObjectDetails.getString("payeeAccName")); + jsonObjectDetails.put("payeeAccNo", formson_0399Json.getString("field0081"));//收款人帐户号 + jsonObjectDetails.put("amount", formson_0399Json.getString("field0077"));//余额/发生额 + jsonObjectDetails.put("payeeBankCode", formson_0399Json.getString("field0093"));//收款人联行号 + jsonObjectDetails.put("payType", "34");//结算方式 + jsonObjectDetails.put("businessType", "04");//业务类别 + jsonObjectDetails.put("isForindividual", "0");//是否对私付款 + jsonObjectDetails.put("creditByCustomer", businessDatamain.getString("field0084"));//贷方客商辅助核算编码 + jsonObjectDetails.put("debitByPersonnel", businessDatamain.getString("field0094"));//借方人员辅助核算编码 + jsonObjectDetails.put("creditByBankAcc", formson_0399Json.getString("field0079"));//贷方银行账户辅助核算编码 + String isQuick = null; + if (null !=formson_0399Json.getBigDecimal("field0077") && formson_0399Json.getBigDecimal("field0077").compareTo(BigDecimal.valueOf(50000)) == 1) {//如果=1,说明大于50000,如果=-1,说明小于50000 + isQuick = "1";//加急标志 1:加急 0:不加急 + } else { + isQuick = "0";//普通标志 + } + jsonObjectDetails.put("isQuick", isQuick);//加急标志 + formson_0399Array.add(jsonObjectDetails); + map.put("details", formson_0399Array); + } + } + purposeBuff.append("借款单款项,借款单据编号-"); + purposeBuff.append(businessDatamain.getString("field0056"));//单据编号 + map.put("purpose",purposeBuff.toString());//摘要 + //只有交通银行的才传递CFS + if(flag==true){ + jsonObject.put("jsonStr", map); + String result = payMentService.sendOAPayMentToCFS(jsonObject,"loan"); + logger.info("借还款传递CFS在SeeYonInterFaceImpl中的返回结果为:"+result); + JSONObject jsonObjectResult = JSONObject.parseObject(result); + logger.info("------开始更新借还款推送标识----------"); + //更新资金拨付的推送状态 + SeeyonEntity seeyonEntity=new SeeyonEntity(); + seeyonEntity.setTableName("formmain_0293"); + seeyonEntity.setPushField("field0092"); + seeyonEntity.setId(businessDatamain.getString("id")); + if("付款信息保存成功".equalsIgnoreCase(jsonObjectResult.getString("statusMsg")) && (null!=jsonObjectResult.getString("serialNo") && !"".equals(jsonObjectResult.getString("serialNo")))){ + seeyonEntity.setPushValue("推送成功"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------借还款推送标识更新为推送成功完成----------"); + }else{ + seeyonEntity.setPushValue("推送失败"); + seeYonDao.updatepush(seeyonEntity); + logger.info("------借还款推送标识更新为推送失败完成----------"); + } + return result; + } else { + logger.info("付款方开户银行不是交通银行类型或者没有银行明细,传递不了CFS"); + return null; + } + }catch (Exception e){ + logger.info("杭泰OA借还款数据获取失败,原因为:"+e.getMessage()); + } + return null; + } + + + + +} diff --git a/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java b/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java index ff97fdf4..0be0d2ce 100644 --- a/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java +++ b/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException; import com.hzya.frame.datasource.DataSourceUtilProperties; +import com.hzya.frame.sys.application.entity.SysApplicationDatasourceDto; import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -140,4 +141,32 @@ public class DsDataSourceUtil { throw new RuntimeException("source_code:" + datasource_code + "不存在"); } } + + //测试连接 + public boolean testConnection(SysApplicationDatasourceDto dataSourceEntity){ + //根据datasource_code查询数据源配置信息 + String driveClass = "";//1、oracle 2、sqlServer3、mysql + if ("3".equalsIgnoreCase(dataSourceEntity.getSourceType())) { + driveClass = DataSourceUtilProperties.MYSQLDRIVER_6; + } else if ("1".equalsIgnoreCase(dataSourceEntity.getSourceType())) { + driveClass = DataSourceUtilProperties.ORACLEDRIVER; + } else if ("sqlserver2000".equalsIgnoreCase(dataSourceEntity.getSourceType())) { + driveClass = DataSourceUtilProperties.SQL2000DRIVER; + } else if ("2".equalsIgnoreCase(dataSourceEntity.getSourceType())) { + driveClass = DataSourceUtilProperties.SQL2005DRIVER; + } + try { + //测试连接 + Class.forName(driveClass); + Connection connection = DriverManager.getConnection(dataSourceEntity.getSourceUrl(), dataSourceEntity.getLoginName(), dataSourceEntity.getPassword());// 相当于连接数据库 + if (connection != null) { + return true; + } else { + return false; + } + } catch (Exception e) { + logger.info("==================连接数据源失败==================="); + return false; + } + } } diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/dao/IApiReflectionDao.java b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/IApiReflectionDao.java new file mode 100644 index 00000000..98803b04 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/IApiReflectionDao.java @@ -0,0 +1,50 @@ +package com.hzya.frame.sys.apireflection.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionEntity; + +import java.util.List; + +/** + * @description: 接口映射配置 dao + * @tableName: sys_api_reflection + * @entityName: ApiReflectionEntity + * @author: gjh + * @history: 1.0 + */ +public interface IApiReflectionDao extends IBaseDao { + + /** + * 查询所有 + * @param apiReflectionEntity + * @return + */ + //List queryList(ApiReflectionEntity apiReflectionEntity); + + /** + * 根据id获取数据 + * @param id + * @return + */ + ApiReflectionEntity queryOneById(String id); + + /** + * 保存 + * @param apiReflectionEntity + * @return + */ + + ApiReflectionEntity saveApiReflection(ApiReflectionEntity apiReflectionEntity); + + /** + * 修改 + * @return + */ + Integer updateApiReflection(ApiReflectionEntity apiReflectionEntity); + + Integer deleteApiReflection(String id); + + +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/dao/IApiReflectionDetailDao.java b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/IApiReflectionDetailDao.java new file mode 100644 index 00000000..9951089b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/IApiReflectionDetailDao.java @@ -0,0 +1,16 @@ +package com.hzya.frame.sys.apireflection.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionEntity; + +/** + * @description: 接口映射配置 dao + * @tableName: sys_api_reflection_detail + * @entityName: ApiReflectionDetailEntity + * @author: gjh + * @history: 1.0 + */ +public interface IApiReflectionDetailDao extends IBaseDao { + +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/dao/impl/ApiReflectionDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/impl/ApiReflectionDaoImpl.java new file mode 100644 index 00000000..2a90da06 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/impl/ApiReflectionDaoImpl.java @@ -0,0 +1,76 @@ +package com.hzya.frame.sys.apireflection.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionEntity; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sys.apireflection.dao.IApiReflectionDao; + +import java.util.List; + +/** + * @description: 接口映射配置 dao + * @tableName: sys_api_reflection + * @entityName: ApiReflectionEntity + * @author: gjh + * @history: 1.0 + */ +@Repository("sys_api_reflectiondao") +public class ApiReflectionDaoImpl extends MybatisGenericDao implements IApiReflectionDao { + + /** + * 查询所有 + * @param apiReflectionEntity + * @return + */ + /* @Override + public List queryList(ApiReflectionEntity apiReflectionEntity) { + return (List) super.selectList("ApiReflectionEntity_list_base",apiReflectionEntity); + }*/ + + /** + * 根据id查询单个对象 + * @param id + * @return + */ + @Override + public ApiReflectionEntity queryOneById(String id) { + return super.get(id); + } + + /** + * 保存 + * @param apiReflectionEntity + * @return + */ + @Override + public ApiReflectionEntity saveApiReflection(ApiReflectionEntity apiReflectionEntity) { + ApiReflectionEntity apiReflectionEntityInsert = super.save(apiReflectionEntity); + return apiReflectionEntityInsert; + } + + /** + * 修改 + * @param apiReflectionEntity + * @return + */ + @Override + public Integer updateApiReflection(ApiReflectionEntity apiReflectionEntity) { + return super.update("ApiReflectionEntity_update",apiReflectionEntity); + } + + /** + * 删除 + * @param id + * @return + */ + @Override + public Integer deleteApiReflection(String id) { + ApiReflectionEntity apiReflectionEntity=new ApiReflectionEntity(); + apiReflectionEntity.setId(id); + return super.update("ApiReflectionEntity_logicDelete",apiReflectionEntity); + } + + +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/dao/impl/ApiReflectionDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/impl/ApiReflectionDetailDaoImpl.java new file mode 100644 index 00000000..99580e13 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/dao/impl/ApiReflectionDetailDaoImpl.java @@ -0,0 +1,18 @@ +package com.hzya.frame.sys.apireflection.dao.impl; + +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sys.apireflection.dao.IApiReflectionDetailDao; + +/** + * @description: 接口映射配置 dao + * @tableName: sys_api_reflection_detail + * @entityName: ApiReflectionDetailEntity + * @author: gjh + * @history: 1.0 + */ +@Repository("sys_api_reflection_detaildao") +public class ApiReflectionDetailDaoImpl extends MybatisGenericDao implements IApiReflectionDetailDao { + +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDTO.java b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDTO.java new file mode 100644 index 00000000..4ebc3437 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDTO.java @@ -0,0 +1,192 @@ +package com.hzya.frame.sys.apireflection.entity; + +/** + * @Description api映射参数类 + * @Author xiangerlin + * @Date 2023/7/28 11:53 + **/ +public class ApiReflectionDTO { + + private String ref_id;//sys_api_reflection.id + private String source_api_id;// sys_api_reflection.source_api_id + private String target_api_id;//sys_api_reflection.target_api_id + private String source_api;//sys_app_api.destination_address + private String target_api;//sys_app_api.destination_address + private String source_body_in;//sys_app_api.body_in + private String source_body_out;//sys_app_api.body_out + private String source_header;//sys_app_api.header_id + private String source_query;//sys_app_api.query_id + private String target_body_in;//sys_app_api.body_id + private String target_body_out;//sys_app_api.body_out + private String target_header;//sys_app_api.header_id + private String target_query;//sys_app_api.query_id + private String source_method;//sys_app_api.requst_method + private String target_method;//sys_app_api.requst_method + private String need_login;//是否需要登陆 + private String authentication_port;//登陆接口id + private String source_timeout;//源接口超时时间 + private String target_timeout;//目标接口超时时间 + + private String source_expand_param;//源接口扩展参数 + public String getRef_id() { + return ref_id; + } + + public void setRef_id(String ref_id) { + this.ref_id = ref_id; + } + + public String getSource_api_id() { + return source_api_id; + } + + public void setSource_api_id(String source_api_id) { + this.source_api_id = source_api_id; + } + + public String getTarget_api_id() { + return target_api_id; + } + + public void setTarget_api_id(String target_api_id) { + this.target_api_id = target_api_id; + } + + + public String getSource_header() { + return source_header; + } + + public void setSource_header(String source_header) { + this.source_header = source_header; + } + + public String getSource_query() { + return source_query; + } + + public void setSource_query(String source_query) { + this.source_query = source_query; + } + + + public String getTarget_header() { + return target_header; + } + + public void setTarget_header(String target_header) { + this.target_header = target_header; + } + + public String getTarget_query() { + return target_query; + } + + public void setTarget_query(String target_query) { + this.target_query = target_query; + } + + public String getSource_method() { + return source_method; + } + + public void setSource_method(String source_method) { + this.source_method = source_method; + } + + public String getTarget_method() { + return target_method; + } + + public void setTarget_method(String target_method) { + this.target_method = target_method; + } + + public String getSource_api() { + return source_api; + } + + public void setSource_api(String source_api) { + this.source_api = source_api; + } + + public String getTarget_api() { + return target_api; + } + + public void setTarget_api(String target_api) { + this.target_api = target_api; + } + + public String getNeed_login() { + return need_login; + } + + public void setNeed_login(String need_login) { + this.need_login = need_login; + } + + public String getAuthentication_port() { + return authentication_port; + } + + public void setAuthentication_port(String authentication_port) { + this.authentication_port = authentication_port; + } + + public String getSource_body_out() { + return source_body_out; + } + + public void setSource_body_out(String source_body_out) { + this.source_body_out = source_body_out; + } + + public String getSource_body_in() { + return source_body_in; + } + + public void setSource_body_in(String source_body_in) { + this.source_body_in = source_body_in; + } + + public String getTarget_body_in() { + return target_body_in; + } + + public void setTarget_body_in(String target_body_in) { + this.target_body_in = target_body_in; + } + + public String getTarget_body_out() { + return target_body_out; + } + + public void setTarget_body_out(String target_body_out) { + this.target_body_out = target_body_out; + } + + public String getSource_timeout() { + return source_timeout; + } + + public void setSource_timeout(String source_timeout) { + this.source_timeout = source_timeout; + } + + public String getTarget_timeout() { + return target_timeout; + } + + public void setTarget_timeout(String target_timeout) { + this.target_timeout = target_timeout; + } + + public String getSource_expand_param() { + return source_expand_param; + } + + public void setSource_expand_param(String source_expand_param) { + this.source_expand_param = source_expand_param; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDetailEntity.java b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDetailEntity.java new file mode 100644 index 00000000..1e076e1c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDetailEntity.java @@ -0,0 +1,180 @@ +package com.hzya.frame.sys.apireflection.entity; + +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.math.BigDecimal; +import com.hzya.frame.web.entity.BaseEntity; + +/** + * @description: 接口映射配置 entity + * @tableName: sys_api_reflection_detail + * @entityName: ApiReflectionDetailEntity + * @author: gjh + * @history: 1.0 + */ +public class ApiReflectionDetailEntity extends BaseEntity { + + /** 主表id */ + private String mainid; + /** 源API字段 */ + private String source_field; + /** 源API字段名 */ + private String source_name; + /** 目标API字段 */ + private String target_field; + /** 目标API字段名 */ + private String target_name; + /** 目标API字段默认值 */ + private String default_vaule; + /** 源字段层级 */ + private String source_field_path; + /** 目标字段层级 */ + private String target_field_path; + /** 无备注 */ + private String sorts; + /** 无备注 */ + private String org_id; + + private String id; + /** 坐标 */ + private String coordinate; + /*源坐标*/ + private String source_path; + /*目标坐标*/ + private String target_path; + + public String getSource_path() { + return source_path; + } + + public void setSource_path(String source_path) { + this.source_path = source_path; + } + + public String getTarget_path() { + return target_path; + } + + public void setTarget_path(String target_path) { + this.target_path = target_path; + } + + public String getCoordinate() { + return coordinate; + } + + public void setCoordinate(String coordinate) { + this.coordinate = coordinate; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + /** 主表id */ + public void setMainid(String mainid) { + this.mainid = mainid; + } + /** 主表id */ + public String getMainid() { + return mainid; + } + + + /** 源API字段 */ + public void setSource_field(String source_field) { + this.source_field = source_field; + } + /** 源API字段 */ + public String getSource_field() { + return source_field; + } + + + /** 源API字段名 */ + public void setSource_name(String source_name) { + this.source_name = source_name; + } + /** 源API字段名 */ + public String getSource_name() { + return source_name; + } + + + /** 目标API字段 */ + public void setTarget_field(String target_field) { + this.target_field = target_field; + } + /** 目标API字段 */ + public String getTarget_field() { + return target_field; + } + + + /** 目标API字段名 */ + public void setTarget_name(String target_name) { + this.target_name = target_name; + } + /** 目标API字段名 */ + public String getTarget_name() { + return target_name; + } + + + /** 目标API字段默认值 */ + public void setDefault_vaule(String default_vaule) { + this.default_vaule = default_vaule; + } + /** 目标API字段默认值 */ + public String getDefault_vaule() { + return default_vaule; + } + + + /** 源字段层级 */ + public void setSource_field_path(String source_field_path) { + this.source_field_path = source_field_path; + } + /** 源字段层级 */ + public String getSource_field_path() { + return source_field_path; + } + + + /** 目标字段层级 */ + public void setTarget_field_path(String target_field_path) { + this.target_field_path = target_field_path; + } + /** 目标字段层级 */ + public String getTarget_field_path() { + return target_field_path; + } + + + /** 无备注 */ + public void setSorts(String sorts) { + this.sorts = sorts; + } + + + + /** 无备注 */ + @Override + public void setOrg_id(String org_id) { + this.org_id = org_id; + } + /** 无备注 */ + @Override + public String getOrg_id() { + return org_id; + } + + +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDetailEntity.xml b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDetailEntity.xml new file mode 100644 index 00000000..035bc576 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionDetailEntity.xml @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + mainid, + source_field, + source_name, + target_field, + target_name, + default_vaule, + source_field_path, + target_field_path, + source_path, + target_path, + create_time, + create_user_id, + modify_time, + modify_user_id, + sts, + sorts, + org_id, + coordinate + + + + + + + + + + + + + + + + + + + insert into sys_api_reflection_detail( + + id, + mainid, + coordinate, + source_field, + source_name, + target_field, + target_name, + default_vaule, + source_field_path, + source_path, + target_field_path, + target_path, + create_user_id, + modify_user_id, + sorts, + org_id, + sorts, + create_time, + modify_time, + sts + + )values( + + #{id}, + #{mainid}, + #{coordinate}, + #{source_field}, + #{source_name}, + #{target_field}, + #{target_name}, + #{default_vaule}, + #{source_field_path}, + #{source_path}, + #{target_field_path}, + #{target_path}, + #{create_user_id}, + #{modify_user_id}, + #{sorts}, + #{org_id}, + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_api_reflection_detail a WHERE a.sts = 'Y' ), + #{create_time} , + now(), + #{modify_time}, + now(), + 'Y' + + ) + + + + + update sys_api_reflection_detail set + + mainid = #{mainid}, + coordinate= #{coordinate}, + source_field = #{source_field}, + source_name = #{source_name}, + target_field = #{target_field}, + target_name = #{target_name}, + default_vaule = #{default_vaule}, + source_field_path = #{source_field_path}, + source_path = #{source_path}, + target_field_path = #{target_field_path}, + target_path = #{target_path}, + create_user_id = #{create_user_id}, + modify_user_id = #{modify_user_id}, + sorts = #{sorts}, + org_id = #{org_id}, + modify_time =#{modify_time} + modify_time = now() + + where id = #{id} + + + + + update sys_api_reflection_detail set + sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where + id = #{id} + + + + + update sys_api_reflection_detail set + sts='N',modify_time = now(),modify_user_id = #{modify_user_id} + + id = #{id} + and mainid = #{mainid} + coordinate= #{coordinate}, + and source_field = #{source_field} + and source_name = #{source_name} + and target_field = #{target_field} + and target_name = #{target_name} + and default_vaule = #{default_vaule} + and source_field_path = #{source_field_path} + and target_field_path = #{target_field_path} + and source_path = #{source_path} + and target_path = #{target_path} + and create_time = #{create_time} + and create_user_id = #{create_user_id} + and modify_time = #{modify_time} + and modify_user_id = #{modify_user_id} + and sts = #{sts} + and sorts = #{sorts} + and org_id = #{org_id} + + + + + + delete from sys_api_reflection_detail where id =#{id} + + + + + update sys_api_reflection_detail set + sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where + mainid = #{mainid} + + diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionEntity.java b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionEntity.java new file mode 100644 index 00000000..28656725 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionEntity.java @@ -0,0 +1,180 @@ +package com.hzya.frame.sys.apireflection.entity; + +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.math.BigDecimal; +import com.hzya.frame.web.entity.BaseEntity; + +/** + * @description: 接口映射配置 entity + * @tableName: sys_api_reflection + * @entityName: ApiReflectionEntity + * @author: gjh + * @history: 1.0 + */ +public class ApiReflectionEntity extends BaseEntity { + + /** 源接口ID */ + private String source_api_id; + /** 目标接口ID */ + private String target_api_id; + /** 备注 */ + private String remark; + /** 排序 */ + private String sorts; + /** 无备注 */ + private String org_id; + /** 无备注 */ + private String source_api_app; + /** 无备注 */ + private String target_api_app; + /** 无备注 */ + private String ref_code; + /** 无备注 */ + private String ref_name; + /** 无备注 */ + private String ref_type; + /** 无备注 */ + private String description; + private String id; + /*是否插件*/ + private String plug; + /*插件id*/ + private String plug_id; + + public String getPlug() { + return plug; + } + + public void setPlug(String plug) { + this.plug = plug; + } + + public String getPlug_id() { + return plug_id; + } + + public void setPlug_id(String plug_id) { + this.plug_id = plug_id; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + /** 源接口ID */ + public void setSource_api_id(String source_api_id) { + this.source_api_id = source_api_id; + } + /** 源接口ID */ + public String getSource_api_id() { + return source_api_id; + } + + + /** 目标接口ID */ + public void setTarget_api_id(String target_api_id) { + this.target_api_id = target_api_id; + } + /** 目标接口ID */ + public String getTarget_api_id() { + return target_api_id; + } + + + /** 备注 */ + public void setRemark(String remark) { + this.remark = remark; + } + /** 备注 */ + public String getRemark() { + return remark; + } + + + /** 排序 */ + public void setSorts(String sorts) { + this.sorts = sorts; + } + + + /** 无备注 */ + @Override + public void setOrg_id(String org_id) { + this.org_id = org_id; + } + /** 无备注 */ + @Override + public String getOrg_id() { + return org_id; + } + + + /** 无备注 */ + public void setSource_api_app(String source_api_app) { + this.source_api_app = source_api_app; + } + /** 无备注 */ + public String getSource_api_app() { + return source_api_app; + } + + + /** 无备注 */ + public void setTarget_api_app(String target_api_app) { + this.target_api_app = target_api_app; + } + /** 无备注 */ + public String getTarget_api_app() { + return target_api_app; + } + + + /** 无备注 */ + public void setRef_code(String ref_code) { + this.ref_code = ref_code; + } + /** 无备注 */ + public String getRef_code() { + return ref_code; + } + + + /** 无备注 */ + public void setRef_name(String ref_name) { + this.ref_name = ref_name; + } + /** 无备注 */ + public String getRef_name() { + return ref_name; + } + + + /** 无备注 */ + public void setRef_type(String ref_type) { + this.ref_type = ref_type; + } + /** 无备注 */ + public String getRef_type() { + return ref_type; + } + + + /** 无备注 */ + public void setDescription(String description) { + this.description = description; + } + /** 无备注 */ + public String getDescription() { + return description; + } + + +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionEntity.xml b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionEntity.xml new file mode 100644 index 00000000..c2ce84ba --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ApiReflectionEntity.xml @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + source_api_id, + target_api_id, + remark, + create_user_id, + create_time, + modify_user_id, + modify_time, + sts, + sorts, + org_id, + source_api_app, + target_api_app, + ref_code, + ref_name, + ref_type, + description, + plug, + plug_id + + + + + + + + + + + + + + + + + + + + insert into sys_api_reflection( + + id, + source_api_id, + target_api_id, + remark, + create_user_id, + modify_user_id, + sorts, + org_id, + source_api_app, + target_api_app, + ref_code, + ref_name, + ref_type, + description, + plug, + plug_id, + sorts, + create_time, + modify_time, + sts + + )values + ( + + #{id}, + #{source_api_id}, + #{target_api_id}, + #{remark}, + #{create_user_id}, + #{modify_user_id}, + #{sorts}, + #{org_id}, + #{source_api_app}, + #{target_api_app}, + #{ref_code}, + #{ref_name}, + #{ref_type}, + #{description}, + #{plug}, + #{plug_id}, + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_api_reflection a WHERE a.sts = 'Y' ), + #{create_time} , + now(), + #{modify_time}, + now(), + 'Y' + + ) + + + + + update sys_api_reflection set + + source_api_id = #{source_api_id}, + target_api_id = #{target_api_id}, + remark = #{remark}, + create_user_id = #{create_user_id}, + modify_user_id = #{modify_user_id}, + sorts = #{sorts}, + org_id = #{org_id}, + source_api_app = #{source_api_app}, + target_api_app = #{target_api_app}, + ref_code = #{ref_code}, + ref_name = #{ref_name}, + ref_type = #{ref_type}, + description = #{description}, + plug = #{plug}, + plug_id = #{plug_id}, + modify_time =#{modify_time} + modify_time = now() + + where id = #{id} + + + + + update sys_api_reflection set + sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where + id = #{id} + + + + + update sys_api_reflection set + sts='N',modify_time = now(),modify_user_id = #{modify_user_id} + + id = #{id} + and source_api_id = #{source_api_id} + and target_api_id = #{target_api_id} + and remark = #{remark} + and create_user_id = #{create_user_id} + and create_time = #{create_time} + and modify_user_id = #{modify_user_id} + and modify_time = #{modify_time} + and sts = #{sts} + and sorts = #{sorts} + and org_id = #{org_id} + and source_api_app = #{source_api_app} + and target_api_app = #{target_api_app} + and ref_code = #{ref_code} + and ref_name = #{ref_name} + and ref_type = #{ref_type} + and description = #{description} + and plug = #{plug} + and plug_id = #{plug_id} + + + + + + delete from sys_api_reflection where id =#{id} + + diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ParameterPropertyDTO.java b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ParameterPropertyDTO.java new file mode 100644 index 00000000..2696a891 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/entity/ParameterPropertyDTO.java @@ -0,0 +1,109 @@ +package com.hzya.frame.sys.apireflection.entity; + +import java.util.List; + +/** + * @Description 参数属性 + * @Author xiangerlin + * @Date 2023/8/2 15:32 + **/ +public class ParameterPropertyDTO { + private String id; + private Integer index; + private String parameterName; + private String sorts; + private String parameterType; + private String concreteType; + private String length; + private Boolean required; + private String example; + private String description; + private List children; + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getIndex() { + return index; + } + + public void setIndex(Integer index) { + this.index = index; + } + + public String getParameterName() { + return parameterName; + } + + public void setParameterName(String parameterName) { + this.parameterName = parameterName; + } + + public String getSorts() { + return sorts; + } + + public void setSorts(String sorts) { + this.sorts = sorts; + } + + public String getParameterType() { + return parameterType; + } + + public void setParameterType(String parameterType) { + this.parameterType = parameterType; + } + + public String getConcreteType() { + return concreteType; + } + + public void setConcreteType(String concreteType) { + this.concreteType = concreteType; + } + + public String getLength() { + return length; + } + + public void setLength(String length) { + this.length = length; + } + + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public String getExample() { + return example; + } + + public void setExample(String example) { + this.example = example; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiHandleService.java b/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiHandleService.java new file mode 100644 index 00000000..12fa9cc4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiHandleService.java @@ -0,0 +1,14 @@ +package com.hzya.frame.sys.apireflection.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IApiHandleService { + /** + * 执行场景配置的api + * @param json + * @return + * @throws Exception + */ + JsonResultEntity executeApi(JSONObject json)throws Exception; +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiReflectionDetailService.java b/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiReflectionDetailService.java new file mode 100644 index 00000000..98c5aef6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiReflectionDetailService.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sys.apireflection.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; + +/** + * @description: 接口映射配置 service + * @tableName: sys_api_reflection_detail + * @entityName: ApiReflectionDetailEntity + * @author: gjh + * @history: 1.0 + */ +public interface IApiReflectionDetailService extends IBaseService { + +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiReflectionService.java b/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiReflectionService.java new file mode 100644 index 00000000..4037c5c3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/service/IApiReflectionService.java @@ -0,0 +1,61 @@ +package com.hzya.frame.sys.apireflection.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDTO; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +import java.util.List; + +/** + * @description: 接口映射配置 service + * @tableName: sys_api_reflection + * @entityName: ApiReflectionEntity + * @author: gjh + * @history: 1.0 + */ +public interface IApiReflectionService extends IBaseService { + + /** + * 查询所有 + * @param jsonObject + * @return + */ + //JsonResultEntity queryList(JSONObject jsonObject); + + /** + * 根据id查询单个数据 + * @param jsonObject + * @return + */ + JsonResultEntity queryOneById(JSONObject jsonObject); + + /** + * 保存 + * @param jsonObject + * @return + */ + JsonResultEntity saveApiReflection(JSONObject jsonObject); + + /** + * 修改 + * @param jsonObject + * @return + */ + JsonResultEntity updateApiReflection(JSONObject jsonObject); + + /** + * 删除 将sts修改为N + * @param jsonObject + * @return + */ + JsonResultEntity deleteApiReflection(JSONObject jsonObject); + + /** + * 接口映射配置关联查接口信息 + * @param ref_id + * @return + */ + ApiReflectionDTO queryApiRefById(String ref_id); +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiHandleServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiHandleServiceImpl.java new file mode 100644 index 00000000..545c051e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiHandleServiceImpl.java @@ -0,0 +1,379 @@ +package com.hzya.frame.sys.apireflection.service.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.Method; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDTO; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; +import com.hzya.frame.sys.apireflection.entity.ParameterPropertyDTO; +import com.hzya.frame.sys.apireflection.service.IApiReflectionDetailService; +import com.hzya.frame.sys.apireflection.service.IApiReflectionService; +import com.hzya.frame.sys.appApi.entity.AppApi; +import com.hzya.frame.sys.apireflection.service.IApiHandleService; +import com.hzya.frame.sys.appApi.service.IAppApiService; +import com.hzya.frame.sys.service.IExcApiService; +import com.hzya.frame.sys.sysenum.SysEnum; +import com.hzya.frame.web.entity.BaseResult; +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.mockito.stubbing.ValidableAnswer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description + * @Author xiangerlin + * @Date 2023/7/26 11:53 + **/ +@Service(value = "apiHandleService") +public class ApiHandleServiceImpl implements IApiHandleService { + + @Autowired + private IAppApiService appApiService; + @Autowired + private IApiReflectionService apiReflectionService; + @Autowired + private IExcApiService excApiService; + @Autowired + private IApiReflectionDetailService apiReflectionDetailService; + public static final String AUTHPORT = SysEnum.AUTHPORT.getValue();//授权参数 + public static final String EXAMPLE = SysEnum.EXAMPLE.getValue();//示例值 + public static final String PARAMETERNAME = SysEnum.PARAMETERNAME.getValue(); + public static final String PARAMETERTYPE = SysEnum.PARAMETERTYPE.getValue(); + + Logger logger = LogManager.getLogger(getClass()); + + + /** + * 这个方法用的是 JSONObject的putIfAbsent方法实现的 + * 左边主表字段对应右边子表的情况 暂不支持 + * + * @param json + * @return + * @throws Exception + */ + @Override + public JsonResultEntity executeApi(JSONObject json) throws Exception { + JSONObject jsonObject = checkParam(json); + if (StrUtil.isNotEmpty(jsonObject.getString("msg"))){ + return BaseResult.getFailureMessageEntity(jsonObject.getString("msg")); + } + //场景 + ApiReflectionDTO apiReflectionDTO = jsonObject.getObject("main",ApiReflectionDTO.class); + if (null == apiReflectionDTO) { + return BaseResult.getFailureMessageEntity("根据场景id查询不到场景"); + } + //源接口 + String source_res = null; + try { + apiReflectionDTO.setSource_expand_param(json.getJSONObject("jsonStr").getString("source_expand_param")); + JSONObject sourceRes = excApiService.execute(apiReflectionDTO.getSource_api_id()); + //source_res = sourceApi(apiReflectionDTO); + if (null != sourceRes && sourceRes.getBoolean("flag")){ + source_res = sourceRes.getString("msg"); + } + } catch (Exception e) { + return BaseResult.getFailureMessageEntity(String.format("源接口:%s调用失败", apiReflectionDTO.getSource_api()), e.getMessage()); + } + //目标接口 + try{ + if (StrUtil.isEmpty(source_res)){ + return BaseResult.getFailureMessageEntity(String.format("源接口:%s调用失败", apiReflectionDTO.getSource_api()), "没有返回参数"); + } + JSONObject targetRes = targetApi(jsonObject, source_res); + if (targetRes.getBoolean("flag")){ + return BaseResult.getSuccessMessageEntity("执行成功", targetRes.getString("msg")); + }else { + return BaseResult.getFailureMessageEntity(String.format("目标接口:%s调用失败", apiReflectionDTO.getTarget_api()), targetRes.getString("msg")); + } + }catch (Exception e){ + return BaseResult.getFailureMessageEntity(String.format("目标接口:%s调用失败", apiReflectionDTO.getTarget_api()), e.getMessage()); + } + } + + //目标接口 + private JSONObject targetApi(JSONObject jsonObject, String source_res) { + ApiReflectionDTO apiReflectionDTO = jsonObject.getObject("main",ApiReflectionDTO.class); + //配置的字段映射关系 + List apiRefDetailList = jsonObject.getObject("details",List.class); + //目标接口body参数 + List paramProList = JSON.parseArray(apiReflectionDTO.getTarget_body_in(), ParameterPropertyDTO.class);//目标接口body_in参数 + JSONObject param = new JSONObject();//最终的参数 + JSONObject data = new JSONObject();//body参数 + for (ApiReflectionDetailEntity ref : apiRefDetailList) {//循环取配置参数 + int index = 0; + String[] pathSegments = ref.getTarget_path().split("\\.");//分割path + if (pathSegments.length > 1) {//如果大于1说明是有层级的 + JSONObject sub = data; + String preSegment = null; + for (int i = 0; i < pathSegments.length - 1; i++) { + String segment = pathSegments[i]; + sub.putIfAbsent(segment, new JSONObject()); + sub = sub.getJSONObject(segment); + preSegment = segment; + index = i; + } + String lastSegment = pathSegments[pathSegments.length - 1];//最后一个节点 + Object valObj = getByPath(source_res, ref.getSource_path());//获取源接口返回的数据 + String varStr = JSONUtil.toJsonStr(valObj); + if (!JSONUtil.isTypeJSONArray(varStr)) {//判断一下是返回值是否为数组。 这里不能根据返回值来判断是否数组,要根据节点的属性来判断 + sub.put(lastSegment, valObj); + } else { + String currentPath = String.join(".", Arrays.copyOf(pathSegments, pathSegments.length - (index + 1)));// + String preData = data.getJSONObject(currentPath).getString(preSegment);// + if (StrUtil.isNotEmpty(preData)){ + JSONArray jsonArray; + if (JSONUtil.isTypeJSONObject(preData)) { + jsonArray = new JSONArray(); + data.getJSONObject(currentPath).put(preSegment, jsonArray); + } else { + jsonArray = data.getJSONObject(currentPath).getJSONArray(preSegment); + } + String val = JSONUtil.toJsonStr(valObj); + if (StrUtil.isNotEmpty(val)) { + if (JSONUtil.isTypeJSONArray(val)) { + JSONArray array = JSONObject.parseArray(val); + for (int i = 0; i < array.size(); i++) { + String detailVal = array.getString(i); + if (!JSONUtil.isTypeJSON(detailVal)) { + JSONObject detailObj = null; + if (jsonArray.size() > 0 && jsonArray.size() > i) { + detailObj = (JSONObject) jsonArray.get(i); + } + if (detailObj == null) { + detailObj = new JSONObject(); + detailObj.put(lastSegment, detailVal); + jsonArray.add(detailObj); + } else { + detailObj.put(lastSegment, detailVal); + } + } + } + } + } + }else { + //判断一下是不是主表返回数组的情况 + JSONArray jsonArray = JSON.parseArray(varStr); + if (CollectionUtils.isNotEmpty(jsonArray)){ + + } + } + } + } else { + if (pathSegments.length == 1) { + param.put(ref.getTarget_field(), getByPath(source_res, ref.getSource_path())); + } + } + } + + JSONObject targetObj = new JSONObject(); + targetObj.put("api_id",apiReflectionDTO.getTarget_api_id()); + targetObj.put("expand_param",data.toJSONString()); + try { + //调用目标接口 + JSONObject targetRes = excApiService.execute(targetObj); + return targetRes; + }catch (Exception e){ + logger.error("执行api失败:{}",apiReflectionDTO.getTarget_api(),e.getMessage()); + JSONObject error = new JSONObject(); + error.put("flag",false); + error.put("msg",e.getMessage()); + return error; + } + } + + + + + //解构json对象 + private static void traverseJSONObject(JSONObject jsonObject, String currentPath, JSONObject result) { + for (String key : jsonObject.keySet()) { + Object value = jsonObject.get(key); + String newPath = currentPath.isEmpty() ? key : currentPath + "." + key; + if (value instanceof JSONObject) { + traverseJSONObject((JSONObject) value, newPath, result); + } else { + result.put(newPath, value); + } + } + } + + + //检查目标接口是否需要登陆,登陆完成后设置token参数 + private void checkLogin(ApiReflectionDTO apiReflectionDTO, HttpRequest target_api, JSONObject param) { + if (SysEnum.NEED_LOGIN.getValue().equals(apiReflectionDTO.getNeed_login())) { + //找到登陆接口 + AppApi loginApi = appApiService.getByid(apiReflectionDTO.getAuthentication_port()); + if (null != loginApi) { + //构造登陆接口 + HttpRequest login_api = HttpRequest.of(loginApi.getDestinationAddress()); + login_api.method(Method.valueOf(loginApi.getRequestMethod().toUpperCase())); + login_api.addHeaders(getHeaders(loginApi.getHeaderIn())); + login_api.body(getBodys(loginApi.getBodyIn())); + String login_res = login_api.timeout(60000).execute().body(); + cn.hutool.json.JSONObject loginJson = JSONUtil.parseObj(login_res); + //找到目标接口请求头中的认证参数 + JSONObject auth = getAuth(apiReflectionDTO.getTarget_header()); + //取token + String token = (String) JSONUtil.getByPath(loginJson, auth.getString(EXAMPLE)); + target_api.header(auth.getString(PARAMETERNAME), token); + //判断目标body参数是否有认证参数 + if (param.containsKey(AUTHPORT)) { + param.remove(AUTHPORT);//移除这个节点 + param.put(auth.getString(PARAMETERNAME), token);//给body添加授权参数 + } + } + } + } + + //检查参数 + private JSONObject checkParam(JSONObject json){ + JSONObject res = new JSONObject(); + boolean flag =true; + String res_msg = null; + if (null == json) { + res_msg="参数不能为空"; + flag = false; + } + if (StrUtil.isEmpty(json.getString("jsonStr"))) { + res_msg="参数不能为空"; + flag = false; + } + if (StrUtil.isEmpty(json.getJSONObject("jsonStr").getString("ref_id"))) { + res_msg="场景id不能为空"; + flag = false; + } + JSONObject jsonStr = json.getJSONObject("jsonStr"); + String ref_id = jsonStr.getString("ref_id"); + ApiReflectionDTO apiReflectionDTO = apiReflectionService.queryApiRefById(ref_id); + if (null == apiReflectionDTO) { + res_msg="根据场景id查询不到场景"; + flag = false; + }else { + res.put("main",apiReflectionDTO); + } + //查询配置的字段映射关系 + ApiReflectionDetailEntity apiRefDetail = new ApiReflectionDetailEntity(); + apiRefDetail.setMainid(ref_id); + List apiRefDetailList = apiReflectionDetailService.query(apiRefDetail); + if (CollectionUtils.isEmpty(apiRefDetailList)) { + res_msg="没有查询到场景明细数据"; + flag = false; + }else { + res.put("details",apiRefDetailList); + } + res.put("msg",res_msg); + res.put("flag",flag); + return res; + } + + //调用源接口 + private String sourceApi(ApiReflectionDTO apiReflectionDTO) { + HttpRequest source_api = HttpRequest.of(apiReflectionDTO.getSource_api()).timeout(Integer.valueOf(apiReflectionDTO.getSource_timeout())); + source_api.method(Method.valueOf(apiReflectionDTO.getSource_method().toUpperCase())); + source_api.addHeaders(getHeaders(apiReflectionDTO.getSource_header()));//请求头 + JSONObject param = new JSONObject(); + checkLogin(apiReflectionDTO, source_api, param); + String bodys = getBodys(apiReflectionDTO.getSource_body_in()); + param.fluentPutAll(JSON.parseObject(bodys)); + if (StrUtil.isNotEmpty(apiReflectionDTO.getSource_expand_param())) { + JSONObject expandParam = JSONObject.parseObject(apiReflectionDTO.getSource_expand_param()); + param.fluentPutAll(expandParam); + } + source_api.body(param.toJSONString());//body + logger.info("源接口:{} , 请求参数:{}", source_api.getUrl(), param); + String source_res = source_api.execute().body(); + logger.info("源接口:{} , 响应参数:{}", source_api.getUrl(), source_res); + return source_res; + } + + /** + * 根据层级获取json数据 + * + * @param str json字符串 + * @param path 层级 + * @return + */ + private Object getByPath(String str, String path) { + if (StrUtil.isNotEmpty(str) && StrUtil.isNotEmpty(path)) { + Object byPath = JSONUtil.getByPath(JSONUtil.parse(str), path);//如果是数组会返回[value,value]这种格式 + return byPath; + } + return null; + } + + //请求头信息 + private Map getHeaders(String haders) { + if (StrUtil.isNotEmpty(haders)) { + if (JSONUtil.isTypeJSONArray(haders)) { + Map headerMap = new LinkedHashMap<>(); + JSONArray headerArray = JSON.parseArray(haders); + for (int i = 0; i < headerArray.size(); i++) { + JSONObject heade = (JSONObject) headerArray.get(i); + headerMap.put(heade.getString(PARAMETERNAME), heade.getString(EXAMPLE)); + } + return headerMap; + } + } + return null; + } + + //body参数 + private String getBodys(String bodyStr) { + if (StrUtil.isNotEmpty(bodyStr)) { + if (JSONUtil.isTypeJSONArray(bodyStr)) { + JSONObject bodyParam = new JSONObject(new LinkedHashMap<>()); + JSONArray bodyArray = JSON.parseArray(bodyStr); + for (int i = 0; i < bodyArray.size(); i++) { + JSONObject body = (JSONObject) bodyArray.get(i); + String parameterType = body.getString(PARAMETERTYPE); + if (!AUTHPORT.equals(parameterType)) {//判断body中是否包含认证参数 + bodyParam.put(body.getString(PARAMETERNAME), body.getString(EXAMPLE)); + } else {//如有存在认证参数,特殊处理 + JSONObject authport = new JSONObject(); + authport.put(body.getString(PARAMETERNAME), body.getString(EXAMPLE)); + bodyParam.put(AUTHPORT, authport); + } + } + return bodyParam.toJSONString(); + } + } + return null; + } + + //认证参数 + private JSONObject getAuth(String headers) { + if (StrUtil.isNotEmpty(headers)) { + if (JSONUtil.isTypeJSONArray(headers)) { + Map headerMap = new LinkedHashMap<>(); + JSONArray headerArray = JSON.parseArray(headers); + for (int i = 0; i < headerArray.size(); i++) { + JSONObject heade = (JSONObject) headerArray.get(i); + if (AUTHPORT.equals(heade.getString(PARAMETERTYPE))) { + //判断一下 认证参数的层级 + if (JSONUtil.isTypeJSONArray(heade.getString(EXAMPLE))) { + List list = JSONObject.parseArray(heade.getString(EXAMPLE), String.class); + if (CollectionUtils.isNotEmpty(list)) { + String join = StrUtil.join(".", list); + heade.put(EXAMPLE, join); + } + } + return heade; + } + } + } + } + return null; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiReflectionDetailServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiReflectionDetailServiceImpl.java new file mode 100644 index 00000000..696b3860 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiReflectionDetailServiceImpl.java @@ -0,0 +1,27 @@ +package com.hzya.frame.sys.apireflection.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; +import com.hzya.frame.sys.apireflection.service.IApiReflectionDetailService; +import com.hzya.frame.sys.apireflection.dao.IApiReflectionDetailDao; +import com.hzya.frame.basedao.service.impl.BaseService; + +/** + * @description: 接口映射配置 service + * @tableName: sys_api_reflection_detail + * @entityName: ApiReflectionDetailEntity + * @author: gjh + * @history: 1.0 + */ +@Service(value = "sys_api_reflection_detailService") +public class ApiReflectionDetailServiceImpl extends BaseService implements IApiReflectionDetailService { + + protected IApiReflectionDetailDao apireflectiondetailDao; + + @Autowired + public void setApiReflectionDetailDao(IApiReflectionDetailDao dao) { + this.apireflectiondetailDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiReflectionServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiReflectionServiceImpl.java new file mode 100644 index 00000000..298adebe --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/apireflection/service/impl/ApiReflectionServiceImpl.java @@ -0,0 +1,213 @@ +package com.hzya.frame.sys.apireflection.service.impl; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.sys.apireflection.dao.IApiReflectionDao; +import com.hzya.frame.sys.apireflection.dao.IApiReflectionDetailDao; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDTO; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionDetailEntity; +import com.hzya.frame.sys.apireflection.entity.ApiReflectionEntity; +import com.hzya.frame.sys.apireflection.service.IApiReflectionService; +import com.hzya.frame.uuid.UUIDLong; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.apache.ibatis.session.SqlSession; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * @description: 接口映射配置 service + * @tableName: sys_api_reflection + * @entityName: ApiReflectionEntity + * @author: gjh + * @history: 1.0 + */ +@Service(value = "apiReflectionService") +public class ApiReflectionServiceImpl extends BaseService implements IApiReflectionService { + + protected IApiReflectionDao apireflectionDao; + @Autowired + private IApiReflectionDetailDao apiReflectionDetailDao; + @Autowired + @Resource + private SqlSession sqlSession; + + @Autowired + public void setApiReflectionDao(IApiReflectionDao dao) { + this.apireflectionDao = dao; + this.dao = dao; + } + /** + * 查询所有 + * @param jsonObject + * @return + */ + /*@Override + public JsonResultEntity queryList(JSONObject jsonObject) { + ApiReflectionEntity entity = JSON.parseObject(jsonObject.toJSONString(),ApiReflectionEntity.class); + List apiReflectionEntityList = apireflectionDao.queryList(entity); + return BaseResult.getSuccessMessageEntity(apiReflectionEntityList); + }*/ + + /** + * 根据id查询单个 + * + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity queryOneById(JSONObject jsonObject) { + ApiReflectionEntity apiReflectionEntity = JSONObject.parseObject(jsonObject.getString("jsonStr")).toJavaObject(ApiReflectionEntity.class); + if (null == apiReflectionEntity.getId() || "".equals(apiReflectionEntity.getId())) { + return BaseResult.getFailureMessageEntity("单个查看得时候请携带id"); + } + ApiReflectionEntity apiReflectionEntityOne = apireflectionDao.queryOneById(apiReflectionEntity.getId()); + ApiReflectionDetailEntity apiReflectionDetailEntity = new ApiReflectionDetailEntity(); + apiReflectionDetailEntity.setMainid(apiReflectionEntity.getId()); + List apiReflectionDetailEntityListBase = apiReflectionDetailDao.query(apiReflectionDetailEntity); + JSONObject jsonObjectResult = new JSONObject(); + jsonObjectResult.put("main", apiReflectionEntityOne); + List list = new ArrayList<>(); + for (ApiReflectionDetailEntity reflectionDetailEntity : apiReflectionDetailEntityListBase) { + list.add(reflectionDetailEntity); + } + jsonObjectResult.put("details", list); + return BaseResult.getSuccessMessageEntity(jsonObjectResult); + } + + /** + * 保存 + * + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity saveApiReflection(JSONObject jsonObject) { + //ApiReflectionEntity apiReflectionEntity = JSONObject.parseObject(jsonObject.getString("jsonStr")).toJavaObject(ApiReflectionEntity.class); + ApiReflectionEntity apiReflectionEntity = getData("jsonStr", jsonObject, ApiReflectionEntity.class); + if (null == apiReflectionEntity.getRef_code() || "".equals(apiReflectionEntity.getRef_code())) { + return BaseResult.getFailureMessageEntity("请输入场景编码"); + } + if (null == apiReflectionEntity.getRef_name() || "".equals(apiReflectionEntity.getRef_name())) { + return BaseResult.getFailureMessageEntity("请输入场景名称"); + } + if (null == apiReflectionEntity.getRef_type() || "".equals(apiReflectionEntity.getRef_type())) { + return BaseResult.getFailureMessageEntity("请输入场景分类"); + } + if (null == apiReflectionEntity.getSource_api_app() || "".equals(apiReflectionEntity.getSource_api_app())) { + return BaseResult.getFailureMessageEntity("请选择源应用"); + } + if (null == apiReflectionEntity.getTarget_api_app() || "".equals(apiReflectionEntity.getTarget_api_app())) { + return BaseResult.getFailureMessageEntity("请选择目标应用"); + } + if (null == apiReflectionEntity.getDescription() || "".equals(apiReflectionEntity.getDescription())) { + return BaseResult.getFailureMessageEntity("请输入场景描述"); + } + //设置接口映射配置id + long uuid = UUIDLong.longUUID(); + apiReflectionEntity.setId(String.valueOf(uuid)); + String jsonStr = jsonObject.getString("jsonStr"); + JSONObject jsonObjectStr = JSONObject.parseObject(jsonStr); + //判断是否是插件,如果是插件,明细数据不保存,如果不是插件,明细数据保存 1是2否 + String plug = jsonObjectStr.getString("plug"); + //不是插件 2 + String isNotPlug = "2"; + //是插件 1 + String isPlug = "1"; + if (isNotPlug.equals(plug)) { + //获取接口映射配置明细数据 + JSONArray jsonArray = jsonObjectStr.getJSONArray("details"); + for (Object object : jsonArray) { + String jsonString = JSON.toJSONString(object); + JSONObject jsonObjectDeatils = JSONObject.parseObject(jsonString); + ApiReflectionDetailEntity apiReflectionDetailEntity = jsonObjectDeatils.toJavaObject(ApiReflectionDetailEntity.class); + //设置接口映射配置明细id + long uuidDetails = UUIDLong.longUUID(); + apiReflectionDetailEntity.setId(String.valueOf(uuidDetails)); + apiReflectionDetailEntity.setMainid(String.valueOf(uuid)); + apiReflectionDetailDao.save(apiReflectionDetailEntity); + } + } + apiReflectionEntity = apireflectionDao.saveApiReflection(apiReflectionEntity); + return BaseResult.getSuccessMessageEntity("新增成功", apiReflectionEntity.getId()); + } + + /** + * 修改 + * + * @param jsonObject + * @return + */ + @Override + public JsonResultEntity updateApiReflection(JSONObject jsonObject) { + //ApiReflectionEntity apiReflectionEntity = JSONObject.parseObject(jsonObject.getString("jsonStr")).toJavaObject(ApiReflectionEntity.class); + ApiReflectionEntity apiReflectionEntity = getData("jsonStr", jsonObject, ApiReflectionEntity.class); + if (null == apiReflectionEntity.getId() || "".equals(apiReflectionEntity.getId())) { + return BaseResult.getFailureMessageEntity("修改时候请携带id"); + } + //修改时,先将明细表数据删除,然后再新增 + ApiReflectionDetailEntity apiReflectionDetailEntity = new ApiReflectionDetailEntity(); + apiReflectionDetailEntity.setMainid(apiReflectionEntity.getId()); + apiReflectionDetailDao.update("ApiReflectionDetailEntity_update_details", apiReflectionDetailEntity); + //解析明细数据 + String jsonStr = jsonObject.getString("jsonStr"); + JSONObject jsonObjectStr = JSONObject.parseObject(jsonStr); + JSONArray jsonArray = jsonObjectStr.getJSONArray("details"); + //判断是否是插件,如果是插件,明细数据不保存,如果不是插件,明细数据保存 1是2否 + String plug = jsonObjectStr.getString("plug"); + //不是插件 2 + String isNotPlug = "2"; + //是插件 1 + String isPlug = "1"; + if (isNotPlug.equals(plug)) { + for (Object object : jsonArray) { + String jsonString = JSON.toJSONString(object); + JSONObject jsonObjectDeatils = JSONObject.parseObject(jsonString); + ApiReflectionDetailEntity apiReflectionDetailEntitySave = jsonObjectDeatils.toJavaObject(ApiReflectionDetailEntity.class); + //设置接口映射配置明细id + long uuidDetails = UUIDLong.longUUID(); + //保存接口映射配置明细数据 + apiReflectionDetailEntitySave.setId(String.valueOf(uuidDetails)); + apiReflectionDetailEntitySave.setMainid(String.valueOf(apiReflectionEntity.getId())); + apiReflectionDetailDao.save(apiReflectionDetailEntitySave); + } + } + apireflectionDao.updateApiReflection(apiReflectionEntity); + return BaseResult.getSuccessMessageEntity("修改成功", apiReflectionEntity.getId()); + } + + /** + * 删除 将sts修改为N + * + * @param + * @return + */ + @Override + public JsonResultEntity deleteApiReflection(JSONObject jsonObject) { + ApiReflectionEntity apiReflectionEntity = JSONObject.parseObject(jsonObject.getString("jsonStr")).toJavaObject(ApiReflectionEntity.class); + if (null == apiReflectionEntity.getId() || "".equals(apiReflectionEntity.getId())) { + return BaseResult.getFailureMessageEntity("删除时候id不能为null"); + } + apireflectionDao.deleteApiReflection(apiReflectionEntity.getId()); + ApiReflectionDetailEntity apiReflectionDetailEntity = new ApiReflectionDetailEntity(); + apiReflectionDetailEntity.setMainid(apiReflectionEntity.getId()); + apiReflectionDetailDao.update("ApiReflectionDetailEntity_logicDelete_Multi_Condition", apiReflectionDetailEntity); + return BaseResult.getSuccessMessageEntity("删除成功", apiReflectionEntity.getId()); + } + + @Override + public ApiReflectionDTO queryApiRefById(String ref_id) { + ApiReflectionDTO apiReflectionDTO = new ApiReflectionDTO(); + apiReflectionDTO.setRef_id(ref_id); + List list = sqlSession.selectList("com.hzya.frame.sys.apireflection.dao.impl.ApiReflectionDaoImpl.ApiReflectionEntity_list_view", apiReflectionDTO); + return CollectionUtils.isNotEmpty(list) ? list.get(0) : null; + } + +} diff --git a/service/src/main/java/com/hzya/frame/sys/app/controller/SysAppController.java b/service/src/main/java/com/hzya/frame/sys/app/controller/SysAppController.java new file mode 100644 index 00000000..4ab8defa --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/app/controller/SysAppController.java @@ -0,0 +1,101 @@ +package com.hzya.frame.sys.app.controller; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.app.service.ISysAppService; +import com.hzya.frame.sys.app.service.impl.SysAppServiceImpl; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +/** + * @description: 应用表 controller + * @tableName: sys_app + * @entityName: sysApp + * @author: llg + * @history: 1.0 + */ + +@Controller() +@RequestMapping("sysApp") +public class SysAppController { + @Autowired + protected ISysAppService sysAppService; + /** + * @Author lvleigang + * @Description 分页查询应用 + * @Date 9:44 上午 2023/3/1 + * @param servletRequest + * @param servletResponse + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @RequestMapping(value = "/queryPageApp") + @ResponseBody + public JsonResultEntity queryPageApp(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + return sysAppService.queryPageApp(new JSONObject()); + } + /** + * @Author lvleigang + * @Description 根据应用id查询 + * @Date 11:15 上午 2023/3/6 + * @param servletRequest + * @param servletResponse + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @RequestMapping(value = "/queryApp") + @ResponseBody + public JsonResultEntity queryApp(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + return sysAppService.queryApp(new JSONObject()); + } + + /** + * @Author lvleigang + * @Description 新增应用 + * @Date 9:44 上午 2023/3/1 + * @param servletRequest + * @param servletResponse + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @RequestMapping(value = "/addApp") + @ResponseBody + public JsonResultEntity addApp(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + return sysAppService.addApp(new JSONObject()); + } + + /** + * @Author lvleigang + * @Description 修改应用 + * @Date 9:44 上午 2023/3/1 + * @param servletRequest + * @param servletResponse + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @RequestMapping(value = "/updateApp") + @ResponseBody + public JsonResultEntity updateApp(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + return sysAppService.updateApp(new JSONObject()); + } + + /** + * @Author lvleigang + * @Description 删除应用 + * @Date 9:44 上午 2023/3/1 + * @param servletRequest + * @param servletResponse + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @RequestMapping(value = "/delectProduct") + @ResponseBody + public JsonResultEntity delectApp(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + return sysAppService.delectApp(new JSONObject()); + } + + + + + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/app/dao/ISysAppMapper.java b/service/src/main/java/com/hzya/frame/sys/app/dao/ISysAppMapper.java new file mode 100644 index 00000000..08b71e60 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/app/dao/ISysAppMapper.java @@ -0,0 +1,44 @@ +package com.hzya.frame.sys.app.dao; + + +import com.hzya.frame.sys.app.entity.SysApp; + +import java.util.List; + +/** + * @description: 应用表 dao + * @tableName: sys_app + * @entityName: SysApp + * @author: llg + * @history:1.0 + */ +public interface ISysAppMapper { + //通过ID获取数据 entity_get + SysApp entity_get(String id); + + //查询 采用==查询 entity_list_base + List entity_list_base(SysApp SysApp); + + //分页查询列表 采用like格式 entity_list_like + List entity_list_like(SysApp SysApp); + + //分页查询列表 采用like格式 entity_list_like + List entity_list_like_page(SysApp SysApp); + + //查询列表 字段采用or格式 entity_list_or + List entity_list_or(SysApp SysApp); + + //新增 entity_insert + Integer entity_insert(SysApp SysApp); + + //修改 entity_update + Integer entity_update(SysApp SysApp); + + //物理删除 entity_delete + Integer entity_delete(SysApp SysApp); + + + Integer logicDelete_Multi_Condition(SysApp sysApp); + + Integer entity_list_base_count(SysApp checkEntity); +} diff --git a/service/src/main/java/com/hzya/frame/sys/app/dao/impl/SysAppMapperImpl.java b/service/src/main/java/com/hzya/frame/sys/app/dao/impl/SysAppMapperImpl.java new file mode 100644 index 00000000..79208215 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/app/dao/impl/SysAppMapperImpl.java @@ -0,0 +1,100 @@ +package com.hzya.frame.sys.app.dao.impl; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sys.app.dao.ISysAppMapper; +import com.hzya.frame.sys.app.entity.SysApp; +import com.hzya.frame.web.exception.BaseSystemException; +import org.apache.ibatis.session.SqlSession; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @description: 应用表 dao + * @tableName: sys_app + * @entityName: SysApp + * @author: llg + * @history:1.0 + */ +@Service +public class SysAppMapperImpl extends MybatisGenericDao implements ISysAppMapper { + + @Override + public SysApp entity_get(String id) { + + SysApp o = (SysApp) super.selectOne(getSqlIdPrifx() + "entity_get", id); + return o; + + } + + @Override + public List entity_list_base(SysApp entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_base", entity); + return o; + } + + @Override + public Integer entity_list_base_count(SysApp entity) { + + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_list_base_count", entity); + return o; + + } + + @Override + public List entity_list_like(SysApp entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_like", entity); + return o; + + } + + @Override + public List entity_list_like_page(SysApp entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_like_page", entity); + return o; + + } + + @Override + public List entity_list_or(SysApp entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_or", entity); + return o; + + } + + @Override + public Integer entity_insert(SysApp entity) { + + Integer o = super.insert(getSqlIdPrifx() + "entity_insert", entity); + return o; + + } + + @Override + public Integer entity_update(SysApp entity) { + + Integer o = super.update(getSqlIdPrifx() + "entity_update", entity); + return o; + + } + + @Override + public Integer entity_delete(SysApp entity) { + + Integer o = super.delete(getSqlIdPrifx() + "entity_delete", entity); + return o; + + } + + @Override + public Integer logicDelete_Multi_Condition(SysApp entity) { + + Integer o = super.delete(getSqlIdPrifx() + "logicDelete_Multi_Condition", entity); + return o; + + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/app/entity/SysApp.java b/service/src/main/java/com/hzya/frame/sys/app/entity/SysApp.java new file mode 100644 index 00000000..ad952d9a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/app/entity/SysApp.java @@ -0,0 +1,302 @@ +package com.hzya.frame.sys.app.entity; + +import cn.dev33.satoken.stp.StpUtil; +import com.hzya.frame.sys.appParameter.entity.SysAppParameter; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.Date; +import java.util.List; + +/** + * @description: 应用表 + * @tableName: sys_app + * @entityName: sysApp + * @author: llg + * @history: 1.0 + */ +public class SysApp extends BaseEntity { + /** 主键ID*/ + private String id; + /** 产品id */ + private String productId; + /** 应用名称 */ + private String name; + /** 应用编号 */ + private String code; + /** 应用图标PC地址 */ + private String pcPath; + /** 应用图标移动端地址 */ + private String phonePath; + /** 登记产品编码 */ + private String registeredProductCode; + /** 版本号 */ + private String versionNumber; + /** 版本说明 */ + private String versionDescription; + /** 应用说明 */ + private String appDescription; + /** 应用标签 */ + private String appLabel; + /** 应用服务商 */ + private String appServiceProvider; + /** 接入方式 */ + private String accessMode; + /** 排序号 */ + private Long sorts; + /** 组织机构ID */ + private String orgId; + /** 状态 1有效 0无效 */ + private String sts; + /** 创建人ID*/ + private String createUserId; + /** 创建时间ID */ + private Date createTime; + /** 修改时间*/ + private Date modifyTime; + /** 修改人ID*/ + private String modifyUserId; + private String registeredProductCodeName; + private String accessModeName; + private String versionNumberName; + + //页数 利用pageHelper + private Integer pageNum; + //数量 利用pageHelper + private Integer pageSize; + + //应用参数 + private List sysAppParameterList; + + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getPcPath() { + return pcPath; + } + + public void setPcPath(String pcPath) { + this.pcPath = pcPath; + } + + public String getPhonePath() { + return phonePath; + } + + public void setPhonePath(String phonePath) { + this.phonePath = phonePath; + } + + public String getRegisteredProductCode() { + return registeredProductCode; + } + + public void setRegisteredProductCode(String registeredProductCode) { + this.registeredProductCode = registeredProductCode; + } + + public String getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(String versionNumber) { + this.versionNumber = versionNumber; + } + + public String getVersionDescription() { + return versionDescription; + } + + public void setVersionDescription(String versionDescription) { + this.versionDescription = versionDescription; + } + + public String getAppDescription() { + return appDescription; + } + + public void setAppDescription(String appDescription) { + this.appDescription = appDescription; + } + + public String getAppLabel() { + return appLabel; + } + + public void setAppLabel(String appLabel) { + this.appLabel = appLabel; + } + + public String getAppServiceProvider() { + return appServiceProvider; + } + + public void setAppServiceProvider(String appServiceProvider) { + this.appServiceProvider = appServiceProvider; + } + + public String getAccessMode() { + return accessMode; + } + + public void setAccessMode(String accessMode) { + this.accessMode = accessMode; + } + + public Long getSorts() { + return sorts; + } + + public void setSorts(Long sorts) { + this.sorts = sorts; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + + public String getCreateUserId() { + return createUserId; + } + + public void setCreateUserId(String createUserId) { + this.createUserId = createUserId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public String getModifyUserId() { + return modifyUserId; + } + + public void setModifyUserId(String modifyUserId) { + this.modifyUserId = modifyUserId; + } + + public List getSysAppParameterList() { + return sysAppParameterList; + } + + public void setSysAppParameterList(List sysAppParameterList) { + this.sysAppParameterList = sysAppParameterList; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + @Override + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + //创建新增产品信息 + public void setCreateApp() { + this.id = UUIDUtils.getUUID(); + this.orgId =""; + this.sts = "Y"; + this.createUserId = String.valueOf( StpUtil.getLoginId()); + this.createTime = new Date(); + this.modifyTime = new Date(); + this.modifyUserId = String.valueOf( StpUtil.getLoginId()); + } + + + //创建新增产品信息 + public void setUpdateApp() { + this.modifyTime = new Date(); + this.modifyUserId = String.valueOf( StpUtil.getLoginId()); + } + + public String getRegisteredProductCodeName() { + return registeredProductCodeName; + } + + public void setRegisteredProductCodeName(String registeredProductCodeName) { + this.registeredProductCodeName = registeredProductCodeName; + } + + public String getAccessModeName() { + return accessModeName; + } + + public void setAccessModeName(String accessModeName) { + this.accessModeName = accessModeName; + } + + public String getVersionNumberName() { + return versionNumberName; + } + + public void setVersionNumberName(String versionNumberName) { + this.versionNumberName = versionNumberName; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public String getSts() { + return sts; + } + + @Override + public void setSts(String sts) { + this.sts = sts; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/app/entity/SysAppMapper.xml b/service/src/main/java/com/hzya/frame/sys/app/entity/SysAppMapper.xml new file mode 100644 index 00000000..db815105 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/app/entity/SysAppMapper.xml @@ -0,0 +1,379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID as id, + product_id as product_id, + name as name, + code as code, + pc_path as pc_path, + phone_path as phone_path, + registered_product_code as registered_product_code, + version_number as version_number, + version_description as version_description, + app_description as app_description, + app_label as app_label, + app_service_provider as app_service_provider, + access_mode as access_mode, + sorts as sorts, + org_id as org_id, + sts as sts, + create_user_id as create_user_id, + create_time as create_time, + modify_time as modify_time, + modify_user_id as modify_user_id + + + + a.ID as id, + a.product_id as product_id, + a.name as name, + a.code as code, + a.pc_path as pc_path, + a.phone_path as phone_path, + a.registered_product_code as registered_product_code, + b.code as registered_product_code_name, + a.version_number as version_number, + c.version_number as version_number_name, + a.version_description as version_description, + a.app_description as app_description, + a.app_label as app_label, + a.app_service_provider as app_service_provider, + a.access_mode as access_mode, + d.column_content as access_mode_name, + a.sorts as sorts, + a.org_id as org_id, + a.sts as sts, + a.create_user_id as create_user_id, + a.create_time as create_time, + a.modify_time as modify_time, + a.modify_user_id as modify_user_id + + + + + + + + + + + + + + + + + + + + + + + + + + insert into sys_app( + + ID, + product_id, + name, + code, + pc_path, + phone_path, + registered_product_code, + version_number, + version_description, + app_description, + app_label, + app_service_provider, + access_mode, + sorts, + org_id, + sts, + create_user_id, + create_time, + modify_time, + modify_user_id, + + + + )values + ( + + #{id}, + #{productId}, + #{name}, + #{code}, + #{pcPath}, + #{phonePath}, + #{registeredProductCode}, + #{versionNumber}, + #{versionDescription}, + #{appDescription}, + #{appLabel}, + #{appServiceProvider}, + #{accessMode}, + #{sorts}, + #{orgId}, + #{sts}, + #{createUserId}, + #{createTime}, + #{modifyTime}, + #{modifyUserId}, + + + ) + + + + + update sys_app set + + ID = #{id}, + product_id = #{productId}, + name = #{name}, + code = #{code}, + pc_path = #{pcPath}, + phone_path = #{phonePath}, + registered_product_code = #{registeredProductCode}, + version_number = #{versionNumber}, + version_description = #{versionDescription}, + app_description = #{appDescription}, + app_label = #{appLabel}, + app_service_provider = #{appServiceProvider}, + access_mode = #{accessMode}, + sorts = #{sorts}, + org_id = #{orgId}, + sts = #{sts}, + create_user_id = #{createUserId}, + create_time = #{createTime}, + modify_time = #{modifyTime}, + modify_user_id = #{modifyUserId}, + + + where id = #{id} + + + + update sys_app set + sts='N',modify_time = #{modifyTime} ,modify_user_id = #{modifyUserId} + + and ID = #{id} + and product_id = #{productId} + and name = #{name} + and code = #{code} + and pc_path = #{pcPath} + and phone_path = #{phonePath} + and registered_product_code = #{registeredProductCode} + and version_number = #{versionNumber} + and version_description = #{versionDescription} + and app_description = #{appDescription} + and app_label = #{appLabel} + and app_service_provider = #{appServiceProvider} + and access_mode = #{accessMode} + and sorts = #{sorts} + and org_id = #{orgId} + and sts = #{sts} + and create_user_id = #{createUserId} + and create_time = #{createTime} + + + + + delete from sys_app where id =#{id} + + diff --git a/service/src/main/java/com/hzya/frame/sys/app/service/ISysAppService.java b/service/src/main/java/com/hzya/frame/sys/app/service/ISysAppService.java new file mode 100644 index 00000000..eda2cbdc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/app/service/ISysAppService.java @@ -0,0 +1,69 @@ +package com.hzya.frame.sys.app.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * @description: 系统菜单 service + * @tableName: sys_module_new + * @entityName: SysModuleNewEntity + * @author: gjh + * @history: 1.0 + */ +public interface ISysAppService { + + /** + * @Author lvleigang + * @Description 根据应用id查询 + * @Date 11:15 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryApp(JSONObject object); + + /** + * @Author lvleigang + * @Description 新增应用 + * @Date 11:16 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity addApp(JSONObject object); + + /** + * @Author lvleigang + * @Description 修改应用 + * @Date 11:16 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateApp(JSONObject object); + + + /** + * @Author lvleigang + * @Description 删除应用 + * @Date 11:16 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity delectApp(JSONObject object); + + /** + * @Author lvleigang + * @Description 分页查询应用 + * @Date 11:16 上午 2023/3/6 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryPageApp(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 分页查询应用 + * @Date 11:16 上午 2023/3/6 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryList(JSONObject jsonObject); +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/sys/app/service/impl/SysAppServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/app/service/impl/SysAppServiceImpl.java new file mode 100644 index 00000000..f11deff0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/app/service/impl/SysAppServiceImpl.java @@ -0,0 +1,234 @@ +package com.hzya.frame.sys.app.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.sys.app.dao.ISysAppMapper; +import com.hzya.frame.sys.app.entity.SysApp; +import com.hzya.frame.sys.app.service.ISysAppService; +import com.hzya.frame.sys.appParameter.dao.ISysAppParameterMapper; +import com.hzya.frame.sys.appParameter.entity.SysAppParameter; +import com.hzya.frame.serviceUtil.ServiceUtil; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; + +/** + * @description: 应用表 service + * @tableName: sys_app + * @entityName: Sysapp + * @author: llg + * @history: 1.0 + */ +@Service(value="sysAppService") +public class SysAppServiceImpl extends ServiceUtil implements ISysAppService { + + @Resource + private ISysAppMapper sysAppMapper; + @Resource + private ISysAppParameterMapper sysAppParameterMapper; + /** + * @Author lvleigang + * @Description 根据应用id查询 + * @Date 11:18 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryApp(JSONObject object) { + SysApp sysApp = getData("jsonStr",object,SysApp.class); + if(sysApp == null || sysApp.getId() == null || "".equals(sysApp.getId())){ + return BaseResult.getFailureMessageEntity("查询应用id不存在"); + } + //查询应用 + SysApp queryEntity = sysAppMapper.entity_get(sysApp.getId()); + if(queryEntity == null || queryEntity.getId() == null || "".equals(queryEntity.getId())){ + return BaseResult.getFailureMessageEntity("查询应用不存在"); + } + //查询应用参数 + //SysAppParameter sysAppParameter = new SysAppParameter(); + //sysAppParameter.setAppId(queryEntity.getId()); + //sysAppParameter.setSts("Y"); + //List sysAppParameterList = sysAppParameterMapper.entity_list_base(sysAppParameter); + //queryEntity.setSysAppParameterList(sysAppParameterList); + return BaseResult.getSuccessMessageEntity("获取应用成功", queryEntity); + } + /** + * @Author lvleigang + * @Description 新增应用 + * @Date 11:16 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity addApp(JSONObject object) { + SysApp sysApp = getData("jsonStr",object,SysApp.class); + if(sysApp == null){ + return BaseResult.getFailureMessageEntity("请求参数不存在"); + } + //判断产品编号是否重复 + SysApp checkEntity = new SysApp(); + checkEntity.setCode(sysApp.getCode()); + checkEntity.setSts("Y"); + Integer count = sysAppMapper.entity_list_base_count(checkEntity); + if(count != null && count> 0){ + return BaseResult.getFailureMessageEntity("应用编号重复请修改"); + } + //新增应用 + //添加应用的id,代码生成 + sysApp.setCreateApp(); + //新增应用参数 + if(sysApp.getSysAppParameterList() != null && sysApp.getSysAppParameterList().size() > 0){ + for (int i = 0; i < sysApp.getSysAppParameterList().size(); i++) { + SysAppParameter sysAppParameter = sysApp.getSysAppParameterList().get(i); + sysAppParameter.setCreateAppParameter(); + sysAppParameter.setAppId(sysApp.getId()); + sysAppParameterMapper.entity_insert(sysAppParameter); + } + } + sysAppMapper.entity_insert(sysApp); + return BaseResult.getSuccessMessageEntity("新增应用成功"); + } + /** + * @Author lvleigang + * @Description 修改应用 + * @Date 11:16 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity updateApp(JSONObject object) { + SysApp sysApp = getData("jsonStr",object,SysApp.class); + if(sysApp == null && sysApp.getId() != null && !"".equals(sysApp.getId()) ){ + return BaseResult.getFailureMessageEntity("请求参数不存在"); + } + //修改应用,代码生成 + sysApp.setUpdateApp(); + //新增产品版本 + //添加产品版本的id,代码生成 + if(sysApp.getSysAppParameterList() != null && sysApp.getSysAppParameterList().size() > 0){ + //先删除原先的(逻辑删除) + delectAppParameterByAppId(sysApp.getId()); + for (int i = 0; i < sysApp.getSysAppParameterList().size(); i++) { + //新增或修改产品版本 + SysAppParameter sysAppParameter = sysApp.getSysAppParameterList().get(i); + addOrUpdateAppParameterById(sysAppParameter,sysApp.getId()); + } + } + sysAppMapper.entity_update(sysApp); + return BaseResult.getSuccessMessageEntity("修改产品成功"); + + } + /** + * @Author lvleigang + * @Description 新增或修改应用版本 + * @Date 3:30 下午 2023/3/3 + * @param sysAppParameter + * @param id + * @return void + **/ + private void addOrUpdateAppParameterById(SysAppParameter sysAppParameter , String id) { + if(sysAppParameter != null && id != null && !"".equals(id)){ + sysAppParameter.setAppId(id); + if(sysAppParameter.getId() == null || "".equals(sysAppParameter.getId())){ + sysAppParameter.setCreateAppParameter(); + sysAppParameterMapper.entity_insert(sysAppParameter); + }else { + sysAppParameter.setUpdateAppParameter(); + sysAppParameterMapper.entity_update(sysAppParameter); + } + } + } + /** + * @Author lvleigang + * @Description 根据id逻辑删除产品版本表数据 + * @Date 3:21 下午 2023/3/3 + * @param id + * @return void + **/ + private void delectAppParameterByAppId(String id) { + if(id != null && !"".equals(id)){ + SysAppParameter sysAppParameter = new SysAppParameter(); + sysAppParameter.setAppId(id); + sysAppParameter.setSts("Y"); + sysAppParameter.setUpdateAppParameter(); + sysAppParameterMapper.logicDelete_Multi_Condition(sysAppParameter); + } + } + /** + * @Author lvleigang + * @Description 删除应用 + * @Date 11:16 上午 2023/3/6 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity delectApp(JSONObject object) { + SysApp sysApp = getData("jsonStr",object,SysApp.class); + if(sysApp == null && sysApp.getId() != null && !"".equals(sysApp.getId()) ){ + return BaseResult.getFailureMessageEntity("请求参数不存在"); + } + //删除原先的(逻辑删除) + delectAppByAppId(sysApp.getId()); + //删除原先的 + delectAppParameterByAppId(sysApp.getId()); + + return BaseResult.getSuccessMessageEntity("删除产品成功"); + } + + /** + * @Author lvleigang + * @Description 分页查询数据成功 + * @Date 11:00 上午 2023/3/14 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryPageApp(JSONObject jsonObject) { + SysApp sysApp = getData("jsonStr",jsonObject,SysApp.class); + if(sysApp == null || sysApp.getPageNum() == null || sysApp.getPageSize() == null){ + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + //查询产品 + PageHelper.startPage(sysApp.getPageNum(), sysApp.getPageSize()); + sysApp.setSts("Y"); + List sysAppList = sysAppMapper.entity_list_like_page(sysApp); + PageInfo pageInfo = new PageInfo(sysAppList); + return BaseResult.getSuccessMessageEntity("获取应用成功", pageInfo); + } + + /** + * @Author lvleigang + * @Description 分页查询数据成功 + * @Date 11:00 上午 2023/3/14 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryList(JSONObject jsonObject) { + SysApp sysApp = getData("jsonStr",jsonObject,SysApp.class); + sysApp.setSts("Y"); + List sysAppList = sysAppMapper.entity_list_like_page(sysApp); + return BaseResult.getSuccessMessageEntity("获取应用成功", sysAppList); + } + + + /** + * @Author lvleigang + * @Description 根据id逻辑删除产品版本表数据 + * @Date 3:21 下午 2023/3/3 + * @param id + * @return void + **/ + private void delectAppByAppId(String id) { + if(id != null && !"".equals(id)){ + SysApp sysApp = new SysApp(); + sysApp.setId(id); + sysApp.setSts("Y"); + sysApp.setUpdateApp(); + sysAppMapper.logicDelete_Multi_Condition(sysApp); + } + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/dao/IAppApiMapper.java b/service/src/main/java/com/hzya/frame/sys/appApi/dao/IAppApiMapper.java new file mode 100644 index 00000000..c687c3bd --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/dao/IAppApiMapper.java @@ -0,0 +1,54 @@ +package com.hzya.frame.sys.appApi.dao; + +import com.hzya.frame.sys.appApi.entity.AppApi; +import com.hzya.frame.sys.appApi.entity.AppApiDto; +import com.hzya.frame.sys.appApi.entity.AppApiListVo; + +import java.util.List; + +/** + * @description: 应用api dao + * @tableName: sys_app_api + * @entityName: AppApi + * @author: gjh + * @history: 1.0 + */ +public interface IAppApiMapper { + + //通过ID获取数据 entity_get + AppApi entity_get(String id); + //通过id获取数据 request_method关联查的数据字典 + AppApi entity_get_join_dictionary(String id); + + //查询 采用==查询 entity_list_base + List entity_list_base(AppApi entity); + + // 查询符合条件的数量 + Integer entity_count(AppApi entity); + + //分页查询列表 采用like格式 entity_list_like + List entity_list_like(AppApi entity); + + //查询列表 字段采用or格式 entity_list_or + List entity_list_or(AppApi entity); + + //新增 entity_insert + AppApi entity_insert(AppApi entity); + + //修改 entity_update + Integer entity_update(AppApi entity); + + //逻辑删除 entity_delete + Integer entity_logicDelete(AppApi entity); + + //逻辑删除多条件 + Integer entity_logicDelete_Multi_Condition(AppApi entity); + + //物理删除 + Integer entity_delete(AppApi entity); + + + List queryList(AppApiDto entity); + + Integer entity_count_not_id(AppApi checkEntity); +} diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/dao/impl/AppApiMapperImpl.java b/service/src/main/java/com/hzya/frame/sys/appApi/dao/impl/AppApiMapperImpl.java new file mode 100644 index 00000000..d83f19d7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/dao/impl/AppApiMapperImpl.java @@ -0,0 +1,133 @@ +package com.hzya.frame.sys.appApi.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sys.appApi.dao.IAppApiMapper; +import com.hzya.frame.sys.appApi.entity.AppApi; +import com.hzya.frame.sys.appApi.entity.AppApiDto; +import com.hzya.frame.sys.appApi.entity.AppApiListVo; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * @description: 应用api dao + * @tableName: sys_app_api + * @entityName: AppApi + * @author: gjh + * @history:1.0 + */ +@Service +public class AppApiMapperImpl extends MybatisGenericDao implements IAppApiMapper { + + @Override + public AppApi entity_get(String id) { + + AppApi o = (AppApi) super.selectOne(getSqlIdPrifx() + "entity_get", id); + return o; + + } + + @Override + public AppApi entity_get_join_dictionary(String id) { + AppApi o = (AppApi) super.selectOne(getSqlIdPrifx() + "entity_get_join_dictionary", id); + return o; + } + + //查询 采用==查询 entity_list_base + @Override + public List entity_list_base(AppApi entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_base", entity); + return o; + + } + + // 查询符合条件的数量 + @Override + public Integer entity_count(AppApi entity) { + + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count", entity); + return o; + + } + + // 查询符合条件的数量 + @Override + public Integer entity_count_not_id(AppApi entity) { + + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count_not_id", entity); + return o; + + } + + //分页查询列表 采用like格式 entity_list_like + @Override + public List entity_list_like(AppApi entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_like", entity); + return o; + + } + + //查询列表 字段采用or格式 entity_list_or + @Override + public List entity_list_or(AppApi entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_or", entity); + return o; + + } + + //新增 entity_insert + @Override + public AppApi entity_insert(AppApi entity) { + + entity = super.save(getSqlIdPrifx() + "entity_insert", entity); + return entity; + + } + + //修改 entity_update + @Override + public Integer entity_update(AppApi entity) { + Integer o = super.update(getSqlIdPrifx() + "entity_update", entity); + return o; + + } + + //逻辑删除 entity_delete + @Override + public Integer entity_logicDelete(AppApi entity) { + + Integer o = super.update(getSqlIdPrifx() + "entity_logicDelete", entity); + return o; + + } + + //逻辑删除多条件 + @Override + public Integer entity_logicDelete_Multi_Condition(AppApi entity) { + + Integer o = super.update(getSqlIdPrifx() + "entity_logicDelete_Multi_Condition", entity); + return o; + + } + + //物理删除 + @Override + public Integer entity_delete(AppApi entity) { + + Integer o = super.update(getSqlIdPrifx() + "entity_delete", entity); + return o; + + } + + //分页查询列表 采用like格式 entity_list_like + @Override + public List queryList(AppApiDto entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryList", entity); + return o; + } + +} diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApi.java b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApi.java new file mode 100644 index 00000000..0af4bab0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApi.java @@ -0,0 +1,834 @@ +package com.hzya.frame.sys.appApi.entity; + +import java.util.Date; + +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.sysenum.SysEnum; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseEntity; +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @description: 应用api + * @tableName: sys_app_api + * @entityName: AppApi + * @author: llg + * @history: 1.0 + */ +public class AppApi extends BaseEntity { + + + private String id; + /** + * api从属系统 + */ + private String appId; + /** + * 中文名称 + */ + private String apiName; + /** + * api名称 + */ + private String apiCode; + /** + * api描述 + */ + private String apiRemark; + /** + * 是否需要登录 1、是 2、否 + */ + private String needLogin; + /** + * 认证接口 + */ + private String authenticationPort; + /** + * 传参方式 1、query 2、data + */ + private String parameterPassingMode; + /** + * 允许访问入口 1、app 2、H5 + */ + private String enableAccessEntry; + /** + * 服务接入协议 1、HTTP 2、HTTPS + */ + private String serviceAccessProtocol; + /** + * 目标地址 + */ + private String destinationAddress; + /** + * 请求编码 1、UTF-8 + */ + private String requestCoding; + /** + * 请求方法 1、POST 2、GET + */ + private String requestMethod; + /** + * 超时时间 6000 ms + */ + private String timeoutPeriod; + /** + * 限流 6000 ms + */ + private String currentLimiting; + /** + * Header入参 JSON + */ + private String headerIn; + /** + * Query入参 JSON + */ + private String queryIn; + /** + * Body 入参类型 1、Application/json + */ + private String bodyInType; + /** + * Body 入参 JSON + */ + private String bodyIn; + /** + * Body 出参 JSON + */ + private String bodyOut; + /** + * 排序 + */ + private Long sorts; + /** + * 创建人id + */ + private String createUserId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + /** + * 修改人id + */ + private String modifyUserId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date modifyTime; + /** + * 状态(Y正常N删除) + */ + private String sts; + /** + * 组织机构ID + */ + private String orgId; + private String createUser; + private String appName; + + + /** + * 应用id(应用表主键) + */ + public void setAppId(String appId) { + this.appId = appId; + } + + /** + * 应用id(应用表主键) + */ + public String getAppId() { + return appId; + } + + /** + * 接口名称 + */ + public void setApiName(String apiName) { + this.apiName = apiName; + } + + /** + * 接口名称 + */ + public String getApiName() { + return apiName; + } + + /** + * 接口编码 + */ + public void setApiCode(String apiCode) { + this.apiCode = apiCode; + } + + /** + * 接口编码 + */ + public String getApiCode() { + return apiCode; + } + + /** + * 允许访问入口 1、app 2、H5 + */ + public void setEnableAccessEntry(String enableAccessEntry) { + this.enableAccessEntry = enableAccessEntry; + } + + /** + * 允许访问入口 1、app 2、H5 + */ + public String getEnableAccessEntry() { + return enableAccessEntry; + } + + /** + * 服务接入协议 1、HTTP 2、HTTPS + */ + public void setServiceAccessProtocol(String serviceAccessProtocol) { + this.serviceAccessProtocol = serviceAccessProtocol; + } + + /** + * 服务接入协议 1、HTTP 2、HTTPS + */ + public String getServiceAccessProtocol() { + return serviceAccessProtocol; + } + + /** + * 目标地址 + */ + public void setDestinationAddress(String destinationAddress) { + this.destinationAddress = destinationAddress; + } + + /** + * 目标地址 + */ + public String getDestinationAddress() { + return destinationAddress; + } + + /** + * 请求编码 1、UTF-8 + */ + public void setRequestCoding(String requestCoding) { + this.requestCoding = requestCoding; + } + + /** + * 请求编码 1、UTF-8 + */ + public String getRequestCoding() { + return requestCoding; + } + + /** + * 请求方法 1、POST 2、GET + */ + public void setRequestMethod(String requestMethod) { + this.requestMethod = requestMethod; + } + + /** + * 请求方法 1、POST 2、GET + */ + public String getRequestMethod() { + return requestMethod; + } + + /** + * 超时时间 6000 ms + */ + public void setTimeoutPeriod(String timeoutPeriod) { + this.timeoutPeriod = timeoutPeriod; + } + + /** + * 超时时间 6000 ms + */ + public String getTimeoutPeriod() { + return timeoutPeriod; + } + + /** + * Header入参 JSON + */ + public void setHeaderIn(String headerIn) { + this.headerIn = headerIn; + } + + /** + * Header入参 JSON + */ + public String getHeaderIn() { + return headerIn; + } + + /** + * Query入参 JSON + */ + public void setQueryIn(String queryIn) { + this.queryIn = queryIn; + } + + /** + * Query入参 JSON + */ + public String getQueryIn() { + return queryIn; + } + + /** + * Body 入参类型 1、Application/json + */ + public void setBodyInType(String bodyInType) { + this.bodyInType = bodyInType; + } + + /** + * Body 入参类型 1、Application/json + */ + public String getBodyInType() { + return bodyInType; + } + + /** + * Body 入参 JSON + */ + public void setBodyIn(String bodyIn) { + this.bodyIn = bodyIn; + } + + /** + * Body 入参 JSON + */ + public String getBodyIn() { + return bodyIn; + } + + /** + * Body 出参 JSON + */ + public void setBodyOut(String bodyOut) { + this.bodyOut = bodyOut; + } + + /** + * Body 出参 JSON + */ + public String getBodyOut() { + return bodyOut; + } + + /** + * 排序 + */ + public void setSorts(Long sorts) { + this.sorts = sorts; + } + + /** + * 排序 + */ + public Long getSorts() { + return sorts; + } + + /** + * 创建人id + */ + public void setCreateUserId(String createUserId) { + this.createUserId = createUserId; + } + + /** + * 创建人id + */ + public String getCreateUserId() { + return createUserId; + } + + /** + * 创建时间 + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * 创建时间 + */ + public Date getCreateTime() { + return createTime; + } + + /** + * 修改人id + */ + public void setModifyUserId(String modifyUserId) { + this.modifyUserId = modifyUserId; + } + + /** + * 修改人id + */ + public String getModifyUserId() { + return modifyUserId; + } + + /** + * 修改时间 + */ + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + /** + * 修改时间 + */ + public Date getModifyTime() { + return modifyTime; + } + + /** + * 组织机构ID + */ + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + /** + * 组织机构ID + */ + public String getOrgId() { + return orgId; + } + + + + + + public String getApiRemark() { + return apiRemark; + } + + public void setApiRemark(String apiRemark) { + this.apiRemark = apiRemark; + } + + public String getNeedLogin() { + return needLogin; + } + + public void setNeedLogin(String needLogin) { + this.needLogin = needLogin; + } + + public String getParameterPassingMode() { + return parameterPassingMode; + } + + public void setParameterPassingMode(String parameterPassingMode) { + this.parameterPassingMode = parameterPassingMode; + } + + public String getCurrentLimiting() { + return currentLimiting; + } + + public void setCurrentLimiting(String currentLimiting) { + this.currentLimiting = currentLimiting; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getAuthenticationPort() { + return authenticationPort; + } + + public void setAuthenticationPort(String authenticationPort) { + this.authenticationPort = authenticationPort; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public String getSts() { + return sts; + } + + @Override + public void setSts(String sts) { + this.sts = sts; + } + + /** + * @param sendData + * @return java.lang.String + * @Author lvleigang + * @Description 转换query 值 + * @Date 9:54 上午 2023/8/31 + **/ + public String getQuery(JSONObject sendData, JSONObject loginData) { + if(sendData == null){ + sendData = new JSONObject(); + } + if(loginData == null){ + loginData = new JSONObject(); + } + StringBuffer returnStr = new StringBuffer(); + if (this.queryIn != null && !"".equals(this.queryIn)) { + if (JSONUtil.isTypeJSONArray(this.queryIn)) { + JSONArray headerArray = JSON.parseArray(this.queryIn); + for (int i = 0; i < headerArray.size(); i++) { + JSONObject querys = headerArray.getJSONObject(i); + + //query 只有基本类型,不用循环判断下级 + //判断参数是否有值 + //获取对象下面的层级数据 + if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型 + String query = querys.getString(SysEnum.EXAMPLE.getValue()); + if (query != null && !"".equals(query)) { + JSONArray example = JSONArray.parseArray(query); + String logValue = getObjectValue(loginData, example); + if (i == 0) { + returnStr.append("?"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "=" + logValue); + } else { + returnStr.append("&"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "=" + logValue); + } + } + } else { + //不是认证类型直接取值 + if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null + && !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值 + if (i == 0) { + returnStr.append("?"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "=" + sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue()))); + } else { + returnStr.append("&"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "=" + sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue()))); + } + } else if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加 + if (i == 0) { + returnStr.append("?"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "=" + querys.getString(SysEnum.EXAMPLE.getValue())); + } else { + returnStr.append("&"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "=" + querys.getString(SysEnum.EXAMPLE.getValue())); + } + } else {//没有值直接拼接 + if (i == 0) { + returnStr.append("?"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "="); + } else { + returnStr.append("&"); + returnStr.append(querys.getString(SysEnum.PARAMETERNAME.getValue()) + "="); + } + } + } + + + } + } + } + return returnStr.toString(); + } + + /** + * @param loginData + * @param example + * @return java.lang.String + * @Author lvleigang + * @Description 根据jsonArray 获取jsonobject中的值 + * @Date 11:47 上午 2023/8/31 + **/ + private String getObjectValue(JSONObject loginData, JSONArray example) { + String values = ""; + if (example != null && example.size() > 0) { + for (int i = 0; i < example.size(); i++) { + if (loginData.getString(example.getString(i)) != null && !"".equals(loginData.getString(example.getString(i)))) { + if (i == (example.size() - 1)) { + values = loginData.getString(example.getString(i)); + } else { + loginData = JSONObject.parseObject(loginData.getString(example.getString(i))); + } + } else { + return values; + } + } + } + return values; + } + + /** + * @param sendData + * @return java.lang.String + * @Author lvleigang + * @Description 转换header 值 + * @Date 9:54 上午 2023/8/31 + **/ + public Map getHeaders(JSONObject sendData, JSONObject loginData) { + if(sendData == null){ + sendData = new JSONObject(); + } + if(loginData == null){ + loginData = new JSONObject(); + } + Map map = new HashMap<>(); + if (this.headerIn != null && !"".equals(this.headerIn)) { + if (JSONUtil.isTypeJSONArray(this.headerIn)) { + JSONArray headerArray = JSON.parseArray(this.headerIn); + for (int i = 0; i < headerArray.size(); i++) { + JSONObject querys = headerArray.getJSONObject(i); + //query 只有基本类型,不用循环判断下级 + //判断参数是否有值 + //获取对象下面的层级数据 + if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型 + String query = querys.getString(SysEnum.EXAMPLE.getValue()); + if (query != null && !"".equals(query)) { + JSONArray example = JSONArray.parseArray(query); + String logValue = getObjectValue(loginData, example); + map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue); + } + } else { + //不是认证类型直接取值 + if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null + && !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值 + map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue()))); + } else if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加 + map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue())); + } else {//没有值直接拼接 + map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), ""); + } + } + } + } + } + return map; + } + + + /** + * @param sendData + * @param loginData + * @return java.lang.String + * @Author lvleigang + * @Description 设置body值 + * @Date 2:23 下午 2023/8/31 + **/ + public String getBodys(JSONObject sendData, JSONObject loginData) { + if(sendData == null){ + sendData = new JSONObject(); + } + if(loginData == null){ + loginData = new JSONObject(); + } + JSONObject returnObject = new JSONObject(); + if (this.bodyIn != null && !"".equals(this.bodyIn)) { + if (JSONUtil.isTypeJSONArray(this.bodyIn)) { + JSONArray headerArray = JSON.parseArray(this.bodyIn); + for (int i = 0; i < headerArray.size(); i++) { + //获取到第一个数据 + JSONObject querys = headerArray.getJSONObject(i); + returnObject.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(querys, sendData, loginData)); + } + } + } + return returnObject.toString(); + } + + /** + * @param querys 设置的字段属性 + * @param sendData 发送数据 + * @param loginData 认证信息 + * @return java.lang.Object + * @Author lvleigang + * @Description 设置值 + * @Date 4:14 下午 2023/8/31 + **/ + private Object getUpdata(JSONObject querys, JSONObject sendData, JSONObject loginData) { + if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型 可以直接设置值 + String query = querys.getString(SysEnum.EXAMPLE.getValue()); + if (query != null && !"".equals(query)) { + JSONArray example = JSONArray.parseArray(query); + String logValue = getObjectValue(loginData, example); + return logValue; + } + } else if (SysEnum.FUNDAMENTAL.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//基本类型 + if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null + && !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值 + return sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())); + } else if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加 + return querys.getString(SysEnum.EXAMPLE.getValue()); + } else {//没有值直接拼接 + return ""; + } + } else if (SysEnum.COMPLEX.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//复杂类型 + if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null + && !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值 + //获取子级 + String childers = querys.getString(SysEnum.CHILDREN.getValue()); + if (childers != null && !"".equals(childers)) { + JSONArray childersObj = JSONArray.parseArray(childers); + if (childersObj != null && childersObj.size() > 0) { + JSONObject obj = new JSONObject(); + for (int i = 0; i < childersObj.size(); i++) { + JSONObject a = childersObj.getJSONObject(i); + obj.put(a.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(a, sendData.getJSONObject(querys.getString(SysEnum.PARAMETERNAME.getValue())), loginData)); + } + return obj; + } + } else { + JSONObject obj = new JSONObject(); + return obj; + } + } else {//入参没有值用实例值,如果没有不添加 + //获取子级 + String childers = querys.getString(SysEnum.CHILDREN.getValue()); + if (childers != null && !"".equals(childers)) { + JSONArray childersObj = JSONArray.parseArray(childers); + if (childersObj != null && childersObj.size() > 0) { + JSONObject obj = new JSONObject(); + for (int i = 0; i < childersObj.size(); i++) { + JSONObject a = childersObj.getJSONObject(i); + obj.put(a.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(a, new JSONObject(), loginData)); + } + return obj; + } else { //没有值直接拼接 + JSONObject obj = new JSONObject(); + return obj; + } + } else { //没有值直接拼接 + JSONObject obj = new JSONObject(); + return obj; + } + } + } else if (SysEnum.FUNDAMENTALLIST.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//基本列表 + if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null + && !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值 + JSONArray jsonArray = JSONArray.parseArray(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue()))); + return jsonArray; + } else if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加 + if ("String".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(querys.getString(SysEnum.EXAMPLE.getValue())); + return jsonArray; + } else if ("Int".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(querys.getIntValue(SysEnum.EXAMPLE.getValue())); + return jsonArray; + } else if ("Long".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(querys.getLongValue(SysEnum.EXAMPLE.getValue())); + return jsonArray; + } else if ("Float".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(querys.getFloatValue(SysEnum.EXAMPLE.getValue())); + return jsonArray; + } else if ("Double".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(querys.getDoubleValue(SysEnum.EXAMPLE.getValue())); + return jsonArray; + } else if ("Boolean".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(querys.getBooleanValue(SysEnum.EXAMPLE.getValue())); + return jsonArray; + } else { + JSONArray jsonArray = new JSONArray(); + jsonArray.add(querys.getString(SysEnum.EXAMPLE.getValue())); + return jsonArray; + } + } else {//没有值直接拼接 + JSONArray jsonArray = new JSONArray(); + return jsonArray; + } + } else if (SysEnum.COMPLEXLIST.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//复杂列表 + if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null + && !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值 + //获取入参的数据 + //循环入参 + //循环api配置的参数 + //设置api的参数 + //返回数据 + JSONArray sendArray = sendData.getJSONArray(querys.getString(SysEnum.PARAMETERNAME.getValue())); + if(sendArray == null || sendArray.size() == 0){ + return new JSONArray(); + } + String childers = querys.getString(SysEnum.CHILDREN.getValue()); + if(childers == null || "".equals(childers)){ + return new JSONArray(); + } + JSONArray childersObj = JSONArray.parseArray(childers); + if(childersObj == null || childersObj.size() == 0){ + return new JSONArray(); + } + JSONArray obj = new JSONArray(); + for (int i = 0; i < sendArray.size(); i++) { + JSONObject sl = new JSONObject(); + for (int a = 0; a < childersObj.size(); a++) { + JSONObject b = childersObj.getJSONObject(a); + //入参没有只能取实例,实例只会有一个 + sl.put(b.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(b, sendArray.getJSONObject(i), loginData)); + } + obj.add(sl); + } + return obj; + } else {//入参没有值用实例值,如果没有不添加 + String childers = querys.getString(SysEnum.CHILDREN.getValue()); + if (childers != null && !"".equals(childers)) { + JSONArray childersObj = JSONArray.parseArray(childers); + if (childersObj != null && childersObj.size() > 0) { + JSONArray obj = new JSONArray(); + JSONObject sl = new JSONObject(); + for (int i = 0; i < childersObj.size(); i++) { + JSONObject a = childersObj.getJSONObject(i); + //入参没有只能取实例,实例只会有一个 + sl.put(a.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(a, new JSONObject(), loginData)); + } + obj.add(sl); + return obj; + } + } else { + JSONArray obj = new JSONArray(); + return obj; + } + } + } + return null; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiDto.java b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiDto.java new file mode 100644 index 00000000..5a020a86 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiDto.java @@ -0,0 +1,69 @@ +package com.hzya.frame.sys.appApi.entity; + +import cn.dev33.satoken.stp.StpUtil; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hzya.frame.uuid.UUIDUtils; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + + +public class AppApiDto { + /** 主键ID */ + private String id; + /** 应用id(应用表主键) */ + private String appId; + /** 接口名称 */ + private String apiName; + /** 接口编码 */ + private String apiCode; + private Integer pageNum; + private Integer pageSize; + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getApiName() { + return apiName; + } + + public void setApiName(String apiName) { + this.apiName = apiName; + } + + public String getApiCode() { + return apiCode; + } + + public void setApiCode(String apiCode) { + this.apiCode = apiCode; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiListVo.java b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiListVo.java new file mode 100644 index 00000000..ff32d81b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiListVo.java @@ -0,0 +1,82 @@ +package com.hzya.frame.sys.appApi.entity; + + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +public class AppApiListVo { + + /** 主键ID */ + private String id; + /** 应用id(应用表主键) */ + private String appName; + /** 接口名称 */ + private String apiName; + /** 接口编码 */ + private String apiCode; + /** 创建人id */ + private String createUserId; + /** 创建人 */ + private String createUser; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getApiName() { + return apiName; + } + + public void setApiName(String apiName) { + this.apiName = apiName; + } + + public String getApiCode() { + return apiCode; + } + + public void setApiCode(String apiCode) { + this.apiCode = apiCode; + } + + public String getCreateUserId() { + return createUserId; + } + + public void setCreateUserId(String createUserId) { + this.createUserId = createUserId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiMapper.xml b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiMapper.xml new file mode 100644 index 00000000..abc0af7f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/entity/AppApiMapper.xml @@ -0,0 +1,536 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + app_id, + api_name, + api_code, + api_remark, + need_Login, + authentication_port, + parameter_passing_mode, + enable_access_entry, + service_access_protocol, + destination_address, + request_coding, + request_method, + timeout_period, + current_limiting, + header_in, + query_in, + body_in_type, + body_in, + body_out, + sorts, + create_user_id, + create_time, + modify_user_id, + modify_time, + sts, + org_id + + + a.id, + a.app_id, + a.api_name, + a.api_code, + a.api_remark, + a.need_Login, + a.authentication_port, + a.parameter_passing_mode, + a.enable_access_entry, + a.service_access_protocol, + a.destination_address, + a.request_coding, + a.request_method, + a.timeout_period, + a.current_limiting, + a.header_in, + a.query_in, + a.body_in_type, + a.body_in, + a.body_out, + a.sorts, + a.create_user_id, + a.create_time, + a.modify_user_id, + a.modify_time, + a.sts, + a.org_id, + b.name as app_name, + c.view_name as create_user + + + a.id, + a.app_id, + a.api_name, + a.api_code, + a.api_remark, + a.need_Login, + a.authentication_port, + a.parameter_passing_mode, + a.enable_access_entry, + a.service_access_protocol, + a.destination_address, + a.request_coding, + d.column_content as request_method, + a.timeout_period, + a.current_limiting, + a.header_in, + a.query_in, + a.body_in_type, + a.body_in, + a.body_out, + a.sorts, + a.create_user_id, + a.create_time, + a.modify_user_id, + a.modify_time, + a.sts, + a.org_id + + + + + + + + + + + + + + + + + + + + insert into sys_app_api( + + id, + app_id, + api_name, + api_code, + api_remark, + need_Login, + authentication_port, + parameter_passing_mode, + enable_access_entry, + service_access_protocol, + destination_address, + request_coding, + request_method, + timeout_period, + current_limiting, + header_in, + query_in, + body_in_type, + body_in, + body_out, + sorts, + sorts, + create_user_id, + create_time, + modify_user_id, + modify_time, + sts, + org_id, + + )values + ( + + #{id}, + #{appId}, + #{apiName}, + #{apiCode}, + #{apiRemark}, + #{needLogin}, + #{authenticationPort}, + #{parameterPassingMode}, + #{enableAccessEntry}, + #{serviceAccessProtocol}, + #{destinationAddress}, + #{requestCoding}, + #{requestMethod}, + #{timeoutPeriod}, + #{currentLimiting}, + #{headerIn}, + #{queryIn}, + #{bodyInType}, + #{bodyIn}, + #{bodyOut}, + #{sorts}, + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_app_api a WHERE a.sts = 'Y' ), + #{createUserId}, + #{createTime}, + #{modifyUserId}, + #{modifyTime}, + #{sts}, + #{orgId}, + + ) + + + + + update sys_app_api set + + app_id = #{appId}, + api_name = #{apiName}, + api_code = #{apiCode}, + api_remark = #{apiRemark}, + need_Login = #{needLogin}, + authentication_port = #{authenticationPort}, + parameter_passing_mode = #{parameterPassingMode}, + enable_access_entry = #{enableAccessEntry}, + service_access_protocol = #{serviceAccessProtocol}, + destination_address = #{destinationAddress}, + request_coding = #{requestCoding}, + request_method = #{requestMethod}, + timeout_period = #{timeoutPeriod}, + current_limiting = #{currentLimiting}, + header_in = #{headerIn}, + query_in = #{queryIn}, + body_in_type = #{bodyInType}, + body_in = #{bodyIn}, + body_out = #{bodyOut}, + sorts = #{sorts}, + create_user_id = #{createUserId}, + create_time = #{createTime}, + modify_user_id = #{modifyUserId}, + modify_time = #{modifyTime}, + sts = #{sts}, + org_id = #{orgId}, + + where id = #{id} + + + + + update sys_app_api set + sts='N',modify_time = now(),modify_user_id = #{modifyUserId} where + id = #{id} + + + + + update sys_app_api set + sts='N',modify_time = now(),modify_user_id = #{modifyUserId} + + id = #{id} + and app_id = #{appId} + and api_name = #{apiName} + and api_code = #{apiCode} + and api_remark = #{apiRemark} + and need_Login = #{needLogin} + and authentication_port = #{authenticationPort} + and parameter_passing_mode = #{parameterPassingMode} + and enable_access_entry = #{enableAccessEntry} + and service_access_protocol = #{serviceAccessProtocol} + and destination_address = #{destinationAddress} + and request_coding = #{requestCoding} + and request_method = #{requestMethod} + and timeout_period = #{timeoutPeriod} + and current_limiting = #{currentLimiting} + and header_in = #{headerIn} + and query_in = #{queryIn} + and body_in_type = #{bodyInType} + and body_in = #{bodyIn} + and body_out = #{bodyOut} + and sorts = #{sorts} + and create_user_id = #{createUserId} + and create_time = #{createTime} + and modify_user_id = #{modifyUserId} + and modify_time = #{modifyTime} + and sts = #{sts} + and org_id = #{orgId} + + + + + + delete from sys_app_api where id =#{id} + + + + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/service/IAppApiService.java b/service/src/main/java/com/hzya/frame/sys/appApi/service/IAppApiService.java new file mode 100644 index 00000000..046befae --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/service/IAppApiService.java @@ -0,0 +1,88 @@ +package com.hzya.frame.sys.appApi.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.web.entity.JsonResultEntity; +import com.hzya.frame.sys.appApi.entity.AppApi; + +/** + * @description: 应用api service + * @tableName: sys_app_api + * @entityName: AppApi + * @author: gjh + * @history: 1.0 + */ +public interface IAppApiService { + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询列表 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity queryList(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询列表 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity queryPage(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取数据 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity queryEntity(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 新增数据 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity addEntity(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 修改数据 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity editEntity(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除数据 + * @Date 2:18 下午 2023/7/17 + **/ + JsonResultEntity deleteEntity(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 调试api + * @Date 4:59 下午 2023/7/10 + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity debugApi(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 调试api + * @Date 4:59 下午 2023/7/10 + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity testToken(JSONObject jsonObject); + + /** + * 根据id获取 + * @param id + * @return + */ + AppApi getByid(String id); +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/sys/appApi/service/impl/AppApiServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/appApi/service/impl/AppApiServiceImpl.java new file mode 100644 index 00000000..e5c77e6d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appApi/service/impl/AppApiServiceImpl.java @@ -0,0 +1,290 @@ +package com.hzya.frame.sys.appApi.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.Method; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.sys.appApi.entity.AppApiDto; +import com.hzya.frame.sys.appApi.entity.AppApiListVo; +import com.hzya.frame.sys.entity.DebugApiDto; +import com.hzya.frame.sys.entity.ModuleDto; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.exception.BaseSystemException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.hzya.frame.serviceUtil.ServiceUtil; +import com.hzya.frame.sys.appApi.entity.AppApi; +import com.hzya.frame.sys.appApi.service.IAppApiService; +import com.hzya.frame.sys.appApi.dao.IAppApiMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * @description: 应用api service + * @tableName: sys_app_api + * @entityName: AppApi + * @author: gjh + * @history: 1.0 + */ +@Service(value="appApiService") +public class AppApiServiceImpl extends ServiceUtil implements IAppApiService{ + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Resource + protected IAppApiMapper appapiMapper; + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询列表 + * @Date 2:18 下午 2023/7/17 + **/ + @Override + public JsonResultEntity queryPage(JSONObject object) { + AppApiDto entity = getData("jsonStr", object, AppApiDto.class); + //判断分页 + if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){ + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List appApiListVoList = appapiMapper.queryList(entity); + PageInfo pageInfo = new PageInfo(appApiListVoList); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询列表 + * @Date 2:18 下午 2023/7/17 + **/ + @Override + public JsonResultEntity queryList(JSONObject object) { + AppApiDto entity = getData("jsonStr", object, AppApiDto.class); + List appApiListVoList = appapiMapper.queryList(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", appApiListVoList); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取数据 + * @Date 2:18 下午 2023/7/17 + **/ + @Override + public JsonResultEntity queryEntity(JSONObject object) { + AppApiDto entity = getData("jsonStr", object, AppApiDto.class); + //判断分页 + if(entity == null || entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("请先传递请求主键"); + } + AppApi appApi = appapiMapper.entity_get(entity.getId()); + return BaseResult.getSuccessMessageEntity("查询数据成功", appApi); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 新增数据 + * @Date 2:18 下午 2023/7/17 + **/ + @Override + public JsonResultEntity addEntity(JSONObject object) { + AppApi entity = getData("jsonStr", object, AppApi.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getApiName() == null || "".equals(entity.getApiName())){ + return BaseResult.getFailureMessageEntity("请先输入接口名称"); + } + if(entity.getApiCode() == null || "".equals(entity.getApiCode())){ + return BaseResult.getFailureMessageEntity("请先输入接口编码"); + } + AppApi checkEntity = new AppApi(); + checkEntity.setSts("Y"); + checkEntity.setApiCode(entity.getApiCode()); + int checkCount = appapiMapper.entity_count(checkEntity); + if(checkCount > 0){ + return BaseResult.getFailureMessageEntity("接口编码已存在"); + } + entity.setCreate(); + appapiMapper.entity_insert(entity); + return BaseResult.getSuccessMessageEntity("保存接口成功",entity.getId()); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 修改数据 + * @Date 2:18 下午 2023/7/17 + **/ + @Override + public JsonResultEntity editEntity(JSONObject object) { + AppApi entity = getData("jsonStr", object, AppApi.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + if(entity.getApiName() == null || "".equals(entity.getApiName())){ + return BaseResult.getFailureMessageEntity("请先输入接口名称"); + } + if(entity.getApiCode() == null || "".equals(entity.getApiCode())){ + return BaseResult.getFailureMessageEntity("请先输入接口编码"); + } + AppApi checkEntity = new AppApi(); + checkEntity.setSts("Y"); + checkEntity.setId(entity.getId()); + checkEntity.setApiCode(entity.getApiCode()); + int checkCount = appapiMapper.entity_count_not_id(checkEntity); + if(checkCount > 0){ + return BaseResult.getFailureMessageEntity("接口编码已存在"); + } + entity.setUpdate(); + int i = appapiMapper.entity_update(entity); + return BaseResult.getSuccessMessageEntity("修改接口成功",entity.getId()); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除数据 + * @Date 2:18 下午 2023/7/17 + **/ + @Override + public JsonResultEntity deleteEntity(JSONObject object) { + + AppApi entity = getData("jsonStr", object, AppApi.class); + if(entity == null){ + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getId() == null || "".equals(entity.getId())){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + int i = appapiMapper.entity_logicDelete(entity); + return BaseResult.getSuccessMessageEntity("删除接口成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 根据用户id查询菜单树 + * @Date 9:48 上午 2023/6/29 + **/ + @Override + public JsonResultEntity debugApi(JSONObject object) { + DebugApiDto entity = getData("jsonStr", object, DebugApiDto.class); + try { + String body = doApi(entity); + return BaseResult.getSuccessMessageEntity(body); + } catch (BaseSystemException e) { + return BaseResult.getFailureMessageEntity(e.getMessage()); + } + } + + private String doApi(DebugApiDto entity) { + //校验是否有servecr传参 + if (entity == null) { + throw new BaseSystemException("请先传递对象"); + } + if (!checkStr(entity.getUrl())) { + throw new BaseSystemException("请先传递url"); + } + if (!checkStr(entity.getMethod())) { + throw new BaseSystemException("请先传递请求类型"); + } + HttpRequest httpRequest = HttpRequest.of(entity.getUrl()); + httpRequest.method(Method.valueOf(entity.getMethod().toUpperCase())); + if(entity.getHeaders() != null ){ + Map headers = JSON.parseObject(entity.getHeaders()); + if(headers != null && headers.size() > 0){ + httpRequest.addHeaders(headers); + } + }else if(entity.getHeader() != null ){ + Map headers = JSON.parseObject(entity.getHeader()); + if(headers != null && headers.size() > 0){ + httpRequest.addHeaders(headers); + } + + } + if(entity.getBody() != null ){ + httpRequest.body(entity.getBody(),"application/json"); + } + try { + String body = httpRequest.execute().body(); + if(body == null){ + throw new BaseSystemException("请求错误,请检查请求地址以及请求参数"); + } + if(body.contains("HTTP Status 404 – Not Found")){ + throw new BaseSystemException("请求错误,请检查请求地址以及请求参数"); + } + try { + JSON.parse(body); + } catch (Exception e) { + throw new BaseSystemException("请求错误,请检查请求地址以及请求参数"); + } + return body; + } catch (Exception e) { + throw new BaseSystemException("请求错误,请检查请求地址以及请求参数"); + } + } + + + public JsonResultEntity testToken(JSONObject object) { + JSONObject entity = getstrObj("jsonStr", object); + if (entity == null) { + return BaseResult.getFailureMessageEntity("对象为空"); + } + if (!checkStr(entity.getString("body"))) { + return BaseResult.getFailureMessageEntity("对象body为空"); + } + JSONObject body = getstrObj("body", entity); + if (!checkStr(body.getString("user"))) { + return BaseResult.getFailureMessageEntity("对象body.user为空"); + } + JSONObject user = getstrObj("user", body); + if (!checkStr(user.getString("token"))) { + return BaseResult.getFailureMessageEntity("对象body.user.token为空"); + } + if(StpUtil.getTokenValue().equals(user.getString("token"))){ + return BaseResult.getSuccessMessageEntity("校验token成功,业务处理成功获取name:"+user.getString("name")); + }else { + return BaseResult.getFailureMessageEntity("校验token失败"); + } + } + + /** + * 根据id获取 + * + * @param id + * @return + */ + @Override + public AppApi getByid(String id) { + if (StrUtil.isNotEmpty(id)){ + AppApi appApi = appapiMapper.entity_get_join_dictionary(id); + return appApi; + } + return null; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/appParameter/controller/SysAppParameterController.java b/service/src/main/java/com/hzya/frame/sys/appParameter/controller/SysAppParameterController.java new file mode 100644 index 00000000..39bb6a25 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appParameter/controller/SysAppParameterController.java @@ -0,0 +1,31 @@ +package com.hzya.frame.sys.appParameter.controller; + + + +import com.hzya.frame.sys.appParameter.service.ISysAppParameterService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + + +/** + * @description: 应用参数表 controller + * @tableName: sys_app_parameter + * @entityName: sysAppParameter + * @author: llg + * @history: 1.0 + */ + +@Controller() +@RequestMapping("sysAppParameter") +public class SysAppParameterController { + @Autowired + protected ISysAppParameterService sysAppParameterService; + + + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/appParameter/dao/ISysAppParameterMapper.java b/service/src/main/java/com/hzya/frame/sys/appParameter/dao/ISysAppParameterMapper.java new file mode 100644 index 00000000..83a85df0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appParameter/dao/ISysAppParameterMapper.java @@ -0,0 +1,41 @@ +package com.hzya.frame.sys.appParameter.dao; + +import com.hzya.frame.sys.appParameter.entity.SysAppParameter; +import com.hzya.frame.sys.productVersion.entity.SysProductVersion; + +import java.util.List; + + +/** + * @description: 应用参数表 dao + * @tableName: sys_app_parameter + * @entityName: SysAppParameter + * @author: llg + * @history:1.0 + */ +public interface ISysAppParameterMapper { + //通过ID获取数据 entity_get + SysAppParameter entity_get(Integer id); + + //查询 采用==查询 entity_list_base + List entity_list_base(SysAppParameter SysAppParameter); + + //分页查询列表 采用like格式 entity_list_like + List entity_list_like(SysAppParameter SysAppParameter); + + //查询列表 字段采用or格式 entity_list_or + List entity_list_or(SysAppParameter SysAppParameter); + + //新增 entity_insert + SysAppParameter entity_insert(SysAppParameter SysAppParameter); + + //修改 entity_update + Integer entity_update(SysAppParameter SysAppParameter); + + //物理删除 entity_delete + Integer entity_delete(SysAppParameter SysAppParameter); + + //物理删除 logicDelete_Multi_Condition + Integer logicDelete_Multi_Condition(SysAppParameter sysAppParameter); + +} diff --git a/service/src/main/java/com/hzya/frame/sys/appParameter/dao/impl/SysAppParameterMapperImpl.java b/service/src/main/java/com/hzya/frame/sys/appParameter/dao/impl/SysAppParameterMapperImpl.java new file mode 100644 index 00000000..474d77a6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appParameter/dao/impl/SysAppParameterMapperImpl.java @@ -0,0 +1,85 @@ +package com.hzya.frame.sys.appParameter.dao.impl; + + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sys.appParameter.dao.ISysAppParameterMapper; +import com.hzya.frame.sys.appParameter.entity.SysAppParameter; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @description: 应用表 dao + * @tableName: sys_app + * @entityName: SysApp + * @author: llg + * @history:1.0 + */ +@Service +public class SysAppParameterMapperImpl extends MybatisGenericDao implements ISysAppParameterMapper { + + + @Override + public SysAppParameter entity_get(Integer id) { + + SysAppParameter o = (SysAppParameter) super.selectOne(getSqlIdPrifx() + "entity_get", id); + return o; + + } + + @Override + public List entity_list_base(SysAppParameter entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_base", entity); + return o; + + } + + @Override + public List entity_list_like(SysAppParameter entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_like", entity); + return o; + + } + + @Override + public List entity_list_or(SysAppParameter entity) { + + List o = super.query(getSqlIdPrifx() + "entity_list_or", entity); + return o; + + } + + @Override + public SysAppParameter entity_insert(SysAppParameter entity) { + + entity = super.save(getSqlIdPrifx() + "entity_insert", entity); + return entity; + + } + + @Override + public Integer entity_update(SysAppParameter entity) { + + Integer o = super.update(getSqlIdPrifx() + "entity_update", entity); + return o; + + } + + @Override + public Integer entity_delete(SysAppParameter entity) { + + Integer o = super.delete(getSqlIdPrifx() + "entity_delete", entity); + return o; + + } + + @Override + public Integer logicDelete_Multi_Condition(SysAppParameter entity) { + + Integer o = super.delete(getSqlIdPrifx() + "logicDelete_Multi_Condition", entity); + return o; + + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/appParameter/entity/SysAppParameter.java b/service/src/main/java/com/hzya/frame/sys/appParameter/entity/SysAppParameter.java new file mode 100644 index 00000000..8db1756e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appParameter/entity/SysAppParameter.java @@ -0,0 +1,187 @@ +package com.hzya.frame.sys.appParameter.entity; + +import cn.dev33.satoken.stp.StpUtil; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.Date; + +/** + * @description: 应用参数表 + * @tableName: sys_app_parameter + * @entityName: sysAppParameter + * @author: llg + * @history: 1.0 + */ +public class SysAppParameter extends BaseEntity { + /** 主键ID*/ + private String id; + /** 应用id */ + private String appId; + /** 参数 */ + private String parameter; + /** 数据类型 */ + private String dateType; + /** 参数描述 */ + private String description; + /** 是否必填 */ + private String requireds; + /** 参数值 */ + private String dateValue; + /** 备注 */ + private String remarks; + /** 排序号 */ + private Long sorts; + /** 组织机构ID */ + private String orgId; + /** 状态 1有效 0无效 */ + private String sts; + /** 创建人ID*/ + private String createUserId; + /** 创建时间ID */ + private Date createTime; + /** 修改时间*/ + private Date modifyTime; + /** 修改人ID*/ + private String modifyUserId; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getParameter() { + return parameter; + } + + public void setParameter(String parameter) { + this.parameter = parameter; + } + + public String getDateType() { + return dateType; + } + + public void setDateType(String dateType) { + this.dateType = dateType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getRequireds() { + return requireds; + } + + public void setRequireds(String requireds) { + this.requireds = requireds; + } + + public String getDateValue() { + return dateValue; + } + + public void setDateValue(String dateValue) { + this.dateValue = dateValue; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Long getSorts() { + return sorts; + } + + public void setSorts(Long sorts) { + this.sorts = sorts; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public String getSts() { + return sts; + } + + public void setSts(String sts) { + this.sts = sts; + } + + public String getCreateUserId() { + return createUserId; + } + + public void setCreateUserId(String createUserId) { + this.createUserId = createUserId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public String getModifyUserId() { + return modifyUserId; + } + + public void setModifyUserId(String modifyUserId) { + this.modifyUserId = modifyUserId; + } + + //创建新增产品信息 + public void setCreateAppParameter() { + this.id = UUIDUtils.getUUID(); + this.orgId =""; + this.sts = "Y"; + this.createUserId = String.valueOf( StpUtil.getLoginId()); + this.createTime = new Date(); + this.modifyTime = new Date(); + this.modifyUserId = String.valueOf( StpUtil.getLoginId()); + } + + + //创建新增产品信息 + public void setUpdateAppParameter() { + this.modifyTime = new Date(); + this.modifyUserId = String.valueOf( StpUtil.getLoginId()); + } + +} diff --git a/service/src/main/java/com/hzya/frame/sys/appParameter/entity/SysAppParameterMapper.xml b/service/src/main/java/com/hzya/frame/sys/appParameter/entity/SysAppParameterMapper.xml new file mode 100644 index 00000000..d8e0175f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appParameter/entity/SysAppParameterMapper.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID as id, + app_id as app_id, + parameter as parameter, + date_type as date_type, + description as description, + requireds as requireds, + date_value as date_value, + remarks as remarks, + sorts as sorts, + org_id as org_id, + sts as sts, + create_user_id as create_user_id, + create_time as create_time, + modify_time as modify_time, + modify_user_id as modify_user_id + + + + + + + + + + + + + + + + + + insert into sys_app_parameter( + + ID, + app_id, + parameter, + date_type, + description, + requireds, + date_value, + remarks, + sorts, + org_id, + sts, + create_user_id, + create_time, + modify_time, + modify_user_id, + + )values + ( + + #{id}, + #{appId}, + #{parameter}, + #{dateType}, + #{description}, + #{requireds}, + #{dateValue}, + #{remarks}, + #{sorts}, + #{orgId}, + #{sts}, + #{createUserId}, + #{createTime}, + #{modifyTime}, + #{modifyUserId}, + + ) + + + + + update sys_app_parameter set + + ID = #{id}, + app_id = #{appId}, + parameter = #{parameter}, + date_type = #{dateType}, + description = #{description}, + requireds = #{requireds}, + date_value = #{dateValue}, + remarks = #{remarks}, + sorts = #{sorts}, + org_id = #{orgId}, + sts = #{sts}, + create_user_id = #{createUserId}, + create_time = #{createTime}, + modify_time = #{modifyTime}, + modify_user_id = #{modifyUserId}, + + where id = #{id} + + + + update sys_app_parameter set + sts='N',modify_time = #{modifyTime} ,modify_user_id = #{modifyUserId} + + and ID = #{id} + and app_id = #{appId} + and parameter = #{parameter} + and date_type = #{dateType} + and description = #{description} + and requireds = #{requireds} + and date_value = #{dateValue} + and remarks = #{remarks} + and sorts = #{sorts} + and org_id = #{orgId} + and sts = #{sts} + and create_user_id = #{createUserId} + and create_time = #{createTime} + + + + + delete from sys_app_parameter where id =#{id} + + diff --git a/service/src/main/java/com/hzya/frame/sys/appParameter/service/ISysAppParameterService.java b/service/src/main/java/com/hzya/frame/sys/appParameter/service/ISysAppParameterService.java new file mode 100644 index 00000000..a9f77dd3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appParameter/service/ISysAppParameterService.java @@ -0,0 +1,16 @@ +package com.hzya.frame.sys.appParameter.service; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * @description: 系统菜单 service + * @tableName: sys_module_new + * @entityName: SysModuleNewEntity + * @author: gjh + * @history: 1.0 + */ +public interface ISysAppParameterService{ + + + +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/sys/appParameter/service/impl/SysAppParameterServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/appParameter/service/impl/SysAppParameterServiceImpl.java new file mode 100644 index 00000000..151a267d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/appParameter/service/impl/SysAppParameterServiceImpl.java @@ -0,0 +1,21 @@ +package com.hzya.frame.sys.appParameter.service.impl; + +import com.hzya.frame.sys.appParameter.dao.ISysAppParameterMapper; +import com.hzya.frame.sys.appParameter.service.ISysAppParameterService; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +/** + * @description: 应用参数表 service + * @tableName: sys_app_parameter + * @entityName: Sysappparameter + * @author: llg + * @history: 1.0 + */ +@Service(value="sysAppParameterService") +public class SysAppParameterServiceImpl implements ISysAppParameterService { + + @Resource + private ISysAppParameterMapper sysAppParameterMapper; + + +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/dao/ISysApplicationApiDao.java b/service/src/main/java/com/hzya/frame/sys/application/api/dao/ISysApplicationApiDao.java new file mode 100644 index 00000000..cafed003 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/dao/ISysApplicationApiDao.java @@ -0,0 +1,24 @@ +package com.hzya.frame.sys.application.api.dao; + +import com.hzya.frame.sys.application.api.entity.SysApplicationApiDto; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiVo; + +import java.util.List; + +/** + * 应用api(sys_application_api: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:23:21 + */ +public interface ISysApplicationApiDao extends IBaseDao { + + List queryVoList(SysApplicationApiDto entity); + + Integer entity_count_not_id(SysApplicationApiEntity checkEntity); + + Integer checkCatalogue(SysApplicationApiEntity checkEntity); +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/dao/impl/SysApplicationApiDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/api/dao/impl/SysApplicationApiDaoImpl.java new file mode 100644 index 00000000..2f27b86b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/dao/impl/SysApplicationApiDaoImpl.java @@ -0,0 +1,46 @@ +package com.hzya.frame.sys.application.api.dao.impl; + +import com.hzya.frame.sys.appApi.entity.AppApi; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiDto; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sys.application.api.dao.ISysApplicationApiDao; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiVo; +import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; +import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + +/** + * 应用api(SysApplicationApi)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:23:25 + */ +@Repository(value = "SysApplicationApiDaoImpl") +public class SysApplicationApiDaoImpl extends MybatisGenericDao implements ISysApplicationApiDao{ + + @Override + public List queryVoList(SysApplicationApiDto entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryVoList", entity); + return o; + + } + + + // 查询符合条件的数量 + @Override + public Integer entity_count_not_id(SysApplicationApiEntity entity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count_not_id", entity); + return o; + + } // 查询符合条件的数量 + @Override + public Integer checkCatalogue(SysApplicationApiEntity entity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkCatalogue", entity); + return o; + + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiDto.java b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiDto.java new file mode 100644 index 00000000..2f195698 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiDto.java @@ -0,0 +1,90 @@ +package com.hzya.frame.sys.application.api.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 应用api(SysApplicationApi)实体类 + * + * @author makejava + * @since 2023-09-22 16:23:27 + */ +public class SysApplicationApiDto { + /** id */ + private String id; + /** api应用 */ + private String appId; + /** 目录 */ + private String catalogueId; + /** api名称或者描述 */ + private String nameOrRemark; + private Integer pageNum; + private Integer pageSize; + /** 接口编码 */ + private Long apiCode; + /** Api接口地址(固定系统内部外放接口地址) */ + private String apiPath; + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getCatalogueId() { + return catalogueId; + } + + public void setCatalogueId(String catalogueId) { + this.catalogueId = catalogueId; + } + + public String getNameOrRemark() { + return nameOrRemark; + } + + public void setNameOrRemark(String nameOrRemark) { + this.nameOrRemark = nameOrRemark; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Long getApiCode() { + return apiCode; + } + + public void setApiCode(Long apiCode) { + this.apiCode = apiCode; + } + + public String getApiPath() { + return apiPath; + } + + public void setApiPath(String apiPath) { + this.apiPath = apiPath; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiEntity.java b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiEntity.java new file mode 100644 index 00000000..63e3dce5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiEntity.java @@ -0,0 +1,235 @@ +package com.hzya.frame.sys.application.api.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 应用api(SysApplicationApi)实体类 + * + * @author makejava + * @since 2023-09-22 16:23:27 + */ +public class SysApplicationApiEntity extends BaseEntity { + + /** 接口编码 */ + private Long apiCode; + /** Api接口地址(固定系统内部外放接口地址) */ + private String apiPath; + /** 1启用2停用 */ + private String apiStatus; + /** api应用 */ + private String appId; + /** api应用名称 */ + private String appName; + /** 目录 */ + private String catalogueId; + /** 目录名称 */ + private String catalogueName; + /** api名称 */ + private String apiName; + /** api描述 */ + private String apiRemark; + /** 是否需要登录 1、是 2、否 */ + private String needLogin; + /** 认证接口 */ + private String authenticationPort; + /** 传参方式 1、query 2、data */ + private String parameterPassingMode; + /** 目标地址 */ + private String destinationAddress; + /** 请求编码 1、UTF-8 */ + private String requestCoding; + /** 请求方法 1、POST 2、GET */ + private String requestMethod; + /** 超时时间 6000 ms */ + private String timeoutPeriod; + /** 限流 6000 ms */ + private String currentLimiting; + /** Header入参 JSON */ + private String headerIn; + /** Query入参 JSON */ + private String queryIn; + /** Body 入参类型 1、Application/json */ + private String bodyInType; + /** Body 入参 JSON */ + private String bodyIn; + /** Body 出参 JSON */ + private String bodyOut; + + + public String getApiStatus() { + return apiStatus; + } + + public void setApiStatus(String apiStatus) { + this.apiStatus = apiStatus; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getCatalogueId() { + return catalogueId; + } + + public void setCatalogueId(String catalogueId) { + this.catalogueId = catalogueId; + } + + public String getApiName() { + return apiName; + } + + public void setApiName(String apiName) { + this.apiName = apiName; + } + + public String getApiRemark() { + return apiRemark; + } + + public void setApiRemark(String apiRemark) { + this.apiRemark = apiRemark; + } + + public String getNeedLogin() { + return needLogin; + } + + public void setNeedLogin(String needLogin) { + this.needLogin = needLogin; + } + + public String getAuthenticationPort() { + return authenticationPort; + } + + public void setAuthenticationPort(String authenticationPort) { + this.authenticationPort = authenticationPort; + } + + public String getParameterPassingMode() { + return parameterPassingMode; + } + + public void setParameterPassingMode(String parameterPassingMode) { + this.parameterPassingMode = parameterPassingMode; + } + + public String getDestinationAddress() { + return destinationAddress; + } + + public void setDestinationAddress(String destinationAddress) { + this.destinationAddress = destinationAddress; + } + + public String getRequestCoding() { + return requestCoding; + } + + public void setRequestCoding(String requestCoding) { + this.requestCoding = requestCoding; + } + + public String getRequestMethod() { + return requestMethod; + } + + public void setRequestMethod(String requestMethod) { + this.requestMethod = requestMethod; + } + + public String getTimeoutPeriod() { + return timeoutPeriod; + } + + public void setTimeoutPeriod(String timeoutPeriod) { + this.timeoutPeriod = timeoutPeriod; + } + + public String getCurrentLimiting() { + return currentLimiting; + } + + public void setCurrentLimiting(String currentLimiting) { + this.currentLimiting = currentLimiting; + } + + public String getHeaderIn() { + return headerIn; + } + + public void setHeaderIn(String headerIn) { + this.headerIn = headerIn; + } + + public String getQueryIn() { + return queryIn; + } + + public void setQueryIn(String queryIn) { + this.queryIn = queryIn; + } + + public String getBodyInType() { + return bodyInType; + } + + public void setBodyInType(String bodyInType) { + this.bodyInType = bodyInType; + } + + public String getBodyIn() { + return bodyIn; + } + + public void setBodyIn(String bodyIn) { + this.bodyIn = bodyIn; + } + + public String getBodyOut() { + return bodyOut; + } + + public void setBodyOut(String bodyOut) { + this.bodyOut = bodyOut; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getCatalogueName() { + return catalogueName; + } + + public void setCatalogueName(String catalogueName) { + this.catalogueName = catalogueName; + } + + public Long getApiCode() { + return apiCode; + } + + public void setApiCode(Long apiCode) { + this.apiCode = apiCode; + } + + public String getApiPath() { + return apiPath; + } + + public void setApiPath(String apiPath) { + this.apiPath = apiPath; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiEntity.xml new file mode 100644 index 00000000..05503384 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiEntity.xml @@ -0,0 +1,741 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,api_status + ,api_code + ,api_path + ,app_id + ,catalogue_id + ,api_name + ,api_remark + ,need_Login + ,authentication_port + ,parameter_passing_mode + ,destination_address + ,request_coding + ,request_method + ,timeout_period + ,current_limiting + ,header_in + ,query_in + ,body_in_type + ,body_in + ,body_out + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + + + insert into sys_application_api( + + id , + api_status , + api_code , + api_code , + api_path , + app_id , + catalogue_id , + api_name , + api_remark , + need_Login , + authentication_port , + parameter_passing_mode , + destination_address , + request_coding , + request_method , + timeout_period , + current_limiting , + header_in , + query_in , + body_in_type , + body_in , + body_out , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{apiStatus} , + #{apiCode} , + (SELECT IFNULL(MAX(b.api_code)+1,(SELECT CONCAT(app_id,'0000') FROM + sys_application WHERE id=#{appId})) AS appId FROM sys_application_api b WHERE b.app_id=#{appId}) , + + #{apiPath} , + #{appId} , + #{catalogueId} , + #{apiName} , + #{apiRemark} , + #{needLogin} , + #{authenticationPort} , + #{parameterPassingMode} , + #{destinationAddress} , + #{requestCoding} , + #{requestMethod} , + #{timeoutPeriod} , + #{currentLimiting} , + #{headerIn} , + #{queryIn} , + #{bodyInType} , + #{bodyIn} , + #{bodyOut} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_api a WHERE + a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark, + need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method, + timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out, sorts, create_user_id, + create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, + 'Y') + + + + + insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark, + need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method, + timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out, sorts, create_user_id, + create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + api_status = values(api_status), + api_code = values(api_code), + api_path = values(api_path), + app_id = values(app_id), + catalogue_id = values(catalogue_id), + api_name = values(api_name), + api_remark = values(api_remark), + need_Login = values(need_Login), + authentication_port = values(authentication_port), + parameter_passing_mode = values(parameter_passing_mode), + destination_address = values(destination_address), + request_coding = values(request_coding), + request_method = values(request_method), + timeout_period = values(timeout_period), + current_limiting = values(current_limiting), + header_in = values(header_in), + query_in = values(query_in), + body_in_type = values(body_in_type), + body_in = values(body_in), + body_out = values(body_out), + sorts = values(sorts), + 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) + + + + update sys_application_api set + + api_status = #{apiStatus}, + api_code = #{apiCode}, + api_path = #{apiPath}, + app_id = #{appId}, + catalogue_id = #{catalogueId}, + api_name = #{apiName}, + api_remark = #{apiRemark}, + need_Login = #{needLogin}, + authentication_port = + #{authenticationPort}, + + parameter_passing_mode = + #{parameterPassingMode}, + + destination_address = + #{destinationAddress}, + + request_coding = #{requestCoding}, + request_method = #{requestMethod}, + timeout_period = #{timeoutPeriod}, + current_limiting = #{currentLimiting}, + header_in = #{headerIn}, + query_in = #{queryIn}, + body_in_type = #{bodyInType}, + body_in = #{bodyIn}, + body_out = #{bodyOut}, + sorts = #{sorts}, + 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}, + + where id = #{id} + + + +update sys_application_api set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + + update sys_application_api set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and api_status = #{apiStatus} + and api_code = #{apiCode} + and api_path = #{apiPath} + and app_id = #{appId} + and catalogue_id = #{catalogueId} + and api_name = #{apiName} + and api_remark = #{apiRemark} + and need_Login = #{needLogin} + and authentication_port = + #{authenticationPort} + + and parameter_passing_mode = + #{parameterPassingMode} + + and destination_address = + #{destinationAddress} + + and request_coding = #{requestCoding} + and request_method = #{requestMethod} + and timeout_period = #{timeoutPeriod} + and current_limiting = #{currentLimiting} + and header_in = #{headerIn} + and query_in = #{queryIn} + and body_in_type = #{bodyInType} + and body_in = #{bodyIn} + and body_out = #{bodyOut} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_api where id = #{id} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiVo.java b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiVo.java new file mode 100644 index 00000000..5f60711d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/entity/SysApplicationApiVo.java @@ -0,0 +1,133 @@ +package com.hzya.frame.sys.application.api.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 应用api(SysApplicationApi)实体类 + * + * @author makejava + * @since 2023-09-22 16:23:27 + */ +public class SysApplicationApiVo { + /** id */ + private String id; + /** 目录 */ + private String catalogueId; + /** 目录 */ + private String catalogueName; + /** api名称 */ + private String apiName; + /** 目标地址 */ + private String destinationAddress; + /** api描述 */ + private String apiRemark; + /** 异常统计 */ + private Integer errorCount; + /** 1启用2停用 */ + private String apiStatus; + /** 选中的三方系统 */ + private String authDetail; + /** 选中的三方系统 */ + private String[] authDetails; + /** 接口编码 */ + private Long apiCode; + /** Api接口地址(固定系统内部外放接口地址) */ + private String apiPath; + + public Long getApiCode() { + return apiCode; + } + + public void setApiCode(Long apiCode) { + this.apiCode = apiCode; + } + + public String getApiPath() { + return apiPath; + } + + public void setApiPath(String apiPath) { + this.apiPath = apiPath; + } + + public String getAuthDetail() { + return authDetail; + } + + public void setAuthDetail(String authDetail) { + this.authDetail = authDetail; + } + + public String[] getAuthDetails() { + return authDetails; + } + + public void setAuthDetails(String[] authDetails) { + this.authDetails = authDetails; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCatalogueId() { + return catalogueId; + } + + public void setCatalogueId(String catalogueId) { + this.catalogueId = catalogueId; + } + + public String getCatalogueName() { + return catalogueName; + } + + public void setCatalogueName(String catalogueName) { + this.catalogueName = catalogueName; + } + + public String getApiName() { + return apiName; + } + + public void setApiName(String apiName) { + this.apiName = apiName; + } + + public String getDestinationAddress() { + return destinationAddress; + } + + public void setDestinationAddress(String destinationAddress) { + this.destinationAddress = destinationAddress; + } + + public String getApiRemark() { + return apiRemark; + } + + public void setApiRemark(String apiRemark) { + this.apiRemark = apiRemark; + } + + public Integer getErrorCount() { + return errorCount; + } + + public void setErrorCount(Integer errorCount) { + this.errorCount = errorCount; + } + + public String getApiStatus() { + return apiStatus; + } + + public void setApiStatus(String apiStatus) { + this.apiStatus = apiStatus; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/service/ISysApplicationApiService.java b/service/src/main/java/com/hzya/frame/sys/application/api/service/ISysApplicationApiService.java new file mode 100644 index 00000000..fe7dc35a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/service/ISysApplicationApiService.java @@ -0,0 +1,14 @@ +package com.hzya.frame.sys.application.api.service; + +import com.hzya.frame.sys.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 应用api(SysApplicationApi)表服务接口 + * + * @author makejava + * @since 2023-09-22 16:23:32 + */ +public interface ISysApplicationApiService extends IBaseService{ + + +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/api/service/impl/SysApplicationApiServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/api/service/impl/SysApplicationApiServiceImpl.java new file mode 100644 index 00000000..150cb0d8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/api/service/impl/SysApplicationApiServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.application.api.service.impl; + +import com.hzya.frame.sys.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sys.application.api.dao.ISysApplicationApiDao; +import com.hzya.frame.sys.application.api.service.ISysApplicationApiService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 应用api(SysApplicationApi)表服务实现类 + * + * @author makejava + * @since 2023-09-22 16:23:35 + */ +@Service(value = "sysApplicationApiService") +public class SysApplicationApiServiceImpl extends BaseService implements ISysApplicationApiService { + + private ISysApplicationApiDao sysApplicationApiDao; + + @Autowired + public void setSysApplicationApiDao(ISysApplicationApiDao dao) { + this.sysApplicationApiDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAuth/dao/ISysApplicationApiAuthDao.java b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/dao/ISysApplicationApiAuthDao.java new file mode 100644 index 00000000..530a4e37 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/dao/ISysApplicationApiAuthDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sys.application.apiAuth.dao; + +import com.hzya.frame.sys.application.apiAuth.entity.SysApplicationApiAuthEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 三方调用系统表(sys_application_api_auth: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:24:43 + */ +public interface ISysApplicationApiAuthDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAuth/dao/impl/SysApplicationApiAuthDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/dao/impl/SysApplicationApiAuthDaoImpl.java new file mode 100644 index 00000000..32fd6045 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/dao/impl/SysApplicationApiAuthDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sys.application.apiAuth.dao.impl; + +import com.hzya.frame.sys.application.apiAuth.entity.SysApplicationApiAuthEntity; +import com.hzya.frame.sys.application.apiAuth.dao.ISysApplicationApiAuthDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 三方调用系统表(SysApplicationApiAuth)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:24:46 + */ +@Repository(value = "SysApplicationApiAuthDaoImpl") +public class SysApplicationApiAuthDaoImpl extends MybatisGenericDao implements ISysApplicationApiAuthDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthDto.java b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthDto.java new file mode 100644 index 00000000..2eb66bd4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthDto.java @@ -0,0 +1,36 @@ +package com.hzya.frame.sys.application.apiAuth.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +/** + * 三方调用系统表(SysApplicationApiAuth)实体类 + * + * @author makejava + * @since 2023-09-22 16:24:48 + */ +public class SysApplicationApiAuthDto { + + /** 三方调用系统 */ + private List apiAuths; + + private String appId; + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public List getApiAuths() { + return apiAuths; + } + + public void setApiAuths(List apiAuths) { + this.apiAuths = apiAuths; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthEntity.java b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthEntity.java new file mode 100644 index 00000000..dafa6cdf --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthEntity.java @@ -0,0 +1,56 @@ +package com.hzya.frame.sys.application.apiAuth.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 三方调用系统表(SysApplicationApiAuth)实体类 + * + * @author makejava + * @since 2023-09-22 16:24:48 + */ +public class SysApplicationApiAuthEntity extends BaseEntity { + + /** 应用id */ + private String appId; + /** 状态(1、开启 2、关闭) */ + private String systemStatus; + /** 系统名称 */ + private String name; + /** 接口地址 */ + private String systemAddress; + + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getSystemStatus() { + return systemStatus; + } + + public void setSystemStatus(String systemStatus) { + this.systemStatus = systemStatus; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSystemAddress() { + return systemAddress; + } + + public void setSystemAddress(String systemAddress) { + this.systemAddress = systemAddress; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthEntity.xml new file mode 100644 index 00000000..c6e1c57f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/entity/SysApplicationApiAuthEntity.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + id + ,app_id + ,system_status + ,name + ,system_address + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + + + insert into sys_application_api_auth( + + id , + app_id , + system_status , + name , + system_address , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{appId} , + #{systemStatus} , + #{name} , + #{systemAddress} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_api_auth a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into sys_application_api_auth(app_id, system_status, name, system_address, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.appId},#{entity.systemStatus},#{entity.name},#{entity.systemAddress},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, 'Y') + + + + + insert into sys_application_api_auth(app_id, system_status, name, system_address, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.appId},#{entity.systemStatus},#{entity.name},#{entity.systemAddress},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + app_id = values(app_id), + system_status = values(system_status), + name = values(name), + system_address = values(system_address), + sorts = values(sorts), + 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) + + +update sys_application_api_auth set + + app_id = #{appId}, + system_status = #{systemStatus}, + name = #{name}, + system_address = #{systemAddress}, + sorts = #{sorts}, + 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}, + +where id = #{id} + + + +update sys_application_api_auth set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_api_auth set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and system_status = #{systemStatus} + and name = #{name} + and system_address = #{systemAddress} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_api_auth where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAuth/service/ISysApplicationApiAuthService.java b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/service/ISysApplicationApiAuthService.java new file mode 100644 index 00000000..b51d3b25 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/service/ISysApplicationApiAuthService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sys.application.apiAuth.service; + +import com.hzya.frame.sys.application.apiAuth.entity.SysApplicationApiAuthEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 三方调用系统表(SysApplicationApiAuth)表服务接口 + * + * @author makejava + * @since 2023-09-22 16:24:51 + */ +public interface ISysApplicationApiAuthService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAuth/service/impl/SysApplicationApiAuthServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/service/impl/SysApplicationApiAuthServiceImpl.java new file mode 100644 index 00000000..cb1bfb99 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAuth/service/impl/SysApplicationApiAuthServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.application.apiAuth.service.impl; + +import com.hzya.frame.sys.application.apiAuth.entity.SysApplicationApiAuthEntity; +import com.hzya.frame.sys.application.apiAuth.dao.ISysApplicationApiAuthDao; +import com.hzya.frame.sys.application.apiAuth.service.ISysApplicationApiAuthService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 三方调用系统表(SysApplicationApiAuth)表服务实现类 + * + * @author makejava + * @since 2023-09-22 16:24:52 + */ +@Service(value = "sysApplicationApiAuthService") +public class SysApplicationApiAuthServiceImpl extends BaseService implements ISysApplicationApiAuthService { + + private ISysApplicationApiAuthDao sysApplicationApiAuthDao; + + @Autowired + public void setSysApplicationApiAuthDao(ISysApplicationApiAuthDao dao) { + this.sysApplicationApiAuthDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/dao/ISysApplicationApiAuthDetailDao.java b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/dao/ISysApplicationApiAuthDetailDao.java new file mode 100644 index 00000000..3853c50c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/dao/ISysApplicationApiAuthDetailDao.java @@ -0,0 +1,16 @@ +package com.hzya.frame.sys.application.apiAythDetail.dao; + +import com.hzya.frame.sys.application.apiAythDetail.entity.SysApplicationApiAuthDetailEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 应用api关联三方调用系统表(sys_application_api_auth_detail: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:25:46 + */ +public interface ISysApplicationApiAuthDetailDao extends IBaseDao { + + Integer updateDeleteTripartiteSystem(SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity); +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/dao/impl/SysApplicationApiAuthDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/dao/impl/SysApplicationApiAuthDetailDaoImpl.java new file mode 100644 index 00000000..07f076b7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/dao/impl/SysApplicationApiAuthDetailDaoImpl.java @@ -0,0 +1,21 @@ +package com.hzya.frame.sys.application.apiAythDetail.dao.impl; + +import com.hzya.frame.sys.application.apiAythDetail.entity.SysApplicationApiAuthDetailEntity; +import com.hzya.frame.sys.application.apiAythDetail.dao.ISysApplicationApiAuthDetailDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 应用api关联三方调用系统表(SysApplicationApiAuthDetail)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:25:50 + */ +@Repository(value = "SysApplicationApiAuthDetailDaoImpl") +public class SysApplicationApiAuthDetailDaoImpl extends MybatisGenericDao implements ISysApplicationApiAuthDetailDao{ + + @Override + public Integer updateDeleteTripartiteSystem(SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity) { + return super.update(getSqlIdPrifx() +"updateDeleteTripartiteSystem", sysApplicationApiAuthDetailEntity); + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.java b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.java new file mode 100644 index 00000000..3183ddce --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.java @@ -0,0 +1,76 @@ +package com.hzya.frame.sys.application.apiAythDetail.entity; + +import java.util.Date; +import java.util.List; + +import com.hzya.frame.web.entity.BaseEntity; +/** + * 应用api关联三方调用系统表(SysApplicationApiAuthDetail)实体类 + * + * @author makejava + * @since 2023-09-22 16:25:51 + */ +public class SysApplicationApiAuthDetailEntity extends BaseEntity { + + /** 应用id */ + private String appId; + /** 目录id */ + private String catalogueId; + /** 接口id */ + private String apiId; + /** 三方调用系统表id */ + private String tripartiteSystemId; + + /** 状态 1、取消选择 2、选择 */ + private String statusType; + /** 三方调用系统表id s*/ + private List tripartiteSystemIds; + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getCatalogueId() { + return catalogueId; + } + + public void setCatalogueId(String catalogueId) { + this.catalogueId = catalogueId; + } + + public String getApiId() { + return apiId; + } + + public void setApiId(String apiId) { + this.apiId = apiId; + } + + public String getTripartiteSystemId() { + return tripartiteSystemId; + } + + public void setTripartiteSystemId(String tripartiteSystemId) { + this.tripartiteSystemId = tripartiteSystemId; + } + + public List getTripartiteSystemIds() { + return tripartiteSystemIds; + } + + public void setTripartiteSystemIds(List tripartiteSystemIds) { + this.tripartiteSystemIds = tripartiteSystemIds; + } + + public String getStatusType() { + return statusType; + } + + public void setStatusType(String statusType) { + this.statusType = statusType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.xml new file mode 100644 index 00000000..7a78e4a1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.xml @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + + + + + id + ,app_id + ,catalogue_id + ,api_id + ,tripartite_system_id + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + + + insert into sys_application_api_auth_detail( + + id , + app_id , + catalogue_id , + api_id , + tripartite_system_id , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{appId} , + #{catalogueId} , + #{apiId} , + #{tripartiteSystemId} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_api_auth_detail a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into sys_application_api_auth_detail(app_id, catalogue_id, api_id, tripartite_system_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.appId},#{entity.catalogueId},#{entity.apiId},#{entity.tripartiteSystemId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, 'Y') + + + + + insert into sys_application_api_auth_detail(app_id, catalogue_id, api_id, tripartite_system_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.appId},#{entity.catalogueId},#{entity.apiId},#{entity.tripartiteSystemId},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + app_id = values(app_id), + catalogue_id = values(catalogue_id), + api_id = values(api_id), + tripartite_system_id = values(tripartite_system_id), + sorts = values(sorts), + 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) + + +update sys_application_api_auth_detail set + + app_id = #{appId}, + catalogue_id = #{catalogueId}, + api_id = #{apiId}, + tripartite_system_id = #{tripartiteSystemId}, + sorts = #{sorts}, + 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}, + +where id = #{id} + + + +update sys_application_api_auth_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_api_auth_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and catalogue_id = #{catalogueId} + and api_id = #{apiId} + and tripartite_system_id = #{tripartiteSystemId} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_api_auth_detail where id = #{id} + + + update sys_application_api_auth_detail set sts = 'N' + where sts = 'Y' and app_id = #{appId} + + and tripartite_system_id not in + + #{item} + + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/service/ISysApplicationApiAuthDetailService.java b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/service/ISysApplicationApiAuthDetailService.java new file mode 100644 index 00000000..7b2d506d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/service/ISysApplicationApiAuthDetailService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sys.application.apiAythDetail.service; + +import com.hzya.frame.sys.application.apiAythDetail.entity.SysApplicationApiAuthDetailEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 应用api关联三方调用系统表(SysApplicationApiAuthDetail)表服务接口 + * + * @author makejava + * @since 2023-09-22 16:25:54 + */ +public interface ISysApplicationApiAuthDetailService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/service/impl/SysApplicationApiAuthDetailServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/service/impl/SysApplicationApiAuthDetailServiceImpl.java new file mode 100644 index 00000000..89a18ffc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiAythDetail/service/impl/SysApplicationApiAuthDetailServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.application.apiAythDetail.service.impl; + +import com.hzya.frame.sys.application.apiAythDetail.entity.SysApplicationApiAuthDetailEntity; +import com.hzya.frame.sys.application.apiAythDetail.dao.ISysApplicationApiAuthDetailDao; +import com.hzya.frame.sys.application.apiAythDetail.service.ISysApplicationApiAuthDetailService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 应用api关联三方调用系统表(SysApplicationApiAuthDetail)表服务实现类 + * + * @author makejava + * @since 2023-09-22 16:25:56 + */ +@Service(value = "sysApplicationApiAuthDetailService") +public class SysApplicationApiAuthDetailServiceImpl extends BaseService implements ISysApplicationApiAuthDetailService { + + private ISysApplicationApiAuthDetailDao sysApplicationApiAuthDetailDao; + + @Autowired + public void setSysApplicationApiAuthDetailDao(ISysApplicationApiAuthDetailDao dao) { + this.sysApplicationApiAuthDetailDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiPara/dao/ISysApplicationApiParaDao.java b/service/src/main/java/com/hzya/frame/sys/application/apiPara/dao/ISysApplicationApiParaDao.java new file mode 100644 index 00000000..0c19d8fc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiPara/dao/ISysApplicationApiParaDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sys.application.apiPara.dao; + +import com.hzya.frame.sys.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 接口环境参数表(sys_application_api_para: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-25 11:47:17 + */ +public interface ISysApplicationApiParaDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiPara/dao/impl/SysApplicationApiParaDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiPara/dao/impl/SysApplicationApiParaDaoImpl.java new file mode 100644 index 00000000..f56ec664 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiPara/dao/impl/SysApplicationApiParaDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sys.application.apiPara.dao.impl; + +import com.hzya.frame.sys.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.sys.application.apiPara.dao.ISysApplicationApiParaDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 接口环境参数表(SysApplicationApiPara)表数据库访问层 + * + * @author makejava + * @since 2023-09-25 11:47:17 + */ +@Repository(value = "SysApplicationApiParaDaoImpl") +public class SysApplicationApiParaDaoImpl extends MybatisGenericDao implements ISysApplicationApiParaDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiPara/entity/SysApplicationApiParaEntity.java b/service/src/main/java/com/hzya/frame/sys/application/apiPara/entity/SysApplicationApiParaEntity.java new file mode 100644 index 00000000..116d6d9e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiPara/entity/SysApplicationApiParaEntity.java @@ -0,0 +1,60 @@ +package com.hzya.frame.sys.application.apiPara.entity; + +import java.util.Date; + +import cn.dev33.satoken.stp.StpUtil; +import com.hzya.frame.sys.org.entity.Org; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 接口环境参数表(SysApplicationApiPara)实体类 + * + * @author makejava + * @since 2023-09-25 11:47:18 + */ +public class SysApplicationApiParaEntity extends BaseEntity { + + /** 应用id */ + private String appId; + /** key */ + private String interfaceKey; + /** value */ + private String interfaceValue; + /** 类型(1、header2、body) */ + private String interfaceType; + + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getInterfaceKey() { + return interfaceKey; + } + + public void setInterfaceKey(String interfaceKey) { + this.interfaceKey = interfaceKey; + } + + public String getInterfaceValue() { + return interfaceValue; + } + + public void setInterfaceValue(String interfaceValue) { + this.interfaceValue = interfaceValue; + } + + public String getInterfaceType() { + return interfaceType; + } + + public void setInterfaceType(String interfaceType) { + this.interfaceType = interfaceType; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiPara/entity/SysApplicationApiParaEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/apiPara/entity/SysApplicationApiParaEntity.xml new file mode 100644 index 00000000..69764d6d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiPara/entity/SysApplicationApiParaEntity.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + id + ,app_id + ,interface_key + ,interface_value + ,interface_type + ,sorts + ,org_id + ,sts + ,create_time + ,create_user_id + ,modify_time + ,modify_user_id + + + + + + + + + + + + + + + + + + insert into sys_application_api_para( + + id , + app_id , + interface_key , + interface_value , + interface_type , + sorts , + org_id , + sts , + create_time , + create_user_id , + modify_time , + modify_user_id , + sorts, + sts, + + )values( + + #{id} , + #{appId} , + #{interfaceKey} , + #{interfaceValue} , + #{interfaceType} , + #{sorts} , + #{org_id} , + #{sts} , + #{create_time} , + #{create_user_id} , + #{modify_time} , + #{modify_user_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_api_para a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into sys_application_api_para(app_id, interface_key, interface_value, interface_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + values + + (#{entity.appId},#{entity.interfaceKey},#{entity.interfaceValue},#{entity.interfaceType},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + + + + + insert into sys_application_api_para(app_id, interface_key, interface_value, interface_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + values + + (#{entity.appId},#{entity.interfaceKey},#{entity.interfaceValue},#{entity.interfaceType},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + + on duplicate key update + app_id = values(app_id), + interface_key = values(interface_key), + interface_value = values(interface_value), + interface_type = values(interface_type), + sorts = values(sorts), + org_id = values(org_id), + sts = values(sts), + create_time = values(create_time), + create_user_id = values(create_user_id), + modify_time = values(modify_time), + modify_user_id = values(modify_user_id) + + +update sys_application_api_para set + + app_id = #{appId}, + interface_key = #{interfaceKey}, + interface_value = #{interfaceValue}, + interface_type = #{interfaceType}, + sorts = #{sorts}, + org_id = #{org_id}, + sts = #{sts}, + create_time = #{create_time}, + create_user_id = #{create_user_id}, + modify_time = #{modify_time}, + modify_user_id = #{modify_user_id}, + +where id = #{id} + + + +update sys_application_api_para set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_api_para set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and interface_key = #{interfaceKey} + and interface_value = #{interfaceValue} + and interface_type = #{interfaceType} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_api_para where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiPara/service/ISysApplicationApiParaService.java b/service/src/main/java/com/hzya/frame/sys/application/apiPara/service/ISysApplicationApiParaService.java new file mode 100644 index 00000000..7293381b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiPara/service/ISysApplicationApiParaService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sys.application.apiPara.service; + +import com.hzya.frame.sys.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 接口环境参数表(SysApplicationApiPara)表服务接口 + * + * @author makejava + * @since 2023-09-25 11:47:18 + */ +public interface ISysApplicationApiParaService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiPara/service/impl/SysApplicationApiParaServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiPara/service/impl/SysApplicationApiParaServiceImpl.java new file mode 100644 index 00000000..f8c9b6b2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiPara/service/impl/SysApplicationApiParaServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.application.apiPara.service.impl; + +import com.hzya.frame.sys.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.sys.application.apiPara.dao.ISysApplicationApiParaDao; +import com.hzya.frame.sys.application.apiPara.service.ISysApplicationApiParaService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 接口环境参数表(SysApplicationApiPara)表服务实现类 + * + * @author makejava + * @since 2023-09-25 11:47:18 + */ +@Service(value = "sysApplicationApiParaService") +public class SysApplicationApiParaServiceImpl extends BaseService implements ISysApplicationApiParaService { + + private ISysApplicationApiParaDao sysApplicationApiParaDao; + + @Autowired + public void setSysApplicationApiParaDao(ISysApplicationApiParaDao dao) { + this.sysApplicationApiParaDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiType/dao/ISysApplicationApiTypeDao.java b/service/src/main/java/com/hzya/frame/sys/application/apiType/dao/ISysApplicationApiTypeDao.java new file mode 100644 index 00000000..81feb27c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiType/dao/ISysApplicationApiTypeDao.java @@ -0,0 +1,16 @@ +package com.hzya.frame.sys.application.apiType.dao; + +import com.hzya.frame.sys.application.apiType.entity.SysApplicationApiTypeEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 目录表(sys_application_api_type: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-25 11:47:39 + */ +public interface ISysApplicationApiTypeDao extends IBaseDao { + + int entity_count_not_id(SysApplicationApiTypeEntity checkEntity); +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiType/dao/impl/SysApplicationApiTypeDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiType/dao/impl/SysApplicationApiTypeDaoImpl.java new file mode 100644 index 00000000..810709c4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiType/dao/impl/SysApplicationApiTypeDaoImpl.java @@ -0,0 +1,22 @@ +package com.hzya.frame.sys.application.apiType.dao.impl; + +import com.hzya.frame.sys.application.apiType.entity.SysApplicationApiTypeEntity; +import com.hzya.frame.sys.application.apiType.dao.ISysApplicationApiTypeDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 目录表(SysApplicationApiType)表数据库访问层 + * + * @author makejava + * @since 2023-09-25 11:47:39 + */ +@Repository(value = "SysApplicationApiTypeDaoImpl") +public class SysApplicationApiTypeDaoImpl extends MybatisGenericDao implements ISysApplicationApiTypeDao{ + + @Override + public int entity_count_not_id(SysApplicationApiTypeEntity entity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count_not_id", entity); + return o; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiType/entity/SysApplicationApiTypeEntity.java b/service/src/main/java/com/hzya/frame/sys/application/apiType/entity/SysApplicationApiTypeEntity.java new file mode 100644 index 00000000..62418281 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiType/entity/SysApplicationApiTypeEntity.java @@ -0,0 +1,36 @@ +package com.hzya.frame.sys.application.apiType.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 目录表(SysApplicationApiType)实体类 + * + * @author makejava + * @since 2023-09-25 11:47:40 + */ +public class SysApplicationApiTypeEntity extends BaseEntity { + + /** 应用id */ + private String appId; + /** 目录名称 */ + private String name; + + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiType/entity/SysApplicationApiTypeEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/apiType/entity/SysApplicationApiTypeEntity.xml new file mode 100644 index 00000000..99646b9a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiType/entity/SysApplicationApiTypeEntity.xml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + id + ,app_id + ,name + ,sorts + ,org_id + ,sts + ,create_time + ,create_user_id + ,modify_time + ,modify_user_id + + + + + + + + + + + + + + + + + + + + + insert into sys_application_api_type( + + id , + app_id , + name , + sorts , + org_id , + sts , + create_time , + create_user_id , + modify_time , + modify_user_id , + sorts, + sts, + + )values( + + #{id} , + #{appId} , + #{name} , + #{sorts} , + #{org_id} , + #{sts} , + #{create_time} , + #{create_user_id} , + #{modify_time} , + #{modify_user_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_api_type a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into sys_application_api_type(app_id, name, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + values + + (#{entity.appId},#{entity.name},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + + + + + insert into sys_application_api_type(app_id, name, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + values + + (#{entity.appId},#{entity.name},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + + on duplicate key update + app_id = values(app_id), + name = values(name), + sorts = values(sorts), + org_id = values(org_id), + sts = values(sts), + create_time = values(create_time), + create_user_id = values(create_user_id), + modify_time = values(modify_time), + modify_user_id = values(modify_user_id) + + +update sys_application_api_type set + + app_id = #{appId}, + name = #{name}, + sorts = #{sorts}, + org_id = #{org_id}, + sts = #{sts}, + create_time = #{create_time}, + create_user_id = #{create_user_id}, + modify_time = #{modify_time}, + modify_user_id = #{modify_user_id}, + +where id = #{id} + + + +update sys_application_api_type set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_api_type set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and name = #{name} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_api_type where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiType/service/ISysApplicationApiTypeService.java b/service/src/main/java/com/hzya/frame/sys/application/apiType/service/ISysApplicationApiTypeService.java new file mode 100644 index 00000000..106284a9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiType/service/ISysApplicationApiTypeService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sys.application.apiType.service; + +import com.hzya.frame.sys.application.apiType.entity.SysApplicationApiTypeEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 目录表(SysApplicationApiType)表服务接口 + * + * @author makejava + * @since 2023-09-25 11:47:40 + */ +public interface ISysApplicationApiTypeService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/apiType/service/impl/SysApplicationApiTypeServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/apiType/service/impl/SysApplicationApiTypeServiceImpl.java new file mode 100644 index 00000000..d36fda2f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/apiType/service/impl/SysApplicationApiTypeServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.application.apiType.service.impl; + +import com.hzya.frame.sys.application.apiType.entity.SysApplicationApiTypeEntity; +import com.hzya.frame.sys.application.apiType.dao.ISysApplicationApiTypeDao; +import com.hzya.frame.sys.application.apiType.service.ISysApplicationApiTypeService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 目录表(SysApplicationApiType)表服务实现类 + * + * @author makejava + * @since 2023-09-25 11:47:40 + */ +@Service(value = "sysApplicationApiTypeService") +public class SysApplicationApiTypeServiceImpl extends BaseService implements ISysApplicationApiTypeService { + + private ISysApplicationApiTypeDao sysApplicationApiTypeDao; + + @Autowired + public void setSysApplicationApiTypeDao(ISysApplicationApiTypeDao dao) { + this.sysApplicationApiTypeDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/dao/ISysApplicationDao.java b/service/src/main/java/com/hzya/frame/sys/application/dao/ISysApplicationDao.java new file mode 100644 index 00000000..0f615bda --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/dao/ISysApplicationDao.java @@ -0,0 +1,20 @@ +package com.hzya.frame.sys.application.dao; + +import com.hzya.frame.sys.application.entity.SysApplicationDto; +import com.hzya.frame.sys.application.entity.SysApplicationEntity; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.application.entity.SysApplicationVo; + +import java.util.List; + +/** + * 应用表(sys_application: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:22:11 + */ +public interface ISysApplicationDao extends IBaseDao { + + List queryApp(SysApplicationDto entity); +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/dao/impl/SysApplicationDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/dao/impl/SysApplicationDaoImpl.java new file mode 100644 index 00000000..616e6058 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/dao/impl/SysApplicationDaoImpl.java @@ -0,0 +1,28 @@ +package com.hzya.frame.sys.application.dao.impl; + +import com.hzya.frame.sys.appApi.entity.AppApiDto; +import com.hzya.frame.sys.appApi.entity.AppApiListVo; +import com.hzya.frame.sys.application.entity.SysApplicationDto; +import com.hzya.frame.sys.application.entity.SysApplicationEntity; +import com.hzya.frame.sys.application.dao.ISysApplicationDao; +import com.hzya.frame.sys.application.entity.SysApplicationVo; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + +/** + * 应用表(SysApplication)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:22:14 + */ +@Repository(value = "SysApplicationDaoImpl") +public class SysApplicationDaoImpl extends MybatisGenericDao implements ISysApplicationDao{ + @Override + public List queryApp(SysApplicationDto entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryApp", entity); + return o; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/database/dao/ISysApplicationDatabaseDao.java b/service/src/main/java/com/hzya/frame/sys/application/database/dao/ISysApplicationDatabaseDao.java new file mode 100644 index 00000000..ec3bc699 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/database/dao/ISysApplicationDatabaseDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sys.application.database.dao; + +import com.hzya.frame.sys.application.database.entity.SysApplicationDatabaseEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 数据源表(sys_application_database: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-25 11:46:27 + */ +public interface ISysApplicationDatabaseDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java new file mode 100644 index 00000000..0bbb2213 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sys.application.database.dao.impl; + +import com.hzya.frame.sys.application.database.entity.SysApplicationDatabaseEntity; +import com.hzya.frame.sys.application.database.dao.ISysApplicationDatabaseDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 数据源表(SysApplicationDatabase)表数据库访问层 + * + * @author makejava + * @since 2023-09-25 11:46:31 + */ +@Repository(value = "SysApplicationDatabaseDaoImpl") +public class SysApplicationDatabaseDaoImpl extends MybatisGenericDao implements ISysApplicationDatabaseDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/database/entity/SysApplicationDatabaseEntity.java b/service/src/main/java/com/hzya/frame/sys/application/database/entity/SysApplicationDatabaseEntity.java new file mode 100644 index 00000000..63313bf3 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/database/entity/SysApplicationDatabaseEntity.java @@ -0,0 +1,86 @@ +package com.hzya.frame.sys.application.database.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 数据源表(SysApplicationDatabase)实体类 + * + * @author makejava + * @since 2023-09-25 11:46:34 + */ +public class SysApplicationDatabaseEntity extends BaseEntity { + + /** 应用id */ + private String appId; + /** 数据源类型(1、oracle 2、sqlServer3、mysql) */ + private String sourceType; + /** 实例地址 */ + private String sourceUrl; + /** 账户 */ + private String loginName; + /** 密码 */ + private String password; + /** 库名 */ + private String dbName; + /** 数据源是否启用(1、开启 2、关闭) */ + private String dbStatus; + + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + + public String getSourceUrl() { + return sourceUrl; + } + + public void setSourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbStatus() { + return dbStatus; + } + + public void setDbStatus(String dbStatus) { + this.dbStatus = dbStatus; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/database/entity/SysApplicationDatabaseEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/database/entity/SysApplicationDatabaseEntity.xml new file mode 100644 index 00000000..96e1796f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/database/entity/SysApplicationDatabaseEntity.xml @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + + id + ,app_id + ,source_type + ,source_url + ,login_name + ,password + ,db_name + ,db_status + ,sorts + ,org_id + ,sts + ,create_time + ,create_user_id + ,modify_time + ,modify_user_id + + + + + + + + + + + + + + + + + + insert into sys_application_database( + + id , + app_id , + source_type , + source_url , + login_name , + password , + db_name , + db_status , + sorts , + org_id , + sts , + create_time , + create_user_id , + modify_time , + modify_user_id , + sorts, + sts, + + )values( + + #{id} , + #{appId} , + #{sourceType} , + #{sourceUrl} , + #{loginName} , + #{password} , + #{dbName} , + #{dbStatus} , + #{sorts} , + #{org_id} , + #{sts} , + #{create_time} , + #{create_user_id} , + #{modify_time} , + #{modify_user_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_database a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + values + + (#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + + + + + insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + values + + (#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + + on duplicate key update + app_id = values(app_id), + source_type = values(source_type), + source_url = values(source_url), + login_name = values(login_name), + password = values(password), + db_name = values(db_name), + db_status = values(db_status), + sorts = values(sorts), + org_id = values(org_id), + sts = values(sts), + create_time = values(create_time), + create_user_id = values(create_user_id), + modify_time = values(modify_time), + modify_user_id = values(modify_user_id) + + +update sys_application_database set + + app_id = #{appId}, + source_type = #{sourceType}, + source_url = #{sourceUrl}, + login_name = #{loginName}, + password = #{password}, + db_name = #{dbName}, + db_status = #{dbStatus}, + sorts = #{sorts}, + org_id = #{org_id}, + sts = #{sts}, + create_time = #{create_time}, + create_user_id = #{create_user_id}, + modify_time = #{modify_time}, + modify_user_id = #{modify_user_id}, + +where id = #{id} + + + +update sys_application_database set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_database set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and source_type = #{sourceType} + and source_url = #{sourceUrl} + and login_name = #{loginName} + and password = #{password} + and db_name = #{dbName} + and db_status = #{dbStatus} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_database where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/database/service/ISysApplicationDatabaseService.java b/service/src/main/java/com/hzya/frame/sys/application/database/service/ISysApplicationDatabaseService.java new file mode 100644 index 00000000..9eff0b3b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/database/service/ISysApplicationDatabaseService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sys.application.database.service; + +import com.hzya.frame.sys.application.database.entity.SysApplicationDatabaseEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 数据源表(SysApplicationDatabase)表服务接口 + * + * @author makejava + * @since 2023-09-25 11:46:39 + */ +public interface ISysApplicationDatabaseService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/database/service/impl/SysApplicationDatabaseServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/database/service/impl/SysApplicationDatabaseServiceImpl.java new file mode 100644 index 00000000..4500c036 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/database/service/impl/SysApplicationDatabaseServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.application.database.service.impl; + +import com.hzya.frame.sys.application.database.entity.SysApplicationDatabaseEntity; +import com.hzya.frame.sys.application.database.dao.ISysApplicationDatabaseDao; +import com.hzya.frame.sys.application.database.service.ISysApplicationDatabaseService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 数据源表(SysApplicationDatabase)表服务实现类 + * + * @author makejava + * @since 2023-09-25 11:46:42 + */ +@Service(value = "sysApplicationDatabaseService") +public class SysApplicationDatabaseServiceImpl extends BaseService implements ISysApplicationDatabaseService { + + private ISysApplicationDatabaseDao sysApplicationDatabaseDao; + + @Autowired + public void setSysApplicationDatabaseDao(ISysApplicationDatabaseDao dao) { + this.sysApplicationDatabaseDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationDatasourceDto.java b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationDatasourceDto.java new file mode 100644 index 00000000..9d3dd9ca --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationDatasourceDto.java @@ -0,0 +1,53 @@ +package com.hzya.frame.sys.application.entity; + + +import com.hzya.frame.sys.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.sys.application.database.entity.SysApplicationDatabaseEntity; + +import java.util.List; + +/** + * 应用表(SysApplication)实体类 + * + * @author makejava + * @since 2023-09-22 16:22:18 + */ +public class SysApplicationDatasourceDto { + private String sourceUrl; + private String loginName; + private String password; + private String sourceType; + + public String getSourceUrl() { + return sourceUrl; + } + + public void setSourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationDto.java b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationDto.java new file mode 100644 index 00000000..56d76dc8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationDto.java @@ -0,0 +1,266 @@ +package com.hzya.frame.sys.application.entity; + + +import com.hzya.frame.sys.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.sys.application.database.entity.SysApplicationDatabaseEntity; + +import java.util.List; + +/** + * 应用表(SysApplication)实体类 + * + * @author makejava + * @since 2023-09-22 16:22:18 + */ +public class SysApplicationDto { + + /** id */ + private String id; + /** 所属领域(枚举表) */ + private String affiliationField; + /** 应用是否启用(1、启用 2、停用) */ + private String appStatus; + /** 应用名称或者厂商 */ + private String nameOrManufacturer; + + /** 修改类型 1、应用信息 2、开发管理 */ + private String updateType; + /** 应用logo(地址或者id) */ + private String appLogo; + /** 应用名称 */ + private String name; + /** 版本号 */ + private String versionNumber; + /** 接入方式(1、接口2、H53、PC网页4、PC应用程序 ) */ + private String accessMode; + /** 厂商 */ + private String manufacturer; + /** 应用简介 */ + private String appIntroduction; + /** 应用客户端地址(PC) */ + private String clientPath; + /** 应用网页端地址(PC) */ + private String webPath; + /** 应用程序地址(移动端) */ + private String programPath; + /** 应用key */ + private String publicKey; + /** 应用密钥 */ + private String secretKey; + /** 接口地址 */ + private String interfaceAddress; + /** 接口环境是否启用(1、开启 2、关闭) */ + private String interfaceStatus; + /** 数据源是否启用(1、开启 2、关闭) */ + private String dbStatus; + /** 数据源是否启用(1、开启 2、关闭) */ + private Integer appId; + /** ip白名单 */ + private String systemAddress; + //api接口参数表 + private List apiParas; + + //数据源 + private SysApplicationDatabaseEntity databaseEntity; + private Integer pageNum; + private Integer pageSize; + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAffiliationField() { + return affiliationField; + } + + public void setAffiliationField(String affiliationField) { + this.affiliationField = affiliationField; + } + + public String getAppStatus() { + return appStatus; + } + + public void setAppStatus(String appStatus) { + this.appStatus = appStatus; + } + + public String getNameOrManufacturer() { + return nameOrManufacturer; + } + + public void setNameOrManufacturer(String nameOrManufacturer) { + this.nameOrManufacturer = nameOrManufacturer; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getAppLogo() { + return appLogo; + } + + public void setAppLogo(String appLogo) { + this.appLogo = appLogo; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(String versionNumber) { + this.versionNumber = versionNumber; + } + + public String getAccessMode() { + return accessMode; + } + + public void setAccessMode(String accessMode) { + this.accessMode = accessMode; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getAppIntroduction() { + return appIntroduction; + } + + public void setAppIntroduction(String appIntroduction) { + this.appIntroduction = appIntroduction; + } + + public String getClientPath() { + return clientPath; + } + + public void setClientPath(String clientPath) { + this.clientPath = clientPath; + } + + public String getWebPath() { + return webPath; + } + + public void setWebPath(String webPath) { + this.webPath = webPath; + } + + public String getProgramPath() { + return programPath; + } + + public void setProgramPath(String programPath) { + this.programPath = programPath; + } + + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getInterfaceAddress() { + return interfaceAddress; + } + + public void setInterfaceAddress(String interfaceAddress) { + this.interfaceAddress = interfaceAddress; + } + + public String getInterfaceStatus() { + return interfaceStatus; + } + + public void setInterfaceStatus(String interfaceStatus) { + this.interfaceStatus = interfaceStatus; + } + + public String getDbStatus() { + return dbStatus; + } + + public void setDbStatus(String dbStatus) { + this.dbStatus = dbStatus; + } + + public String getUpdateType() { + return updateType; + } + + public void setUpdateType(String updateType) { + this.updateType = updateType; + } + public List getApiParas() { + return apiParas; + } + + public void setApiParas(List apiParas) { + this.apiParas = apiParas; + } + + public SysApplicationDatabaseEntity getDatabaseEntity() { + return databaseEntity; + } + + public void setDatabaseEntity(SysApplicationDatabaseEntity databaseEntity) { + this.databaseEntity = databaseEntity; + } + + public Integer getAppId() { + return appId; + } + + public void setAppId(Integer appId) { + this.appId = appId; + } + + public String getSystemAddress() { + return systemAddress; + } + + public void setSystemAddress(String systemAddress) { + this.systemAddress = systemAddress; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationEntity.java b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationEntity.java new file mode 100644 index 00000000..b1d686df --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationEntity.java @@ -0,0 +1,195 @@ +package com.hzya.frame.sys.application.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 应用表(SysApplication)实体类 + * + * @author makejava + * @since 2023-09-22 16:22:18 + */ +public class SysApplicationEntity extends BaseEntity { + + /** 应用logo(地址或者id) */ + private String appLogo; + /** 应用是否启用(1、启用 2、停用) */ + private String appStatus; + /** 应用名称 */ + private String name; + /** 版本号 */ + private String versionNumber; + /** 接入方式(1、接口2、H53、PC网页4、PC应用程序 ) */ + private String accessMode; + /** 所属领域(枚举表) */ + private String affiliationField; + /** 厂商 */ + private String manufacturer; + /** 应用简介 */ + private String appIntroduction; + /** 应用客户端地址(PC) */ + private String clientPath; + /** 应用网页端地址(PC) */ + private String webPath; + /** 应用程序地址(移动端) */ + private String programPath; + /** 应用key */ + private String publicKey; + /** 应用密钥 */ + private String secretKey; + /** 接口地址 */ + private String interfaceAddress; + /** 接口环境是否启用(1、开启 2、关闭) */ + private String interfaceStatus; + /** 数据源是否启用(1、开启 2、关闭) */ + private String dbStatus; + + /** appid */ + private Integer appId; + /** ip白名单 */ + private String systemAddress; + + public String getAppLogo() { + return appLogo; + } + + public void setAppLogo(String appLogo) { + this.appLogo = appLogo; + } + + public String getAppStatus() { + return appStatus; + } + + public void setAppStatus(String appStatus) { + this.appStatus = appStatus; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(String versionNumber) { + this.versionNumber = versionNumber; + } + + public String getAccessMode() { + return accessMode; + } + + public void setAccessMode(String accessMode) { + this.accessMode = accessMode; + } + + public String getAffiliationField() { + return affiliationField; + } + + public void setAffiliationField(String affiliationField) { + this.affiliationField = affiliationField; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getAppIntroduction() { + return appIntroduction; + } + + public void setAppIntroduction(String appIntroduction) { + this.appIntroduction = appIntroduction; + } + + public String getClientPath() { + return clientPath; + } + + public void setClientPath(String clientPath) { + this.clientPath = clientPath; + } + + public String getWebPath() { + return webPath; + } + + public void setWebPath(String webPath) { + this.webPath = webPath; + } + + public String getProgramPath() { + return programPath; + } + + public void setProgramPath(String programPath) { + this.programPath = programPath; + } + + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getInterfaceAddress() { + return interfaceAddress; + } + + public void setInterfaceAddress(String interfaceAddress) { + this.interfaceAddress = interfaceAddress; + } + + public String getInterfaceStatus() { + return interfaceStatus; + } + + public void setInterfaceStatus(String interfaceStatus) { + this.interfaceStatus = interfaceStatus; + } + + public String getDbStatus() { + return dbStatus; + } + + public void setDbStatus(String dbStatus) { + this.dbStatus = dbStatus; + } + + public Integer getAppId() { + return appId; + } + + public void setAppId(Integer appId) { + this.appId = appId; + } + + public String getSystemAddress() { + return systemAddress; + } + + public void setSystemAddress(String systemAddress) { + this.systemAddress = systemAddress; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationEntity.xml new file mode 100644 index 00000000..03f3acf0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationEntity.xml @@ -0,0 +1,425 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,app_logo + ,app_status + ,name + ,version_number + ,app_id + ,system_address + ,access_mode + ,affiliation_field + ,manufacturer + ,app_introduction + ,client_path + ,web_path + ,program_path + ,public_key + ,secret_key + ,interface_address + ,interface_status + ,db_status + ,sorts + ,org_id + ,sts + ,create_time + ,create_user_id + ,modify_time + ,modify_user_id + + + + + + + + + + + + + + + + + + insert into sys_application( + + id , + app_logo , + app_status , + name , + version_number , + app_id , + app_id , + system_address , + access_mode , + affiliation_field , + manufacturer , + app_introduction , + client_path , + web_path , + program_path , + public_key , + secret_key , + interface_address , + interface_status , + db_status , + sorts , + org_id , + sts , + create_time , + create_user_id , + modify_time , + modify_user_id , + sorts, + sts, + + )values( + + #{id} , + #{appLogo} , + #{appStatus} , + #{name} , + #{versionNumber} , + #{appId} , + (SELECT IFNULL(MAX(b.app_id)+1,800000) AS appId FROM sys_application b ), + #{systemAddress} , + #{accessMode} , + #{affiliationField} , + #{manufacturer} , + #{appIntroduction} , + #{clientPath} , + #{webPath} , + #{programPath} , + #{publicKey} , + #{secretKey} , + #{interfaceAddress} , + #{interfaceStatus} , + #{dbStatus} , + #{sorts} , + #{org_id} , + #{sts} , + #{create_time} , + #{create_user_id} , + #{modify_time} , + #{modify_user_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into sys_application(app_logo, app_status, name, version_number, app_id, system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + values + + (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + + + + + insert into sys_application(app_logo, app_status, name, version_number,app_id,system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + values + + (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + + on duplicate key update + app_logo = values(app_logo), + app_status = values(app_status), + name = values(name), + version_number = values(version_number), + app_id = values(app_id), + system_address = values(system_address), + access_mode = values(access_mode), + affiliation_field = values(affiliation_field), + manufacturer = values(manufacturer), + app_introduction = values(app_introduction), + client_path = values(client_path), + web_path = values(web_path), + program_path = values(program_path), + public_key = values(public_key), + secret_key = values(secret_key), + interface_address = values(interface_address), + interface_status = values(interface_status), + db_status = values(db_status), + sorts = values(sorts), + org_id = values(org_id), + sts = values(sts), + create_time = values(create_time), + create_user_id = values(create_user_id), + modify_time = values(modify_time), + modify_user_id = values(modify_user_id) + + +update sys_application set + + app_logo = #{appLogo}, + app_status = #{appStatus}, + name = #{name}, + version_number = #{versionNumber}, + app_id = #{appId}, + system_address = #{systemAddress}, + access_mode = #{accessMode}, + affiliation_field = #{affiliationField}, + manufacturer = #{manufacturer}, + app_introduction = #{appIntroduction}, + client_path = #{clientPath}, + web_path = #{webPath}, + program_path = #{programPath}, + public_key = #{publicKey}, + secret_key = #{secretKey}, + interface_address = #{interfaceAddress}, + interface_status = #{interfaceStatus}, + db_status = #{dbStatus}, + sorts = #{sorts}, + org_id = #{org_id}, + sts = #{sts}, + create_time = #{create_time}, + create_user_id = #{create_user_id}, + modify_time = #{modify_time}, + modify_user_id = #{modify_user_id}, + +where id = #{id} + + + +update sys_application set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_logo = #{appLogo} + and app_status = #{appStatus} + and name = #{name} + and version_number = #{versionNumber} + and app_id = #{appId} + and system_address = #{systemAddress} + and access_mode = #{accessMode} + and affiliation_field = #{affiliationField} + and manufacturer = #{manufacturer} + and app_introduction = #{appIntroduction} + and client_path = #{clientPath} + and web_path = #{webPath} + and program_path = #{programPath} + and public_key = #{publicKey} + and secret_key = #{secretKey} + and interface_address = #{interfaceAddress} + and interface_status = #{interfaceStatus} + and db_status = #{dbStatus} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application where id = #{id} + + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationVo.java b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationVo.java new file mode 100644 index 00000000..cf0957ed --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/entity/SysApplicationVo.java @@ -0,0 +1,152 @@ +package com.hzya.frame.sys.application.entity; + + +/** + * 应用表(SysApplication)实体类 + * + * @author makejava + * @since 2023-09-22 16:22:18 + */ +public class SysApplicationVo { + /** id */ + private String id; + /** 应用logo(地址或者id) */ + private String appLogo; + /** 应用名称 */ + private String name; + /** appid */ + private Integer appId; + /** ip白名单 */ + private String systemAddress; + /** 版本号 */ + private String versionNumber; + /** 接入方式(1、接口2、H53、PC网页4、PC应用程序 ) */ + private String accessMode; + /** 厂商 */ + private String manufacturer; + /** 所属领域(枚举表) */ + private String affiliationField; + /** 所属领域 */ + private String affiliationFieldName; + /** 应用简介 */ + private String appIntroduction; + /** 接口环境是否启用(1、开启 2、关闭) */ + private String interfaceStatus; + /** 数据源是否启用(1、开启 2、关闭) */ + private String dbStatus; + /** 应用是否启用(1、启用 2、停用) */ + private String appStatus; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAppLogo() { + return appLogo; + } + + public void setAppLogo(String appLogo) { + this.appLogo = appLogo; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(String versionNumber) { + this.versionNumber = versionNumber; + } + + public String getAccessMode() { + return accessMode; + } + + public void setAccessMode(String accessMode) { + this.accessMode = accessMode; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getAffiliationField() { + return affiliationField; + } + + public void setAffiliationField(String affiliationField) { + this.affiliationField = affiliationField; + } + + public String getAppIntroduction() { + return appIntroduction; + } + + public void setAppIntroduction(String appIntroduction) { + this.appIntroduction = appIntroduction; + } + + public String getInterfaceStatus() { + return interfaceStatus; + } + + public void setInterfaceStatus(String interfaceStatus) { + this.interfaceStatus = interfaceStatus; + } + + public String getDbStatus() { + return dbStatus; + } + + public void setDbStatus(String dbStatus) { + this.dbStatus = dbStatus; + } + + public String getAppStatus() { + return appStatus; + } + + public void setAppStatus(String appStatus) { + this.appStatus = appStatus; + } + + public String getAffiliationFieldName() { + return affiliationFieldName; + } + + public void setAffiliationFieldName(String affiliationFieldName) { + this.affiliationFieldName = affiliationFieldName; + } + + public Integer getAppId() { + return appId; + } + + public void setAppId(Integer appId) { + this.appId = appId; + } + + public String getSystemAddress() { + return systemAddress; + } + + public void setSystemAddress(String systemAddress) { + this.systemAddress = systemAddress; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/plugin/dao/ISysApplicationPluginDao.java b/service/src/main/java/com/hzya/frame/sys/application/plugin/dao/ISysApplicationPluginDao.java new file mode 100644 index 00000000..96427ff2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/plugin/dao/ISysApplicationPluginDao.java @@ -0,0 +1,19 @@ +package com.hzya.frame.sys.application.plugin.dao; + +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginDto; +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.List; + +/** + * 插件表(sys_application_plugin: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:29:52 + */ +public interface ISysApplicationPluginDao extends IBaseDao { + + List queryListlike(SysApplicationPluginDto entity); +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/plugin/dao/impl/SysApplicationPluginDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/application/plugin/dao/impl/SysApplicationPluginDaoImpl.java new file mode 100644 index 00000000..8c74196a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/plugin/dao/impl/SysApplicationPluginDaoImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.sys.application.plugin.dao.impl; + +import com.hzya.frame.sys.application.api.entity.SysApplicationApiVo; +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginDto; +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginEntity; +import com.hzya.frame.sys.application.plugin.dao.ISysApplicationPluginDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + +/** + * 插件表(SysApplicationPlugin)表数据库访问层 + * + * @author makejava + * @since 2023-09-22 16:29:56 + */ +@Repository(value = "SysApplicationPluginDaoImpl") +public class SysApplicationPluginDaoImpl extends MybatisGenericDao implements ISysApplicationPluginDao{ + + @Override + public List queryListlike(SysApplicationPluginDto entity) { + + List o = (List) super.selectList(getSqlIdPrifx() + "queryListlike", entity); + + return o; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginDto.java b/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginDto.java new file mode 100644 index 00000000..3040fa74 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginDto.java @@ -0,0 +1,63 @@ +package com.hzya.frame.sys.application.plugin.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.Date; + +/** + * 插件表(SysApplicationPlugin)实体类 + * + * @author makejava + * @since 2023-09-22 16:30:00 + */ +public class SysApplicationPluginDto { + + /** id */ + private String id; + private String appId; + /** 查询 插件名称 插件编号 插件版本 */ + private String name; + private Integer pageNum; + private Integer pageSize; + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginEntity.java b/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginEntity.java new file mode 100644 index 00000000..2ee0fe08 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginEntity.java @@ -0,0 +1,86 @@ +package com.hzya.frame.sys.application.plugin.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 插件表(SysApplicationPlugin)实体类 + * + * @author makejava + * @since 2023-09-22 16:30:00 + */ +public class SysApplicationPluginEntity extends BaseEntity { + + /** 应用id */ + private String appId; + /** 插件名称 */ + private String pluginName; + /** 插件编号 */ + private String pluginCode; + /** 插件版本 */ + private String pluginVersion; + /** 描述 */ + private String pluginRemark; + /** 发布日期 */ + private Date releaseDate; + /** 启用停用(1启用2停用) */ + private String pluginStatus; + + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getPluginName() { + return pluginName; + } + + public void setPluginName(String pluginName) { + this.pluginName = pluginName; + } + + public String getPluginCode() { + return pluginCode; + } + + public void setPluginCode(String pluginCode) { + this.pluginCode = pluginCode; + } + + public String getPluginVersion() { + return pluginVersion; + } + + public void setPluginVersion(String pluginVersion) { + this.pluginVersion = pluginVersion; + } + + public String getPluginRemark() { + return pluginRemark; + } + + public void setPluginRemark(String pluginRemark) { + this.pluginRemark = pluginRemark; + } + + public Date getReleaseDate() { + return releaseDate; + } + + public void setReleaseDate(Date releaseDate) { + this.releaseDate = releaseDate; + } + + public String getPluginStatus() { + return pluginStatus; + } + + public void setPluginStatus(String pluginStatus) { + this.pluginStatus = pluginStatus; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginEntity.xml b/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginEntity.xml new file mode 100644 index 00000000..9e10bc6d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/plugin/entity/SysApplicationPluginEntity.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + id + ,app_id + ,plugin_name + ,plugin_code + ,plugin_version + ,plugin_remark + ,release_date + ,plugin_status + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + + + + + + + + + + + + + + + + + + insert into sys_application_plugin( + + id , + app_id , + plugin_name , + plugin_code , + plugin_version , + plugin_remark , + release_date , + plugin_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + sorts, + sts, + + )values( + + #{id} , + #{appId} , + #{pluginName} , + #{pluginCode} , + #{pluginVersion} , + #{pluginRemark} , + #{releaseDate} , + #{pluginStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_plugin a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into sys_application_plugin(app_id, plugin_name, plugin_code, plugin_version, plugin_remark, release_date, plugin_status, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) + values + + (#{entity.appId},#{entity.pluginName},#{entity.pluginCode},#{entity.pluginVersion},#{entity.pluginRemark},#{entity.releaseDate},#{entity.pluginStatus},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, 'Y') + + + + + insert into sys_application_plugin(app_id, plugin_name, plugin_code, plugin_version, plugin_remark, release_date, plugin_status, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) + values + + (#{entity.appId},#{entity.pluginName},#{entity.pluginCode},#{entity.pluginVersion},#{entity.pluginRemark},#{entity.releaseDate},#{entity.pluginStatus},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) + + on duplicate key update + app_id = values(app_id), + plugin_name = values(plugin_name), + plugin_code = values(plugin_code), + plugin_version = values(plugin_version), + plugin_remark = values(plugin_remark), + release_date = values(release_date), + plugin_status = values(plugin_status), + sorts = values(sorts), + 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) + + +update sys_application_plugin set + + app_id = #{appId}, + plugin_name = #{pluginName}, + plugin_code = #{pluginCode}, + plugin_version = #{pluginVersion}, + plugin_remark = #{pluginRemark}, + release_date = #{releaseDate}, + plugin_status = #{pluginStatus}, + sorts = #{sorts}, + 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}, + +where id = #{id} + + + +update sys_application_plugin set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_plugin set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and plugin_name = #{pluginName} + and plugin_code = #{pluginCode} + and plugin_version = #{pluginVersion} + and plugin_remark = #{pluginRemark} + and release_date = #{releaseDate} + and plugin_status = #{pluginStatus} + and sorts = #{sorts} + and sts = #{sts} + and sts='Y' + + + + + delete from sys_application_plugin where id = #{id} + + + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/application/plugin/service/ISysApplicationPluginService.java b/service/src/main/java/com/hzya/frame/sys/application/plugin/service/ISysApplicationPluginService.java new file mode 100644 index 00000000..5a28b9c2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/plugin/service/ISysApplicationPluginService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sys.application.plugin.service; + +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 插件表(SysApplicationPlugin)表服务接口 + * + * @author makejava + * @since 2023-09-22 16:30:03 + */ +public interface ISysApplicationPluginService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/plugin/service/impl/SysApplicationPluginServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/plugin/service/impl/SysApplicationPluginServiceImpl.java new file mode 100644 index 00000000..4d5788fc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/plugin/service/impl/SysApplicationPluginServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.application.plugin.service.impl; + +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginEntity; +import com.hzya.frame.sys.application.plugin.dao.ISysApplicationPluginDao; +import com.hzya.frame.sys.application.plugin.service.ISysApplicationPluginService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 插件表(SysApplicationPlugin)表服务实现类 + * + * @author makejava + * @since 2023-09-22 16:30:05 + */ +@Service(value = "sysApplicationPluginService") +public class SysApplicationPluginServiceImpl extends BaseService implements ISysApplicationPluginService { + + private ISysApplicationPluginDao sysApplicationPluginDao; + + @Autowired + public void setSysApplicationPluginDao(ISysApplicationPluginDao dao) { + this.sysApplicationPluginDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/service/ISysApplicationService.java b/service/src/main/java/com/hzya/frame/sys/application/service/ISysApplicationService.java new file mode 100644 index 00000000..565f9038 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/service/ISysApplicationService.java @@ -0,0 +1,308 @@ +package com.hzya.frame.sys.application.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.application.entity.SysApplicationEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +/** + * 应用表(SysApplication)表服务接口 + * + * @author makejava + * @since 2023-09-22 16:22:21 + */ +public interface ISysApplicationService extends IBaseService{ + + /** + * @Author lvleigang + * @Description 应用列表查询接口 多字段模糊查询,枚举类型字段转换 + * @Date 2:06 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity queryApp(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 创建应用保存接口 应用名称唯一校验,生成公钥密钥 + * @Date 2:07 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity saveApp(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用复制查询 + * @Date 2:07 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity getCopyApp(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用复制接口保存接口 应用名称校验唯一,其余表,同步保存新增,api接口要关联对应的认证接口id + * @Date 2:07 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity copyApp(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 应用根据ID查询接口 只需要应用表数据的地方都调用这一个接口 + * @Date 2:07 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity getApp(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用启用停用接口 + * @Date 2:07 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity enableOrDisableApp(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用修改接口 应用、应用接口环境参数、数据源一个接口修改。注接口参数和数据源可能修改、新增或者删除情况,要逻辑判断 + * @Date 2:07 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity updateApp(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 数据源测试接口 测试当前页面数据源是否配置正确 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity testDatabase(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用目录查询接口 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity queryAppApiType(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用目录保存接口 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity saveAppApiType(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用目录修改接口 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity updateAppApiType(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 应用目录删除接口 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity deleteAppApiType(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 根据应用、目录、查询条件查询api接口 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity queryAppApi(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 查询api接口 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity getAppApi(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 查询调试参数接口 根据调试内容,查询认证以及自己环境参数以及api设置参数 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity debugAppApi(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 查询接口日志 查询接口发送错误,以及不发送的数据 + * @Date 2:08 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity queryAppApiLog(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description + * 共享保存接口 根据选择的应用和目录, + * 查询对应应用是否有该接口,有返回提示,没有保存, + * 同步判断是否有认证接口,以及认证接口是否存在,如果存在不保存 + * @Date 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity saveApiShare(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description api删除接口 接口删除校验是否有api配置时候有使用,以及esb中心是否有配置该接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity deleteApi(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description api新增接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity saveApi(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description api修改接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity updateApi(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 三方调用系统查询接口 根据应用查询三方调用系统 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity queryAppApiAuth(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 三方调用系统保存接口 保存三方系统,全量修改保存,同步删除api关联三方系统配置表已经删除的三方调用系统接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity saveAppApiAuth(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description api关联三方系统保存接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity saveAppApiAuthDetail(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 查询api所有数据 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity queryAppAll(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 插件查询接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity queryAppPlugin(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 插件修改接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity saveAppPlugin(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 插件修改接口 + * @Date 2:09 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity updateAppPlugin(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 插件删除接口 + * @Date 2:10 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity deleteAppPlugin(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 获取插件接口 + * @Date 2:10 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity getAppPlugin(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 插件启用停用接口 + * @Date 2:10 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity enableOrDisableAppPlugin(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 应用接口启用停用接口 + * @Date 2:10 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity enableOrDisableAppApi(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 应用数据源启用停用接口 + * @Date 2:10 下午 2023/9/23 + * @param jsonObject + * @return + **/ + JsonResultEntity enableOrDisableAppDatasource(JSONObject jsonObject); + + JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse); +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/service/impl/ApplicationCache.java b/service/src/main/java/com/hzya/frame/sys/application/service/impl/ApplicationCache.java new file mode 100644 index 00000000..66b4abc9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/service/impl/ApplicationCache.java @@ -0,0 +1,130 @@ +package com.hzya.frame.sys.application.service.impl; + +import com.hzya.frame.sys.application.api.dao.ISysApplicationApiDao; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sys.application.apiAuth.dao.ISysApplicationApiAuthDao; +import com.hzya.frame.sys.application.apiAuth.entity.SysApplicationApiAuthEntity; +import com.hzya.frame.sys.application.apiAythDetail.dao.ISysApplicationApiAuthDetailDao; +import com.hzya.frame.sys.application.apiAythDetail.entity.SysApplicationApiAuthDetailEntity; +import com.hzya.frame.sys.application.dao.ISysApplicationDao; +import com.hzya.frame.sys.application.entity.SysApplicationEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @Content 应用缓存 + * @Author 👻👻👻👻👻👻👻👻👻👻 llg + * @Version 1.0 + */ +@Service +public class ApplicationCache { + Logger logger = LoggerFactory.getLogger(ApplicationCache.class); + private final ConcurrentHashMap applicationMap = new ConcurrentHashMap<>(); + private final ConcurrentHashMap applicationApiMap = new ConcurrentHashMap<>(); + private final ConcurrentHashMap applicationApiAuthMap = new ConcurrentHashMap<>(); + private final ConcurrentHashMap applicationApiAuthDetailMap = new ConcurrentHashMap<>(); + + @Resource + private ISysApplicationApiAuthDetailDao sysApplicationApiAuthDetailDao; + @Resource + private ISysApplicationApiAuthDao sysApplicationApiAuthDao; + @Resource + private ISysApplicationApiDao sysApplicationApiDao; + @Resource + private ISysApplicationDao sysApplicationDao; + public void saveData(String type,String key, Object value) { + switch (type) { + case "1": // + applicationMap.put(key, value); + break; + case "2": // + applicationApiMap.put(key, value); + break; + case "3": // + applicationApiAuthMap.put(key, value); + break; + case "4": // + applicationApiAuthDetailMap.put(key, value); + break; + default: + } + } + + public Object get(String type,String key) { + Object o = null; + switch (type) { + case "1": // + o = applicationMap.get(key); + break; + case "2": // + o = applicationApiMap.get(key); + break; + case "3": // + o = applicationApiAuthMap.get(key); + break; + case "4": // + o = applicationApiAuthDetailMap.get(key); + break; + default: + } + return o; + } + public void reloadData(String type) { + switch (type) { + case "1": // + applicationMap.clear(); + SysApplicationEntity sendApp = new SysApplicationEntity(); + sendApp.setSts("Y"); + List sysApplicationEntities = sysApplicationDao.queryBase(sendApp); + if(sysApplicationEntities != null && sysApplicationEntities.size() > 0){ + for (int i = 0; i < sysApplicationEntities.size(); i++) { + applicationMap.put("publicKey"+sysApplicationEntities.get(i).getPublicKey()+"secretKey"+sysApplicationEntities.get(i).getSecretKey(), sysApplicationEntities.get(i)); + applicationMap.put("appId"+sysApplicationEntities.get(i).getAppId(), sysApplicationEntities.get(i)); + } + } + break; + case "2": // + applicationApiMap.clear(); + SysApplicationApiEntity receiveApi = new SysApplicationApiEntity(); + receiveApi.setSts("Y"); + List receiveApiList = sysApplicationApiDao.queryBase(receiveApi); + if(receiveApiList != null && receiveApiList.size() > 0){ + for (int i = 0; i < receiveApiList.size(); i++) { + applicationApiMap.put("appId"+receiveApiList.get(i).getAppId()+"apiCode"+receiveApiList.get(i).getApiCode(), receiveApiList.get(i)); + } + } + break; + case "3": // + applicationApiAuthMap.clear(); + SysApplicationApiAuthEntity sysApplicationApiAuthEntity = new SysApplicationApiAuthEntity(); + sysApplicationApiAuthEntity.setSts("Y"); + sysApplicationApiAuthEntity.setSystemStatus("1"); + List sysApplicationApiAuthEntities = sysApplicationApiAuthDao.queryByLike(sysApplicationApiAuthEntity); + if(sysApplicationApiAuthEntities != null && sysApplicationApiAuthEntities.size() > 0){ + for (int i = 0; i < sysApplicationApiAuthEntities.size(); i++) { + applicationApiAuthMap.put("name"+sysApplicationApiAuthEntities.get(i).getName()+"appId"+sysApplicationApiAuthEntities.get(i).getAppId(), sysApplicationApiAuthEntities.get(i)); + } + } + break; + case "4": // + applicationApiAuthDetailMap.clear(); + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = new SysApplicationApiAuthDetailEntity(); + sysApplicationApiAuthDetailEntity.setSts("Y"); + sysApplicationApiAuthDetailEntity.setStatusType("2"); + List sysApplicationApiAuthDetailEntities = sysApplicationApiAuthDetailDao.queryBase(sysApplicationApiAuthDetailEntity); + if(sysApplicationApiAuthDetailEntities != null && sysApplicationApiAuthDetailEntities.size() > 0){ + for (int i = 0; i < sysApplicationApiAuthDetailEntities.size(); i++) { + applicationApiAuthDetailMap.put("appId"+sysApplicationApiAuthDetailEntities.get(i).getAppId()+"apiId"+sysApplicationApiAuthDetailEntities.get(i).getApiId()+"tripartiteSystemId"+sysApplicationApiAuthDetailEntities.get(i).getTripartiteSystemId(), sysApplicationApiAuthDetailEntities.get(i)); + } + } + break; + default: + } + } + +} diff --git a/service/src/main/java/com/hzya/frame/sys/application/service/impl/SysApplicationServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/application/service/impl/SysApplicationServiceImpl.java new file mode 100644 index 00000000..0f85c8d4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/application/service/impl/SysApplicationServiceImpl.java @@ -0,0 +1,1998 @@ +package com.hzya.frame.sys.application.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.extra.servlet.ServletUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.serviceUtil.DsDataSourceUtil; +import com.hzya.frame.sys.application.api.dao.ISysApplicationApiDao; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiDto; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sys.application.api.entity.SysApplicationApiVo; +import com.hzya.frame.sys.application.apiAuth.dao.ISysApplicationApiAuthDao; +import com.hzya.frame.sys.application.apiAuth.entity.SysApplicationApiAuthDto; +import com.hzya.frame.sys.application.apiAuth.entity.SysApplicationApiAuthEntity; +import com.hzya.frame.sys.application.apiAythDetail.dao.ISysApplicationApiAuthDetailDao; +import com.hzya.frame.sys.application.apiAythDetail.entity.SysApplicationApiAuthDetailEntity; +import com.hzya.frame.sys.application.apiPara.dao.ISysApplicationApiParaDao; +import com.hzya.frame.sys.application.apiPara.entity.SysApplicationApiParaEntity; +import com.hzya.frame.sys.application.apiType.dao.ISysApplicationApiTypeDao; +import com.hzya.frame.sys.application.apiType.entity.SysApplicationApiTypeEntity; +import com.hzya.frame.sys.application.database.dao.ISysApplicationDatabaseDao; +import com.hzya.frame.sys.application.database.entity.SysApplicationDatabaseEntity; +import com.hzya.frame.sys.application.entity.SysApplicationDatasourceDto; +import com.hzya.frame.sys.application.entity.SysApplicationDto; +import com.hzya.frame.sys.application.entity.SysApplicationEntity; +import com.hzya.frame.sys.application.dao.ISysApplicationDao; +import com.hzya.frame.sys.application.entity.SysApplicationVo; +import com.hzya.frame.sys.application.plugin.dao.ISysApplicationPluginDao; +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginDto; +import com.hzya.frame.sys.application.plugin.entity.SysApplicationPluginEntity; +import com.hzya.frame.sys.application.service.ISysApplicationService; +import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; +import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; +import com.hzya.frame.sys.messageManage.dao.ISysMessageManageDao; +import com.hzya.frame.sys.messageManage.entity.SysMessageManageEntity; +import com.hzya.frame.sys.messageManage.entity.SysMessageManagePageVo; +import com.hzya.frame.sys.messageManageDetail.dao.ISysMessageManageDetailDao; +import com.hzya.frame.sys.messageManageDetail.entity.SysMessageManageDetailEntity; +import com.hzya.frame.sys.messageManageLog.dao.ISysMessageManageLogDao; +import com.hzya.frame.sys.messageManageLog.entity.SysMessageManageLogEntity; +import com.hzya.frame.sys.messageManageLog.entity.SysMessageManageLogPageVo; +import com.hzya.frame.sys.messageManageLogDetail.service.ISysMessageManageLogDetailService; +import com.hzya.frame.util.AESUtil; +import com.hzya.frame.util.IPHelper; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +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.core.task.TaskExecutor; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +import com.hzya.frame.basedao.service.impl.BaseService; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 应用表(SysApplication)表服务实现类 + * + * @author makejava + * @since 2023-09-22 16:22:24 + */ +@Service(value = "sysApplicationService") +public class SysApplicationServiceImpl extends BaseService implements ISysApplicationService { + + private ISysApplicationDao sysApplicationDao; + @Resource + private ISysApplicationApiDao sysApplicationApiDao; + @Resource + private ISysMessageManageLogDao sysMessageManageLogDao; + @Resource + private DsDataSourceUtil dsDataSourceUtil; + @Resource + private ISysApplicationApiAuthDao sysApplicationApiAuthDao; + @Resource + private ISysApplicationApiAuthDetailDao sysApplicationApiAuthDetailDao; + @Resource + private ISysApplicationApiParaDao sysApplicationApiParaDao; + @Resource + private ISysApplicationApiTypeDao sysApplicationApiTypeDao; + @Resource + private ISysApplicationDatabaseDao sysApplicationDatabaseDao; + @Resource + private ISysApplicationPluginDao sysApplicationPluginDao; + @Resource + private ISysMessageManageDao sysMessageManageDao; + @Resource + private ISysMessageManageDetailDao sysMessageManageDetailDao; //明细表 + + @Resource + private ISysMessageManageLogDetailService sysMessageManageLogDetailService; + + @Resource + private TaskExecutor taskExecutor; + // + @Resource + private ApplicationCache applicationCache; + + //多线程请求加锁 HttpRequest 构造方法是静态的 + private final Object lock = new Object(); + + @Autowired + public void setSysApplicationDao(ISysApplicationDao dao) { + this.sysApplicationDao = dao; + this.dao = dao; + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用列表查询接口 多字段模糊查询,枚举类型字段转换 + * @Date 2:06 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryApp(JSONObject object) { + SysApplicationDto entity = getData("jsonStr", object, SysApplicationDto.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List sysApplicationVos = sysApplicationDao.queryApp(entity); + PageInfo pageInfo = new PageInfo(sysApplicationVos); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 创建应用保存接口 应用名称唯一校验,生成公钥密钥 + * @Date 2:07 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveApp(JSONObject object) { + SysApplicationEntity entity = getData("jsonStr", object, SysApplicationEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getName() == null || "".equals(entity.getName())) { + return BaseResult.getFailureMessageEntity("请先输入应用名称"); + } + SysApplicationEntity checkEntity = new SysApplicationEntity(); + checkEntity.setSts("Y"); + checkEntity.setName(entity.getName()); + int checkCount = sysApplicationDao.getCount(checkEntity); + if (checkCount > 0) { + return BaseResult.getFailureMessageEntity("应用名称已存在"); + } + setCreate(entity); + //设置key 密钥 + entity.setPublicKey("ZJYA" + AESUtil.encipher(entity.getId())); + entity.setSecretKey(AESUtil.encipher(entity.getPublicKey())); + entity.setInterfaceStatus("2"); + entity.setDbStatus("2"); + sysApplicationDao.save(entity); + applicationCache.reloadData("1"); + return BaseResult.getSuccessMessageEntity("保存应用成功", entity.getId()); + } + + private void setCreate(SysApplicationEntity entity) { + entity.setId(UUIDUtils.getUUID()); + entity.setSts("Y"); + entity.setCreate_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setCreate_time(new Date()); + entity.setModify_time(new Date()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用复制接口保存接口 应用名称校验唯一,其余表,同步保存新增,api接口要关联对应的认证接口id + * @Date 2:07 下午 2023/9/23 + **/ + @Override + public JsonResultEntity copyApp(JSONObject object) { + SysApplicationEntity entity = getData("jsonStr", object, SysApplicationEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getName() == null || "".equals(entity.getName())) { + return BaseResult.getFailureMessageEntity("请先输入应用名称"); + } + + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String olderAppId = entity.getId(); + SysApplicationEntity checkEntity = new SysApplicationEntity(); + checkEntity.setSts("Y"); + checkEntity.setName(entity.getName()); + int checkCount = sysApplicationDao.getCount(checkEntity); + if (checkCount > 0) { + return BaseResult.getFailureMessageEntity("应用名称已存在"); + } + setCreate(entity); + //设置key 密钥 + entity.setPublicKey("ZJYA" + AESUtil.encipher(entity.getId())); + entity.setSecretKey(AESUtil.encipher(entity.getPublicKey())); + entity.setAppId(null); + sysApplicationDao.save(entity); + applicationCache.reloadData("1"); + //接口环境参数表 sys_application_api_para + saveApiPara(entity, olderAppId); + + //数据源表 sys_application_database + saveDatabase(entity, olderAppId); + + //插件表 sys_application_plugin + savePlugin(entity, olderAppId); + + //目录表 sys_application_api_type + Map apiType = saveCopyApiType(entity, olderAppId); + + //三方调用系统表 sys_application_api_auth + Map apiAuth = saveCopyApiAuth(entity, olderAppId); + //应用api表 sys_application_api + Map api = saveCopyApi(entity, olderAppId, apiType, apiAuth); + + //应用api关联三方调用系统表 sys_application_api_auth_detail + Map apiAuthDetail = saveCopyApiAuthDetail(entity, olderAppId, apiType, apiAuth, api); + + return BaseResult.getSuccessMessageEntity("复制应用成功", entity.getId()); + } + + //应用api关联三方调用系统表 sys_application_api_auth_detail + private Map saveCopyApiAuthDetail(SysApplicationEntity entity, String olderAppId, Map apiType, Map apiAuth, Map api) { + Map ids = new HashMap<>(); + if (api == null || api.size() == 0) { + return ids; + } + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = new SysApplicationApiAuthDetailEntity(); + sysApplicationApiAuthDetailEntity.setAppId(olderAppId); + sysApplicationApiAuthDetailEntity.setSts("Y"); + List list = sysApplicationApiAuthDetailDao.queryBase(sysApplicationApiAuthDetailEntity); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + String newId = UUIDUtils.getUUID(); + ids.put(list.get(i).getId(), newId); + list.get(i).setId(newId); + list.get(i).setSts("Y"); + list.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setCreate_time(new Date()); + list.get(i).setModify_time(new Date()); + list.get(i).setAppId(entity.getId());//转换应用id + list.get(i).setCatalogueId(apiType.get(list.get(i).getCatalogueId()));//转换目录 + list.get(i).setApiId(api.get(list.get(i).getApiId()));//转换接口id + list.get(i).setTripartiteSystemId(apiAuth.get(list.get(i).getTripartiteSystemId()));//转换三方调用系统表id + sysApplicationApiAuthDetailDao.save(list.get(i)); + } + applicationCache.reloadData("4"); + } + return ids; + } + + //api相关 + private Map saveCopyApi(SysApplicationEntity entity, String olderAppId, Map apiType, Map apiAuth) { + + Map apiIds = new HashMap<>(); + if (apiType == null || apiType.size() == 0) { + return apiIds; + } + SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity(); + sysApplicationApiEntity.setAppId(olderAppId); + sysApplicationApiEntity.setSts("Y"); + List apilist = sysApplicationApiDao.queryBase(sysApplicationApiEntity); + if (apilist != null && apilist.size() > 0) { + for (int i = 0; i < apilist.size(); i++) { + String newId = UUIDUtils.getUUID(); + apiIds.put(apilist.get(i).getId(), newId); + apilist.get(i).setId(newId); + apilist.get(i).setSts("Y"); + apilist.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + apilist.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + apilist.get(i).setCreate_time(new Date()); + apilist.get(i).setModify_time(new Date()); + + apilist.get(i).setAppId(entity.getId()); + apilist.get(i).setApiCode(null); + apilist.get(i).setCatalogueId(apiType.get(apilist.get(i).getCatalogueId()));//转换目录 + sysApplicationApiDao.save(apilist.get(i)); + } + applicationCache.reloadData("2"); + } + return apiIds; + } + + //三方调用系统表 sys_application_api_auth + private Map saveCopyApiAuth(SysApplicationEntity entity, String olderAppId) { + Map ids = new HashMap<>(); + SysApplicationApiAuthEntity sysApplicationApiAuthEntity = new SysApplicationApiAuthEntity(); + sysApplicationApiAuthEntity.setAppId(olderAppId); + sysApplicationApiAuthEntity.setSts("Y"); + List list = sysApplicationApiAuthDao.queryBase(sysApplicationApiAuthEntity); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + String newId = UUIDUtils.getUUID(); + ids.put(list.get(i).getId(), newId); + list.get(i).setId(newId); + list.get(i).setSts("Y"); + list.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setCreate_time(new Date()); + list.get(i).setModify_time(new Date()); + list.get(i).setAppId(entity.getId()); + sysApplicationApiAuthDao.save(list.get(i)); + } + applicationCache.reloadData("3"); + } + return ids; + } + + //目录表 sys_application_api_type + private Map saveCopyApiType(SysApplicationEntity entity, String olderAppId) { + Map ids = new HashMap<>(); + SysApplicationApiTypeEntity sysApplicationApiTypeEntity = new SysApplicationApiTypeEntity(); + sysApplicationApiTypeEntity.setAppId(olderAppId); + sysApplicationApiTypeEntity.setSts("Y"); + List list = sysApplicationApiTypeDao.queryBase(sysApplicationApiTypeEntity); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + String newId = UUIDUtils.getUUID(); + ids.put(list.get(i).getId(), newId); + list.get(i).setId(newId); + list.get(i).setSts("Y"); + list.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setCreate_time(new Date()); + list.get(i).setModify_time(new Date()); + list.get(i).setAppId(entity.getId()); + sysApplicationApiTypeDao.save(list.get(i)); + } + } + return ids; + } + + + //插件表 sys_application_plugin + private void savePlugin(SysApplicationEntity entity, String olderAppId) { + SysApplicationPluginEntity sysApplicationPluginEntity = new SysApplicationPluginEntity(); + sysApplicationPluginEntity.setAppId(olderAppId); + sysApplicationPluginEntity.setSts("Y"); + List list = sysApplicationPluginDao.queryBase(sysApplicationPluginEntity); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + list.get(i).setId(UUIDUtils.getUUID()); + list.get(i).setSts("Y"); + list.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setCreate_time(new Date()); + list.get(i).setModify_time(new Date()); + list.get(i).setAppId(entity.getId()); + sysApplicationPluginDao.save(list.get(i)); + } + } + } + + //数据源表 sys_application_database + private void saveDatabase(SysApplicationEntity entity, String olderAppId) { + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setAppId(olderAppId); + sysApplicationDatabaseEntity.setSts("Y"); + List list = sysApplicationDatabaseDao.queryBase(sysApplicationDatabaseEntity); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + list.get(i).setId(UUIDUtils.getUUID()); + list.get(i).setSts("Y"); + list.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setCreate_time(new Date()); + list.get(i).setModify_time(new Date()); + list.get(i).setAppId(entity.getId()); + sysApplicationDatabaseDao.save(list.get(i)); + } + } + } + + //接口环境参数表 sys_application_api_para + private void saveApiPara(SysApplicationEntity entity, String olderAppId) { + SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity(); + sysApplicationApiParaEntity.setAppId(olderAppId); + sysApplicationApiParaEntity.setSts("Y"); + List list = sysApplicationApiParaDao.queryBase(sysApplicationApiParaEntity); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + list.get(i).setId(UUIDUtils.getUUID()); + list.get(i).setSts("Y"); + list.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + list.get(i).setCreate_time(new Date()); + list.get(i).setModify_time(new Date()); + list.get(i).setAppId(entity.getId()); + sysApplicationApiParaDao.save(list.get(i)); + } + } + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用复制接口查询接口 + * @Date 2:07 下午 2023/9/23 + **/ + @Override + public JsonResultEntity getCopyApp(JSONObject object) { + SysApplicationEntity entity = getData("jsonStr", object, SysApplicationEntity.class); + //判断主键 + if (entity == null || entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("请先传递请求主键"); + } + entity = sysApplicationDao.queryOne(entity); + entity.setName(null); + entity.setPublicKey(null); + entity.setSecretKey(null); + entity.setAppId(null); + return BaseResult.getSuccessMessageEntity("查询数据成功", entity); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用根据ID查询接口 只需要应用表数据的地方都调用这一个接口 + * @Date 2:07 下午 2023/9/23 + **/ + @Override + public JsonResultEntity getApp(JSONObject object) { + SysApplicationEntity entity = getData("jsonStr", object, SysApplicationEntity.class); + //判断主键 + if (entity == null || entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("请先传递请求主键"); + } + entity = sysApplicationDao.queryOne(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", entity); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用启用停用接口 + * @Date 2:07 下午 2023/9/23 + **/ + @Override + public JsonResultEntity enableOrDisableApp(JSONObject object) { + SysApplicationEntity entity = getData("jsonStr", object, SysApplicationEntity.class); + //判断编码是否重复 + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getAppStatus() == null || "".equals(entity.getAppStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + SysApplicationEntity saveEntity = new SysApplicationEntity(); + saveEntity.setSts("Y"); + saveEntity.setId(entity.getId()); + saveEntity.setAppStatus(entity.getAppStatus()); + saveEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + saveEntity.setModify_time(new Date()); + sysApplicationDao.update(saveEntity); + applicationCache.reloadData("1"); + if ("1".equals(entity.getAppStatus())) { + return BaseResult.getSuccessMessageEntity("启用成功"); + } else { + return BaseResult.getSuccessMessageEntity("停用成功"); + } + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用修改接口 应用、应用接口环境参数、数据源一个接口修改。注接口参数和数据源可能修改、新增或者删除情况,要逻辑判断 + * @Date 2:07 下午 2023/9/23 + **/ + @Override + public JsonResultEntity updateApp(JSONObject object) { + SysApplicationDto entity = getData("jsonStr", object, SysApplicationDto.class); + //判断编码是否重复 + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getUpdateType() == null || "".equals(entity.getUpdateType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //修改应用基本信息 + SysApplicationEntity sysApplicationEntity = doUpdateApp(entity); + if ("2".equals(entity.getUpdateType())) {//开发管理界面,需要保存 接口参数,和数据源 + doUpdateApiPara(entity);//api接口参数 + doUpdateDatabase(entity);//数据源 + } + return BaseResult.getSuccessMessageEntity("修改应用成功"); + } + + //修改数据源 + private void doUpdateDatabase(SysApplicationDto entity) { + //先删除明细再修改 + SysApplicationDatabaseEntity detailEntity = new SysApplicationDatabaseEntity(); + detailEntity.setSts("Y"); + detailEntity.setAppId(entity.getId()); + detailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + detailEntity.setModify_time(new Date()); + sysApplicationDatabaseDao.logicRemoveMultiCondition(detailEntity); + SysApplicationDatabaseEntity databaseEntity = entity.getDatabaseEntity(); + if (databaseEntity != null) { + databaseEntity.setAppId(entity.getId()); + databaseEntity.setSts("Y"); + databaseEntity.setDbStatus(entity.getDbStatus()); + databaseEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + databaseEntity.setModify_time(new Date()); + if (databaseEntity.getId() != null && !"".equals(databaseEntity.getId())) { + //修改 + sysApplicationDatabaseDao.update(databaseEntity); + } else { + //新增 + databaseEntity.setId(UUIDUtils.getUUID()); + databaseEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + databaseEntity.setCreate_time(new Date()); + sysApplicationDatabaseDao.save(databaseEntity); + } + } + } + + //修改api接口参数信息 + private void doUpdateApiPara(SysApplicationDto entity) { + //先删除明细再修改 + SysApplicationApiParaEntity detailEntity = new SysApplicationApiParaEntity(); + detailEntity.setSts("Y"); + detailEntity.setAppId(entity.getId()); + detailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + detailEntity.setModify_time(new Date()); + sysApplicationApiParaDao.logicRemoveMultiCondition(detailEntity); + + List apiParas = entity.getApiParas(); + if (apiParas != null && apiParas.size() > 0) { + for (int i = 0; i < apiParas.size(); i++) { + apiParas.get(i).setAppId(entity.getId()); + apiParas.get(i).setSts("Y"); + apiParas.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + apiParas.get(i).setModify_time(new Date()); + if (apiParas.get(i).getId() != null && !"".equals(apiParas.get(i).getId())) { + //修改 + sysApplicationApiParaDao.update(apiParas.get(i)); + } else { + //新增 + apiParas.get(i).setId(UUIDUtils.getUUID()); + apiParas.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + apiParas.get(i).setCreate_time(new Date()); + sysApplicationApiParaDao.save(apiParas.get(i)); + } + } + } + } + + //修改app信息 + private SysApplicationEntity doUpdateApp(SysApplicationDto entity) { + SysApplicationEntity sysApplicationEntity = new SysApplicationEntity(); + sysApplicationEntity.setId(entity.getId()); + /** 应用logo(地址或者id) */ + sysApplicationEntity.setAppLogo(entity.getAppLogo()); + /** 应用是否启用(1、启用 2、停用) */ + sysApplicationEntity.setAppStatus(entity.getAppStatus()); + /** 应用名称 */ + sysApplicationEntity.setName(entity.getName()); + /** 版本号 */ + sysApplicationEntity.setVersionNumber(entity.getVersionNumber()); + /** 接入方式(1、接口2、H53、PC网页4、PC应用程序 ) */ + sysApplicationEntity.setAccessMode(entity.getAccessMode()); + /** 所属领域(枚举表) */ + sysApplicationEntity.setAffiliationField(entity.getAffiliationField()); + /** 厂商 */ + sysApplicationEntity.setManufacturer(entity.getManufacturer()); + /** 应用简介 */ + sysApplicationEntity.setAppIntroduction(entity.getAppIntroduction()); + /** 应用客户端地址(PC) */ + sysApplicationEntity.setClientPath(entity.getClientPath()); + /** 应用网页端地址(PC) */ + sysApplicationEntity.setWebPath(entity.getWebPath()); + /** 应用程序地址(移动端) */ + sysApplicationEntity.setProgramPath(entity.getProgramPath()); + /** 应用key */ + sysApplicationEntity.setPublicKey(entity.getPublicKey()); + /** 应用密钥 */ + sysApplicationEntity.setSecretKey(entity.getSecretKey()); + sysApplicationEntity.setAppId(entity.getAppId()); + sysApplicationEntity.setSystemAddress(entity.getSystemAddress()); + /** 接口地址 */ + sysApplicationEntity.setInterfaceAddress(entity.getInterfaceAddress()); + /** 接口环境是否启用(1、开启 2、关闭) */ + sysApplicationEntity.setInterfaceStatus(entity.getInterfaceStatus()); + /** 数据源是否启用(1、开启 2、关闭) */ + sysApplicationEntity.setDbStatus(entity.getDbStatus()); + sysApplicationEntity.setSts("Y"); + sysApplicationEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationEntity.setModify_time(new Date()); + sysApplicationDao.update(sysApplicationEntity); + applicationCache.reloadData("1"); + return sysApplicationEntity; + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 数据源测试接口 测试当前页面数据源是否配置正确 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity testDatabase(JSONObject object) { + SysApplicationDatasourceDto entity = getData("jsonStr", object, SysApplicationDatasourceDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (dsDataSourceUtil.testConnection(entity)) { + return BaseResult.getSuccessMessageEntity("测试连接数据源成功"); + } else { + return BaseResult.getFailureMessageEntity("测试连接数据源失败,请检查数据源配置是否正确"); + } + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用目录查询接口 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppApiType(JSONObject object) { + SysApplicationApiTypeEntity entity = getData("jsonStr", object, SysApplicationApiTypeEntity.class); + List apiTypeEntities = sysApplicationApiTypeDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询目录成功", apiTypeEntities); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用目录保存接口 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveAppApiType(JSONObject object) { + SysApplicationApiTypeEntity entity = getData("jsonStr", object, SysApplicationApiTypeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getName() == null || "".equals(entity.getName())) { + return BaseResult.getFailureMessageEntity("请先输入目录名称"); + } + if (entity.getAppId() == null || "".equals(entity.getAppId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setId(UUIDUtils.getUUID()); + entity.setSts("Y"); + entity.setCreate_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setCreate_time(new Date()); + entity.setModify_time(new Date()); + sysApplicationApiTypeDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存目录成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用目录修改接口 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity updateAppApiType(JSONObject object) { + SysApplicationApiTypeEntity entity = getData("jsonStr", object, SysApplicationApiTypeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getName() == null || "".equals(entity.getName())) { + return BaseResult.getFailureMessageEntity("请先输入业务类型"); + } + if (entity.getAppId() == null || "".equals(entity.getAppId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + SysApplicationApiTypeEntity checkEntity = new SysApplicationApiTypeEntity(); + checkEntity.setSts("Y"); + checkEntity.setId(entity.getId()); + checkEntity.setName(entity.getName()); + checkEntity.setAppId(entity.getAppId()); + int checkCount = sysApplicationApiTypeDao.entity_count_not_id(checkEntity); + if (checkCount > 0) { + return BaseResult.getFailureMessageEntity("业务类型已存在"); + } + entity.setSts("Y"); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_time(new Date()); + sysApplicationApiTypeDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改业务类型成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用目录删除接口 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity deleteAppApiType(JSONObject object) { + + SysApplicationApiTypeEntity entity = getData("jsonStr", object, SysApplicationApiTypeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getAppId() == null || "".equals(entity.getAppId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + SysApplicationApiEntity checkEntity = new SysApplicationApiEntity(); + checkEntity.setSts("Y"); + checkEntity.setAppId(entity.getAppId()); + checkEntity.setCatalogueId(entity.getId()); + int checkCount = sysApplicationApiDao.checkCatalogue(checkEntity); + if (checkCount > 0) { + return BaseResult.getFailureMessageEntity("业务模块下的接口已被其他接口使用,请先删除接口"); + } + //删除 + SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity(); + sysApplicationApiEntity.setCatalogueId(entity.getId()); + sysApplicationApiEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiEntity.setModify_time(new Date()); + sysApplicationApiEntity.setSts("Y"); + sysApplicationApiDao.logicRemoveMultiCondition(sysApplicationApiEntity); + applicationCache.reloadData("2"); + //删除 + SysApplicationApiTypeEntity sysApplicationApiTypeEntity = new SysApplicationApiTypeEntity(); + sysApplicationApiTypeEntity.setId(entity.getId()); + sysApplicationApiTypeEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiTypeEntity.setModify_time(new Date()); + sysApplicationApiTypeEntity.setSts("Y"); + sysApplicationApiTypeDao.logicRemoveMultiCondition(sysApplicationApiTypeEntity); + return BaseResult.getSuccessMessageEntity("删除业务类型成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 根据应用、目录、查询条件查询api接口 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppApi(JSONObject object) { + SysApplicationApiDto entity = getData("jsonStr", object, SysApplicationApiDto.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List entities = sysApplicationApiDao.queryVoList(entity); + + + PageInfo pageInfo = new PageInfo(entities); + if (entities != null && entities.size() > 0) { + for (int i = 0; i < entities.size(); i++) { + if (entities.get(i).getAuthDetail() != null && !"".equals(entities.get(i).getAuthDetail())) { + String[] a = entities.get(i).getAuthDetail().split(","); + entities.get(i).setAuthDetails(a); + } else { + entities.get(i).setAuthDetails(new String[]{}); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 查询调试参数接口 根据调试内容,查询认证以及自己环境参数以及api设置参数 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity debugAppApi(JSONObject object) { + SysApplicationApiDto entity = getData("jsonStr", object, SysApplicationApiDto.class); + if (entity.getAppId() == null || "".equals(entity.getAppId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询app + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(entity.getAppId()); + //查询接口 + SysApplicationApiEntity sysApplicationApiEntity = sysApplicationApiDao.get(entity.getId()); + //查询接口参数 + SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity(); + sysApplicationApiParaEntity.setSts("Y"); + sysApplicationApiParaEntity.setAppId(entity.getAppId()); + List sysApplicationApiParaEntityList = sysApplicationApiParaDao.queryBase(sysApplicationApiParaEntity); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app", sysApplicationEntity); + jsonObject.put("api", sysApplicationApiEntity); + jsonObject.put("para", sysApplicationApiParaEntityList); + return BaseResult.getSuccessMessageEntity("查询数据成功", jsonObject); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 查询api接口 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity getAppApi(JSONObject object) { + SysApplicationApiDto entity = getData("jsonStr", object, SysApplicationApiDto.class); + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询接口 + SysApplicationApiEntity sysApplicationApiEntity = sysApplicationApiDao.get(entity.getId()); + return BaseResult.getSuccessMessageEntity("查询数据成功", sysApplicationApiEntity); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 查询接口日志 查询接口发送错误,以及不发送的数据 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppApiLog(JSONObject object) { + SysMessageManageLogEntity entity = getData("jsonStr", object, SysMessageManageLogEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List ids = sysMessageManageLogDao.querySysMessageManageLogIds(entity); + PageInfo pageInfo = new PageInfo(ids); + List sysMessageManageLogEntities = new ArrayList<>(); + if(ids != null && ids.size() > 0){ + entity.setIds(ids); + sysMessageManageLogEntities = sysMessageManageLogDao.queryListByErrorPageVo(entity); + } + pageInfo.setList(sysMessageManageLogEntities); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 共享保存接口 根据选择的应用和目录, + * 查询对应应用是否有该接口,有返回提示,没有保存, + * 同步判断是否有认证接口,以及认证接口是否存在,如果存在不保存 + * @Date 2023/9/23 + **/ + @Override + public JsonResultEntity saveApiShare(JSONObject object) { + SysApplicationApiDto entity = getData("jsonStr", object, SysApplicationApiDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getAppId() == null || "".equals(entity.getAppId())) { + return BaseResult.getFailureMessageEntity("请先选择应用"); + } + if (entity.getCatalogueId() == null || "".equals(entity.getCatalogueId())) { + return BaseResult.getFailureMessageEntity("请先选择目录"); + } + SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(entity.getId()); + //判断接口是否已经存在 + SysApplicationApiEntity checkEntity = new SysApplicationApiEntity(); + checkEntity.setSts("Y"); + checkEntity.setAppId(entity.getAppId()); + checkEntity.setApiName(apiEntity.getApiName()); + List checkList = sysApplicationApiDao.queryBase(checkEntity); + if (checkList != null && checkList.size() > 0) { + return BaseResult.getFailureMessageEntity("接口已存在"); + } else { + doSaveApiShare(apiEntity, entity.getAppId(), entity.getCatalogueId()); + return BaseResult.getSuccessMessageEntity("共享接口成功"); + } + } + + /** + * @param apiEntity 需要复制的接口 + * @param appId 复制后的应用id + * @param catalogueId 复制后的目录id + * @return java.lang.String + * @Author lvleigang + * @Description 保存接口 + * @Date 3:45 下午 2023/9/25 + **/ + private String doSaveApiShare(SysApplicationApiEntity apiEntity, String appId, String catalogueId) { + //判断接口是否已经存在 + String authenticationPortId = null; + SysApplicationApiEntity checkEntity = new SysApplicationApiEntity(); + checkEntity.setSts("Y"); + checkEntity.setAppId(appId); + checkEntity.setApiName(apiEntity.getApiName()); + List checkList = sysApplicationApiDao.queryBase(checkEntity); + if (checkList != null && checkList.size() > 0) { + return authenticationPortId; + } + //新的认证接口id + //修改设置参数 + apiEntity.setApiCode(null); + apiEntity.setAppId(appId); + apiEntity.setCatalogueId(catalogueId); + apiEntity.setId(UUIDUtils.getUUID()); + apiEntity.setSts("Y"); + apiEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + apiEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + apiEntity.setCreate_time(new Date()); + apiEntity.setModify_time(new Date()); + //判断是否有认证接口 + if (apiEntity.getNeedLogin() != null && "1".equals(apiEntity.getNeedLogin()) && apiEntity.getAuthenticationPort() != null && !"".equals(apiEntity.getAuthenticationPort())) { + String rnId = null; + //存在认证接口 + SysApplicationApiEntity authenticationPort = sysApplicationApiDao.get(apiEntity.getAuthenticationPort()); + //查询保存认证接口目录 + SysApplicationApiTypeEntity sysApplicationApiTypeEntity = sysApplicationApiTypeDao.get(authenticationPort.getCatalogueId()); + //判断目录是否存在 + SysApplicationApiTypeEntity checkType = new SysApplicationApiTypeEntity(); + checkType.setSts("Y"); + checkType.setAppId(appId); + checkType.setName(sysApplicationApiTypeEntity.getName()); + List apiTypeEntities = sysApplicationApiTypeDao.queryBase(checkType); + // 目录不存在时候 + if (apiTypeEntities == null || apiTypeEntities.size() == 0) { + SysApplicationApiTypeEntity saveApiType = new SysApplicationApiTypeEntity(); + saveApiType.setAppId(appId); + saveApiType.setName(sysApplicationApiTypeEntity.getName()); + saveApiType.setId(UUIDUtils.getUUID()); + saveApiType.setSts("Y"); + saveApiType.setCreate_user_id(StpUtil.getLoginIdAsString()); + saveApiType.setModify_user_id(StpUtil.getLoginIdAsString()); + saveApiType.setCreate_time(new Date()); + saveApiType.setModify_time(new Date()); + sysApplicationApiTypeDao.save(saveApiType); + apiEntity.setAuthenticationPort(doSaveApiShare(authenticationPort, appId, saveApiType.getId())); + } else { + apiEntity.setAuthenticationPort(doSaveApiShare(authenticationPort, appId, apiTypeEntities.get(0).getId())); + } + } + authenticationPortId = apiEntity.getId(); + sysApplicationApiDao.save(apiEntity); + applicationCache.reloadData("2"); + return authenticationPortId; + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description api删除接口 接口删除校验是否有api配置时候有使用,以及esb中心是否有配置该接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity deleteApi(JSONObject object) { + + SysApplicationApiDto entity = getData("jsonStr", object, SysApplicationApiDto.class); + //判断编码是否重复 + if (entity == null) { + return BaseResult.getFailureMessageEntity("请先填写内容"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("请先选择数据"); + } + //判断api是否有使用 + SysApplicationApiEntity checkApi = new SysApplicationApiEntity(); + checkApi.setAuthenticationPort(entity.getId()); + checkApi.setSts("Y"); + Integer checkApiCount = sysApplicationApiDao.getCount(checkApi); + if (checkApiCount != null && checkApiCount > 0) { + return BaseResult.getFailureMessageEntity("当前api已被别的api引用,请先删除引用"); + } + //判断esb是否有使用 + SysMessageManageEntity checkMessageManage = new SysMessageManageEntity(); + checkMessageManage.setSendApi(entity.getId()); + checkMessageManage.setSts("Y"); + Integer checkMessageManageCount = sysMessageManageDao.getCount(checkMessageManage); + if (checkMessageManageCount != null && checkMessageManageCount > 0) { + return BaseResult.getFailureMessageEntity("当前api已再esb中心配置,请先删除引用"); + } + SysMessageManageDetailEntity checkMessageManageDetail = new SysMessageManageDetailEntity(); + checkMessageManageDetail.setReceiveApi(entity.getId()); + checkMessageManageDetail.setSts("Y"); + Integer checkMessageManageDetailCount = sysMessageManageDetailDao.getCount(checkMessageManageDetail); + if (checkMessageManageDetailCount != null && checkMessageManageDetailCount > 0) { + return BaseResult.getFailureMessageEntity("当前api已再esb中心配置,请先删除引用"); + } + //删除 + SysApplicationApiEntity sysApplicationApiEntity = new SysApplicationApiEntity(); + sysApplicationApiEntity.setId(entity.getId()); + sysApplicationApiEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiEntity.setModify_time(new Date()); + sysApplicationApiEntity.setSts("Y"); + sysApplicationApiDao.logicRemove(sysApplicationApiEntity); + applicationCache.reloadData("2"); + return BaseResult.getSuccessMessageEntity("删除成功"); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description api新增接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveApi(JSONObject object) { + SysApplicationApiEntity entity = getData("jsonStr", object, SysApplicationApiEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getApiName() == null || "".equals(entity.getApiName())) { + return BaseResult.getFailureMessageEntity("请先输入接口名称"); + } + if (entity.getAppId() == null || "".equals(entity.getAppId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + SysApplicationApiEntity checkEntity = new SysApplicationApiEntity(); + checkEntity.setSts("Y"); + checkEntity.setApiName(entity.getApiName()); + checkEntity.setAppId(entity.getAppId()); + int checkCount = sysApplicationApiDao.getCount(checkEntity); + if (checkCount > 0) { + return BaseResult.getFailureMessageEntity("接口名称已存在"); + } + entity.setId(UUIDUtils.getUUID()); + entity.setSts("Y"); + entity.setCreate_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setCreate_time(new Date()); + entity.setModify_time(new Date()); + sysApplicationApiDao.save(entity); + applicationCache.reloadData("2"); + return BaseResult.getSuccessMessageEntity("保存接口成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description api修改接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity updateApi(JSONObject object) { + SysApplicationApiEntity entity = getData("jsonStr", object, SysApplicationApiEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getApiName() == null || "".equals(entity.getApiName())) { + return BaseResult.getFailureMessageEntity("请先输入接口名称"); + } + if (entity.getAppId() == null || "".equals(entity.getAppId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + SysApplicationApiEntity checkEntity = new SysApplicationApiEntity(); + checkEntity.setSts("Y"); + checkEntity.setId(entity.getId()); + checkEntity.setApiName(entity.getApiName()); + checkEntity.setAppId(entity.getAppId()); + int checkCount = sysApplicationApiDao.entity_count_not_id(checkEntity); + if (checkCount > 0) { + return BaseResult.getFailureMessageEntity("接口名称已存在"); + } + entity.setSts("Y"); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_time(new Date()); + sysApplicationApiDao.update(entity); + applicationCache.reloadData("2"); + return BaseResult.getSuccessMessageEntity("修改接口成功", entity.getId()); + + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 三方调用系统查询接口 根据应用查询三方调用系统 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppApiAuth(JSONObject object) { + SysApplicationApiAuthEntity entity = getData("jsonStr", object, SysApplicationApiAuthEntity.class); + List apiAuthEntities = sysApplicationApiAuthDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询三方调用系统成功", apiAuthEntities); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 三方调用系统保存接口 保存三方系统,全量修改保存,同步删除api关联三方系统配置表已经删除的三方调用系统接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveAppApiAuth(JSONObject object) { + + SysApplicationApiAuthDto entity = getData("jsonStr", object, SysApplicationApiAuthDto.class); + //判断编码是否重复 + if (entity == null) { + return BaseResult.getFailureMessageEntity("请先填写内容"); + } + //删除 + SysApplicationApiAuthEntity sysApplicationApiAuthEntity = new SysApplicationApiAuthEntity(); + sysApplicationApiAuthEntity.setAppId(entity.getAppId()); + sysApplicationApiAuthEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiAuthEntity.setModify_time(new Date()); + sysApplicationApiAuthEntity.setSts("Y"); + sysApplicationApiAuthDao.logicRemoveMultiCondition(sysApplicationApiAuthEntity); + applicationCache.reloadData("3"); + List tripartiteSystemIds = new ArrayList<>(); + //添加 + List apiAuths = entity.getApiAuths(); + if (apiAuths != null && apiAuths.size() > 0) { + for (int i = 0; i < apiAuths.size(); i++) { + apiAuths.get(i).setAppId(entity.getAppId()); + apiAuths.get(i).setSts("Y"); + apiAuths.get(i).setModify_user_id(StpUtil.getLoginIdAsString()); + apiAuths.get(i).setModify_time(new Date()); + if (apiAuths.get(i).getId() != null && !"".equals(apiAuths.get(i).getId())) { + //修改 + tripartiteSystemIds.add(apiAuths.get(i).getId()); + sysApplicationApiAuthDao.update(apiAuths.get(i)); + } else { + //新增 + apiAuths.get(i).setId(UUIDUtils.getUUID()); + apiAuths.get(i).setCreate_user_id(StpUtil.getLoginIdAsString()); + apiAuths.get(i).setCreate_time(new Date()); + tripartiteSystemIds.add(apiAuths.get(i).getId()); + sysApplicationApiAuthDao.save(apiAuths.get(i)); + } + applicationCache.reloadData("3"); + } + } + //删除三方系统关联表 + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = new SysApplicationApiAuthDetailEntity(); + sysApplicationApiAuthDetailEntity.setAppId(entity.getAppId()); + sysApplicationApiAuthDetailEntity.setTripartiteSystemIds(tripartiteSystemIds); + sysApplicationApiAuthDetailDao.updateDeleteTripartiteSystem(sysApplicationApiAuthDetailEntity); + applicationCache.reloadData("4"); + return BaseResult.getSuccessMessageEntity("保存成功"); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description api关联三方系统保存接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveAppApiAuthDetail(JSONObject object) { + SysApplicationApiAuthDetailEntity entity = getData("jsonStr", object, SysApplicationApiAuthDetailEntity.class); + //判断编码是否重复 + if (entity == null) { + return BaseResult.getFailureMessageEntity("请先填写内容"); + } + if (entity.getStatusType() == null || "".equals(entity.getStatusType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //状态 1、取消选择 2、选择 + if ("1".equals(entity.getStatusType())) { + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = new SysApplicationApiAuthDetailEntity(); + //sysApplicationApiAuthDetailEntity.setSts("N"); + sysApplicationApiAuthDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiAuthDetailEntity.setModify_time(new Date()); + sysApplicationApiAuthDetailEntity.setAppId(entity.getAppId()); + sysApplicationApiAuthDetailEntity.setCatalogueId(entity.getCatalogueId()); + sysApplicationApiAuthDetailEntity.setApiId(entity.getApiId()); + sysApplicationApiAuthDetailEntity.setTripartiteSystemId(entity.getTripartiteSystemId()); + sysApplicationApiAuthDetailDao.logicRemoveMultiCondition(sysApplicationApiAuthDetailEntity); + applicationCache.reloadData("4"); + return BaseResult.getSuccessMessageEntity("取消关联成功"); + + } else { + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = new SysApplicationApiAuthDetailEntity(); + sysApplicationApiAuthDetailEntity.setAppId(entity.getAppId()); + sysApplicationApiAuthDetailEntity.setCatalogueId(entity.getCatalogueId()); + sysApplicationApiAuthDetailEntity.setApiId(entity.getApiId()); + sysApplicationApiAuthDetailEntity.setTripartiteSystemId(entity.getTripartiteSystemId()); + List sysApplicationApiAuthDetailEntities = sysApplicationApiAuthDetailDao.queryBase(sysApplicationApiAuthDetailEntity); + if (sysApplicationApiAuthDetailEntities != null && sysApplicationApiAuthDetailEntities.size() > 0) { + sysApplicationApiAuthDetailEntity = sysApplicationApiAuthDetailEntities.get(0); + sysApplicationApiAuthDetailEntity.setSts("Y"); + sysApplicationApiAuthDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiAuthDetailEntity.setModify_time(new Date()); + sysApplicationApiAuthDetailDao.update(sysApplicationApiAuthDetailEntity); + applicationCache.reloadData("4"); + } else { + sysApplicationApiAuthDetailEntity.setId(UUIDUtils.getUUID()); + sysApplicationApiAuthDetailEntity.setSts("Y"); + sysApplicationApiAuthDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiAuthDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationApiAuthDetailEntity.setCreate_time(new Date()); + sysApplicationApiAuthDetailEntity.setModify_time(new Date()); + sysApplicationApiAuthDetailDao.save(sysApplicationApiAuthDetailEntity); + applicationCache.reloadData("4"); + } + return BaseResult.getSuccessMessageEntity("关联成功"); + } + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 插件查询接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppPlugin(JSONObject object) { + SysApplicationPluginDto entity = getData("jsonStr", object, SysApplicationPluginDto.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List sysApplicationPluginEntities = sysApplicationPluginDao.queryListlike(entity); + PageInfo pageInfo = new PageInfo(sysApplicationPluginEntities); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 插件保存接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveAppPlugin(JSONObject object) { + SysApplicationPluginEntity entity = getData("jsonStr", object, SysApplicationPluginEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + entity.setId(UUIDUtils.getUUID()); + entity.setSts("Y"); + entity.setCreate_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setCreate_time(new Date()); + entity.setModify_time(new Date()); + sysApplicationPluginDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存插件成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 获取插件接口 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity getAppPlugin(JSONObject object) { + SysApplicationPluginEntity entity = getData("jsonStr", object, SysApplicationPluginEntity.class); + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询接口 + SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(entity.getId()); + return BaseResult.getSuccessMessageEntity("查询数据成功", sysApplicationPluginEntity); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 插件修改接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity updateAppPlugin(JSONObject object) { + SysApplicationPluginEntity entity = getData("jsonStr", object, SysApplicationPluginEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_time(new Date()); + sysApplicationPluginDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改插件成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 插件删除接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity deleteAppPlugin(JSONObject object) { + SysApplicationPluginEntity entity = getData("jsonStr", object, SysApplicationPluginEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setSts("N"); + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_time(new Date()); + sysApplicationPluginDao.update(entity); + return BaseResult.getSuccessMessageEntity("删除插件成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 插件启用停用接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity enableOrDisableAppPlugin(JSONObject object) { + SysApplicationPluginEntity entity = getData("jsonStr", object, SysApplicationPluginEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getPluginStatus() == null || "".equals(entity.getPluginStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setModify_user_id(StpUtil.getLoginIdAsString()); + entity.setModify_time(new Date()); + sysApplicationPluginDao.update(entity); + if ("1".equals(entity.getPluginStatus())) {// 1启用2停用 + return BaseResult.getSuccessMessageEntity("启用成功"); + } else { + return BaseResult.getSuccessMessageEntity("停用成功"); + } + } + + + /** + * @param object + * @return + * @Author lvleigang + * @Description 查询api所有数据 + * @Date 2:08 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppAll(JSONObject object) { + SysApplicationDto entity = getData("jsonStr", object, SysApplicationDto.class); + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询app + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(entity.getId()); + //查询接口参数 + SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity(); + sysApplicationApiParaEntity.setSts("Y"); + sysApplicationApiParaEntity.setAppId(entity.getId()); + List sysApplicationApiParaEntityList = sysApplicationApiParaDao.queryBase(sysApplicationApiParaEntity); + + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setAppId(entity.getId()); + sysApplicationDatabaseEntity.setSts("Y"); + List list = sysApplicationDatabaseDao.queryBase(sysApplicationDatabaseEntity); + + if (list != null && list.size() > 0) { + sysApplicationDatabaseEntity = list.get(0); + } else { + sysApplicationDatabaseEntity = null; + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app", sysApplicationEntity); + jsonObject.put("databaseEntity", sysApplicationDatabaseEntity); + jsonObject.put("apiParas", sysApplicationApiParaEntityList); + return BaseResult.getSuccessMessageEntity("查询数据成功", jsonObject); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用接口启用停用接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity enableOrDisableAppApi(JSONObject object) { + SysApplicationDto entity = getData("jsonStr", object, SysApplicationDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getInterfaceStatus() == null || "".equals(entity.getInterfaceStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //接口环境是否启用(1、开启 2、关闭) + if ("1".equals(entity.getInterfaceStatus())) {// 1启用2停用 + //判断接口参数是否存在,如果存在判断是否有值 + //查询接口参数 + SysApplicationApiParaEntity sysApplicationApiParaEntity = new SysApplicationApiParaEntity(); + sysApplicationApiParaEntity.setSts("Y"); + sysApplicationApiParaEntity.setAppId(entity.getId()); + List sysApplicationApiParaEntityList = sysApplicationApiParaDao.queryBase(sysApplicationApiParaEntity); + boolean flag = true; + if (sysApplicationApiParaEntityList != null && sysApplicationApiParaEntityList.size() > 0) { + for (int i = 0; i < sysApplicationApiParaEntityList.size(); i++) { + if (sysApplicationApiParaEntityList.get(i).getInterfaceKey() == null || "".equals(sysApplicationApiParaEntityList.get(i).getInterfaceKey()) + || sysApplicationApiParaEntityList.get(i).getInterfaceType() == null || "".equals(sysApplicationApiParaEntityList.get(i).getInterfaceType()) + || sysApplicationApiParaEntityList.get(i).getInterfaceValue() == null || "".equals(sysApplicationApiParaEntityList.get(i).getInterfaceValue())) { + flag = false; + break; + } + + } + } + if (flag) { + //查询接口参数 + SysApplicationEntity sysApplicationEntity = new SysApplicationEntity(); + sysApplicationEntity.setSts("Y"); + sysApplicationEntity.setId(entity.getId()); + sysApplicationEntity.setInterfaceStatus(entity.getInterfaceStatus()); + sysApplicationEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationEntity.setModify_time(new Date()); + sysApplicationDao.update(sysApplicationEntity); + applicationCache.reloadData("1"); + return BaseResult.getSuccessMessageEntity("启用成功"); + } else { + return BaseResult.getFailureMessageEntity("接口参数配置不完整,请先配置参数"); + } + } else { + //查询接口参数 + SysApplicationEntity sysApplicationEntity = new SysApplicationEntity(); + sysApplicationEntity.setSts("Y"); + sysApplicationEntity.setId(entity.getId()); + sysApplicationEntity.setInterfaceStatus(entity.getInterfaceStatus()); + sysApplicationEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationEntity.setModify_time(new Date()); + sysApplicationDao.update(sysApplicationEntity); + applicationCache.reloadData("1"); + return BaseResult.getSuccessMessageEntity("停用成功"); + } + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 应用数据源启用停用接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity enableOrDisableAppDatasource(JSONObject object) { + SysApplicationDto entity = getData("jsonStr", object, SysApplicationDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbStatus() == null || "".equals(entity.getDbStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //接口环境是否启用(1、开启 2、关闭) + if ("1".equals(entity.getDbStatus())) {// 1启用2停用 + //判断接口参数是否存在,如果存在判断是否有值 + //查询接口参数 + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setAppId(entity.getId()); + List sysApplicationDatabaseEntityList = sysApplicationDatabaseDao.queryBase(sysApplicationDatabaseEntity); + boolean flag = true; + if (sysApplicationDatabaseEntityList != null && sysApplicationDatabaseEntityList.size() > 0) { + if (sysApplicationDatabaseEntityList.get(0).getSourceType() == null || "".equals(sysApplicationDatabaseEntityList.get(0).getSourceType()) + || sysApplicationDatabaseEntityList.get(0).getSourceUrl() == null || "".equals(sysApplicationDatabaseEntityList.get(0).getSourceUrl()) + || sysApplicationDatabaseEntityList.get(0).getPassword() == null || "".equals(sysApplicationDatabaseEntityList.get(0).getPassword()) + || sysApplicationDatabaseEntityList.get(0).getDbName() == null || "".equals(sysApplicationDatabaseEntityList.get(0).getDbName()) + || sysApplicationDatabaseEntityList.get(0).getLoginName() == null || "".equals(sysApplicationDatabaseEntityList.get(0).getLoginName())) { + flag = false; + } + if (flag) { + //校验连接 + SysApplicationDatasourceDto testDb = new SysApplicationDatasourceDto(); + testDb.setSourceUrl(sysApplicationDatabaseEntityList.get(0).getSourceUrl()); + testDb.setLoginName(sysApplicationDatabaseEntityList.get(0).getLoginName()); + testDb.setPassword(sysApplicationDatabaseEntityList.get(0).getPassword()); + testDb.setSourceType(sysApplicationDatabaseEntityList.get(0).getSourceType()); + if (dsDataSourceUtil.testConnection(testDb)) { + sysApplicationDatabaseEntity = sysApplicationDatabaseEntityList.get(0); + sysApplicationDatabaseEntity.setDbStatus(entity.getDbStatus()); + sysApplicationDatabaseEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationDatabaseEntity.setModify_time(new Date()); + sysApplicationDatabaseDao.update(sysApplicationDatabaseEntity); + //查询接口参数 + SysApplicationEntity sysApplicationEntity = new SysApplicationEntity(); + sysApplicationEntity.setSts("Y"); + sysApplicationEntity.setId(entity.getId()); + sysApplicationEntity.setDbStatus(entity.getDbStatus()); + sysApplicationEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationEntity.setModify_time(new Date()); + sysApplicationDao.update(sysApplicationEntity); + applicationCache.reloadData("1"); + return BaseResult.getSuccessMessageEntity("启用成功"); + } else { + return BaseResult.getFailureMessageEntity("数据源连接失败,请先配置参数"); + } + } else { + return BaseResult.getFailureMessageEntity("数据源配置不完整,请先配置参数"); + } + } else { + return BaseResult.getFailureMessageEntity("请先配置数据源"); + } + + } else { + SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity(); + sysApplicationDatabaseEntity.setSts("Y"); + sysApplicationDatabaseEntity.setAppId(entity.getId()); + sysApplicationDatabaseEntity.setAppId(entity.getId()); + sysApplicationDatabaseEntity.setDbStatus(entity.getDbStatus()); + sysApplicationDatabaseDao.update(sysApplicationDatabaseEntity); + //查询接口参数 + SysApplicationEntity sysApplicationEntity = new SysApplicationEntity(); + sysApplicationEntity.setSts("Y"); + sysApplicationEntity.setId(entity.getId()); + sysApplicationEntity.setDbStatus(entity.getDbStatus()); + sysApplicationEntity.setModify_user_id(StpUtil.getLoginIdAsString()); + sysApplicationEntity.setModify_time(new Date()); + sysApplicationDao.update(sysApplicationEntity); + applicationCache.reloadData("1"); + return BaseResult.getSuccessMessageEntity("停用成功"); + } + } + + /** + * @param servletRequest + * @param servletResponse + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 外部系统调用接口 + * @Date 4:21 下午 2023/10/19 + **/ + @Override + @DSTransactional() + public JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse) { + + //例如:A应用发送数据到中台,中台转发到B应用 + long jrff = System.currentTimeMillis(); + long fsqsj = 0L; + long fshsj = 0L; + HttpServletRequest request = (HttpServletRequest) servletRequest; + String bodys = ServletUtil.getBody(servletRequest); + //if(bodys.startsWith("\"") && bodys.endsWith("\"")){ + // bodys = bodys.substring(1); + // bodys = bodys.substring(0, bodys.length() - 1); + //} + //bodys = StringEscapeUtils.unescapeJson(bodys).replaceAll("\r\n",""); + Map headerMap = ServletUtil.getHeaderMap(request); + String querys = request.getQueryString(); + //应用key + String publicKey = request.getHeader("publicKey"); + //应用密钥 + String secretKey = request.getHeader("secretKey"); + //appId + String appId = request.getHeader("appId"); + //apiCode + String apiCode = request.getHeader("apiCode"); + + String ip = IPHelper.getIpAddr(request); + if (publicKey == null || "".equals(publicKey)) { + return BaseResult.getFailureMessageEntity("请先传递公钥"); + } + if (secretKey == null || "".equals(secretKey)) { + return BaseResult.getFailureMessageEntity("请先传递密钥"); + } + if (appId == null || "".equals(appId)) { + return BaseResult.getFailureMessageEntity("请先传递接收方应用"); + } + if (apiCode == null || "".equals(apiCode)) { + return BaseResult.getFailureMessageEntity("请先传递发送接口"); + } + + logger.info("请求参数:publicKey:【" + publicKey + "】secretKey:【" + secretKey + "】appId:【" + appId + "】apiCode:【" + apiCode); + //根据请求a应用的公钥、密钥是否能查找到一条数据 + //TODO 修改为缓存获取 + //SysApplicationEntity sendApp = new SysApplicationEntity(); + //sendApp.setSts("Y"); + //sendApp.setPublicKey(publicKey); + //sendApp.setSecretKey(secretKey); + //List sysApplicationEntities = sysApplicationDao.queryBase(sendApp); + //if (sysApplicationEntities == null || sysApplicationEntities.size() != 1) { + // return BaseResult.getFailureMessageEntity("系统错误请联系中台管理员,应用配置错误"); + //} + //sendApp = sysApplicationEntities.get(0); + SysApplicationEntity sendApp = getAppByPublicKeySecretKey(publicKey,secretKey); + if(sendApp == null ){ + return BaseResult.getFailureMessageEntity("系统错误请联系中台管理员,应用配置错误"); + } + //判断应用是否启用 + if (sendApp.getAppStatus() == null || !"1".equals(sendApp.getAppStatus())) { + return BaseResult.getFailureMessageEntity("发送方应用未启用,请联系中台管理员"); + } + //判断应用接口是否启用 + //if(sendApp.getInterfaceStatus() == null || !"1".equals(sendApp.getInterfaceStatus())){ + // return BaseResult.getFailureMessageEntity("发送方应用接口未启用,请联系中台管理员"); + //} + //估计请求的appID和接口编码 查询具体发送的那个应用那个接口 + //SysApplicationEntity receiveApp = new SysApplicationEntity(); + //receiveApp.setSts("Y"); + //receiveApp.setAppId(Integer.valueOf(appId)); + //List receiveAppList = sysApplicationDao.queryBase(receiveApp); + //if (receiveAppList == null || receiveAppList.size() != 1) { + // return BaseResult.getFailureMessageEntity("系统错误请联系中台管理员,应用配置错误"); + //} + //receiveApp = receiveAppList.get(0); + SysApplicationEntity receiveApp = getAppByAppId(appId); + if(receiveApp == null ){ + return BaseResult.getFailureMessageEntity("系统错误请联系中台管理员,应用配置错误"); + } + //判断应用是否启用 + if (receiveApp.getAppStatus() == null || !"1".equals(receiveApp.getAppStatus())) { + return BaseResult.getFailureMessageEntity("接收方应用未启用,请联系中台管理员"); + } + //判断应用接口是否启用 + if (receiveApp.getInterfaceStatus() == null || !"1".equals(receiveApp.getInterfaceStatus())) { + return BaseResult.getFailureMessageEntity("接收方应用接口未启用,请联系中台管理员"); + } + + //SysApplicationApiEntity receiveApi = new SysApplicationApiEntity(); + //receiveApi.setSts("Y"); + //receiveApi.setAppId(receiveApp.getId()); + //receiveApi.setApiCode(Long.parseLong(apiCode)); + //List receiveApiList = sysApplicationApiDao.queryBase(receiveApi); + //if (receiveApiList == null || receiveApiList.size() != 1) { + // return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建"); + //} + //receiveApi = receiveApiList.get(0); + + SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(),apiCode); + if(receiveApi == null ){ + return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建"); + } + //获取A应用请求过来的IP,校验B应用设置三方的ip白名单是否一致 + //SysApplicationApiAuthEntity sysApplicationApiAuthEntity = new SysApplicationApiAuthEntity(); + //sysApplicationApiAuthEntity.setSts("Y"); + //sysApplicationApiAuthEntity.setName(sendApp.getId()); + //sysApplicationApiAuthEntity.setAppId(receiveApp.getId()); + //sysApplicationApiAuthEntity.setSystemStatus("1"); + //List sysApplicationApiAuthEntities = sysApplicationApiAuthDao.queryByLike(sysApplicationApiAuthEntity); + //if (sysApplicationApiAuthEntities == null || sysApplicationApiAuthEntities.size() == 0) { + // return BaseResult.getFailureMessageEntity("接收方应用权限配置错误"); + //} + //for (int i = 0; i < sysApplicationApiAuthEntities.size(); i++) { + // if (sysApplicationApiAuthEntities.get(i).getSystemAddress() != null && !"".equals(sysApplicationApiAuthEntities.get(i).getSystemAddress()) + // && !sysApplicationApiAuthEntities.get(i).getSystemAddress().contains(ip)) { + // logger.error("发送方应用ip配置错误,ip为:" + ip); + // return BaseResult.getFailureMessageEntity("发送方应用ip配置错误"); + // } + //} + SysApplicationApiAuthEntity sysApplicationApiAuthEntity = getApiAuthByNameAppId(sendApp.getId(),receiveApp.getId()); + if(sysApplicationApiAuthEntity == null ){ + return BaseResult.getFailureMessageEntity("接收方应用权限配置错误"); + } + if (sysApplicationApiAuthEntity.getSystemAddress() != null && !"".equals(sysApplicationApiAuthEntity.getSystemAddress()) + && !sysApplicationApiAuthEntity.getSystemAddress().contains(ip)) { + logger.error("发送方应用ip配置错误,ip为:" + ip); + return BaseResult.getFailureMessageEntity("发送方应用ip配置错误"); + } + + //判断接口是否授权第三方 + //SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = new SysApplicationApiAuthDetailEntity(); + //sysApplicationApiAuthDetailEntity.setSts("Y"); + //sysApplicationApiAuthDetailEntity.setAppId(receiveApp.getId()); + //sysApplicationApiAuthDetailEntity.setApiId(receiveApi.getId()); + //sysApplicationApiAuthDetailEntity.setStatusType("2"); + //sysApplicationApiAuthDetailEntity.setTripartiteSystemId(sysApplicationApiAuthEntities.get(0).getId()); + //List sysApplicationApiAuthDetailEntities = sysApplicationApiAuthDetailDao.queryBase(sysApplicationApiAuthDetailEntity); + //if (sysApplicationApiAuthDetailEntities == null || sysApplicationApiAuthDetailEntities.size() == 0) { + // return BaseResult.getFailureMessageEntity("发送方未关联应用方"); + //} + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = getApiAuthDetailByAppIdApiIdTripartiteSystemId(receiveApp.getId(),receiveApi.getId(),sysApplicationApiAuthEntity.getId()); + if(sysApplicationApiAuthDetailEntity == null ){ + return BaseResult.getFailureMessageEntity("发送方未关联应用方"); + } + //设置参数获取参数 + StringBuffer url = new StringBuffer(); + 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 (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); + } + fsqsj = System.currentTimeMillis(); + response = closeableHttpClient.execute(post); + fshsj = System.currentTimeMillis(); + + HttpEntity entity = response.getEntity(); + synchronized (lock) { + body.append(EntityUtils.toString(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(sendApp, receiveApp, receiveApi, bodys, headerMap, headers, querys, body.toString(), jrff, fsqsj, fshsj); + logger.info("保存日志结束"); + if (flag) { + return BaseResult.getSuccessMessageEntity("转发成功", body); + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + + } else {//GET + + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpGet get = new HttpGet(url.toString()); + CloseableHttpResponse response = null; + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build(); + get.setConfig(requestConfig);//设置请求参数【超时时间】 + if (headers != null && headers.size() > 0) { + for (String key : headers.keySet()) { + get.setHeader(key, headers.get(key)); + } + } + StringBuilder body = new StringBuilder(); + + boolean flag = true; + try { + fsqsj = System.currentTimeMillis(); + response = closeableHttpClient.execute(get); + fshsj = System.currentTimeMillis(); + HttpEntity entity = response.getEntity(); + synchronized (lock) { + body.append(EntityUtils.toString(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(sendApp, receiveApp, receiveApi, bodys, headerMap, headers, querys, body.toString(), jrff, fsqsj, fshsj); + logger.info("保存日志结束"); + if (flag) { + return BaseResult.getSuccessMessageEntity("转发成功", body); + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + } + + private SysApplicationApiAuthDetailEntity getApiAuthDetailByAppIdApiIdTripartiteSystemId(String appId, String apiId, String tripartiteSystemId) { + String str = "appId"+appId+"apiId"+apiId+"tripartiteSystemId"+tripartiteSystemId; + Object o = applicationCache.get("4",str); + if(o != null ){ + return (SysApplicationApiAuthDetailEntity) o; + } + return null; + } + + private SysApplicationApiAuthEntity getApiAuthByNameAppId(String name, String appId) { + String str = "name"+name+"appId"+appId; + Object o = applicationCache.get("3",str); + if(o != null ){ + return (SysApplicationApiAuthEntity) o; + } + return null; + } + + private SysApplicationApiEntity getApiByAppIdApiCode(String appId, String apiCode) { + + String str = "appId"+appId+"apiCode"+apiCode; + Object o = applicationCache.get("2",str); + if(o != null ){ + return (SysApplicationApiEntity) o; + } + return null; + } + + private SysApplicationEntity getAppByAppId(String appId) { + String str = "appId"+appId; + Object o = applicationCache.get("1",str); + if(o != null ){ + return (SysApplicationEntity) o; + } + return null; + } + + private SysApplicationEntity getAppByPublicKeySecretKey(String publicKey, String secretKey) { + String str = "publicKey"+publicKey+"secretKey"+secretKey; + Object o = applicationCache.get("1",str); + if(o != null ){ + return (SysApplicationEntity) o; + } + return null; + } + + /** + * @param sendApp + * @param receiveApp + * @param receiveApi + * @param bodys + * @param headerMap + * @param querys + * @param body + * @return void + * @Author lvleigang + * @Description 保存日志 + * @Date 11:36 上午 2023/10/20 + **/ + private void saveLog(SysApplicationEntity sendApp, SysApplicationEntity receiveApp, SysApplicationApiEntity receiveApi, String bodys, Map headerMap, Map headers, String querys, String body, long jrff, long fsqsj, long fshsj) { + SysMessageManageLogEntity sysMessageManageLogEntity = new SysMessageManageLogEntity(); + //messageManageId 消息主表主键 + //theme 消息主题 + //messageCode 消息编码 + //sendApp + sysMessageManageLogEntity.setSendApp(sendApp.getId());//发送者应用 + //sendApi 发送者 + sysMessageManageLogEntity.setReceiveCode(receiveApi.getApiCode().toString());//接收者编码 + sysMessageManageLogEntity.setReceiveApp(receiveApp.getId());//接收者应用 + sysMessageManageLogEntity.setReceiveApi(receiveApi.getId());//接收者 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("body", bodys); + jsonObject.put("header", headerMap); + jsonObject.put("querys", querys); + 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 + sysMessageManageLogEntity.setReturnData(body);//返回信息 + //status 状态(1、待发送 2、发送中3、发送成功 4、发送失败) + sysMessageManageLogEntity.setStatus("3");//返回信息 + //remark 备注 + long s1 = jrff - fsqsj; + long s2 = fsqsj - fshsj; + sysMessageManageLogEntity.setRemark("转发成功,发送前时间:" + s1 + "ms,发送时间:" + s2 + "ms");//返回信息 + //returnType 返回解析类型 + //errorStatus 失败状态(1、需要重新发送 2、不需要重新发送) + sysMessageManageLogEntity.setErrorStatus("2");//返回信息 + sysMessageManageLogEntity.setId(UUIDUtils.getUUID()); + sysMessageManageLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + sysMessageManageLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + sysMessageManageLogEntity.setCreate_time(new Date()); + sysMessageManageLogEntity.setModify_time(new Date()); + sysMessageManageLogEntity.setSts("Y"); + //JSONObject jsonObject1 = (JSONObject) JSONObject.toJSON(sysMessageManageLogEntity); + //logger.info("esb转发请求参数:[ "+ jsonObject1.toJSONString()+" ]"); + taskExecutor.execute(() -> doEsbTask(sysMessageManageLogEntity)); + //sysMessageManageLogDao.save(sysMessageManageLogEntity); + //doEsbTask(sysMessageManageLogEntity); + + } + + /** + * @param manageLogEntities + * @return void + * @Author lvleigang + * @Description 保存日子 + * @Date 11:43 上午 2023/8/30 + **/ + private void doEsbTask(SysMessageManageLogEntity manageLogEntities) { + + //sysMessageManageLogDetailService.saveSysMessageManageLogDetail(manageLogEntities); + //manageLogEntities.setSourceData(null); + //manageLogEntities.setTargetData(null); + //manageLogEntities.setReturnData(null); + sysMessageManageLogDao.save(manageLogEntities); + } + +} diff --git a/service/src/main/java/com/hzya/frame/sys/businessFile/controller/BusinessFileController.java b/service/src/main/java/com/hzya/frame/sys/businessFile/controller/BusinessFileController.java new file mode 100644 index 00000000..e94949b8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/businessFile/controller/BusinessFileController.java @@ -0,0 +1,327 @@ +package com.hzya.frame.sys.businessFile.controller; + +import com.github.pagehelper.PageInfo; +import com.hzya.frame.page.PageAttribute; +import com.hzya.frame.sys.businessFile.entity.BusinessFileEntity; +import com.hzya.frame.sys.businessFile.service.IBusinessFileService; +import com.hzya.frame.sys.file.download.service.IFileDownloadService; +import com.hzya.frame.web.action.DefaultController; +import com.hzya.frame.web.action.SessionContext; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.zip.ZipOutputStream; + +/** + * @description: 文件业务关系 controller + * @tableName: sys_business_file + * @entityName: BusinessFileEntity + * 包含: + * 1、分页查询(queryPaged) + * 2、index页面(goIndexPage) + * 3、新增页面(goAddPage) + * 4、新增信息保存(save) + * 5、修改页面(goEditPage) + * 6、修改信息保存(update) + * 7、信息查看(goShowPage) + * 8、删除信息(delete) + * @author: gjh + * @history: 1.0 + */ + +@Controller("sys_business_file") +@RequestMapping("/sys/business/file/BusinessFileController") +public class BusinessFileController extends DefaultController { + @Autowired + protected IBusinessFileService businessfileService; + @Autowired + private IFileDownloadService fileDownloadService; + + /** + * 文件业务关系分页信息 + **/ + @RequestMapping(value = "queryPaged") + @ResponseBody + public PageAttribute queryPaged(BusinessFileEntity entity) throws Exception { + PageAttribute page = null; + try { + page = businessfileService.queryPaged(entity); + } catch (Exception e) { + e.printStackTrace(); + } + return page; + } + + @RequestMapping(value = "queryList") + @ResponseBody + public List queryList(BusinessFileEntity entity) throws Exception { + List list = null; + try { + list = businessfileService.query(entity); + } catch (Exception e) { + e.printStackTrace(); + } + return list; + } + + /** + * 跳转到文件业务关系的index页面 + **/ + @RequestMapping(value = "goIndexPage", method = RequestMethod.GET) + public ModelAndView goIndexPage() { + ModelAndView view = new ModelAndView(); + /**这里根据实际的需要填写需要传到前台的对象**/ + //view.addObject(attributeName, attributeValue); + /**这里是返回对应的页面路径**/ + view.setViewName("/sys/businessFile/businessFile/list"); + return view; + } + + /** + * 跳转到文件业务关系信息新增页面 + **/ + @RequestMapping(value = "goAddPage") + public ModelAndView goAddPage() { + ModelAndView view = new ModelAndView(); + /**这里根据实际的需要填写需要传到前台的对象**/ + //view.addObject(attributeName, attributeValue); + /**这里是返回对应的页面路径**/ + view.setViewName("/sys/businessFile/businessFile/add"); + return view; + } + + /** + * 文件业务关系新增信息保存 + **/ + @RequestMapping(value = "save", method = RequestMethod.POST) + @ResponseBody + public JsonResultEntity save(BusinessFileEntity entity) { + try { + businessfileService.save(entity); + return getSuccessMessageEntity("保存成功", "save"); + } catch (Exception e) { + logger.error("save", e); + e.printStackTrace(); + return getFailureMessageEntity("保存失败!" + e.getMessage(), "save"); + } + } + + /** + * 跳转到文件业务关系信息修改页面 + **/ + @RequestMapping(value = "edit/{id}") + public ModelAndView goEditPage(@PathVariable("id") Long id) { + ModelAndView view = new ModelAndView(); + /**这里根据实际的需要填写需要传到前台的对象**/ + BusinessFileEntity entity = businessfileService.get(id); + view.addObject("entity", entity); + /**这里是返回对应的页面路径**/ + view.setViewName("/sys/businessFile/businessFile/edit"); + return view; + } + + /** + * 文件业务关系修改信息保存 + **/ + @RequestMapping(value = "update", method = RequestMethod.POST) + @ResponseBody + public JsonResultEntity update(BusinessFileEntity entity) { + try { + businessfileService.update(entity); + return getSuccessMessageEntity("更新成功!", "update"); + } catch (Exception e) { + logger.error("update", e); + e.printStackTrace(); + return getFailureMessageEntity("更新失败!" + e.getMessage(), "update"); + } + } + + /** + * 跳转到文件业务关系信息查看 + **/ + @RequestMapping(value = "show/{id}") + public ModelAndView goShowPage(@PathVariable("id") Long id) { + ModelAndView view = new ModelAndView(); + /**这里根据实际的需要填写需要传到前台的对象**/ + BusinessFileEntity entity = businessfileService.get(id); + view.addObject("entity", entity); + /**这里是返回对应的页面路径**/ + view.setViewName("/sys/businessFile/businessFile/show"); + return view; + } + + /** + * 删除文件业务关系信息 + **/ + @RequestMapping(value = "delete", method = RequestMethod.POST) + @ResponseBody + public JsonResultEntity delete(Long id) { + try { + return getSuccessMessageEntity("删除成功!", "delete"); + } catch (Exception e) { + logger.error("delete", e); + e.printStackTrace(); + return getFailureMessageEntity("删除失败!" + e.getMessage(), "delete"); + } + } + + /** + * 业务附件批量保存,通过JSON字符串传入保存参数 + **/ + @RequestMapping(value = "saveBusinessFile", method = RequestMethod.POST) + @ResponseBody + public JsonResultEntity saveBusinessFile(BusinessFileEntity entity) { + try { + entity = businessfileService.saveBatchBusinessFile(entity); + return getSuccessMessageEntity("保存成功!" ); + } catch (Exception e) { + logger.error("save", e); + e.printStackTrace(); + return getFailureMessageEntity("保存失败!" + e.getMessage(), "delete"); + } + } + + /** + * 业务附件批量保存 + **/ + @RequestMapping(value = "saveBatchBusinessFile", method = RequestMethod.POST) + @ResponseBody + public JsonResultEntity saveBatchBusinessFile(BusinessFileEntity entity) { + try { + entity = businessfileService.saveBusinessFile(entity); + return getSuccessMessageEntity("保存成功!" ); + } catch (Exception e) { + logger.error("save", e); + e.printStackTrace(); + return getFailureMessageEntity("保存失败!" + e.getMessage(), "delete"); + } + } + + + /** + * 业务附件批量保存 + **/ + @RequestMapping(value = "validateTicketFiles", method = RequestMethod.POST) + @ResponseBody + public JsonResultEntity validateTicketFiles(BusinessFileEntity entity) { + try { + entity = businessfileService.validateTicketFiles(entity); + return getSuccessMessageEntity("验证成功!" ); + } catch (Exception e) { + logger.error("save", e); + e.printStackTrace(); + return getFailureMessageEntity(e.getMessage(), "validate"); + } + } + + @RequestMapping(value = "listQueryBusinessFilesByGroup", method = RequestMethod.POST) + @ResponseBody + public List listQueryBusinessFilesByGroup(BusinessFileEntity entity) { + List listQueryBusinessFilesByGroup = businessfileService.listQueryBusinessFilesByGroup(entity); + return listQueryBusinessFilesByGroup; + } + + + /*** + * 根据单票ID下载所有的附件 + * @param entity + * @param response + */ + @RequestMapping(value = "ticketFilesDownloadToZip") + public void ticketFilesDownloadToZip(BusinessFileEntity entity, HttpServletResponse response) { + ZipOutputStream out = null; + response.setContentType("APPLICATION/OCTET-STREAM"); + String zipName = entity.getZipName() + ".zip"; + try { + zipName = new String(zipName.getBytes(StandardCharsets.UTF_8), "iso8859-1"); + response.setHeader("Content-Disposition", "attachment; filename=" + zipName); + out = new ZipOutputStream(response.getOutputStream()); + + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + + /** + * 文件业务关系分页信息 + **/ + @RequestMapping(value = "queryBusinessFileByServiceType") + @ResponseBody + public List queryBusinessFileByServiceType(BusinessFileEntity entity) throws Exception { + List businessFileEntityList = null; + try { + businessFileEntityList = businessfileService.queryBusinessFileByServiceType(entity); + } catch (Exception e) { + e.printStackTrace(); + } + return businessFileEntityList; + } + + + + /** + * 跳转到国内清关文件文件上传页面 + **/ + @RequestMapping(value = "goDomesticUploadPage/{id}") + public ModelAndView goDomesticUploadPage(@PathVariable("id") Long id) { + ModelAndView view = new ModelAndView(); + /** 传入整个单票对象*/ + + /** 获取当前登陆人的服务项*/ + + /**这里是返回对应的页面路径**/ + view.setViewName("/sys/businessFile/businessFile/add"); + return view; + } + + + /** + * 跳转制作保函列表页面 + **/ + @RequestMapping(value = "goTicketFileDocumentsIndexPage", method = RequestMethod.GET) + public ModelAndView goTicketFileDocumentsIndexPage(Long ticket_id, Long business_id, String business_type, boolean fileFlag) { + ModelAndView view = new ModelAndView(); + /**这里根据实际的需要填写需要传到前台的对象**/ + view.addObject("business_type", "guarantee"); + /**这里是返回对应的页面路径**/ + + view.setViewName("/sys/businessFile/businessFile/documents"); + return view; + } + + + /** + * 业务附件批量保存 + **/ + @RequestMapping(value = "saveBusinessFileToGuarantee", method = RequestMethod.POST) + @ResponseBody + public JsonResultEntity saveBusinessFileToGuarantee(BusinessFileEntity entity) { + try { + entity = businessfileService.saveBusinessFileToGuarantee(entity); + return getSuccessMessageEntity("保存成功!" ); + } catch (Exception e) { + logger.error("save", e); + e.printStackTrace(); + return getFailureMessageEntity("保存失败!" + e.getMessage(), "delete"); + } + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/businessFile/dao/IBusinessFileDao.java b/service/src/main/java/com/hzya/frame/sys/businessFile/dao/IBusinessFileDao.java new file mode 100644 index 00000000..00a293b0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/businessFile/dao/IBusinessFileDao.java @@ -0,0 +1,28 @@ +package com.hzya.frame.sys.businessFile.dao; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.businessFile.entity.BusinessFileEntity; + +import java.util.List; + +/** + * @description: 文件业务关系 dao + * @tableName: sys_business_file + * @entityName: BusinessFileEntity + * @author: gjh + * @history: 1.0 + */ +public interface IBusinessFileDao extends IBaseDao { + /*** + * 根据业务条件获取根据单证编号分组的附件列表 + * @param entity + * @return + */ + List listQueryBusinessFiles(BusinessFileEntity entity); + + /**** + * 根据服务项类型列表获取附件列表 + * @param entity + * @return + */ + List queryBusinessFileByServiceType(BusinessFileEntity entity); +} diff --git a/service/src/main/java/com/hzya/frame/sys/businessFile/dao/impl/BusinessFileDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/businessFile/dao/impl/BusinessFileDaoImpl.java new file mode 100644 index 00000000..9a3ccfda --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/businessFile/dao/impl/BusinessFileDaoImpl.java @@ -0,0 +1,29 @@ +package com.hzya.frame.sys.businessFile.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sys.businessFile.dao.IBusinessFileDao; +import com.hzya.frame.sys.businessFile.entity.BusinessFileEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @description: 文件业务关系 dao + * @tableName: sys_business_file + * @entityName: BusinessFileEntity + * @author: gjh + * @history:1.0 + */ +@Repository("sys_business_filedao") +public class BusinessFileDaoImpl extends MybatisGenericDao implements IBusinessFileDao { + + @Override + public List listQueryBusinessFiles(BusinessFileEntity entity) { + return super.queryList(entity, "com.hzya.frame.sys.businessFile.entity.BusinessFileEntity.BusinessFileEntity_list_base_group"); + } + + @Override + public List queryBusinessFileByServiceType(BusinessFileEntity entity) { + return super.queryList(entity, "com.hzya.frame.sys.businessFile.entity.BusinessFileEntity.BusinessFileEntity_queryBusinessFileByServiceType"); + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/businessFile/entity/BusinessFileEntity.java b/service/src/main/java/com/hzya/frame/sys/businessFile/entity/BusinessFileEntity.java new file mode 100644 index 00000000..f0dba502 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/businessFile/entity/BusinessFileEntity.java @@ -0,0 +1,321 @@ +package com.hzya.frame.sys.businessFile.entity; + + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +/** + * @description: 文件业务关系 + * @tableName: sys_business_file + * @entityName: BusinessFileEntity + * @author: gjh + * @history: 1.0 + */ +public class BusinessFileEntity extends BaseEntity { + + /** + * 附件表生成的唯一新名称 + */ + private String file_save_name; + /** + * 业务表ID(应用表,) + */ + private String business_id; + /**** + * 业务类型 1、应用 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-10-09 8:19 + * @param + * @return + **/ + private String business_type; + /** + * 单票ID + */ + private Long ticket_id; + /** + * 附件类型 + */ + private String file_type; + /** + * 附件名称 + */ + private String file_name; + /** + * 上传人名称 + */ + private String upload_user; + /** + * 单证号码 + */ + private String file_number; + /** + * 单证名称 + */ + private String documents_name; + /** + * 备注 + */ + private String remark; + /** + * 关联查询文件路径 + */ + private String file_path; + /** + * 关联查询单票号码 + */ + private String ticket_code; + /** + * 接收打包下载的文件集合 + */ + private List businessFileEntityList; + /** + * JSON数据字符串 + */ + private String jsonDataStr; + /** + * 打包下载的名称 + */ + private String zipName; + //附件数量 + private Long file_count; + /** + * 单票服务项List的类型查询条件集合 + */ + private List ticketAllServiceEntities; + /** + * 接收字符串 + */ + private String ticketAllJsonStr; + + /** + * 根据服务项,查询特定的附件 + */ + private List business_type_list; + /** + * 附件集合 + */ + private String fileInfo; + + /** + * 根据服务项,查询特定的附件 + */ + public List getBusiness_type_list() { + return business_type_list; + } + + /** + * 根据服务项,查询特定的附件 + */ + public void setBusiness_type_list(List business_type_list) { + this.business_type_list = business_type_list; + } + + /** + * 附件表生成的唯一新名称 + */ + public String getFile_save_name() { + return file_save_name; + } + + /** + * 附件表生成的唯一新名称 + */ + public void setFile_save_name(String file_save_name) { + this.file_save_name = file_save_name; + } + + /** + * 业务表ID(合同,预报,单票,国际物流) + */ + public String getBusiness_id() { + return business_id; + } + + /** + * 业务表ID(合同,预报,单票,国际物流) + */ + public void setBusiness_id(String business_id) { + this.business_id = business_id; + } + + /** + * 业务类型(contract/合同prediction/预报changeOrder /纯换单customsClearance /报关报检unboxing/纯开箱单shipSeal/船司盖章harbourSeal /港区盖章) + */ + public String getBusiness_type() { + return business_type; + } + + /** + * 业务类型(contract/合同prediction/预报changeOrder /纯换单customsClearance /报关报检unboxing/纯开箱单shipSeal/船司盖章harbourSeal /港区盖章) + */ + public void setBusiness_type(String business_type) { + this.business_type = business_type; + } + + /** + * 单票ID + */ + public Long getTicket_id() { + return ticket_id; + } + + /** + * 单票ID + */ + public void setTicket_id(Long ticket_id) { + this.ticket_id = ticket_id; + } + + /** + * 附件类型 + */ + public String getFile_type() { + return file_type; + } + + /** + * 附件类型 + */ + public void setFile_type(String file_type) { + this.file_type = file_type; + } + + /** + * 附件名称 + */ + public String getFile_name() { + return file_name; + } + + /** + * 附件名称 + */ + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + /** + * 上传人名称 + */ + public String getUpload_user() { + return upload_user; + } + + /** + * 上传人名称 + */ + public void setUpload_user(String upload_user) { + this.upload_user = upload_user; + } + + /** + * 单证号码 + */ + public String getFile_number() { + return file_number; + } + + /** + * 单证号码 + */ + public void setFile_number(String file_number) { + this.file_number = file_number; + } + + /** + * 备注 + */ + public String getRemark() { + return remark; + } + + /** + * 备注 + */ + public void setRemark(String remark) { + this.remark = remark; + } + + public String getTicket_code() { + return ticket_code; + } + + public void setTicket_code(String ticket_code) { + this.ticket_code = ticket_code; + } + + public List getBusinessFileEntityList() { + return businessFileEntityList; + } + + public void setBusinessFileEntityList(List businessFileEntityList) { + this.businessFileEntityList = businessFileEntityList; + } + + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + public Long getFile_count() { + return file_count; + } + + public void setFile_count(Long file_count) { + this.file_count = file_count; + } + + public String getDocuments_name() { + return documents_name; + } + + public void setDocuments_name(String documents_name) { + this.documents_name = documents_name; + } + + public List getTicketAllServiceEntities() { + return ticketAllServiceEntities; + } + + public void setTicketAllServiceEntities(List ticketAllServiceEntities) { + this.ticketAllServiceEntities = ticketAllServiceEntities; + } + + public String getTicketAllJsonStr() { + return ticketAllJsonStr; + } + + public void setTicketAllJsonStr(String ticketAllJsonStr) { + this.ticketAllJsonStr = ticketAllJsonStr; + } + + public String getJsonDataStr() { + return jsonDataStr; + } + + public void setJsonDataStr(String jsonDataStr) { + this.jsonDataStr = jsonDataStr; + } + + public String getZipName() { + return zipName; + } + + public void setZipName(String zipName) { + this.zipName = zipName; + } + + public String getFileInfo() { + return fileInfo; + } + + public void setFileInfo(String fileInfo) { + this.fileInfo = fileInfo; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/businessFile/entity/BusinessFileEntity.xml b/service/src/main/java/com/hzya/frame/sys/businessFile/entity/BusinessFileEntity.xml new file mode 100644 index 00000000..90b73caa --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/businessFile/entity/BusinessFileEntity.xml @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + file_save_name, + business_id, + business_type, + ticket_id, + file_type, + file_name, + upload_user, + create_user_id, + create_time, + modify_user_id, + modify_time, + sts, + file_number, + documents_name, + remark + + + + COUNT(1) as file_count, + file_save_name, + business_id, + business_type, + ticket_id, + file_type, + file_name, + upload_user, + create_user_id, + create_time, + modify_user_id, + modify_time, + sts, + file_number, + documents_name, + remark + + + + + + + + + + + + + + + + + + + + + + + + + insert into sys_business_file( + + id, + file_save_name, + business_id, + business_type, + ticket_id, + file_type, + file_name, + upload_user, + create_user_id, + modify_user_id, + file_number, + documents_name, + remark, + create_time, + modify_time, + sts + + )values + ( + + #{id}, + #{file_save_name}, + #{business_id}, + #{business_type}, + #{ticket_id}, + #{file_type}, + #{file_name}, + #{upload_user}, + #{create_user_id}, + #{modify_user_id}, + #{file_number}, + #{documents_name}, + #{remark}, + #{create_time} , + now(), + #{modify_time}, + now(), + 'Y' + + ) + + + + + + update sys_business_file set + + file_save_name = #{file_save_name}, + business_id = #{business_id}, + business_type = #{business_type}, + ticket_id = #{ticket_id}, + file_type = #{file_type}, + file_name = #{file_name}, + upload_user = #{upload_user}, + create_user_id = #{create_user_id}, + modify_user_id = #{modify_user_id}, + file_number = #{file_number}, + documents_name = #{documents_name}, + remark = #{remark}, + modify_time =#{modify_time} + modify_time = now() + + where id = #{id} + + + + + update sys_business_file set + sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where + id = #{id} + + + + + update sys_business_file set + sts='N',modify_time = now(),modify_user_id = #{modify_user_id} + + id=#{id} + and file_save_name = #{file_save_name} + and business_id = #{business_id} + and business_type = #{business_type} + and ticket_id = #{ticket_id} + and file_type = #{file_type} + and file_name = #{file_name} + and upload_user = #{upload_user} + and create_user_id = #{create_user_id} + and create_time = #{create_time} + and modify_user_id = #{modify_user_id} + and modify_time = #{modify_time} + and sts = #{sts} + and file_number = #{file_number} + and remark = #{remark} + + + + + + delete from sys_business_file where id =#{id} + + diff --git a/service/src/main/java/com/hzya/frame/sys/businessFile/service/IBusinessFileService.java b/service/src/main/java/com/hzya/frame/sys/businessFile/service/IBusinessFileService.java new file mode 100644 index 00000000..005da343 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/businessFile/service/IBusinessFileService.java @@ -0,0 +1,73 @@ +package com.hzya.frame.sys.businessFile.service; + import com.alibaba.fastjson.JSONObject; + import com.hzya.frame.basedao.service.IBaseService; + import com.hzya.frame.sys.businessFile.entity.BusinessFileEntity; + import com.hzya.frame.web.entity.JsonResultEntity; + + import java.util.List; + +/** + * @description: 文件业务关系 service + * @tableName: sys_business_file + * @entityName: BusinessFileEntity + * @author: gjh + * @history: 1.0 + */ +public interface IBusinessFileService extends IBaseService { + /*** + * 保存业务表和文件表的关系 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-10-09 8:32 + * @param + * @return com.hzya.frame.sys.businessFile.entity.BusinessFileEntity + **/ + BusinessFileEntity saveBusinessFile(BusinessFileEntity requestData); + /*** + * 保存业务表和文件表的关系 + * @content: + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-10-09 8:32 + * @param + * @return com.hzya.frame.sys.businessFile.entity.BusinessFileEntity + **/ + JsonResultEntity saveBusinessFileByJsonObj(JSONObject requestData); + + /*** + * 批量保存文件业务相关信息 + * @param entity + * @return + */ + BusinessFileEntity saveBatchBusinessFile(BusinessFileEntity entity) throws Exception; + + + /*** + * 根据业务条件获取根据单证编号分组的附件列表 + * @param entity + * @return + */ + List listQueryBusinessFilesByGroup(BusinessFileEntity entity); + + /*** + * 根据服务项类型获取附件列表 + * @param entity + * @return + */ + List queryBusinessFileByServiceType(BusinessFileEntity entity); + + /*** + * 验证单票是否有附件可以下载 + * @param entity + * @return + */ + BusinessFileEntity validateTicketFiles(BusinessFileEntity entity); + + /**** + * @Content: 保存保函附件 + * @Author guojh + * @Date 2019/5/16 19:16 + * @Param [entity] + * @return com.hzya.frame.sys.businessFile.entity.BusinessFileEntity + **/ + BusinessFileEntity saveBusinessFileToGuarantee(BusinessFileEntity entity); +} diff --git a/service/src/main/java/com/hzya/frame/sys/businessFile/service/impl/BusinessFileServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/businessFile/service/impl/BusinessFileServiceImpl.java new file mode 100644 index 00000000..ae02230b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/businessFile/service/impl/BusinessFileServiceImpl.java @@ -0,0 +1,204 @@ +package com.hzya.frame.sys.businessFile.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.sys.businessFile.dao.IBusinessFileDao; +import com.hzya.frame.sys.businessFile.entity.BusinessFileEntity; +import com.hzya.frame.sys.businessFile.service.IBusinessFileService; +import com.hzya.frame.sys.file.upload.entity.FileResultEntity; +import com.hzya.frame.sys.file.upload.entity.FileUploadEntity; +import com.hzya.frame.sys.file.upload.service.IFileUploadService; +import com.hzya.frame.uuid.UUIDLong; +import com.hzya.frame.web.action.SessionContext; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import com.hzya.frame.web.exception.BaseSystemException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @description: 文件业务关系 service + * @tableName: sys_business_file + * @entityName: BusinessFileEntity + * @author: gjh + * @history: 1.0 + */ +@Service(value = "sys_business_fileService") +public class BusinessFileServiceImpl extends BaseService implements IBusinessFileService { + protected IBusinessFileDao businessfileDao; + + @Autowired + private IFileUploadService fileUploadService; + + @Autowired + public void setBusinessFileDao(IBusinessFileDao dao) { + + this.businessfileDao = dao; + this.dao = dao; + } + + @Override + public BusinessFileEntity saveBusinessFile(BusinessFileEntity entity) { + entity.setId(String.valueOf(UUIDLong.longUUID())); + businessfileDao.save(entity); + return entity; + } + @Override + public JsonResultEntity saveBusinessFileByJsonObj(JSONObject requestData) { + String jsonStr = requestData.getString("jsonStr"); + BusinessFileEntity entity = JSON.parseObject(jsonStr,BusinessFileEntity.class); + entity.setId(String.valueOf(UUIDLong.longUUID())); + businessfileDao.save(entity); + + return BaseResult.getSuccessMessageEntity("保存成功",entity); + } + @Override + public BusinessFileEntity saveBatchBusinessFile(BusinessFileEntity entity) throws Exception { + /** 获取传入的文件集合*/ + List entityBusinessFileEntityList = null; + String jsonStr = entity.getJsonDataStr(); + + if (jsonStr != null && !"".equals(jsonStr)) { + BusinessFileEntity businessFileEntity = JSON.parseObject(jsonStr, BusinessFileEntity.class); + entity.setTicket_id(businessFileEntity.getTicket_id() == null ? entity.getTicket_id() : businessFileEntity.getTicket_id()); + entity.setBusiness_type(businessFileEntity.getBusiness_type()); + entityBusinessFileEntityList = businessFileEntity.getBusinessFileEntityList(); + } else { + entityBusinessFileEntityList = entity.getBusinessFileEntityList(); + + } + + + if (null != entityBusinessFileEntityList && entityBusinessFileEntityList.size() > 0) { +// UserEntity userEntity = SessionContext.getCurrentUser(); + for (BusinessFileEntity businessFileEntity : entityBusinessFileEntityList) { + + String file_business_id = businessFileEntity.getBusiness_id(); + //如果businessFileEntity内的business_id 与主表传入的不一致,说明需要重新上传附件 + if (null != file_business_id && !"".equals(file_business_id) && !file_business_id.equals(entity.getBusiness_id())) { + + String fileSaveName = businessFileEntity.getFile_save_name(); + FileUploadEntity oldFileEntity = new FileUploadEntity(); + oldFileEntity.setFilesavename(fileSaveName); + List fileUploadEntityList = fileUploadService.query(oldFileEntity); + if (fileUploadEntityList.size() > 0) { + oldFileEntity = fileUploadEntityList.get(0); + } else { + throw new BaseSystemException("获取历史附件错误,请联系管理员!"); + } + String oldPath = oldFileEntity.getFilepath() + "/" + fileSaveName; + //根据老文件获取文件,写到新的文件夹下面 + File oldFile = new File(oldPath); + //获取流 + InputStream in = new FileInputStream(oldFile); + //创建文件 + MockMultipartFile mockMultipartFile = new MockMultipartFile(oldFileEntity.getFilename(), oldFileEntity.getFilename(), oldFileEntity.getType(), in); + + FileResultEntity fileResultEntity = new FileResultEntity(); + fileResultEntity.setBusiness_id(Long.valueOf(entity.getBusiness_id())); + fileResultEntity.setTicket_id(entity.getTicket_id()); + fileResultEntity.setBusiness_type(entity.getBusiness_type()); + fileResultEntity = fileUploadService.fileUpload(mockMultipartFile, fileResultEntity); + FileUploadEntity fileUploadEntity = (FileUploadEntity) fileResultEntity.getAttribute(); + businessFileEntity.setFile_save_name(fileUploadEntity.getFilesavename()); + businessFileEntity.setFile_name(oldFileEntity.getFilename()); + businessFileEntity.setId(null); + } + + + businessFileEntity.setBusiness_id(entity.getBusiness_id()); + businessFileEntity.setBusiness_type(entity.getBusiness_type()); + businessFileEntity.setFile_number(entity.getFile_number()); + businessFileEntity.setTicket_id(businessFileEntity.getTicket_id() == null ? entity.getTicket_id() : businessFileEntity.getTicket_id()); + businessFileEntity.setDocuments_name(entity.getDocuments_name()); +// businessFileEntity.setCreate_user_id(userEntity.getId()); +// businessFileEntity.setUpload_user(userEntity.getView_name()); +// businessFileEntity.setModify_user_id(userEntity.getId()); + businessfileDao.saveOrUpdate(businessFileEntity); + } + } + + return entity; + } + + @Override + public List listQueryBusinessFilesByGroup(BusinessFileEntity entity) { + return businessfileDao.listQueryBusinessFiles(entity); + } + + @Override + public List queryBusinessFileByServiceType(BusinessFileEntity entity) { + /** 返回的附件集合*/ + List returnBusinessFiles = new ArrayList(); + String str = entity.getTicketAllJsonStr(); + + List ticketAllServiceEntities = null; + if (null == str || "".equals(str)) { + return returnBusinessFiles; + } else { + ticketAllServiceEntities = JSON.parseArray(str, String.class); + } + if (null == ticketAllServiceEntities || ticketAllServiceEntities.size() == 0) { + return returnBusinessFiles; + } else { + entity.setTicketAllServiceEntities(ticketAllServiceEntities); + returnBusinessFiles = businessfileDao.queryBusinessFileByServiceType(entity); + } + + return returnBusinessFiles; + } + + @Override + public BusinessFileEntity validateTicketFiles(BusinessFileEntity entity) { + Long ticket_id = entity.getTicket_id(); + + /** 根据单票的ID获取单票下的所有的附件*/ + BusinessFileEntity queryBusinessFileEntity = new BusinessFileEntity(); + queryBusinessFileEntity.setTicket_id(ticket_id); + List entityBusinessFileEntityList = businessfileDao.query(queryBusinessFileEntity); + if (entityBusinessFileEntityList.size() == 0) { + throw new BaseSystemException("单票ID:" + ticket_id + "未查询到可打包下载的附件!"); + } + entity.setBusinessFileEntityList(entityBusinessFileEntityList); + + return entity; + } + + @Override + public BusinessFileEntity saveBusinessFileToGuarantee(BusinessFileEntity entity) { + /** 获取当前登陆人*/ + /** 获取file转成的集合JSON字符串*/ + String fileInfo = entity.getFileInfo(); + /** 转成对象*/ + BusinessFileEntity businessFileEntity = JSON.parseObject(fileInfo, BusinessFileEntity.class); + /** 获取file集合*/ + List businessFileEntityList = businessFileEntity.getBusinessFileEntityList(); + if (null != businessFileEntityList && businessFileEntityList.size() > 0) { + for (BusinessFileEntity fileEntity : businessFileEntityList) { +// if (fileEntity.getId() == null) { +// fileEntity.setCreate_user_id(userEntity.getId()); +// fileEntity.setModify_user_id(userEntity.getId()); +// fileEntity.setOrg_id(userEntity.getOrg_id()); +// fileEntity.setCompany_org_id(userEntity.getCompany_org_id()); +// fileEntity.setBusiness_type(entity.getBusiness_type()); +// fileEntity.setBusiness_id(entity.getBusiness_id()); +// fileEntity.setUpload_user(userEntity.getView_name()); +// businessfileDao.saveOrUpdate(fileEntity); +// } + } + entity.setBusinessFileEntityList(businessFileEntityList); + } + + + return entity; + } +} diff --git a/service/src/main/java/com/hzya/frame/sys/buttonConfig/service/ISysButtonConfigService.java b/service/src/main/java/com/hzya/frame/sys/buttonConfig/service/ISysButtonConfigService.java deleted file mode 100644 index e239564d..00000000 --- a/service/src/main/java/com/hzya/frame/sys/buttonConfig/service/ISysButtonConfigService.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hzya.frame.sys.buttonConfig.service; - -import com.hzya.frame.sys.buttonConfig.entity.SysButtonConfigEntity; -import com.hzya.frame.basedao.service.IBaseService; -/** - * 按钮配置表(SysButtonConfig)表服务接口 - * - * @author makejava - * @since 2024-03-26 15:23:01 - */ -public interface ISysButtonConfigService extends IBaseService{ -} diff --git a/service/src/main/java/com/hzya/frame/sys/buttonConfig/service/impl/SysButtonConfigServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/buttonConfig/service/impl/SysButtonConfigServiceImpl.java deleted file mode 100644 index f26e8f16..00000000 --- a/service/src/main/java/com/hzya/frame/sys/buttonConfig/service/impl/SysButtonConfigServiceImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hzya.frame.sys.buttonConfig.service.impl; - -import com.hzya.frame.sys.buttonConfig.entity.SysButtonConfigEntity; -import com.hzya.frame.sys.buttonConfig.dao.ISysButtonConfigDao; -import com.hzya.frame.sys.buttonConfig.service.ISysButtonConfigService; -import org.springframework.stereotype.Service; -import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.Resource; -import com.hzya.frame.basedao.service.impl.BaseService; -/** - * 按钮配置表(SysButtonConfig)表服务实现类 - * - * @author makejava - * @since 2024-03-26 15:23:01 - */ -@Service(value = "sysButtonConfigService") -public class SysButtonConfigServiceImpl extends BaseService implements ISysButtonConfigService { - - private ISysButtonConfigDao sysButtonConfigDao; - - @Autowired - public void setSysButtonConfigDao(ISysButtonConfigDao dao) { - this.sysButtonConfigDao = dao; - this.dao = dao; - } -} diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/dao/ISysContrastTaskDao.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/dao/ISysContrastTaskDao.java new file mode 100644 index 00000000..76dae609 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/dao/ISysContrastTaskDao.java @@ -0,0 +1,25 @@ +package com.hzya.frame.sys.contrastTask.dao; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.contrastTask.entity.SaveBatchConTrastEntity; +import com.hzya.frame.sys.contrastTask.entity.SysContrastTaskEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.Collection; +import java.util.List; + +/** + * 对照任务表(sys_contrast_task: table)表数据库访问层 + * + * @author makejava + * @since 2023-08-08 16:33:54 + */ +public interface ISysContrastTaskDao extends IBaseDao { + + Integer truncateTable(String tableName); + + Integer saveBatchContrast(SaveBatchConTrastEntity saveBatchConTrastEntity); + + List dosql(String sql); +} + diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/dao/impl/SysContrastTaskDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/dao/impl/SysContrastTaskDaoImpl.java new file mode 100644 index 00000000..8b8f8d88 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/dao/impl/SysContrastTaskDaoImpl.java @@ -0,0 +1,41 @@ +package com.hzya.frame.sys.contrastTask.dao.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.contrastTask.entity.SaveBatchConTrastEntity; +import com.hzya.frame.sys.contrastTask.entity.SysContrastTaskEntity; +import com.hzya.frame.sys.contrastTask.dao.ISysContrastTaskDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + +/** + * 对照任务表(SysContrastTask)表数据库访问层 + * + * @author makejava + * @since 2023-08-08 16:33:58 + */ +@Repository("SysContrastTaskDaoImpl") +public class SysContrastTaskDaoImpl extends MybatisGenericDao implements ISysContrastTaskDao { + + @Override + public Integer truncateTable(String tableName) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "truncateTable", tableName); + return o; + + } + + @Override + public Integer saveBatchContrast(SaveBatchConTrastEntity saveBatchConTrastEntity) { + Integer o = super.insert(getSqlIdPrifx() + "saveBatchContrast", saveBatchConTrastEntity); + return o; + + } + + @Override + public List dosql(String sql) { + List o = (List) super.selectList(getSqlIdPrifx() + "dosql", sql); + return o; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/ReturnContrastDataDto.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/ReturnContrastDataDto.java new file mode 100644 index 00000000..9b303ba4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/ReturnContrastDataDto.java @@ -0,0 +1,75 @@ +package com.hzya.frame.sys.contrastTask.entity; + +import java.util.List; + +/** + * 对照任务返回对象 + * + * @author makejava + * @since 2023-08-08 16:33:59 + */ +public class ReturnContrastDataDto { + + + //id + private String id; + //编码 + private String code; + //名称 + private String name; + //纳税人识别号 + private String tin; + //手机号 + private String tel; + //身份证号 + private String ic; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTin() { + return tin; + } + + public void setTin(String tin) { + this.tin = tin; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getIc() { + return ic; + } + + public void setIc(String ic) { + this.ic = ic; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/ReturnContrastDto.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/ReturnContrastDto.java new file mode 100644 index 00000000..102ed697 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/ReturnContrastDto.java @@ -0,0 +1,58 @@ +package com.hzya.frame.sys.contrastTask.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.Date; +import java.util.List; + +/** + * 对照任务返回对象 + * + * @author makejava + * @since 2023-08-08 16:33:59 + */ +public class ReturnContrastDto { + + + //描述 + private String msg; + //状态 + private String status; + //状态 + private boolean flag; + //结果 + private List attribute; + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public boolean getFlag() { + return flag; + } + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public List getAttribute() { + return attribute; + } + + public void setAttribute(List attribute) { + this.attribute = attribute; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SaveBatchConTrastEntity.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SaveBatchConTrastEntity.java new file mode 100644 index 00000000..2c8b406b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SaveBatchConTrastEntity.java @@ -0,0 +1,125 @@ +package com.hzya.frame.sys.contrastTask.entity; + +import java.util.List; + +/** + * 对照任务返回对象 + * + * @author makejava + * @since 2023-08-08 16:33:59 + */ +public class SaveBatchConTrastEntity { + + + //表名 + private String tableName; + //userId + private String userId; + //具体数据 + private List detailData; + /** 左应用id */ + private String left_app_id; + /** 左应用编码 */ + private String left_app_code; + /** 左应用名称 */ + private String left_app_name; + /** 左接口ID */ + private String left_api_id; + /** 右应用id */ + private String right_app_id; + /** 右应用编码 */ + private String right_app_code; + /** 右应用名称 */ + private String right_app_name; + /** 右接口ID */ + private String right_api_id; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public List getDetailData() { + return detailData; + } + + public void setDetailData(List detailData) { + this.detailData = detailData; + } + + public String getLeft_app_id() { + return left_app_id; + } + + public void setLeft_app_id(String left_app_id) { + this.left_app_id = left_app_id; + } + + public String getLeft_app_code() { + return left_app_code; + } + + public void setLeft_app_code(String left_app_code) { + this.left_app_code = left_app_code; + } + + public String getLeft_app_name() { + return left_app_name; + } + + public void setLeft_app_name(String left_app_name) { + this.left_app_name = left_app_name; + } + + public String getLeft_api_id() { + return left_api_id; + } + + public void setLeft_api_id(String left_api_id) { + this.left_api_id = left_api_id; + } + + public String getRight_app_id() { + return right_app_id; + } + + public void setRight_app_id(String right_app_id) { + this.right_app_id = right_app_id; + } + + public String getRight_app_code() { + return right_app_code; + } + + public void setRight_app_code(String right_app_code) { + this.right_app_code = right_app_code; + } + + public String getRight_app_name() { + return right_app_name; + } + + public void setRight_app_name(String right_app_name) { + this.right_app_name = right_app_name; + } + + public String getRight_api_id() { + return right_api_id; + } + + public void setRight_api_id(String right_api_id) { + this.right_api_id = right_api_id; + } +} + diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.java new file mode 100644 index 00000000..aa14f3f7 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.java @@ -0,0 +1,211 @@ +package com.hzya.frame.sys.contrastTask.entity; + +import java.util.Date; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * 对照任务表(SysContrastTask)实体类 + * + * @author makejava + * @since 2023-08-08 16:33:59 + */ +public class SysContrastTaskEntity extends BaseEntity { + + /** + * 主键ID + */ + private String id; + /** + * 服务名称 + */ + private String serviceName; + /** + * 左应用id + */ + private String leftAppId; + /** + * 左接口ID + */ + private String leftApiId; + /** + * 右应用id + */ + private String rightAppId; + /** + * 右接口ID + */ + private String rightApiId; + /** + * 任务状态 1、待执行 2、执行中 3、执行完成 4、执行失败 + */ + private String taskStatus; + /** + * 任务描述 + */ + private String taskMsg; + /** + * 排序 + */ + private Long sorts; + /** + * 创建人id + */ + private String createUserId; + /** + * 创建时间 + */ + private Date createTime; + /** + * 修改人id + */ + private String modifyUserId; + /** + * 修改时间 + */ + private Date modifyTime; + /** + * 状态(Y正常N删除) + */ + private String sts; + /** + * 组织机构ID + */ + private String orgId; + /** + * 匹配方式 1、按名称 2、按编码 + */ + private String matchMode; + + public String getMatchMode() { + return matchMode; + } + + public void setMatchMode(String matchMode) { + this.matchMode = matchMode; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getLeftAppId() { + return leftAppId; + } + + public void setLeftAppId(String leftAppId) { + this.leftAppId = leftAppId; + } + + public String getLeftApiId() { + return leftApiId; + } + + public void setLeftApiId(String leftApiId) { + this.leftApiId = leftApiId; + } + + public String getRightAppId() { + return rightAppId; + } + + public void setRightAppId(String rightAppId) { + this.rightAppId = rightAppId; + } + + public String getRightApiId() { + return rightApiId; + } + + public void setRightApiId(String rightApiId) { + this.rightApiId = rightApiId; + } + + public String getTaskStatus() { + return taskStatus; + } + + public void setTaskStatus(String taskStatus) { + this.taskStatus = taskStatus; + } + + public String getTaskMsg() { + return taskMsg; + } + + public void setTaskMsg(String taskMsg) { + this.taskMsg = taskMsg; + } + + public Long getSorts() { + return sorts; + } + + public void setSorts(Long sorts) { + this.sorts = sorts; + } + + public String getCreateUserId() { + return createUserId; + } + + public void setCreateUserId(String createUserId) { + this.createUserId = createUserId; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getModifyUserId() { + return modifyUserId; + } + + public void setModifyUserId(String modifyUserId) { + this.modifyUserId = modifyUserId; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public String getSts() { + return sts; + } + + public void setSts(String sts) { + this.sts = sts; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + + +} + diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml new file mode 100644 index 00000000..67e6d489 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id + ,service_name + ,left_app_id + ,left_api_id + ,right_app_id + ,right_api_id + ,task_status + ,task_msg + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,match_mode + + + + + + + + + + + + + + + + insert into sys_contrast_task( + + id , + service_name , + left_app_id , + left_api_id , + right_app_id , + right_api_id , + task_status , + task_msg , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + match_mode , + sorts, + sts, + + )values( + + #{id} , + #{serviceName} , + #{leftAppId} , + #{leftApiId} , + #{rightAppId} , + #{rightApiId} , + #{taskStatus} , + #{taskMsg} , + #{sorts} , + #{createUserId} , + #{createTime} , + #{modifyUserId} , + #{modifyTime} , + #{sts} , + #{orgId} , + #{matchMode} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_contrast_task a WHERE + a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into sys_contrast_task(id, service_name, left_app_id, left_api_id, right_app_id, right_api_id, + task_status, task_msg, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, match_mode, + sts) + values + + (#{entity.id},#{entity.serviceName},#{entity.leftAppId},#{entity.leftApiId},#{entity.rightAppId},#{entity.rightApiId},#{entity.taskStatus},#{entity.taskMsg},#{entity.sorts},#{entity.createUserId},#{entity.createTime},#{entity.modifyUserId},#{entity.modifyTime},#{entity.sts},#{entity.orgId},#{entity.matchMode}, + 'Y') + + + + + insert into sys_contrast_task(id, service_name, left_app_id, left_api_id, right_app_id, right_api_id, + task_status, task_msg, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, match_mode) + values + + (#{entity.id}, #{entity.serviceName}, #{entity.leftAppId}, #{entity.leftApiId}, #{entity.rightAppId}, + #{entity.rightApiId}, #{entity.taskStatus}, #{entity.taskMsg}, #{entity.sorts}, #{entity.createUserId}, + #{entity.createTime}, #{entity.modifyUserId}, #{entity.modifyTime}, #{entity.sts}, #{entity.orgId}, + #{entity.matchMode}) + + on duplicate key update + id = values(id), + service_name = values(service_name), + left_app_id = values(left_app_id), + left_api_id = values(left_api_id), + right_app_id = values(right_app_id), + right_api_id = values(right_api_id), + task_status = values(task_status), + task_msg = values(task_msg), + sorts = values(sorts), + 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), + match_mode = values(match_mode) + + + + update sys_contrast_task set + + id = #{id}, + service_name = #{serviceName}, + left_app_id = #{leftAppId}, + left_api_id = #{leftApiId}, + right_app_id = #{rightAppId}, + right_api_id = #{rightApiId}, + task_status = #{taskStatus}, + task_msg = #{taskMsg}, + sorts = #{sorts}, + create_user_id = #{createUserId}, + create_time = #{createTime}, + modify_user_id = #{modifyUserId}, + modify_time = #{modifyTime}, + sts = #{sts}, + org_id = #{orgId}, + match_mode = #{matchMode}, + + where id = #{id} + + + +update sys_contrast_task set sts= 'N' +where id = #{id} + + + + update sys_contrast_task set sts= 'N' + + or id = #{id} + or service_name = #{serviceName} + or left_app_id = #{leftAppId} + or left_api_id = #{leftApiId} + or right_app_id = #{rightAppId} + or right_api_id = #{rightApiId} + or task_status = #{taskStatus} + or task_msg = #{taskMsg} + or sorts = #{sorts} + or create_user_id = #{createUserId} + or create_time = #{createTime} + or modify_user_id = #{modifyUserId} + or modify_time = #{modifyTime} + or sts = #{sts} + or org_id = #{orgId} + or match_mode = #{matchMode} + and sts='Y' + + + + + delete from sys_contrast_task where id = #{id} + + + + + + + + insert into ${tableName} ( + id, + left_app_id, + left_app_code, + left_app_name, + left_api_id, + left_id, + left_code, + left_name, + left_tin, + left_tin, + left_tel, + left_ic, + + right_app_id, + right_app_code, + right_app_name, + right_api_id, + right_id, + right_code, + right_name, + right_tin, + right_tin, + right_tel, + right_ic, + + sorts, + create_user_id, + create_time, + modify_user_id, + modify_time, + sts + ) + values + + ( + #{entity.id}, + #{left_app_id}, + #{left_app_code}, + #{left_app_name}, + #{left_api_id}, + #{entity.left_id}, + #{entity.left_code}, + #{entity.left_name}, + #{entity.left_tin}, + #{entity.left_tin}, + #{entity.left_tel}, + #{entity.left_ic}, + #{right_app_id}, + #{right_app_code}, + #{right_app_name}, + #{right_api_id}, + #{entity.right_id}, + #{entity.right_code}, + #{entity.right_name}, + #{entity.right_tin}, + #{entity.right_tin}, + #{entity.right_tel}, + #{entity.right_tel}, + #{entity.sorts}, + #{userId}, + now(), + #{userId}, + now(), + 'Y' + ) + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/service/ISysContrastTaskService.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/service/ISysContrastTaskService.java new file mode 100644 index 00000000..c0f42460 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/service/ISysContrastTaskService.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sys.contrastTask.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.contrastTask.entity.SysContrastTaskEntity; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + +/** + * 对照任务表(SysContrastTask)表服务接口 + * + * @author makejava + * @since 2023-08-08 16:34:00 + */ +public interface ISysContrastTaskService extends IBaseService { + void doContrastTask(SysContrastTaskEntity sysContrastTaskEntity); + + + + /** + * @Author lvleigang + * @Description 对照数据 + * @Date 4:59 下午 2023/7/10 + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity controlData(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/service/impl/SysContrastTaskServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/contrastTask/service/impl/SysContrastTaskServiceImpl.java new file mode 100644 index 00000000..c778ae83 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/service/impl/SysContrastTaskServiceImpl.java @@ -0,0 +1,484 @@ +package com.hzya.frame.sys.contrastTask.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sys.app.dao.ISysAppMapper; +import com.hzya.frame.sys.app.entity.SysApp; +import com.hzya.frame.sys.contrastTask.entity.ReturnContrastDataDto; +import com.hzya.frame.sys.contrastTask.entity.ReturnContrastDto; +import com.hzya.frame.sys.contrastTask.entity.SaveBatchConTrastEntity; +import com.hzya.frame.sys.contrastTask.entity.SysContrastTaskEntity; +import com.hzya.frame.sys.contrastTask.dao.ISysContrastTaskDao; +import com.hzya.frame.sys.contrastTask.service.ISysContrastTaskService; +import com.hzya.frame.sys.customerControl.entity.CustomerControlEntity; +import com.hzya.frame.sys.orgControl.entity.OrgControlEntity; +import com.hzya.frame.sys.personnelControl.entity.PersonnelControlEntity; +import com.hzya.frame.sys.projectControl.entity.ProjectControlEntity; +import com.hzya.frame.sys.service.IExcApiService; +import com.hzya.frame.sys.supplierControl.entity.SupplierControlEntity; +import com.hzya.frame.sys.template.dao.ITemplateMapper; +import com.hzya.frame.sys.template.entity.Template; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.lang3.ArrayUtils; +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.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 对照任务表(SysContrastTask)表服务实现类 + * + * @author makejava + * @since 2023-08-08 16:34:01 + */ +@Service("sysContrastTaskService") +public class SysContrastTaskServiceImpl extends BaseService implements ISysContrastTaskService { + + private ISysContrastTaskDao sysContrastTaskDao; + @Resource + private IExcApiService excApiService; + + @Resource + private ISysAppMapper sysAppMapper; + @Resource + protected ITemplateMapper templateMapper;//模版表 + + @Autowired + public void setSysContrastTaskDao(ISysContrastTaskDao dao) { + this.sysContrastTaskDao = dao; + this.dao = dao; + } + + /** + * @param sysContrastTaskEntity + * @return void + * @Author lvleigang + * @Description 执行对照任务 + * @Date 10:49 上午 2023/8/9 + **/ + @Override + public void doContrastTask(SysContrastTaskEntity sysContrastTaskEntity) { + //获取左接口数据,如果左接口数据不存在不执行 + logger.info(Thread.currentThread().getName() + "对照任务执行开始:" + sysContrastTaskEntity.toString()); + //1、修改任务执行状态 + updateContrastTask("2", "执行中", sysContrastTaskEntity); + //2、清空原对比表数据 + //获取对应的服务 + //判断服务是否存在 + Template template = new Template(); + template.setServiceName(sysContrastTaskEntity.getServiceName()); + template.setSts("Y"); + List