Commit e9f83b6f authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_tzs_register
parents c145de89 15218606
......@@ -198,7 +198,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
installationInfo.put(s, ObjectUtils.isEmpty(installationInfo.get(s)) ? new JSONArray() : parseArray(installationInfo.get(s).toString()));
}
if(equipmentInfos.get(0).containsKey(s)) {
equipmentInfos.get(0).put(s, ObjectUtils.isEmpty(installationInfo.get(s)) ? new JSONArray() : parseArray(equipmentInfos.get(0).get(s).toString()));
equipmentInfos.get(0).put(s, ObjectUtils.isEmpty(equipmentInfos.get(0).get(s)) ? new JSONArray() : parseArray(equipmentInfos.get(0).get(s).toString()));
}
}
Map<String, Object> map = equipmentInfos.get(0);
......
......@@ -19,13 +19,14 @@ import java.util.List;
@AllArgsConstructor
public enum BizTypeEnum {
SUPERVISE("supervise", "监督检验"),
FIRST_INSPECTION("firstinspect", "定检"),
DETECTION("detection", "检测"),
BUSINESS_OPEN("businessOpen", "开通");
SUPERVISE("supervise", "监督检验","115"),
FIRST_INSPECTION("firstinspect", "定检","116"),
DETECTION("detection", "检测","117"),
BUSINESS_OPEN("businessOpen", "检验业务开通","114");
private String code;
private String name;
private String num;
public static List<String> getEnumNameList() {
List<String> codeList = new ArrayList<String>();
......@@ -44,4 +45,22 @@ public enum BizTypeEnum {
}
return null;
}
public static String getNumByCode(String code) {
for (BizTypeEnum c : BizTypeEnum.values()) {
if (c.getCode().equals(code)){
return c.getNum();
}
}
return null;
}
public static String getNameByNum(String num) {
for (BizTypeEnum c : BizTypeEnum.values()) {
if (c.getCode().equals(num)){
return c.getName();
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.jyjc.api.enums;
/**
* 业务类型枚举
*
* @author Administrator
*/
public enum BusinessTypeEnum {
/**
* 业务类型枚举
*/
JG_EQUIPMENT_HANDOVER("101", "设备移交"),
JG_INSTALLATION_NOTIFICATION("102", "安装告知"),
JG_MODIFICATION_NOTIFICATION("103", "改造告知"),
JG_MAINTENANCE_NOTIFICATION("104", "维修告知"),
JG_ADVICE_REMOVAL("105", "移装告知"),
JG_MAINTENANCE_RECORD("106", "维保备案"),
JG_USAGE_REGISTRATION("107", "使用登记"),
JG_NAME_CHANGE_REGISTRATION("108", "更名变更登记"),
JG_COMPANY_CHANGE_REGISTRATION("109", "单位变更登记"),
JG_CHANGE_REGISTRATION("110", "移装变更登记"),
JG_RENOVATION_REGISTRATION("111", "改造变更登记"),
JG_EQUIPMENT_START("112-1", "设备启用"),
JG_EQUIPMENT_STOP("112-2", "设备停用"),
JG_EQUIPMENT_MOVE("113-1", "移装报废"),
JG_EQUIPMENT_CANCEL("113-2", "注销报废"),
JY_OPENING_APPLICATION("114", "业务开通"),
JY_INSPECTION_APPLICATION_JD("115", "监督检验"),
JY_INSPECTION_APPLICATION_DS("116", "定(首)检验"),
JY_INSPECTION_APPLICATION_CHECK("117", "检验(含安全阀效验)");
private final String code;
private final String name;
BusinessTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByType(String code) {
String name = null;
for (BusinessTypeEnum enumOne : BusinessTypeEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
......@@ -165,7 +165,7 @@ public class JyjcInspectionApplicationModel extends BaseModel {
private String nextTaskId;
@ApiModelProperty(value = "下一步执行人Ids")
private String nextExcuteUserIds;
private String nextExecuteUserIds;
@ApiModelProperty(value = "下一步任务名称")
private String nextTaskName;
......
......@@ -58,4 +58,6 @@ public class TaskMessageDto {
* 设备id、使用登记使用
*/
String equipId;
String processKey;
}
......@@ -41,6 +41,12 @@ public class JyjcInspectionApplicationController extends BaseController {
@Autowired
JyjcInspectionApplicationServiceImpl jyjcInspectionApplicationServiceImpl;
// 业务通用发起——基本信息
private static final String basic = "basic";
// 业务通用发起——设备信息
private static final String equipPageInfo = "equipPageInfo";
// 业务通用发起——技术参数-
private static final String filePageData = "filePageData";
/**
* 新增
......@@ -51,7 +57,17 @@ public class JyjcInspectionApplicationController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<JyjcInspectionApplicationModel> save(@RequestBody JSONObject model) {
if (model.containsKey(basic)) {
JSONObject finallyJson = new JSONObject();
Map<String, Object> basicObj = (Map<String, Object>) model.get(basic);
Map<String, Object> equipPageInfoObj = (Map<String, Object>) model.get(equipPageInfo);
Map<String, Object> filePageDataObj = (Map<String, Object>) model.get(filePageData);
finallyJson.putAll(model);
finallyJson.putAll(basicObj);
finallyJson.putAll(equipPageInfoObj);
finallyJson.putAll(filePageDataObj);
model = finallyJson;
}
ReginParams selectedOrgInfo = getSelectedOrgInfo();
model.put("applicationUnitCode",selectedOrgInfo.getCompany().getCompanyCode());
......@@ -65,22 +81,6 @@ public class JyjcInspectionApplicationController extends BaseController {
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<JyjcInspectionApplicationModel> updateBySequenceNbrJyjcInspectionApplication(@RequestBody JyjcInspectionApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
......
package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
......@@ -56,9 +57,10 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<JyjcOpeningApplicationModel> save(@RequestBody JyjcOpeningApplicationModel model) {
model = jyjcOpeningApplicationServiceImpl.saveOrUpdateModel(model, false);
return ResponseHelper.buildResponse(model);
public ResponseModel<JyjcOpeningApplicationModel> save(@RequestBody JSONObject model) {
JyjcOpeningApplicationModel jyjcOpeningApplicationModel = new JyjcOpeningApplicationModel();
BeanUtil.copyProperties(model.get("applyInfo"),jyjcOpeningApplicationModel);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.saveOrUpdateModel(jyjcOpeningApplicationModel, false));
}
/**
......@@ -78,7 +80,9 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/submit")
@ApiOperation(httpMethod = "PUT", value = "保存并提交", notes = "保存并提交")
public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrAndStartFlow(@RequestBody JyjcOpeningApplicationModel model, @RequestParam(value = "sequenceNbr", required = false) Long sequenceNbr) {
public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrAndStartFlow(@RequestBody JSONObject jsonObject, @RequestParam(value = "sequenceNbr", required = false) Long sequenceNbr) {
JyjcOpeningApplicationModel model = new JyjcOpeningApplicationModel();
BeanUtil.copyProperties(jsonObject.get("applyInfo"),model);
model.setSequenceNbr(sequenceNbr);
if (sequenceNbr != null) {
JyjcOpeningApplicationModel jyjcOpeningApplicationModel = jyjcOpeningApplicationServiceImpl.queryDetail(sequenceNbr);
......@@ -217,7 +221,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "撤回业务开通申请", notes = "撤回业务开通申请")
@GetMapping(value = "/rollBackFlow")
public ResponseModel<JSONObject> overflow(@RequestParam("sequenceNbr") String sequenceNbr) {
public ResponseModel<Object> overflow(@RequestParam("sequenceNbr") String sequenceNbr) {
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.stopFlow(sequenceNbr));
}
......
......@@ -108,7 +108,7 @@ public class TaskModelServiceImpl {
model.setFlowCreateDate(new Date());
model.setTaskStatus(FlowStatusEnum.TO_BE_SUBMITTED.getCode());
model.setTaskTitle("有一条待提交的草稿");
model.setTaskName(BizTypeEnum.getNameByCode(obj.getTaskType()));
model.setTaskName(BizTypeEnum.getNameByNum(obj.getTaskType()));
model.setTaskTypeLabel(BizTypeEnum.getNameByCode(obj.getTaskType()));
// model.setTaskContent("【申请单号:"+obj.getTaskCode()+"】待提交");
}else {
......
[
[ {
"type":"supervise",
"pageType": "draft",
"url": "/mixuap?appId=1742358052905971713&id=1734576595978448898&roleIds={roleIds}&userId={userId}&pageType=edit"
}, {
"type":"firstinspect",
"pageType": "draft",
"url": "/mixuap?appId=1742358052905971713&id=1736728282272919554&roleIds={roleIds}&userId={userId}&pageType=edit"
}, {
"type":"detection",
"pageType": "draft",
"url": "/mixuap?appId=1742358052905971713&id=1736733779709423618&roleIds={roleIds}&userId={userId}&pageType=edit"
},
{
"type":"supervise",
"pageType": "look",
......@@ -24,15 +36,15 @@
"pageType": "edit",
"url": "/mixuap?appId=1742358052905971713&id=1736733779709423618&roleIds={roleIds}&userId={userId}&pageType=edit"
}, {
"type":"businessOpen",
"type":"114",
"pageType": "draft",
"url": "/mixuap?appId=1742358052905971713&id=1734569644833927170&roleIds={roleIds}&userId={userId}&pageType=edit"
"url": "/mixuap?appId=1742358052905971713&id=1737319295022559234&roleIds={roleIds}&userId={userId}&pageType=edit"
}, {
"type":"businessOpen",
"type":"114",
"pageType": "look",
"url": "/mixuap?appId=1742358052905971713&id=1735201757841092609&roleIds={roleIds}&userId={userId}&pageType=edit"
}, {
"type":"businessOpen",
"type":"114",
"pageType": "edit",
"url": "/mixuap?appId=1742358052905971713&id=1735201757841092609&roleIds={roleIds}&userId={userId}&pageType=edit"
}
......
......@@ -51,4 +51,6 @@ public interface IGenerateCodeService {
* @return 7位监管编码生成
*/
String createSupervisoryCode(String key);
String initCode();
}
......@@ -5,10 +5,7 @@ import com.yeejoin.amos.boot.module.ymt.api.service.IGenerateCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -66,4 +63,14 @@ public class GenerateCodeController extends BaseController {
public ResponseModel<String> createUseRegistrationCode(@RequestParam("key") String key) {
return ResponseHelper.buildResponse(generateCodeService.createUseRegistrationCode(key));
}
/**
* 初始化96333和监管码到Redis
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/init-code")
@ApiOperation(httpMethod = "GET", value = "初始化96333和监管码到Redis", notes = "初始化96333和监管码到Redis")
public ResponseModel<String> initCode() {
return ResponseHelper.buildResponse(generateCodeService.initCode());
}
}
......@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.ymt.biz.service.impl;
import com.yeejoin.amos.boot.module.ymt.api.common.DateUtils;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentCategoryEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.service.IGenerateCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
......@@ -33,12 +35,15 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
private static final String SEQUENCE_TYPE = "%07d";
private static final long LOCK_EXPIRATION_SECONDS = 60;
private final RedisTemplate<String, String> redisTemplate;
private final StringRedisTemplate stringRedisTemplate;
private final CategoryOtherInfoMapper categoryOtherInfoMapper;
private String rulePrefix = "";
public GenerateCodeServiceImpl(RedisTemplate<String, String> redisTemplate) {
public GenerateCodeServiceImpl(RedisTemplate<String, String> redisTemplate, StringRedisTemplate stringRedisTemplate, CategoryOtherInfoMapper categoryOtherInfoMapper) {
this.redisTemplate = redisTemplate;
this.stringRedisTemplate = stringRedisTemplate;
this.categoryOtherInfoMapper = categoryOtherInfoMapper;
}
/**
* 生成申请单编号(13位,GZ20231214000)
*
......@@ -93,6 +98,15 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
return (key.length() == 5) ? generateSupervisorySequence(key) : "生成码规则不对!";
}
@Override
public String initCode() {
categoryOtherInfoMapper.selectSupervisorCodeMaxValue().forEach(vo ->
stringRedisTemplate.opsForValue().set(vo.getName(), String.valueOf(vo.getValue())));
categoryOtherInfoMapper.selectElevatorCodeMaxValue().forEach(vo ->
stringRedisTemplate.opsForValue().set(vo.getName(), String.valueOf(vo.getValue())));
return "ok";
}
private String generateSupervisorySequence(String sequenceKey) {
// 使用分布式锁,确保在并发情况下只有一个线程能够生成顺序码
Boolean lockAcquired = obtainLock(GenerateCodeServiceImpl.LOCK_KEY_SUPERVISORY);
......@@ -102,7 +116,7 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
ValueOperations<String, String> valueOps = redisTemplate.opsForValue();
String currentSequenceStr = valueOps.get(sequenceKey);
// 如果为空,则初始化为0
Long currentSequence = (currentSequenceStr != null) ? Long.parseLong(currentSequenceStr) : 0L;
Long currentSequence = (currentSequenceStr != null) ? Long.parseLong(currentSequenceStr) : this.initRedis(sequenceKey);
log.info("===================>获取《{}》当前顺序码:{}<===================", sequenceKey, currentSequenceStr);
currentSequence++;
......@@ -121,6 +135,18 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
}
/**
* 监管码为空的话,初始化Redis
* @param sequenceKey key
* @return 顺序码
*/
private Long initRedis(String sequenceKey) {
categoryOtherInfoMapper.selectSupervisorCodeMaxValue().forEach(vo ->
stringRedisTemplate.opsForValue().set(vo.getName(), String.valueOf(vo.getValue())));
return Long.parseLong(Objects.requireNonNull(redisTemplate.opsForValue().get(sequenceKey)));
}
/**
* 校验枚举合法性
*
* @param value value
......
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