diff --git a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/IIntegrationTaskLivingDetailsDao.java b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/IIntegrationTaskLivingDetailsDao.java index 3e94afda..bead3beb 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/IIntegrationTaskLivingDetailsDao.java +++ b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/IIntegrationTaskLivingDetailsDao.java @@ -10,6 +10,24 @@ import com.hzya.frame.basedao.dao.IBaseDao; * @since 2024-05-15 14:06:30 */ public interface IIntegrationTaskLivingDetailsDao extends IBaseDao<IntegrationTaskLivingDetailsEntity, String> { +/** + * + * @content 保存成功日志 + * @author laborer + * @date 2024/5/15 0015 15:34 + * + */ + IntegrationTaskLivingDetailsEntity saveSuccessLog(IntegrationTaskLivingDetailsEntity entity); +/** + * + * @content 通过主键逻辑删除数据 + * @author laborer + * @date 2024/5/15 0015 15:47 + * + * @return + */ + + int deleteById(String id); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/impl/IntegrationTaskLivingDetailsDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/impl/IntegrationTaskLivingDetailsDaoImpl.java index ae4c6839..1a353642 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/impl/IntegrationTaskLivingDetailsDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/dao/impl/IntegrationTaskLivingDetailsDaoImpl.java @@ -12,6 +12,20 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "IntegrationTaskLivingDetailsDaoImpl") public class IntegrationTaskLivingDetailsDaoImpl extends MybatisGenericDao<IntegrationTaskLivingDetailsEntity, String> implements IIntegrationTaskLivingDetailsDao{ - +/** + * + * @content 保存成功日志 + * @author laborer + * @date 2024/5/15 0015 15:34 + */ + @Override + public IntegrationTaskLivingDetailsEntity saveSuccessLog(IntegrationTaskLivingDetailsEntity entity) { + return super.save("com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.impl.IntegrationTaskLivingDetailsDaoImpl.entity_insert_success",entity); + } + + @Override + public int deleteById(String id) { + return super.delete("com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.impl.IntegrationTaskLivingDetailsDaoImpl.entity_logicDelete_for_uuid",id); + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml index d620468c..025035b2 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/entity/IntegrationTaskLivingDetailsEntity.xml @@ -323,6 +323,85 @@ </trim> ) </insert> + + <!--成功日志保存--> + <insert id="entity_insert_success" parameterType = "com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity" > + insert into integration_task_living_details_success( + <trim suffix="" suffixOverrides=","> + <if test="id != null and id != ''"> id , </if> + <if test="taskLinvingId != null and taskLinvingId != ''"> task_linving_id , </if> + <if test="result != null and result != ''"> result , </if> + <if test="queryCondition != null and queryCondition != ''"> query_condition , </if> + <if test="rootAppPk != null and rootAppPk != ''"> root_app_pk , </if> + <if test="rootAppBill != null and rootAppBill != ''"> root_app_bill , </if> + <if test="rootAppNewData != null and rootAppNewData != ''"> root_app_new_data , </if> + <if test="newTransmitInfo != null and newTransmitInfo != ''"> new_transmit_info , </if> + <if test="newPushDate != null"> new_push_date , </if> + <if test="repairPust != null and repairPust != ''"> repair_pust , </if> + <if test="create_time != null"> create_time , </if> + <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if> + <if test="modify_time != null"> modify_time , </if> + <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if> + <if test="sts != null and sts != ''"> sts , </if> + <if test="sorts != null"> sorts , </if> + <if test="senceId != null and senceId != ''"> sence_id , </if> + <if test="newState != null and newState != ''"> new_state , </if> + <if test="businessDate != null and businessDate != ''"> business_date , </if> + <if test="pluginId != null and pluginId != ''"> plugin_id , </if> + <if test="processingTime != null"> processing_time , </if> + <if test="processingRemarks != null and processingRemarks != ''"> processing_remarks , </if> + <if test="processorName != null and processorName != ''"> processor_name , </if> + <if test="processor != null and processor != ''"> processor , </if> + <if test="newSystemNumber != null and newSystemNumber != ''"> new_system_number , </if> + <if test="newSystemPrimary != null and newSystemPrimary != ''"> new_system_primary , </if> + <if test="remark != null and remark != ''"> remark , </if> + <if test="def1 != null and def1 != ''"> def1 , </if> + <if test="def2 != null and def2 != ''"> def2 , </if> + <if test="def3 != null and def3 != ''"> def3 , </if> + <if test="def4 != null and def4 != ''"> def4 , </if> + <if test="def5 != null and def5 != ''"> def5 , </if> + <if test="sorts == null ">sorts,</if> + <if test="sts == null ">sts,</if> + </trim> + )values( + <trim suffix="" suffixOverrides=","> + <if test="id != null and id != ''"> #{id} ,</if> + <if test="taskLinvingId != null and taskLinvingId != ''"> #{taskLinvingId} ,</if> + <if test="result != null and result != ''"> #{result} ,</if> + <if test="queryCondition != null and queryCondition != ''"> #{queryCondition} ,</if> + <if test="rootAppPk != null and rootAppPk != ''"> #{rootAppPk} ,</if> + <if test="rootAppBill != null and rootAppBill != ''"> #{rootAppBill} ,</if> + <if test="rootAppNewData != null and rootAppNewData != ''"> #{rootAppNewData} ,</if> + <if test="newTransmitInfo != null and newTransmitInfo != ''"> #{newTransmitInfo} ,</if> + <if test="newPushDate != null"> #{newPushDate} ,</if> + <if test="repairPust != null and repairPust != ''"> #{repairPust} ,</if> + <if test="create_time != null"> #{create_time} ,</if> + <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if> + <if test="modify_time != null"> #{modify_time} ,</if> + <if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if> + <if test="sts != null and sts != ''"> #{sts} ,</if> + <if test="sorts != null"> #{sorts} ,</if> + <if test="senceId != null and senceId != ''"> #{senceId} ,</if> + <if test="newState != null and newState != ''"> #{newState} ,</if> + <if test="businessDate != null and businessDate != ''"> #{businessDate} ,</if> + <if test="pluginId != null and pluginId != ''"> #{pluginId} ,</if> + <if test="processingTime != null"> #{processingTime} ,</if> + <if test="processingRemarks != null and processingRemarks != ''"> #{processingRemarks} ,</if> + <if test="processorName != null and processorName != ''"> #{processorName} ,</if> + <if test="processor != null and processor != ''"> #{processor} ,</if> + <if test="newSystemNumber != null and newSystemNumber != ''"> #{newSystemNumber} ,</if> + <if test="newSystemPrimary != null and newSystemPrimary != ''"> #{newSystemPrimary} ,</if> + <if test="remark != null and remark != ''"> #{remark} ,</if> + <if test="def1 != null and def1 != ''"> #{def1} ,</if> + <if test="def2 != null and def2 != ''"> #{def2} ,</if> + <if test="def3 != null and def3 != ''"> #{def3} ,</if> + <if test="def4 != null and def4 != ''"> #{def4} ,</if> + <if test="def5 != null and def5 != ''"> #{def5} ,</if> + <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from integration_task_living_details a WHERE a.sts = 'Y' ),</if> + <if test="sts == null ">'Y',</if> + </trim> + ) + </insert> <!-- 批量新增 --> <insert id="entityInsertBatch" > insert into integration_task_living_details(task_linving_id, result, query_condition, root_app_pk, root_app_bill, root_app_new_data, new_transmit_info, new_push_date, repair_pust, create_time, create_user_id, modify_time, modify_user_id, sts, sence_id, new_state, business_date, plugin_id, processing_time, processing_remarks, processor_name, processor, new_system_number, new_system_primary, remark, def1, def2, def3, def4, def5, sts) @@ -410,6 +489,12 @@ where id = #{id} <update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity" > update integration_task_living_details set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} where id = #{id} +</update> + + <!-- 逻辑删除 处理主键为UUID的情况 --> +<update id="entity_logicDelete_for_uuid" parameterType = "com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity" > +update integration_task_living_details set sts= 'N' +where id = #{id} </update> <!-- 多条件逻辑删除 --> <update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity" > diff --git a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/IIntegrationTaskLivingDetailsService.java b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/IIntegrationTaskLivingDetailsService.java index 1e3d9edd..bbaf4243 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/IIntegrationTaskLivingDetailsService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/IIntegrationTaskLivingDetailsService.java @@ -1,7 +1,10 @@ package com.hzya.frame.sysnew.integtationTaskLivingDetails.service; +import com.alibaba.fastjson.JSONObject; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + /** * 集成任务-实例详情(IntegrationTaskLivingDetails)表服务接口 * @@ -9,4 +12,45 @@ import com.hzya.frame.basedao.service.IBaseService; * @since 2024-05-15 14:06:43 */ public interface IIntegrationTaskLivingDetailsService extends IBaseService<IntegrationTaskLivingDetailsEntity, String>{ + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询任务实例列表分页 + * @Date 11:52 上午 2024/3/27 + **/ + JsonResultEntity testLog(JSONObject jsonObject)throws Exception; + + /** + * + * @content 成功日志公用接口 + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + JsonResultEntity saveLogToSuccess(IntegrationTaskLivingDetailsEntity entity)throws Exception; + /** + * + * @content 失败日志公用接口 + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + JsonResultEntity saveLogToFail(IntegrationTaskLivingDetailsEntity entity)throws Exception; + /** + * + * @content 重推成功接口(成功数据挪到成功日志表) + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + JsonResultEntity saveLogFailToSuccess(IntegrationTaskLivingDetailsEntity entity)throws Exception; + /** + * + * @content 重推失败更新接口 + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + JsonResultEntity updateLogFailToSuccess(IntegrationTaskLivingDetailsEntity entity)throws Exception; } diff --git a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/impl/IntegrationTaskLivingDetailsServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/impl/IntegrationTaskLivingDetailsServiceImpl.java index bac0f324..7ef0525f 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/impl/IntegrationTaskLivingDetailsServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/integtationTaskLivingDetails/service/impl/IntegrationTaskLivingDetailsServiceImpl.java @@ -1,8 +1,15 @@ package com.hzya.frame.sysnew.integtationTaskLivingDetails.service.impl; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.sysnew.integtationTaskLog.entity.IntegrationTaskLogEntity; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import com.hzya.frame.web.exception.BaseSystemException; import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.Resource; @@ -23,4 +30,158 @@ public class IntegrationTaskLivingDetailsServiceImpl extends BaseService<Integra this.integrationTaskLivingDetailsDao = dao; this.dao = dao; } +/** + * + * @content 完全用于测试,此接口不使用 + * @author laborer + * @date 2024/5/15 0015 16:00 + * + */ + + @Override + public JsonResultEntity testLog(JSONObject jsonObject)throws Exception { + IntegrationTaskLivingDetailsEntity entity = getData("jsonStr", jsonObject, IntegrationTaskLivingDetailsEntity.class); + String def1 = entity.getDef1(); + switch (def1){ + case "1": + return saveLogToSuccess(entity); + case "2": + return saveLogToFail(entity); + case "3": + return saveLogFailToSuccess(entity); + case "4": + return updateLogFailToSuccess(entity); + default: + break; + } + return null; + } + + /** + * + * @content 成功日志公用接口 + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + @Override + public JsonResultEntity saveLogToSuccess(IntegrationTaskLivingDetailsEntity entity)throws Exception { + checkDate(entity); + try { + entity = integrationTaskLivingDetailsDao.saveSuccessLog(entity); + return BaseResult.getSuccessMessageEntity(entity); + } catch (Exception e) { + e.printStackTrace(); + return BaseResult.getFailureMessageEntity("保存成功日志失败:"+e.getMessage()); + } + + } + + + /** + * + * @content 失败日志公用接口 + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + @Override + public JsonResultEntity saveLogToFail(IntegrationTaskLivingDetailsEntity entity)throws Exception { + //验证必填字段如果不满足返回数据 + checkDate(entity); + try { + entity = integrationTaskLivingDetailsDao.save(entity); + return BaseResult.getSuccessMessageEntity(entity); + } catch (Exception e) { + e.printStackTrace(); + return BaseResult.getFailureMessageEntity("保存失败日志错误:"+e.getMessage()); + } + } + /** + * + * @content 重推成功接口(成功数据挪到成功日志表) + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + @Override + public JsonResultEntity saveLogFailToSuccess(IntegrationTaskLivingDetailsEntity entity)throws Exception { + //验证必填字段如果不满足返回数据 + checkDate(entity); + try { + //先根据主键删除错误日志表数据,在进行成功表写入 + integrationTaskLivingDetailsDao.delete(entity.getId()); + //将数据写入成功日志表 + entity = integrationTaskLivingDetailsDao.saveSuccessLog(entity); + return BaseResult.getSuccessMessageEntity(entity); + } catch (Exception e) { + e.printStackTrace(); + return BaseResult.getFailureMessageEntity("保存失败日志错误:"+e.getMessage()); + } + } + /** + * + * @content 重推失败更新接口 + * @author laborer + * @date 2024/5/15 0015 15:05 + * + */ + @Override + public JsonResultEntity updateLogFailToSuccess(IntegrationTaskLivingDetailsEntity entity)throws Exception { + //验证必填字段如果不满足返回数据 + checkDate(entity); + try { + //将数据写入成功日志表 + entity = integrationTaskLivingDetailsDao.update(entity); + return BaseResult.getSuccessMessageEntity(entity); + } catch (Exception e) { + e.printStackTrace(); + return BaseResult.getFailureMessageEntity("更新失败日志错误:"+e.getMessage()); + } + } + /** + * + * @content 验证数据必填项 + * @author laborer + * @date 2024/5/15 0015 15:42 + * + */ + + private void checkDate(IntegrationTaskLivingDetailsEntity entity)throws Exception{ + //todo 除了必填字段理论都可以为空 根据业务需求自己定义 + //验证必填字段如果不满足返回数据 + String id = entity.getId();//不可为空,数据主键 + if (StrUtil.isEmpty(id)) { + throw new BaseSystemException("主键不可为空,请传入"); + } + String rootAppPk = entity.getRootAppPk();//源系统主键(通过该条件进行重推时数据查询不可为空) + if (StrUtil.isEmpty(rootAppPk)) { + throw new BaseSystemException("源系统主键不可为空,请传入"); + } + String rootAppBill = entity.getRootAppBill();//源系统单号(通过该条件进行重查询条件不可为空) + if (StrUtil.isEmpty(rootAppBill)) { + throw new BaseSystemException("源系统单号不可为空,请传入"); + } + String pluginId = entity.getPluginId();//插件ID 用于任务寻找插件方法字段(不可为空) + if (StrUtil.isEmpty(pluginId)) { + throw new BaseSystemException("插件ID不可为空,请传入"); + } + String rootAppNewData = entity.getRootAppNewData();//推送数据-最新(不可为空) + if (StrUtil.isEmpty(rootAppNewData)) { + throw new BaseSystemException("推送数据-最新不可为空,请传入"); + } + String newTransmitInfo = entity.getNewTransmitInfo();//三方系统返回数据(不可为空) + if (StrUtil.isEmpty(newTransmitInfo)) { + throw new BaseSystemException("三方系统返回数据不可为空,请传入"); + } + String repairPust = entity.getRepairPust();//是否补推(Y是N不是) 成功情况下默认N不需要补退 + if (StrUtil.isEmpty(repairPust)) { + throw new BaseSystemException("是否补推不可为空,请传入"); + } + String newState = entity.getNewState();//推送状态 成功情况下默认Y + if (StrUtil.isEmpty(newState)) { + throw new BaseSystemException("推送状态不可为空,请传入"); + } + } + }