下发填写日志
This commit is contained in:
parent
319bd2ba7a
commit
4351dd9ef7
|
@ -117,7 +117,7 @@ public interface IMdmService {
|
|||
* @Description 处理分发数据
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity doMdmDistribute(JSONObject jsonObject);
|
||||
JsonResultEntity doMdmDistribute(JSONObject jsonObject) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
|
|||
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
|
||||
import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao;
|
||||
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao;
|
||||
import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao;
|
||||
import com.hzya.frame.sysnew.user.dao.ISysUserDao;
|
||||
|
@ -85,6 +87,8 @@ public class MdmServiceImpl implements IMdmService {
|
|||
@Resource
|
||||
private IMdmModuleDao mdmModuleDao;
|
||||
|
||||
@Resource
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
@Resource
|
||||
private IGroovyIntegrationService groovyIntegrationService;
|
||||
@Resource
|
||||
|
@ -1612,7 +1616,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity doMdmDistribute(JSONObject jsonStr) {
|
||||
public JsonResultEntity doMdmDistribute(JSONObject jsonStr) throws Exception {
|
||||
JSONObject jsonObject = getstrObj("jsonStr", jsonStr);
|
||||
//校验是否有servecr传参
|
||||
if (!checkData(jsonObject, "mdmCode")) {
|
||||
|
@ -1843,7 +1847,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
saveMdmModuleSendLogEntity("2", "转发失败,认证接口不存在", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败,认证接口不存在", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误,认证接口不存在");
|
||||
|
||||
}
|
||||
|
@ -1857,7 +1861,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
String rzbodys = getBodys(loginApi, null, null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi, rzheaders, rzbodys, rzquerys);
|
||||
if (!rzjsonResultEntity.isFlag()) {
|
||||
saveMdmModuleSendLogEntity("2", "转发失败,认证接口调用失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败,认证接口调用失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误:" + rzjsonResultEntity.getMsg());
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
|
@ -1869,10 +1873,10 @@ public class MdmServiceImpl implements IMdmService {
|
|||
//组装数据发送
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers, bodys, querys);
|
||||
if (jsonResultEntity.isFlag()) {
|
||||
saveMdmModuleSendLogEntity("1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getSuccessMessageEntity("发送成功");
|
||||
} else {
|
||||
saveMdmModuleSendLogEntity("2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg());
|
||||
}
|
||||
}
|
||||
|
@ -2262,10 +2266,9 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
}
|
||||
|
||||
private void saveMdmModuleSendLogEntity(String dataType, String remark, String dbname, String formmain_id, String target_app, String target_api, String source_data, String option_type) {
|
||||
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) throws Exception {
|
||||
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
||||
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
||||
mdmModuleSendLogEntity.setCreate();
|
||||
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
||||
mdmModuleSendLogEntity.setSts("Y");
|
||||
mdmModuleSendLogEntity.setCreate_user_id("1");
|
||||
|
@ -2282,6 +2285,35 @@ public class MdmServiceImpl implements IMdmService {
|
|||
mdmModuleSendLogEntity.setDataType(dataType);
|
||||
mdmModuleSendLogEntity.setRemark(remark);
|
||||
mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
|
||||
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(source_data);
|
||||
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");
|
||||
JSONObject aa = new JSONObject();
|
||||
aa.put("mdmCode",mdmCode);//主数据编码
|
||||
aa.put("documentRule",jsonObject.getString("document_rule"));//行数据的单据规则编码
|
||||
aa.put("distributeId",distributeId);//发送表id
|
||||
aa.put("type",option_type);//发送类型,1、新增2、修改3、删除
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(aa.toJSONString());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(jsonObject.getString("document_rule"));
|
||||
integrationTaskLivingDetailsEntity.setPluginId("MdmModulePlugin");
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(source_data);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(remark);
|
||||
if("1".equals(dataType)){
|
||||
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
|
||||
}else {
|
||||
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Groovy 脚本执行实现类
|
||||
*
|
||||
|
@ -59,8 +62,12 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
|
|||
billheadObject.put("user_name", data.get("user_name"));
|
||||
billheadObject.put("user_code", data.get("user_code"));
|
||||
billheadObject.put("user_password", "Hzya@1314");
|
||||
billheadObject.put("pwdparam", data.get("pwdparam"));
|
||||
billheadObject.put("abledate", data.get("abledate"));
|
||||
java.util.Date date = new java.util.Date();
|
||||
java.text.SimpleDateFormat yyyy = new java.text.SimpleDateFormat("yyyy-MM-dd");
|
||||
java.text.SimpleDateFormat mmm = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
billheadObject.put("pwdparam", yyyy.format(date));
|
||||
billheadObject.put("abledate", mmm.format(date));
|
||||
billheadObject.put("islocked", data.get("islocked"));
|
||||
billheadObject.put("user_type", data.get("user_type"));
|
||||
billheadObject.put("base_doc_type", data.get("base_doc_type"));
|
||||
|
|
Loading…
Reference in New Issue