Commit 54ea673d authored by tianbo's avatar tianbo

Merge branch 'develop_tzs_bugfix' into develop_tzs_register

parents c9e2db69 b74a5ca5
......@@ -113,6 +113,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
if (result.get("data") instanceof JSONObject) {
JSONObject dataObj = (JSONObject) result.get("data");
String cameraUrl = dataObj.getString("url");
video.setType(param.getString("protocol"));
video.setUrl(cameraUrl);
video.setType(param.getString("protocol"));
}
......
......@@ -10,14 +10,16 @@ import java.util.Map;
@Getter
@AllArgsConstructor
public enum EquipSourceEnum {
jg_his("历史设备", "jg_his"),
jg_his_black("历史设备(无登记证)", "jg_his_black"),
jg("新设备", "jg");
jg_his("历史设备", "jg_his", "his"),
jg_his_black("历史设备(无登记证)", "jg_his_black", "black"),
jg("新设备", "jg", "new");
private final String name;
private final String code;
private final String type;
public static String getMessage(String code) {
for (EquipSourceEnum constants : values()) {
......@@ -30,6 +32,7 @@ public enum EquipSourceEnum {
public static Map<Integer,String> getName=new HashMap<>();
public static Map<String,Integer> getCode=new HashMap<>();
public static Map<String,Integer> getType=new HashMap<>();
static {
for (ConstructionEnum e : ConstructionEnum.values()){
......@@ -39,14 +42,6 @@ public enum EquipSourceEnum {
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
public static String getDataSourceName(String dataSource) {
if(StringUtils.isEmpty(dataSource)){
return EquipSourceEnum.jg_his.getName();
......
......@@ -2334,7 +2334,7 @@
WHERE tjvi."USE_UNIT_CREDIT_CODE" = #{useCode}
AND tjvi.is_delete = '0'
</select>
<select id="countEquipInUseTimesWithOutZF" resultType="java.lang.Integer">
<select id="countEquipInUseTimesWithOutZF" resultType="java.lang.Integer" flushCache="true">
select
sum(inUseNumber)
from (
......
......@@ -364,8 +364,8 @@ public class CommonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询监管业务名称列表", notes = "查询监管业务名称列表")
@GetMapping(value = "/superviseBusinessCategory")
public ResponseModel<Object> equipTree(@RequestParam(value = "businessType") String businessType) {
return ResponseHelper.buildResponse(commonService.superviseBusinessCategory(businessType));
public ResponseModel<Object> equipTree(@RequestParam(value = "businessType") String businessType, String dataSource) {
return ResponseHelper.buildResponse(commonService.superviseBusinessCategory(businessType, dataSource));
}
/**
......
......@@ -53,12 +53,17 @@ public class CancellationEventListener {
@PostConstruct
public void init() {
ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);
ExecutorService executorService = Executors.newFixedThreadPool(threadNumber, r -> {
Thread t = new Thread(r);
t.setName("CancellationWorker-" + t.getId());
return t;
});
for (int i = 0; i < threadNumber; i++) {
executorService.execute(() -> {
while (true) {
try {
String record = queue.take();
log.info("线程 {} 开始处理 record: {}", Thread.currentThread().getName(), record);
this.dealData(record);
} catch (Exception e) {
log.error(e.getMessage(), e);
......@@ -70,6 +75,7 @@ public class CancellationEventListener {
}
private void dealData(String record) {
log.info("开始检查设备的引用:{}", record);
// 所有业务单据(除去作废、删除状态单据),有在引用设备的则不修改设备纳管状态
Boolean inUsed = commonService.checkEquipIsUsed(record);
// 无引用则进行修改纳管状态为未纳管
......
......@@ -64,7 +64,7 @@ public interface ICommonService {
List<LinkedHashMap> creatApproveTree();
List<Map<String, Object>> superviseBusinessCategory(String businessType);
List<Map<String, Object>> superviseBusinessCategory(String businessType, String dataSource);
List<Map<String, Object>> businessScenarios(String type);
......
......@@ -85,6 +85,7 @@ import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
......@@ -732,7 +733,7 @@ public class CommonServiceImpl implements ICommonService {
}
@Override
public List<Map<String, Object>> superviseBusinessCategory(String businessType) {
public List<Map<String, Object>> superviseBusinessCategory(String businessType, String dataSource) {
ReginParams reginParams = getSelectedOrgInfo();
Map<String, List<Map<String, Object>>> resourceJson = JsonUtils.getResourceJson(superviseBusinessCategory);
if (XZSB.equals(businessType) && CompanyTypeEnum.CONSTRUCTION.getName().equals(reginParams.getCompany().getCompanyType())) {
......@@ -745,6 +746,11 @@ public class CommonServiceImpl implements ICommonService {
}
return resourceJson.get(businessType);
}
// 历史有证设备(气瓶、管道)只能通过导入进系统,不能按单位录入进系统
if (EquipSourceEnum.jg_his.getType().equals(dataSource)) {
resourceJson.get(businessType).removeIf(item -> item.get(CODE).equals(DW_LR));
return resourceJson.get(businessType);
}
return resourceJson.get(businessType);
}
......@@ -2152,6 +2158,7 @@ public class CommonServiceImpl implements ICommonService {
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Boolean checkEquipIsUsed(String record) {
Integer useTime = commonMapper.countEquipInUseTimesWithOutZF(record);
log.info("检查设备是否被使用,设备:{},业务数:{}", record, useTime);
......
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