Commit 9f129b60 authored by suhuiguang's avatar suhuiguang

1.编辑功能调整,设备编辑后,通知其他业务进行更新json

parent f7708a9a
...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jg.api.dto; ...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jg.api.dto;
import lombok.Data; import lombok.Data;
import java.util.Set;
@Data @Data
public class BizRelationDataDto { public class BizRelationDataDto {
...@@ -30,4 +32,9 @@ public class BizRelationDataDto { ...@@ -30,4 +32,9 @@ public class BizRelationDataDto {
* 附件 * 附件
*/ */
private String changeAttachment; private String changeAttachment;
/**
* 变更的设备
*/
private Set<String> records;
} }
...@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -66,4 +67,6 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat ...@@ -66,4 +67,6 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat
* @return 已完成但是未生成装置的施工信息的安装告知单据列表 * @return 已完成但是未生成装置的施工信息的安装告知单据列表
*/ */
List<JgInstallationNotice> selectNotInsertProjectConstructionInstallNoticeList(); List<JgInstallationNotice> selectNotInsertProjectConstructionInstallNoticeList();
Set<Long> queryListByEqsAndStatus(@Param("records") Set<String> records, @Param("noticeStatus") String noticeStatus);
} }
...@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -38,4 +39,6 @@ public interface JgMaintenanceContractMapper extends BaseMapper<JgMaintenanceCon ...@@ -38,4 +39,6 @@ public interface JgMaintenanceContractMapper extends BaseMapper<JgMaintenanceCon
List<MaintenanceVo> queryMaintenanceInIds(@Param("ids") List<String> ids); List<MaintenanceVo> queryMaintenanceInIds(@Param("ids") List<String> ids);
String getNameByEquDefine(String equDefine); String getNameByEquDefine(String equDefine);
Set<Long> queryListByEqsAndStatus(@Param("records") Set<String> records, @Param("status") String status);
} }
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -19,4 +20,5 @@ public interface JgUseRegistrationEqMapper extends BaseMapper<JgUseRegistrationE ...@@ -19,4 +20,5 @@ public interface JgUseRegistrationEqMapper extends BaseMapper<JgUseRegistrationE
void batchInsert(@Param("equipTransferId") String equipTransferId, @Param("jgRelationEquipList") List<JgUseRegistrationEq> jgRelationEquipList); void batchInsert(@Param("equipTransferId") String equipTransferId, @Param("jgRelationEquipList") List<JgUseRegistrationEq> jgRelationEquipList);
List<JgUseRegistrationEqDto> queryEqListByApplyNo(@Param("applyNo") String applyNo);
} }
...@@ -360,4 +360,21 @@ ...@@ -360,4 +360,21 @@
and n.project_contraption_id <![CDATA[ <> ]]> '' and n.project_contraption_id <![CDATA[ <> ]]> ''
and not EXISTS (select 1 from idx_biz_jg_project_construction c where c.record=n.sequence_nbr) and not EXISTS (select 1 from idx_biz_jg_project_construction c where c.record=n.sequence_nbr)
</select> </select>
<select id="queryListByEqsAndStatus"
resultType="java.lang.Long">
SELECT
distinct n.sequence_nbr as sequence_nbr
FROM
"tzs_jg_installation_notice" n,
tzs_jg_installation_notice_eq ne
WHERE
n.notice_status =#{noticeStatus}
and n.is_delete=0
<if test='records != null'>
and ne.equ_id in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
</if>
</select>
</mapper> </mapper>
...@@ -195,4 +195,20 @@ ...@@ -195,4 +195,20 @@
ORDER BY ORDER BY
tjmc.create_date DESC, tjmc.apply_no DESC tjmc.create_date DESC, tjmc.apply_no DESC
</select> </select>
</mapper> <select id="queryListByEqsAndStatus" resultType="java.lang.Long">
SELECT
distinct n.sequence_nbr as sequence_nbr
FROM
tzs_jg_maintenance_contract n,
tzs_jg_maintenance_contract_eq ne
WHERE
n.status = #{status}
and n.is_delete=0
<if test='records != null'>
and ne.equ_id in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
...@@ -9,4 +9,16 @@ ...@@ -9,4 +9,16 @@
(#{item.sequenceNbr},#{equipTransferId}, #{item.equId}) (#{item.sequenceNbr},#{equipTransferId}, #{item.equId})
</foreach> </foreach>
</insert> </insert>
<select id="queryEqListByApplyNo"
resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto">
SELECT
eq.equ_id,
eq.sequence_nbr
FROM
tzs_jg_use_registration_eq eq,
tzs_jg_use_registration u
where
u.sequence_nbr = eq.equip_transfer_id
and u.apply_no=#{applyNo}
</select>
</mapper> </mapper>
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
public class FlowingEquipRedisContext { public class FlowingEquipRedisContext {
private static ThreadLocal<List<FlowingEquipRedisKeyDTO>> threadLocal = new ThreadLocal<>(); private static final ThreadLocal<List<FlowingEquipRedisKeyDTO>> threadLocal = new ThreadLocal<>();
public static List<FlowingEquipRedisKeyDTO> getContext() { public static List<FlowingEquipRedisKeyDTO> getContext() {
if (threadLocal.get() == null) { if (threadLocal.get() == null) {
...@@ -29,9 +29,7 @@ public class FlowingEquipRedisContext { ...@@ -29,9 +29,7 @@ public class FlowingEquipRedisContext {
public static void clean() { public static void clean() {
log.info("FlowingEquipRedisContext clean begin"); log.info("FlowingEquipRedisContext clean begin");
if (threadLocal != null) { threadLocal.remove();
threadLocal.remove();
}
log.info("FlowingEquipRedisContext clean end"); log.info("FlowingEquipRedisContext clean end");
} }
} }
package com.yeejoin.amos.boot.module.jg.biz.event.handler;
import org.springframework.context.ApplicationEvent;
public interface IChangeUpdateHandler<T extends ApplicationEvent> {
void handle(T event);
Boolean supports(T event);
}
package com.yeejoin.amos.boot.module.jg.biz.event.handler;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterDataChangeHandleImpl;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Set;
@Component
@RequiredArgsConstructor
@Slf4j
public class InstallNoticeUpdateUpdateHandler implements IChangeUpdateHandler<ChangeDataEvent> {
private final JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Override
@Async
public void handle(ChangeDataEvent event) {
log.info("开始更新安装告知json数据:{}", event);
// 查询关联的单据-未删除且已完成状态
Set<Long> installationNoticeIds = this.getRelationInstallNoticeList(event);
// 更新历史json
installationNoticeIds.forEach(seq -> {
// 更新json
JgInstallationNotice installationNotice = jgInstallationNoticeService.getById(seq);
jgInstallationNoticeService.saveHisDataBeforeUpdate(installationNotice);
});
}
private Set<Long> getRelationInstallNoticeList(ChangeDataEvent event) {
// 变化的设备
Set<String> records = event.getBizRelationData().getRecords();
// 查询关联的单据-已完成时更新其json
return jgInstallationNoticeService.getBaseMapper().queryListByEqsAndStatus(records, FlowStatusEnum.TO_BE_FINISHED.getCode() + "");
}
@Override
public Boolean supports(ChangeDataEvent event) {
return event.getBizRelationData().getBizType().equals(UseRegisterDataChangeHandleImpl.BIZ_TYPE);
}
}
package com.yeejoin.amos.boot.module.jg.biz.event.handler;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract;
import com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgMaintenanceContractServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterDataChangeHandleImpl;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Set;
@Component
@RequiredArgsConstructor
@Slf4j
public class MaintenanceContractUpdateUpdateHandler implements IChangeUpdateHandler<ChangeDataEvent> {
private final JgMaintenanceContractServiceImpl jgMaintenanceContractService;
@Override
@Async
public void handle(ChangeDataEvent event) {
log.info("开始更新维保备案json数据:{}", event);
// 查询关联的单据-未删除且已完成状态
Set<Long> maintenanceContractList = this.getRelationMaintenanceContractList(event);
// 更新历史json
maintenanceContractList.forEach(seq -> {
// 更新json
JgMaintenanceContract maintenanceContract = jgMaintenanceContractService.getById(seq);
jgMaintenanceContractService.updateHisDataAfterEquipEdit(maintenanceContract);
});
}
private Set<Long> getRelationMaintenanceContractList(ChangeDataEvent event) {
// 变化的设备
Set<String> records = event.getBizRelationData().getRecords();
// 查询关联的单据-已完成时更新其json
return jgMaintenanceContractService.getBaseMapper().queryListByEqsAndStatus(records, FlowStatusEnum.TO_BE_FINISHED.getName());
}
@Override
public Boolean supports(ChangeDataEvent event) {
return event.getBizRelationData().getBizType().equals(UseRegisterDataChangeHandleImpl.BIZ_TYPE);
}
}
...@@ -12,8 +12,9 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImp ...@@ -12,8 +12,9 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImp
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;
import org.typroject.tyboot.core.foundation.context.RequestContextModel; import org.typroject.tyboot.core.foundation.context.RequestContextModel;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -26,6 +27,7 @@ import java.util.concurrent.ExecutorService; ...@@ -26,6 +27,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
/** /**
* @author Administrator * @author Administrator
...@@ -33,7 +35,7 @@ import java.util.stream.Collectors; ...@@ -33,7 +35,7 @@ import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
public class ChangeDataEventListener { public class ChangeLogInsertListener {
private static final Map<String, String> bizTypeTableMap = new HashMap<>(); private static final Map<String, String> bizTypeTableMap = new HashMap<>();
...@@ -42,17 +44,19 @@ public class ChangeDataEventListener { ...@@ -42,17 +44,19 @@ public class ChangeDataEventListener {
bizTypeTableMap.put("singleManageEquipEdit", "idx_biz_jg_use_info"); bizTypeTableMap.put("singleManageEquipEdit", "idx_biz_jg_use_info");
} }
@Value("${changeData.deal.thread.number:1}") @Value("${change.data.deal.thread.number:1}")
private int threadNumber; private int threadNumber;
private final ESDataChangeLogDao esDataChangeLogDao; private final ESDataChangeLogDao esDataChangeLogDao;
private final JgBizChangeLogServiceImpl bizChangeLogService; private final JgBizChangeLogServiceImpl bizChangeLogService;
private final BlockingQueue<ChangeDataEvent> queue = new LinkedBlockingQueue<>(); private final BlockingQueue<ChangeDataEvent> queue = new LinkedBlockingQueue<>();
@EventListener(value = ChangeDataEvent.class) @TransactionalEventListener(value = ChangeDataEvent.class)
@Async
public void handleTransactionalEvent(ChangeDataEvent event) { public void handleTransactionalEvent(ChangeDataEvent event) {
log.info("收到用户变更业务数据消息:{}", JSONObject.toJSONString(event)); log.info("收到用户变更业务数据消息:{}", JSONObject.toJSONString(event));
queue.add(event); queue.add(event);
...@@ -61,27 +65,26 @@ public class ChangeDataEventListener { ...@@ -61,27 +65,26 @@ public class ChangeDataEventListener {
@PostConstruct @PostConstruct
public void init() { public void init() {
ExecutorService executorService = Executors.newFixedThreadPool(threadNumber); ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);
for (int i = 0; i < threadNumber; i++) { IntStream.range(0, threadNumber).forEach(i -> {
executorService.execute(() -> { executorService.execute(() -> {
while (true) { while (true) {
try { try {
ChangeDataEvent event = queue.take(); ChangeDataEvent event = queue.take();
this.dealData(event); processEvent(event);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} }
}); });
});
}
} }
private void dealData(ChangeDataEvent event) { private void processEvent(ChangeDataEvent event) {
List<ChangeDataDto> changeDataDtos = event.getData(); List<ChangeDataDto> changeDataDtos = event.getData();
RequestContextModel requestContextModel = event.getRequestContext(); RequestContextModel requestContextModel = event.getRequestContext();
Date date = new Date(); Date date = new Date();
// 1.主表保存 // 1.主表保存
JgBizChangeLog changeLog = saveLog(event); JgBizChangeLog changeLog = saveLog(event);
// 2.子表字段保存 // 2.子表字段保存
List<ESDataChangeLogDto> logs = saveColumnsChange2Es(changeDataDtos, requestContextModel, date, changeLog); List<ESDataChangeLogDto> logs = saveColumnsChange2Es(changeDataDtos, requestContextModel, date, changeLog);
log.info("es 操作日志数据入库成功:{}条", logs.size()); log.info("es 操作日志数据入库成功:{}条", logs.size());
...@@ -103,7 +106,7 @@ public class ChangeDataEventListener { ...@@ -103,7 +106,7 @@ public class ChangeDataEventListener {
changeLogDto.setBatchId(changeLog.getSequenceNbr() + ""); changeLogDto.setBatchId(changeLog.getSequenceNbr() + "");
return changeLogDto; return changeLogDto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if(!logs.isEmpty()){ if (!logs.isEmpty()) {
esDataChangeLogDao.saveAll(logs); esDataChangeLogDao.saveAll(logs);
} }
return logs; return logs;
......
package com.yeejoin.amos.boot.module.jg.biz.event.listener;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent;
import com.yeejoin.amos.boot.module.jg.biz.event.handler.IChangeUpdateHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEvent;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.IntStream;
/**
* @author Administrator
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class RelationBizApplyUpdateListener {
@Value("${relation.data.deal.thread.number:1}")
private int threadNumber;
private final List<IChangeUpdateHandler<ApplicationEvent>> changeUpdateHandlers;
private final BlockingQueue<ChangeDataEvent> queue = new LinkedBlockingQueue<>();
@TransactionalEventListener(value = ChangeDataEvent.class)
@Async
public void handleTransactionalEvent(ChangeDataEvent event) {
log.info("收到用户变更业务数据消息:{}", JSONObject.toJSONString(event));
queue.add(event);
}
@PostConstruct
public void init() {
ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);
IntStream.range(0, threadNumber).forEach(i -> {
executorService.execute(() -> {
while (true) {
try {
ChangeDataEvent event = queue.take();
processEvent(event);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
});
});
}
private void processEvent(ChangeDataEvent event) {
changeUpdateHandlers.stream().filter(h -> h.supports(event)).forEach(h -> h.handle(event));
}
}
...@@ -18,7 +18,6 @@ public class EventPublisher implements ApplicationEventPublisherAware { ...@@ -18,7 +18,6 @@ public class EventPublisher implements ApplicationEventPublisherAware {
this.publisher = applicationEventPublisher; this.publisher = applicationEventPublisher;
} }
@Async
public void publish(ApplicationEvent event) { public void publish(ApplicationEvent event) {
publisher.publishEvent(event); publisher.publishEvent(event);
} }
......
...@@ -1603,11 +1603,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1603,11 +1603,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
idxBizJgUseInfoMapper.update(idxBizJgUseInfo, lambda); idxBizJgUseInfoMapper.update(idxBizJgUseInfo, lambda);
} }
private void saveHisDataBeforeUpdate(JgInstallationNotice jgInstallationNotice) { public void saveHisDataBeforeUpdate(JgInstallationNotice jgInstallationNotice) {
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr()); queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr());
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper); List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(queryWrapper);
List<String> ids = jgInstallationNoticeEqs.stream().map(item -> item.getEquId()).collect(Collectors.toList()); List<String> ids = jgInstallationNoticeEqs.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toList());
List<Map<String, Object>> equipListMaps; List<Map<String, Object>> equipListMaps;
String equCategoryCode = jgInstallationNotice.getEquCategoryCode(); String equCategoryCode = jgInstallationNotice.getEquCategoryCode();
Map<String, Object> installationInfo = BeanUtil.beanToMap(jgInstallationNotice, false, true); Map<String, Object> installationInfo = BeanUtil.beanToMap(jgInstallationNotice, false, true);
...@@ -1630,6 +1630,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1630,6 +1630,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName(), new JSONObject(installationInfo), null, jgInstallationNotice.getSequenceNbr().toString()); commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName(), new JSONObject(installationInfo), null, jgInstallationNotice.getSequenceNbr().toString());
} }
private void saveHisDataBeforeUpdate(JgInstallationNotice jgInstallationNotice, String equId) { private void saveHisDataBeforeUpdate(JgInstallationNotice jgInstallationNotice, String equId) {
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId); Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId);
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName(), new JSONObject(map), equId, jgInstallationNotice.getSequenceNbr().toString()); commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName(), new JSONObject(map), equId, jgInstallationNotice.getSequenceNbr().toString());
......
...@@ -917,6 +917,12 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC ...@@ -917,6 +917,12 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName(), JSON.parseArray(JSON.toJSONString(equipmentLists)), null, maintenanceContract.getSequenceNbr().toString()); commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName(), JSON.parseArray(JSON.toJSONString(equipmentLists)), null, maintenanceContract.getSequenceNbr().toString());
} }
public void updateHisDataAfterEquipEdit(JgMaintenanceContract maintenanceContract) {
List<Map<String, Object>> list = maintenanceContractMapper.selectEquipList(maintenanceContract.getSequenceNbr());
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName(), JSON.parseArray(JSON.toJSONString(list)), null, maintenanceContract.getSequenceNbr().toString());
}
@Override @Override
public boolean beforeCheck(JgMaintenanceContractDto jgMaintenanceContract) { public boolean beforeCheck(JgMaintenanceContractDto jgMaintenanceContract) {
return jgMaintenanceContract.getInstanceId() != null && !jgMaintenanceContract.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName()) &&!jgMaintenanceContract.getStatus().equals(FlowStatusEnum.TO_BE_DISCARD.getName()); return jgMaintenanceContract.getInstanceId() != null && !jgMaintenanceContract.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName()) &&!jgMaintenanceContract.getStatus().equals(FlowStatusEnum.TO_BE_DISCARD.getName());
......
...@@ -32,6 +32,10 @@ public class JgUseRegistrationEqServiceImpl extends BaseService<JgUseRegistratio ...@@ -32,6 +32,10 @@ public class JgUseRegistrationEqServiceImpl extends BaseService<JgUseRegistratio
return this.queryForList("" , false); return this.queryForList("" , false);
} }
public List<JgUseRegistrationEqDto> queryForJgUseRegistrationEqList(String equipTransferId) {
return this.queryForList("" , false, equipTransferId);
}
public List<JgUseRegistrationEq> getListByEquIds(List<String> equIds) { public List<JgUseRegistrationEq> getListByEquIds(List<String> equIds) {
QueryWrapper<JgUseRegistrationEq> queryWrapper = new QueryWrapper<>(); QueryWrapper<JgUseRegistrationEq> queryWrapper = new QueryWrapper<>();
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto; import com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto; import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto;
import com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy; import com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.context.DataProcessStrategyContext; import com.yeejoin.amos.boot.module.jg.biz.context.DataProcessStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent; import com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent;
...@@ -13,6 +14,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -13,6 +14,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStrategy { public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStrategy {
...@@ -22,6 +24,8 @@ public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStra ...@@ -22,6 +24,8 @@ public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStra
private final UseRegisterUpdateService useRegisterUpdateService; private final UseRegisterUpdateService useRegisterUpdateService;
public final static String BIZ_TYPE = "useRegister";
public UseRegisterDataChangeHandleImpl(EventPublisher publisher, UseRegisterUpdateService useRegisterUpdateService) { public UseRegisterDataChangeHandleImpl(EventPublisher publisher, UseRegisterUpdateService useRegisterUpdateService) {
this.publisher = publisher; this.publisher = publisher;
...@@ -31,7 +35,7 @@ public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStra ...@@ -31,7 +35,7 @@ public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStra
@Override @Override
public String canHandleBizType() { public String canHandleBizType() {
return "useRegister"; return BIZ_TYPE;
} }
...@@ -57,9 +61,11 @@ public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStra ...@@ -57,9 +61,11 @@ public class UseRegisterDataChangeHandleImpl implements IBizDataChangeHandleStra
} }
private void publishEvent2Logger(String applyNo, List<ChangeDataDto> allChangeColumns) { private void publishEvent2Logger(String applyNo, List<ChangeDataDto> allChangeColumns) {
List<JgUseRegistrationEqDto> eqDtos = useRegisterUpdateService.useRegistrationEqService.getBaseMapper().queryEqListByApplyNo(applyNo);
BizRelationDataDto bizRelationDataDto = new BizRelationDataDto(); BizRelationDataDto bizRelationDataDto = new BizRelationDataDto();
bizRelationDataDto.setBizId(applyNo); bizRelationDataDto.setBizId(applyNo);
bizRelationDataDto.setBizType(canHandleBizType()); bizRelationDataDto.setBizType(canHandleBizType());
bizRelationDataDto.setRecords(eqDtos.stream().map(JgUseRegistrationEqDto::getEquId).collect(Collectors.toSet()));
// 异步记录日志 // 异步记录日志
publisher.publish(new ChangeDataEvent(this, bizRelationDataDto, allChangeColumns, RequestContext.cloneRequestContext())); publisher.publish(new ChangeDataEvent(this, bizRelationDataDto, allChangeColumns, RequestContext.cloneRequestContext()));
} }
......
...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.InformationManageTypeEnum; ...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.InformationManageTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -24,23 +25,18 @@ import java.util.stream.Collectors; ...@@ -24,23 +25,18 @@ import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toList;
@Service @Service
@RequiredArgsConstructor
public class UseRegisterUpdateService { public class UseRegisterUpdateService {
private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper; private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
private final JgUseRegistrationServiceImpl useRegistrationService; private final JgUseRegistrationServiceImpl useRegistrationService;
private final JgRegistrationHistoryServiceImpl jgRegistrationHistoryService; private final JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
private final IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionService; private final IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionService;
public UseRegisterUpdateService(IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper, JgUseRegistrationServiceImpl useRegistrationService, JgRegistrationHistoryServiceImpl jgRegistrationHistoryService, IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionService) { protected final JgUseRegistrationEqServiceImpl useRegistrationEqService;
this.idxBizJgRegisterInfoMapper = idxBizJgRegisterInfoMapper;
this.useRegistrationService = useRegistrationService;
this.jgRegistrationHistoryService = jgRegistrationHistoryService;
this.idxBizJgProjectContraptionService = idxBizJgProjectContraptionService;
}
public void updateHisData(String applyNo) { public void updateHisData(String applyNo) {
JgUseRegistration jgUseRegistration = useRegistrationService.getOne(new LambdaQueryWrapper<JgUseRegistration>().eq(JgUseRegistration::getApplyNo, applyNo)); JgUseRegistration jgUseRegistration = useRegistrationService.getOne(new LambdaQueryWrapper<JgUseRegistration>().eq(JgUseRegistration::getApplyNo, applyNo));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment