Commit fef0c61f authored by suhuiguang's avatar suhuiguang

feat(jg): 压力管道后续业务

1.维修告知历史json存储结构不对修改 2.维修告知历史json数据新写入,解决结构不对,导致已完成后还实时查询设备信息 3.历史数据刷库接口开发
parent 4f3c9368
......@@ -442,4 +442,11 @@ public class DataHandlerController extends BaseController {
return ResponseHelper.buildResponse(dataHandlerService.synEquipFromDb2Es(equListCode, equCategoryCode, orgBranchCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/update/mainNoticeJson")
@ApiOperation(httpMethod = "PUT", value = "更新维修告知的json", notes = "更新维修告知的json")
public ResponseModel<Integer> updateMainNoticeJson(){
return ResponseHelper.buildResponse(dataHandlerService.updateMainNoticeJson());
}
}
\ No newline at end of file
......@@ -67,7 +67,7 @@ public class JgMaintainByWorkFlowController {
LinkedHashMap maintainInfo = (LinkedHashMap) model1.get(TABLE_PAGE_ID);
String opinion = model.get("opinion").toString();
JgMaintainNoticeDto jgMaintainNoticeDto = JSON.parseObject(JSON.toJSONString(maintainInfo), JgMaintainNoticeDto.class);
jgMaintainNoticeServiceImpl.accept(jgMaintainNoticeDto, op, opinion, model1);
jgMaintainNoticeServiceImpl.accept(jgMaintainNoticeDto, op, opinion, jgMaintainNoticeDto);
return ResponseHelper.buildResponse(null);
}
}
......@@ -54,8 +54,8 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore
import com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualityScore;
import com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import lombok.RequiredArgsConstructor;
......@@ -178,6 +178,9 @@ public class DataHandlerServiceImpl {
private final IdxBizJgRegisterInfoMapper registerInfoMapper;
private final IdxBizJgSupervisionInfoServiceImpl idxBizJgSupervisionInfoServiceImpl;
private final JgMaintainNoticeMapper jgMaintainNoticeMapper;
private final JgMaintainNoticeEqMapper jgMaintainNoticeEqMapper;
private final JgMaintainNoticeServiceImpl jgMaintainNoticeServiceImpl;
@Value("${jyjc.open.online: true}")
private Boolean onlineJyjc;
......@@ -2782,7 +2785,7 @@ public class DataHandlerServiceImpl {
if (!esEquipmentCategoryDtos.isEmpty()) {
totalUpdate = esEquipmentCategoryDtos.size() + totalUpdate;
esEquipmentCategory.saveAll(esEquipmentCategoryDtos);
esBulkService.bulkUpsert(IDX_BIZ_VIEW_JG_ALL, esEquipmentCategoryDtos.stream().map(e-> new EsEntity<>(e.getSEQUENCE_NBR(), e)).collect(Collectors.toList()));
esBulkService.bulkUpsert(IDX_BIZ_VIEW_JG_ALL, esEquipmentCategoryDtos.stream().map(e -> new EsEntity<>(e.getSEQUENCE_NBR(), e)).collect(Collectors.toList()));
idxBizJgSupervisionInfoServiceImpl.getBaseMapper().updateOrgBranchCodeBatch(esEquipmentCategoryDtos);
}
}
......@@ -2807,4 +2810,29 @@ public class DataHandlerServiceImpl {
p.put("orgBranchCode", orgBranchCode);
return equipInsert2EsPatcher.patchBatchData(p);
}
public Integer updateMainNoticeJson() {
log.info("处理维修告知的json历史数据开始");
StopWatch watch = new StopWatch();
watch.start();
List<JgMaintainNotice> maintainNoticesNotices = jgMaintainNoticeServiceImpl.list();
maintainNoticesNotices.parallelStream().forEach(r -> {
List<String> records = jgMaintainNoticeEqMapper.selectList(
new LambdaQueryWrapper<JgMaintainNoticeEq>()
.eq(JgMaintainNoticeEq::getEquipTransferId, r.getSequenceNbr()))
.stream()
.map(JgMaintainNoticeEq::getEquId)
.collect(Collectors.toList());
if (!records.isEmpty()) {
List<Map<String, Object>> deviceList = jgMaintainNoticeServiceImpl.getDeviceList(r, records);
JSONObject hisData = new JSONObject();
BeanUtil.copyProperties(r, hisData);
hisData.put("deviceList", deviceList);
commonServiceImpl.saveOrUpdateHistory(BusinessTypeEnum.JG_RENOVATION_REGISTRATION.getName(), hisData, null, r.getSequenceNbr() + "");
}
});
watch.stop();
log.info("处理维修告知的json历史数据结束:处理数量:「{}」,耗时:「{}」", maintainNoticesNotices.size(), watch.getTotalTimeSeconds());
return maintainNoticesNotices.size();
}
}
......@@ -219,14 +219,14 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr());
// 兼容老数据
if (hisData == null || ObjectUtils.isEmpty(hisData.get("deviceList"))) {
// 老数据逻辑
// 老数据逻辑-实时查询
setNewEquipInfo(sequenceNbr, maintainInfo, notice);
new FillingEditPermForCurrentUser(new JSONObject(maintainInfo), companyBo, BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION).getData();
return new HashMap<String, Map<String, Object>>() {{
put(TABLE_PAGE_ID, maintainInfo);
}};
} else {
// 新数据逻辑
// 新数据逻辑-使用json数据
hisData.putAll(maintainInfo);
CommonServiceImpl.formatTime2StrDateForEquip(hisData);
new FillingEditPermForCurrentUser(hisData, companyBo, BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION).getData();
......@@ -235,6 +235,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}};
}
} else {
// 实时查询
setNewEquipInfo(sequenceNbr, maintainInfo, notice);
new FillingEditPermForCurrentUser(new JSONObject(maintainInfo), companyBo, BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION).getData();
return new HashMap<String, Map<String, Object>>() {{
......@@ -293,7 +294,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
maintainInfo.put("deviceList", deviceList);
}
private List<Map<String, Object>> getDeviceList(JgMaintainNotice notice, List<String> equIds) {
public List<Map<String, Object>> getDeviceList(JgMaintainNotice notice, List<String> equIds) {
List<Map<String, Object>> deviceList;
if (!notice.getEquListCode().equals(EquipmentClassifityEnum.YLGD.getCode())) {
deviceList = getEquipListMaps(esEquipmentCategory.findAllById(equIds));
......@@ -973,7 +974,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public void accept(JgMaintainNoticeDto dto, String op, String opinion, Map<String, Object> model) {
public void accept(JgMaintainNoticeDto dto, String op, String opinion, JgMaintainNoticeDto jgMaintainNoticeDto) {
String instanceId = dto.getInstanceId();
String nextTaskId = dto.getNextTaskId();
String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId);
......@@ -1040,7 +1041,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
jgMaintainNoticeMapper.updateById(jgMaintainNotice);
// 保存历史表
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(model));
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(jgMaintainNoticeDto));
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName(), jsonObject, "", jgMaintainNotice.getSequenceNbr().toString());
// 保存流水表
......
......@@ -936,7 +936,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
LinkedHashMap model1 = (LinkedHashMap) map.get("model");
String opinion = (String) map.get("opinion");
String jsonString = JSON.toJSONString(model1);
JSONObject jsonObject = JSONObject.parseObject(jsonString);
JgReformNoticeDto jgReformNoticeDto = JSON.parseObject(jsonString, JgReformNoticeDto.class);
jgReformNoticeDto.setRemark(opinion);
String instanceId = jgReformNoticeDto.getInstanceId();
......
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