标签管理,维修保养管理
This commit is contained in:
parent
3e46f5ae35
commit
c3102ddbcc
|
|
@ -0,0 +1,79 @@
|
|||
package com.bonus.material.device.controller;
|
||||
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.domain.MaDevQc;
|
||||
import com.bonus.material.device.domain.MaDevRm;
|
||||
import com.bonus.material.device.service.MaDevQcService;
|
||||
import com.bonus.material.device.service.MaDevRmService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/5 15:53
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ma_rm")
|
||||
@Api(value = "装备维修保养管理",tags = "维修保养")
|
||||
public class MaDevRmController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private MaDevRmService maDevRmService;
|
||||
|
||||
/**
|
||||
* 装备质检列表
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "装备质检列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(MaDevRm maDevRm) {
|
||||
startPage();
|
||||
List<MaDevRm> list = maDevRmService.selectDevQcList(maDevRm);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
/**
|
||||
* 装备质检列表
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "装备质检列表")
|
||||
@GetMapping("/rmList")
|
||||
public AjaxResult qcList(MaDevRm maDevRm) {
|
||||
startPage();
|
||||
List<MaDevRm> list = maDevRmService.selectQcList(maDevRm);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增装备质检--含附件上传
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增装备维保--含附件上传")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody MaDevRm maDevRm) {
|
||||
return maDevRmService.insertDevQc(maDevRm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除装备质检
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除装备维保")
|
||||
@PostMapping("/deleteById")
|
||||
public AjaxResult deleteById(@RequestBody MaDevRm maDevRm) {
|
||||
if (maDevRm == null || maDevRm.getMaId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
Integer i = maDevRmService.deleteById(maDevRm);
|
||||
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.material.device.controller;
|
||||
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.SafeBookInfo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.device.service.DevInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2024/12/12 - 9:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tag")
|
||||
@Api(value = "标签管理",tags = "标签管理")
|
||||
public class TagDevController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private DevInfoService devInfoService;
|
||||
@ApiOperation(value = "标签管理列表")
|
||||
@GetMapping("/getTagDevList")
|
||||
public AjaxResult getTagDevList(DevInfoVo devInfoVo) {
|
||||
startPage();
|
||||
List<DevInfoVo> list = devInfoService.getTagDevList(devInfoVo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
}
|
||||
|
|
@ -214,14 +214,12 @@ public class DevInfo extends BaseEntity {
|
|||
private List<BmFileInfo> detailsFileList = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "检测证明、检验pdf")
|
||||
@NotEmpty(message = "检测证明、检验pdf不能为空")
|
||||
private List<List<BmFileInfo>> examinationPdfs = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "检测证明、检验pdf")
|
||||
private List<BmFileInfo> examinationPdf = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "合格证、保险pdf")
|
||||
@NotEmpty(message = "合格证、保险pdf不能为空")
|
||||
private List<List<BmFileInfo>> insurancePdfs = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "合格证、保险pdf")
|
||||
|
|
@ -237,6 +235,9 @@ public class DevInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "公司Id")
|
||||
private String companyId;
|
||||
|
||||
@ApiModelProperty(value = "公司名称")
|
||||
private String comName;
|
||||
|
||||
@ApiModelProperty(value = "管理方式(0编号 1计数)")
|
||||
private String manageType;
|
||||
|
||||
|
|
@ -258,4 +259,7 @@ public class DevInfo extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "自定义属性列表")
|
||||
private List<DevInfoPropertyVo> devInfoProperties;
|
||||
|
||||
@ApiModelProperty(value = "上传人")
|
||||
private String nickName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
package com.bonus.material.device.domain;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 装备质检表(MaDevQc)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-12-05 15:51:33
|
||||
*/
|
||||
@Data
|
||||
public class MaDevRm extends BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 810056154627295208L;
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "装备id")
|
||||
private Integer maId;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
private String deviceCode;
|
||||
|
||||
@ApiModelProperty(value = "装备名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty(value = "质检名称")
|
||||
private String rmName;
|
||||
|
||||
@ApiModelProperty(value = "维保编码")
|
||||
private String rmCode;
|
||||
|
||||
@ApiModelProperty(value = "维保日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date rmTime;
|
||||
|
||||
@ApiModelProperty(value = "维保开始日期")
|
||||
private String rmStartTime;
|
||||
|
||||
@ApiModelProperty(value = "维保结束日期")
|
||||
private String rmEndTime;
|
||||
|
||||
@ApiModelProperty(value = "上传开始日期")
|
||||
private String createStartTime;
|
||||
|
||||
@ApiModelProperty(value = "上传结束日期")
|
||||
private String createEndTime;
|
||||
|
||||
@ApiModelProperty(value = "附件信息")
|
||||
private List<BmFileInfo> fileInfoList;
|
||||
|
||||
@ApiModelProperty(value = "附件地址")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "上传人")
|
||||
private String nickName;
|
||||
|
||||
@ApiModelProperty(value = "维保次数")
|
||||
private Integer minNum;
|
||||
private Integer maxNum;
|
||||
|
||||
@ApiModelProperty(value = "维保次数")
|
||||
private Integer num;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -183,5 +183,7 @@ public interface DevInfoMapper {
|
|||
Integer updateDevInfoIsSafeBook(SafeBookInfo safeBookInfo);
|
||||
|
||||
List<DevInfoVo> selectAssociationList(DevInfoVo devInfo);
|
||||
|
||||
List<DevInfoVo> getTagDevList(DevInfoVo devInfoVo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.material.device.mapper;
|
||||
|
||||
import com.bonus.material.device.domain.MaDevQc;
|
||||
import com.bonus.material.device.domain.MaDevRm;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/5 15:54
|
||||
*/
|
||||
@Mapper
|
||||
public interface MaDevRmMapper {
|
||||
|
||||
/**
|
||||
* 装备质检列表
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
List<MaDevRm> selectDevQcList(MaDevRm maDevRm);
|
||||
|
||||
/**
|
||||
* 新增装备质检
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
int insertDevQc(MaDevRm maDevRm);
|
||||
|
||||
/**
|
||||
* 删除装备质检
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteDevQcById(Integer maId);
|
||||
|
||||
/**
|
||||
* 查询月任务数
|
||||
* @param nowDate
|
||||
* @return
|
||||
*/
|
||||
String selectTaskNumByMonth(Date nowDate);
|
||||
|
||||
List<MaDevRm> selectQcList(MaDevRm maDevRm);
|
||||
}
|
||||
|
|
@ -105,4 +105,6 @@ public interface DevInfoService {
|
|||
void downLoadTemplate(HttpServletResponse resp);
|
||||
|
||||
List<DevInfoVo> selectAssociationList(DevInfoVo devInfo);
|
||||
|
||||
List<DevInfoVo> getTagDevList(DevInfoVo devInfoVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.bonus.material.device.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.domain.MaDevQc;
|
||||
import com.bonus.material.device.domain.MaDevRm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/5 15:53
|
||||
*/
|
||||
public interface MaDevRmService {
|
||||
|
||||
/**
|
||||
* 装备质检列表
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
List<MaDevRm> selectDevQcList(MaDevRm maDevRm);
|
||||
|
||||
/**
|
||||
* 新增设备质检
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
AjaxResult insertDevQc(MaDevRm maDevRm);
|
||||
|
||||
/**
|
||||
* 删除装备质检
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
Integer deleteById(MaDevRm maDevQc);
|
||||
|
||||
List<MaDevRm> selectQcList(MaDevRm maDevRm);
|
||||
}
|
||||
|
|
@ -307,7 +307,7 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
}
|
||||
// 删除原草稿附件
|
||||
BmFileInfo bmFileInfo = new BmFileInfo()
|
||||
.setFileType(Long.valueOf(MaterialConstants.MATERIAL_FILE_TYPE_CODE))
|
||||
.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE)
|
||||
.setModelId(devInfo.getMaId());
|
||||
bmFileInfoMapper.deleteBmFileInfoByBizInfo(bmFileInfo);
|
||||
}
|
||||
|
|
@ -456,6 +456,63 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
private AjaxResult uploadFile(DevInfo devInfo, Long userId) {
|
||||
if (userId == null) {
|
||||
return AjaxResult.error("用户信息获取失败,请刷新后重试");
|
||||
}
|
||||
if (devInfo.getMaId() == null) {
|
||||
return AjaxResult.error("设备ID为空,请携带设备信息上传附件");
|
||||
}
|
||||
|
||||
//把文件保存到附件中
|
||||
List<BmFileInfo> fileInfoList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getMainFileList())) {
|
||||
devInfo.getMainFileList().removeIf(Objects::isNull);
|
||||
devInfo.getMainFileList().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(MAIN_IMAGES_DICT_VALUE));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getMainFileList());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getDetailsFileList())) {
|
||||
devInfo.getDetailsFileList().removeIf(Objects::isNull);
|
||||
devInfo.getDetailsFileList().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(DETAILS_IMAGES_DICT_VALUE));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getDetailsFileList());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getInsurancePdf())) {
|
||||
devInfo.getInsurancePdf().removeIf(Objects::isNull);
|
||||
devInfo.getInsurancePdf().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(INSURANCE_PDF));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getInsurancePdf());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(devInfo.getExaminationPdf())) {
|
||||
devInfo.getExaminationPdf().removeIf(Objects::isNull);
|
||||
devInfo.getExaminationPdf().forEach(item -> {
|
||||
item.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
item.setFileType(Long.valueOf(EXAMINATION_PDF));
|
||||
});
|
||||
fileInfoList.addAll(devInfo.getExaminationPdf());
|
||||
}
|
||||
|
||||
// 上传处理后的附件列表
|
||||
if (CollectionUtil.isNotEmpty(fileInfoList)) {
|
||||
System.out.println("设备附件数量:" + fileInfoList.size());
|
||||
for (BmFileInfo sysFileInfo : fileInfoList) {
|
||||
sysFileInfo.setModelId(devInfo.getMaId());
|
||||
sysFileInfo.setCreateBy(String.valueOf(userId));
|
||||
}
|
||||
int fileUploadTotal = bmFileInfoMapper.insertBmFileInfos(fileInfoList);
|
||||
if (fileUploadTotal == 0) {
|
||||
return AjaxResult.error("设备附件保存0条,保存失败,请修改后重试");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -477,7 +534,16 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) {
|
||||
devInfoMapper.insertDevInfoProperties(devInfo.getMaId(), devInfo.getDevInfoProperties());
|
||||
}
|
||||
return devInfoMapper.updateDevInfo(devInfo) > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||
int i = devInfoMapper.updateDevInfo(devInfo);
|
||||
if (i > 0){
|
||||
BmFileInfo bmFileInfo = new BmFileInfo()
|
||||
.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE)
|
||||
.setModelId(devInfo.getMaId());
|
||||
bmFileInfoMapper.deleteBmFileInfoByBizInfo(bmFileInfo);
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
uploadFile(devInfo, userId);
|
||||
}
|
||||
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -693,6 +759,11 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
return devInfoMapper.selectAssociationList(devInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevInfoVo> getTagDevList(DevInfoVo devInfoVo) {
|
||||
return devInfoMapper.getTagDevList(devInfoVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOutType(String devInfo) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class MaDevQcServiceImpl implements MaDevQcService {
|
|||
} else {
|
||||
taskNum = "0001";
|
||||
}
|
||||
return "WXBY" + format + "-" + taskNum;
|
||||
return "ZJ" + format + "-" + taskNum;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,123 @@
|
|||
package com.bonus.material.device.service.impl;
|
||||
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.device.domain.MaDevRm;
|
||||
import com.bonus.material.device.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.device.mapper.DevInfoMapper;
|
||||
import com.bonus.material.device.mapper.MaDevRmMapper;
|
||||
import com.bonus.material.device.service.MaDevRmService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/5 15:53
|
||||
*/
|
||||
@Service
|
||||
public class MaDevRmServiceImpl implements MaDevRmService {
|
||||
|
||||
@Resource
|
||||
private MaDevRmMapper maDevRmMapper;
|
||||
|
||||
@Resource
|
||||
private BmFileInfoMapper bmFileInfoMapper;
|
||||
|
||||
/**
|
||||
* 装备质检列表
|
||||
*
|
||||
* @param maDevQc
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaDevRm> selectDevQcList(MaDevRm maDevRm) {
|
||||
return maDevRmMapper.selectDevQcList(maDevRm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增装备质检
|
||||
*
|
||||
* @param maDevRm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertDevQc(MaDevRm maDevRm) {
|
||||
if (maDevRm == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
String code = getString();
|
||||
maDevRm.setRmCode(code);
|
||||
maDevRm.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
maDevRm.setCreateTime(DateUtils.getNowDate());
|
||||
int result = maDevRmMapper.insertDevQc(maDevRm);
|
||||
// devInfoMapper.updateDevInfoIsQc(maDevRm);
|
||||
if (result > 0 && maDevRm.getId() != null) {
|
||||
if (CollectionUtils.isNotEmpty(maDevRm.getFileInfoList())) {
|
||||
for (BmFileInfo bmFileInfo : maDevRm.getFileInfoList()) {
|
||||
bmFileInfo.setTaskId(Long.valueOf(maDevRm.getId()));
|
||||
bmFileInfo.setModelId(Long.valueOf(maDevRm.getMaId()));
|
||||
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
|
||||
// 维保附件
|
||||
bmFileInfo.setFileType(6L);
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成需求编号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getString() {
|
||||
//根据前台传过来的数据,生成需求编号
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String taskNum = maDevRmMapper.selectTaskNumByMonth(nowDate);
|
||||
if (StringUtils.isNotBlank(taskNum)) {
|
||||
// 将字符串转换为整数
|
||||
int num = Integer.parseInt(taskNum);
|
||||
// 执行加一操作
|
||||
num++;
|
||||
// 将结果转换回字符串格式,并确保结果是4位数,不足4位则在前面补0
|
||||
taskNum = String.format("%04d", num);
|
||||
} else {
|
||||
taskNum = "0001";
|
||||
}
|
||||
return "WXBY" + format + "-" + taskNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除装备质检
|
||||
*
|
||||
* @param maDevRm
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer deleteById(MaDevRm maDevRm) {
|
||||
int i = maDevRmMapper.deleteDevQcById(maDevRm.getMaId());
|
||||
if (i > 0) {
|
||||
bmFileInfoMapper.deleteBmFileInfoByMaId(maDevRm.getMaId(),6);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaDevRm> selectQcList(MaDevRm maDevRm) {
|
||||
return maDevRmMapper.selectQcList(maDevRm);
|
||||
}
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and task_type = #{taskType}
|
||||
<if test="taskId != null "> and task_id = #{taskId}</if>
|
||||
<if test="modelId != null "> and model_id = #{modelId}</if>
|
||||
<if test="fileType != null "> and file_type = #{fileType}</if>
|
||||
and file_type in (0,1,2,3)
|
||||
</where>
|
||||
</delete>
|
||||
<delete id="deleteBmFileInfoByMaId">
|
||||
|
|
|
|||
|
|
@ -630,6 +630,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
is_active,
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
<if test="ownId != null and ownId != ''">own_id,</if>
|
||||
<if test="checkDate != null">check_date,</if>
|
||||
<if test="checkCycle != null">check_cycle,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
|
|
@ -666,6 +668,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
1,
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||
<if test="ownId != null and ownId != ''">#{ownId},</if>
|
||||
<if test="checkDate != null">#{checkDate},</if>
|
||||
<if test="checkCycle != null">#{checkCycle}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -747,5 +751,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and d.own_co = #{companyId}
|
||||
ORDER BY d.create_time desc
|
||||
</select>
|
||||
<select id="getTagDevList" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
d.*,
|
||||
u.nick_name as nickName,
|
||||
dept.dept_name as comName
|
||||
FROM
|
||||
ma_dev_info d
|
||||
LEFT JOIN sys_user u ON d.own_id = u.user_id
|
||||
LEFT JOIN sys_dept dept ON d.own_co = dept.dept_id
|
||||
WHERE
|
||||
d.is_active = 1
|
||||
AND d.ma_status !=0
|
||||
<if test="code != null and code != ''">
|
||||
and d.code like concat('%',#{code},'%')
|
||||
</if>
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
and d.device_name like concat('%',#{deviceName},'%')
|
||||
</if>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
and u.nick_name like concat('%',#{nickName},'%')
|
||||
</if>
|
||||
<if test="comName != null and comName != ''">
|
||||
and dept.dept_name like concat('%',#{comName},'%')
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
and DATE_FORMAT(d.create_time,'%Y-%m-%d') between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bonus.material.device.mapper.MaDevRmMapper">
|
||||
|
||||
<delete id="deleteDevQcById">
|
||||
delete from ma_dev_rm where ma_id = #{maId}
|
||||
</delete>
|
||||
|
||||
<insert id="insertDevQc" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ma_dev_rm
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">ma_id,</if>
|
||||
<if test="rmName != null and rmName != ''">rm_name,</if>
|
||||
<if test="rmCode != null and rmCode != ''">rm_code,</if>
|
||||
<if test="rmTime != null">rm_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="rmName != null and rmName != ''">#{rmName},</if>
|
||||
<if test="rmCode != null and rmCode != ''">#{rmCode},</if>
|
||||
<if test="rmTime != null">#{rmTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectTaskNumByMonth" resultType="java.lang.String">
|
||||
SELECT SUBSTRING(rm_code, - 4) as code
|
||||
FROM ma_dev_rm
|
||||
WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
|
||||
ORDER BY create_time DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectDevQcList" resultType="com.bonus.material.device.domain.MaDevRm">
|
||||
SELECT
|
||||
m1.id,
|
||||
m1.ma_id AS maId,
|
||||
m2.CODE AS deviceCode,
|
||||
m2.device_name AS deviceName,
|
||||
m1.rm_name AS rmName,
|
||||
m1.rm_code AS rmCode,
|
||||
m1.rm_time AS rmTime,
|
||||
su.nick_name AS createBy,
|
||||
latest_rm.num AS num,
|
||||
m1.create_time AS updateTime,
|
||||
aa.create_time AS createTime
|
||||
FROM
|
||||
ma_dev_rm m1
|
||||
LEFT JOIN ma_dev_info m2 ON m1.ma_id = m2.ma_id
|
||||
AND m2.is_active = '1'
|
||||
LEFT JOIN sys_user su ON su.user_id = m1.create_by
|
||||
INNER JOIN ( SELECT count(*) as num, ma_id, MAX( rm_time ) AS max_rm_time FROM ma_dev_rm GROUP BY ma_id ) latest_rm ON m1.ma_id = latest_rm.ma_id
|
||||
AND m1.rm_time = latest_rm.max_rm_time
|
||||
INNER JOIN ( SELECT ma_id, min( create_time ) AS create_time FROM ma_dev_rm GROUP BY ma_id ) aa ON m1.ma_id = aa.ma_id
|
||||
<where>
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
and m2.code like concat('%',#{deviceCode},'%')
|
||||
</if>
|
||||
<if test="minNum != null and maxNum != null">
|
||||
and latest_rm.num BETWEEN #{minNum} AND #{maxNum}
|
||||
</if>
|
||||
<if test="rmCode != null and rmCode != ''">
|
||||
and m1.rm_code like concat('%',#{rmCode},'%')
|
||||
</if>
|
||||
<if test="rmStartTime != null and rmStartTime != '' and rmEndTime != null and rmEndTime != ''">
|
||||
and DATE_FORMAT(m1.rm_time,'%Y-%m-%d') between #{rmStartTime} and #{rmEndTime}
|
||||
</if>
|
||||
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
||||
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectQcList" resultType="com.bonus.material.device.domain.MaDevRm">
|
||||
SELECT
|
||||
mdq.*,
|
||||
su.nick_name AS nickName,
|
||||
bfi.url AS url
|
||||
FROM
|
||||
ma_dev_rm mdq
|
||||
LEFT JOIN bm_file_info bfi ON bfi.model_id = mdq.ma_id
|
||||
LEFT JOIN sys_user su ON mdq.create_by = su.user_id
|
||||
WHERE
|
||||
bfi.task_type = 17
|
||||
AND bfi.file_type = 6
|
||||
AND bfi.task_id = #{id}
|
||||
<if test="rmCode != null and rmCode != ''">
|
||||
and mdq.rm_code like concat('%',#{rmCode},'%')
|
||||
</if>
|
||||
<if test="rmStartTime != null and rmStartTime != '' and rmEndTime != null and rmEndTime != ''">
|
||||
and DATE_FORMAT(mdq.rm_time,'%Y-%m-%d') between #{rmStartTime} and #{rmEndTime}
|
||||
</if>
|
||||
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
||||
and DATE_FORMAT(mdq.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue