Commit 098bb25c authored by suhuiguang's avatar suhuiguang

feat(jyjc):检验检测业务管理

1.按照要求进行调整
parent e0bbb0a3
......@@ -100,11 +100,19 @@ public class JyjcBizManageController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{appSeq}/detectionRegion")
@ApiOperation(httpMethod = "PUT", value = "开通区域维护-省局使用", notes = "开通区域维护-省局使用")
public ResponseModel<Boolean> detectionRegionEdit(@PathVariable String appSeq,
@RequestParam String newDetectionRegion) {
return ResponseHelper.buildResponse(jyjcBizManageService.detectionRegionEdit(appSeq, newDetectionRegion));
@GetMapping(value = "/region/{appSeq}/detail")
@ApiOperation(httpMethod = "GET", value = "启用停用区域详情-省局使用", notes = "启用停用区域详情-省局使用")
public ResponseModel<Map<String, Object>> regionDetail(@PathVariable String appSeq) {
return ResponseHelper.buildResponse(jyjcBizManageService.regionDetail(appSeq));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/region/{appSeq}/status")
@ApiOperation(httpMethod = "PUT", value = "启用停用区域维护-省局使用", notes = "启用停用区域维护-省局使用")
@RestEventTrigger(value = "operateLogRestEventHandler")
public ResponseModel<Boolean> regionStatusEdit(@PathVariable String appSeq,
@RequestBody Map<String, Object> data) {
return ResponseHelper.buildResponse(jyjcBizManageService.regionStatusEdit(appSeq, data));
}
......
......@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.enums.LicenceStateEnum;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseCertDto;
......@@ -58,6 +59,8 @@ public class JyjcBizManageServiceImpl {
private final DataDictionaryServiceImpl dictionaryService;
private static final String REGION_LIST_KEY = "regions";
public IPage<?> pageList(Page<JyjcBizManageModel> page, CompanyBo company, JyjcOpeningApplicationModel model) {
Page<JyjcOpeningApplication> pageApp = new Page<>(page.getCurrent(), page.getSize());
......@@ -311,4 +314,49 @@ public class JyjcBizManageServiceImpl {
return map;
}).collect(Collectors.toList());
}
public Map<String, Object> regionDetail(String appSeq) {
Map<String, Object> res = new HashMap<>();
JyjcOpeningApplication openingApplication = openingApplicationService.getById(appSeq);
Map<String, String> detectionRegionCodeNameMap = getDetectionRegionCodeNameMap();
List<Map<String, Object>> regions = openingApplication.getDetectionRegion().stream().map(r -> {
Map<String, Object> map = new HashMap<>();
map.put("regionCode", r);
map.put("regionName", detectionRegionCodeNameMap.getOrDefault(r, ""));
map.put("status", Optional.ofNullable(openingApplication.getExclusionRegion()).orElse(new ArrayList<>()).contains(r) ? String.valueOf(LicenceStateEnum.disabled.getValue()) : String.valueOf(LicenceStateEnum.enabled.getValue()));
return map;
}).collect(Collectors.toList());
res.put(REGION_LIST_KEY, regions);
return res;
}
public Boolean regionStatusEdit(String appSeq, Map<String, Object> data) {
log.info("省局企业区域调整权限, appSeq: {}, data: {}", appSeq, data);
String lockKey = "app:region:lock:" + appSeq;
RLock lock = redissonClient.getLock(lockKey);
try {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
// 解决并发问题:解决并发问题:多个人同时操作一个单据
if (!isLocked) {
throw new BadRequest("其他机构同时在操作该业务,请稍后重试!");
}
JyjcOpeningApplication openingApplication = openingApplicationService.getById(appSeq);
List<JSONObject> regions = JSONObject.parseArray(JSONObject.toJSONString(data.get(REGION_LIST_KEY)), JSONObject.class);
Set<String> exclusionRegion = new HashSet<>();
regions.forEach(r -> {
if (LicenceStateEnum.disabled.getValue() == r.getInteger("status")) {
exclusionRegion.add(r.getString("regionCode"));
}
});
openingApplication.setExclusionRegion(new ArrayList<>(exclusionRegion));
openingApplicationService.saveOrUpdate(openingApplication);
} catch (InterruptedException e) {
log.error("禁用企业区域失败:{}", e.getMessage(), e);
} finally {
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
return Boolean.TRUE;
}
}
......@@ -50,7 +50,7 @@
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="INFO">
<root level="ERROR">
<!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" />
<!-- <appender-ref ref="ELK" />-->
......
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