Commit 38ed946d authored by suhuiguang's avatar suhuiguang

1.增加并发控制所

parent 4ca58000
...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; ...@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
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.job.InspectionExpireRemindJob; import com.yeejoin.amos.boot.module.jyjc.biz.job.InspectionExpireRemindJob;
import com.yeejoin.amos.boot.module.jyjc.biz.service.TaskModelServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.TaskModelServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonserviceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
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;
...@@ -36,7 +36,7 @@ import java.util.stream.Collectors; ...@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
public class CommonController extends BaseController { public class CommonController extends BaseController {
@Autowired @Autowired
CommonserviceImpl commonserviceImpl; CommonServiceImpl commonserviceImpl;
@Autowired @Autowired
TaskModelServiceImpl taskModelService; TaskModelServiceImpl taskModelService;
......
...@@ -56,7 +56,7 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -56,7 +56,7 @@ public class JyjcInspectionApplicationController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "暂存、提交", notes = "新增")
public ResponseModel<List<JyjcInspectionApplicationModel>> save(@RequestBody JSONObject model) { public ResponseModel<List<JyjcInspectionApplicationModel>> save(@RequestBody JSONObject model) {
if (model.containsKey(basic)) { if (model.containsKey(basic)) {
JSONObject finallyJson = new JSONObject(); JSONObject finallyJson = new JSONObject();
...@@ -69,7 +69,7 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -69,7 +69,7 @@ public class JyjcInspectionApplicationController extends BaseController {
finallyJson.putAll(filePageDataObj); finallyJson.putAll(filePageDataObj);
model = finallyJson; model = finallyJson;
} }
// operationType: 1-暂存 // operationType: 1-暂存 0-提交
ReginParams selectedOrgInfo = getSelectedOrgInfo(); ReginParams selectedOrgInfo = getSelectedOrgInfo();
model.put("applicationUnitCode", selectedOrgInfo.getCompany().getCompanyCode()); model.put("applicationUnitCode", selectedOrgInfo.getCompany().getCompanyCode());
...@@ -124,67 +124,6 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -124,67 +124,6 @@ public class JyjcInspectionApplicationController extends BaseController {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.selectBySeq(sequenceNbr)); return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.selectBySeq(sequenceNbr));
} }
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/pageByInstitution")
@ApiOperation(httpMethod = "GET", value = "分页查询(检验机构)", notes = "分页查询(检验机构)")
public ResponseModel<Page<JyjcInspectionApplicationModel>> queryForPageByInstitution(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(required = false) String applicationNo,
@RequestParam(required = false) String inspectionClassify,
@RequestParam(required = false) String applicationUnitCode,
@RequestParam(required = false) String applicationUnitName,
@RequestParam(required = false) String inspectionUnitName,
@RequestParam(required = false) String equipClassify,
@RequestParam(required = false) String inspectionUnitCode,
@RequestParam(required = false) String applicationDate,
@RequestParam(required = false) String acceptDate,
@RequestParam(required = false) String inspectionChargePerson,
@RequestParam(required = false) String status,
@RequestParam(required = false) String roles, String bizType) {
Page<JyjcInspectionApplication> page = new Page<JyjcInspectionApplication>();
page.setCurrent(current);
page.setSize(size);
ReginParams reginParams = getSelectedOrgInfo();
inspectionUnitCode = reginParams.getCompany().getCompanyCode();
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryForJyjcInspectionApplicationPage(page, applicationNo, inspectionClassify, applicationUnitCode, equipClassify, inspectionUnitCode, applicationUnitName, inspectionUnitName, applicationDate, acceptDate, inspectionChargePerson, status, bizType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/pageByCompany")
@ApiOperation(httpMethod = "GET", value = "分页查询(报检单位)", notes = "分页查询(报检单位)")
public ResponseModel<Page<JyjcInspectionApplicationModel>> queryForPageByCompany(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(required = false) String applicationNo,
@RequestParam(required = false) String inspectionClassify,
@RequestParam(required = false) String applicationUnitCode,
@RequestParam(required = false) String equipClassify,
@RequestParam(required = false) String inspectionUnitCode,
@RequestParam(required = false) String applicationUnitName,
@RequestParam(required = false) String inspectionUnitName,
@RequestParam(required = false) String applicationDate,
@RequestParam(required = false) String acceptDate,
@RequestParam(required = false) String inspectionChargePerson,
@RequestParam(required = false) String roles,
@RequestParam(required = false) String status, String bizType) {
Page<JyjcInspectionApplication> page = new Page<JyjcInspectionApplication>();
page.setCurrent(current);
page.setSize(size);
ReginParams reginParams = getSelectedOrgInfo();
applicationUnitCode = reginParams.getCompany().getCompanyCode();
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.queryForJyjcInspectionApplicationPage(page, applicationNo, inspectionClassify, applicationUnitCode, equipClassify, inspectionUnitCode, applicationUnitName, inspectionUnitName, applicationDate, acceptDate, inspectionChargePerson, status, bizType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/pageList") @PostMapping(value = "/pageList")
...@@ -226,11 +165,7 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -226,11 +165,7 @@ public class JyjcInspectionApplicationController extends BaseController {
@PostMapping(value = "/flow/{type}/receive") @PostMapping(value = "/flow/{type}/receive")
public ResponseModel executeFlow(@PathVariable(value = "type") String type, @RequestBody Map<String, Object> params) { public ResponseModel executeFlow(@PathVariable(value = "type") String type, @RequestBody Map<String, Object> params) {
params.put("type", type); params.put("type", type);
try { jyjcInspectionApplicationServiceImpl.doReceive(params);
jyjcInspectionApplicationServiceImpl.doReceive(params);
} catch (Exception e) {
return CommonResponseUtil.failure("该项流程发生变化,请返回列表刷新查看状态后重试");
}
HashMap<String, String> result = new HashMap<>(); HashMap<String, String> result = new HashMap<>();
result.put("result", "success"); result.put("result", "success");
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
...@@ -264,12 +199,13 @@ public class JyjcInspectionApplicationController extends BaseController { ...@@ -264,12 +199,13 @@ public class JyjcInspectionApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "撤回", notes = "撤回") @ApiOperation(httpMethod = "GET", value = "撤回", notes = "撤回")
@GetMapping(value = "/flow/rollback") @GetMapping(value = "/flow/rollback")
public ResponseModel<Boolean> doRollbackFlow(@RequestParam("sequenceNbr") String sequenceNbr) { public ResponseModel<Boolean> doRollbackFlow(@RequestParam("sequenceNbr") String sequenceNbr,
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.doRollback(sequenceNbr)); @RequestParam("instanceId") String instanceId,
@RequestParam("nextTaskId") String nextTaskId) {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.doRollback(sequenceNbr, instanceId, nextTaskId));
} }
/** /**
* 查询指定设备种类的设备列表
* *
* @return * @return
*/ */
......
...@@ -48,7 +48,7 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -48,7 +48,7 @@ public class JyjcOpeningApplicationController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增、编辑的保存", notes = "新增、编辑的保存")
public ResponseModel<JyjcOpeningApplicationModel> save(@RequestBody JSONObject model) { public ResponseModel<JyjcOpeningApplicationModel> save(@RequestBody JSONObject model) {
JyjcOpeningApplicationModel jyjcOpeningApplicationModel = new JyjcOpeningApplicationModel(); JyjcOpeningApplicationModel jyjcOpeningApplicationModel = new JyjcOpeningApplicationModel();
// 兼容工作台暂存逻辑、编辑时报错逻辑 // 兼容工作台暂存逻辑、编辑时报错逻辑
...@@ -59,26 +59,13 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -59,26 +59,13 @@ public class JyjcOpeningApplicationController extends BaseController {
// 详情保存逻辑 // 详情保存逻辑
BeanUtil.copyProperties(model, jyjcOpeningApplicationModel); BeanUtil.copyProperties(model, jyjcOpeningApplicationModel);
} }
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.saveOrUpdateModel(jyjcOpeningApplicationModel, false)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.saveOrUpdate(jyjcOpeningApplicationModel));
} }
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "更新", notes = "更新")
public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.saveOrUpdateModel(model, false));
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/submit") @PutMapping(value = "/submit")
@ApiOperation(httpMethod = "PUT", value = "保存并提交", notes = "保存并提交") @ApiOperation(httpMethod = "PUT", value = "保存并提交、提交", notes = "保存并提交")
public ResponseModel<List<JyjcOpeningApplicationModel>> updateBySequenceNbrAndStartFlow(@RequestBody JSONObject jsonObject, @RequestParam(value = "sequenceNbr", required = false) Long sequenceNbr) { public ResponseModel<List<JyjcOpeningApplicationModel>> updateBySequenceNbrAndStartFlow(@RequestBody JSONObject jsonObject, @RequestParam(value = "sequenceNbr", required = false) Long sequenceNbr) {
JyjcOpeningApplicationModel model = new JyjcOpeningApplicationModel(); JyjcOpeningApplicationModel model = new JyjcOpeningApplicationModel();
if (jsonObject.containsKey("applyInfo")) { if (jsonObject.containsKey("applyInfo")) {
...@@ -93,18 +80,10 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -93,18 +80,10 @@ public class JyjcOpeningApplicationController extends BaseController {
throw new BadRequest("企业资质信息和检验人员信息为空,无法提交!"); throw new BadRequest("企业资质信息和检验人员信息为空,无法提交!");
} }
} }
JyjcOpeningApplicationModel data = jyjcOpeningApplicationServiceImpl.saveOrUpdateModel(model, true); JyjcOpeningApplicationModel data = jyjcOpeningApplicationServiceImpl.submitApplication(model);
return ResponseHelper.buildResponse(Collections.singletonList(data)); return ResponseHelper.buildResponse(Collections.singletonList(data));
} }
@Deprecated
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/startFlow/{sequenceNbr}")
@ApiOperation(httpMethod = "POST", value = "重新提交开通申请", notes = "重新提交开通申请")
public ResponseModel<JyjcOpeningApplicationModel> resubmitJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.resubmit(model));
}
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
...@@ -200,8 +179,10 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -200,8 +179,10 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "撤回业务开通申请", notes = "撤回业务开通申请") @ApiOperation(httpMethod = "GET", value = "撤回业务开通申请", notes = "撤回业务开通申请")
@GetMapping(value = "/rollBackFlow") @GetMapping(value = "/rollBackFlow")
public ResponseModel<Object> overflow(@RequestParam("sequenceNbr") String sequenceNbr) { public ResponseModel<Object> overflow(@RequestParam("sequenceNbr") String sequenceNbr,
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.stopFlow(sequenceNbr)); @RequestParam("instanceId") String instanceId,
@RequestParam("nextTaskId") String nextTaskId) {
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.stopFlow(sequenceNbr, instanceId, nextTaskId));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Sequence; ...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Sequence;
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.biz.event.InspectionDetectionSaveToDbEvent; import com.yeejoin.amos.boot.module.jyjc.biz.event.InspectionDetectionSaveToDbEvent;
import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher; import com.yeejoin.amos.boot.module.jyjc.biz.event.publisher.BizEmqPublisher;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonserviceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper;
...@@ -37,7 +37,7 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList ...@@ -37,7 +37,7 @@ public class InspectionDetectionSaveToDbEventListener implements ApplicationList
private int threadNumber; private int threadNumber;
@Autowired @Autowired
CommonserviceImpl commonService; CommonServiceImpl commonService;
@Autowired @Autowired
private Sequence sequence; private Sequence sequence;
......
package com.yeejoin.amos.boot.module.jyjc.biz.runner;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicationServiceImpl;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcOpeningApplicationServiceImpl;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
/**
* @author Administrator
*/
@Component
public class ApplicationRunnerImpl implements ApplicationRunner {
private JyjcInspectionApplicationServiceImpl inspectionApplicationService;
private JyjcOpeningApplicationServiceImpl openingApplicationService;
public ApplicationRunnerImpl(JyjcInspectionApplicationServiceImpl inspectionApplicationService,
JyjcOpeningApplicationServiceImpl openingApplicationService) {
this.inspectionApplicationService = inspectionApplicationService;
this.openingApplicationService = openingApplicationService;
}
@Override
public void run(ApplicationArguments args) {
inspectionApplicationService.initFlowData2Redis();
openingApplicationService.initFlowData2Redis();
}
}
...@@ -25,8 +25,11 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -25,8 +25,11 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.List; import java.util.List;
/**
* @author Administrator
*/
@Service @Service
public class CommonserviceImpl { public class CommonServiceImpl {
@Value("${jyjc.user-post:6615}") @Value("${jyjc.user-post:6615}")
private String jyjcUserPost; private String jyjcUserPost;
...@@ -138,14 +141,18 @@ public class CommonserviceImpl { ...@@ -138,14 +141,18 @@ public class CommonserviceImpl {
} }
private InstanceRuntimeData getInstanceRuntimeData(String instanceId) { private InstanceRuntimeData getInstanceRuntimeData(String instanceId) {
RBucket<InstanceRuntimeData> rBucket = redissonClient.getBucket(buildJgInstanceDataKey(instanceId)); RBucket<InstanceRuntimeData> rBucket = redissonClient.getBucket(buildJcInstanceDataKey(instanceId));
return rBucket.get(); return rBucket.get();
} }
private static String buildJgInstanceDataKey(String instanceId) { private String buildJcInstanceDataKey(String instanceId) {
return "JC_INSTANCE_DATA:" + instanceId; return "JC_INSTANCE_DATA:" + instanceId;
} }
public static String buildJcExecuteLockKey(String instanceId) {
return "JC_INSTANCE_LOCK:" + instanceId;
}
/** /**
* 最新流程数据缓存 * 最新流程数据缓存
...@@ -154,7 +161,7 @@ public class CommonserviceImpl { ...@@ -154,7 +161,7 @@ public class CommonserviceImpl {
* @param instanceData 流程数据 * @param instanceData 流程数据
*/ */
public void saveExecuteFlowData2Redis(String instanceId, InstanceRuntimeData instanceData) { public void saveExecuteFlowData2Redis(String instanceId, InstanceRuntimeData instanceData) {
redissonClient.getBucket(buildJgInstanceDataKey(instanceId)).set(instanceData); redissonClient.getBucket(buildJcInstanceDataKey(instanceId)).set(instanceData);
} }
......
...@@ -101,7 +101,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -101,7 +101,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper; TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired @Autowired
CommonserviceImpl commonService; CommonServiceImpl commonService;
@Autowired @Autowired
TzsUserInfoMapper tzsUserInfoMapper; TzsUserInfoMapper tzsUserInfoMapper;
......
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