发票传递
This commit is contained in:
parent
b6334bba1a
commit
103b9c2981
|
@ -20,5 +20,13 @@ public interface IIncomeInvoiceDao extends IBaseDao<IncomeInvoiceEntity, String>
|
||||||
int saveDetailData(JSONObject saveDetailData);
|
int saveDetailData(JSONObject saveDetailData);
|
||||||
|
|
||||||
int saveData(JSONObject saveData);
|
int saveData(JSONObject saveData);
|
||||||
|
|
||||||
|
List<IncomeInvoiceEntity> queryOaZb(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||||
|
|
||||||
|
List<IncomeInvoiceEntity> queryOaMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||||
|
|
||||||
|
int updateMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||||
|
|
||||||
|
int saveMx(IncomeInvoiceEntity incomeInvoiceEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.hzya.frame.plugin.incomeInvoiceData.dao.impl;
|
package com.hzya.frame.plugin.incomeInvoiceData.dao.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
import com.hzya.frame.plugin.incomeInvoiceData.dao.IIncomeInvoiceDao;
|
import com.hzya.frame.plugin.incomeInvoiceData.dao.IIncomeInvoiceDao;
|
||||||
import com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity;
|
import com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity;
|
||||||
|
@ -28,5 +29,28 @@ public class IncomeInvoiceDaoImpl extends MybatisGenericDao<IncomeInvoiceEntity,
|
||||||
public int saveDetailData(JSONObject saveData) {
|
public int saveDetailData(JSONObject saveData) {
|
||||||
return super.insert(getSqlIdPrifx() + "saveDetailData", saveData);
|
return super.insert(getSqlIdPrifx() + "saveDetailData", saveData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public List<IncomeInvoiceEntity> queryOaZb(IncomeInvoiceEntity entity) {
|
||||||
|
List<IncomeInvoiceEntity> o = (List<IncomeInvoiceEntity>) super.selectList(getSqlIdPrifx() + "queryOaZb", entity);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public List<IncomeInvoiceEntity> queryOaMx(IncomeInvoiceEntity entity) {
|
||||||
|
List<IncomeInvoiceEntity> o = (List<IncomeInvoiceEntity>) super.selectList(getSqlIdPrifx() + "queryOaMx", entity);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int updateMx(IncomeInvoiceEntity entity) {
|
||||||
|
return super.update(getSqlIdPrifx() + "updateMx", entity);
|
||||||
|
}
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int saveMx(IncomeInvoiceEntity entity) {
|
||||||
|
return super.insert(getSqlIdPrifx() + "saveMx", entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,69 @@ import com.hzya.frame.web.entity.BaseEntity;
|
||||||
*/
|
*/
|
||||||
public class IncomeInvoiceEntity extends BaseEntity {
|
public class IncomeInvoiceEntity extends BaseEntity {
|
||||||
|
|
||||||
|
private Integer data_id;
|
||||||
|
private Integer formmain_id;
|
||||||
|
private String field0127;
|
||||||
|
private String field0128;
|
||||||
|
private String field0129;
|
||||||
|
private String field0130;
|
||||||
|
private String field0003;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getData_id() {
|
||||||
|
return data_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData_id(Integer data_id) {
|
||||||
|
this.data_id = data_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFormmain_id() {
|
||||||
|
return formmain_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormmain_id(Integer formmain_id) {
|
||||||
|
this.formmain_id = formmain_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0127() {
|
||||||
|
return field0127;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0127(String field0127) {
|
||||||
|
this.field0127 = field0127;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0128() {
|
||||||
|
return field0128;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0128(String field0128) {
|
||||||
|
this.field0128 = field0128;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0129() {
|
||||||
|
return field0129;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0129(String field0129) {
|
||||||
|
this.field0129 = field0129;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0130() {
|
||||||
|
return field0130;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0130(String field0130) {
|
||||||
|
this.field0130 = field0130;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField0003() {
|
||||||
|
return field0003;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField0003(String field0003) {
|
||||||
|
this.field0003 = field0003;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,57 @@
|
||||||
</trim>
|
</trim>
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
<select id="queryOaZb" resultType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||||
|
select
|
||||||
|
id as data_id,
|
||||||
|
field0003
|
||||||
|
from formmain_0323
|
||||||
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
<if test="field0003 != null and field0003 != ''"> and field0003 = #{field0003} </if>
|
||||||
|
</trim>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryOaMx" resultType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" parameterType="com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity">
|
||||||
|
select
|
||||||
|
id as data_id
|
||||||
|
from formson_0702
|
||||||
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
<if test="field0128 != null and field0128 != ''"> and field0128 = #{field0128} </if>
|
||||||
|
</trim>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateMx" parameterType = "com.hzya.frame.plugin.incomeInvoiceData.entity.IncomeInvoiceEntity" >
|
||||||
|
update formson_0702 set
|
||||||
|
<trim suffix="" suffixOverrides=",">
|
||||||
|
<if test="field0127 != null and field0127 != ''"> field0127 = #{field0127},</if>
|
||||||
|
<if test="field0128 != null and field0128 != ''"> field0128 = #{field0128},</if>
|
||||||
|
<if test="field0129 != null and field0129 != ''"> field0129 = #{field0129},</if>
|
||||||
|
<if test="field0130 != null and field0130 != ''"> field0130 = #{field0130},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{data_id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="saveMx" parameterType="com.hzya.frame.report.reportManage.entity.ReportManageEntity">
|
||||||
|
insert into formson_0702(
|
||||||
|
<trim suffix="" suffixOverrides=",">
|
||||||
|
<if test="data_id != null and data_id != ''">id ,</if>
|
||||||
|
<if test="formmain_id != null and formmain_id != ''">formmain_id ,</if>
|
||||||
|
<if test="field0127 != null and field0127 != ''">field0127 ,</if>
|
||||||
|
<if test="field0128 != null and field0128 != ''">field0128 ,</if>
|
||||||
|
<if test="field0129 != null and field0129 != ''">field0129 ,</if>
|
||||||
|
<if test="field0130 != null and field0130 != ''">field0130 ,</if>
|
||||||
|
|
||||||
|
</trim>
|
||||||
|
)values(
|
||||||
|
<trim suffix="" suffixOverrides=",">
|
||||||
|
<if test="data_id != null and data_id != ''">#{data_id} ,</if>
|
||||||
|
<if test="formmain_id != null and formmain_id != ''">#{formmain_id} ,</if>
|
||||||
|
<if test="field0127 != null and field0127 != ''">#{field0127} ,</if>
|
||||||
|
<if test="field0128 != null and field0128 != ''">#{field0128} ,</if>
|
||||||
|
<if test="field0129 != null and field0129 != ''">#{field0129} ,</if>
|
||||||
|
<if test="field0130 != null and field0130 != ''">#{field0130} ,</if>
|
||||||
|
</trim>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -460,6 +460,27 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
sendBody.put("loginName",loginName);
|
sendBody.put("loginName",loginName);
|
||||||
sendBody.put("dataXml",dataXml);
|
sendBody.put("dataXml",dataXml);
|
||||||
entity.setBodys(sendBody.toJSONString());
|
entity.setBodys(sendBody.toJSONString());
|
||||||
|
//修改明细表
|
||||||
|
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
||||||
|
incomeInvoiceEntity.setDataSourceCode("master");
|
||||||
|
incomeInvoiceEntity.setField0003("hth001");//合同号
|
||||||
|
incomeInvoiceEntity.setField0127(jsonObject.getString("fpdm"));//发票代码
|
||||||
|
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
||||||
|
incomeInvoiceEntity.setField0129(jsonObject.getString("jshj"));//发票总额
|
||||||
|
incomeInvoiceEntity.setField0130(jsonObject.getString("fpwj"));//发票文件
|
||||||
|
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaZb(incomeInvoiceEntity);
|
||||||
|
if(list != null && list.size() == 1){
|
||||||
|
incomeInvoiceEntity.setFormmain_id(list.get(0).getData_id());
|
||||||
|
}
|
||||||
|
List<IncomeInvoiceEntity> mxlist = incomeInvoiceDao.queryOaMx(incomeInvoiceEntity);
|
||||||
|
if(mxlist != null && mxlist.size() == 1){
|
||||||
|
incomeInvoiceEntity.setData_id(mxlist.get(0).getData_id());
|
||||||
|
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
|
||||||
|
}
|
||||||
|
if(mxlist == null || mxlist.size() == 0){
|
||||||
|
incomeInvoiceEntity.setData_id(1);
|
||||||
|
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,7 +470,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {//执行正常下发
|
}else {//执行正常下发
|
||||||
|
logger.info("==========开始执行正常主数据下发=============");
|
||||||
//查询主数据
|
//查询主数据
|
||||||
MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity();
|
MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity();
|
||||||
queryMdmModuleEntity.setMdmCode(10050L);
|
queryMdmModuleEntity.setMdmCode(10050L);
|
||||||
|
@ -510,13 +510,17 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
queryFildRule.setRuleCode("service");
|
queryFildRule.setRuleCode("service");
|
||||||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
|
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
|
||||||
|
|
||||||
//新增
|
if(mdmModuleEntities.get(i).getMdmCode()!= 10045L){
|
||||||
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
//新增
|
||||||
//修改
|
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||||
doUpdate(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);
|
//删除
|
||||||
|
doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||||
|
}else{
|
||||||
|
logger.info("主数据编码为10045,已经在业务数据下发执行,主数据下发不执行");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -740,7 +744,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
map1.put("tableName",mainDb);
|
map1.put("tableName",mainDb);
|
||||||
//map1.put("dataStatus", "F");
|
//map1.put("dataStatus", "F");
|
||||||
map1.put("updateStatus", "0");
|
map1.put("updateStatus", "0");
|
||||||
map1.put("size", 50);
|
//map1.put("size", 50);
|
||||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||||
objects = toLowerCaseKeys(objects);
|
objects = toLowerCaseKeys(objects);
|
||||||
|
|
||||||
|
@ -828,6 +832,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
/** body */
|
/** body */
|
||||||
String bodys = doObjects.get(i).toJSONString();
|
String bodys = doObjects.get(i).toJSONString();
|
||||||
if(scriptEntity != null && scriptEntity.getId() != null ){
|
if(scriptEntity != null && scriptEntity.getId() != null ){
|
||||||
|
logger.info("=========开始执行正常主数据修改下发脚本,第一次==============");
|
||||||
groovy.put("code",scriptEntity.getScriptCode());
|
groovy.put("code",scriptEntity.getScriptCode());
|
||||||
groovy.put("className",scriptEntity.getClassName());
|
groovy.put("className",scriptEntity.getClassName());
|
||||||
groovy.put("name",scriptEntity.getScriptName());
|
groovy.put("name",scriptEntity.getScriptName());
|
||||||
|
@ -855,6 +860,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
|
logger.info("=========正常主数据修改开始执行登录接口==============");
|
||||||
//找到登陆接口
|
//找到登陆接口
|
||||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
if (null == loginApi) {
|
if (null == loginApi) {
|
||||||
|
@ -875,12 +881,15 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
|
logger.info("=======主数据正常修改下发登录返回数据:{}========",attritube.toJSONString());
|
||||||
querys = getQuery(apiEntity,querys,attritube);
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
headers = getHeaders(apiEntity,headers,attritube);
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
bodys = getBodys(apiEntity,bodys,attritube);
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
}
|
}
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
|
logger.info("=========开始执行主业务修改数据下发脚本,第二次==============");
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||||
|
logger.info("=====主数据修改下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||||
if(jsonResultEntity.isFlag()){
|
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");
|
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");
|
||||||
|
@ -912,7 +921,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
* @param mdmModuleDistributeEntities
|
* @param mdmModuleDistributeEntities
|
||||||
* @return void
|
* @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;
|
String mainDb = null;
|
||||||
List<JSONObject> objects = new ArrayList<>();
|
List<JSONObject> objects = new ArrayList<>();
|
||||||
|
@ -928,7 +938,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
map1.put("tableName",mainDb);
|
map1.put("tableName",mainDb);
|
||||||
//map1.put("dataStatus", "Y");
|
//map1.put("dataStatus", "Y");
|
||||||
map1.put("addStatus", "0");
|
map1.put("addStatus", "0");
|
||||||
map1.put("size", 50);
|
//map1.put("size", 50);
|
||||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||||
objects = toLowerCaseKeys(objects);
|
objects = toLowerCaseKeys(objects);
|
||||||
|
|
||||||
|
@ -1000,6 +1010,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
mdmModuleSendLogEntity.setOptionType("1");
|
mdmModuleSendLogEntity.setOptionType("1");
|
||||||
Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity);
|
Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity);
|
||||||
if(num > 0){//已经新增过不发送
|
if(num > 0){//已经新增过不发送
|
||||||
|
objects.get(i).put("sendsanfzt123",true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||||
|
@ -1030,6 +1041,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
/** body */
|
/** body */
|
||||||
String bodys = doObjects.get(i).toJSONString();
|
String bodys = doObjects.get(i).toJSONString();
|
||||||
if(scriptEntity != null && scriptEntity.getId() != null ){
|
if(scriptEntity != null && scriptEntity.getId() != null ){
|
||||||
|
logger.info("=========开始执行正常主数据新增下发脚本,第一次==============");
|
||||||
groovy.put("code",scriptEntity.getScriptCode());
|
groovy.put("code",scriptEntity.getScriptCode());
|
||||||
groovy.put("className",scriptEntity.getClassName());
|
groovy.put("className",scriptEntity.getClassName());
|
||||||
groovy.put("name",scriptEntity.getScriptName());
|
groovy.put("name",scriptEntity.getScriptName());
|
||||||
|
@ -1057,6 +1069,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
|
logger.info("=========正常主数据新增开始执行登录接口==============");
|
||||||
//找到登陆接口
|
//找到登陆接口
|
||||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
if (null == loginApi) {
|
if (null == loginApi) {
|
||||||
|
@ -1077,15 +1090,19 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
|
logger.info("=======主数据正常新增下发登录返回数据:{}========",attritube.toJSONString());
|
||||||
querys = getQuery(apiEntity,querys,attritube);
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
headers = getHeaders(apiEntity,headers,attritube);
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
bodys = getBodys(apiEntity,bodys,attritube);
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
}
|
}
|
||||||
|
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
|
logger.info("=========开始执行主业务新增数据下发脚本,第二次==============");
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||||
|
logger.info("=====主数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
|
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
|
||||||
|
logger.info("=========开始执行主数据新增返回脚本==============");
|
||||||
JSONObject backScriptJson = new JSONObject();
|
JSONObject backScriptJson = new JSONObject();
|
||||||
backScriptJson.put("data", jsonResultEntity.getAttribute());
|
backScriptJson.put("data", jsonResultEntity.getAttribute());
|
||||||
groovy.put("code", scriptEntity.getScriptCode()+"back");
|
groovy.put("code", scriptEntity.getScriptCode()+"back");
|
||||||
|
@ -1125,11 +1142,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");
|
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);
|
objects.get(i).put("sendsanfzt123",true);
|
||||||
|
logger.info("========主数据新增下发完成,日志保存为成功============");
|
||||||
continue;
|
continue;
|
||||||
}else {
|
}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");
|
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);
|
objects.get(i).put("sendsanfzt123",false);
|
||||||
|
logger.info("========主数据新增下发完成,日志保存为失败============");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1137,7 +1156,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
//所有下发发送完成,修改数据状态
|
//所有下发发送完成,修改数据状态
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
if(objects.get(i).getBoolean("sendsanfzt123")){
|
if(objects.get(i).getString("sendsanfzt123") != null && objects.get(i).getBoolean("sendsanfzt123")){
|
||||||
Map<String, Object> updateMap = new HashMap<>();
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
updateMap.put("tableName",mainDb);
|
updateMap.put("tableName",mainDb);
|
||||||
//updateMap.put("dataStatus", "Y");
|
//updateMap.put("dataStatus", "Y");
|
||||||
|
|
|
@ -3055,8 +3055,13 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
if(receiveApi.getReturnSuccessValue().equals(body)){
|
||||||
sysMessageManageLogEntity.setRemark("接口调用失败,返回格式错误,不是JSON");//返回信息
|
sysMessageManageLogEntity.setStatus("3");//返回信息
|
||||||
|
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + body);//返回信息
|
||||||
|
}else {
|
||||||
|
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||||
|
sysMessageManageLogEntity.setRemark("接口调用失败,返回格式错误,不是JSON");//返回信息
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||||
|
@ -3094,6 +3099,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
return sysMessageManageLogEntity;
|
return sysMessageManageLogEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendMssage(SysPushMessageEntity sysPushMessageEntity) {
|
private void sendMssage(SysPushMessageEntity sysPushMessageEntity) {
|
||||||
sysSendMessageLogService.sendMessage(sysPushMessageEntity);
|
sysSendMessageLogService.sendMessage(sysPushMessageEntity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue