Commit bb9a3a4b authored by 韩桐桐's avatar 韩桐桐

fix(jg):1,改造告知列表查询修改,车用气瓶检验单位和安装单位兼容旧系统数据

parent 242b6d29
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
<select id="queryForPage" resultType="java.util.Map"> <select id="queryForPage" resultType="java.util.Map">
select select
isn.province,
isn.city,
isn.county,
isn.street,
isn.promoter,
isn.sequence_nbr AS sequenceNbr, isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo, isn.apply_no AS applyNo,
isn.use_unit_name AS useUnitName, isn.use_unit_name AS useUnitName,
...@@ -12,16 +17,10 @@ ...@@ -12,16 +17,10 @@
isn.notice_status AS noticeStatus, isn.notice_status AS noticeStatus,
isn.install_unit_name AS installUnitName, isn.install_unit_name AS installUnitName,
isn.province_name AS provinceName, isn.province_name AS provinceName,
isn.province, isn.notice_report_url AS noticeReportUrl,
isn.city, isn.equ_list_code as equListCode,
isn.county, isn.create_user_id as createUserId,
isn.street, isn.next_execute_user_ids as nextExecuteUserIds,
isn.promoter,
isn.notice_report_url,
isn.equ_list_code,
isn.equ_category,
isn.create_user_id,
isn.next_execute_user_ids,
isn.instance_id AS instanceId, isn.instance_id AS instanceId,
isn.city_name AS cityName, isn.city_name AS cityName,
isn.county_name AS countyName, isn.county_name AS countyName,
...@@ -29,6 +28,7 @@ ...@@ -29,6 +28,7 @@
isn.receive_company_code AS receiveCompanyCode, isn.receive_company_code AS receiveCompanyCode,
isn.receive_org_name AS receiveOrgName, isn.receive_org_name AS receiveOrgName,
isn.next_execute_ids as nextExecuteIds, isn.next_execute_ids as nextExecuteIds,
isn.instance_status AS instanceStatus,
isn.inform_number AS informNumber, isn.inform_number AS informNumber,
isn.equ_category AS equCategory, isn.equ_category AS equCategory,
isn.next_task_id as nextTaskId, isn.next_task_id as nextTaskId,
......
...@@ -126,8 +126,9 @@ public class CommonController extends BaseController { ...@@ -126,8 +126,9 @@ public class CommonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUnitList") @GetMapping(value = "/getUnitList")
@ApiOperation(httpMethod = "GET", value = "通过单位类型获取单位列表", notes = "通过单位类型获取单位列表") @ApiOperation(httpMethod = "GET", value = "通过单位类型获取单位列表", notes = "通过单位类型获取单位列表")
public ResponseModel<List<Map<String, Object>>> getUnitList(@RequestParam(value = "type") String type) { public ResponseModel<List<Map<String, Object>>> getUnitList(@RequestParam(value = "type") String type,
return ResponseHelper.buildResponse(commonService.getUnitListByType(type)); @RequestParam(value = "business",required = false) String business) {
return ResponseHelper.buildResponse(commonService.getUnitListByType(type,business));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -32,7 +32,7 @@ public interface ICommonService { ...@@ -32,7 +32,7 @@ public interface ICommonService {
List<LinkedHashMap> creatTree(); List<LinkedHashMap> creatTree();
List<Map<String, Object>> getUnitListByType(String type); List<Map<String, Object>> getUnitListByType(String type, String business);
List<Map<String, Object>> getSecurityAdmin(String type, String useUnitCode); List<Map<String, Object>> getSecurityAdmin(String type, String useUnitCode);
...@@ -77,6 +77,7 @@ public interface ICommonService { ...@@ -77,6 +77,7 @@ public interface ICommonService {
/** /**
* 使用标志生成 * 使用标志生成
*
* @param useFlagParamDto 参数 * @param useFlagParamDto 参数
* @param response 文件信息 * @param response 文件信息
*/ */
...@@ -86,6 +87,7 @@ public interface ICommonService { ...@@ -86,6 +87,7 @@ public interface ICommonService {
/** /**
* 执行流程时前置校验 * 执行流程时前置校验
*
* @param taskId 任务id * @param taskId 任务id
* @param instanceId 实例id * @param instanceId 实例id
*/ */
...@@ -94,6 +96,7 @@ public interface ICommonService { ...@@ -94,6 +96,7 @@ public interface ICommonService {
/** /**
* 最新流程数据缓存 * 最新流程数据缓存
*
* @param instanceId 实例id * @param instanceId 实例id
* @param instanceData 流程数据 * @param instanceData 流程数据
*/ */
...@@ -101,6 +104,7 @@ public interface ICommonService { ...@@ -101,6 +104,7 @@ public interface ICommonService {
/** /**
* 撤回时校验 * 撤回时校验
*
* @param taskId 前端业务上送任务id * @param taskId 前端业务上送任务id
* @param instanceId 实例id * @param instanceId 实例id
*/ */
...@@ -109,6 +113,7 @@ public interface ICommonService { ...@@ -109,6 +113,7 @@ public interface ICommonService {
/** /**
* 创建或者更新历史表 * 创建或者更新历史表
*
* @param registrationClass 分类 * @param registrationClass 分类
* @param map 过程数据 * @param map 过程数据
* @param equipId 设备唯一标识 * @param equipId 设备唯一标识
...@@ -119,6 +124,7 @@ public interface ICommonService { ...@@ -119,6 +124,7 @@ public interface ICommonService {
/** /**
* 查询历史数据 * 查询历史数据
*
* @param currentDocumentId 业务id * @param currentDocumentId 业务id
* @return JSONObject * @return JSONObject
*/ */
...@@ -126,6 +132,7 @@ public interface ICommonService { ...@@ -126,6 +132,7 @@ public interface ICommonService {
/** /**
* 查询历史数据: 通用 * 查询历史数据: 通用
*
* @param currentDocumentId 业务id * @param currentDocumentId 业务id
* @return Object * @return Object
*/ */
...@@ -133,6 +140,7 @@ public interface ICommonService { ...@@ -133,6 +140,7 @@ public interface ICommonService {
/** /**
* 统计指定设备流程中的引用次数(12个流程中,非待提交、非已撤回、非已驳回) * 统计指定设备流程中的引用次数(12个流程中,非待提交、非已撤回、非已驳回)
*
* @param record 设备唯一标识 * @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可编辑 * @return 被引用次数 > 0 则设备不可编辑
*/ */
...@@ -141,6 +149,7 @@ public interface ICommonService { ...@@ -141,6 +149,7 @@ public interface ICommonService {
/** /**
* 统计设备被引用的次数(只有存在就算引用) * 统计设备被引用的次数(只有存在就算引用)
*
* @param record 设备唯一标识 * @param record 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除 * @return 被引用次数 > 0 则设备不可删除
*/ */
...@@ -148,6 +157,7 @@ public interface ICommonService { ...@@ -148,6 +157,7 @@ public interface ICommonService {
/** /**
* 设备分类 * 设备分类
*
* @param type 1,设备种类 2,设备类别 3,设备品种 * @param type 1,设备种类 2,设备类别 3,设备品种
* @return * @return
*/ */
...@@ -155,6 +165,7 @@ public interface ICommonService { ...@@ -155,6 +165,7 @@ public interface ICommonService {
/** /**
* 套打使用标志生成 * 套打使用标志生成
*
* @param useFlagParamDto 参数 * @param useFlagParamDto 参数
* @param response 文件信息 * @param response 文件信息
*/ */
...@@ -168,6 +179,7 @@ public interface ICommonService { ...@@ -168,6 +179,7 @@ public interface ICommonService {
/** /**
* 公司详情 * 公司详情
*
* @param companyCode 公司编码 * @param companyCode 公司编码
* @return CompanyBo * @return CompanyBo
*/ */
......
...@@ -56,6 +56,7 @@ import com.yeejoin.amos.feign.privilege.Privilege; ...@@ -56,6 +56,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.PermissionModel; import com.yeejoin.amos.feign.privilege.model.PermissionModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model; import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.model.ActTaskDTO; import com.yeejoin.amos.feign.workflow.model.ActTaskDTO;
import com.yeejoin.amos.feign.workflow.model.FlowTaskVo; import com.yeejoin.amos.feign.workflow.model.FlowTaskVo;
...@@ -104,69 +105,35 @@ import java.util.stream.Collectors; ...@@ -104,69 +105,35 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class CommonServiceImpl implements ICommonService { public class CommonServiceImpl implements ICommonService {
@Autowired public static final String SPECIAL_REGION_CODE = "SpecialRegionCode";
EquipmentCategoryMapper equipmentCategoryMapper; // 行政区划redis缓存key
@Autowired
private RedisUtils redisUtils;
@Autowired
IDataDictionaryService iDataDictionaryService;
@Value("classpath:/json/superviseBusinessCategory.json")
private Resource superviseBusinessCategory;
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
@Value("classpath:/json/companyCodeRegName.json")
private Resource regNameJson;
@Autowired
JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
//行政区划redis缓存key
private static final String PROVINCE = "PROVINCE"; private static final String PROVINCE = "PROVINCE";
private static final String CITY = "CITY"; private static final String CITY = "CITY";
private static final String REGION = "REGION"; private static final String REGION = "REGION";
private static final String STREET = "STREET"; private static final String STREET = "STREET";
//行政区划level // 行政区划level
private static final String PROVINCE_LEVEL = "1"; private static final String PROVINCE_LEVEL = "1";
private static final String CITY_LEVEL = "2"; private static final String CITY_LEVEL = "2";
private static final String REGION_LEVEL = "3"; private static final String REGION_LEVEL = "3";
private static final String STREET_LEVEL = "4"; private static final String STREET_LEVEL = "4";
// 判断行政区划查询市还是区
//判断行政区划查询市还是区
private static final String END_CODE = "0000"; private static final String END_CODE = "0000";
//判断行政区划查询街道 // 判断行政区划查询街道
private static final String STREET_END_CODE = "00"; private static final String STREET_END_CODE = "00";
// 管辖机构redis缓存key
//管辖机构redis缓存key
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE"; private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
/** /**
* 接收机构redis缓存key前置 * 接收机构redis缓存key前置
*/ */
private static final String PREFIX_NOTICE_RECEIVE_UNIT_TREE = "NOTICE_RECEIVE_UNIT_TREE"; private static final String PREFIX_NOTICE_RECEIVE_UNIT_TREE = "NOTICE_RECEIVE_UNIT_TREE";
// 管辖机构redis缓存key
//管辖机构redis缓存key
private static final String REGULATOR_UNIT_TREE_ALL = "REGULATOR_UNIT_TREE_ALL"; private static final String REGULATOR_UNIT_TREE_ALL = "REGULATOR_UNIT_TREE_ALL";
// 行政审批局redis缓存key
//行政审批局redis缓存key
private static final String ADMINISTRATION_UNIT_TREE = "ADMINISTRATION_UNIT_TREE"; private static final String ADMINISTRATION_UNIT_TREE = "ADMINISTRATION_UNIT_TREE";
// 管辖机构
//管辖机构
private static final String REGULATOR_UNIT = "监管机构"; private static final String REGULATOR_UNIT = "监管机构";
//行政审批局 // 行政审批局
private static final String ADMINISTRATION_UNIT = "行政审批局"; private static final String ADMINISTRATION_UNIT = "行政审批局";
public static final String SPECIAL_REGION_CODE = "SpecialRegionCode";
@Value("${regulator.unit.code}")
private String code;
@Autowired
PrivilegeFeginService privilegeFeginService;
// 业务通用发起——基本信息 // 业务通用发起——基本信息
private static final String basic = "basic"; private static final String basic = "basic";
// 业务通用发起——告知单详情 // 业务通用发起——告知单详情
...@@ -190,6 +157,14 @@ public class CommonServiceImpl implements ICommonService { ...@@ -190,6 +157,14 @@ public class CommonServiceImpl implements ICommonService {
// 业务通用发起——更名变更表单key // 业务通用发起——更名变更表单key
private static final String GMBG_PAGE_ID = "jgRegistrationInfo"; private static final String GMBG_PAGE_ID = "jgRegistrationInfo";
@Autowired @Autowired
EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
IDataDictionaryService iDataDictionaryService;
@Autowired
JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired
PrivilegeFeginService privilegeFeginService;
@Autowired
CommonMapper commonMapper; CommonMapper commonMapper;
@Autowired @Autowired
RegistrationInfoMapper tzsJgRegistrationInfoMapper; RegistrationInfoMapper tzsJgRegistrationInfoMapper;
...@@ -222,7 +197,18 @@ public class CommonServiceImpl implements ICommonService { ...@@ -222,7 +197,18 @@ public class CommonServiceImpl implements ICommonService {
DataDictionaryServiceImpl dataDictionaryService; DataDictionaryServiceImpl dataDictionaryService;
@Autowired @Autowired
IdxBizJgSupervisionInfoMapper idxBizJgSupervisionInfoMapper; IdxBizJgSupervisionInfoMapper idxBizJgSupervisionInfoMapper;
@Autowired
RedissonClient redissonClient;
@Autowired
private RedisUtils redisUtils;
@Value("classpath:/json/superviseBusinessCategory.json")
private Resource superviseBusinessCategory;
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
@Value("classpath:/json/companyCodeRegName.json")
private Resource regNameJson;
@Value("${regulator.unit.code}")
private String code;
@Autowired @Autowired
private IJgInstallationNoticeService iJgInstallationNoticeService; private IJgInstallationNoticeService iJgInstallationNoticeService;
@Autowired @Autowired
...@@ -231,18 +217,8 @@ public class CommonServiceImpl implements ICommonService { ...@@ -231,18 +217,8 @@ public class CommonServiceImpl implements ICommonService {
private IJgTransferNoticeService jgTransferNoticeService; private IJgTransferNoticeService jgTransferNoticeService;
@Autowired @Autowired
private JgVehicleInformationServiceImpl jgVehicleInformationService; private JgVehicleInformationServiceImpl jgVehicleInformationService;
@Autowired
RedissonClient redissonClient;
private Map<String, String> companyCodeRegNameMap; private Map<String, String> companyCodeRegNameMap;
@PostConstruct
public void init(){
companyCodeRegNameMap = JsonUtils.getResourceJson(regNameJson);
}
public static byte[] file2byte(File file) { public static byte[] file2byte(File file) {
try { try {
FileInputStream in = new FileInputStream(file); FileInputStream in = new FileInputStream(file);
...@@ -257,6 +233,68 @@ public class CommonServiceImpl implements ICommonService { ...@@ -257,6 +233,68 @@ public class CommonServiceImpl implements ICommonService {
} }
} }
private static String toQueryParams2(JSONObject jsonObject) {
StringBuilder sb = new StringBuilder();
Set<String> keys = jsonObject.keySet();
keys.forEach(key -> {
Object value = jsonObject.get(key);
if (sb.length() > 0) {
sb.append('&');
}
try {
if (value != null && !"".equals(value)) {
sb.append(URLEncoder.encode(key, "UTF-8"))
.append('=')
.append(URLEncoder.encode(value.toString(), "UTF-8"));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
});
return sb.toString();
}
public static String buildJgExecuteLockKey(String instanceId) {
return "JG_INSTANCE_LOCK:" + instanceId;
}
public static String buildJgInstanceDataKey(String instanceId) {
return "JG_INSTANCE_DATA:" + instanceId;
}
public static void formatTime2StrDateForEquip(JSONObject jsonObject) {
String[] timeFields = {"designDate", "produceDate", "inspectDate", "nextInspectDate"};
for (String field : timeFields) {
if (jsonObject.get(field) != null && jsonObject.get(field) instanceof Long) {
jsonObject.put(field, DateUtil.format(new Date(Long.parseLong(jsonObject.get(field).toString())), DatePattern.NORM_DATETIME_PATTERN));
}
}
}
/**
* 驼峰转下划线
*
* @param str
* @return
*/
public static String convertToUnderline(String str) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (Character.isUpperCase(c)) {
sb.append("_").append(Character.toLowerCase(c));
} else {
sb.append(c);
}
}
return sb.toString();
}
@PostConstruct
public void init() {
companyCodeRegNameMap = JsonUtils.getResourceJson(regNameJson);
}
@Override @Override
public List<EquipmentCategory> getEquipmentCategoryList(String code, String type) { public List<EquipmentCategory> getEquipmentCategoryList(String code, String type) {
List<EquipmentCategory> result = new ArrayList<>(); List<EquipmentCategory> result = new ArrayList<>();
...@@ -419,17 +457,15 @@ public class CommonServiceImpl implements ICommonService { ...@@ -419,17 +457,15 @@ public class CommonServiceImpl implements ICommonService {
paramMap.put("receiveOrgName", receiveOrgName); paramMap.put("receiveOrgName", receiveOrgName);
} }
public String getRegName(String receiveCompanyCode, String defaultName) { public String getRegName(String receiveCompanyCode, String defaultName) {
return companyCodeRegNameMap.getOrDefault(receiveCompanyCode, defaultName); return companyCodeRegNameMap.getOrDefault(receiveCompanyCode, defaultName);
} }
private void setNextDate(UseFlagParamDto useFlagParamDto, Map<String, Object> paramMap) { private void setNextDate(UseFlagParamDto useFlagParamDto, Map<String, Object> paramMap) {
if (useFlagParamDto.getNextInspectionDate() != null) { if (useFlagParamDto.getNextInspectionDate() != null) {
paramMap.put("year", DateUtil.year(useFlagParamDto.getNextInspectionDate()) + ""); paramMap.put("year", DateUtil.year(useFlagParamDto.getNextInspectionDate()) + "");
paramMap.put("month", DateUtil.month(useFlagParamDto.getNextInspectionDate()) + 1); paramMap.put("month", DateUtil.month(useFlagParamDto.getNextInspectionDate()) + 1);
paramMap.put("nextInspectionTime",paramMap.get("year") +"年" + paramMap.get("month") +"月"); paramMap.put("nextInspectionTime", paramMap.get("year") + "年" + paramMap.get("month") + "月");
} }
} }
...@@ -602,7 +638,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -602,7 +638,7 @@ public class CommonServiceImpl implements ICommonService {
} }
@Override @Override
public List<Map<String, Object>> getUnitListByType(String type) { public List<Map<String, Object>> getUnitListByType(String type, String business) {
switch (type) { switch (type) {
case "use": case "use":
...@@ -621,9 +657,27 @@ public class CommonServiceImpl implements ICommonService { ...@@ -621,9 +657,27 @@ public class CommonServiceImpl implements ICommonService {
type = "all"; type = "all";
break; break;
} }
return commonMapper.getUnitListByType(type); List<Map<String, Object>> unitList = commonMapper.getUnitListByType(type);
// 检验检测机构 追加车用气瓶
if ("检验检测机构".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSPECTION_TESTING_UNIT").getResult();
result.forEach(x-> convertAndAddToUnitList(x, unitList));
}
if ("安装改造维修单位".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSTALLATION_UNIT").getResult();
result.forEach(x-> convertAndAddToUnitList(x, unitList));
}
return unitList;
}
private static void convertAndAddToUnitList(DictionarieValueModel x, List<Map<String, Object>> unitList) {
HashMap<String, Object> map = new HashMap<>();
map.put("useCode", x.getDictDataKey());
map.put("useUnit", x.getDictDataValue());
unitList.add(map);
} }
@Override @Override
public List<Map<String, Object>> getSecurityAdmin(String type, String companyCode) { public List<Map<String, Object>> getSecurityAdmin(String type, String companyCode) {
if (ObjectUtils.isEmpty(companyCode)) { if (ObjectUtils.isEmpty(companyCode)) {
...@@ -800,7 +854,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -800,7 +854,7 @@ public class CommonServiceImpl implements ICommonService {
String qrCode = ImageUtils.generateQRCode((String) map.getOrDefault("applyNo", ""), 100, 100); String qrCode = ImageUtils.generateQRCode((String) map.getOrDefault("applyNo", ""), 100, 100);
map.put("supervisoryCode", qrCode); // 监管二维码 代码优化 map.put("supervisoryCode", qrCode); // 监管二维码 代码优化
this.fillParamValueToPdf(map, response,"templates/use-registration-model.pdf","套打使用登记证.pdf",12.0f); this.fillParamValueToPdf(map, response, "templates/use-registration-model.pdf", "套打使用登记证.pdf", 12.0f);
} }
/** /**
...@@ -840,7 +894,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -840,7 +894,7 @@ public class CommonServiceImpl implements ICommonService {
pdfStamper.setFormFlattening(true); pdfStamper.setFormFlattening(true);
pdfStamper.close(); pdfStamper.close();
this.writeAttachment(response, bos.toByteArray(),printFileName); this.writeAttachment(response, bos.toByteArray(), printFileName);
} catch (IOException | DocumentException e) { } catch (IOException | DocumentException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
...@@ -944,7 +998,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -944,7 +998,7 @@ public class CommonServiceImpl implements ICommonService {
if (submitType.equals("1")) { if (submitType.equals("1")) {
jsonObject.put("submit", Boolean.TRUE); jsonObject.put("submit", Boolean.TRUE);
} }
//判断是否为车用气瓶使用登记或者设备使用登记 // 判断是否为车用气瓶使用登记或者设备使用登记
return code != null && code.equals("1") ? jgVehicleInformationService.save(submitType, jsonObject) : jgUseRegistrationServiceImpl.save(jsonObject); return code != null && code.equals("1") ? jgVehicleInformationService.save(submitType, jsonObject) : jgUseRegistrationServiceImpl.save(jsonObject);
} else if (type.equals(ApplicationFormTypeEnum.GZBG.getBusinessCode())) { } else if (type.equals(ApplicationFormTypeEnum.GZBG.getBusinessCode())) {
// 兼容业务逻辑代码 // 兼容业务逻辑代码
...@@ -1016,7 +1070,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1016,7 +1070,7 @@ public class CommonServiceImpl implements ICommonService {
try { try {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS); boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
// 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回) // 解决并发问题:多个人同时操作一个流程(并发执行通过、驳回、撤回)
if(!isLocked){ if (!isLocked) {
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!"); throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
} }
// 流程执行前置校验 // 流程执行前置校验
...@@ -1066,7 +1120,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1066,7 +1120,7 @@ public class CommonServiceImpl implements ICommonService {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if(lock.isHeldByCurrentThread()){ if (lock.isHeldByCurrentThread()) {
lock.unlock(); lock.unlock();
} }
} }
...@@ -1359,28 +1413,6 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1359,28 +1413,6 @@ public class CommonServiceImpl implements ICommonService {
} }
} }
private static String toQueryParams2(JSONObject jsonObject) {
StringBuilder sb = new StringBuilder();
Set<String> keys = jsonObject.keySet();
keys.forEach(key -> {
Object value = jsonObject.get(key);
if (sb.length() > 0) {
sb.append('&');
}
try {
if (value != null && !"".equals(value)) {
sb.append(URLEncoder.encode(key, "UTF-8"))
.append('=')
.append(URLEncoder.encode(value.toString(), "UTF-8"));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
});
return sb.toString();
}
public <T> String toQueryParams(T obj) throws UnsupportedEncodingException { public <T> String toQueryParams(T obj) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -1408,7 +1440,6 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1408,7 +1440,6 @@ public class CommonServiceImpl implements ICommonService {
return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : ""; return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : "";
} }
/** /**
* 根据流程状态name 获取流程状态code * 根据流程状态name 获取流程状态code
* *
...@@ -1538,18 +1569,10 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1538,18 +1569,10 @@ public class CommonServiceImpl implements ICommonService {
} }
} }
public static String buildJgExecuteLockKey(String instanceId) {
return "JG_INSTANCE_LOCK:" + instanceId;
}
public static String buildJgInstanceDataKey(String instanceId) {
return "JG_INSTANCE_DATA:" + instanceId;
}
@Override @Override
public void checkForExecuteFlow(String taskId, String instanceId) { public void checkForExecuteFlow(String taskId, String instanceId) {
InstanceRuntimeData instanceRuntimeData = getInstanceRuntimeData(instanceId); InstanceRuntimeData instanceRuntimeData = getInstanceRuntimeData(instanceId);
if(instanceRuntimeData == null){ if (instanceRuntimeData == null) {
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!"); throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
} }
// 当前任务id与当前任务id不一致时,不让操作,解决老页面没关闭,但是流程已经被被人执行(通过、驳回、撤回),工作流未限制错误 // 当前任务id与当前任务id不一致时,不让操作,解决老页面没关闭,但是流程已经被被人执行(通过、驳回、撤回),工作流未限制错误
...@@ -1578,7 +1601,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1578,7 +1601,7 @@ public class CommonServiceImpl implements ICommonService {
@Override @Override
public void checkForRevocationFlow(String taskId, String instanceId) { public void checkForRevocationFlow(String taskId, String instanceId) {
InstanceRuntimeData instanceRuntimeData = getInstanceRuntimeData(instanceId); InstanceRuntimeData instanceRuntimeData = getInstanceRuntimeData(instanceId);
if(instanceRuntimeData == null){ if (instanceRuntimeData == null) {
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!"); throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
} }
// 前端页面上送任务id与当前任务id不一致时,不让操作,解决老页面没关闭,但是流程已经被被人执行(通过、驳回、撤回),工作流未限制错误 // 前端页面上送任务id与当前任务id不一致时,不让操作,解决老页面没关闭,但是流程已经被被人执行(通过、驳回、撤回),工作流未限制错误
...@@ -1586,7 +1609,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1586,7 +1609,7 @@ public class CommonServiceImpl implements ICommonService {
if (!taskId.equals(currentTaskId)) { if (!taskId.equals(currentTaskId)) {
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!"); throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
} }
if(!instanceRuntimeData.getPromoter().equals(RequestContext.getExeUserId())){ if (!instanceRuntimeData.getPromoter().equals(RequestContext.getExeUserId())) {
throw new BadRequest("无权限执行该任务"); throw new BadRequest("无权限执行该任务");
} }
} }
...@@ -1610,45 +1633,35 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1610,45 +1633,35 @@ public class CommonServiceImpl implements ICommonService {
} }
} }
@Override @Override
public JSONObject queryHistoryData(Long currentDocumentId){ public JSONObject queryHistoryData(Long currentDocumentId) {
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda(); LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId); lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId);
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda); JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda);
return jgRegistrationHistory != null ? JSONObject.parseObject(jgRegistrationHistory.getChangeData()) : null; return jgRegistrationHistory != null ? JSONObject.parseObject(jgRegistrationHistory.getChangeData()) : null;
} }
@Override @Override
public Object queryHistoryDataObj(Long currentDocumentId){ public Object queryHistoryDataObj(Long currentDocumentId) {
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda(); LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId); lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId);
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda); JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda);
return jgRegistrationHistory != null ? JSON.parse(jgRegistrationHistory.getChangeData()) : null; return jgRegistrationHistory != null ? JSON.parse(jgRegistrationHistory.getChangeData()) : null;
} }
public static void formatTime2StrDateForEquip(JSONObject jsonObject){
String[] timeFields = {"designDate" ,"produceDate", "inspectDate", "nextInspectDate"};
for(String field: timeFields){
if(jsonObject.get(field) != null && jsonObject.get(field) instanceof Long){
jsonObject.put(field, DateUtil.format(new Date(Long.parseLong(jsonObject.get(field).toString())) , DatePattern.NORM_DATETIME_PATTERN));
}
}
}
@Override @Override
public Integer countEquipInUseTimesForEdit(String record){ public Integer countEquipInUseTimesForEdit(String record) {
return commonMapper.countEquipInUseTimesForEdit(record); return commonMapper.countEquipInUseTimesForEdit(record);
} }
@Override @Override
public Integer countEquipInUseTimesForDel(String record){ public Integer countEquipInUseTimesForDel(String record) {
return commonMapper.countEquipInUseTimesForDel(record); return commonMapper.countEquipInUseTimesForDel(record);
} }
/** /**
* string转化为jsonObject * string转化为jsonObject
*
* @param obj jsonobject/map对象 * @param obj jsonobject/map对象
* @param jsonFields 要转化的字段数据 * @param jsonFields 要转化的字段数据
*/ */
...@@ -1675,14 +1688,15 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1675,14 +1688,15 @@ public class CommonServiceImpl implements ICommonService {
/** /**
* 设备分类 * 设备分类
*
* @param type 1,设备种类 2,设备类别 3,设备品种 * @param type 1,设备种类 2,设备类别 3,设备品种
* @return * @return
*/ */
@Override @Override
public List<EquipmentCategory> equipmentClassification(String type){ public List<EquipmentCategory> equipmentClassification(String type) {
List<EquipmentCategory> categoryList = equipmentCategoryMapper.selectList(new QueryWrapper<>()); List<EquipmentCategory> categoryList = equipmentCategoryMapper.selectList(new QueryWrapper<>());
List<EquipmentCategory> result = Collections.emptyList(); List<EquipmentCategory> result = Collections.emptyList();
switch (type){ switch (type) {
case "1": case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList());
break; break;
...@@ -1695,27 +1709,10 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1695,27 +1709,10 @@ public class CommonServiceImpl implements ICommonService {
} }
return result; return result;
} }
/**
* 驼峰转下划线
*
* @param str
* @return
*/
public static String convertToUnderline(String str) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (Character.isUpperCase(c)) {
sb.append("_").append(Character.toLowerCase(c));
} else {
sb.append(c);
}
}
return sb.toString();
}
/** /**
* 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject * 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
*
* @param sort "字段,ascend" 或 "字段,descend" * @param sort "字段,ascend" 或 "字段,descend"
* @return JSONObject * @return JSONObject
*/ */
...@@ -1766,6 +1763,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1766,6 +1763,7 @@ public class CommonServiceImpl implements ICommonService {
/** /**
* 根据设备列表代码选择对应的 PDF 模板 * 根据设备列表代码选择对应的 PDF 模板
*
* @param equListCode 设备代码 * @param equListCode 设备代码
* @return model * @return model
*/ */
......
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