Merge remote-tracking branch 'origin/sw' into sw
This commit is contained in:
commit
bdbcd96bf4
|
@ -23,7 +23,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务数据同步
|
||||
* 未定合同号
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.hzya.frame.plugin.businessData.dao;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.businessData.entity.BusinessEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户档案(mdm_customer: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public interface IBusinessDao extends IBaseDao<BusinessEntity, String> {
|
||||
|
||||
List<JSONObject> queryData(JSONObject saveData);
|
||||
|
||||
int saveData(JSONObject saveData);
|
||||
|
||||
int saveDetailData(JSONObject saveDetailData);
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.hzya.frame.plugin.businessData.dao.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.businessData.dao.IBusinessDao;
|
||||
import com.hzya.frame.plugin.businessData.entity.BusinessEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class BusinessDaoImpl extends MybatisGenericDao<BusinessEntity, String> implements IBusinessDao {
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryData(JSONObject saveData) {
|
||||
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryData", saveData);
|
||||
return o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveData(JSONObject saveData) {
|
||||
return super.insert(getSqlIdPrifx() + "saveData", saveData);
|
||||
}
|
||||
@Override
|
||||
public int saveDetailData(JSONObject saveData) {
|
||||
return super.insert(getSqlIdPrifx() + "saveDetailData", saveData);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.hzya.frame.plugin.businessData.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class BusinessEntity extends BaseEntity {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.plugin.businessData.dao.impl.BusinessDaoImpl">
|
||||
|
||||
<select id="queryData" resultType="com.alibaba.fastjson.JSONObject" parameterType="com.alibaba.fastjson.JSONObject">
|
||||
select
|
||||
*
|
||||
from mdm_ccd
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="field0011 != null and field0011 != ''"> and field0011 = #{field0011} </if>
|
||||
and sts = 'Y' and data_status != 'N'
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="saveData" parameterType="com.alibaba.fastjson.JSONObject">
|
||||
insert into mdm_ccd(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="document_rule != null and document_rule != ''"> document_rule , </if>
|
||||
<if test="document_rule_num != null"> document_rule_num , </if>
|
||||
<if test="data_status != null and data_status != ''"> data_status , </if>
|
||||
<if test="add_status != null and add_status != ''"> add_status , </if>
|
||||
<if test="update_status != null and update_status != ''"> update_status , </if>
|
||||
<if test="delete_status != null and delete_status != ''"> delete_status , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="field0011 != null and field0011 != ''"> field0011 , </if>
|
||||
<if test="field0001 != null and field0001 != ''"> field0001 , </if>
|
||||
<if test="field0002 != null and field0002 != ''"> field0002 , </if>
|
||||
<if test="field0012 != null and field0012 != ''"> field0012 , </if>
|
||||
<if test="field0013 != null and field0013 != ''"> field0013 , </if>
|
||||
<if test="field0014 != null and field0014 != ''"> field0014 , </if>
|
||||
<if test="field0003 != null and field0003 != ''"> field0003 , </if>
|
||||
<if test="field0015 != null and field0015 != ''"> field0015 , </if>
|
||||
<if test="field0016 != null and field0016 != ''"> field0016 , </if>
|
||||
<if test="field0017 != null and field0017 != ''"> field0017 , </if>
|
||||
<if test="field0018 != null and field0018 != ''"> field0018 , </if>
|
||||
<if test="field0019 != null and field0019 != ''"> field0019 , </if>
|
||||
<if test="field0020 != null and field0020 != ''"> field0020 , </if>
|
||||
<if test="field0021 != null and field0021 != ''"> field0021 , </if>
|
||||
|
||||
</trim>
|
||||
)values
|
||||
(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> #{id} , </if>
|
||||
<if test="document_rule != null and document_rule != ''"> #{document_rule} , </if>
|
||||
<if test="document_rule_num != null"> #{document_rule_num} , </if>
|
||||
<if test="data_status != null and data_status != ''"> #{data_status} , </if>
|
||||
<if test="add_status != null and add_status != ''"> #{add_status} , </if>
|
||||
<if test="update_status != null and update_status != ''"> #{update_status} , </if>
|
||||
<if test="delete_status != null and delete_status != ''"> #{delete_status} , </if>
|
||||
<if test="sorts != null"> #{sorts} , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} , </if>
|
||||
<if test="create_time != null"> #{create_time} , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} , </if>
|
||||
<if test="modify_time != null"> #{modify_time} , </if>
|
||||
<if test="sts != null and sts != ''"> #{sts} , </if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} , </if>
|
||||
<if test="companyId != null and companyId != ''"> #{company_id} , </if>
|
||||
<if test="field0011 != null and field0011 != ''"> #{field0011} , </if>
|
||||
<if test="field0001 != null and field0001 != ''"> #{field0001} , </if>
|
||||
<if test="field0002 != null and field0002 != ''"> #{field0002} , </if>
|
||||
<if test="field0012 != null and field0012 != ''"> #{field0012} , </if>
|
||||
<if test="field0013 != null and field0013 != ''"> #{field0013} , </if>
|
||||
<if test="field0014 != null and field0014 != ''"> #{field0014} , </if>
|
||||
<if test="field0003 != null and field0003 != ''"> #{field0003} , </if>
|
||||
<if test="field0015 != null and field0015 != ''"> #{field0015} , </if>
|
||||
<if test="field0016 != null and field0016 != ''"> #{field0016} , </if>
|
||||
<if test="field0017 != null and field0017 != ''"> #{field0017} , </if>
|
||||
<if test="field0018 != null and field0018 != ''"> #{field0018} , </if>
|
||||
<if test="field0019 != null and field0019 != ''"> #{field0019} , </if>
|
||||
<if test="field0020 != null and field0020 != ''"> #{field0020} , </if>
|
||||
<if test="field0021 != null and field0021 != ''"> #{field0021} , </if>
|
||||
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<insert id="saveDetailData" parameterType="com.alibaba.fastjson.JSONObject">
|
||||
insert into mdm_ccd_detail(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="formmain_id != null and formmain_id != ''"> formmain_id , </if>
|
||||
<if test="data_status != null and data_status != ''"> data_status , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="field0004 != null and field0004 != ''"> field0004 , </if>
|
||||
<if test="field0005 != null and field0005 != ''"> field0005 , </if>
|
||||
<if test="field0022 != null and field0022 != ''"> field0022 , </if>
|
||||
<if test="field0008 != null and field0008 != ''"> field0008 , </if>
|
||||
<if test="field0006 != null and field0006 != ''"> field0006 , </if>
|
||||
<if test="field0007 != null and field0007 != ''"> field0007 , </if>
|
||||
<if test="field0009 != null and field0009 != ''"> field0009 , </if>
|
||||
</trim>
|
||||
)values
|
||||
(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''"> #{id} , </if>
|
||||
<if test="formmain_id != null and formmain_id != ''"> #{formmain_id} , </if>
|
||||
<if test="data_status != null and data_status != ''"> #{data_status}, </if>
|
||||
<if test="sorts != null"> #{sorts} , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} , </if>
|
||||
<if test="create_time != null"> #{create_time} , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} , </if>
|
||||
<if test="modify_time != null"> #{modify_time} , </if>
|
||||
<if test="sts != null and sts != ''"> #{sts} , </if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} , </if>
|
||||
<if test="companyId != null and companyId != ''"> #{company_id} , </if>
|
||||
<if test="field0004 != null and field0004 != ''"> #{field0004} , </if>
|
||||
<if test="field0005 != null and field0005 != ''"> #{field0005} , </if>
|
||||
<if test="field0022 != null and field0022 != ''"> #{field0022} , </if>
|
||||
<if test="field0008 != null and field0008 != ''"> #{field0008} , </if>
|
||||
<if test="field0006 != null and field0006 != ''"> #{field0006} , </if>
|
||||
<if test="field0007 != null and field0007 != ''"> #{field0007} , </if>
|
||||
<if test="field0009 != null and field0009 != ''"> #{field0009} , </if>
|
||||
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.hzya.frame.plugin.businessData.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.businessData.service.IBusinessService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 主数据同步
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class BusinessPluginInitializer extends PluginBaseEntity{
|
||||
Logger logger = LoggerFactory.getLogger(BusinessPluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private IBusinessService businessService;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "BusinessPlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "BusinessPlugin插件";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "BusinessPlugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行主数据信息同步========");
|
||||
return businessService.getBusinessData(requestJson);
|
||||
}catch (Exception e){
|
||||
logger.info("======执行主数据同步失败:{}========",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.plugin.businessData.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.plugin.businessData.entity.BusinessEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public interface IBusinessService extends IBaseService<BusinessEntity, String> {
|
||||
JsonResultEntity getBusinessData(JSONObject requestJson);
|
||||
SysExtensionApiEntity setData(SysExtensionApiEntity entity) throws Exception;
|
||||
}
|
|
@ -0,0 +1,664 @@
|
|||
package com.hzya.frame.plugin.businessData.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.plugin.businessData.dao.IBusinessDao;
|
||||
import com.hzya.frame.plugin.businessData.entity.BusinessEntity;
|
||||
import com.hzya.frame.plugin.businessData.service.IBusinessService;
|
||||
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.comparison.controlsLog.dao.impl.ControlsLogDaoImpl;
|
||||
import com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity;
|
||||
import com.hzya.frame.sysnew.comparison.dao.IComparisonDao;
|
||||
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
|
||||
import com.hzya.frame.uuid.UUIDLong;
|
||||
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.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.conn.ssl.NoopHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.TrustAllStrategy;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author makejava
|
||||
* @since 2024-06-21 13:52:35
|
||||
*/
|
||||
public class BusinessServiceImpl extends BaseService<BusinessEntity, String> implements IBusinessService {
|
||||
|
||||
private IBusinessDao businessDao;
|
||||
@Autowired
|
||||
private ControlsLogDaoImpl controlsLogDaoimpl;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IComparisonDao comparisonDao;
|
||||
@Autowired
|
||||
public void setBusinessCustomerDao(IBusinessDao dao) {
|
||||
this.businessDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public JsonResultEntity getBusinessData(JSONObject requestJson) {
|
||||
//
|
||||
// //1、调用token
|
||||
// String access_token = getToken();
|
||||
// if (access_token == null) {
|
||||
// return BaseResult.getFailureMessageEntity("token获取失败");
|
||||
// }
|
||||
// Date date = new Date();
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// String times = sdf.format(date);
|
||||
//times = "2025-02-08";//
|
||||
// //2、调用接口获取数据
|
||||
// String queryCursor = null;
|
||||
// String startDate = times+" 00:00:00";
|
||||
// String endDate = times+" 23:59:59";
|
||||
// JSONArray datalist = new JSONArray();
|
||||
// sendBusinessData(datalist, access_token, queryCursor, startDate, endDate);
|
||||
//
|
||||
// if(datalist != null && datalist.size() > 0){
|
||||
// for (int i = 0; i < datalist.size(); i++) {
|
||||
// JSONObject saveData = new JSONObject();
|
||||
// //3、对照数据
|
||||
// JSONObject jsonObject = datalist.getJSONObject(i);
|
||||
// //field0011 申请单号
|
||||
// String field0011 = jsonObject.getString("serialNumber");
|
||||
// if(field0011 == null || "".equals(field0011) ){
|
||||
// continue;
|
||||
// }
|
||||
// saveData.put("field0011",field0011);
|
||||
// //判断是否有这个数据
|
||||
// List<JSONObject> checkData = businessDao.queryData(saveData);
|
||||
// if(checkData != null && checkData.size() > 0){
|
||||
// continue;
|
||||
// }
|
||||
// saveData.put("id", String.valueOf(UUIDLong.longUUID()));
|
||||
// saveData.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
// saveData.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
// saveData.put("org_id", "0");
|
||||
// saveData.put("create_time", new Date());
|
||||
// saveData.put("modify_time", new Date());
|
||||
// saveData.put("sts", "Y");
|
||||
// saveData.put("data_status", "Y");//新增状态
|
||||
// saveData.put("add_status", "0");//新增状态
|
||||
// saveData.put("update_status", "1");//修改状态
|
||||
// saveData.put("delete_status", "1");//删除状态
|
||||
// ComparisonEntity comparisonEntityRule = new ComparisonEntity();
|
||||
// comparisonEntityRule.setRulePrefix("CCD");
|
||||
// comparisonEntityRule.setRuleMiddle("%Y-%m-%d");
|
||||
// comparisonEntityRule.setRuleSuffix(5);
|
||||
// comparisonEntityRule.setDbName("mdm_ccd");
|
||||
// ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule);
|
||||
// saveData.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则
|
||||
// saveData.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号
|
||||
// saveData.put("field0001",jsonObject.getString("applyUser"));//申请人
|
||||
// saveData.put("field0002",jsonObject.getString("jobNumber"));//申请人工号
|
||||
// String oaToken = getOAToken("");
|
||||
// JSONObject user = getUser(jsonObject.getString("jobNumber"),oaToken);
|
||||
// saveData.put("field0012",user.getString("orgPostName"));
|
||||
// saveData.put("field0013",user.getString("orgDepartmentName"));
|
||||
// saveData.put("field0014",user.getString("telNumber"));
|
||||
// saveData.put("field0003",jsonObject.getString("startDateTime"));// 出差时间
|
||||
// saveData.put("field0015",jsonObject.getString("documentType"));
|
||||
// saveData.put("field0017",jsonObject.getString("dayValOfDuration"));// 出差时长(天)
|
||||
// saveData.put("field0018",jsonObject.getString("extshifouzhanhuichucha_109372_807255447"));// 是否境外出差
|
||||
// saveData.put("field0019",jsonObject.getString("extshifouxuyaoapecka_109372_294746269"));// 是否需要APEC卡
|
||||
// saveData.put("field0020",jsonObject.getString("extshifoujingwaichucha_109372_295886206"));// 是否展会出差
|
||||
// saveData.put("field0021",jsonObject.getString("reason"));// 出差事由
|
||||
//
|
||||
// JSONArray detaildata = jsonObject.getJSONArray("businessDetailsSync");
|
||||
// if(detaildata != null && detaildata.size() > 0){
|
||||
// for (int i1 = 0; i1 < detaildata.size(); i1++) {
|
||||
// JSONObject saveDetailData = new JSONObject();
|
||||
// saveDetailData.put("field0004",detaildata.getJSONObject(i1).getString("startDateTime"));//明细表-出发时间
|
||||
// saveDetailData.put("field0005",detaildata.getJSONObject(i1).getString("stopDateTime"));//明细表-结束时间
|
||||
// saveDetailData.put("field0022",detaildata.getJSONObject(i1).getString("businessDuration"));//明细表-出差时长
|
||||
//
|
||||
// if(detaildata.getJSONObject(i1).getString("businessVehicle") != null){// 明细表-交通工具
|
||||
// if("0".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){
|
||||
// saveDetailData.put("field0008","飞机");
|
||||
// }
|
||||
// if("1".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){
|
||||
// saveDetailData.put("field0008","火车");
|
||||
// }
|
||||
// if("2".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){
|
||||
// saveDetailData.put("field0008","汽车");
|
||||
// }
|
||||
// if("3".equals(detaildata.getJSONObject(i1).getString("businessVehicle"))){
|
||||
// saveDetailData.put("field0008","轮船");
|
||||
// }
|
||||
// }
|
||||
// saveDetailData.put("field0006",detaildata.getJSONObject(i1).getString("departurePlace"));//明细表-出发地
|
||||
// saveDetailData.put("field0007",detaildata.getJSONObject(i1).getString("destination"));//明细表-目的地
|
||||
// saveDetailData.put("field0009",detaildata.getJSONObject(i1).getString("expectedCost"));//明细表-预计费用
|
||||
// saveData.put("field0016",detaildata.getJSONObject(i1).getString("destination"));// 出差城市
|
||||
//
|
||||
//
|
||||
// saveDetailData.put("id", String.valueOf(UUIDLong.longUUID()));
|
||||
// saveDetailData.put("formmain_id", saveData.getString("id"));
|
||||
// saveDetailData.put("data_status", "Y");//新增状态
|
||||
//
|
||||
// saveDetailData.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
// saveDetailData.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
// saveDetailData.put("org_id", "0");
|
||||
// saveDetailData.put("create_time", new Date());
|
||||
// saveDetailData.put("modify_time", new Date());
|
||||
// saveDetailData.put("sts", "Y");
|
||||
// businessDao.saveDetailData(saveDetailData);
|
||||
// }
|
||||
// }
|
||||
// businessDao.saveData(saveData);
|
||||
//
|
||||
// //5、保存写入日志
|
||||
// ControlsLogEntity controlsLogEntity=new ControlsLogEntity();
|
||||
// controlsLogEntity.setId(UUIDUtils.getUUID());
|
||||
// controlsLogEntity.setFormmainId(saveData.getString("id"));
|
||||
// controlsLogEntity.setSourceName("数智中台");
|
||||
// controlsLogEntity.setCode("800004");
|
||||
// controlsLogEntity.setSourceData(jsonObject.toString());
|
||||
// controlsLogEntity.setOptionType("接口新增");
|
||||
// controlsLogEntity.setOptionName("数智中台");
|
||||
// controlsLogEntity.setDbName("mdm_ccd_option_log");
|
||||
// controlsLogEntity.setDataType("1");
|
||||
// controlsLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
// controlsLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
// controlsLogEntity.setOrg_id("0");
|
||||
// controlsLogEntity.setRemark("插件新增");
|
||||
// controlsLogDaoimpl.saveControlsLog(saveData.getString("id"), "数智中台", "800004", jsonObject.toJSONString(), "接口新增", "数智中台", "mdm_ccd_option_log", "1","插件新增");
|
||||
// }
|
||||
// }
|
||||
// return BaseResult.getSuccessMessageEntity("处理成功");
|
||||
//}
|
||||
@Override
|
||||
public JsonResultEntity getBusinessData(JSONObject requestJson) {
|
||||
|
||||
//1、调用token
|
||||
String access_token = getToken();
|
||||
if (access_token == null) {
|
||||
return BaseResult.getFailureMessageEntity("token获取失败");
|
||||
}
|
||||
Date date = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String times = sdf.format(date);
|
||||
//2、调用接口获取数据
|
||||
Integer queryCursor = 1;
|
||||
String startDate = times+" 00:00:00";
|
||||
String endDate = times+" 23:59:59";
|
||||
JSONArray datalist = new JSONArray();
|
||||
sendBusinessData(datalist, access_token, queryCursor, startDate, endDate);
|
||||
|
||||
if(datalist != null && datalist.size() > 0){
|
||||
for (int i = 0; i < datalist.size(); i++) {
|
||||
JSONObject saveData = new JSONObject();
|
||||
//3、对照数据
|
||||
JSONObject jsonObject = datalist.getJSONObject(i);
|
||||
//field0011 申请单号
|
||||
String field0011 = jsonObject.getString("SerialNumber");
|
||||
if(field0011 == null || "".equals(field0011) ){
|
||||
continue;
|
||||
}
|
||||
saveData.put("field0011",field0011);
|
||||
//判断是否有这个数据
|
||||
List<JSONObject> checkData = businessDao.queryData(saveData);
|
||||
if(checkData != null && checkData.size() > 0){
|
||||
continue;
|
||||
}
|
||||
saveData.put("id", String.valueOf(UUIDLong.longUUID()));
|
||||
saveData.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveData.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveData.put("org_id", "0");
|
||||
saveData.put("create_time", new Date());
|
||||
saveData.put("modify_time", new Date());
|
||||
saveData.put("sts", "Y");
|
||||
saveData.put("data_status", "Y");//新增状态
|
||||
saveData.put("add_status", "0");//新增状态
|
||||
saveData.put("update_status", "1");//修改状态
|
||||
saveData.put("delete_status", "1");//删除状态
|
||||
ComparisonEntity comparisonEntityRule = new ComparisonEntity();
|
||||
comparisonEntityRule.setRulePrefix("CCD");
|
||||
comparisonEntityRule.setRuleMiddle("%Y-%m-%d");
|
||||
comparisonEntityRule.setRuleSuffix(5);
|
||||
comparisonEntityRule.setDbName("mdm_ccd");
|
||||
ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule);
|
||||
saveData.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则
|
||||
saveData.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号
|
||||
saveData.put("field0001",jsonObject.getString("ApplyUser"));//申请人
|
||||
saveData.put("field0002",jsonObject.getString("JobNumber"));//申请人工号
|
||||
String oaToken = getOAToken("");
|
||||
JSONObject user = getUser(jsonObject.getString("JobNumber"),oaToken);
|
||||
if(jsonObject.getString("ApplyUser") != null && !"".equals(jsonObject.getString("ApplyUser"))){
|
||||
saveData.put("field0001",jsonObject.getString("ApplyUser"));//申请人
|
||||
}else {
|
||||
saveData.put("field0001",user.getString("name"));//申请人
|
||||
}
|
||||
saveData.put("field0012",user.getString("orgPostName"));
|
||||
saveData.put("field0013",user.getString("orgDepartmentName"));
|
||||
saveData.put("field0014",user.getString("telNumber"));
|
||||
saveData.put("field0003",jsonObject.getString("StartDateTime"));// 出差时间
|
||||
saveData.put("field0015",jsonObject.getString("DocumentType"));
|
||||
saveData.put("field0017",jsonObject.getString("DayValOfDuration"));// 出差时长(天)
|
||||
if(jsonObject.getString("extshifouzhanhuichucha_109372_807255447") != null && "true".equals(jsonObject.getString("extshifouzhanhuichucha_109372_807255447"))){
|
||||
saveData.put("field0018","是");// 是否境外出差
|
||||
}else {
|
||||
saveData.put("field0018","否");// 是否境外出差
|
||||
}
|
||||
if(jsonObject.getString("extshifouxuyaoapecka_109372_294746269") != null && "true".equals(jsonObject.getString("extshifouxuyaoapecka_109372_294746269"))){
|
||||
saveData.put("field0019","是");// 是否需要APEC卡
|
||||
}else {
|
||||
saveData.put("field0019","否");// 是否需要APEC卡
|
||||
}
|
||||
if(jsonObject.getString("extshifoujingwaichucha_109372_295886206") != null && "true".equals(jsonObject.getString("extshifoujingwaichucha_109372_295886206"))){
|
||||
saveData.put("field0020","是");// 是否展会出差
|
||||
}else {
|
||||
saveData.put("field0020","否");// 是否展会出差
|
||||
}
|
||||
saveData.put("field0021",jsonObject.getString("Reason"));// 出差事由
|
||||
|
||||
JSONArray detaildata = jsonObject.getJSONArray("BusinessDetailsSync");
|
||||
if(detaildata != null && detaildata.size() > 0){
|
||||
for (int i1 = 0; i1 < detaildata.size(); i1++) {
|
||||
JSONObject saveDetailData = new JSONObject();
|
||||
saveDetailData.put("field0004",detaildata.getJSONObject(i1).getString("StartDateTime"));//明细表-出发时间
|
||||
saveDetailData.put("field0005",detaildata.getJSONObject(i1).getString("StopDateTime"));//明细表-结束时间
|
||||
saveDetailData.put("field0022",detaildata.getJSONObject(i1).getString("BusinessDuration"));//明细表-出差时长
|
||||
|
||||
if(detaildata.getJSONObject(i1).getString("BusinessVehicle") != null){// 明细表-交通工具
|
||||
if("0".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){
|
||||
saveDetailData.put("field0008","飞机");
|
||||
}
|
||||
if("1".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){
|
||||
saveDetailData.put("field0008","火车");
|
||||
}
|
||||
if("2".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){
|
||||
saveDetailData.put("field0008","汽车");
|
||||
}
|
||||
if("3".equals(detaildata.getJSONObject(i1).getString("BusinessVehicle"))){
|
||||
saveDetailData.put("field0008","轮船");
|
||||
}
|
||||
}
|
||||
saveDetailData.put("field0006",detaildata.getJSONObject(i1).getString("DeparturePlace"));//明细表-出发地
|
||||
saveDetailData.put("field0007",detaildata.getJSONObject(i1).getString("Destination"));//明细表-目的地
|
||||
saveDetailData.put("field0009",detaildata.getJSONObject(i1).getString("ExpectedCost"));//明细表-预计费用
|
||||
saveData.put("field0016",detaildata.getJSONObject(i1).getString("Destination"));// 出差城市
|
||||
|
||||
|
||||
saveDetailData.put("id", String.valueOf(UUIDLong.longUUID()));
|
||||
saveDetailData.put("formmain_id", saveData.getString("id"));
|
||||
saveDetailData.put("data_status", "Y");//新增状态
|
||||
|
||||
saveDetailData.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveDetailData.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
saveDetailData.put("org_id", "0");
|
||||
saveDetailData.put("create_time", new Date());
|
||||
saveDetailData.put("modify_time", new Date());
|
||||
saveDetailData.put("sts", "Y");
|
||||
businessDao.saveDetailData(saveDetailData);
|
||||
}
|
||||
}
|
||||
businessDao.saveData(saveData);
|
||||
|
||||
//5、保存写入日志
|
||||
ControlsLogEntity controlsLogEntity=new ControlsLogEntity();
|
||||
controlsLogEntity.setId(UUIDUtils.getUUID());
|
||||
controlsLogEntity.setFormmainId(saveData.getString("id"));
|
||||
controlsLogEntity.setSourceName("数智中台");
|
||||
controlsLogEntity.setCode("800004");
|
||||
controlsLogEntity.setSourceData(jsonObject.toString());
|
||||
controlsLogEntity.setOptionType("接口新增");
|
||||
controlsLogEntity.setOptionName("数智中台");
|
||||
controlsLogEntity.setDbName("mdm_ccd_option_log");
|
||||
controlsLogEntity.setDataType("1");
|
||||
controlsLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setOrg_id("0");
|
||||
controlsLogEntity.setRemark("插件新增");
|
||||
controlsLogDaoimpl.saveControlsLog(saveData.getString("id"), "数智中台", "800004", jsonObject.toJSONString(), "接口新增", "数智中台", "mdm_ccd_option_log", "1","插件新增");
|
||||
}
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("处理成功");
|
||||
}
|
||||
|
||||
//private void sendBusinessData(JSONArray datalist, String access_token, String queryCursor, String startDate, String endDate) {
|
||||
// String url = "https://openapi.italent.cn/AttendanceOpen/api/v1/Business/GetApprovalCompletedBusinessListByDate";
|
||||
// Map<String, String> headers = new HashMap<>();
|
||||
// headers.put("Authorization", "Bearer " + access_token);
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("startDate", startDate);
|
||||
// jsonObject.put("endDate", endDate);
|
||||
// jsonObject.put("pageSize", 100);
|
||||
// if (queryCursor != null) {
|
||||
// jsonObject.put("queryCursor", queryCursor);
|
||||
// }
|
||||
// String returndata = sendPost(url, headers, jsonObject.toString());
|
||||
//
|
||||
// if (returndata != null && JSONObject.isValidObject(returndata)) {
|
||||
// JSONObject dataJson = JSONObject.parseObject(returndata);
|
||||
// if(dataJson != null && dataJson.getString("code") != null && "200".equals( dataJson.getString("code"))){
|
||||
// JSONObject data = dataJson.getJSONObject("data");
|
||||
// if(data != null ){
|
||||
// JSONArray businessList = data.getJSONArray("businessList");
|
||||
// if(!data.getBoolean("isLastPage")){
|
||||
// queryCursor = data.getString("sortCursor");
|
||||
// sendBusinessData(datalist, access_token, queryCursor, startDate, endDate);
|
||||
// }
|
||||
// if(businessList != null && businessList.size() > 0){
|
||||
// datalist.addAll(businessList);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
private void sendBusinessData(JSONArray datalist, String access_token, Integer queryCursor, String startDate, String endDate) {
|
||||
String url = "https://openapi.italent.cn/AttendanceOpen/api/v1/Business/GetApprovalCompletedBusinessList";
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Authorization", "Bearer " + access_token);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("StartDate", startDate);
|
||||
jsonObject.put("EndDate", endDate);
|
||||
jsonObject.put("PageIndex", queryCursor);
|
||||
jsonObject.put("PageSize", 100);
|
||||
|
||||
String returndata = sendPost(url, headers, jsonObject.toString());
|
||||
|
||||
if (returndata != null && JSONObject.isValidObject(returndata)) {
|
||||
JSONObject dataJson = JSONObject.parseObject(returndata);
|
||||
if(dataJson != null && dataJson.getString("Code") != null && "200".equals( dataJson.getString("Code"))){
|
||||
JSONObject data = dataJson.getJSONObject("Data");
|
||||
if(data != null ){
|
||||
JSONArray businessList = data.getJSONArray("BusinessList");
|
||||
if(data.getInteger("Total") > queryCursor*100){
|
||||
queryCursor = queryCursor+1;
|
||||
sendBusinessData(datalist, access_token, queryCursor, startDate, endDate);
|
||||
}
|
||||
if(businessList != null && businessList.size() > 0){
|
||||
datalist.addAll(businessList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private JSONObject getUser(String usercode,String access_token) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String url = "https://swoa.sunwave.com.cn:9999/seeyon/rest/orgMembers/code/"+usercode+"?pageNo=0&pageSize=100";
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("token",access_token);
|
||||
|
||||
String returndata = sendGet(url, headers);
|
||||
if (returndata != null && JSONArray.isValidArray(returndata)) {
|
||||
JSONArray dataJson = JSONObject.parseArray(returndata);
|
||||
if(dataJson != null && dataJson.size() > 0){
|
||||
for (int i = 0; i < dataJson.size(); i++) {
|
||||
if(dataJson.getJSONObject(i).getString("code") != null && !"".equals(dataJson.getJSONObject(i).getString("code"))
|
||||
&& usercode.toLowerCase().equals(dataJson.getJSONObject(i).getString("code").toLowerCase())){
|
||||
jsonObject.put("telNumber",dataJson.getJSONObject(i).getString("telNumber"));
|
||||
jsonObject.put("orgDepartmentName",dataJson.getJSONObject(i).getString("orgDepartmentName"));
|
||||
jsonObject.put("orgPostName",dataJson.getJSONObject(i).getString("orgPostName"));
|
||||
jsonObject.put("name",dataJson.getJSONObject(i).getString("name"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
private String getOAToken(String name) {
|
||||
String url = "https://swoa.sunwave.com.cn:9999/seeyon/rest/token";
|
||||
Map<String, String> headers = null;
|
||||
String bodys = "{\"password\":\"64de4de7-23ce-4946-ac91-dd9e322d86e5\",\"userName\":\"beis\",\"loginName\":\""+name+"\"}";
|
||||
String tokenData = sendPost(url, headers, bodys);
|
||||
String access_token = null;
|
||||
if (tokenData != null && JSONObject.isValidObject(tokenData)) {
|
||||
JSONObject tokendataJson = JSONObject.parseObject(tokenData);
|
||||
if (tokendataJson != null && tokendataJson.getString("id") != null) {
|
||||
access_token = tokendataJson.getString("id");
|
||||
}
|
||||
}
|
||||
return access_token;
|
||||
}
|
||||
private String getToken() {
|
||||
String url = "https://openapi.italent.cn/token";
|
||||
Map<String, String> headers = null;
|
||||
String bodys = "{\"grant_type\":\"client_credentials\",\"app_key\":\"1CBEBF66FABD4A25A94DF8BB7B0074E7\",\"app_secret\":\"AEFCFCE92804440E89682A3B9FA9BBB8774DDF4FB812428AB7EC340C54CC472B\"}";
|
||||
String tokenData = sendPost(url, headers, bodys);
|
||||
String access_token = null;
|
||||
if (tokenData != null && JSONObject.isValidObject(tokenData)) {
|
||||
JSONObject tokendataJson = JSONObject.parseObject(tokenData);
|
||||
if (tokendataJson != null && tokendataJson.getString("access_token") != null) {
|
||||
access_token = tokendataJson.getString("access_token");
|
||||
}
|
||||
}
|
||||
return access_token;
|
||||
}
|
||||
|
||||
private String sendPost(String url, Map<String, String> headers, String bodys) {
|
||||
logger.info("url:"+url+"。bodys:"+bodys);
|
||||
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
CloseableHttpClient closeableHttpClient = HttpClients.custom()
|
||||
.setSSLContext(sslContext)
|
||||
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
|
||||
.build();
|
||||
HttpPost post = new HttpPost(url);
|
||||
CloseableHttpResponse response = null;
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).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();
|
||||
try {
|
||||
if (bodys != null && !"".equals(bodys)) {
|
||||
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
|
||||
entity.setContentType("application/json");
|
||||
post.setEntity(entity);
|
||||
}
|
||||
response = closeableHttpClient.execute(post);
|
||||
HttpEntity entity = response.getEntity();
|
||||
body.append(EntityUtils.toString(entity, "UTF-8"));
|
||||
logger.info("返回结果:" + body);
|
||||
} catch (Exception e) {
|
||||
logger.error("请求错误:" + e.getMessage());
|
||||
body = new StringBuilder();
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
logger.info("url:"+url+"。bodys:"+bodys+"。body"+body);
|
||||
|
||||
return body.toString();
|
||||
}
|
||||
private String sendGet(String url, Map<String, String> headers) {
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
CloseableHttpClient closeableHttpClient = HttpClients.custom()
|
||||
.setSSLContext(sslContext)
|
||||
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
|
||||
.build();
|
||||
// HttpClient
|
||||
HttpGet get = new HttpGet(url);
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(60000).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();
|
||||
|
||||
try {
|
||||
response = closeableHttpClient.execute(get);
|
||||
HttpEntity entity = response.getEntity();
|
||||
body.append(EntityUtils.toString(entity,"UTF-8"));
|
||||
logger.info("返回结果:" + body);
|
||||
} catch (Exception e) {
|
||||
logger.error("请求错误:" + e.getMessage());
|
||||
body.append(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
// 关闭响应对象
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
// 关闭响应对象
|
||||
if (closeableHttpClient != null) {
|
||||
closeableHttpClient.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return body.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* seeyon流程事件监听前置方法,绑定数据源
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public SysExtensionApiEntity setData(SysExtensionApiEntity entity) throws Exception {
|
||||
try {
|
||||
JSONObject sendBody = new JSONObject();
|
||||
String bodys = entity.getBodys();
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
JSONObject jsonObject = JSONObject.parseObject(bodys);
|
||||
String loginName = jsonObject.getString("field0002");
|
||||
String dataXml = getXml(jsonObject);
|
||||
//处理xml数据
|
||||
String oaToken = getOAToken(loginName);
|
||||
headers.put("token",oaToken);
|
||||
sendBody.put("token",oaToken);
|
||||
sendBody.put("loginName",loginName);
|
||||
sendBody.put("dataXml",dataXml);
|
||||
entity.setBodys(sendBody.toJSONString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
private String getXml(JSONObject jsonObject) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("<forms version=\"2.1\"><formExport><summary id=\"-3743349685075685398\" name=\"formmain_11769\"/><definitions><column id=\"field0011\" type=\"0\" name=\"申请单号\" isNullable=\"false\" length=\"100\"/><column id=\"field0001\" type=\"0\" name=\"申请人\" isNullable=\"false\" length=\"255\"/><column id=\"field0002\" type=\"0\" name=\"申请人工号\" isNullable=\"false\" length=\"255\"/><column id=\"field0012\" type=\"0\" name=\"申请人职位\" isNullable=\"false\" length=\"255\"/><column id=\"field0013\" type=\"0\" name=\"申请人部门\" isNullable=\"false\" length=\"255\"/><column id=\"field0014\" type=\"0\" name=\"申请人手机号\" isNullable=\"false\" length=\"255\"/><column id=\"field0003\" type=\"3\" name=\"出差时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0015\" type=\"0\" name=\"出差类型\" isNullable=\"false\" length=\"255\"/><column id=\"field0016\" type=\"0\" name=\"出差城市\" isNullable=\"false\" length=\"255\"/><column id=\"field0017\" type=\"4\" name=\"出差时长\" isNullable=\"false\" length=\"20\"/><column id=\"field0018\" type=\"0\" name=\"是否境外出差\" isNullable=\"false\" length=\"100\"/><column id=\"field0019\" type=\"0\" name=\"是否需要APEC卡\" isNullable=\"false\" length=\"100\"/><column id=\"field0020\" type=\"0\" name=\"是否展会出差\" isNullable=\"false\" length=\"100\"/><column id=\"field0021\" type=\"0\" name=\"出差事由\" isNullable=\"false\" length=\"255\"/></definitions><values>");
|
||||
stringBuffer.append("<column name=\"申请单号\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0011") != null?"<![CDATA["+jsonObject.getString("field0011")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"申请人\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0001") != null?"<![CDATA["+jsonObject.getString("field0001")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"申请人工号\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0002") != null?"<![CDATA["+jsonObject.getString("field0002")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"申请人职位\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0012") != null?"<![CDATA["+jsonObject.getString("field0012")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"申请人部门\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0013") != null?"<![CDATA["+jsonObject.getString("field0013")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"申请人手机号\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0014") != null?"<![CDATA["+jsonObject.getString("field0014")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"出差时间\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0003") != null?"<![CDATA["+jsonObject.getString("field0003")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"出差类型\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0015") != null?"<![CDATA["+jsonObject.getString("field0015")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"出差城市\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0016") != null?"<![CDATA["+jsonObject.getString("field0016")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"出差时长\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0017") != null?"<![CDATA["+jsonObject.getString("field0017")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"是否境外出差\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0018") != null?"<![CDATA["+jsonObject.getString("field0018")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"是否需要APEC卡\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0019") != null?"<![CDATA["+jsonObject.getString("field0019")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"是否展会出差\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0020") != null?"<![CDATA["+jsonObject.getString("field0020")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("<column name=\"出差事由\"><value>");
|
||||
stringBuffer.append(jsonObject.getString("field0021") != null?"<![CDATA["+jsonObject.getString("field0021")+"]]>":"");
|
||||
stringBuffer.append("</value></column>");
|
||||
stringBuffer.append("</values><subForms><subForm><definitions><column id=\"field0004\" type=\"2\" name=\"明细表-出发时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0005\" type=\"2\" name=\"明细表-结束时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0022\" type=\"4\" name=\"明细表-出差时长\" isNullable=\"false\" length=\"20\"/><column id=\"field0006\" type=\"0\" name=\"明细表-出发地\" isNullable=\"false\" length=\"255\"/><column id=\"field0007\" type=\"0\" name=\"明细表-目的地\" isNullable=\"false\" length=\"255\"/><column id=\"field0008\" type=\"0\" name=\"明细表-交通工具\" isNullable=\"false\" length=\"255\"/><column id=\"field0009\" type=\"4\" name=\"明细表-预计费用\" isNullable=\"false\" length=\"20\"/></definitions><values>");
|
||||
//处理明细
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("mdm_ccd_detail"));
|
||||
if(jsonArray != null&& jsonArray.size() > 0){
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject detailObject = jsonArray.getJSONObject(i);
|
||||
stringBuffer.append("<row>");
|
||||
stringBuffer.append("<column name=\"明细表-出发时间\"><value>").append(detailObject.getString("field0004") != null?"<![CDATA["+detailObject.getString("field0004")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"明细表-结束时间\"><value>").append(detailObject.getString("field0005") != null?"<![CDATA["+detailObject.getString("field0005")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"明细表-出差时长\"><value>").append(detailObject.getString("field0022") != null?"<![CDATA["+detailObject.getString("field0022")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"明细表-出发地\"><value>").append(detailObject.getString("field0006") != null?"<![CDATA["+detailObject.getString("field0006")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"明细表-目的地\"><value>").append(detailObject.getString("field0007") != null?"<![CDATA["+detailObject.getString("field0007")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"明细表-交通工具\"><value>").append(detailObject.getString("field0008") != null?"<![CDATA["+detailObject.getString("field0008")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("<column name=\"明细表-预计费用\"><value>").append(detailObject.getString("field0009") != null?"<![CDATA["+detailObject.getString("field0009")+"]]>":"").append("</value></column>");
|
||||
stringBuffer.append("</row>");
|
||||
}
|
||||
}
|
||||
stringBuffer.append("</values></subForm></subForms></formExport></forms>");
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -470,7 +470,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
}else {//执行正常下发
|
||||
|
||||
logger.info("==========开始执行正常主数据下发=============");
|
||||
//查询主数据
|
||||
MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity();
|
||||
queryMdmModuleEntity.setSts("Y");
|
||||
|
@ -509,13 +509,17 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
queryFildRule.setRuleCode("service");
|
||||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
|
||||
|
||||
//新增
|
||||
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//修改
|
||||
doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//删除
|
||||
doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
|
||||
if(mdmModuleEntities.get(i).getMdmCode()!= 10045L){
|
||||
//新增
|
||||
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//修改
|
||||
doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//删除
|
||||
doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
}else{
|
||||
logger.info("主数据编码为10045,已经在业务数据下发执行,主数据下发不执行");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -827,6 +831,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
/** body */
|
||||
String bodys = doObjects.get(i).toJSONString();
|
||||
if(scriptEntity != null && scriptEntity.getId() != null ){
|
||||
logger.info("=========开始执行正常主数据修改下发脚本,第一次==============");
|
||||
groovy.put("code",scriptEntity.getScriptCode());
|
||||
groovy.put("className",scriptEntity.getClassName());
|
||||
groovy.put("name",scriptEntity.getScriptName());
|
||||
|
@ -854,6 +859,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
headers.putAll(header);
|
||||
}
|
||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||
logger.info("=========正常主数据修改开始执行登录接口==============");
|
||||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
|
@ -874,12 +880,15 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
continue;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
logger.info("=======主数据正常修改下发登录返回数据:{}========",attritube.toJSONString());
|
||||
querys = getQuery(apiEntity,querys,attritube);
|
||||
headers = getHeaders(apiEntity,headers,attritube);
|
||||
bodys = getBodys(apiEntity,bodys,attritube);
|
||||
}
|
||||
//组装数据发送
|
||||
logger.info("=========开始执行主业务修改数据下发脚本,第二次==============");
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
logger.info("=====主数据修改下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||
if(jsonResultEntity.isFlag()){
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
|
||||
|
@ -911,7 +920,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
* @param mdmModuleDistributeEntities
|
||||
* @return void
|
||||
**/
|
||||
private void doAdd(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
|
||||
private void
|
||||
doAdd(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
|
||||
//查询一千条数据
|
||||
String mainDb = null;
|
||||
List<JSONObject> objects = new ArrayList<>();
|
||||
|
@ -1029,6 +1039,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
/** body */
|
||||
String bodys = doObjects.get(i).toJSONString();
|
||||
if(scriptEntity != null && scriptEntity.getId() != null ){
|
||||
logger.info("=========开始执行正常主数据新增下发脚本,第一次==============");
|
||||
groovy.put("code",scriptEntity.getScriptCode());
|
||||
groovy.put("className",scriptEntity.getClassName());
|
||||
groovy.put("name",scriptEntity.getScriptName());
|
||||
|
@ -1056,6 +1067,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
headers.putAll(header);
|
||||
}
|
||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||
logger.info("=========正常主数据新增开始执行登录接口==============");
|
||||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
|
@ -1076,15 +1088,19 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
continue;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
logger.info("=======主数据正常新增下发登录返回数据:{}========",attritube.toJSONString());
|
||||
querys = getQuery(apiEntity,querys,attritube);
|
||||
headers = getHeaders(apiEntity,headers,attritube);
|
||||
bodys = getBodys(apiEntity,bodys,attritube);
|
||||
}
|
||||
|
||||
//组装数据发送
|
||||
logger.info("=========开始执行主业务新增数据下发脚本,第二次==============");
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
logger.info("=====主数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||
if(jsonResultEntity.isFlag()){
|
||||
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
|
||||
logger.info("=========开始执行主数据新增返回脚本==============");
|
||||
JSONObject backScriptJson = new JSONObject();
|
||||
backScriptJson.put("data", jsonResultEntity.getAttribute());
|
||||
groovy.put("code", scriptEntity.getScriptCode()+"back");
|
||||
|
@ -1124,11 +1140,13 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||
objects.get(i).put("sendsanfzt123",true);
|
||||
logger.info("========主数据新增下发完成,日志保存为成功============");
|
||||
continue;
|
||||
}else {
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||
objects.get(i).put("sendsanfzt123",false);
|
||||
logger.info("========主数据新增下发完成,日志保存为失败============");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.hzya.frame.plugin.projectMainFlow.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IProjectMainFlowDao extends IBaseDao<ProjectMainFlowEntity,String> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 查询审定完成节点得项目主流程档案
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2025-01-06 16:50
|
||||
* **/
|
||||
List<ProjectMainFlowEntity> queryProjectMainFlowAudit(ProjectMainFlowEntity projectMainFlowEntity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 查询归档节点得项目主流程档案
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2025-01-06 16:50
|
||||
* **/
|
||||
List<ProjectMainFlowEntity> queryProjectMainFlowArchivist(ProjectMainFlowEntity projectMainFlowEntity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 更新项目主流程审定和归档推送标识和结果
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2025-01-08 11:48
|
||||
* **/
|
||||
Integer updateProjectMainFlow(ProjectMainFlowEntity projectMainFlowEntity);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.hzya.frame.plugin.projectMainFlow.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao;
|
||||
import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ProjectMainFlowDaoImpl extends MybatisGenericDao<ProjectMainFlowEntity,String> implements IProjectMainFlowDao {
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<ProjectMainFlowEntity> queryProjectMainFlowAudit(ProjectMainFlowEntity entity) {
|
||||
return (List<ProjectMainFlowEntity>)super.selectList("queryProjectMainFlowAudit",entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<ProjectMainFlowEntity> queryProjectMainFlowArchivist(ProjectMainFlowEntity entity) {
|
||||
return (List<ProjectMainFlowEntity>)super.selectList("queryProjectMainFlowArchivist",entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public Integer updateProjectMainFlow(ProjectMainFlowEntity entity) {
|
||||
return super.update("updateProjectMainFlow",entity);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,287 @@
|
|||
package com.hzya.frame.plugin.projectMainFlow.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
public class ProjectMainFlowEntity extends BaseEntity {
|
||||
private String completemoney;//F完工服务额
|
||||
private String def2;//F完工辅材额公司
|
||||
private String def3;//F完工辅材额自购
|
||||
private String completedate;//完工完成时间
|
||||
private String def4;//F实际完工日期
|
||||
private String auditmoney;//J审定服务金额
|
||||
private String def5;//J审定辅材额公司
|
||||
private String def6;//J审定辅材额自购
|
||||
private String auditdate;//审计完成时间
|
||||
private String pinspectiondate;//H实际初验日期
|
||||
private String def1;//I终验日期
|
||||
|
||||
private String ts;//时间
|
||||
private String pkGroup;//集团编码
|
||||
private String pkOrg;//公司编码
|
||||
private String contractno;//合同号编码
|
||||
private String contractname;//合同档案名称
|
||||
private String creator;//创建人
|
||||
private String creationtime;//创建时间
|
||||
private String projectno;//项目号
|
||||
private String completepersion;//完工填单人
|
||||
private String pinspectionmoney;//初验金额
|
||||
private String pinspectionpersion;//初验填单人
|
||||
private String auditpersion;//审计填单人
|
||||
private String forecastRevenue;//预估收入确认
|
||||
private String vnote;//备注
|
||||
|
||||
private String auditStatus;//审定推送状态
|
||||
private String auditResult;//审定推送结果
|
||||
private String archivistResult;//归档推送结果
|
||||
private String archivistStatus;//归档推送状态
|
||||
private String def8;//完工服务额
|
||||
private String def7;//J审定服务金额
|
||||
|
||||
public String getDef8() {
|
||||
return def8;
|
||||
}
|
||||
|
||||
public void setDef8(String def8) {
|
||||
this.def8 = def8;
|
||||
}
|
||||
|
||||
public String getDef7() {
|
||||
return def7;
|
||||
}
|
||||
|
||||
public void setDef7(String def7) {
|
||||
this.def7 = def7;
|
||||
}
|
||||
|
||||
public String getCompletemoney() {
|
||||
return completemoney;
|
||||
}
|
||||
|
||||
public void setCompletemoney(String completemoney) {
|
||||
this.completemoney = completemoney;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public String getCompletedate() {
|
||||
return completedate;
|
||||
}
|
||||
|
||||
public void setCompletedate(String completedate) {
|
||||
this.completedate = completedate;
|
||||
}
|
||||
|
||||
public String getDef4() {
|
||||
return def4;
|
||||
}
|
||||
|
||||
public void setDef4(String def4) {
|
||||
this.def4 = def4;
|
||||
}
|
||||
|
||||
public String getAuditmoney() {
|
||||
return auditmoney;
|
||||
}
|
||||
|
||||
public void setAuditmoney(String auditmoney) {
|
||||
this.auditmoney = auditmoney;
|
||||
}
|
||||
|
||||
public String getDef5() {
|
||||
return def5;
|
||||
}
|
||||
|
||||
public void setDef5(String def5) {
|
||||
this.def5 = def5;
|
||||
}
|
||||
|
||||
public String getDef6() {
|
||||
return def6;
|
||||
}
|
||||
|
||||
public void setDef6(String def6) {
|
||||
this.def6 = def6;
|
||||
}
|
||||
|
||||
public String getAuditdate() {
|
||||
return auditdate;
|
||||
}
|
||||
|
||||
public void setAuditdate(String auditdate) {
|
||||
this.auditdate = auditdate;
|
||||
}
|
||||
|
||||
public String getPinspectiondate() {
|
||||
return pinspectiondate;
|
||||
}
|
||||
|
||||
public void setPinspectiondate(String pinspectiondate) {
|
||||
this.pinspectiondate = pinspectiondate;
|
||||
}
|
||||
|
||||
public String getDef1() {
|
||||
return def1;
|
||||
}
|
||||
|
||||
public void setDef1(String def1) {
|
||||
this.def1 = def1;
|
||||
}
|
||||
|
||||
public String getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(String ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
public String getPkGroup() {
|
||||
return pkGroup;
|
||||
}
|
||||
|
||||
public void setPkGroup(String pkGroup) {
|
||||
this.pkGroup = pkGroup;
|
||||
}
|
||||
|
||||
public String getPkOrg() {
|
||||
return pkOrg;
|
||||
}
|
||||
|
||||
public void setPkOrg(String pkOrg) {
|
||||
this.pkOrg = pkOrg;
|
||||
}
|
||||
|
||||
public String getContractno() {
|
||||
return contractno;
|
||||
}
|
||||
|
||||
public void setContractno(String contractno) {
|
||||
this.contractno = contractno;
|
||||
}
|
||||
|
||||
public String getContractname() {
|
||||
return contractname;
|
||||
}
|
||||
|
||||
public void setContractname(String contractname) {
|
||||
this.contractname = contractname;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getCreationtime() {
|
||||
return creationtime;
|
||||
}
|
||||
|
||||
public void setCreationtime(String creationtime) {
|
||||
this.creationtime = creationtime;
|
||||
}
|
||||
|
||||
public String getProjectno() {
|
||||
return projectno;
|
||||
}
|
||||
|
||||
public void setProjectno(String projectno) {
|
||||
this.projectno = projectno;
|
||||
}
|
||||
|
||||
public String getCompletepersion() {
|
||||
return completepersion;
|
||||
}
|
||||
|
||||
public void setCompletepersion(String completepersion) {
|
||||
this.completepersion = completepersion;
|
||||
}
|
||||
|
||||
public String getPinspectionmoney() {
|
||||
return pinspectionmoney;
|
||||
}
|
||||
|
||||
public void setPinspectionmoney(String pinspectionmoney) {
|
||||
this.pinspectionmoney = pinspectionmoney;
|
||||
}
|
||||
|
||||
public String getPinspectionpersion() {
|
||||
return pinspectionpersion;
|
||||
}
|
||||
|
||||
public void setPinspectionpersion(String pinspectionpersion) {
|
||||
this.pinspectionpersion = pinspectionpersion;
|
||||
}
|
||||
|
||||
public String getAuditpersion() {
|
||||
return auditpersion;
|
||||
}
|
||||
|
||||
public void setAuditpersion(String auditpersion) {
|
||||
this.auditpersion = auditpersion;
|
||||
}
|
||||
|
||||
public String getForecastRevenue() {
|
||||
return forecastRevenue;
|
||||
}
|
||||
|
||||
public void setForecastRevenue(String forecastRevenue) {
|
||||
this.forecastRevenue = forecastRevenue;
|
||||
}
|
||||
|
||||
public String getVnote() {
|
||||
return vnote;
|
||||
}
|
||||
|
||||
public void setVnote(String vnote) {
|
||||
this.vnote = vnote;
|
||||
}
|
||||
|
||||
public String getAuditStatus() {
|
||||
return auditStatus;
|
||||
}
|
||||
|
||||
public void setAuditStatus(String auditStatus) {
|
||||
this.auditStatus = auditStatus;
|
||||
}
|
||||
|
||||
public String getAuditResult() {
|
||||
return auditResult;
|
||||
}
|
||||
|
||||
public void setAuditResult(String auditResult) {
|
||||
this.auditResult = auditResult;
|
||||
}
|
||||
|
||||
public String getArchivistResult() {
|
||||
return archivistResult;
|
||||
}
|
||||
|
||||
public void setArchivistResult(String archivistResult) {
|
||||
this.archivistResult = archivistResult;
|
||||
}
|
||||
|
||||
public String getArchivistStatus() {
|
||||
return archivistStatus;
|
||||
}
|
||||
|
||||
public void setArchivistStatus(String archivistStatus) {
|
||||
this.archivistStatus = archivistStatus;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.plugin.projectMainFlow.dao.impl.ProjectMainFlowDaoImpl">
|
||||
<resultMap id="get-ProjectMainFlowEntity-result" type="com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity" >
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id = "ProjectMainFlowEntity_Base_Column_List">
|
||||
formmain_0219.id as id
|
||||
,'SW01' as pkGroup -- 集团编码
|
||||
,'666' as pkOrg -- 公司编码
|
||||
,field0274 as contractno -- 合同号
|
||||
,field0279 as contractname -- 合同名称
|
||||
,m4.name as creator -- 创建人
|
||||
,field0003 as creationtime -- 创建时间
|
||||
,field0007 as projectno -- 项目号
|
||||
,field0116 as completemoney -- 完工金额
|
||||
,field0294 as completedate -- 完工日期
|
||||
,m1.name as completepersion -- 完工填单人
|
||||
,field0149 as pinspectionmoney -- 初验金额
|
||||
,field0147 as pinspectiondate -- 初验时间
|
||||
,m2.name as pinspectionpersion -- 初验填单人
|
||||
,field0209 as auditmoney -- 审计金额
|
||||
,field0297 as auditdate -- 审计时间
|
||||
,m3.name as auditpersion -- 审计填单人
|
||||
,null as forecastRevenue -- 预估收入确认
|
||||
,field0138 as vnote -- 备注
|
||||
,field0120 as def8 -- 完工服务额
|
||||
,field0320 as def2 -- F完工辅材额公司
|
||||
,field0321 as def3 -- F完工辅材额自购
|
||||
,field0294 as completedate -- 完工完成时间
|
||||
,field0112 as def4 -- F实际完工日期
|
||||
,field0213 as def7 -- J审定服务金额
|
||||
,field0354 as def5 -- J审定辅材额公司
|
||||
,field0355 as def6 -- J审定辅材额自购
|
||||
,field0297 as auditdate -- 审计完成时间
|
||||
,field0147 as pinspectiondate -- H实际初验日期
|
||||
,field0161 as def1 -- I终验日期
|
||||
,field0427 as auditStatus -- 审定推送状态
|
||||
,field0428 as auditResult -- 审定推送结果
|
||||
,field0426 as archivistResult -- 归档推送结果
|
||||
,field0425 as archivistStatus -- 归档推送状态
|
||||
</sql>
|
||||
|
||||
<!--查询审计完成的数据,推送BIP新增-->
|
||||
<select id="queryProjectMainFlowAudit" resultMap="get-ProjectMainFlowEntity-result" parameterType = "com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity">
|
||||
select
|
||||
<include refid="ProjectMainFlowEntity_Base_Column_List" />
|
||||
from formmain_0219
|
||||
LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0219.id
|
||||
LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.object_id = COL_SUMMARY.id
|
||||
LEFT JOIN org_member m1 ON m1.id=field0108
|
||||
LEFT JOIN org_member m2 ON m2.id=field0159
|
||||
LEFT JOIN org_member m3 ON m3.id=field0237
|
||||
LEFT JOIN org_member m4 ON m4.id=field0081
|
||||
WHERE 1=1
|
||||
and CTP_AFFAIR.node_policy = '审计完成' AND CTP_AFFAIR.complete_time is not null
|
||||
and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0427 is null
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<!--查询归档节点的数据,推送BIP更新-->
|
||||
<select id="queryProjectMainFlowArchivist" resultMap="get-ProjectMainFlowEntity-result" parameterType = "com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity">
|
||||
select
|
||||
<include refid="ProjectMainFlowEntity_Base_Column_List" />
|
||||
from formmain_0219
|
||||
LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0219.id
|
||||
LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.object_id = COL_SUMMARY.id
|
||||
LEFT JOIN org_member m1 ON m1.id=field0108
|
||||
LEFT JOIN org_member m2 ON m2.id=field0159
|
||||
LEFT JOIN org_member m3 ON m3.id=field0237
|
||||
LEFT JOIN org_member m4 ON m4.id=field0081
|
||||
WHERE 1=1
|
||||
and CTP_AFFAIR.node_policy = '归档' AND CTP_AFFAIR.complete_time is not null
|
||||
and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0425 is null and formmain_0219.id='4000079310249084585'
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateProjectMainFlow" parameterType="com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity">
|
||||
update formmain_0219 set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="auditStatus != null and auditStatus != ''"> field0427 = #{auditStatus},</if>
|
||||
<if test="auditResult != null and auditResult != ''"> field0428 = #{auditResult},</if>
|
||||
<if test="archivistResult != null and archivistResult != ''"> field0426 = #{archivistResult},</if>
|
||||
<if test="archivistStatus != null and archivistStatus != ''"> field0425 = #{archivistStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
package com.hzya.frame.plugin.projectMainFlow.plugin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao;
|
||||
import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class ProjectMainFlowArchivistPluginInitializer extends PluginBaseEntity {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(ProjectMainFlowArchivistPluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private IProjectMainFlowDao projectMainFlowDao;
|
||||
|
||||
@Autowired
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
|
||||
@Value("${zt.url}")
|
||||
private String url;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "ProjectMainFlowArchivistPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "项目主流程审定";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "ProjectMainFlowArchivistPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行项目主流程归档推送BIP========");
|
||||
//重试方法
|
||||
if (null != requestJson) {
|
||||
//如果这个id不为空,说明是重试的
|
||||
String id = requestJson.getString("integration_task_living_details_id");
|
||||
//执行重新发送
|
||||
ProjectMainFlowEntity projectMainFlowEntity = new ProjectMainFlowEntity();
|
||||
projectMainFlowEntity.setDataSourceCode("SW-OA");
|
||||
if (StrUtil.isNotEmpty(id)) {
|
||||
projectMainFlowEntity.setId(id);
|
||||
}
|
||||
//查询审定之后数据
|
||||
List<ProjectMainFlowEntity> projectMainFlowEntities = projectMainFlowDao.queryProjectMainFlowArchivist(projectMainFlowEntity);
|
||||
if(projectMainFlowEntities == null || projectMainFlowEntities.size() == 0){
|
||||
logger.info("=====查询项目主流程归档数据有:{}条",projectMainFlowEntities.size());
|
||||
return BaseResult.getSuccessMessageEntity("查询成功");
|
||||
}
|
||||
for (ProjectMainFlowEntity mainFlowEntity : projectMainFlowEntities) {
|
||||
//组装数据
|
||||
JSONObject sendData = getSendData(mainFlowEntity);
|
||||
JSONObject tokenData = getBipTokenData();
|
||||
mainFlowEntity.setDataSourceCode("SW-OA");
|
||||
//获取TOKEN
|
||||
String tokenResult = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500003").
|
||||
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(tokenData.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("项目主流程归档BIPtoken返回结果:"+tokenResult);
|
||||
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
|
||||
if(!tokenResultJson.getBoolean("flag")){
|
||||
mainFlowEntity.setArchivistStatus("0");
|
||||
mainFlowEntity.setArchivistResult("执行失败,Token获取失败");
|
||||
projectMainFlowDao.updateProjectMainFlow(mainFlowEntity);
|
||||
continue;
|
||||
}
|
||||
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
|
||||
//发送数据
|
||||
String result = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500016").
|
||||
header("access_token", tokenBody).
|
||||
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(sendData.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("项目主流程归档之后返回结果:"+result);
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
if(!resultJson.getBoolean("flag")){
|
||||
mainFlowEntity.setArchivistStatus("0");
|
||||
mainFlowEntity.setArchivistResult("归档发送失败"+resultJson.getString("msg"));
|
||||
projectMainFlowDao.updateProjectMainFlow(mainFlowEntity);
|
||||
saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),false);
|
||||
}else {
|
||||
mainFlowEntity.setArchivistStatus("1");
|
||||
mainFlowEntity.setArchivistResult("归档发送成功");
|
||||
projectMainFlowDao.updateProjectMainFlow(mainFlowEntity);
|
||||
saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("=======项目主流程归档推送BIP执行成功=======");
|
||||
return BaseResult.getSuccessMessageEntity("项目主流程归档执行成功");
|
||||
} catch (Exception e) {
|
||||
logger.info("======执行项目主流程归档推送BIP失败:{}========", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return BaseResult.getFailureMessageEntity("项目主流程归档执行失败");
|
||||
}
|
||||
|
||||
|
||||
private JSONObject getBipTokenData() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
private JSONObject getSendData(ProjectMainFlowEntity projectMainFlowEntity) {
|
||||
JSONObject htdd01Master = new JSONObject();
|
||||
JSONObject bill = new JSONObject();
|
||||
JSONObject htdd01slave4_htdd01slave4 = new JSONObject();
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
htdd01Master.put("pk_group",projectMainFlowEntity.getPkGroup());
|
||||
htdd01Master.put("pk_org",projectMainFlowEntity.getPkOrg());
|
||||
htdd01Master.put("contractno",projectMainFlowEntity.getContractno());
|
||||
htdd01Master.put("name",projectMainFlowEntity.getContractname());
|
||||
// htdd01Master.put("creator",projectMainFlowEntity.getCreator());
|
||||
// htdd01Master.put("creationtime",projectMainFlowEntity.getCreationtime());
|
||||
|
||||
htdd01slave4_htdd01slave4.put("contractno",projectMainFlowEntity.getContractno());
|
||||
htdd01slave4_htdd01slave4.put("projectno",projectMainFlowEntity.getProjectno());
|
||||
htdd01slave4_htdd01slave4.put("completemoney",projectMainFlowEntity.getCompletemoney());
|
||||
htdd01slave4_htdd01slave4.put("completedate",projectMainFlowEntity.getCompletedate());
|
||||
htdd01slave4_htdd01slave4.put("completepersion",projectMainFlowEntity.getCompletepersion());
|
||||
htdd01slave4_htdd01slave4.put("pinspectionmoney",projectMainFlowEntity.getPinspectionmoney());
|
||||
htdd01slave4_htdd01slave4.put("pinspectiondate",projectMainFlowEntity.getPinspectiondate());
|
||||
htdd01slave4_htdd01slave4.put("pinspectionpersion",projectMainFlowEntity.getPinspectionpersion());
|
||||
htdd01slave4_htdd01slave4.put("auditmoney",projectMainFlowEntity.getAuditmoney());
|
||||
htdd01slave4_htdd01slave4.put("auditdate",projectMainFlowEntity.getAuditdate());
|
||||
htdd01slave4_htdd01slave4.put("auditpersion",projectMainFlowEntity.getAuditpersion());
|
||||
htdd01slave4_htdd01slave4.put("forecast_revenue",projectMainFlowEntity.getForecastRevenue());
|
||||
htdd01slave4_htdd01slave4.put("vnote",projectMainFlowEntity.getVnote());
|
||||
htdd01slave4_htdd01slave4.put("def1",projectMainFlowEntity.getDef1());
|
||||
htdd01slave4_htdd01slave4.put("def2",projectMainFlowEntity.getDef2());
|
||||
htdd01slave4_htdd01slave4.put("def3",projectMainFlowEntity.getDef3());
|
||||
htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4());
|
||||
htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5());
|
||||
htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6());
|
||||
htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7());
|
||||
htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8());
|
||||
jsonArray.add(htdd01slave4_htdd01slave4);
|
||||
bill.put("htdd01Master",htdd01Master);
|
||||
bill.put("htdd01slave4_htdd01slave4",jsonArray);
|
||||
return bill;
|
||||
}
|
||||
|
||||
|
||||
private void saveTaskLivingDetails(String rootAppPk,String rootAppBill,String rootAppNewData,String newTransmitInfo,boolean flag) {
|
||||
try {
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID());
|
||||
integrationTaskLivingDetailsEntity.setSts("Y");
|
||||
integrationTaskLivingDetailsEntity.setCreate_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setModify_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setCreate_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setModify_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setOrg_id("0");
|
||||
integrationTaskLivingDetailsEntity.setCompanyId("0");
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(rootAppBill);
|
||||
integrationTaskLivingDetailsEntity.setPluginId("ProjectMainFlowArchivistPluginInitializer");
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo);
|
||||
if(flag){
|
||||
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
|
||||
}else {
|
||||
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("保存日志到集成任务日志明细中失败:{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,211 @@
|
|||
package com.hzya.frame.plugin.projectMainFlow.plugin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.SendContract.entity.SendContractEntity;
|
||||
import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao;
|
||||
import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class ProjectMainFlowAuditPluginInitializer extends PluginBaseEntity {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(ProjectMainFlowAuditPluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private IProjectMainFlowDao projectMainFlowDao;
|
||||
|
||||
@Autowired
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
|
||||
@Value("${zt.url}")
|
||||
private String url;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "ProjectMainFlowAuditPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "项目主流程审定";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "ProjectMainFlowAuditPluginInitializer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
try {
|
||||
logger.info("======开始执行项目主流程审定完成之后推送BIP========");
|
||||
//重试方法
|
||||
if (null != requestJson) {
|
||||
//如果这个id不为空,说明是重试的
|
||||
String id = requestJson.getString("integration_task_living_details_id");
|
||||
//执行重新发送
|
||||
ProjectMainFlowEntity projectMainFlowEntity = new ProjectMainFlowEntity();
|
||||
projectMainFlowEntity.setDataSourceCode("SW-OA");
|
||||
if (StrUtil.isNotEmpty(id)) {
|
||||
projectMainFlowEntity.setId(id);
|
||||
}
|
||||
//查询审定之后数据
|
||||
List<ProjectMainFlowEntity> projectMainFlowEntities = projectMainFlowDao.queryProjectMainFlowAudit(projectMainFlowEntity);
|
||||
if(projectMainFlowEntities == null || projectMainFlowEntities.size() == 0){
|
||||
logger.info("=====查询项目主流程审定完成数据有:{}条",projectMainFlowEntities.size());
|
||||
return BaseResult.getSuccessMessageEntity("查询成功");
|
||||
}
|
||||
for (ProjectMainFlowEntity mainFlowEntity : projectMainFlowEntities) {
|
||||
//组装数据
|
||||
JSONObject sendData = getSendData(mainFlowEntity);
|
||||
JSONObject tokenData = new JSONObject();
|
||||
mainFlowEntity.setDataSourceCode("SW-OA");
|
||||
//获取TOKEN
|
||||
String tokenResult = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500003").
|
||||
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(tokenData.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("项目主流程审定之后BIPtoken返回结果:"+tokenResult);
|
||||
JSONObject tokenResultJson = JSONObject.parseObject(tokenResult);
|
||||
if(!tokenResultJson.getBoolean("flag")){
|
||||
mainFlowEntity.setAuditStatus("0");
|
||||
mainFlowEntity.setAuditResult("执行失败,Token获取失败");
|
||||
projectMainFlowDao.updateProjectMainFlow(mainFlowEntity);
|
||||
continue;
|
||||
}
|
||||
String tokenBody = tokenResultJson.getJSONObject("attribute").getJSONObject("data").getString("access_token");
|
||||
logger.info("====项目主流程审定请求参数======:{}",sendData.toJSONString());
|
||||
//发送数据
|
||||
String result = HttpRequest.post(url).
|
||||
header("appId", "800050").
|
||||
header("apiCode", "8000500016").
|
||||
header("access_token", tokenBody).
|
||||
header("publicKey", "ZJYAQ/VtQ66PqKXlV0EowrrlKkhBHYgS/Zk39Q5ezIQne51Ce7eDIk+3zDUT+v578prj").
|
||||
header("secretKey", "iLLk424Bmzknbu+ROeJoiVDMYY5EFXtbZY/aU13HmVYIiQrIw9c0Ag4ipxbfpUqqj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||
body(sendData.toString()).
|
||||
execute().
|
||||
body();
|
||||
logger.error("项目主流程审定之后返回结果:"+result);
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
if(!resultJson.getBoolean("flag")){
|
||||
mainFlowEntity.setAuditStatus("0");
|
||||
mainFlowEntity.setAuditResult("审定发送失败"+resultJson.getString("msg"));
|
||||
projectMainFlowDao.updateProjectMainFlow(mainFlowEntity);
|
||||
saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),false);
|
||||
}else {
|
||||
mainFlowEntity.setAuditStatus("1");
|
||||
mainFlowEntity.setAuditResult("审定发送成功");
|
||||
projectMainFlowDao.updateProjectMainFlow(mainFlowEntity);
|
||||
saveTaskLivingDetails(mainFlowEntity.getId(),mainFlowEntity.getId(),sendData.toString(),resultJson.toJSONString(),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("=======项目主流程审定完成之后推送BIP执行成功=======");
|
||||
return BaseResult.getSuccessMessageEntity("项目主流程审定执行成功");
|
||||
} catch (Exception e) {
|
||||
logger.info("======执行项目主流程审定完成之后推送BIP失败:{}========", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return BaseResult.getFailureMessageEntity("项目主流程审定执行失败");
|
||||
}
|
||||
|
||||
|
||||
private JSONObject getSendData(ProjectMainFlowEntity projectMainFlowEntity) {
|
||||
JSONObject htdd01Master = new JSONObject();
|
||||
JSONObject bill = new JSONObject();
|
||||
JSONObject htdd01slave4_htdd01slave4 = new JSONObject();
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
htdd01Master.put("pk_group",projectMainFlowEntity.getPkGroup());
|
||||
htdd01Master.put("pk_org",projectMainFlowEntity.getPkOrg());
|
||||
htdd01Master.put("contractno",projectMainFlowEntity.getContractno());
|
||||
htdd01Master.put("name",projectMainFlowEntity.getContractname());
|
||||
// htdd01Master.put("creator",projectMainFlowEntity.getCreator());
|
||||
// htdd01Master.put("creationtime",projectMainFlowEntity.getCreationtime());
|
||||
|
||||
htdd01slave4_htdd01slave4.put("contractno",projectMainFlowEntity.getContractno());
|
||||
htdd01slave4_htdd01slave4.put("projectno",projectMainFlowEntity.getProjectno());
|
||||
htdd01slave4_htdd01slave4.put("completemoney",projectMainFlowEntity.getCompletemoney());
|
||||
htdd01slave4_htdd01slave4.put("completedate",projectMainFlowEntity.getCompletedate());
|
||||
htdd01slave4_htdd01slave4.put("completepersion",projectMainFlowEntity.getCompletepersion());
|
||||
htdd01slave4_htdd01slave4.put("pinspectionmoney",projectMainFlowEntity.getPinspectionmoney());
|
||||
htdd01slave4_htdd01slave4.put("pinspectiondate",projectMainFlowEntity.getPinspectiondate());
|
||||
htdd01slave4_htdd01slave4.put("pinspectionpersion",projectMainFlowEntity.getPinspectionpersion());
|
||||
htdd01slave4_htdd01slave4.put("auditmoney",projectMainFlowEntity.getAuditmoney());
|
||||
htdd01slave4_htdd01slave4.put("auditdate",projectMainFlowEntity.getAuditdate());
|
||||
htdd01slave4_htdd01slave4.put("auditpersion",projectMainFlowEntity.getAuditpersion());
|
||||
htdd01slave4_htdd01slave4.put("forecast_revenue",projectMainFlowEntity.getForecastRevenue());
|
||||
htdd01slave4_htdd01slave4.put("vnote",projectMainFlowEntity.getVnote());
|
||||
htdd01slave4_htdd01slave4.put("def1",projectMainFlowEntity.getDef1());
|
||||
htdd01slave4_htdd01slave4.put("def2",projectMainFlowEntity.getDef2());
|
||||
htdd01slave4_htdd01slave4.put("def3",projectMainFlowEntity.getDef3());
|
||||
htdd01slave4_htdd01slave4.put("def4",projectMainFlowEntity.getDef4());
|
||||
htdd01slave4_htdd01slave4.put("def5",projectMainFlowEntity.getDef5());
|
||||
htdd01slave4_htdd01slave4.put("def6",projectMainFlowEntity.getDef6());
|
||||
htdd01slave4_htdd01slave4.put("def7",projectMainFlowEntity.getDef7());
|
||||
htdd01slave4_htdd01slave4.put("def8",projectMainFlowEntity.getDef8());
|
||||
jsonArray.add(htdd01slave4_htdd01slave4);
|
||||
bill.put("htdd01Master",htdd01Master);
|
||||
bill.put("htdd01slave4_htdd01slave4",jsonArray);
|
||||
return bill;
|
||||
}
|
||||
|
||||
|
||||
private void saveTaskLivingDetails(String rootAppPk,String rootAppBill,String rootAppNewData,String newTransmitInfo,boolean flag) {
|
||||
try {
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID());
|
||||
integrationTaskLivingDetailsEntity.setSts("Y");
|
||||
integrationTaskLivingDetailsEntity.setCreate_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setModify_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setCreate_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setModify_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setOrg_id("0");
|
||||
integrationTaskLivingDetailsEntity.setCompanyId("0");
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk);
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(rootAppBill);
|
||||
integrationTaskLivingDetailsEntity.setPluginId("ProjectMainFlowAuditPluginInitializer");
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo);
|
||||
if(flag){
|
||||
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
|
||||
}else {
|
||||
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("保存日志到集成任务日志明细中失败:{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.hzya.frame.plugin.projectMainFlow.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
public interface IProjectMainFlowService extends IBaseService<ProjectMainFlowEntity,String> {
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.hzya.frame.plugin.projectMainFlow.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.plugin.SendContract.dao.ISendContractDao;
|
||||
import com.hzya.frame.plugin.projectMainFlow.dao.IProjectMainFlowDao;
|
||||
import com.hzya.frame.plugin.projectMainFlow.entity.ProjectMainFlowEntity;
|
||||
import com.hzya.frame.plugin.projectMainFlow.service.IProjectMainFlowService;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
public class ProjectMainFlowServiceImpl extends BaseService<ProjectMainFlowEntity,String> implements IProjectMainFlowService {
|
||||
|
||||
private IProjectMainFlowDao projectMainFlowDao;
|
||||
|
||||
@Autowired
|
||||
public void setProjectMainFlowDao(IProjectMainFlowDao dao) {
|
||||
this.projectMainFlowDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
}
|
|
@ -1055,6 +1055,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
|
|||
}
|
||||
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
logger.info("=========需要下发的数据有{}条,单据编号为:{}======",doObjects.size(),doObjects.get(i).getString("vdef1"));
|
||||
//查询是否已经手动发送过。只有新增校验,查询发送日志是否已经有这条数据
|
||||
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
||||
mdmModuleSendLogEntity.setTableName(mainDb+"_send_log");
|
||||
|
@ -1154,7 +1155,7 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
|
|||
//组装数据发送
|
||||
logger.info("=========开始执行正常业务数据下发脚本,第二次==============");
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
logger.info("=====业务数据下发重试调用BIP付款申请返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||
logger.info("=====业务数据下发调用BIP付款申请返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||
if(jsonResultEntity.isFlag()){
|
||||
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
|
||||
logger.info("=========开始执行正常业务返回脚本==============");
|
||||
|
@ -1203,6 +1204,12 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
|
|||
serviceDataEntity.setId(query.get(0).getId());
|
||||
serviceDataDao.updateBipPaymentNumber(serviceDataEntity);
|
||||
logger.info("===正常下发时候,根据OA单据编号:{}更新BIP付款申请单号:{}完毕",jsonObjectParent.getString("vdef1"),backJsonResultEntity.getString("vbillno"));
|
||||
Map<String, Object> updateMap = new HashMap<>();
|
||||
updateMap.put("tableName",mainDb);
|
||||
//updateMap.put("dataStatus", "Y");
|
||||
updateMap.put("addStatus", "1");
|
||||
updateMap.put("id", objects.get(i).getString("id"));
|
||||
mdmModuleDao.updateMdmSTs(updateMap);
|
||||
}else{
|
||||
logger.info("======正常下发时候根据单据编号:{}未能在三维OA查询到数据,Bip付款申请单号不回写",jsonObjectParent.getString("vdef1"));
|
||||
}
|
||||
|
@ -1217,27 +1224,28 @@ public class ServiceDataDistributePluginInitializer extends PluginBaseEntity{
|
|||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||
objects.get(i).put("sendsanfzt123",true);
|
||||
logger.info("========业务数据下发完成,日志保存为成功============");
|
||||
continue;
|
||||
}else {
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||
objects.get(i).put("sendsanfzt123",false);
|
||||
logger.info("========业务数据下发完成,日志保存为失败============");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//所有下发发送完成,修改数据状态
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
if(objects.get(i).getBoolean("sendsanfzt123")){
|
||||
/* //所有下发发送完成,修改数据状态
|
||||
for (int ii = 0; ii < objects.size(); ii++) {
|
||||
if(objects.get(ii).getBoolean("sendsanfzt123")){
|
||||
Map<String, Object> updateMap = new HashMap<>();
|
||||
updateMap.put("tableName",mainDb);
|
||||
//updateMap.put("dataStatus", "Y");
|
||||
updateMap.put("addStatus", "1");
|
||||
updateMap.put("id", objects.get(i).getString("id"));
|
||||
updateMap.put("id", objects.get(ii).getString("id"));
|
||||
mdmModuleDao.updateMdmSTs(updateMap);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String appId, String target_api,String apiID, String source_data, String option_type) throws Exception {
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="SendContractPluginInitializer" class="com.hzya.frame.plugin.SendContract.plugin.SendContractPluginInitializer" />
|
||||
<bean name="SendContractOrderGoodsPluginInitializer" class="com.hzya.frame.plugin.SendContract.plugin.SendContractOrderGoodsPluginInitializer" />
|
||||
<!--<bean name="SendContractOrderGoodsPluginInitializer" class="com.hzya.frame.plugin.SendContract.plugin.SendContractOrderGoodsPluginInitializer" />-->
|
||||
</beans>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>businessPlugin</id>
|
||||
<name>businessPlugin插件</name>
|
||||
<category>20250219</category>
|
||||
</plugin>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="businessDao" class="com.hzya.frame.plugin.businessData.dao.impl.BusinessDaoImpl" />
|
||||
</beans>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="businessPluginInitializer" class="com.hzya.frame.plugin.businessData.plugin.BusinessPluginInitializer" />
|
||||
</beans>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="businessService" class="com.hzya.frame.plugin.businessData.service.impl.BusinessServiceImpl" />
|
||||
</beans>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>ProjectMainFlowAuditPluginInitializer</id>
|
||||
<name>ProjectMainFlowAuditPluginInitializer插件</name>
|
||||
<category>90000001</category>
|
||||
</plugin>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="projectMainFlowDaoImpl" class="com.hzya.frame.plugin.projectMainFlow.dao.impl.ProjectMainFlowDaoImpl" />
|
||||
</beans>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="ProjectMainFlowAuditPluginInitializer" class="com.hzya.frame.plugin.projectMainFlow.plugin.ProjectMainFlowAuditPluginInitializer" />
|
||||
<bean name="ProjectMainFlowArchivistPluginInitializer" class="com.hzya.frame.plugin.projectMainFlow.plugin.ProjectMainFlowArchivistPluginInitializer" />
|
||||
</beans>
|
|
@ -61,11 +61,15 @@ 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.conn.ssl.NoopHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.TrustAllStrategy;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -76,6 +80,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -1888,9 +1893,19 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
|
||||
|
||||
if ("POST".equals(method)) {
|
||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||
SSLContext sslContext = null;
|
||||
try {
|
||||
sslContext = new SSLContextBuilder()
|
||||
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
CloseableHttpClient closeableHttpClient = HttpClients.custom()
|
||||
.setSSLContext(sslContext)
|
||||
.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
|
||||
.build();
|
||||
// HttpClient
|
||||
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
|
||||
HttpPost post = new HttpPost(url.toString());
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
|
@ -3031,8 +3046,13 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||
sysMessageManageLogEntity.setRemark("接口调用失败,返回格式错误,不是JSON");//返回信息
|
||||
if(receiveApi.getReturnSuccessValue().equals(body)){
|
||||
sysMessageManageLogEntity.setStatus("3");//返回信息
|
||||
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + body);//返回信息
|
||||
}else {
|
||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||
sysMessageManageLogEntity.setRemark("接口调用失败,返回格式错误,不是JSON");//返回信息
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||
|
@ -3928,6 +3948,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
sysExtensionApiEntity.setQuerys(stringBuilder.toString());
|
||||
return sysExtensionApiEntity;
|
||||
}
|
||||
|
||||
|
||||
//<forms version=\"2.1\"><formExport><summary id=\"-3743349685075685398\" name=\"formmain_11769\"/><definitions><column id=\"field0011\" type=\"0\" name=\"申请单号\" isNullable=\"false\" length=\"100\"/><column id=\"field0001\" type=\"0\" name=\"申请人\" isNullable=\"false\" length=\"255\"/><column id=\"field0002\" type=\"0\" name=\"申请人工号\" isNullable=\"false\" length=\"255\"/><column id=\"field0012\" type=\"0\" name=\"申请人职位\" isNullable=\"false\" length=\"255\"/><column id=\"field0013\" type=\"0\" name=\"申请人部门\" isNullable=\"false\" length=\"255\"/><column id=\"field0014\" type=\"0\" name=\"申请人手机号\" isNullable=\"false\" length=\"255\"/><column id=\"field0003\" type=\"3\" name=\"出差时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0015\" type=\"0\" name=\"出差类型\" isNullable=\"false\" length=\"255\"/><column id=\"field0016\" type=\"0\" name=\"出差城市\" isNullable=\"false\" length=\"255\"/><column id=\"field0017\" type=\"4\" name=\"出差时长\" isNullable=\"false\" length=\"20\"/><column id=\"field0018\" type=\"0\" name=\"是否境外出差\" isNullable=\"false\" length=\"100\"/><column id=\"field0019\" type=\"0\" name=\"是否需要APEC卡\" isNullable=\"false\" length=\"100\"/><column id=\"field0020\" type=\"0\" name=\"是否展会出差\" isNullable=\"false\" length=\"100\"/><column id=\"field0021\" type=\"0\" name=\"出差事由\" isNullable=\"false\" length=\"255\"/></definitions><values><column name=\"申请单号\"><value><![CDATA[CCSQ2025022002]]></value></column><column name=\"申请人\"><value><![CDATA[陈宇杰]]></value></column><column name=\"申请人工号\"><value><![CDATA[sw091029]]></value></column><column name=\"申请人职位\"><value><![CDATA[开发工程师]]></value></column><column name=\"申请人部门\"><value><![CDATA[IT部]]></value></column><column name=\"申请人手机号\"><value><![CDATA[13867430000]]></value></column><column name=\"出差时间\"><value><![CDATA[2025-02-20]]></value></column><column name=\"出差类型\"><value></value></column><column name=\"出差城市\"><value><![CDATA[上海、北京]]></value></column><column name=\"出差时长\"><value><![CDATA[3]]></value></column><column name=\"是否境外出差\"><value><![CDATA[否]]></value></column><column name=\"是否需要APEC卡\"><value><![CDATA[否]]></value></column><column name=\"是否展会出差\"><value><![CDATA[否]]></value></column><column name=\"出差事由\"><value><![CDATA[信息化改造]]></value></column></values><subForms><subForm><definitions><column id=\"field0004\" type=\"2\" name=\"明细表-出发时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0005\" type=\"2\" name=\"明细表-结束时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0022\" type=\"4\" name=\"明细表-出差时长\" isNullable=\"false\" length=\"20\"/><column id=\"field0006\" type=\"0\" name=\"明细表-出发地\" isNullable=\"false\" length=\"255\"/><column id=\"field0007\" type=\"0\" name=\"明细表-目的地\" isNullable=\"false\" length=\"255\"/><column id=\"field0008\" type=\"0\" name=\"明细表-交通工具\" isNullable=\"false\" length=\"255\"/><column id=\"field0009\" type=\"4\" name=\"明细表-预计费用\" isNullable=\"false\" length=\"20\"/></definitions><values><row><column name=\"明细表-出发时间\"><value><![CDATA[2025-02-20 14:14:00]]></value></column><column name=\"明细表-结束时间\"><value><![CDATA[2025-02-21 14:14:00]]></value></column><column name=\"明细表-出差时长\"><value><![CDATA[2]]></value></column><column name=\"明细表-出发地\"><value><![CDATA[杭州]]></value></column><column name=\"明细表-目的地\"><value><![CDATA[上海]]></value></column><column name=\"明细表-交通工具\"><value><![CDATA[高铁]]></value></column><column name=\"明细表-预计费用\"><value><![CDATA[500]]></value></column></row><row><column name=\"明细表-出发时间\"><value><![CDATA[2025-02-21 14:14:00]]></value></column><column name=\"明细表-结束时间\"><value><![CDATA[2025-02-22 17:14:00]]></value></column><column name=\"明细表-出差时长\"><value><![CDATA[1]]></value></column><column name=\"明细表-出发地\"><value><![CDATA[上海]]></value></column><column name=\"明细表-目的地\"><value><![CDATA[北京]]></value></column><column name=\"明细表-交通工具\"><value><![CDATA[飞机]]></value></column><column name=\"明细表-预计费用\"><value><![CDATA[2000]]></value></column></row></values></subForm></subForms></formExport></forms>
|
||||
//<forms version=\"2.1\"><formExport><summary id=\"-3743349685075685398\" name=\"formmain_11769\"/><definitions><column id=\"field0011\" type=\"0\" name=\"申请单号\" isNullable=\"false\" length=\"100\"/><column id=\"field0001\" type=\"0\" name=\"申请人\" isNullable=\"false\" length=\"255\"/><column id=\"field0002\" type=\"0\" name=\"申请人工号\" isNullable=\"false\" length=\"255\"/><column id=\"field0012\" type=\"0\" name=\"申请人职位\" isNullable=\"false\" length=\"255\"/><column id=\"field0013\" type=\"0\" name=\"申请人部门\" isNullable=\"false\" length=\"255\"/><column id=\"field0014\" type=\"0\" name=\"申请人手机号\" isNullable=\"false\" length=\"255\"/><column id=\"field0003\" type=\"3\" name=\"出差时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0015\" type=\"0\" name=\"出差类型\" isNullable=\"false\" length=\"255\"/><column id=\"field0016\" type=\"0\" name=\"出差城市\" isNullable=\"false\" length=\"255\"/><column id=\"field0017\" type=\"4\" name=\"出差时长\" isNullable=\"false\" length=\"20\"/><column id=\"field0018\" type=\"0\" name=\"是否境外出差\" isNullable=\"false\" length=\"100\"/><column id=\"field0019\" type=\"0\" name=\"是否需要APEC卡\" isNullable=\"false\" length=\"100\"/><column id=\"field0020\" type=\"0\" name=\"是否展会出差\" isNullable=\"false\" length=\"100\"/><column id=\"field0021\" type=\"0\" name=\"出差事由\" isNullable=\"false\" length=\"255\"/></definitions><values><column name=\"申请单号\"><value><![CDATA[CCSQ2025022002]]></value></column><column name=\"申请人\"><value><![CDATA[陈宇杰]]></value></column><column name=\"申请人工号\"><value><![CDATA[sw091029]]></value></column><column name=\"申请人职位\"><value><![CDATA[开发工程师]]></value></column><column name=\"申请人部门\"><value><![CDATA[IT部]]></value></column><column name=\"申请人手机号\"><value><![CDATA[13867430000]]></value></column><column name=\"出差时间\"><value><![CDATA[2025-02-20]]></value></column><column name=\"出差类型\"><value></value></column><column name=\"出差城市\"><value><![CDATA[上海、北京]]></value></column><column name=\"出差时长\"><value><![CDATA[3]]></value></column><column name=\"是否境外出差\"><value><![CDATA[否]]></value></column><column name=\"是否需要APEC卡\"><value><![CDATA[否]]></value></column><column name=\"是否展会出差\"><value><![CDATA[否]]></value></column><column name=\"出差事由\"><value><![CDATA[信息化改造]]></value></column></values><subForms><subForm><definitions><column id=\"field0004\" type=\"2\" name=\"明细表-出发时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0005\" type=\"2\" name=\"明细表-结束时间\" isNullable=\"false\" length=\"255\"/><column id=\"field0022\" type=\"4\" name=\"明细表-出差时长\" isNullable=\"false\" length=\"20\"/><column id=\"field0006\" type=\"0\" name=\"明细表-出发地\" isNullable=\"false\" length=\"255\"/><column id=\"field0007\" type=\"0\" name=\"明细表-目的地\" isNullable=\"false\" length=\"255\"/><column id=\"field0008\" type=\"0\" name=\"明细表-交通工具\" isNullable=\"false\" length=\"255\"/><column id=\"field0009\" type=\"4\" name=\"明细表-预计费用\" isNullable=\"false\" length=\"20\"/></definitions><values><row><column name=\"明细表-出发时间\"><value><![CDATA[2025-02-20 14:14:00]]></value></column><column name=\"明细表-结束时间\"><value><![CDATA[2025-02-21 14:14:00]]></value></column><column name=\"明细表-出差时长\"><value><![CDATA[2]]></value></column><column name=\"明细表-出发地\"><value><![CDATA[杭州]]></value></column><column name=\"明细表-目的地\"><value><![CDATA[上海]]></value></column><column name=\"明细表-交通工具\"><value><![CDATA[高铁]]></value></column><column name=\"明细表-预计费用\"><value><![CDATA[500]]></value></column></row><row><column name=\"明细表-出发时间\"><value><![CDATA[2025-02-21 14:14:00]]></value></column><column name=\"明细表-结束时间\"><value><![CDATA[2025-02-22 17:14:00]]></value></column><column name=\"明细表-出差时长\"><value><![CDATA[1]]></value></column><column name=\"明细表-出发地\"><value><![CDATA[上海]]></value></column><column name=\"明细表-目的地\"><value><![CDATA[北京]]></value></column><column name=\"明细表-交通工具\"><value><![CDATA[飞机]]></value></column><column name=\"明细表-预计费用\"><value><![CDATA[2000]]></value></column></row></values></subForm></subForms></formExport></forms>
|
||||
}
|
||||
|
|
|
@ -28,15 +28,15 @@ import java.util.List;
|
|||
@Service("MasterDataServiceImpl")
|
||||
public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String> implements IMasterDataService {
|
||||
|
||||
@Autowired
|
||||
@Autowired
|
||||
private MasterDataDaoImpl masterDataDaoImpl;
|
||||
@Autowired
|
||||
private ComparisonServiceImpl comparisonServiceimpl;
|
||||
@Autowired
|
||||
private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl;
|
||||
@Autowired
|
||||
private ComparisonServiceImpl comparisonServiceimpl;
|
||||
@Autowired
|
||||
private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl;
|
||||
|
||||
@Autowired
|
||||
private ApplicationCache applicationCache;
|
||||
@Autowired
|
||||
private ApplicationCache applicationCache;
|
||||
private String ts = "";
|
||||
|
||||
/**
|
||||
|
@ -60,8 +60,8 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
|
||||
// applicationCache.get()
|
||||
// logger.info("入参数据"+jsonObject.toString());
|
||||
String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间
|
||||
String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间
|
||||
String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间
|
||||
String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间
|
||||
// logger.info("本次任务查询区间开始时间:{} 结束时间:{}",startTime,endTime);
|
||||
String tableName = "";
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
String mdmCode = mdmModuleSourceEntity.getMdmCode();
|
||||
List<JSONObject> listAll = new ArrayList<>();
|
||||
if("10007".equals(mdmCode)){
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
// if(!"10003".equals(mdmCode)){
|
||||
// continue;
|
||||
|
@ -80,7 +80,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
case "1":
|
||||
//通过主数据编码判断,不同的接口走不通的查询逻辑
|
||||
switch (mdmCode){
|
||||
case "10003"://致远用户信息
|
||||
/*case "10003"://致远用户信息
|
||||
tableName = "mdm_user";
|
||||
listAll = bindingUser(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
|
||||
break;
|
||||
|
@ -91,7 +91,19 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
case "10007"://银行信息
|
||||
tableName = "mdm_bank";
|
||||
listAll = binDingBank(jsonObject, mdmModuleSourceEntity, dbCode);
|
||||
break;*/
|
||||
/* case "10047"://BIP供应商档案
|
||||
tableName = "mdm_bip_supplier";
|
||||
listAll = binDingSupplier(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
|
||||
break;*/
|
||||
case "10048"://BIP项目档案
|
||||
tableName = "mdm_bip_project";
|
||||
listAll = binDingProject(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
|
||||
break;
|
||||
/* case "10049"://BIP供应商银行档案
|
||||
tableName = "mdm_bip_supplier_bank";
|
||||
listAll = binDingSupplierBank(jsonObject, mdmModuleSourceEntity, dbCode,startTime,endTime);
|
||||
break;*/
|
||||
default:
|
||||
logger.info("未匹配到主数据的编码,请检查");
|
||||
break;
|
||||
|
@ -110,6 +122,89 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
return BaseResult.getSuccessMessageEntity("主数据同步成功");
|
||||
}
|
||||
|
||||
//绑定项目
|
||||
private List<JSONObject> binDingProject(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){
|
||||
sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ");
|
||||
sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ");
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select * from v_hzya_project where 1=1 "+sb.toString());
|
||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||
int i = 0;
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
JSONObject main = new JSONObject();
|
||||
JSONObject mdm = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
mdm.put(key.toLowerCase(), hashMap.get(key));
|
||||
}
|
||||
main.put("mdm_bip_project",mdm);
|
||||
list.add(main);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//绑定供应商银行账户
|
||||
private List<JSONObject> binDingSupplierBank(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){
|
||||
sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ");
|
||||
sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ");
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select * from v_hzya_supplier_bank where 1=1 "+sb.toString());
|
||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||
int i = 0;
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
JSONObject main = new JSONObject();
|
||||
JSONObject mdm = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
mdm.put(key.toLowerCase(), hashMap.get(key));
|
||||
}
|
||||
main.put("mdm_bip_supplier_bank",mdm);
|
||||
list.add(main);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//绑定供应商
|
||||
private List<JSONObject> binDingSupplier(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)){
|
||||
sb.append(" AND MODIFY_DATE >= TO_DATE('"+startTime+"','yyyy-MM-dd HH24:mi:ss') ");
|
||||
sb.append(" AND MODIFY_DATE <> TO_DATE('"+endTime+"','yyyy-MM-dd HH24:mi:ss') ");
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select * from v_hzya_supplier where 1=1 "+sb.toString());
|
||||
logger.info("主数据抽取供应商的sql语句为:{}",stringBuffer.toString());
|
||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||
int i = 0;
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
JSONObject main = new JSONObject();
|
||||
JSONObject mdm = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
mdm.put(key.toLowerCase(), hashMap.get(key));
|
||||
}
|
||||
main.put("mdm_bip_supplier",mdm);
|
||||
list.add(main);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//绑定银行
|
||||
private List<JSONObject> binDingBank(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode)throws Exception {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
|
@ -187,7 +282,8 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
|
||||
//绑定OA用户参数
|
||||
private List<JSONObject> bindingUser(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
|
||||
private List<JSONObject>
|
||||
bindingUser(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode,String startTime,String endTime)throws Exception {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
||||
|
@ -209,7 +305,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
JSONObject main = new JSONObject();
|
||||
JSONObject mdm_user = new JSONObject();
|
||||
JSONObject mdm_user = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
mdm_user.put(key, hashMap.get(key));
|
||||
}
|
||||
|
@ -223,10 +319,11 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
|
||||
//查询档案参数组装
|
||||
public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List<JSONObject> hashMaps,String mdmCode,String tableName)throws Exception{
|
||||
JSONObject jsonObjectUser = new JSONObject();
|
||||
List<Object> result=new ArrayList<>();
|
||||
try {
|
||||
for (JSONObject hashMap : hashMaps) {
|
||||
JSONObject main = hashMap.getJSONObject(tableName);
|
||||
|
||||
JSONObject jsonObjectUser = new JSONObject();
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonObjectUser.put("data_id", main.get("data_id"));
|
||||
jsonObjectUser.put("mdmCode", mdmCode);
|
||||
|
@ -235,39 +332,34 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
Object attribute = comparisonServiceimpl.queryEntityPage(jsonStr);
|
||||
logger.info("得到的attribute值为:{}", jsonStr.toJSONString(attribute));
|
||||
JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute);
|
||||
JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list");
|
||||
JSONObject pageInfo = jsonObjectAttribute.getJSONObject("pageInfo");
|
||||
JSONArray jsonArrayList = pageInfo.getJSONArray("list");
|
||||
//如果jsonArrayList为null,说明没有值,在表中不存在
|
||||
if (jsonArrayList == null || jsonArrayList.size() == 0) {
|
||||
// //将查询出来得数据调用通用接口新增,保存到表中
|
||||
// JSONObject main = new JSONObject();
|
||||
// for(String key:hashMap.keySet()) {
|
||||
// main.put(key, hashMap.get(key));
|
||||
// }
|
||||
// jsonObjectUser.put("main", main);
|
||||
hashMap.put("appName","数智中台");
|
||||
hashMap.put("appCode","800004");
|
||||
hashMap.put("mdmCode", mdmCode);
|
||||
hashMap.put("optionName", "数智中台");
|
||||
jsonStr.put("jsonStr", hashMap);
|
||||
Object result = comparisonServiceimpl.saveEntity(jsonStr);
|
||||
logger.info("新增结果为:{}", JSON.toJSONString(result));
|
||||
// if(!result.isFlag()){
|
||||
// throw new BaseSystemException("主数据保存失败"+ result.getMsg());
|
||||
// }
|
||||
Object object = comparisonServiceimpl.saveEntity(jsonStr);
|
||||
logger.info("新增结果为:{}", JSON.toJSONString(object));
|
||||
result.add(object);
|
||||
} else {
|
||||
hashMap.put("appName","数智中台");
|
||||
hashMap.put("appCode","800004");
|
||||
hashMap.put("mdmCode", mdmCode);
|
||||
hashMap.put("optionName", "数智中台");
|
||||
jsonStr.put("jsonStr", hashMap);
|
||||
Object result = comparisonServiceimpl.updateEntity(jsonStr);
|
||||
Object object = comparisonServiceimpl.updateEntity(jsonStr);
|
||||
logger.info("更新结果为:{}", JSON.toJSONString(result));
|
||||
// if(!result.isFlag()){
|
||||
// //throw new BaseSystemException("主数据更新失败"+ result.getMsg());
|
||||
// }
|
||||
result.add(object);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}catch (Exception e){
|
||||
logger.info("将数据查询之后进行组装调用通用方法错误:{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,4 +4,34 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
|||
import com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity;
|
||||
|
||||
public interface ICtpAttachmentDao extends IBaseDao<CtpAttachmentEntity,String> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 根据附件id查询附件信息
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2025-01-15 14:08
|
||||
* **/
|
||||
CtpAttachmentEntity queryCtpAttachmentEntity(CtpAttachmentEntity entity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 新增
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2025-01-15 14:46
|
||||
* **/
|
||||
CtpAttachmentEntity saveCtpAttachmentEntity(CtpAttachmentEntity entity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 更新
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2025-01-15 14:47
|
||||
* **/
|
||||
Integer updateCtpAttachmentEntity(CtpAttachmentEntity entity);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzya.frame.sysnew.comparison.serviceData.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.sysnew.comparison.serviceData.dao.ICtpAttachmentDao;
|
||||
import com.hzya.frame.sysnew.comparison.serviceData.dao.IServiceDataDao;
|
||||
|
@ -8,4 +9,21 @@ import org.springframework.stereotype.Repository;
|
|||
|
||||
@Repository(value = "CtpAttachmentDaoImpl")
|
||||
public class CtpAttachmentDaoImpl extends MybatisGenericDao<CtpAttachmentEntity,String> implements ICtpAttachmentDao {
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public CtpAttachmentEntity queryCtpAttachmentEntity(CtpAttachmentEntity entity) {
|
||||
return (CtpAttachmentEntity) super.selectOne("queryCtpAttachmentEntity",entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public CtpAttachmentEntity saveCtpAttachmentEntity(CtpAttachmentEntity entity) {
|
||||
return super.save("saveCtpAttachmentEntity",entity);
|
||||
}
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public Integer updateCtpAttachmentEntity(CtpAttachmentEntity entity) {
|
||||
return super.update("updateCtpAttachmentEntity",entity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,19 @@
|
|||
</trim>
|
||||
</select>
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="queryCtpAttachmentEntity" resultMap="get-CtpAttachmentEntity-result" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
|
||||
select
|
||||
id,
|
||||
category,
|
||||
type,
|
||||
filename,
|
||||
mime_type, FILE_SIZE AS attachment_size
|
||||
from CTP_FILE where id= #{file_url}
|
||||
</select>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="entity_insert" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
|
||||
<insert id="saveCtpAttachmentEntity" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
|
||||
insert into CTP_ATTACHMENT(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id !='' "> id, </if>
|
||||
|
@ -76,7 +87,7 @@
|
|||
</insert>
|
||||
|
||||
<!-- 修改 付款单中的电子回单字段-->
|
||||
<update id="entity_update" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
|
||||
<update id="updateCtpAttachmentEntity" parameterType="com.hzya.frame.sysnew.comparison.serviceData.entity.CtpAttachmentEntity">
|
||||
update CTP_ATTACHMENT set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="sub_reference != null and sub_reference !='' "> sub_reference = #{sub_reference},</if>
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ServiceDataEntity extends BaseEntity {
|
|||
private String receipt;//电子回单值
|
||||
private String billCode;//单据编号
|
||||
|
||||
private String summary_id;//summary_id
|
||||
private String summaryId;//summaryId
|
||||
|
||||
private String bipAmountField;//BIP打款金额字段
|
||||
private String bipAmount;//BIP打款金额
|
||||
|
@ -37,12 +37,12 @@ public class ServiceDataEntity extends BaseEntity {
|
|||
this.bipAmount = bipAmount;
|
||||
}
|
||||
|
||||
public String getSummary_id() {
|
||||
return summary_id;
|
||||
public String getSummaryId() {
|
||||
return summaryId;
|
||||
}
|
||||
|
||||
public void setSummary_id(String summary_id) {
|
||||
this.summary_id = summary_id;
|
||||
public void setSummaryId(String summaryId) {
|
||||
this.summaryId = summaryId;
|
||||
}
|
||||
|
||||
public String getTabName() {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
,receipt_filed as receiptFiled
|
||||
,receipt as receipt
|
||||
,vdef1 as billCode
|
||||
,summary_id
|
||||
,summary_id as summaryId
|
||||
,bip_payment_number_field as bipPaymentNumberField
|
||||
,bip_payment_number as bipPaymentNumber
|
||||
,bip_amount_field as bipAmountField
|
||||
|
@ -90,7 +90,7 @@
|
|||
<update id="updatePayResult" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
|
||||
update ${tabName} set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="payDate != null and payDate != ''"> ${payDateFiled} = #{payDate},</if>
|
||||
<if test="payDate != null and payDate != ''"> ${payDateFiled} = to_date(#{payDate},'YYYY-MM-DD HH24:MI:SS'),</if>
|
||||
<if test="bipAmount != null and bipAmount != ''"> ${bipAmountField} = #{bipAmount},</if>
|
||||
<if test="payResult != null and payResult != ''"> ${payResultFiled} = #{payResult}</if>
|
||||
</trim>
|
||||
|
@ -100,7 +100,7 @@
|
|||
<!--通过主键修改方法-->
|
||||
<update id="updateElectronic" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity" >
|
||||
update ${tabName} set
|
||||
set ${receiptFiled} = #{receipt}
|
||||
${receiptFiled} = #{receipt}
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
|
|
|
@ -197,38 +197,46 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
|
|||
String file_url = jsonObject.getString("fileUrl");
|
||||
CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity();
|
||||
ctpAttachmentEntity.setFile_url(file_url);
|
||||
String att_reference = serviceDataEntity.getSummary_id();//Summary_id
|
||||
String att_reference = serviceDataEntity.getSummaryId();//Summary_id
|
||||
logger.info("==========oa_id:{}的表单的Summary_id值为:{}",serviceDataEntity.getId(),att_reference);
|
||||
ctpAttachmentEntity.setSub_reference(sub_reference);
|
||||
ctpAttachmentEntity.setAtt_reference(att_reference);
|
||||
ctpAttachmentEntity.setDataSourceCode(serviceDataEntity.getDataSourceCode());
|
||||
List<CtpAttachmentEntity> ctpAttachmentEntityListBase = ctpAttachmentDao.query(ctpAttachmentEntity);
|
||||
logger.info("====根据附件id:{}查询出来在CTP_ATTACHMENT表中的数据有:{}条",file_url,ctpAttachmentEntityListBase.size());
|
||||
CtpAttachmentEntity ctpAttachment = ctpAttachmentDao.queryCtpAttachmentEntity(ctpAttachmentEntity);
|
||||
logger.info("====根据附件id:{}查询在CTP_file表中的文件名称为",file_url,ctpAttachment.getFilename());
|
||||
//如果没有查询到数据,就新增附件业务,否则更新
|
||||
if (ctpAttachmentEntityListBase.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("2");
|
||||
ctpAttachmentEntity.setCreatedate(new Date());
|
||||
ctpAttachmentEntity.setDataSourceCode(jsonObject.getString("dataSourceCode"));
|
||||
ctpAttachmentDao.save(ctpAttachmentEntity);
|
||||
logger.info("OA附件新增成功");
|
||||
if(null !=ctpAttachment) {
|
||||
String type =ctpAttachment.getType();
|
||||
String filename = ctpAttachment.getFilename();
|
||||
String mime_type =ctpAttachment.getMime_type();
|
||||
String attachment_size = ctpAttachment.getAttachment_size();
|
||||
String id = String.valueOf(UUIDLong.longUUID());
|
||||
ctpAttachmentEntity.setCategory("66");
|
||||
ctpAttachmentEntity.setFilename(filename);
|
||||
ctpAttachmentEntity.setType(type);
|
||||
ctpAttachmentEntity.setMime_type(mime_type);
|
||||
ctpAttachmentEntity.setAttachment_size(attachment_size);
|
||||
ctpAttachmentEntity.setId(id);
|
||||
ctpAttachmentEntity.setCreatedate(new Date());
|
||||
ctpAttachmentEntity.setDataSourceCode(serviceDataEntity.getDataSourceCode());
|
||||
ctpAttachmentDao.saveCtpAttachmentEntity(ctpAttachmentEntity);
|
||||
logger.info("OA附件新增成功");
|
||||
}else{
|
||||
logger.info("======根据附件id:{}查询在CTP_file表中不存在======");
|
||||
}
|
||||
} else {
|
||||
if (ctpAttachmentEntityListBase.size() > 1) {
|
||||
throw new BaseSystemException("OA附件业务表中查到多条记录");
|
||||
}
|
||||
//更新数据到OA附件业务表中
|
||||
ctpAttachmentDao.save(ctpAttachmentEntity);
|
||||
ctpAttachmentDao.updateCtpAttachmentEntity(ctpAttachmentEntity);
|
||||
logger.info("OA附件更新成功");
|
||||
}
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("电子回单更新成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +304,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
|
|||
"push_status_field,summary_id,bip_payment_number_field,bip_amount_field,\n" +
|
||||
"vdef1,pk_acceptorg,creator,pk_group,pk_org,applydate,pk_trantypecode,pk_busitype,vdef2,pk_currtype,\n" +
|
||||
"pk_supplier,pk_bankacc_r,pk_bankacc_p,pk_decidedept,vdef10,vdef12,vdef3,vdef4,vdef5,vdef6,applysum,\n" +
|
||||
"vdef7,vdef8,vdef9 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null and applysum >0");
|
||||
"vdef7,vdef8,vdef9,vdef21,vdef11,vdef17,vdef20 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null and applysum >0");
|
||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||
List<HashMap<String, Object>> hashMaps = serviceDataDao.queryListBySWSource(stringBuffer.toString(), mdmModuleSourceEntity);
|
||||
int i = 0;
|
||||
|
@ -312,8 +320,8 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
|
|||
vdef1=cmp_apply.getString("vdef1");
|
||||
StringBuffer stringBufferDetails = new StringBuffer();
|
||||
stringBufferDetails.append("select d_id as data_id,tab_name,pk_balatype,pk_acceptorg,pk_org,pk_group,pk_busitype,rowno,\n" +
|
||||
"pk_supplier,pk_bankacc_r,pk_currtype,pk_decidedept,gllcrate,applysum,applymny,vdef1,pk_project,vdef2,vdef3,\n" +
|
||||
"vdef4 from v_cmp_apply_b where formmain_id= '"+formmainId+"' " );
|
||||
"pk_supplier,pk_bankacc_r,customer,pk_currtype,pk_decidedept,gllcrate,applysum,applymny,vdef1,pk_project,vdef2,vdef3,\n" +
|
||||
"vdef4,vdef10,vdef14 from v_cmp_apply_b where formmain_id= '"+formmainId+"' " );
|
||||
List<HashMap<String, Object>> hashMapsDetails = serviceDataDao.queryListBySWSource(stringBufferDetails.toString(),mdmModuleSourceEntity);
|
||||
JSONArray cmp_apply_b = new JSONArray();
|
||||
if(CollectionUtils.isNotEmpty(hashMapsDetails)){
|
||||
|
|
|
@ -671,8 +671,8 @@ update integration_task_living_details set sts= 'N' ,modify_time = #{modify_tim
|
|||
<if test="new_push_date != null and new_push_date !='' "> <![CDATA[ AND DATE_FORMAT(new_push_date , '%Y-%m-%d') = #{new_push_date} ]]> </if>
|
||||
<if test="repair_pust != null and repair_pust !='' "> and repair_pust like concat('%',#{repair_pust},'%') </if>
|
||||
<if test="sence_id != null and sence_id !='' "> and sence_id like concat('%',#{sence_id},'%') </if>
|
||||
<if test="plugin_id != null and plugin_id !='' "> and plugin_id like concat(#{plugin_id},'%') </if>
|
||||
<if test="new_state != null and new_state !='' "> and new_state like concat(#{new_state},'%') </if>
|
||||
<if test="plugin_id != null and plugin_id !='' "> and plugin_id = #{plugin_id} </if>
|
||||
<if test="new_state != null and new_state !='' "> and new_state = #{new_state} </if>
|
||||
<if test="business_date != null and business_date !='' "> <![CDATA[ AND DATE_FORMAT(business_date , '%Y-%m-%d') = str_to_date(#{business_date},'%Y-%m-%d') ]]> </if>
|
||||
<if test="create_time != null and create_time !='' "> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id !='' "> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
|
|
Loading…
Reference in New Issue