Commit e8b7dc41 authored by 麻笑宇's avatar 麻笑宇

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 8cbc699a e7299805
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgEquipTransferDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEquipTransfer;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -23,4 +25,6 @@ public interface JgEquipTransferMapper extends CustomBaseMapper<JgEquipTransfer>
@MapKey("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(Long sequenceNbr);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgMaintenanceContractDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
......@@ -30,4 +31,6 @@ public interface JgMaintenanceContractMapper extends BaseMapper<JgMaintenanceCon
void updatePromoter(@Param("id") Long id);
List<Map<String, Object>> selectEquipList(@Param("id") Long id);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
......@@ -33,7 +33,7 @@ public interface IJgChangeRegistrationUnitService {
* @param noticeDto 安装告知
* @param op 操作类型
*/
JgChangeRegistrationUnitDto updateInstallationNotice(String submitType, JgChangeRegistrationUnitDto noticeDto, String op);
JgChangeRegistrationUnitDto updateInstallationNotice(String submitType, JgChangeRegistrationUnitDto noticeDto, String op, ReginParams reginParams);
/**
* 分页查询
......
......@@ -210,4 +210,14 @@
jet.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from tzs_jg_equip_transfer a,
tzs_jg_equip_transfer_eq b
where a.sequence_nbr = b.equip_transfer_id
and a.apply_status = '6612'
GROUP BY a.use_unit_credit_code
</select>
</mapper>
......@@ -155,4 +155,14 @@
left JOIN idx_biz_jg_register_info jri on mc.equ_id = jri.RECORD
WHERE mc.equip_transfer_id = #{id}
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_code as companyCode,
group_concat(b.equ_id) as records
from tzs_jg_maintenance_contract a,
tzs_jg_maintenance_contract_eq b
where a.sequence_nbr = b.equip_transfer_id
and a.status in ('监管单位待受理','维保单位待受理')
GROUP BY a.use_unit_code
</select>
</mapper>
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.common.BaseException;
import com.yeejoin.amos.boot.module.jg.api.dto.JgEquipTransferDto;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEquipTransferServiceImpl;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.*;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEquipTransferServiceImpl;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgEquipTransferDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 设备移交
......@@ -54,9 +53,9 @@ public class JgEquipTransferController extends BaseController {
@PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新设备移交", notes = "根据sequenceNbr更新设备移交")
public ResponseModel<Object> updateBySequenceNbr(@RequestParam("submitType") String submitType,
@RequestBody JgEquipTransferDto equipTransferDto,
@RequestParam(value = "op", required = false) String op) {
return ResponseHelper.buildResponse(jgEquipTransferServiceImpl.updateEquipTransfer(submitType, equipTransferDto, op));
@RequestBody JgEquipTransferDto equipTransferDto,
@RequestParam(value = "op", required = false) String op) {
return ResponseHelper.buildResponse(jgEquipTransferServiceImpl.updateEquipTransfer(submitType, equipTransferDto, op, getSelectedOrgInfo()));
}
/**
......@@ -112,10 +111,10 @@ public class JgEquipTransferController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "设备移交分页查询", notes = "设备移交分页查询")
public ResponseModel<Page<JgEquipTransferDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "sort",required = false) String sort,
@RequestParam(value = "sort", required = false) String sort,
@RequestBody(required = false) JgEquipTransferDto dto) {
Page<JgEquipTransferDto> page = new Page<>(current, size);
return ResponseHelper.buildResponse(jgEquipTransferServiceImpl.queryForJgEquipTransferPage(page,sort, dto, getSelectedOrgInfo()));
return ResponseHelper.buildResponse(jgEquipTransferServiceImpl.queryForJgEquipTransferPage(page, sort, dto, getSelectedOrgInfo()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -13,8 +13,6 @@ import com.yeejoin.amos.boot.module.jg.api.vo.JgMaintenanceContractVo;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgMaintenanceContractServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
......@@ -23,6 +21,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
/**
......@@ -176,8 +175,8 @@ public class JgMaintenanceContractController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/cancelApplication")
@ApiOperation(httpMethod = "POST", value = "维保备案作废", notes = "维保备案作废")
public ResponseModel<JgMaintenanceContract> cancelApplication(@RequestBody JgMaintenanceContractDto dto){
JgMaintenanceContract result = jgMaintenanceContractServiceImpl.cancelApplication(dto.getSequenceNbr(),dto.getCancelReason());
public ResponseModel<JgMaintenanceContract> cancelApplication(@RequestBody JgMaintenanceContractDto dto) {
JgMaintenanceContract result = jgMaintenanceContractServiceImpl.cancelApplication(dto.getSequenceNbr(), dto.getCancelReason());
return ResponseHelper.buildResponse(result);
}
}
......@@ -44,7 +44,7 @@ public class ChangeUnitEquipUsedCheckImpl extends BaseEquipUsedCheckService {
@Override
public void init() {
// 初始化已经完成或者在流程中安装告知的设备数据
// 初始化在流程中设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = changeRegistrationUnitMapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgEquipTransferMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class EquipTransferEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "equipmentHandover";
private JgEquipTransferMapper equipTransferMapper;
public EquipTransferEquipUsedCheckImpl(RedissonClient redissonClient, JgEquipTransferMapper equipTransferMapper) {
this.redissonClient = redissonClient;
this.equipTransferMapper = equipTransferMapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化在流程中的设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = equipTransferMapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
......@@ -738,12 +738,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap.put("FULLADDRESS", fullAddress);
}
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
useInfoMap.put("USE_PLACE", useInfo.getUsePlace());
if (!ValidationUtil.isEmpty(useInfo.getLongitudeLatitude())) {
useInfoMap.put("LONGITUDE_LATITUDE", JSON.parseObject(useInfo.getLongitudeLatitude()));
useInfoMap.put("USE_LONGITUDE_LATITUDE", JSON.parseObject(useInfo.getLongitudeLatitude()));
}
if (!ValidationUtil.isEmpty(useInfo.getAddress())) {
useInfoMap.put("USE_ADDRESS", useInfo.getAddress());
useInfoMap.put("FULL_ADDRESS", useInfo.getAddress());
}
}
if (!useInfoMap.isEmpty()) {
......@@ -2041,7 +2043,18 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String dataSource = OPERATESAVE.equals(operateType) ? ("new".equals(equipSource) ? "jg" : "jg_his") : equipmentInfoForm.get("DATA_SOURCE").toString();
if (isCopy) {
String sourceRecord = equipmentClassForm.get(RECORD).toString();
dataSource = "new".equals(equipSource) ? ("jg_" + sourceRecord) : ("jg_his_" + sourceRecord);
// dataSource = "new".equals(equipSource) ? ("jg_" + sourceRecord) : ("jg_his_" + sourceRecord);
// bug-21203
if (equipmentInfoForm.containsKey("DATA_SOURCE")){
String dataSourceCopy = equipmentInfoForm.get("DATA_SOURCE").toString();
if (dataSourceCopy.startsWith("jg_his")){
dataSource = "jg_his_" + sourceRecord;
}else {
dataSource = "jg_" + sourceRecord;
}
}else {
throw new BadRequest("数据异常,请联系管理员");
}
}
record = OPERATESAVE.equals(operateType) ? UUID.randomUUID().toString() : equipmentInfoForm.get(RECORD).toString();
......
......@@ -115,6 +115,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired
JgUseRegistrationMapper jgUseRegistrationMapper;
@Autowired
IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired
IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
IdxBizJgRegisterInfoMapper tzsJgRegistrationInfoMapper;
......@@ -1394,6 +1396,28 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
this.updateById(installationNotice);
// 2.更新关联的业务
this.processElseDataByStatus(Objects.requireNonNull(FlowStatusEnum.getEumByCode(Integer.parseInt(oldNoticeStatus))), installationNotice);
// 3.更新ES、IdxBizJgUseInfo中关联设备为未纳管
Map<String, Map<String, Object>> objMap = new HashMap<>();
LambdaQueryWrapper<JgInstallationNoticeEq> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr());
List<JgInstallationNoticeEq> jgInstallationNoticeEqs = jgInstallationNoticeEqMapper.selectList(lambdaQueryWrapper);
if (!ObjectUtils.isEmpty(jgInstallationNoticeEqs) && jgInstallationNoticeEqs.size() > 0) {
for (JgInstallationNoticeEq jgInstallationNoticeEq : jgInstallationNoticeEqs) {
// 组装修改es条件及数据
Map<String, Object> map = new HashMap<>();
map.put("IS_INTO_MANAGEMENT", Boolean.FALSE);
objMap.put(jgInstallationNoticeEq.getEquId(), map);
}
}
// 组装更新IdxBizJgUseInfo条件
LambdaQueryWrapper<IdxBizJgUseInfo> jgUseInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
jgUseInfoLambdaQueryWrapper.in(IdxBizJgUseInfo::getRecord, jgInstallationNoticeEqs.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toList()));
List<IdxBizJgUseInfo> list = idxBizJgUseInfoMapper.selectList(jgUseInfoLambdaQueryWrapper);
for (IdxBizJgUseInfo useInfo : list) {
useInfo.setIsIntoManagement(Boolean.FALSE);
}
idxBizJgUseInfoService.saveOrUpdateBatch(list);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
return installationNotice;
}
......
......@@ -25,6 +25,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgMaintenanceContractService;
import com.yeejoin.amos.boot.module.jg.api.vo.JgMaintenanceContractVo;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
......@@ -72,6 +73,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
public static final String SUBMIT_DATA = "0";
public static final String SUBMIT_TYPE_FLOW = "1";
public static final String WB_PROCESS_DEFINITION_KEY = "maintenanceFiling";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "维保单位已驳回", "使用单位已撤回", "已作废", "已完成");
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
......@@ -211,6 +213,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
ProcessTaskDTO complete = workflowService.completeOrReject(taskId, dto, operate);
// 更新下一步执行人、创建待办
updateExecuteIds(instanceId, id, operate, complete);
this.delRepeatUseEquipData(contract.getSequenceNbr(), contract.getStatus(), contract.getUseUnitCode());
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -220,6 +223,22 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
}
}
/**
* 删除 redis校验重复引用设备的数据
*/
private void delRepeatUseEquipData(Long id, String status, String companyCode) {
List<JgMaintenanceContractEq> list = jgMaintenanceContractEqService.lambdaQuery().eq(JgMaintenanceContractEq::getEquipTransferId, id).list();
// 获取单位变更设备列表
if (CollectionUtils.isEmpty(list)) {
return;
}
List<String> records = list.stream().map(JgMaintenanceContractEq::getEquId).collect(Collectors.toList());
if (NOT_FLOWING_STATE.contains(status)) {
EquipUsedCheckStrategyContext.getUsedStrategy(WB_PROCESS_DEFINITION_KEY)
.delDataForCheckEquipRepeatUsed(records, companyCode);
}
}
public InstanceRuntimeData buildInstanceRuntimeData(JgMaintenanceContract jgMaintenanceContract) {
return InstanceRuntimeData.builder()
.nextExecuteUserIds(jgMaintenanceContract.getNextExecuteUserIds())
......@@ -256,7 +275,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
list.forEach(seq -> {
JgMaintenanceContract jgMaintenanceContract = this.baseMapper.selectById(seq);
// 删除待办 及 中止流程
commonService.deleteTaskModel(String.valueOf(jgMaintenanceContract.getSequenceNbr()),jgMaintenanceContract.getInstanceId());
commonService.deleteTaskModel(String.valueOf(jgMaintenanceContract.getSequenceNbr()), jgMaintenanceContract.getInstanceId());
// 删除业务单
this.baseMapper.deleteById(seq);
// 删除对应eq
......@@ -370,6 +389,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
// redis流程实时数据更新
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(contract));
this.delRepeatUseEquipData(contract.getSequenceNbr(), contract.getStatus(), contract.getUseUnitCode());
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -441,9 +461,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
jgMaintenanceContractEqService.getBaseMapper().delete(lambda);
}
// 更新关联设备信息
List<JgMaintenanceContractEq> equipList = new ArrayList<>();
if (!CollectionUtils.isEmpty(equipmentLists)) {
contract.setEquNum(equipmentLists.size());
List<JgMaintenanceContractEq> equipList = new ArrayList<>();
equipmentLists.forEach(x -> {
JgMaintenanceContractEq equip = new JgMaintenanceContractEq();
equip.setEquId(String.valueOf(x.get("SEQUENCE_NBR")));
......@@ -546,6 +566,11 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
updateById(contract);
// 设备数据存历史数据,在流程完成时使用
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getName(), JSON.parseArray(JSON.toJSONString(equipmentLists)), null, contract.getSequenceNbr().toString());
if (SUBMIT_TYPE_FLOW.equals(submit)) {//放在最后面防止前面有异常
//如果是提交,用于校验设备是否已经在流程中,如果不在标记设备已经在流程中
equipList.forEach(equip -> EquipUsedCheckStrategyContext.getUsedStrategy(WB_PROCESS_DEFINITION_KEY)
.equipRepeatUsedCheck(String.valueOf(equip.getEquId()), reginParams.getCompany().getCompanyCode()));
}
return Collections.singletonList(contract);
}
......@@ -784,37 +809,39 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
return null;
}
private void processElseDataByStatus(FlowStatusEnum oldNoticeStatus, JgMaintenanceContract maintenanceContract) {
private void processElseDataByStatus(FlowStatusEnum oldNoticeStatus, JgMaintenanceContract contract) {
switch (oldNoticeStatus) {
case TO_BE_SUBMITTED:
// 1.写入历史表
this.saveHisDataBeforeUpdate(maintenanceContract);
this.saveHisDataBeforeUpdate(contract);
// 2.删除暂存时生成的待办
commonService.deleteTasksAndStopProcess(maintenanceContract.getInstanceId(),"监管单位主动作废");
commonService.deleteTasksAndStopProcess(contract.getInstanceId(), "监管单位主动作废");
break;
case TO_BE_FINISHED:
// 1.回退表单
updateIdxBizJgRegisterInfo(maintenanceContract);
updateIdxBizJgRegisterInfo(contract);
break;
default:
// 流程中(驳回、撤回等)
// 1.待办任务更新为已完成
this.finishedTask(maintenanceContract);
this.finishedTask(contract);
// 2.终止流程-工作流报错暂时注释掉
iCmWorkflowService.stopProcess(maintenanceContract.getInstanceId(), maintenanceContract.getCancelReason());
iCmWorkflowService.stopProcess(contract.getInstanceId(), contract.getCancelReason());
// 3.写入历史表
this.saveHisDataBeforeUpdate(maintenanceContract);
this.saveHisDataBeforeUpdate(contract);
// 4、释放流程中设备
this.delRepeatUseEquipData(contract.getSequenceNbr(), contract.getStatus(), contract.getUseUnitCode());
}
}
private void updateIdxBizJgRegisterInfo(JgMaintenanceContract maintenanceContract) {
LambdaQueryWrapper<JgMaintenanceContractEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgMaintenanceContractEq::getEquipTransferId, maintenanceContract.getSequenceNbr());
List<JgMaintenanceContractEq> equipmentLists = maintenanceContractEqMapper.selectList(queryWrapper);
if(!CollectionUtils.isEmpty(equipmentLists)){
List<String> list = equipmentLists.stream().filter(t->t.getEquId() != null).map(JgMaintenanceContractEq::getEquId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(equipmentLists)) {
List<String> list = equipmentLists.stream().filter(t -> t.getEquId() != null).map(JgMaintenanceContractEq::getEquId).collect(Collectors.toList());
maintenanceContractEqMapper.updateIdxBizJgRegisterInfo(list);
}
}
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
......@@ -33,6 +34,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.common.StringUtil;
......@@ -113,6 +115,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
@Autowired
IdxBizJgDesignInfoMapper idxBizJgDesignInfoMapper;
@Autowired
IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService;
@Autowired
TzsUserInfoMapper userInfoMapper;
@Autowired
ICommonService commonService;
......@@ -152,6 +158,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
private IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
@Autowired
private IdxBizJgFactoryInfoMapper idxBizJgFactoryInfoMapper;
@Autowired
IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
@Autowired
private IdxBizJgMaintenanceRecordInfoServiceImpl idxBizJgMaintenanceRecordInfoService;
@Autowired
private RedissonClient redissonClient;
......@@ -2671,14 +2681,50 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
registerInfo.setUseOrgCode(jgUseRegistration.getUseRegistrationCode());
String equCode = this.getEquCode(registerInfo, jgUseRegistration.getReceiveCompanyCode());
registerInfo.setEquCodeType(String.valueOf(map.get("equCodeType")));
String equCode = ObjectUtils.isEmpty(map.get("equCode")) ? this.getEquCode(registerInfo, jgUseRegistration.getReceiveCompanyCode()) : String.valueOf(map.get("equCode"));
registerInfo.setEquCode(equCode);// 设备代码
registerInfo.setEquPrice(String.valueOf(map.get("equPrice")));
registerInfo.setProductPhoto(JSONObject.toJSONString(map.get("productPhoto")));
registerInfo.setOtherAccessoriesReg(JSONObject.toJSONString(map.get("otherAccessoriesReg")));
idxBizJgRegisterInfoMapper.updateById(registerInfo);
// 查询设备制造信息
// 设计信息
LambdaQueryWrapper<IdxBizJgDesignInfo> lambdaDes = new QueryWrapper<IdxBizJgDesignInfo>().lambda();
lambdaDes.eq(IdxBizJgDesignInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgDesignInfo designInfo = idxBizJgDesignInfoService.getOne(lambdaDes);
designInfo.setDesignUnitCreditCode(String.valueOf(map.get("designUnitCreditCode")));
designInfo.setDesignUnitName(String.valueOf(map.get("designUnitName")));
designInfo.setDesignLicenseNum(String.valueOf(map.get("designLicenseNum")));
designInfo.setDesignUseDate(String.valueOf(map.get("designUseDate")));
designInfo.setDesignDate(DateUtil.parse(String.valueOf(map.get("designDate")), "yyyy-MM-dd"));
designInfo.setDrawingDo(String.valueOf(map.get("drawingDo")));
designInfo.setAppraisalUnit(String.valueOf(map.get("appraisalUnit")));
designInfo.setAppraisalDate(String.valueOf(map.get("appraisalDate")));
designInfo.setDesignDoc(JSONObject.toJSONString(map.get("designDoc")));
designInfo.setDesignStandard(JSONObject.toJSONString(map.get("designStandard")));
designInfo.setOtherAccessoriesDes(JSONObject.toJSONString(map.get("otherAccessoriesDes")));
idxBizJgDesignInfoMapper.updateById(designInfo);
// 制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.eq(IdxBizJgFactoryInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgFactoryInfo idxBizJgFactoryInfo = idxBizJgFactoryInfoService.getOne(factoryInfoWrapper);
idxBizJgFactoryInfo.setProduceUnitCreditCode(String.valueOf(map.get("produceUnitCreditCode")));
idxBizJgFactoryInfo.setProduceUnitName(String.valueOf(map.get("produceUnitName")));
idxBizJgFactoryInfo.setFactoryNum(String.valueOf(map.get("factoryNum")));
idxBizJgFactoryInfo.setProduceLicenseNum(String.valueOf(map.get("produceLicenseNum")));
idxBizJgFactoryInfo.setProduceDate(DateUtil.parse(String.valueOf(map.get("produceDate")), "yyyy-MM-dd"));
idxBizJgFactoryInfo.setImported(String.valueOf(map.get("imported")));
idxBizJgFactoryInfo.setProduceCountry(String.valueOf(map.get("produceCountry")));
idxBizJgFactoryInfo.setOtherAccessoriesFact(JSONObject.toJSONString(map.get("otherAccessoriesFact")));
idxBizJgFactoryInfo.setProductQualityYieldProve(JSONObject.toJSONString(map.get("productQualityYieldProve")));
idxBizJgFactoryInfo.setInsUseMaintainExplain(JSONObject.toJSONString(map.get("insUseMaintainExplain")));
idxBizJgFactoryInfo.setFactoryStandard(JSONObject.toJSONString(map.get("factoryStandard")));
idxBizJgFactoryInfo.setFactSupervisionInspectionReport(JSONObject.toJSONString(map.get("factSupervisionInspectionReport")));
idxBizJgFactoryInfo.setBoilerEnergyEfficiencyCertificate(JSONObject.toJSONString(map.get("boilerEnergyEfficiencyCertificate")));
idxBizJgFactoryInfoMapper.updateById(idxBizJgFactoryInfo);
// 使用信息
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
......@@ -2699,6 +2745,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
useInfo.setIsNotXiXian(String.valueOf(map.get("isXixian")));
useInfo.setEstateUnitCreditCode(String.valueOf(map.get("estateUnitName")).split("_")[0]);
useInfo.setEstateUnitName(String.valueOf(map.get("estateUnitName")).split("_")[1]);
useInfo.setPhone(String.valueOf(map.get("safetyManager")).split("_")[0]);
useInfo.setSafetyManager(String.valueOf(map.get("safetyManager")).split("_")[1]);
useInfo.setUseDate(String.valueOf(map.get("useDate")));
String usePlace = useInfo.getProvinceName() + "/" + useInfo.getCityName() + "/" + useInfo.getCountyName() +"/" + useInfo.getStreetName();
useInfoMapper.updateById(useInfo);
......@@ -2706,6 +2755,21 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
otherLambda.eq(IdxBizJgOtherInfo::getRecord, map.get("equipId"));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(otherLambda);
// 检验检测【一对多,暂时只取最新一条数据】
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(String.valueOf(map.get("equipId")));
if (ObjectUtils.isEmpty(inspectionDetectionInfo)) {
inspectionDetectionInfo = new IdxBizJgInspectionDetectionInfo();
}
inspectionDetectionInfo.setInspectOrgCode(String.valueOf(map.get("inspectOrgCode")));
inspectionDetectionInfo.setInspectOrgName(String.valueOf(map.get("inspectOrgName")));
inspectionDetectionInfo.setInspectConclusion(String.valueOf(map.get("inspectConclusion")));
inspectionDetectionInfo.setInspectType(String.valueOf(map.get("inspectType")));
inspectionDetectionInfo.setInspectDate(DateUtil.parse(String.valueOf(map.get("inspectDate")), "yyyy-MM-dd"));
inspectionDetectionInfo.setInspectStaff(String.valueOf(map.get("inspectStaff")));
inspectionDetectionInfo.setNextInspectDate(DateUtil.parse(String.valueOf(map.get("nextInspectDate")), "yyyy-MM-dd"));
inspectionDetectionInfo.setInspectReport(JSONObject.toJSONString(map.get("inspectReport")));
iIdxBizJgInspectionDetectionInfoService.saveOrUpdateData(inspectionDetectionInfo);
// 生成监管码 96333码
this.createCode(map, jgUseRegistration, registerInfo, useInfo, otherInfo);
map.put("equCode", equCode);
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintenanceContractMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class MaintenanceContractEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "maintenanceFiling";
private JgMaintenanceContractMapper maintenanceContractMapper;
public MaintenanceContractEquipUsedCheckImpl(RedissonClient redissonClient, JgMaintenanceContractMapper maintenanceContractMapper) {
this.redissonClient = redissonClient;
this.maintenanceContractMapper = maintenanceContractMapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化在流程中的设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = maintenanceContractMapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import lombok.Data;
/**
* 机构进行检验时效统计对象
*
* @author Administrator
*/
@Data
public class InspectionTimelinesDto {
private String city;
private String name;
private String unitCode;
private Long count;
}
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import lombok.Data;
/**
* 检验机构公示
*
* @author Administrator
*/
@Data
public class PublicityInspectOrgInfoDto {
/**
* 单位名称
*/
private String unitName;
/**
* 单位编码
*/
private String unitCode;
/**
* 核准代码
*/
private String approvalNumber;
/**
* 核准有效期
*/
private String aapprovalDeadline;
/**
* 业务有限期
*/
private String businessDeadline;
}
......@@ -219,6 +219,12 @@ public class JyjcInspectionApplication extends BaseEntity {
private JSONObject planData;
/**
* 计划下发日期,统计办理时效使用
*/
@TableField(value = "plan_create_date")
private Date planCreateDate;
/**
* 是否必须处理: true-必须处理,false-可不予受理
*/
@TableField(value = "is_must_accept")
......
......@@ -215,4 +215,11 @@ public class JyjcInspectionResult extends BaseEntity {
*/
@TableField(value = "safety_level")
private String safetyLevel;
/**
* 计划下发日期,,统计办理时效使用"
*/
@TableField(value = "plan_create_date")
private Date planCreateDate;
}
......@@ -19,12 +19,12 @@ public enum JYJCTypeEnum {
/**
* 检验检测类型
*/
DTJC("DTJC", "电梯检测", "jc", BizTypeEnum.DETECTION.getCode()),
DQJY("DQJY", "定期检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
SCJY("SCJY", "首次检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
WXJDJY("WXJDJY", "维修监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
AZJDJY("AZJDJY", "安装监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
GZJDJY("GZJDJY", "改造监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
AZJDJY("AZJDJY", "安装监督检验", "jy", BizTypeEnum.SUPERVISE.getCode());
WXJDJY("WXJDJY", "维修监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
SCJY("SCJY", "首次检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
DQJY("DQJY", "定期检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
DTJC("DTJC", "电梯检测", "jc", BizTypeEnum.DETECTION.getCode());
private final String code;
private final String name;
......
......@@ -42,4 +42,6 @@ public interface JyjcBaseMapper {
List<TzsUserInfoDto> selectUserByCompanyCodes(@Param("companyCodes") List<String> companyCodes);
CompanyModel selectOneCompanyByCode(String companyCode);
String getOrgCodeByCompanyCode(String companyCode);
}
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipDto;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import org.springframework.data.repository.query.Param;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
......@@ -44,5 +46,23 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
* @param equips 需要判断的设备
* @return 在流程中的设备records
*/
List<String> queryRecordListInFlowing(@org.apache.ibatis.annotations.Param("equips") List<JyjcInspectionApplicationEquipDto> equips);
List<String> queryRecordListInFlowing(@Param("equips") List<JyjcInspectionApplicationEquipDto> equips);
/**
* 按照检验类型、机构、时间统计检验数量(流程中及已完成的)
*
* @param orgCode 区域对应公司orgCode
* @param dpFilterParamDto 过滤条件
* @return 统计信息
*/
List<CountDto> queryAllFlowingAndFinishedInspectApp(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
/**
* 查询待出结果的报检单据数量
*
* @param orgCode 区域对应公司orgCode
* @param dpFilterParamDto 过滤条件
* @return 统计信息
*/
List<CountDto> queryAllPendingResultInspectApp(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
}
......@@ -2,10 +2,14 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 业务开通申请表 Mapper 接口
*
......@@ -18,4 +22,5 @@ public interface JyjcInspectionResultMapper extends BaseMapper<JyjcInspectionRes
Page<JyjcInspectionResultModel> selectForPage(@Param("page") Page<JyjcInspectionResultModel> page, @Param("jyjcInspectionResultModel") JyjcInspectionResultModel jyjcInspectionResultModel,@Param("identity") String identity);
List<InspectionTimelinesDto> queryInspectionTimelinessTopXX(@Param("top") String top,@Param("orgCode") String orgCode);
}
package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -26,4 +27,11 @@ public interface JyjcOpeningApplicationMapper extends BaseMapper<JyjcOpeningAppl
void updatePromoter(@Param("id") Long id);
List<Long> selectOverdueData();
/**
* 检验机构公示
* @param orgCode 区域对应的orgCode
* @return List<PublicityInspectOrgInfoDto>
*/
List<PublicityInspectOrgInfoDto> queryInspectionOrgListForPublicity(String orgCode);
}
......@@ -166,6 +166,9 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty(value = "是否已经进行计划排期")
private Boolean isExistPlanData;
@ApiModelProperty(value = "计划下发日期,统计办理时效使用,来源JyjcInspectionApplication.planCreateDate")
private Date planCreateDate;
/**
* 是否必须处理: true-必须处理,false-可不予受理
*/
......
......@@ -150,6 +150,11 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "监管码")
private String supervisoryCode;
@ApiModelProperty(value = "计划下发日期,统计办理时效使用")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date planCreateDate;
/**
* 校验检验系统唯一流水号,排查问题,跟踪问题使用
*/
......
......@@ -85,6 +85,9 @@
WHERE
c.company_code =#{companyCode}
</select>
<select id="getOrgCodeByCompanyCode" resultType="java.lang.String">
select org_code from privilege_company where company_code = #{companyCode} limit 1
</select>
</mapper>
......@@ -216,4 +216,32 @@
UPDATE tz_jyjc_inspection_application set promoter = null
where sequence_nbr = #{id}
</update>
<select id="queryAllFlowingAndFinishedInspectApp" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
count(1) as longValue,
a.inspection_type as keyStr
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and b.supervise_org_code like CONCAT(#{orgCode}, '%')
and a.status != '6610' and a.status != '6615'
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
and date_le(CAST(a.application_date as date),#{dto.endDate})
group by a.inspection_type
</select>
<select id="queryAllPendingResultInspectApp" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
count(1) as longValue,
a.inspection_type as keyStr
FROM
tz_jyjc_inspection_application a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status = '6616'
and EXISTS (select 1 from tz_jyjc_inspection_result r where r.result_status='1' and a.application_no = r.application_no)
and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
</select>
</mapper>
......@@ -157,4 +157,28 @@
</where>
ORDER BY res.sequence_nbr DESC
</select>
<select id="queryInspectionTimelinessTopXX" resultType="com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto">
select
a1.avgtime as count,
a1.inspection_unit_code as unitCode,
b1.use_unit as name,
b1.city
from
(SELECT
ROUND(avg(EXTRACT(EPOCH FROM ( r.rec_date - r.plan_create_date)) / 60),0) as avgtime,
r.inspection_unit_code
FROM
tz_jyjc_inspection_result r,
tz_base_enterprise_info b
where
r.result_status ='2'
and r.inspection_unit_code= b.use_unit_code
AND b.supervise_org_code like CONCAT(#{orgCode}, '%')
GROUP BY r.inspection_unit_code ORDER BY avgtime
limit #{top}
) a1,
tz_base_enterprise_info b1
WHERE
a1.inspection_unit_code = b1.use_unit_code
</select>
</mapper>
......@@ -50,4 +50,36 @@
UPDATE tz_jyjc_opening_application set promoter = null
where sequence_nbr = #{id}
</update>
<select id="queryInspectionOrgListForPublicity" resultType="com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto">
select
b.use_unit as unitName,
l.cert_no as approvalNumber,
l.expiry_date as aapprovalDeadline,
b.use_code as unitCode,
a.expiry_date as businessDeadline,
a.licenceType
from
(SELECT
unit_code,
expiry_date,
unit_code_name,
case when
open_biz_type = 'jy' then '1233-1'
when
open_biz_type = 'jc' then '1233-2'
end as open_biz_type,
open_biz_type as licenceType
FROM
"tz_jyjc_opening_application"
where
status = '6616') a,
tz_base_enterprise_info b,
(select cert_no, min(expiry_date) as expiry_date, unit_code, cert_type_code from tz_base_unit_licence GROUP BY cert_no,unit_code,cert_type_code) l
where
a.unit_code= b.use_unit_code
and a.unit_code=l.unit_code
and l.cert_type_code = a.open_biz_type
and b.supervise_org_code like CONCAT(#{orgCode}, '%')
ORDER BY unitName
</select>
</mapper>
package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.DPStatisticsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
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.exception.instance.BadRequest;
......@@ -42,8 +41,8 @@ public class DPStatisticsController {
@PostMapping(value = "/inspectTime/count/byEquListAndInspectType")
public ResponseModel<Map<String, Object>> inspectTimeCountByTypeAndEquList(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if(!fieldErrors.isEmpty()){
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.inspectTimeCountByTypeAndEquList(dpFilterParamDto));
}
......@@ -53,10 +52,66 @@ public class DPStatisticsController {
@PostMapping(value = "/inspectTimeCount")
public ResponseModel<Map<String, Object>> inspectTimeCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if(!fieldErrors.isEmpty()){
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.inspectTimeCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-左侧检验检测人员统计", notes = "大屏-检验检测-左侧检验检测人员统计")
@PostMapping(value = "/jy/person/count")
public ResponseModel<Map<String, Object>> inspectPersonCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.inspectPersonCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-各检验类型业务数量统计", notes = "大屏-检验检测-各检验类型业务数量统计")
@PostMapping(value = "/jy/allApp/countByType")
public ResponseModel<Map<String, Object>> inspectBizNumCountByType(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryAllFlowingAndFinishedInspectApp(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-各检验类型待检数量统计", notes = "大屏-检验检测-各检验类型待检数量统计")
@PostMapping(value = "/jy/pendingApp/countByType")
public ResponseModel<Map<String, Object>> queryAllFlowingAndFinishedInspectApp(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryAllPendingResultInspectApp(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-按机构进行检验时效统计Top10排名", notes = "大屏-检验检测-按机构进行检验时效统计Top10排名")
@PostMapping(value = "/jy/timeliness/top")
public ResponseModel<List<InspectionTimelinesDto>> inspectionTimelinessTopXX(@RequestParam(required = false, defaultValue = "10") String top, @Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryInspectionTimelinessTopXX(top, dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-检验检测机构公示", notes = "大屏-检验检测-检验检测机构公示")
@PostMapping(value = "/jy/inspectionOrgList/publicity")
public ResponseModel<List<PublicityInspectOrgInfoDto>> inspectionOrgListForPublicity(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryInspectionOrgListForPublicity(dpFilterParamDto));
}
}
......@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
......@@ -25,13 +26,16 @@ public class InspectionPlanServiceImpl {
private JyjcInspectionApplicationEquipServiceImpl applicationEquipService;
private JyjcInspectionResultServiceImpl inspectionResultService;
private ESEquipmentCategory esEquipmentCategory;
public InspectionPlanServiceImpl(JyjcInspectionApplicationServiceImpl inspectionApplicationService,
JyjcInspectionApplicationEquipServiceImpl applicationEquipService,
ESEquipmentCategory esEquipmentCategory) {
JyjcInspectionResultServiceImpl inspectionResultService, ESEquipmentCategory esEquipmentCategory) {
this.inspectionApplicationService = inspectionApplicationService;
this.applicationEquipService = applicationEquipService;
this.inspectionResultService = inspectionResultService;
this.esEquipmentCategory = esEquipmentCategory;
}
......@@ -40,15 +44,23 @@ public class InspectionPlanServiceImpl {
LambdaUpdateWrapper<JyjcInspectionApplication> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(JyjcInspectionApplication::getPlanData, JSONObject.toJSONString(model));
updateWrapper.eq(BaseEntity::getSequenceNbr, applicationSeq);
updateWrapper.set(JyjcInspectionApplication::getPlanCreateDate, new Date());
inspectionApplicationService.update(updateWrapper);
// 异步写入计划排期日期,统计办理时效使用
this.updatePlanCreateDate(applicationSeq);
return model;
}
private void updatePlanCreateDate(String applicationSeq) {
JyjcInspectionApplication inspectionApplication = inspectionApplicationService.getById(applicationSeq);
inspectionResultService.updatePlanCreateDateByAppNo(inspectionApplication.getApplicationNo());
}
public JSONObject getDetail(String applicationSeq) {
JyjcInspectionApplication inspectionApplication = inspectionApplicationService.getById(applicationSeq);
// 初始时查询设备地址关联设备表
JSONObject jsonObject = inspectionApplication.getPlanData();
if(jsonObject == null){
if (jsonObject == null) {
jsonObject = new JSONObject();
String address = this.getOneEquipAddress(applicationSeq);
jsonObject.put("address", address);
......@@ -61,10 +73,10 @@ public class InspectionPlanServiceImpl {
List<JyjcInspectionApplicationEquip> applicationEquips = applicationEquipService.list(new LambdaQueryWrapper<JyjcInspectionApplicationEquip>().eq(JyjcInspectionApplicationEquip::getApplicationSeq, applicationSeq));
// 拼接地址
List<String> allAddress = new ArrayList<>();
applicationEquips.forEach(e->{
applicationEquips.forEach(e -> {
String record = e.getEquipUnicode();
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if(optional.isPresent()){
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
allAddress.add(this.concatDetailAddress(esEquipmentCategoryDto));
}
......@@ -77,6 +89,6 @@ public class InspectionPlanServiceImpl {
String usePlace = esEquipmentCategoryDto.getUSE_PLACE();
// 详细地址
String address = esEquipmentCategoryDto.getADDRESS();
return String.format("%s%s",usePlace, address);
return String.format("%s%s", usePlace, address);
}
}
......@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -39,6 +40,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -504,4 +506,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
String group = getPersonIdentityByType(selectedOrgInfo.getCompany().getCompanyType());
return JyjcInspectionApplicationServiceImpl.getDictionarieModels(group);
}
@Async
public void updatePlanCreateDateByAppNo(String appNo) {
LambdaUpdateWrapper<JyjcInspectionResult> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(JyjcInspectionResult::getApplicationNo, appNo);
updateWrapper.set(JyjcInspectionResult::getPlanCreateDate, new Date());
this.update(updateWrapper);
}
}
\ No newline at end of file
......@@ -48,4 +48,6 @@ public interface ITzBaseEnterpriseInfoService extends IService<TzBaseEnterpriseI
String setLabel(List<Long> enterpriseIds, List<String> enterpriseLabels);
BaseUnitLicence getUnitLicenceMessage(String unitCode);
Map<String, Object> getInfoByUseCodeMap(String useCode);
}
......@@ -200,6 +200,13 @@ public class TzBaseEnterpriseInfoController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getInfoByUseCode/map", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据统一信用代码查询企业详情返回map", notes = "根据统一信用代码查询企业详情返回map")
public ResponseModel<Map<String, Object>> getInfoByUseCodeMap(String useCode) {
return ResponseHelper.buildResponse(iTzBaseEnterpriseInfoService.getInfoByUseCodeMap(useCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getInfoByUseCodeList", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据统一信用代码查询企业详情", notes = "根据统一信用代码查询企业详情")
public ResponseModel<IPage<TzBaseEnterpriseInfoDto>> getInfoByUseCodeList(String useCode) {
......
......@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
......@@ -237,6 +238,44 @@ public class TzBaseEnterpriseInfoServiceImpl
}
@Override
public Map<String, Object> getInfoByUseCodeMap(String useCode) {
TzBaseEnterpriseInfoDto infoByUseCode = getInfoByUseCode(useCode);
ObjectMapper objectMapper = new ObjectMapper();
Map<String,Object> resultMap = new HashMap<>();
RegUnitIcDto regUnitIcDto = infoByUseCode.getRegUnitIcDto();
RegUnitInfoDto regUnitInfoDto = infoByUseCode.getRegUnitInfoDto();
TzsBaseInstitution tzsBaseInstitution = infoByUseCode.getRegUnitMessage();
Map<String,Object> regUnitIcDtoMap = new HashMap<>();
Map<String,Object> regUnitInfoDtoMap = new HashMap<>();
Map<String,Object> tzsBaseInstitutionMap = new HashMap<>();
try {
resultMap = objectMapper.convertValue(infoByUseCode, Map.class);
regUnitIcDtoMap = objectMapper.convertValue(regUnitIcDto, Map.class);
regUnitInfoDtoMap = objectMapper.convertValue(regUnitInfoDto, Map.class);
tzsBaseInstitutionMap = objectMapper.convertValue(tzsBaseInstitution, Map.class);
} catch (Exception e) {
e.printStackTrace();
}
if(!ObjectUtils.isEmpty(regUnitIcDtoMap)){
resultMap.putAll(regUnitIcDtoMap);
}
if(!ObjectUtils.isEmpty(regUnitInfoDtoMap)){
resultMap.putAll(regUnitInfoDtoMap);
}
if(!ObjectUtils.isEmpty(tzsBaseInstitutionMap)){
resultMap.putAll(tzsBaseInstitutionMap);
}
resultMap.remove("regUnitIcDto");
resultMap.remove("regUnitInfoDto");
resultMap.remove("tzsBaseInstitution");
return resultMap;
}
@Override
public TzBaseEnterpriseInfoDto getInfoByUseCode(String useCode) {
TzBaseEnterpriseInfo tzBaseEnterpriseInfo = tzBaseEnterpriseInfoMapper.selectOne(new QueryWrapper<TzBaseEnterpriseInfo>().eq("use_code", useCode));
......@@ -869,4 +908,6 @@ public class TzBaseEnterpriseInfoServiceImpl
return baseUnitLicenceService.getBaseMapper().selectOne(lambda);
}
}
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