Commit 22b32e40 authored by 王果's avatar 王果

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 15c1f96a 6e885790
...@@ -3,11 +3,11 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -3,11 +3,11 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESElavtorRepository;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgDesignInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgDesignInfoService;
...@@ -38,7 +38,6 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; ...@@ -38,7 +38,6 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgTechParamsElevatorMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.queryparser.classic.QueryParser;
...@@ -54,15 +53,16 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -54,15 +53,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -163,7 +163,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -163,7 +163,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
/** /**
* 删除设备注册信息(批量删除) * 删除设备注册信息(批量删除)
* *
* @param sequenceNbrList * @param map
* @return * @return
*/ */
public boolean batchDeleteByRecord(Map<String, Object> map) { public boolean batchDeleteByRecord(Map<String, Object> map) {
...@@ -204,63 +204,118 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -204,63 +204,118 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//使用信息 //使用信息
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(record); IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(useInfo)) { if (!ValidationUtil.isEmpty(useInfo)) {
Map<String, Object> useInfoMap = Bean.BeantoMap(useInfo); Map<String, Object> useInfoMap = new HashMap<>();
String[] fields = null;
try {
useInfoMap = this.convertCamelToUnderscore(useInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr()); useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
objMap.putAll(useInfoMap); objMap.putAll(useInfoMap);
} }
//设计制造 //设计制造
IdxBizJgDesignInfo designInfo = iIdxBizJgDesignInfoService.getOneData(record); IdxBizJgDesignInfo designInfo = iIdxBizJgDesignInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(designInfo)) { if (!ValidationUtil.isEmpty(designInfo)) {
Map<String, Object> designInfoMap = Bean.BeantoMap(designInfo); Map<String, Object> designInfoMap = new HashMap<>();
String[] fields = {"DESIGN_DOC", "DESIGN_STANDARD"};
try {
designInfoMap = this.convertCamelToUnderscore(designInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr()); designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr());
objMap.putAll(designInfoMap); objMap.putAll(designInfoMap);
} }
//制造信息 //制造信息
IdxBizJgFactoryInfo factoryInfo = iIdxBizJgFactoryInfoService.getOneData(record); IdxBizJgFactoryInfo factoryInfo = iIdxBizJgFactoryInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(factoryInfo)) { if (!ValidationUtil.isEmpty(factoryInfo)) {
Map<String, Object> factoryInfoMap = Bean.BeantoMap(factoryInfo); Map<String, Object> factoryInfoMap = new HashMap<>();
String[] fields = {"FACTORY_STANDARD", "PRODUCT_QUALITY_YIELD_PROVE", "INS_USE_MAINTAIN_EXPLAIN"};
try {
factoryInfoMap = this.convertCamelToUnderscore(factoryInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr()); factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr());
objMap.putAll(factoryInfoMap); objMap.putAll(factoryInfoMap);
} }
//施工信息 //施工信息
IdxBizJgConstructionInfo constructionInfo = iIdxBizJgConstructionInfoService.getOneData(record); IdxBizJgConstructionInfo constructionInfo = iIdxBizJgConstructionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(constructionInfo)) { if (!ValidationUtil.isEmpty(constructionInfo)) {
Map<String, Object> constructionInfoMap = Bean.BeantoMap(constructionInfo); Map<String, Object> constructionInfoMap = new HashMap<>();
String[] fields = null;
try {
constructionInfoMap = this.convertCamelToUnderscore(constructionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr()); constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
objMap.putAll(constructionInfoMap); objMap.putAll(constructionInfoMap);
} }
//注册登记 //注册登记
IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record)); IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record));
if (!ValidationUtil.isEmpty(registerInfo)) { if (!ValidationUtil.isEmpty(registerInfo)) {
Map<String, Object> registerInfoMap = Bean.BeantoMap(registerInfo); Map<String, Object> registerInfoMap = new HashMap<>();
String[] fields = {"PRODUCT_PHOTO"};
try {
registerInfoMap = this.convertCamelToUnderscore(registerInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr()); registerInfoMap.put("REGISTERINFO_SEQ", registerInfo.getSequenceNbr());
registerInfoMap.put("SEQUENCE_NBR", registerInfo.getSequenceNbr());
objMap.putAll(registerInfoMap); objMap.putAll(registerInfoMap);
} }
//维保备案 //维保备案
IdxBizJgMaintenanceRecordInfo maintenanceRecordInfo = iIdxBizJgMaintenanceRecordInfoService.getOneData(record); IdxBizJgMaintenanceRecordInfo maintenanceRecordInfo = iIdxBizJgMaintenanceRecordInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) { if (!ValidationUtil.isEmpty(maintenanceRecordInfo)) {
Map<String, Object> maintenanceRecordInfoMap = Bean.BeantoMap(maintenanceRecordInfo); Map<String, Object> maintenanceRecordInfoMap = new HashMap<>();
String[] fields = null;
try {
maintenanceRecordInfoMap = this.convertCamelToUnderscore(maintenanceRecordInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr()); maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr());
objMap.putAll(maintenanceRecordInfoMap); objMap.putAll(maintenanceRecordInfoMap);
} }
//监督管理 //监督管理
IdxBizJgSupervisionInfo supervisionInfo = iIdxBizJgSupervisionInfoService.getOneData(record); IdxBizJgSupervisionInfo supervisionInfo = iIdxBizJgSupervisionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(supervisionInfo)) { if (!ValidationUtil.isEmpty(supervisionInfo)) {
Map<String, Object> supervisionInfoMap = Bean.BeantoMap(supervisionInfo); Map<String, Object> supervisionInfoMap = new HashMap<>();
String[] fields = null;
try {
supervisionInfoMap = this.convertCamelToUnderscore(supervisionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr()); supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr());
objMap.putAll(supervisionInfoMap); objMap.putAll(supervisionInfoMap);
} }
//其他信息 //其他信息
IdxBizJgOtherInfo otherInfo = iIdxBizJgOtherInfoService.getOneData(record); IdxBizJgOtherInfo otherInfo = iIdxBizJgOtherInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(otherInfo)) { if (!ValidationUtil.isEmpty(otherInfo)) {
Map<String, Object> otherInfoMap = Bean.BeantoMap(otherInfo); Map<String, Object> otherInfoMap = new HashMap<>();
String[] fields = null;
try {
otherInfoMap = this.convertCamelToUnderscore(otherInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr()); otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr());
objMap.putAll(otherInfoMap); objMap.putAll(otherInfoMap);
} }
//检验检测 //检验检测
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.getOneData(record); IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) { if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
Map<String, Object> inspectionDetectionInfoMap = Bean.BeantoMap(inspectionDetectionInfo); Map<String, Object> inspectionDetectionInfoMap = new HashMap<>();
String[] fields = {"INSPECT_REPORT"};
try {
inspectionDetectionInfoMap = this.convertCamelToUnderscore(inspectionDetectionInfo, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr()); inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr());
objMap.putAll(inspectionDetectionInfoMap); objMap.putAll(inspectionDetectionInfoMap);
} }
...@@ -268,7 +323,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -268,7 +323,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//电梯 //电梯
IdxBizJgTechParamsElevator elevator = iIdxBizJgTechParamsElevatorService.getOneData(record); IdxBizJgTechParamsElevator elevator = iIdxBizJgTechParamsElevatorService.getOneData(record);
if (!ValidationUtil.isEmpty(elevator)) { if (!ValidationUtil.isEmpty(elevator)) {
Map<String, Object> elevatorMap = Bean.BeantoMap(elevator); Map<String, Object> elevatorMap = new HashMap<>();
String[] fields = {"EXPLOSIONPROOF_SIGN_COMPLETE"};
try {
elevatorMap = this.convertCamelToUnderscore(elevator, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr()); elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr());
objMap.putAll(elevatorMap); objMap.putAll(elevatorMap);
} }
...@@ -283,14 +344,26 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -283,14 +344,26 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//主要零部件 //主要零部件
IdxBizJgMainParts mainParts = iIdxBizJgMainPartsService.getOneData(record); IdxBizJgMainParts mainParts = iIdxBizJgMainPartsService.getOneData(record);
if (!ValidationUtil.isEmpty(mainParts)) { if (!ValidationUtil.isEmpty(mainParts)) {
Map<String, Object> mainPartsMap = Bean.BeantoMap(mainParts); Map<String, Object> mainPartsMap = new HashMap<>();
String[] fields = null;
try {
mainPartsMap = this.convertCamelToUnderscore(mainParts, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
mainPartsMap.put("MAINPARTS_SEQ", mainParts.getSequenceNbr()); mainPartsMap.put("MAINPARTS_SEQ", mainParts.getSequenceNbr());
objMap.putAll(mainPartsMap); objMap.putAll(mainPartsMap);
} }
//安全附件 //安全附件
IdxBizJgProtectionDevices protectionDevices = iIdxBizJgProtectionDevicesService.getOneData(record); IdxBizJgProtectionDevices protectionDevices = iIdxBizJgProtectionDevicesService.getOneData(record);
if (!ValidationUtil.isEmpty(protectionDevices)) { if (!ValidationUtil.isEmpty(protectionDevices)) {
Map<String, Object> protectionDevicesMap = Bean.BeantoMap(protectionDevices); Map<String, Object> protectionDevicesMap = new HashMap<>();
String[] fields = null;
try {
protectionDevicesMap = this.convertCamelToUnderscore(protectionDevices, fields);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
protectionDevicesMap.put("PROTECTIONDEVICES_SEQ", protectionDevices.getSequenceNbr()); protectionDevicesMap.put("PROTECTIONDEVICES_SEQ", protectionDevices.getSequenceNbr());
objMap.putAll(protectionDevicesMap); objMap.putAll(protectionDevicesMap);
} }
...@@ -367,22 +440,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -367,22 +440,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// //查询 安装告知【可告知设备列表】【EQU_STATE===""】 // //查询 安装告知【可告知设备列表】【EQU_STATE===""】
if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "AZ")) { if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "AZ")) {
BoolQueryBuilder azBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder azBuilder = QueryBuilders.boolQuery();
azBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); azBuilder.must(QueryBuilders.matchQuery("EQU_STATE", 9999));
boolMust.must(azBuilder); boolMust.must(azBuilder);
} }
//查询 维保备案【可绑定设备列表】【EQU_STATE==="" && INSPECT_REPORT!==9999(默认占位值)】 //查询 维保备案【可绑定设备列表】【EQU_STATE==="" && INSPECT_REPORT!==9999(默认占位值)】
if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "WB")) { if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "WB")) {
BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery();
wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); wbBuilder.must(QueryBuilders.matchQuery("EQU_STATE", 9999));
wbBuilder.mustNot(QueryBuilders.matchQuery("INSPECT_REPORT", 9999)); wbBuilder.mustNot(QueryBuilders.existsQuery("INSPECT_REPORT"));
boolMust.must(wbBuilder); boolMust.must(wbBuilder);
} }
//查询 使用登记【可选设备列表】【EQU_STATUS==="" && INSPECT_REPORT!==9999(默认占位值) && USE_ORG_CODE!=="" 】 //查询 使用登记【可选设备列表】【EQU_STATUS==="" && INSPECT_REPORT!==9999(默认占位值) && USE_ORG_CODE!=="" 】
if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "SY")) { if (!ObjectUtils.isEmpty(queryType) && ValidationUtil.equals(queryType, "SY")) {
BoolQueryBuilder syBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder syBuilder = QueryBuilders.boolQuery();
syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); syBuilder.must(QueryBuilders.matchQuery("EQU_STATE", 9999));
syBuilder.mustNot(QueryBuilders.matchQuery("INSPECT_REPORT", 9999)); syBuilder.mustNot(QueryBuilders.existsQuery("INSPECT_REPORT"));
syBuilder.mustNot(QueryBuilders.matchQuery("USE_ORG_CODE", "")); syBuilder.mustNot(QueryBuilders.existsQuery("USE_ORG_CODE"));
boolMust.must(syBuilder); boolMust.must(syBuilder);
} }
...@@ -455,7 +528,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -455,7 +528,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String record = null; String record = null;
LinkedHashMap equipmentInfoForm = (LinkedHashMap) map.get(EQUIPMENT_INFO_FORM_ID); LinkedHashMap equipmentInfoForm = (LinkedHashMap) map.get(EQUIPMENT_INFO_FORM_ID);
//操作类型 //操作类型
String operateType = ValidationUtil.isEmpty(String.valueOf(equipmentInfoForm.get("SEQUENCE_NBR"))) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get("SEQUENCE_NBR")) ? OPERATESAVE : OPERATEEDIT;
record = OPERATESAVE.equals(operateType) ? UUID.randomUUID().toString() : equipmentInfoForm.get("RECORD").toString(); record = OPERATESAVE.equals(operateType) ? UUID.randomUUID().toString() : equipmentInfoForm.get("RECORD").toString();
//使用信息 //使用信息
...@@ -616,4 +689,27 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -616,4 +689,27 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
/**
* 将对象的属性由驼峰转为纯大写下划线格式
*
* @param object
* @return
* @throws IllegalAccessException
*/
public static Map<String, Object> convertCamelToUnderscore(Object object, String[] strToJsonArrayFields) throws IllegalAccessException {
Map<String, Object> result = new HashMap<>();
Class<?> clazz = object.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String fieldName = field.getName();
String underscoreFieldName = StringUtils.camelToUnderline(fieldName).toUpperCase();
Object value = field.get(object);
//需要转为jsonArray的字段
if (!ValidationUtil.isEmpty(strToJsonArrayFields) && Arrays.asList(strToJsonArrayFields).contains(underscoreFieldName)) {
value = JSON.parseArray((String) field.get(object));
}
result.put(underscoreFieldName.toUpperCase(), value);
}
return result;
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.api.enums
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:25
*/
@Getter
@AllArgsConstructor
public enum BizTypeEnum {
SUPERVISE("supervise", "监督检验"),
FIRST_INSPECTION("firstinspect", "定检"),
DETECTION("detection", "检测");
private String code;
private String name;
public static List<String> getEnumNameList() {
List<String> codeList = new ArrayList<String>();
for (BizTypeEnum c : BizTypeEnum.values()) {
codeList.add(c.getCode());
}
return codeList;
}
}
...@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface JyjcInspectionApplicationPushLogMapper extends BaseMapper<JyjcInspectionApplicationPushLog> { public interface JyjcInspectionApplicationPushLogMapper extends BaseMapper<JyjcInspectionApplicationPushLog> {
void deleteByApplicationSeq(Long seq);
} }
...@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface JyjcInspectionEquipStatisticsMapper extends BaseMapper<JyjcInspectionEquipStatistics> { public interface JyjcInspectionEquipStatisticsMapper extends BaseMapper<JyjcInspectionEquipStatistics> {
void deleteByApplicationSeq(Long seq);
} }
package com.yeejoin.amos.boot.module.jyjc.api.service;
import java.util.Map;
/**
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.api.service
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 15:55
*/
public interface IJyjcInspectionApplicationHandlerService {
String type();
boolean notifyInspectionUnit(Map<String, Object> params);
}
package com.yeejoin.amos.boot.module.jyjc.api.service; package com.yeejoin.amos.boot.module.jyjc.api.service;
import java.util.List;
/** /**
* 接口类 * 接口类
* *
* @author system_generator * @author system_generator
* @date 2023-12-14 * @date 2023-12-14
*/ */
public interface IJyjcInspectionApplicationService {} public interface IJyjcInspectionApplicationService {
void deleteBatchData(List<Long> sequenceNbr);
}
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.api.service; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jyjc.api.service;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 检验结果技术参数表接口类 * 检验结果技术参数表接口类
...@@ -17,4 +18,11 @@ public interface IJyjcInspectionResultParamService { ...@@ -17,4 +18,11 @@ public interface IJyjcInspectionResultParamService {
* @return * @return
*/ */
List<JyjcInspectionResultParam> getParamByResultSeq(Long sequenceNbr); List<JyjcInspectionResultParam> getParamByResultSeq(Long sequenceNbr);
/**
* 根据设备code获取技术参数字段
* @param equipTypeCode 设备code
* @return 字段列表
*/
List<Map<String,Object>> getParamByEquipTypeCode(String equipTypeCode);
} }
package com.yeejoin.amos.boot.module.jyjc.api.service; package com.yeejoin.amos.boot.module.jyjc.api.service;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -18,4 +21,12 @@ public interface IJyjcInspectionResultService { ...@@ -18,4 +21,12 @@ public interface IJyjcInspectionResultService {
* @return 检验结果实体 * @return 检验结果实体
*/ */
Map<String, Object> queryDetailBySeq(Long sequenceNbr); Map<String, Object> queryDetailBySeq(Long sequenceNbr);
/**
* 获取设备种类
* @param type 获取的类型
* @param notNode 不需要节点
* @return 列表
*/
List<Map<String,Object>> equipList(String type, String notNode);
} }
...@@ -5,26 +5,27 @@ ...@@ -5,26 +5,27 @@
<select id="queryForDataList" <select id="queryForDataList"
resultType="com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication"> resultType="com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication">
select select
tzjia.applicationNo, tzjia.application_no,
tzjia.inspectionType, tzjia.inspection_type,
tzjia.inspectionUnitName, tzjia.inspection_classify,
tzjia.equipClassify, tzjia.inspection_unit_code,
tzjia.numberOfEquip, tzjia.equip_classify,
tzjia.inspectionUnitName, tzjia.number_of_equip,
tzjia.applicationDate, tzjia.inspection_unit_code,
tzjia.acceptDate, tzjia.application_date,
tzjia.inspectionChargePerson, tzjia.accept_date,
tzjia.inspectionChargePhone, tzjia.inspection_charge_phone,
tzjia.inspection_charge_person,
tzjia.status tzjia.status
from from
tz_jyjc_inspection_application as tzjia tz_jyjc_inspection_application as tzjia
where <where>
tzjia.is_delete = 0
<if test=" applicationNo != null and applicationNo != ''"> <if test=" applicationNo != null and applicationNo != ''">
and applicationNo like concat('%',#{applicationNo}.'%') and application_no like concat('%',#{applicationNo}.'%')
</if> </if>
<if test="inspectionType != null and inspectionType != ''"> <if test="inspectionClassify != null and inspectionClassify != ''">
and inspectionType = #{inspectionType} and inspection_classify = #{inspectionClassify}
</if> </if>
<if test="inspectionUnitName != null and inspectionUnitName != ''"> <if test="inspectionUnitName != null and inspectionUnitName != ''">
and inspection_unit_code in (select use_code from tz_base_enterprise_info where use_unit like concat('%',#{inspectionUnitName},'%')) and inspection_unit_code in (select use_code from tz_base_enterprise_info where use_unit like concat('%',#{inspectionUnitName},'%'))
...@@ -39,22 +40,16 @@ ...@@ -39,22 +40,16 @@
and application_unit_code in (select use_code from tz_base_enterprise_info where use_unit like concat('%',#{inspectionUnitName},'%')) and application_unit_code in (select use_code from tz_base_enterprise_info where use_unit like concat('%',#{inspectionUnitName},'%'))
</if> </if>
<if test="equipClassify != null and equipClassify != ''"> <if test="equipClassify != null and equipClassify != ''">
and equipClassify = #{equipClassify} and equip_classify = #{equipClassify}
</if>
<if test="numberOfEquip != null and numberOfEquip != ''">
and numberOfEquip = #{numberOfEquip}
</if> </if>
<if test="applicationDate != null and applicationDate != ''"> <if test="applicationDate != null and applicationDate != ''">
and applicationDate = #{applicationDate} and application_date = #{applicationDate}
</if> </if>
<if test="acceptDate != null and acceptDate != ''"> <if test="acceptDate != null and acceptDate != ''">
and acceptDate = #{acceptDate} and accept_date = #{acceptDate}
</if> </if>
<if test="inspectionChargePerson != null and inspectionChargePerson != ''"> <if test="inspectionChargePerson != null and inspectionChargePerson != ''">
and inspectionChargePerson like concat('%',#{inspectionChargePerson}.'%') and inspection_charge_person like concat('%',#{inspectionChargePerson}.'%')
</if>
<if test="inspectionChargePhone != null and inspectionChargePhone != ''">
and inspectionChargePhone like concat('%',#{inspectionChargePhone}.'%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and status = #{status} and status = #{status}
...@@ -62,5 +57,6 @@ ...@@ -62,5 +57,6 @@
<if test="bizType != null and bizType != ''"> <if test="bizType != null and bizType != ''">
and biz_type = #{bizType} and biz_type = #{bizType}
</if> </if>
</where>
</select> </select>
</mapper> </mapper>
...@@ -2,4 +2,12 @@ ...@@ -2,4 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationPushLogMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationPushLogMapper">
<delete id="deleteByApplicationSeq">
delete
*
from
tz_jyjc_inspection_application_push_log
where
application_seq = #{applicationSeq}
</delete>
</mapper> </mapper>
...@@ -2,4 +2,12 @@ ...@@ -2,4 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionEquipStatisticsMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionEquipStatisticsMapper">
<delete id="deleteByApplicationSeq">
delete
*
from
tz_jyjc_inspection_equip_statistics
where
application_seq = #{applicationSeq}
</delete>
</mapper> </mapper>
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
workflow_prostance_id, workflow_prostance_id,
workflow_role, workflow_role,
unit_code_name, unit_code_name,
status, status_name,
status_name workflow_active_key
from tz_jyjc_opening_application from tz_jyjc_opening_application
<where> <where>
<if test="jyjcOpeningApplicationRequstDto.applicationSeq != '' and jyjcOpeningApplicationRequstDto.applicationSeq != null"> <if test="jyjcOpeningApplicationRequstDto.applicationSeq != '' and jyjcOpeningApplicationRequstDto.applicationSeq != null">
......
package com.yeejoin.amos.boot.module.jyjc.biz.config; package com.yeejoin.amos.boot.module.jyjc.biz.config;
import com.yeejoin.amos.boot.module.ymt.api.enums.BaseExceptionEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.BaseExceptionEnum;
/** /**
......
package com.yeejoin.amos.boot.module.jyjc.biz.config; package com.yeejoin.amos.boot.module.jyjc.biz.config;
import com.yeejoin.amos.boot.module.ymt.api.common.BaseException;
import com.yeejoin.amos.boot.module.ymt.api.enums.CommonErrorEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.CommonErrorEnum;
/** /**
......
...@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.enums.DocumentEnum; ...@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.enums.DocumentEnum;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationAttachmentModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationAttachmentModel;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationAttachmentServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationAttachmentServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationEquipServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationEquipServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationPushLogServiceImpl;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -24,10 +25,14 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -24,10 +25,14 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.Map;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationServiceImpl;
import org.typroject.tyboot.core.rdbms.annotation.Condition; import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator; import org.typroject.tyboot.core.rdbms.annotation.Operator;
...@@ -56,12 +61,7 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -56,12 +61,7 @@ public class JyjcInspectionApplicationController extends BaseController {
@Autowired @Autowired
JyjcInspectionApplicationServiceImpl jyjcInspectionApplicationServiceImpl; JyjcInspectionApplicationServiceImpl jyjcInspectionApplicationServiceImpl;
@Autowired
JyjcInspectionApplicationAttachmentServiceImpl jyjcInspectionApplicationAttachmentService;
@Autowired
JyjcInspectionApplicationEquipServiceImpl jyjcInspectionApplicationEquipService;
@Autowired
WorkflowFeignService workflowFeignService;
/** /**
* 新增 * 新增
...@@ -73,81 +73,9 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -73,81 +73,9 @@ public class JyjcInspectionApplicationController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<JyjcInspectionApplicationModel> save(@RequestBody JyjcInspectionApplicationModel model) { public ResponseModel<JyjcInspectionApplicationModel> save(@RequestBody JyjcInspectionApplicationModel model) {
//开启报检流程工作流 ReginParams selectedOrgInfo = getSelectedOrgInfo();
model.setApplicationUnitCode(selectedOrgInfo.getCompany().getCompanyCode());
if ( !model.getOperationType().equals("2")){ return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.save(model));
if (model.getOperationType().equals("0")){
JSONObject body = new JSONObject();
String businessKey = buildOrderNo();
body.put(WorkFlowEnum.BUSINESSKEY.getCode(), businessKey);
body.put(WorkFlowEnum.processDefinitionKey.getCode(), model.getProcessKey());
JSONObject jsonObject = workflowFeignService.startProcess(body);
String processId = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("result"))).getString("id");
model.setProcessInstanceId(processId);
model.setStatus("已提交");
}else if ( model.getOperationType().equals("1")){
model.setStatus("草稿");
}
model = jyjcInspectionApplicationServiceImpl.createWithModel(model);
//保存报检装备监管码
if ( model.getEquip().size() > 0){
List<Map<String, Object>> equip = model.getEquip();
List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
for (String s : jgm) {
JyjcInspectionApplicationEquip equipInfo = new JyjcInspectionApplicationEquip();
equipInfo.setApplicationSeq(model.getSequenceNbr());
equipInfo.setEquipUnicode(s);
jyjcInspectionApplicationEquipService.save(equipInfo);
}
}
Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件保存
List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
for (String code : enumNameList) {
if (map.containsKey(code)){
JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment();
attachments.setAttachmentType(code);
attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code)));
attachments.setApplicationSeq(model.getSequenceNbr());
jyjcInspectionApplicationAttachmentService.getBaseMapper().insert(attachments);
}
}
}else {
//更新报检装备监管码
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
if ( model.getEquip().size() > 0){
List<Map<String, Object>> equip = model.getEquip();
List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
for (String s : jgm) {
JyjcInspectionApplicationEquip equipInfo = new JyjcInspectionApplicationEquip();
equipInfo.setApplicationSeq(model.getSequenceNbr());
equipInfo.setEquipUnicode(s);
jyjcInspectionApplicationEquipService.save(equipInfo);
}
}
Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件更新
List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
jyjcInspectionApplicationAttachmentService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
for (String code : enumNameList) {
if (map.containsKey(code)){
JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment();
attachments.setAttachmentType(code);
attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code)));
attachments.setApplicationSeq(model.getSequenceNbr());
jyjcInspectionApplicationAttachmentService.getBaseMapper().insert(attachments);
}
}
model.setStatus("已提交");
jyjcInspectionApplicationServiceImpl.updateWithModel(model);
}
return ResponseHelper.buildResponse(model);
} }
...@@ -163,7 +91,6 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -163,7 +91,6 @@ public class JyjcInspectionApplicationController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<JyjcInspectionApplicationModel> updateBySequenceNbrJyjcInspectionApplication(@RequestBody JyjcInspectionApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<JyjcInspectionApplicationModel> updateBySequenceNbrJyjcInspectionApplication(@RequestBody JyjcInspectionApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.updateWithModel(model));
} }
...@@ -181,6 +108,25 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -181,6 +108,25 @@ public class JyjcInspectionApplicationController extends BaseController {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.removeById(sequenceNbr));
} }
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除", notes = "批量删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, List<Long>sequenceNbr){
jyjcInspectionApplicationServiceImpl.deleteBatchData(sequenceNbr);
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.deleteBatchSeq(sequenceNbr));
}
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
...@@ -191,6 +137,8 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -191,6 +137,8 @@ public class JyjcInspectionApplicationController extends BaseController {
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个") @ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<JyjcInspectionApplicationModel> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JyjcInspectionApplicationModel> selectOne(@PathVariable Long sequenceNbr) {
jyjcInspectionApplicationServiceImpl.selectBySeq(sequenceNbr);
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryBySeq(sequenceNbr));
} }
...@@ -260,4 +208,59 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -260,4 +208,59 @@ public class JyjcInspectionApplicationController extends BaseController {
public ResponseModel<List<JyjcInspectionApplicationModel>> selectForList() { public ResponseModel<List<JyjcInspectionApplicationModel>> selectForList() {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryForJyjcInspectionApplicationList()); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryForJyjcInspectionApplicationList());
} }
/**
* 接收接口
*
*
* @param params params
* @return {@link ResponseModel< HashMap< String String>>}
* @author yangyang
* @throws
* @date 2023/12/15 11:25
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "接收", notes = "接收")
@PostMapping(value = "/flow/{type}/receive")
public ResponseModel<HashMap<String,String>> execueFlow(@PathVariable(value = "type") String type, @RequestBody Map<String, Object> params) {
params.put("type", type);
jyjcInspectionApplicationServiceImpl.doReceive(params);
HashMap<String,String> result =new HashMap<>();
result.put("result","success");
return ResponseHelper.buildResponse(result);
}
/**
* 退回接口(监督检验、定(首)检、检测)-通用
*
*
* @param params params
* @return {@link }
* @author yangyang
* @throws
* @date 2023/12/15 13:44
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "退回", notes = "退回")
@PostMapping(value = "/flow/reject")
public void doRejectFlow(@RequestBody Map<String,Object> params) {
jyjcInspectionApplicationServiceImpl.doReject(params);
}
/**
* 撤回接口(监督检验、定(首)检、检测)-通用
*
*
* @param instanceId instanceId
* @return {@link }
* @author yangyang
* @throws
* @date 2023/12/15 13:39
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "撤回", notes = "撤回")
@GetMapping(value = "/flow/rollback")
public void doRollbackFlow(@RequestParam("instanceId") String instanceId) {
jyjcInspectionApplicationServiceImpl.doRollback(instanceId);
}
} }
...@@ -148,4 +148,17 @@ public class JyjcInspectionResultController extends BaseController { ...@@ -148,4 +148,17 @@ public class JyjcInspectionResultController extends BaseController {
public ResponseModel<JyjcInspectionResultModel> updateJyjcInspectionResult(@RequestBody JyjcInspectionResultModel model) { public ResponseModel<JyjcInspectionResultModel> updateJyjcInspectionResult(@RequestBody JyjcInspectionResultModel model) {
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.updateJyjcInspectionResult(model)); return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.updateJyjcInspectionResult(model));
} }
/**
* 获取设备种类列表
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "获取设备种类列表", notes = "获取设备种类列表")
@GetMapping(value = "/equipTypeList")
public ResponseModel<List<Map<String,Object>>> equipTypeList(@RequestParam(required = false) String type, @RequestParam(required = false) String notNode) {
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.equipList(type, notNode));
}
} }
...@@ -6,6 +6,8 @@ import io.swagger.annotations.Api; ...@@ -6,6 +6,8 @@ import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionResultParamServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionResultParamServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -113,4 +115,16 @@ public class JyjcInspectionResultParamController extends BaseController { ...@@ -113,4 +115,16 @@ public class JyjcInspectionResultParamController extends BaseController {
public ResponseModel<List<JyjcInspectionResultParamModel>> selectForList() { public ResponseModel<List<JyjcInspectionResultParamModel>> selectForList() {
return ResponseHelper.buildResponse(jyjcInspectionResultParamServiceImpl.queryForJyjcInspectionResultParamList()); return ResponseHelper.buildResponse(jyjcInspectionResultParamServiceImpl.queryForJyjcInspectionResultParamList());
} }
/**
* 获取某一类设备的技术参数
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "获取某一类设备的技术参数", notes = "获取某一类设备的技术参数")
@GetMapping(value = "/getParamByEquipTypeCode")
public ResponseModel<List<Map<String,Object>>> getParamByEquipTypeCode(@RequestParam String equipTypeCode) {
return ResponseHelper.buildResponse(jyjcInspectionResultParamServiceImpl.getParamByEquipTypeCode(equipTypeCode));
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import cn.hutool.core.map.MapBuilder; import cn.hutool.core.map.MapBuilder;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstDto; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstDto;
import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException; import com.yeejoin.amos.boot.module.jyjc.biz.config.BaseException;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
...@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcOpeningApplicationServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcOpeningApplicationServiceImpl;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -25,10 +27,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel; ...@@ -25,10 +27,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -97,6 +96,11 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -97,6 +96,11 @@ public class JyjcOpeningApplicationController extends BaseController {
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
JyjcOpeningApplication jyjcOpeningApplication = jyjcOpeningApplicationServiceImpl.getById(sequenceNbr);
List<String> status = Arrays.asList(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()),String.valueOf(FlowStatusEnum.REJECTED.getCode()));
if(status.contains(jyjcOpeningApplication.getStatus())){
throw new BadRequest("除撤回跟驳回的流程之外其余流程不可删除!");
}
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.removeById(sequenceNbr));
} }
...@@ -110,7 +114,7 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -110,7 +114,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@DeleteMapping(value = "batchDelete") @DeleteMapping(value = "batchDelete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){ public ResponseModel<Boolean> deleteBySequenceNbr(@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.deleteBatchSeq(sequenceNbrList)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.deleteBatchByIds(sequenceNbrList));
} }
/** /**
......
...@@ -4,9 +4,13 @@ import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEqu ...@@ -4,9 +4,13 @@ import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEqu
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationEquipMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationEquipMapper;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationEquipService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationEquipService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
...@@ -30,4 +34,13 @@ public class JyjcInspectionApplicationEquipServiceImpl extends BaseService<JyjcI ...@@ -30,4 +34,13 @@ public class JyjcInspectionApplicationEquipServiceImpl extends BaseService<JyjcI
public List<JyjcInspectionApplicationEquipModel> queryForJyjcInspectionApplicationEquipList() { public List<JyjcInspectionApplicationEquipModel> queryForJyjcInspectionApplicationEquipList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
public List<JyjcInspectionApplicationEquipModel> listApplicationEquipByApplicationSeq(Long applicationSeq) {
// this.queryForList 尽量不要重载方法
List<JyjcInspectionApplicationEquip> entitys = this.lambdaQuery().eq(JyjcInspectionApplicationEquip::getApplicationSeq, applicationSeq).list();
if (ValidationUtil.isEmpty(entitys)) {
return Collections.EMPTY_LIST;
}
return Bean.toModels(entitys, JyjcInspectionApplicationEquipModel.class);
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationPushLog; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationPushLog;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationPushLogMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationPushLogMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationPushLogService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationPushLogService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationPushLogModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationPushLogModel;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 服务实现类 * 服务实现类
...@@ -30,4 +34,26 @@ public class JyjcInspectionApplicationPushLogServiceImpl extends BaseService<Jyj ...@@ -30,4 +34,26 @@ public class JyjcInspectionApplicationPushLogServiceImpl extends BaseService<Jyj
public List<JyjcInspectionApplicationPushLogModel> queryForJyjcInspectionApplicationPushLogList() { public List<JyjcInspectionApplicationPushLogModel> queryForJyjcInspectionApplicationPushLogList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
/**
* 记录日志
*
*
* @param params params
* @return {@link boolean}
* @author yangyang
* @throws
* @date 2023/12/15 15:53
*/
public boolean saveInspectionApplicationPushLog(Map<String, Object> params) {
JyjcInspectionApplicationModel inspectionApplicationModel = (JyjcInspectionApplicationModel) params.get("inspectionApplication");
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = (List<JyjcInspectionApplicationEquipModel>) params.get("applicationEquips");
JyjcInspectionApplicationPushLog logEntity = new JyjcInspectionApplicationPushLog();
logEntity.setApplicationSeq(inspectionApplicationModel.getSequenceNbr());
logEntity.setInspectionUnitCode(inspectionApplicationModel.getInspectionUnitCode());
logEntity.setPushData(JSON.toJSONString(applicationEquipModels));
logEntity.setPushStatus("0");
return this.save(logEntity);
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEquip;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.enums.DocumentEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationAttachmentModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.typroject.tyboot.core.rdbms.annotation.Condition; import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator; import org.typroject.tyboot.core.rdbms.annotation.Operator;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler.JyjcInspectionApplicationHandlerFactory;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.service.ICreateCodeService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl.buildOrderNo;
import java.util.Map;
import java.util.Optional;
/** /**
* 服务实现类 * 服务实现类
...@@ -18,11 +61,135 @@ import java.util.List; ...@@ -18,11 +61,135 @@ import java.util.List;
* @date 2023-12-14 * @date 2023-12-14
*/ */
@Service @Service
public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspectionApplicationModel,JyjcInspectionApplication,JyjcInspectionApplicationMapper> implements IJyjcInspectionApplicationService { @Slf4j
public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspectionApplicationModel, JyjcInspectionApplication, JyjcInspectionApplicationMapper> implements IJyjcInspectionApplicationService {
@Autowired
private JyjcInspectionResultServiceImpl inspectionResultService;
@Autowired
private JyjcInspectionApplicationEquipServiceImpl applicationEquipService;
@Autowired
private ICreateCodeService createCodeService;
@Autowired
private WorkflowHelper workflowHelper;
/** /**
* 分页查询 * 分页查询
*/ */
@Autowired
JyjcInspectionApplicationAttachmentServiceImpl jyjcInspectionApplicationAttachmentService;
@Autowired
JyjcInspectionApplicationEquipServiceImpl jyjcInspectionApplicationEquipService;
@Autowired
JyjcInspectionApplicationPushLogServiceImpl jyjcInspectionApplicationPushLogService;
@Autowired
JyjcInspectionEquipStatisticsServiceImpl jyjcInspectionEquipStatisticsService;
@Autowired
WorkflowFeignService workflowFeignService;
public JyjcInspectionApplicationModel save(@RequestBody JyjcInspectionApplicationModel model) {
//开启报检流程工作流
if (!model.getOperationType().equals("2")) {
if (model.getOperationType().equals("0")) {
JSONObject body = new JSONObject();
String businessKey = buildOrderNo();
body.put(WorkFlowEnum.BUSINESSKEY.getCode(), businessKey);
body.put(WorkFlowEnum.processDefinitionKey.getCode(), model.getProcessKey());
JSONObject jsonObject = workflowFeignService.startByVariable(body);
String processId = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("data"))).getString("id");
model.setProcessInstanceId(processId);
model.setStatus("已提交");
} else if (model.getOperationType().equals("1")) {
model.setStatus("草稿");
}
model.setApplicationNo(UUID.randomUUID().toString());
model.setApplicationDate(new Date());
model = this.createWithModel(model);
//保存报检装备监管码
if (null != model.getEquip()&&model.getEquip().size() > 0) {
List<Map<String, Object>> equip = model.getEquip();
List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
for (String s : jgm) {
JyjcInspectionApplicationEquip equipInfo = new JyjcInspectionApplicationEquip();
equipInfo.setApplicationSeq(model.getSequenceNbr());
equipInfo.setEquipUnicode(s);
jyjcInspectionApplicationEquipService.save(equipInfo);
}
}
Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件保存
List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
for (String code : enumNameList) {
if (map.containsKey(code)) {
JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment();
attachments.setAttachmentType(code);
attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code)));
attachments.setApplicationSeq(model.getSequenceNbr());
jyjcInspectionApplicationAttachmentService.getBaseMapper().insert(attachments);
}
}
} else {
//更新报检装备监管码
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
if (model.getEquip().size() > 0) {
List<Map<String, Object>> equip = model.getEquip();
List<String> jgm = equip.stream().map(e -> e.get("equipUnicode").toString()).collect(Collectors.toList());
for (String s : jgm) {
JyjcInspectionApplicationEquip equipInfo = new JyjcInspectionApplicationEquip();
equipInfo.setApplicationSeq(model.getSequenceNbr());
equipInfo.setEquipUnicode(s);
jyjcInspectionApplicationEquipService.save(equipInfo);
}
}
Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件更新
List<String> enumNameList = DocumentEnum.getEnumNameList();
List<JyjcInspectionApplicationAttachmentModel> attachmentModels = new ArrayList<>();
jyjcInspectionApplicationAttachmentService.getBaseMapper().deleteByApplicationSeq(model.getSequenceNbr());
for (String code : enumNameList) {
if (map.containsKey(code)) {
JyjcInspectionApplicationAttachment attachments = new JyjcInspectionApplicationAttachment();
attachments.setAttachmentType(code);
attachments.setAttachmentUrl(JSONObject.toJSONString(map.get(code)));
attachments.setApplicationSeq(model.getSequenceNbr());
jyjcInspectionApplicationAttachmentService.getBaseMapper().insert(attachments);
}
}
model.setStatus("已提交");
this.updateWithModel(model);
}
return model;
}
public void deleteBatchData(List<Long> sequenceNbr) {
List<JyjcInspectionApplication> jyjcInspectionApplications = this.getBaseMapper().selectBatchIds(sequenceNbr);
long count = jyjcInspectionApplications.stream().filter(e -> !e.getStatus().equals("已撤销") && !e.getStatus().equals("已撤回")).count();
if (count > 0) {
throw new BadRequest("存在 非已撤销、已退回状态的报检单 不可删除!");
}
this.deleteBatchSeq(sequenceNbr);
for (Long seq : sequenceNbr) {
jyjcInspectionApplicationEquipService.getBaseMapper().deleteByApplicationSeq(seq);
jyjcInspectionApplicationAttachmentService.getBaseMapper().deleteByApplicationSeq(seq);
jyjcInspectionApplicationPushLogService.getBaseMapper().deleteByApplicationSeq(seq);
jyjcInspectionEquipStatisticsService.getBaseMapper().deleteByApplicationSeq(seq);
}
}
public Page<JyjcInspectionApplication> queryForJyjcInspectionApplicationPage(Page<JyjcInspectionApplication> page, public Page<JyjcInspectionApplication> queryForJyjcInspectionApplicationPage(Page<JyjcInspectionApplication> page,
String applicationNo, String applicationNo,
...@@ -35,9 +202,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -35,9 +202,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
String applicationDate, String applicationDate,
String acceptDate, String acceptDate,
String inspectionChargePerson, String inspectionChargePerson,
String status , String bizType) { String status, String bizType) {
return this.getBaseMapper().queryForDataList(page,applicationNo,inspectionClassify,applicationUnitCode,applicationUnitName,equipClassify,inspectionUnitCode,inspectionUnitName,applicationDate,acceptDate,inspectionChargePerson,status,bizType); return this.getBaseMapper().queryForDataList(page, applicationNo, inspectionClassify, applicationUnitCode, applicationUnitName, equipClassify, inspectionUnitCode, inspectionUnitName, applicationDate, acceptDate, inspectionChargePerson, status, bizType);
} }
...@@ -45,6 +212,146 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -45,6 +212,146 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
* 列表查询 示例 * 列表查询 示例
*/ */
public List<JyjcInspectionApplicationModel> queryForJyjcInspectionApplicationList() { public List<JyjcInspectionApplicationModel> queryForJyjcInspectionApplicationList() {
return this.queryForList("" , false); return this.queryForList("", false);
}
public JyjcInspectionApplicationModel selectBySeq(Long sequenceNbr) {
JyjcInspectionApplicationModel model = this.selectBySeq(sequenceNbr);
return model;
}
/**
* 接收
*
*
* @param params params
* @return {@link }
* @author yangyang
* @throws
* @date 2023/12/15 15:14
*/
public void doReceive(Map<String, Object> params) {
execueFlow(params);
// 执行接收业务
String type = (String) params.get("type");
Long sequenceNbr = (Long) params.get("sequenceNbr");
JyjcInspectionApplicationModel inspectionApplicationModel = this.queryBySeq(sequenceNbr);
List<JyjcInspectionApplicationEquipModel> applicationEquipModels = applicationEquipService.listApplicationEquipByApplicationSeq(sequenceNbr);
if (ValidationUtil.isEmpty(applicationEquipModels)) {
return;
}
List<JyjcInspectionResult> resultModels = new ArrayList(applicationEquipModels.size());
List<String> codes = createCodeService.createApplicationFormCode(ApplicationFormTypeEnum.JG.getCode(), applicationEquipModels.size());
for (int i = 0; i < applicationEquipModels.size(); i++) {
JyjcInspectionResult resultModel = new JyjcInspectionResult();
resultModel.setInspectionUnitCode(inspectionApplicationModel.getInspectionUnitCode());
resultModel.setApplicationNo(inspectionApplicationModel.getApplicationNo());
resultModel.setApplicationUnitCode(inspectionApplicationModel.getApplicationUnitCode());
resultModel.setResultStatus("未出");
// 解析设备
resultModel.setBizType(inspectionApplicationModel.getBizType());
resultModel.setResultNo(codes.get(i));
resultModel.setEquipUnicode(applicationEquipModels.get(i).getEquipUnicode());//设备唯一标识
}
inspectionResultService.saveOrUpdateBatch(resultModels);
// 通知对应的检验机构
Map<String, Object> thiryPartParams = MapBuilder.<String, Object>create().put("inspectionApplication", inspectionApplicationModel).put("applicationEquips", applicationEquipModels).build();
JyjcInspectionApplicationHandlerFactory.apply(type).notifyInspectionUnit(thiryPartParams);
}
/**
* 退回
*
*
* @param params params
* @return {@link }
* @author yangyang
* @throws
* @date 2023/12/15 15:14
*/
public void doReject(Map<String, Object> params) {
execueFlow(params);
String instanceId = Optional.ofNullable(params.get("instanceId")).orElse("").toString();
params.put("status", FlowStatusEnum.REJECTED.getCode() + "");
updateModelByInstanceId(instanceId, params);
}
/**
* 接收/驳回通知检验单
*/
public void execueFlow(Map<String, Object> params) {
String op = params.get("op").toString();
String instanceId = params.get("instanceId").toString();
String comments= params.get("comments").toString();
try {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
//组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
HashMap<String,Object> varibalble = new HashMap<>();
varibalble.put("approvalStatus",op);
dto.setVariable(varibalble);
dto.setComment(comments);
// 执行流程
AjaxResult ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto);
if (ObjectUtils.isEmpty(ajaxResult1)) {
}
} catch (Exception e) {
e.printStackTrace();
log.error("执行工作流错误, => {}", params, e);
}
}
/**
* 撤回流程办理单
*/
public void doRollback(String instanceId) {
try {
// 撤回流程
FeignClientResult feignClientResult = Workflow.taskV2Client.rollBack(instanceId);
if (ObjectUtils.isEmpty(feignClientResult)) {
}
updateModelByInstanceId(instanceId, MapBuilder.<String, Object>create().put("status", FlowStatusEnum.REJECTED.getCode() + "").build());
} catch (Exception e) {
e.printStackTrace();
log.error("撤回工作流错误, => {}", instanceId, e);
}
}
public void updateModelByInstanceId(String instanceId, Map<String, Object> params) {
JyjcInspectionApplication entity = this.lambdaQuery().eq(JyjcInspectionApplication::getProcessInstanceId, instanceId).one();
if (entity == null) {
return;
}
String status = (String) params.get("status");
String inspectionChargePerson = (String) params.get("inspectionChargePerson");
String inspectionChargePhone = (String) params.get("inspectionChargePhone");
String processDescription = (String) params.get("comments");
if (StringUtils.isNotBlank(inspectionChargePerson)) {
entity.setInspectionChargePerson(inspectionChargePerson);
}
if (StringUtils.isNotBlank(inspectionChargePhone)) {
entity.setInspectionChargePhone(inspectionChargePhone);
}
if (StringUtils.isNotBlank(processDescription)) {
entity.setProcessDescription(processDescription);
}
JSONObject taskJson = workflowHelper.getTask(instanceId);
if (taskJson == null) {
log.warn("流程=>{}查询不到或已结束", instanceId);
return;
}
entity.setWorkflowRole(workflowHelper.getWorkflowRoleGroups(taskJson));
// entity.setWorkflowActiveKey(taskJson.getString("taskDefinitionKey"));
entity.setStatus(status);
// entity.setStatusName(FlowStatusEnum.getNameByType(Long.parseLong(status)));
this.updateById(entity);
} }
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jyjc.api.common.StringUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultParamMapper; import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultParamMapper;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultParamModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultParamModel;
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 检验结果技术参数表服务实现类 * 检验结果技术参数表服务实现类
...@@ -18,6 +26,10 @@ import java.util.List; ...@@ -18,6 +26,10 @@ import java.util.List;
*/ */
@Service @Service
public class JyjcInspectionResultParamServiceImpl extends BaseService<JyjcInspectionResultParamModel,JyjcInspectionResultParam,JyjcInspectionResultParamMapper> implements IJyjcInspectionResultParamService { public class JyjcInspectionResultParamServiceImpl extends BaseService<JyjcInspectionResultParamModel,JyjcInspectionResultParam,JyjcInspectionResultParamMapper> implements IJyjcInspectionResultParamService {
@Value("classpath:/json/equipParam.json")
private Resource equipParam;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -38,4 +50,14 @@ public class JyjcInspectionResultParamServiceImpl extends BaseService<JyjcInspec ...@@ -38,4 +50,14 @@ public class JyjcInspectionResultParamServiceImpl extends BaseService<JyjcInspec
wrapper.eq(JyjcInspectionResultParam::getResultSeq, sequenceNbr); wrapper.eq(JyjcInspectionResultParam::getResultSeq, sequenceNbr);
return this.baseMapper.selectList(wrapper); return this.baseMapper.selectList(wrapper);
} }
@Override
public List<Map<String, Object>> getParamByEquipTypeCode(String equipTypeCode) {
List<Map<String, Object>> paramList = new ArrayList<>();
Map<String, List<Map<String, Object>>> paramJson = JsonUtils.getResourceJson(equipParam);
if (StringUtil.isNotEmpty(equipTypeCode)) {
paramList = ObjectUtils.isEmpty(paramJson.get(equipTypeCode)) ? new ArrayList<>() : paramJson.get(equipTypeCode);
}
return paramList;
}
} }
\ No newline at end of file
...@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult; 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.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
...@@ -16,16 +18,28 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel; ...@@ -16,16 +18,28 @@ import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultAttachmentService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultAttachmentService;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultService; import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultService;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -44,6 +58,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -44,6 +58,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private IJyjcInspectionResultParamService iJyjcInspectionResultParamService; private IJyjcInspectionResultParamService iJyjcInspectionResultParamService;
@Autowired @Autowired
EquipmentCategoryMapper equipmentCategoryMapper;
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory;
@Autowired
JyjcInspectionResultMapper resultMapper; JyjcInspectionResultMapper resultMapper;
@Autowired @Autowired
...@@ -123,4 +143,32 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -123,4 +143,32 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
} }
return map; return map;
} }
@Override
public List<Map<String, Object>> equipList(String type, String notNode) {
List<Map<String, Object>> menus = new ArrayList<>();
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(equipCategory);
List<Map<String, Object>> mapList;
if (ValidationUtil.isEmpty(type)) {
mapList = resourceJson.get(EquipmentClassifityEnum.BDLS.getCode());
} else {
mapList = resourceJson.get(type);
}
mapList.stream().filter(map -> {
if (!ObjectUtils.isEmpty(notNode)) {
String[] code = notNode.split(",");
List<String> codeList = Arrays.asList(code);
return !codeList.contains(map.get("code"));
}
return true;
}).forEach(obj -> {
Map<String, Object> resultMap = new HashMap<>(2);
resultMap.put("instanceName", obj.get("name"));
resultMap.put("instanceId", obj.get("code"));
menus.add(resultMap);
});
return menus;
}
} }
\ No newline at end of file
...@@ -25,9 +25,11 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseUnitLicenceDto; ...@@ -25,9 +25,11 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseUnitLicenceMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseUnitLicenceMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.service.ICreateCodeService;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.Workflow; import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
...@@ -39,12 +41,15 @@ import org.apache.commons.lang3.StringUtils; ...@@ -39,12 +41,15 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.expression.Ids;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -64,7 +69,8 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -64,7 +69,8 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
@Autowired @Autowired
CommonserviceImpl commonserviceImpl; CommonserviceImpl commonserviceImpl;
@Autowired
private ICreateCodeService createCodeService;
@Autowired @Autowired
JyjcOpeningApplicationMapper jyjcOpeningApplicationMapper; JyjcOpeningApplicationMapper jyjcOpeningApplicationMapper;
...@@ -95,7 +101,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -95,7 +101,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
try { try {
if (enableStartFlow) { if (enableStartFlow) {
// 开启工作流 startProcess // 开启工作流 startProcess
String instanceId = startFlow(); String instanceId = startFlow("1");
JSONObject dataObject = getTask(instanceId); JSONObject dataObject = getTask(instanceId);
JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor"); JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor");
if (!ValidationUtil.isEmpty(executorArray)) { if (!ValidationUtil.isEmpty(executorArray)) {
...@@ -119,7 +125,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -119,7 +125,7 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
model.setUnitCode(companyBo.getCompanyCode()); model.setUnitCode(companyBo.getCompanyCode());
model.setUnitCode("91611103MAC4Q1EG7B"); model.setUnitCode("91611103MAC4Q1EG7B");
model.setUnitCodeName(companyBo.getCompanyName()); model.setUnitCodeName(companyBo.getCompanyName());
model.setApplicationSeq(buildApplicationSeq()); model.setApplicationSeq(createCodeService.createDeviceRegistrationCode(ApplicationFormTypeEnum.JY.getCode()));
return this.createWithModel(model); return this.createWithModel(model);
} else { } else {
return this.updateWithModel(model); return this.updateWithModel(model);
...@@ -281,19 +287,21 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -281,19 +287,21 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
return jyjcOpeningApplicationModel; return jyjcOpeningApplicationModel;
} }
public String startFlow() throws Exception { public String startFlow(String businessKey) throws Exception {
// 重新开启工作流 // 重新开启工作流
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(processDefinitionKey); dto.setProcessDefinitionKey(processDefinitionKey);
dto.setBusinessKey("1"); dto.setBusinessKey(StringUtils.defaultString(businessKey, "1"));
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto); // dto.setCompleteFirstTask(true);
FeignClientResult ajaxResult = Workflow.taskV2Client.startByVariable(dto);
// AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("开启工作流结果:{}", ajaxResult); log.debug("开启工作流结果:{}", ajaxResult);
} }
if (ajaxResult == null || (ajaxResult.get(AjaxResult.CODE_TAG) != null && !"200".equals(ajaxResult.get(AjaxResult.CODE_TAG).toString()))) { if (ajaxResult == null || 200 != ajaxResult.getStatus()) {
throw new BaseException("开启工作流错误"); throw new BaseException("开启工作流错误");
} }
return ((Map) ajaxResult.get("data")).get("id").toString(); return ((Map) ajaxResult.getResult()).get("id").toString();
} }
/** /**
...@@ -375,34 +383,34 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -375,34 +383,34 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
dataObject.put("nodeInfo", nodeInfo.getResult()); dataObject.put("nodeInfo", nodeInfo.getResult());
return dataObject; return dataObject;
} }
//
/** // /**
* JY+年(4位)+月(2位)+日(2位)+序列号(3位 // * JY+年(4位)+月(2位)+日(2位)+序列号(3位
* // *
* @param // * @param
* @return {@link java.lang.String} // * @return {@link java.lang.String}
* @throws // * @throws
* @author yangyang // * @author yangyang
* @date 2023/12/13 22:30 // * @date 2023/12/13 22:30
*/ // */
private String buildApplicationSeq() { // private String buildApplicationSeq() {
String sdf = new SimpleDateFormat("yyyyMMdd").format(new Date()); // String sdf = new SimpleDateFormat("yyyyMMdd").format(new Date());
long increment = redisUtils.incr(CommonConstants.OPEN_APPLICATION_SEQ_KEY, 1); // long increment = redisUtils.incr(CommonConstants.OPEN_APPLICATION_SEQ_KEY, 1);
if (increment == 0) { // if (increment == 0) {
redisUtils.expire(CommonConstants.OPEN_APPLICATION_SEQ_KEY, nextDay()); // redisUtils.expire(CommonConstants.OPEN_APPLICATION_SEQ_KEY, nextDay());
} // }
return CommonConstants.APPLICATION_SEQ_PREFIX + sdf + String.format("%03d", increment); // return CommonConstants.APPLICATION_SEQ_PREFIX + sdf + String.format("%03d", increment);
} // }
//
private long nextDay() { // private long nextDay() {
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0); // calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0); // calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0); // calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0); // calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.DAY_OF_MONTH, 1); // calendar.add(Calendar.DAY_OF_MONTH, 1);
return (calendar.getTimeInMillis() - System.currentTimeMillis()) / 1000; // return (calendar.getTimeInMillis() - System.currentTimeMillis()) / 1000;
} // }
public List<Map<String, Object>> selectForFlowStatusList() { public List<Map<String, Object>> selectForFlowStatusList() {
return Arrays.stream(FlowStatusEnum.values()).map(this::mapPointTypeToMap).collect(Collectors.toList()); return Arrays.stream(FlowStatusEnum.values()).map(this::mapPointTypeToMap).collect(Collectors.toList());
...@@ -415,4 +423,15 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -415,4 +423,15 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
return record; return record;
} }
public Boolean deleteBatchByIds(List<Long> ids){
List<JyjcOpeningApplication> jyjcOpeningApplicationList=jyjcOpeningApplicationMapper.selectList(new QueryWrapper<JyjcOpeningApplication>()
.in("sequence_nbr"));
List<String> status = Arrays.asList(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()),String.valueOf(FlowStatusEnum.REJECTED.getCode()));
jyjcOpeningApplicationList = jyjcOpeningApplicationList.stream().filter(jyjcOpeningApplication ->!status.contains(jyjcOpeningApplication.getStatus())).collect(Collectors.toList());
if(jyjcOpeningApplicationList.isEmpty()){
throw new BadRequest("除撤回跟驳回的流程之外其余流程不可删除,请核对数据后重新提交!");
}
deleteBatchByIds(ids);
return true;
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jyjc.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.LinkedHashMap;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 15:46
*/
@Component
@Slf4j
public class WorkflowHelper {
@Autowired
private WorkflowFeignClient workflowFeignClient;
/**
* 获取工作流
*
*
* @param instanceId instanceId
* @return {@link JSONObject}
* @author yangyang
* @throws
* @date 2023/12/15 16:17
*/
public JSONObject getTask(String instanceId) {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");// 工作流ID
FeignClientResult<JSONObject> nodeInfo = workflowFeignClient.getNodeInfotoken(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), taskId);
dataObject.put("nodeInfo", nodeInfo.getResult());
return dataObject;
}
public String getWorkflowStatus(JSONObject dataObject) {
return !ValidationUtil.isEmpty(dataObject) && !ValidationUtil.isEmpty(dataObject.get("status")) ? String.valueOf(dataObject.get("status")) : "";
}
public String getWorkflowRoleGroups(JSONObject dataObject) {
JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor");
if(!ValidationUtil.isEmpty(executorArray)) {
return executorArray.stream().map(json -> Optional.ofNullable(((LinkedHashMap) json).get("groupId")).orElse("").toString()).collect(Collectors.joining(","));
}
return null;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationHandlerService;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationPushLogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:12
*/
@Component
public class AbstractJyjcInspectionApplicationHandlerServiceImpl implements IJyjcInspectionApplicationHandlerService {
@Autowired
private JyjcInspectionApplicationPushLogServiceImpl applicationPushLogService;
@Override
public String type() {
return "default";
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
// push日志
applicationPushLogService.saveInspectionApplicationPushLog(params);
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 检测
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class DetectionInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.DETECTION.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 定检
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class FirstInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.FIRST_INSPECTION.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionApplicationHandlerService;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* @author yangyang
* @version v1.0
* @date 2023/11/8 15:10
*/
@Service
public class JyjcInspectionApplicationHandlerFactory implements ApplicationContextAware {
private static final Map<String, IJyjcInspectionApplicationHandlerService> SERVICE_POOL = new HashMap<>(12);
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
applicationContext.getBeansOfType(IJyjcInspectionApplicationHandlerService.class).forEach((beanName, bean) -> SERVICE_POOL.put(bean.type(), bean));
}
public static IJyjcInspectionApplicationHandlerService apply(String type) {
IJyjcInspectionApplicationHandlerService objectSceneService = SERVICE_POOL.get(type);
if (Objects.isNull(objectSceneService)) {
throw new IllegalArgumentException("SERVICE_POOL type: " + type + " is not found !");
}
return objectSceneService;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 监督检验
*
* <p>
* ProjectName: amos-boot-biz
* PackageName: com.yeejoin.amos.boot.module.jyjc.biz.service.impl.handler
*
* @author yangyang
* @version v1.0
* @date 2023/12/15 16:32
*/
@Component
public class SuperviseInspectionApplicationHandlerServiceImpl extends AbstractJyjcInspectionApplicationHandlerServiceImpl {
@Override
public String type() {
return BizTypeEnum.SUPERVISE.getCode();
}
@Override
public boolean notifyInspectionUnit(Map<String, Object> params) {
super.notifyInspectionUnit(params);
// todo
return true;
}
}
package com.yeejoin.amos.boot.module.jyjc.biz.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
public class JsonUtils {
//将json文件转化为Map<list<Map<>>>
public static Map getResourceJson(Resource resource) {
String json = null;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(resource + "json文件转化失败");
}
return JSONObject.parseObject(json, Map.class);
}
}
{
"eightCategory": [
{
"name": "电梯",
"code": "3000",
"image": "upload/tzs/common/image/总览电梯.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "elevator"
},
{
"name": "起重机械",
"code": "4000",
"image": "upload/tzs/common/image/总览起重机械.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "lifting"
},
{
"name": "场内机动车辆",
"code": "5000",
"image": "upload/tzs/common/image/总览厂车.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "vehicle"
},
{
"name": "锅炉",
"code": "1000",
"image": "upload/tzs/common/image/总览锅炉.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "boiler"
},
{
"name": "压力容器",
"code": "2000",
"image": "upload/tzs/common/image/总览压力容器.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "vessel"
},
{
"name": "压力管道",
"code": "8000",
"image": "upload/tzs/common/image/总览压力管道.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "pipeline"
},
{
"name": "大型游乐设施",
"code": "6000",
"image": "upload/tzs/common/image/总览游乐设施.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "rides"
},
{
"name": "客运索道",
"code": "9000",
"image": "upload/tzs/common/image/总览索道.png",
"waitClaim": "0",
"alreadyClaim": "0",
"refuseClaim": "0",
"sum": "0",
"type": "ropeway"
}
],
"other": [
{
"name": "电梯",
"code": "3000"
},
{
"name": "起重机械",
"code": "4000"
},
{
"name": "场内机动车辆",
"code": "5000"
},
{
"name": "锅炉",
"code": "1000"
},
{
"name": "压力容器",
"code": "2000"
},
{
"name": "压力管道",
"code": "8000"
},
{
"name": "大型游乐设施",
"code": "6000"
},
{
"name": "客运索道",
"code": "9000"
}
]
}
\ No newline at end of file
{
"3000": [
{
"label": "使用年限",
"key": "synx",
"type": "input"
},
{
"label": "控制方式",
"key": "kzfs",
"type": "select",
"data": [
{
"name": "选项1",
"value": "1"
},
{
"name": "选项1",
"value": "1"
}
]
}
],
"4000": [
{
"label": "使用年限4000",
"key": "synx",
"type": "input"
}
]
}
\ No newline at end of file
...@@ -16,6 +16,7 @@ public enum ApplicationFormTypeEnum { ...@@ -16,6 +16,7 @@ public enum ApplicationFormTypeEnum {
*/ */
GZ("GZ"), GZ("GZ"),
JY("JY"), JY("JY"),
JG("JG"),// 检验结果
WB("WB"), WB("WB"),
SY("SY"); SY("SY");
......
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