Commit b5eba7ba authored by Lambertliu's avatar Lambertliu

fix(jg):管道登记功能开发

parent 7727d145
......@@ -10,17 +10,13 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionIn
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -46,9 +42,8 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增管道工程装置表", notes = "新增管道工程装置表")
public ResponseModel<IdxBizJgProjectContraptionDto> save(@RequestBody IdxBizJgProjectContraptionDto model) {
model = idxBizJgProjectContraptionServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
public ResponseModel<Boolean> save(@RequestBody IdxBizJgProjectContraptionDto model) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.saveFirstMergeProjectContraption(model));
}
/**
......@@ -226,5 +221,4 @@ public class IdxBizJgProjectContraptionController extends BaseController {
public ResponseModel<List<IdxBizJgProjectContraptionDto>> selectForList() {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.queryForIdxBizJgProjectContraptionList());
}
}
......@@ -369,28 +369,20 @@ public class JgUseRegistrationController extends BaseController {
/**
* 查询有使用登记证,新增的,没有流程引用的数据
* @param useUnitCreditCode 使用登记证编号
* @param current 当前页
* @param size 每页数
* @return page
* @return List
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jgProjectContraptionPageMaster")
@GetMapping(value = "/jgProjectContraptionListMaster")
@ApiOperation(value = "查询指定使用单位下的可用总装置,已纳管且使用登记证编号不为空或者首次合并为true", notes = "不包括流程中的")
public ResponseModel<IPage<IdxBizJgProjectContraption>> jgProjectContraptionPageMaster(@RequestParam String useUnitCreditCode,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
Page<IdxBizJgProjectContraption> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
IPage<IdxBizJgProjectContraption> re = jgUseRegistrationServiceImpl.jgProjectContraptionPageMaster(useUnitCreditCode, page);
return ResponseHelper.buildResponse(re);
public ResponseModel<List<IdxBizJgProjectContraption>> jgProjectContraptionListMaster(@RequestParam String useUnitCreditCode) {
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.jgProjectContraptionListMaster(useUnitCreditCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询工程装置下的所有做过安装告知但是为做使用登记的管道", notes = "查询工程装置下的所有做过安装告知但是为做使用登记的管道")
@GetMapping(value = "/getDeviceListByProjectContraptionSeq")
public ResponseModel<Object> getDeviceListByProjectContraption(@RequestParam("record") String projectContraptionSeq,
@RequestParam("originProjectContraptionIds") String[] originProjectContraptionIds) {
@RequestParam(required = false) String[] originProjectContraptionIds) {
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDeviceListByProjectContraption(projectContraptionSeq, originProjectContraptionIds));
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -10,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
......@@ -45,7 +47,7 @@ import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static com.alibaba.fastjson.JSON.toJSONString;
/**
* 管道工程装置表服务实现类
*
......@@ -79,6 +81,10 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
@Autowired
private CommonServiceImpl commonService;
@Autowired
private JgVehicleInformationMapper jgVehicleInformationMapper;
@Autowired
private JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
......@@ -422,4 +428,26 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
throw new RuntimeException("导出异常:", e);
}
}
public boolean saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) {
// 单位类型
Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType();
IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(model), IdxBizJgProjectContraption.class);
String equListName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquListCode());
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategoryCode());
String equDefineName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquDefineCode());
projectContraption.setDataSource("new");
projectContraption.setIsIntoManagement(true);
projectContraption.setProvinceName("陕西省");
projectContraption.setEquList(model.getEquListCode());
projectContraption.setEquCategory(model.getEquCategoryCode());
projectContraption.setEquDefine(model.getEquDefineCode());
projectContraption.setEquListName(equListName);
projectContraption.setEquCategoryName(equCategoryName);
projectContraption.setEquDefineName(equDefineName);
projectContraption.setPipelineLength(0.0);
projectContraption.setUscUnitName(companyInfoMap.get("companyName").toString());
projectContraption.setUscUnitCreditCode(companyInfoMap.get("creditCode").toString());
return this.saveOrUpdateData(projectContraption);
}
}
\ No newline at end of file
......@@ -3853,7 +3853,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return jgProjectContraptionService.page(page, wrapper);
}
public IPage<IdxBizJgProjectContraption> jgProjectContraptionPageMaster(String useUnitCreditCode, Page<IdxBizJgProjectContraption> page) {
public List<IdxBizJgProjectContraption> jgProjectContraptionListMaster(String useUnitCreditCode) {
// 兼容个人业务
if(useUnitCreditCode.contains("_")){
useUnitCreditCode = useUnitCreditCode.split("_")[1];
......@@ -3866,18 +3866,15 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
);
Set<String> proIds = flowIngPros.stream()
.map(JgUseRegistration::getProjectContraptionId)
.filter(id -> id != null && !id.isEmpty()) // 过滤 null 和空字符串
.filter(id -> id != null && !id.isEmpty())
.collect(toSet());
// 查询已纳管且使用登记证编号为空或 null,非流程中的装置,或首次合并为 true
LambdaQueryWrapper<IdxBizJgProjectContraption> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, useUnitCreditCode)
.eq(IdxBizJgProjectContraption::getIsIntoManagement, true)
.notIn(!proIds.isEmpty(), BaseEntity::getSequenceNbr, proIds)
.and(w -> w.isNull(IdxBizJgProjectContraption::getUseRegistrationCode)
.or().eq(IdxBizJgProjectContraption::getUseRegistrationCode, "")
.and(w -> w.isNotNull(IdxBizJgProjectContraption::getUseRegistrationCode)
.or().eq(IdxBizJgProjectContraption::getIsFirstMerge, true));
return jgProjectContraptionService.page(page, wrapper);
return jgProjectContraptionService.list(wrapper);
}
public Map<String, Object> getDeviceListByProjectContraption(String projectContraptionSeq, String[] originProjectContraptionIds) {
......
package com.yeejoin.amos.boot.module.ymt.api.dto;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -62,10 +63,10 @@ public class IdxBizJgProjectContraptionDto extends BaseDto {
private Double pipelineLength;
@ApiModelProperty(value = "产品照片附件")
private String productPhoto;
private JSONArray productPhoto;
@ApiModelProperty(value = "其他附件")
private String otherAccessories;
private JSONArray otherAccessories;
@ApiModelProperty(value = "属地监管单位代码")
private String orgCode;
......@@ -74,7 +75,7 @@ public class IdxBizJgProjectContraptionDto extends BaseDto {
private String orgName;
@ApiModelProperty(value = "产品质量合格证明")
private String productQualificationCertificate;
private JSONArray productQualificationCertificate;
@ApiModelProperty(value = "使用地点代码_省")
private String province;
......
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