Commit ddb40e06 authored by zhangsen's avatar zhangsen

告知申请相关接口提交

parent bb95b11c
......@@ -61,4 +61,115 @@ public class InstallNoticeDto extends BaseDto {
private String companyName;
/**
* 设备名称
*/
@ApiModelProperty("设备名称")
private String equipName;
/**
* 设备代码
*/
@ApiModelProperty("设备代码")
private String equipCode;
/**
* 制造编号
*/
@ApiModelProperty("制造编号")
private String factoryNum;
/**
* 设备地点
*/
@ApiModelProperty("设备地点")
private String equipPosition;
/**
* 安装改造维修日期
*/
@ApiModelProperty("安装改造维修日期")
private Date implementDate;
/**
* 施工单位
*/
@ApiModelProperty("施工单位")
private String constructionUnit;
/**
* 施工类别
*/
@ApiModelProperty("施工类别")
private String constructionType;
/**
* 联系人
*/
@ApiModelProperty("联系人")
private String contact;
/**
* 电话
*/
@ApiModelProperty("电话")
private String phone;
/**
* 传真
*/
@ApiModelProperty("传真")
private String fax;
/**
* 邮编
*/
@ApiModelProperty("邮编")
private String zipcode;
/**
* 地址
*/
@ApiModelProperty("地址")
private String address;
/**
* 使用单位联系人
*/
@ApiModelProperty("使用单位联系人")
private String useUnitContact;
/**
* 使用单位电话
*/
@ApiModelProperty("使用单位电话")
private String useUnitPhone;
/**
* 使用单位传真
*/
@ApiModelProperty("使用单位传真")
private String useUnitFax;
/**
* 使用单位邮编
*/
@ApiModelProperty("使用单位邮编")
private String useUnitZipcode;
/**
* 使用单位地址
*/
@ApiModelProperty("使用单位地址")
private String useUnitAddress;
//以下字段为页面需要回显字段,不需要提交入库的字段
/**
* 设备型号(参数)
*/
@ApiModelProperty("设备型号(参数)")
private String equipType;
@ApiModelProperty("制造单位")
private String madeUnit;
@ApiModelProperty("制造许可证编号")
private String madeLicenceCode;
@ApiModelProperty("施工单位许可证编号")
private String buildLicenceCode;
@ApiModelProperty("施工单位许可证有效期")
private String buildLicenceDateLine;
@ApiModelProperty("使用单位")
private String useUnitName;
@ApiModelProperty("流程实例ID")
private String instanceId;
}
package com.yeejoin.amos.boot.module.ugp.api.dto;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
@Data
public class OverProjectDto {
public class OverProjectDto extends BaseDto {
/**
* 项目主键Id
......
......@@ -93,5 +93,90 @@ public class InstallNotice extends BaseEntity {
*/
@TableField("remark")
private String remark;
/**
* 设备名称
*/
@TableField("equip_name")
private String equipName;
/**
* 设备代码
*/
@TableField("equip_code")
private String equipCode;
/**
* 制造编号
*/
@TableField("factory_num")
private String factoryNum;
/**
* 设备地点
*/
@TableField("equip_position")
private String equipPosition;
/**
* 安装改造维修日期
*/
@TableField("implement_date")
private String implementDate;
/**
* 施工单位
*/
@TableField("construction_unit")
private String constructionUnit;
/**
* 施工类别
*/
@TableField("construction_type")
private String constructionType;
/**
* 联系人
*/
@TableField("contact")
private String contact;
/**
* 电话
*/
@TableField("phone")
private String phone;
/**
* 传真
*/
@TableField("fax")
private String fax;
/**
* 邮编
*/
@TableField("zipcode")
private String zipcode;
/**
* 地址
*/
@TableField("address")
private String address;
/**
* 使用单位联系人
*/
@TableField("use_unit_contact")
private String useUnitContact;
/**
* 使用单位电话
*/
@TableField("use_unit_phone")
private String useUnitPhone;
/**
* 使用单位传真
*/
@TableField("use_unit_fax")
private String useUnitFax;
/**
* 使用单位邮编
*/
@TableField("use_unit_zipcode")
private String useUnitZipcode;
/**
* 使用单位地址
*/
@TableField("use_unit_address")
private String useUnitAddress;
}
package com.yeejoin.amos.boot.module.ugp.api.service;
import com.yeejoin.amos.boot.module.ugp.api.dto.InstallNoticePageDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.ugp.api.entity.InstallNotice;
/**
* 安装告知表接口类
......@@ -11,5 +10,5 @@ import java.util.List;
* @author system_generator
* @date 2022-09-22
*/
public interface IInstallNoticeService {
public interface IInstallNoticeService extends IService<InstallNotice> {
}
......@@ -4,29 +4,41 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.Enum.NoticeStatusEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.WhetherItPassEnum;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.dto.*;
import com.yeejoin.amos.boot.module.ugp.api.entity.InstallNotice;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.entity.*;
import com.yeejoin.amos.boot.module.ugp.api.mapper.InstallNoticeMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IInstallNoticeService;
import com.yeejoin.amos.boot.module.ugp.biz.fegin.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.*;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -60,6 +72,21 @@ public class InstallNoticeController extends BaseController {
@Autowired
UnitLicenceServiceImpl unitLicenceService;
@Resource
private IInstallNoticeService iInstallNoticeService;
@Resource
private IPipeServiceImpl pipeService;
@Resource
private ProjectResourceServiceImpl projectResourceService;
@Resource
private MaterialServiceImpl materialService;
@Resource
private TzsServiceFeignClient tzsServiceFeignClient;
/**
* 新增安装告知表
......@@ -345,4 +372,93 @@ public class InstallNoticeController extends BaseController {
jsonObject = unitLicenceService.getLicenceByCompanyId(jsonObject,companyId);
return ResponseHelper.buildResponse(jsonObject);
}
/**
* 新增/修改安装告知表信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/saveOrUpdate")
@ApiOperation(value = "新增/修改安装告知表信息", notes = "新增/修改安装告知表信息")
public ResponseModel<InstallNoticeDto> saveOrUpdate(@RequestBody InstallNoticeDto model) {
Project project = projectServiceImpl.getById(model.getProjectId());
LambdaQueryWrapper<InstallNotice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(InstallNotice::getProjectId, model.getProjectId());
lambdaQueryWrapper.eq(InstallNotice::getIsDelete, Boolean.FALSE);
InstallNotice one = iInstallNoticeService.getOne(lambdaQueryWrapper);
if (ObjectUtils.isNotEmpty(one)) {
model.setSequenceNbr(one.getSequenceNbr());
}
InstallNotice installNotice = new InstallNotice();
BeanUtils.copyProperties(model, installNotice);
installNotice.setNoticeDate(new Date());
installNotice.setOrganizationCode(orgServiceImpl.getOrgUsr().getBizOrgCode());
iInstallNoticeService.saveOrUpdate(installNotice);
if (NoticeStatusEnum.已提交.getName().equals(model.getNoticeStatus())) {
projectInitiationServiceImpl.execute(project.getInstanceId(), model, WhetherItPassEnum.PASS.getCode(), null);
}
return ResponseHelper.buildResponse(model);
}
/**
* 告知页面回显内容
* @param projectId
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getInfoByProjectId")
@ApiOperation(value = "告知页面回显内容", notes = "告知页面回显内容")
public ResponseModel<InstallNoticeDto> getInfoByProjectId(@RequestParam Long projectId) {
if (ObjectUtils.isEmpty(projectId)) {
return null;
}
LambdaQueryWrapper<InstallNotice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(InstallNotice::getProjectId, projectId);
lambdaQueryWrapper.eq(InstallNotice::getIsDelete, Boolean.FALSE);
InstallNotice one = iInstallNoticeService.getOne(lambdaQueryWrapper);
ProjectDto projectDto = projectServiceImpl.getDetail(projectId);
InstallNoticeDto installNoticeDto = new InstallNoticeDto();
if (ObjectUtils.isNotEmpty(one)) {
BeanUtils.copyProperties(one, installNoticeDto);
}
installNoticeDto.setEquipPosition(projectDto.getAddress());
installNoticeDto.setImplementDate(projectDto.getStartDate());
installNoticeDto.setConstructionUnit(projectDto.getInstallationUnit());
installNoticeDto.setUseUnitName(orgServiceImpl.getOrgUsr().getBizOrgName());
//查询设备型号(参数)
LambdaQueryWrapper<Pipe> lambda = new LambdaQueryWrapper<>();
lambda.eq(Pipe::getProjectId, projectId);
lambda.eq(Pipe::getIsDelete, Boolean.FALSE);
List<Pipe> list = pipeService.list(lambda);
String specifications = list.stream().map(Pipe::getSpecification).distinct().collect(Collectors.joining(","));
installNoticeDto.setEquipType(specifications);
//查询制造单位信息
LambdaQueryWrapper<ProjectResource> lambdaProjectResource = new LambdaQueryWrapper<>();
lambdaProjectResource.eq(ProjectResource::getProjectId, projectId);
lambdaProjectResource.eq(ProjectResource::getType, ProjectResourceEnum.管材资源.getCode());
lambdaProjectResource.eq(ProjectResource::getIsDelete, 0);
List<Long> collect1 = projectResourceService.list(lambdaProjectResource).stream().map(ProjectResource::getResourceId).distinct().collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect1)) {
LambdaQueryWrapper<Material> materialLambdaQueryWrapper = new LambdaQueryWrapper<>();
materialLambdaQueryWrapper.in(Material::getSequenceNbr, collect1);
materialLambdaQueryWrapper.eq(Material::getIsDelete, Boolean.FALSE);
List<String> collect = materialService.list(materialLambdaQueryWrapper).stream().map(Material::getManufacturer).distinct().collect(Collectors.toList());
ResponseModel<List<UnitLicence>> licenceByCompanyName = tzsServiceFeignClient.getLicenceByCompanyName(collect);
String manufacturers = String.join(",", collect);
String cerNos = licenceByCompanyName.getResult().stream().map(UnitLicence::getCertNo).collect(Collectors.joining(","));
installNoticeDto.setMadeUnit(manufacturers);
installNoticeDto.setMadeLicenceCode(cerNos);
}
List<String> list1 = Collections.singletonList(projectDto.getInstallationUnit());
ResponseModel<List<UnitLicence>> buildLicenceInfo = tzsServiceFeignClient.getLicenceByCompanyName(list1);
String buildLicenceCode = buildLicenceInfo.getResult().stream().map(UnitLicence::getCertNo).collect(Collectors.joining(","));
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_PATTERN);
String collect = buildLicenceInfo.getResult().stream().map(t -> sdf.format(t.getExpiryDate())).collect(Collectors.joining(","));
installNoticeDto.setBuildLicenceCode(buildLicenceCode);
installNoticeDto.setBuildLicenceDateLine(collect);
installNoticeDto.setProjectId(projectId);
installNoticeDto.setInstanceId(projectDto.getInstanceId());
return ResponseHelper.buildResponse(installNoticeDto);
}
}
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