Commit 3b9cde15 authored by suhuiguang's avatar suhuiguang

1.报检结果、检验申请的检验类型下拉接口新增

parent 0ecc4b66
......@@ -2,6 +2,11 @@ package com.yeejoin.amos.boot.module.jyjc.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author LiuLin
......@@ -14,16 +19,18 @@ public enum JYJCTypeEnum {
/**
* 检验检测类型
*/
DTJC("DTJC", "电梯检测","jc"),
DQJY("DQJY", "定期检验", "jy"),
SCJY("SCJY", "首次检验", "jy"),
WXJDJY("WXJDJY", "维修监督检验", "jy"),
GZJDJY("GZJDJY", "改造监督检验", "jy"),
AZJDJY("AZJDJY", "安装监督检验", "jy");
DTJC("DTJC", "电梯检测", "jc", BizTypeEnum.DETECTION.getCode()),
DQJY("DQJY", "定期检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
SCJY("SCJY", "首次检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
WXJDJY("WXJDJY", "维修监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
GZJDJY("GZJDJY", "改造监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
AZJDJY("AZJDJY", "安装监督检验", "jy", BizTypeEnum.SUPERVISE.getCode());
private final String code;
private final String name;
private final String openBizType;
private final String bizType;
public static JYJCTypeEnum of(String code) {
......@@ -34,4 +41,11 @@ public enum JYJCTypeEnum {
}
return null;
}
public static List<JYJCTypeEnum> getListByBizType(String bizType) {
if (StringUtils.isEmpty(bizType)) {
return Arrays.asList(JYJCTypeEnum.values());
}
return Arrays.stream(JYJCTypeEnum.values()).filter(e -> e.getBizType().equals(bizType)).collect(Collectors.toList());
}
}
......@@ -80,8 +80,8 @@
<if test="jyjcInspectionApplicationModel.applicationNo != null and jyjcInspectionApplicationModel.applicationNo != ''">
and tzjia.application_no like concat('%',#{jyjcInspectionApplicationModel.applicationNo},'%')
</if>
<if test="jyjcInspectionApplicationModel.inspectionClassify != null and jyjcInspectionApplicationModel.inspectionClassify != ''">
and tzjia.inspection_classify = #{jyjcInspectionApplicationModel.inspectionClassify}
<if test="jyjcInspectionApplicationModel.inspectionType != null and jyjcInspectionApplicationModel.inspectionType != ''">
and tzjia.inspection_type = #{jyjcInspectionApplicationModel.inspectionType}
</if>
<if test="jyjcInspectionApplicationModel.equipClassify != null and jyjcInspectionApplicationModel.equipClassify != ''">
......
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionApplicationPushEven
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.feign.systemctl.model.DictionarieModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -274,4 +275,11 @@ public class JyjcInspectionApplicationController extends BaseController {
public ResponseModel<List<TzBaseEnterpriseInfoDto>> getInspectionUnitListForWorkbench(@RequestParam String openBizType) {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.getInspectionUnitListForWorkbench(openBizType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "检验类型-按照业务查询", notes = "检验类型-按照业务查询")
@GetMapping(value = "/{bizType}/inspectType/list")
public ResponseModel<List<DictionarieModel>> inspectTypeListByBizType(@PathVariable String bizType){
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.inspectTypeListByBizType(bizType));
}
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionResultServiceImpl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -187,4 +188,11 @@ public class JyjcInspectionResultController extends BaseController {
public ResponseModel<List<JyjcInspectionResultDataModel>> saveResultDataBatch(@RequestBody List<JyjcInspectionResultDataModel> resultDataModels){
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.receivePushResultData(resultDataModels));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "检验类型-按照身份查询", notes = "\"检验类型-按照身份查询")
@GetMapping(value = "/inspectType/list")
public ResponseModel<List<DictionarieModel>> inspectTypeListByPerson(){
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.inspectTypeListByPerson(getSelectedOrgInfo()));
}
}
......@@ -86,7 +86,7 @@ public class DisableRuleDataPreparationListener implements ApplicationListener<I
private String getBizTypeByInspectionType(String inspectionType) {
JYJCTypeEnum jyjcTypeEnum = JYJCTypeEnum.of(inspectionType);
if (jyjcTypeEnum != null) {
return jyjcTypeEnum.getBizType();
return jyjcTypeEnum.getOpenBizType();
}
return OpenBizTypeEnum.JY.getCode();
}
......
......@@ -38,6 +38,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
......@@ -71,8 +72,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -1309,4 +1310,20 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
public List<TzBaseEnterpriseInfoDto> getInspectionUnitListForWorkbench(String openBizType) {
return commonService.getInspectionUnitList(openBizType);
}
public List<DictionarieModel> inspectTypeListByBizType(String bizType) {
return getDictionarieModels(bizType);
}
@NotNull
public static List<DictionarieModel> getDictionarieModels(String bizType) {
List<JYJCTypeEnum> enums = JYJCTypeEnum.getListByBizType(bizType);
return enums.stream().map(e -> {
DictionarieModel dictionarieModel = new DictionarieModel();
dictionarieModel.setDictCode(e.getCode());
dictionarieModel.setDictName(e.getName());
return dictionarieModel;
}).collect(Collectors.toList());
}
}
\ No newline at end of file
......@@ -16,7 +16,9 @@ import com.yeejoin.amos.boot.module.jyjc.api.common.StringUtil;
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.entity.JyjcInspectionResultParam;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.EquipCategoryEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.JYJCTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.ResultStatusEnum;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultDataModel;
......@@ -33,6 +35,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.feign.systemctl.model.DictionarieModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -187,6 +190,16 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
return "no";
}
static String getPersonIdentityByType(String companyType) {
if ("使用单位".equals(companyType)) {
return BizTypeEnum.FIRST_INSPECTION.getCode();
} else if ("安装改造维修单位".equals(companyType)) {
return BizTypeEnum.SUPERVISE.getCode();
} else {
return "";
}
}
@Transactional(rollbackFor = Exception.class)
public JyjcInspectionResultModel updateJyjcInspectionResult(Map<String, Map<String, Object>> tableModel) {
......@@ -409,11 +422,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private void deleteAndCreateSubTable(Map<String, JyjcInspectionResult> resultListMap, List<JyjcInspectionResultAttachment> resultAttachments, List<JyjcInspectionResultParam> resultParams) {
List<JyjcInspectionResult> resultList = new ArrayList<>(resultListMap.values());
List<Long> resultIds = resultList.stream().map(BaseEntity::getSequenceNbr).collect(Collectors.toList());
if(resultAttachments.size() > 0){
attachmentService.remove(new LambdaQueryWrapper<JyjcInspectionResultAttachment>().in(JyjcInspectionResultAttachment::getResultSeq,resultIds));
if (resultAttachments.size() > 0) {
attachmentService.remove(new LambdaQueryWrapper<JyjcInspectionResultAttachment>().in(JyjcInspectionResultAttachment::getResultSeq, resultIds));
attachmentService.saveBatch(resultAttachments);
}
if(resultParams.size() >0){
if (resultParams.size() > 0) {
resultParamService.remove(new LambdaQueryWrapper<JyjcInspectionResultParam>().in(JyjcInspectionResultParam::getResultSeq, resultIds));
resultParamService.saveBatch(resultParams);
}
......@@ -470,11 +483,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
}
private String getUserSeqByPersonCode(String innerPersonCode) {
if(StrUtil.isNotEmpty(innerPersonCode)){
if (StrUtil.isNotEmpty(innerPersonCode)) {
List<TzsUserInfo> tzsUserInfos = tzsUserInfoMapper.selectList(new LambdaQueryWrapper<TzsUserInfo>().in(TzsUserInfo::getInnerPersonCode, Arrays.asList(innerPersonCode.split(","))));
return tzsUserInfos.stream().map(u -> u.getSequenceNbr() + "").collect(Collectors.joining(","));
}
log.error("检验人员内部编号为空");
log.error("检验人员内部编号为空");
return "";
}
......@@ -485,6 +498,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
wrapper.in(JyjcInspectionResult::getApplicationNo, applicationNos);
wrapper.in(JyjcInspectionResult::getSupervisoryCode, supervisoryCodes);
List<JyjcInspectionResult> resultList = this.list(wrapper);
return resultList.stream().collect(Collectors.toMap((c)-> c.getApplicationNo() + ":" + c.getSupervisoryCode(), Function.identity()));
return resultList.stream().collect(Collectors.toMap((c) -> c.getApplicationNo() + ":" + c.getSupervisoryCode(), Function.identity()));
}
public List<DictionarieModel> inspectTypeListByPerson(ReginParams selectedOrgInfo) {
String group = getPersonIdentityByType(selectedOrgInfo.getCompany().getCompanyType());
return JyjcInspectionApplicationServiceImpl.getDictionarieModels(group);
}
}
\ No newline at end of file
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