新增装备修改
This commit is contained in:
		
							parent
							
								
									aee243e556
								
							
						
					
					
						commit
						8a53fcb79e
					
				| 
						 | 
				
			
			@ -186,11 +186,11 @@ public class DevInfoController extends BaseController {
 | 
			
		|||
    /**
 | 
			
		||||
     * 设备信息录入--保存草稿--不校验必填
 | 
			
		||||
     */
 | 
			
		||||
    @ApiOperation(value = "草稿新增(该接口已废弃)")
 | 
			
		||||
/*    @ApiOperation(value = "草稿新增(该接口已废弃)")
 | 
			
		||||
    @PostMapping("/insertDraft")
 | 
			
		||||
    public AjaxResult insertDraft(@NotNull @RequestBody DevInfo devInfo) {
 | 
			
		||||
        return devInfoService.insertDraft(devInfo);
 | 
			
		||||
    }
 | 
			
		||||
    }*/
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 统计装备
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -218,21 +218,14 @@ public class DevInfo extends BaseEntity {
 | 
			
		|||
    @NotEmpty(message = "详情页展示图不能为空")
 | 
			
		||||
    private List<BmFileInfo> detailsFileList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检测证明pdf")
 | 
			
		||||
    private List<List<BmFileInfo>> examinationPdfs = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检测证明pdf")
 | 
			
		||||
    private List<BmFileInfo> examinationPdf = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "唯一标识符列表")
 | 
			
		||||
    private List<String> identifyCodes = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "合格证pdf")
 | 
			
		||||
    private List<List<BmFileInfo>> insurancePdfs = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "合格证pdf")
 | 
			
		||||
    private List<BmFileInfo> insurancePdf = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    private List<Table> tableList;
 | 
			
		||||
 | 
			
		||||
    /**文件附件*/
 | 
			
		||||
    @ApiModelProperty(value = "文件附件")
 | 
			
		||||
    private List<BmFileInfo> bmFileInfoList;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
 | 
			
		|||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,7 @@ import java.util.List;
 | 
			
		|||
 * @since 2024-12-05 15:51:33
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
public class MaDevQc extends BaseEntity implements Serializable {
 | 
			
		||||
    private static final long serialVersionUID = 810056154627295208L;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
package com.bonus.material.device.domain;
 | 
			
		||||
 | 
			
		||||
import com.bonus.common.biz.domain.BmFileInfo;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author:liang.chao
 | 
			
		||||
 * @Date:2024/12/20 - 14:14
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class Table {
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "唯一标识符")
 | 
			
		||||
    private String identifyCode;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检测人")
 | 
			
		||||
    private String checkMan;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检测日期")
 | 
			
		||||
    private String checkDate;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "下次检测日期")
 | 
			
		||||
    private String nextCheckDate;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检测证明pdf")
 | 
			
		||||
    private List<BmFileInfo> examinationPdf = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "合格证pdf")
 | 
			
		||||
    private List<BmFileInfo> insurancePdf = new ArrayList<>();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -85,11 +85,6 @@ public interface DevInfoService {
 | 
			
		|||
     */
 | 
			
		||||
    AjaxResult insertDevInfo(DevInfo devInfo);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增装备 -- 保存草稿 -- 不校验
 | 
			
		||||
     */
 | 
			
		||||
    AjaxResult insertDraft(DevInfo devInfo);
 | 
			
		||||
 | 
			
		||||
    Map<String, Integer> sumType();
 | 
			
		||||
 | 
			
		||||
    List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,7 @@ public interface MaDevQcService {
 | 
			
		|||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    AjaxResult insertDevQc(MaDevQc maDevQc);
 | 
			
		||||
    AjaxResult addDev(MaDevQc maDevQc);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除装备质检
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,7 @@ import com.bonus.material.device.mapper.BmFileInfoMapper;
 | 
			
		|||
import com.bonus.material.device.mapper.DevInfoMapper;
 | 
			
		||||
import com.bonus.material.device.mapper.MaDevQcMapper;
 | 
			
		||||
import com.bonus.material.device.service.DevInfoService;
 | 
			
		||||
import com.bonus.material.device.service.MaDevQcService;
 | 
			
		||||
import com.bonus.system.api.model.LoginUser;
 | 
			
		||||
import com.fasterxml.jackson.core.JsonProcessingException;
 | 
			
		||||
import com.fasterxml.jackson.core.type.TypeReference;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +74,9 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
			
		|||
    @Resource
 | 
			
		||||
    private BmFileInfoMapper bmFileInfoMapper;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private MaDevQcService maDevQcService;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    protected Validator validator;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -313,7 +317,7 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
			
		|||
            return AjaxResult.error("设备信息不能为空");
 | 
			
		||||
        }
 | 
			
		||||
        String code = "";
 | 
			
		||||
        for (int i = 0; i < devInfo.getExaminationPdfs().size(); i++) {
 | 
			
		||||
        for (int i = 0; i < devInfo.getTableList().size(); i++) {
 | 
			
		||||
            //获取用户信息
 | 
			
		||||
            Long userId = SecurityUtils.getLoginUser().getUserid();
 | 
			
		||||
            //保存用户信息
 | 
			
		||||
| 
						 | 
				
			
			@ -324,7 +328,7 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
			
		|||
            devInfo.setCode(code);
 | 
			
		||||
            devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
 | 
			
		||||
            devInfo.setDeviceCount(1);
 | 
			
		||||
            devInfo.setIdentifyCode(devInfo.getIdentifyCodes().get(i));
 | 
			
		||||
            devInfo.setIdentifyCode(devInfo.getTableList().get(i).getIdentifyCode());
 | 
			
		||||
            int saveSuccessNum = devInfoMapper.insertDevInfo(devInfo);
 | 
			
		||||
            code = "";
 | 
			
		||||
            if (saveSuccessNum == 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -343,46 +347,6 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
			
		|||
        return AjaxResult.success("保存成功");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增设备--草稿状态
 | 
			
		||||
     *
 | 
			
		||||
     * @param devInfo 设备信息
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public AjaxResult insertDraft(DevInfo devInfo) {
 | 
			
		||||
        //获取用户信息
 | 
			
		||||
        Long userId = SecurityUtils.getLoginUser().getUserid();
 | 
			
		||||
        //保存用户信息
 | 
			
		||||
        devInfo.setCreator(userId).setMaStatus(TO_BE_LISTED.getCode()).setOwnId(userId);
 | 
			
		||||
        try {
 | 
			
		||||
            if (devInfo.getMaId() != null) {
 | 
			
		||||
                devInfoMapper.deleteDevInfoByMaId(devInfo.getMaId(), MaStatusEnum.UNDER_RENT.getCode());
 | 
			
		||||
            }
 | 
			
		||||
            for (int i = 0; i < devInfo.getExaminationPdfs().size(); i++) {
 | 
			
		||||
                String code = getString();
 | 
			
		||||
                devInfo.setCode(code);
 | 
			
		||||
                devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
 | 
			
		||||
                int insertedDraft = devInfoMapper.insertDraft(devInfo);
 | 
			
		||||
                if (insertedDraft == 0) {
 | 
			
		||||
                    return AjaxResult.error("装备草稿保存失败,请修改后重试");
 | 
			
		||||
                }
 | 
			
		||||
                //保存自定义属性值
 | 
			
		||||
                if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) {
 | 
			
		||||
                    devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
 | 
			
		||||
                }
 | 
			
		||||
                //把文件保存到附件中
 | 
			
		||||
                AjaxResult error = uploadFiles(devInfo, userId, i);
 | 
			
		||||
                if (error != null) {
 | 
			
		||||
                    return error;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            return AjaxResult.error("装备草稿保存失败,执行异常:" + e.getMessage());
 | 
			
		||||
        }
 | 
			
		||||
        return AjaxResult.success("装备草稿保存成功");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 物资设备文件处理并上传
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -416,21 +380,27 @@ public class DevInfoServiceImpl implements DevInfoService {
 | 
			
		|||
            });
 | 
			
		||||
            fileInfoList.addAll(devInfo.getDetailsFileList());
 | 
			
		||||
        }
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(devInfo.getInsurancePdfs().get(i))) {
 | 
			
		||||
            devInfo.getInsurancePdfs().get(i).removeIf(Objects::isNull);
 | 
			
		||||
            devInfo.getInsurancePdfs().get(i).forEach(item -> {
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(devInfo.getTableList().get(i).getInsurancePdf())) {
 | 
			
		||||
            devInfo.getTableList().get(i).getInsurancePdf().removeIf(Objects::isNull);
 | 
			
		||||
            devInfo.getTableList().get(i).getInsurancePdf().forEach(item -> {
 | 
			
		||||
                item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
 | 
			
		||||
                item.setFileType(Long.valueOf(INSURANCE_PDF));
 | 
			
		||||
            });
 | 
			
		||||
            fileInfoList.addAll(devInfo.getInsurancePdfs().get(i));
 | 
			
		||||
            fileInfoList.addAll(devInfo.getTableList().get(i).getInsurancePdf());
 | 
			
		||||
        }
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(devInfo.getExaminationPdfs().get(i))) {
 | 
			
		||||
            devInfo.getExaminationPdfs().get(i).removeIf(Objects::isNull);
 | 
			
		||||
            devInfo.getExaminationPdfs().get(i).forEach(item -> {
 | 
			
		||||
        if (CollectionUtil.isNotEmpty(devInfo.getTableList().get(i).getExaminationPdf())) {
 | 
			
		||||
            devInfo.getTableList().get(i).getExaminationPdf().removeIf(Objects::isNull);
 | 
			
		||||
            devInfo.getTableList().get(i).getExaminationPdf().forEach(item -> {
 | 
			
		||||
                item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
 | 
			
		||||
                item.setFileType(Long.valueOf(EXAMINATION_PDF));
 | 
			
		||||
            });
 | 
			
		||||
            fileInfoList.addAll(devInfo.getExaminationPdfs().get(i));
 | 
			
		||||
            fileInfoList.addAll(devInfo.getTableList().get(i).getExaminationPdf());
 | 
			
		||||
 | 
			
		||||
            // 新增检测证明
 | 
			
		||||
            MaDevQc maDevQc = new MaDevQc();
 | 
			
		||||
            maDevQc.setMaId(devInfo.getMaId().intValue());
 | 
			
		||||
            maDevQc.setFileInfoList(devInfo.getTableList().get(i).getExaminationPdf());
 | 
			
		||||
            maDevQcService.addDev(maDevQc);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 上传处理后的附件列表
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,6 +82,34 @@ public class MaDevQcServiceImpl implements MaDevQcService {
 | 
			
		|||
        return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public AjaxResult addDev(MaDevQc maDevQc) {
 | 
			
		||||
        if (maDevQc == null) {
 | 
			
		||||
            return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
 | 
			
		||||
        }
 | 
			
		||||
        String code = getString();
 | 
			
		||||
        maDevQc.setQcCode(code);
 | 
			
		||||
        maDevQc.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
 | 
			
		||||
        maDevQc.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
        maDevQc.setQcCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
 | 
			
		||||
        int result = maDevQcMapper.insertDevQc(maDevQc);
 | 
			
		||||
        devInfoMapper.updateDevInfoIsQc(maDevQc);
 | 
			
		||||
        if (result > 0 && maDevQc.getId() != null) {
 | 
			
		||||
            if (CollectionUtils.isNotEmpty(maDevQc.getFileInfoList())) {
 | 
			
		||||
                for (BmFileInfo bmFileInfo : maDevQc.getFileInfoList()) {
 | 
			
		||||
                    bmFileInfo.setTaskId(Long.valueOf(maDevQc.getId()));
 | 
			
		||||
                    bmFileInfo.setModelId(Long.valueOf(maDevQc.getMaId()));
 | 
			
		||||
                    bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
 | 
			
		||||
                    // 质检附件
 | 
			
		||||
                    bmFileInfo.setFileType(4L);
 | 
			
		||||
                    bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
 | 
			
		||||
                    bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 生成需求编号
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue