Commit c4ddd9e2 authored by suhuiguang's avatar suhuiguang

feat(jyjc): 报检开发调整

1.报检规则4.0开发,联调自测bug修改
parent 67551e25
......@@ -17,11 +17,11 @@ public enum OpenBizTypeEnum {
JY("jy","检验业务"),
JC("jc","检测业务");
private String code;
private final String code;
private String name;
private final String name;
private OpenBizTypeEnum(String code,String name){
OpenBizTypeEnum(String code, String name){
this.code = code;
this.name = name;
}
......
......@@ -159,7 +159,7 @@ public class JyjcOpeningApplicationController extends BaseController {
Page<JyjcOpeningApplication> page = new Page<JyjcOpeningApplication>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.queryForJyjcOpeningApplicationPage(page, jyjcOpeningApplicationRequstDto,client));
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.queryForJyjcOpeningApplicationPage(page, jyjcOpeningApplicationRequstDto, client));
}
/**
......@@ -183,8 +183,8 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "流程节点执行", notes = "流程节点执行")
@PostMapping(value = "/execueFlow")
public ResponseModel<HashMap<String, String>> executeFlow(@RequestBody Map<String, Object> params) {
jyjcOpeningApplicationServiceImpl.executeFlow(params);
public ResponseModel<Map<String, String>> executeFlow(@RequestBody Map<String, Object> params) {
jyjcOpeningApplicationServiceImpl.executedFlow(params);
HashMap<String, String> result = new HashMap<>();
result.put("result", "success");
return ResponseHelper.buildResponse(result);
......
......@@ -19,7 +19,6 @@ import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionHistory;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.enums.OpenBizTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.PersonTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.InstanceRuntimeData;
......@@ -140,11 +139,15 @@ public class CommonServiceImpl {
userInfoQueryWrapper.and(w -> w.like(TzsUserInfo::getPost, jyUserPost).or().like(TzsUserInfo::getPost, jcUserPost).or().like(TzsUserInfo::getPost, chargeUserPost));
return;
}
if (personType.equals(OpenBizTypeEnum.JY.getCode())) {
if (personType.contains(PersonTypeEnum.jc.name()) && personType.contains(PersonTypeEnum.jy.name())) {
userInfoQueryWrapper.and(w -> w.like(TzsUserInfo::getPost, jyUserPost).or().like(TzsUserInfo::getPost, jcUserPost));
return;
}
if (personType.equals(PersonTypeEnum.jy.name())) {
userInfoQueryWrapper.like(TzsUserInfo::getPost, jyUserPost);
return;
}
if (personType.equals(OpenBizTypeEnum.JC.getCode())) {
if (personType.equals(PersonTypeEnum.jc.name())) {
userInfoQueryWrapper.like(TzsUserInfo::getPost, jcUserPost);
}
}
......
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEquip;
import com.yeejoin.amos.boot.module.jyjc.api.model.InspectionPlanModel;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author Administrator
......@@ -25,21 +26,24 @@ import java.util.Optional;
@Service
public class InspectionPlanServiceImpl {
private JyjcInspectionApplicationServiceImpl inspectionApplicationService;
private final IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
private JyjcInspectionApplicationEquipServiceImpl applicationEquipService;
private final JyjcInspectionApplicationServiceImpl inspectionApplicationService;
private JyjcInspectionResultServiceImpl inspectionResultService;
private final JyjcInspectionApplicationEquipServiceImpl applicationEquipService;
private ESEquipmentCategory esEquipmentCategory;
private final JyjcInspectionResultServiceImpl inspectionResultService;
private final ESEquipmentCategory esEquipmentCategory;
public InspectionPlanServiceImpl(JyjcInspectionApplicationServiceImpl inspectionApplicationService,
JyjcInspectionApplicationEquipServiceImpl applicationEquipService,
JyjcInspectionResultServiceImpl inspectionResultService, ESEquipmentCategory esEquipmentCategory) {
JyjcInspectionResultServiceImpl inspectionResultService, ESEquipmentCategory esEquipmentCategory, IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper) {
this.inspectionApplicationService = inspectionApplicationService;
this.applicationEquipService = applicationEquipService;
this.inspectionResultService = inspectionResultService;
this.esEquipmentCategory = esEquipmentCategory;
this.idxBizJgProjectContraptionMapper = idxBizJgProjectContraptionMapper;
}
......@@ -66,33 +70,34 @@ public class InspectionPlanServiceImpl {
JSONObject jsonObject = inspectionApplication.getPlanData();
if (jsonObject == null) {
jsonObject = new JSONObject();
String address = this.getOneEquipAddress(applicationSeq);
String address = this.getOneEquipAddress(inspectionApplication);
jsonObject.put("address", address);
}
return jsonObject;
}
private String getOneEquipAddress(String applicationSeq) {
// 查询报检的设备,返回地址,目前是单台报检,applicationEquips长度只有1,后续会多个
List<JyjcInspectionApplicationEquip> applicationEquips = applicationEquipService.list(new LambdaQueryWrapper<JyjcInspectionApplicationEquip>().eq(JyjcInspectionApplicationEquip::getApplicationSeq, applicationSeq));
// 拼接地址
List<String> allAddress = new ArrayList<>();
applicationEquips.forEach(e -> {
String record = e.getEquipUnicode();
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
private String getOneEquipAddress(JyjcInspectionApplication application) {
// 压力管道取装置使用/安装地址
if (EquipmentClassifityEnum.YLGD.getCode().equals(application.getEquipClassify())) {
IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionMapper.selectById(application.getProjectContraptionId());
return Stream.of(projectContraption.getProvinceName(), projectContraption.getCityName(), projectContraption.getCountyName(), projectContraption.getStreetName(), projectContraption.getAddress())
.map(value -> value == null ? "" : value)
.collect(Collectors.joining());
} else {
// 其他取第一个设备使用/安装地址
List<JyjcInspectionApplicationEquip> applicationEquips = applicationEquipService.list(new LambdaQueryWrapper<JyjcInspectionApplicationEquip>().eq(JyjcInspectionApplicationEquip::getApplicationSeq, application.getSequenceNbr()));
if (!applicationEquips.isEmpty()) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(applicationEquips.get(0).getEquipUnicode());
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
allAddress.add(this.concatDetailAddress(esEquipmentCategoryDto));
return this.concatDetailAddress(esEquipmentCategoryDto);
}
}
return "";
}
});
return String.join(",", allAddress);
}
private String concatDetailAddress(ESEquipmentCategoryDto esEquipmentCategoryDto) {
// 省、市、区
String usePlace = esEquipmentCategoryDto.getUSE_PLACE();
// 详细地址
String address = esEquipmentCategoryDto.getADDRESS();
return String.format("%s%s", usePlace, address);
return Stream.of(esEquipmentCategoryDto.getUSE_PLACE(), esEquipmentCategoryDto.getADDRESS()).map(a -> a == null ? "" : a.replace("/", "").trim()).collect(Collectors.joining());
}
}
......@@ -813,7 +813,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
queryWrapper.eq(JyjcOpeningApplication::getUnitCode, applicationModel.getInspectionUnitCode());
queryWrapper.eq(JyjcOpeningApplication::getStatus, FlowStatusEnum.TO_BE_FINISHED.getName());
queryWrapper.select(JyjcOpeningApplication::getResultType, BaseEntity::getSequenceNbr);
queryWrapper.orderByDesc(JyjcOpeningApplication::getAcceptDate);
queryWrapper.orderByDesc(JyjcOpeningApplication::getRecDate);
queryWrapper.last("limit 1");
List<JyjcOpeningApplication> applicationList = jyjcOpeningApplicationService.list(queryWrapper);
if (!applicationList.isEmpty()) {
......
......@@ -59,7 +59,6 @@ import com.yeejoin.amos.boot.module.ymt.api.vo.TzsUserInfoVo;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -309,7 +308,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
public JyjcOpeningApplicationModel resubmit(JyjcOpeningApplicationModel model) {
model.setStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode() + "");
model = this.updateWithModel(model);
executeFlow(MapBuilder.<String, Object>create()
executedFlow(MapBuilder.<String, Object>create()
.put("op", "0")
.put("instanceId", model.getWorkflowProstanceId())
.put("comments", "")
......@@ -345,6 +344,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
// 将历史同单位类型+同机构类别的开通申请作废掉
for (Long id : ids) {
JyjcInspectionHistory historyOpened = inspectionHistoryService.getBySSeq(id);
if(historyOpened != null){
JSONObject hisDataOpened = historyOpened.getHistoryData();
List<BaseEnterpriseCertDto> certOpened = hisDataOpened.getJSONArray(BizCommonConstant.UNIT_LICENCE_KEY).toJavaList(BaseEnterpriseCertDto.class);
boolean matchHisOpened = certOpened.stream().anyMatch(c -> agencyTypeLast.contains(c.getAgencyType()));
......@@ -352,6 +352,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
filterIds.add(id);
}
}
}
if (!filterIds.isEmpty()) {
LambdaUpdateWrapper<JyjcOpeningApplication> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(JyjcOpeningApplication::getStatus, FlowStatusEnum.TO_BE_DISCARD.getName())
......@@ -758,7 +759,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public JyjcOpeningApplication executeFlow(Map<String, Object> params) {
public void executedFlow(Map<String, Object> params) {
String instanceId = params.get("instanceId").toString();
String nextTaskId = params.get("nextTaskId").toString();
String lockKey = CommonServiceImpl.buildJcExecuteLockKey(instanceId);
......@@ -808,6 +809,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
jyjcOpeningApplication.setExpiryDate(DateUtil.parseDate(params.get("expiryDate").toString()));
jyjcOpeningApplication.setAgencyClassify(params.get("agencyClassify").toString());
jyjcOpeningApplication.setPromoter(RequestContext.getExeUserId());
jyjcOpeningApplication.setResultType(Optional.ofNullable(params.get("resultType")).map(Object::toString).orElse(""));
this.sendMsg2User(jyjcOpeningApplication);
// 更新json
commonService.saveOrUpdateHistory(jyjcOpeningApplication.getOpenBizType(), JSONObject.parseObject(JSONObject.toJSONString(params)), jyjcOpeningApplication.getSequenceNbr());
......@@ -844,6 +846,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
jyjcOpeningApplication.setNextExecuteUserIds("");
jyjcOpeningApplication.setExpiryDate(DateUtil.parseDate(params.get("expiryDate").toString()));
jyjcOpeningApplication.setAgencyClassify(params.get("agencyClassify").toString());
jyjcOpeningApplication.setResultType(Optional.ofNullable(params.get("resultType")).map(Object::toString).orElse(""));
// 更新json
commonService.saveOrUpdateHistory(jyjcOpeningApplication.getOpenBizType(), JSONObject.parseObject(JSONObject.toJSONString(params)), jyjcOpeningApplication.getSequenceNbr());
// 将审批通过的资质信息写入到企业资质表
......@@ -856,7 +859,6 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
}
// 更新流程中的流程数据
commonService.saveExecuteFlowData2Redis(jyjcOpeningApplication.getWorkflowProstanceId(), this.buildInstanceRuntimeData(jyjcOpeningApplication));
return jyjcOpeningApplication;
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
} finally {
......@@ -864,7 +866,6 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
lock.unlock();
}
}
return null;
}
private void restoreApplicationData(JyjcOpeningApplication jyjcOpeningApplication, Map<String, Object> params) {
......
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