领用出库
This commit is contained in:
parent
a0c43fa985
commit
297dc2c3c0
|
|
@ -0,0 +1,12 @@
|
|||
package com.bonus.material.common.constants;
|
||||
|
||||
/**
|
||||
* 类型常量类
|
||||
* @Author ma_sh
|
||||
* @create 2025/11/15 13:26
|
||||
*/
|
||||
public class TypeConstants {
|
||||
|
||||
/** 领料单号的开头字母 */
|
||||
public static final String LEASE_TASK_TYPE_LABEL = "L";
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.material.common.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 类型枚举类
|
||||
* @Author ma_sh
|
||||
* @create 2025/11/15 13:31
|
||||
*/
|
||||
@Getter
|
||||
public enum TypeEnums {
|
||||
|
||||
TM_TASK_BACK(1, "退还任务"),
|
||||
TM_TASK_LEASE(2, "领用任务"),
|
||||
TM_TASK_RETIRE(3, "退役任务"),
|
||||
TM_TASK_REPAIR(4, "维修任务");
|
||||
|
||||
|
||||
private final Integer taskTypeId;
|
||||
private final String taskTypeName;
|
||||
|
||||
TypeEnums(Integer taskTypeId, String taskTypeName) {
|
||||
this.taskTypeId = taskTypeId;
|
||||
this.taskTypeName = taskTypeName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,12 @@
|
|||
package com.bonus.material.devchange.controller;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.basic.domain.BmSlideShow;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeVo;
|
||||
import com.bonus.material.devchange.domain.DevChangeVo;
|
||||
import com.bonus.material.devchange.domain.JjProjectVo;
|
||||
import com.bonus.material.devchange.domain.*;
|
||||
import com.bonus.material.devchange.service.DevChangeService;
|
||||
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -133,4 +123,75 @@ public class DevChangeController extends BaseController {
|
|||
return AjaxResult.success(service.getDevDetails(vo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取添加设备详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取添加设备详情")
|
||||
@GetMapping("/getDevDetailsInfo")
|
||||
public AjaxResult getDevDetailsInfo(CsDeviceDetails dto) {
|
||||
startPage();
|
||||
List<CsDeviceDetails> list = service.getDevDetailsInfo(dto);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增出库申请
|
||||
* @param csDeviceVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增出库申请")
|
||||
@PostMapping("/addDevDetails")
|
||||
public AjaxResult addDevDetails(@RequestBody CsDeviceVo csDeviceVo) {
|
||||
return service.addDevDetails(csDeviceVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改出库申请
|
||||
* @param csDeviceVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改出库申请")
|
||||
@PostMapping("/updateDevDetails")
|
||||
public AjaxResult updateDevDetails(@RequestBody CsDeviceVo csDeviceVo) {
|
||||
return service.updateDevDetails(csDeviceVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除出库申请
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除出库申请")
|
||||
@PostMapping("/deleteDevDetails")
|
||||
public AjaxResult deleteDevDetails(@RequestBody CsDeviceInfo csDeviceInfo) {
|
||||
return service.deleteDevDetails(csDeviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取设备详情")
|
||||
@GetMapping("/getDevDetailsById")
|
||||
public AjaxResult getDevDetailsById(CsDeviceDetails dto) {
|
||||
CsDeviceVo devInfo = service.getDevDetailsById(dto);
|
||||
return AjaxResult.success(devInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请一级列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取申请一级列表")
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult getList(CsDeviceInfo dto) {
|
||||
startPage();
|
||||
List<CsDeviceInfo> list = service.getList(dto);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备详情列表
|
||||
* @author ma_sh
|
||||
*/
|
||||
@Data
|
||||
public class CsDeviceDetails {
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "主任务ID")
|
||||
private Long changeId;
|
||||
|
||||
@ApiModelProperty(value = "类型ID")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "设备类型 1装备 2工具")
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty(value = "类目")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "管理模式")
|
||||
private String manageType;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
private String devCode;
|
||||
|
||||
@ApiModelProperty(value = "当前库存")
|
||||
private Integer storageNum;
|
||||
|
||||
@ApiModelProperty(value = "申请数量")
|
||||
private Integer num;
|
||||
|
||||
@ApiModelProperty(value = "使用到期日期")
|
||||
private String useTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备详情
|
||||
* @author ma_sh
|
||||
*/
|
||||
@Data
|
||||
public class CsDeviceInfo {
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "需求单位")
|
||||
private String useUnit;
|
||||
|
||||
@ApiModelProperty(value = "项目编号")
|
||||
private String proCode;
|
||||
|
||||
@ApiModelProperty(value = "使用项目")
|
||||
private String proName;
|
||||
|
||||
@ApiModelProperty(value = "项目类型")
|
||||
private String proType;
|
||||
|
||||
@ApiModelProperty(value = "电压等级")
|
||||
private String voltageLevel;
|
||||
|
||||
@ApiModelProperty(value = "省")
|
||||
private String proProvince;
|
||||
|
||||
@ApiModelProperty(value = "市")
|
||||
private String proCity;
|
||||
|
||||
@ApiModelProperty(value = "区/县")
|
||||
private String proCounty;
|
||||
|
||||
@ApiModelProperty(value = "使用到期日期")
|
||||
private String useTime;
|
||||
|
||||
@ApiModelProperty(value = "领用单号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "任务类型 1退还 2领用 3退役 4维修")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "领用方式 0自用 1共享")
|
||||
private String leaseType;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
@ApiModelProperty(value = "申请装备数量")
|
||||
private Integer devNum;
|
||||
|
||||
@ApiModelProperty(value = "申请工具数量")
|
||||
private Integer toolNum;
|
||||
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private String taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备详情列表vo
|
||||
* @author ma_sh
|
||||
*/
|
||||
@Data
|
||||
public class CsDeviceVo {
|
||||
|
||||
private CsDeviceInfo devInfo;
|
||||
|
||||
private List<CsDeviceDetails> devDetailsList;
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.bonus.material.devchange.domain.*;
|
|||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -141,4 +142,76 @@ public interface DevChangeMapper {
|
|||
* @param newNum
|
||||
*/
|
||||
void updateChangeDetailsNum(DevChangeDetailsVo voo);
|
||||
|
||||
/**
|
||||
* 获取添加设备详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<CsDeviceDetails> getDevDetailsInfo(CsDeviceDetails dto);
|
||||
|
||||
/**
|
||||
* 获取申请编号
|
||||
* @param year
|
||||
* @param month
|
||||
* @param taskType
|
||||
* @return
|
||||
*/
|
||||
int getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month, @Param("taskType") Integer taskType);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
int addChangeInfoNew(CsDeviceInfo devInfo);
|
||||
|
||||
/**
|
||||
* 添加设备详情
|
||||
* @param devDetailsList
|
||||
* @return
|
||||
*/
|
||||
int addDetails(List<CsDeviceDetails> devDetailsList);
|
||||
|
||||
/**
|
||||
* 修改设备信息
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
int updateCsDevInfo(CsDeviceInfo devInfo);
|
||||
|
||||
/**
|
||||
* 删除设备详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteChangeDetails(Long id);
|
||||
|
||||
/**
|
||||
* 根据id查询主任务表数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
CsDeviceInfo getDevInfoById(CsDeviceDetails dto);
|
||||
|
||||
/**
|
||||
* 根据id查询设备详情表数据
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<CsDeviceDetails> getDevDetailsById(CsDeviceDetails dto);
|
||||
|
||||
/**
|
||||
* 删除主任务
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
int deleteChangeInfo(CsDeviceInfo csDeviceInfo);
|
||||
|
||||
/**
|
||||
* 获取申请一级列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<CsDeviceInfo> getList(CsDeviceInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
package com.bonus.material.devchange.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeVo;
|
||||
import com.bonus.material.devchange.domain.DevChangeVo;
|
||||
import com.bonus.material.devchange.domain.JjProjectVo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.devchange.domain.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -63,4 +59,46 @@ public interface DevChangeService {
|
|||
AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo);
|
||||
|
||||
AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo);
|
||||
|
||||
/**
|
||||
* 获取添加设备详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<CsDeviceDetails> getDevDetailsInfo(CsDeviceDetails dto);
|
||||
|
||||
/**
|
||||
* 新增出库申请
|
||||
* @param csDeviceVo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult addDevDetails(CsDeviceVo csDeviceVo);
|
||||
|
||||
/**
|
||||
* 修改出库申请
|
||||
* @param csDeviceVo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateDevDetails(CsDeviceVo csDeviceVo);
|
||||
|
||||
/**
|
||||
* 获取设备详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
CsDeviceVo getDevDetailsById(CsDeviceDetails dto);
|
||||
|
||||
/**
|
||||
* 删除出库申请
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult deleteDevDetails(CsDeviceInfo csDeviceInfo);
|
||||
|
||||
/**
|
||||
* 获取申请一级列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<CsDeviceInfo> getList(CsDeviceInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,23 @@ package com.bonus.material.devchange.service;
|
|||
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.common.utils.StringUtil;
|
||||
import com.bonus.material.common.constants.TypeConstants;
|
||||
import com.bonus.material.common.enums.TypeEnums;
|
||||
import com.bonus.material.devchange.domain.*;
|
||||
import com.bonus.material.devchange.mapper.DevChangeMapper;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
|
@ -197,6 +201,163 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取添加设备详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CsDeviceDetails> getDevDetailsInfo(CsDeviceDetails dto) {
|
||||
try {
|
||||
return mapper.getDevDetailsInfo(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增出库申请
|
||||
* @param csDeviceVo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addDevDetails(CsDeviceVo csDeviceVo) {
|
||||
try {
|
||||
if (csDeviceVo == null || csDeviceVo.getDevInfo() == null || CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
||||
return AjaxResult.error("请选择需要添加的设备");
|
||||
}
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 获取申请编号
|
||||
int thisMonthMaxOrder = mapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TypeEnums.TM_TASK_LEASE.getTaskTypeId());
|
||||
String code = genderTaskCode(thisMonthMaxOrder);
|
||||
CsDeviceInfo devInfo = csDeviceVo.getDevInfo();
|
||||
devInfo.setCode(code);
|
||||
devInfo.setCreateBy(userId.toString());
|
||||
// 添加主任务
|
||||
int num = mapper.addChangeInfoNew(devInfo);
|
||||
if (num < 1) {
|
||||
throw new RuntimeException("添加主任务失败");
|
||||
}
|
||||
csDeviceVo.getDevDetailsList().forEach(devDetails -> {
|
||||
devDetails.setChangeId(devInfo.getId());
|
||||
devDetails.setCreateBy(userId.toString());
|
||||
devDetails.setCreateTime(DateUtils.getNowDate());
|
||||
});
|
||||
// 添加设备详情
|
||||
num = mapper.addDetails(csDeviceVo.getDevDetailsList());
|
||||
if (num < 1) {
|
||||
throw new RuntimeException("添加设备详情失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.success("添加成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改出库申请
|
||||
* @param csDeviceVo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateDevDetails(CsDeviceVo csDeviceVo) {
|
||||
try {
|
||||
if (csDeviceVo == null || csDeviceVo.getDevInfo() == null || csDeviceVo.getDevInfo().getId() == null
|
||||
|| CollectionUtils.isEmpty(csDeviceVo.getDevDetailsList())) {
|
||||
return AjaxResult.error("请选择需要修改的设备");
|
||||
}
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
csDeviceVo.getDevInfo().setUpdateBy(userId.toString());
|
||||
// 修改主任务
|
||||
int num = mapper.updateCsDevInfo(csDeviceVo.getDevInfo());
|
||||
if (num < 1) {
|
||||
throw new RuntimeException("修改主任务失败");
|
||||
}
|
||||
// 先将设备详情删除,重新添加
|
||||
num = mapper.deleteChangeDetails(csDeviceVo.getDevInfo().getId());
|
||||
if (num < 1) {
|
||||
throw new RuntimeException("删除设备详情失败");
|
||||
}
|
||||
csDeviceVo.getDevDetailsList().forEach(devDetails -> {
|
||||
devDetails.setChangeId(csDeviceVo.getDevInfo().getId());
|
||||
devDetails.setUpdateBy(userId.toString());
|
||||
devDetails.setCreateBy(userId.toString());
|
||||
devDetails.setCreateTime(DateUtils.getNowDate());
|
||||
devDetails.setUpdateTime(DateUtils.getNowDate());
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详情
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CsDeviceVo getDevDetailsById(CsDeviceDetails dto) {
|
||||
CsDeviceVo csDeviceVo = new CsDeviceVo();
|
||||
// 根据id查询主任务表数据
|
||||
CsDeviceInfo devInfo = mapper.getDevInfoById(dto);
|
||||
// 根据id查询设备详情表数据
|
||||
List<CsDeviceDetails> devDetailsList = mapper.getDevDetailsById(dto);
|
||||
csDeviceVo.setDevInfo(devInfo);
|
||||
csDeviceVo.setDevDetailsList(devDetailsList);
|
||||
return csDeviceVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除出库申请
|
||||
* @param csDeviceInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult deleteDevDetails(CsDeviceInfo csDeviceInfo) {
|
||||
try {
|
||||
// 删除主任务
|
||||
int num = mapper.deleteChangeInfo(csDeviceInfo);
|
||||
if (num < 1) {
|
||||
throw new RuntimeException("删除主任务失败");
|
||||
}
|
||||
// 删除设备详情
|
||||
num = mapper.deleteChangeDetails(csDeviceInfo.getId());
|
||||
if (num < 1) {
|
||||
throw new RuntimeException("删除设备详情失败");
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请一级列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CsDeviceInfo> getList(CsDeviceInfo dto) {
|
||||
return mapper.getList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成任务编号
|
||||
* @param thisMonthMaxOrder
|
||||
* @return
|
||||
*/
|
||||
private String genderTaskCode(int thisMonthMaxOrder) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return TypeConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%04d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修接口
|
||||
*
|
||||
|
|
|
|||
|
|
@ -232,4 +232,253 @@
|
|||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getDevDetailsInfo" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
|
||||
SELECT CASE
|
||||
WHEN mt.level = 1 THEN mt.type_name
|
||||
WHEN mt.level = 2 THEN CONCAT(mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 3 THEN CONCAT(mt2.type_name, '>', mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 4 THEN CONCAT(mt3.type_name, '>', mt2.type_name, '>', mt1.type_name, '>',
|
||||
mt.type_name)
|
||||
WHEN mt.level = 5 THEN CONCAT(mt4.type_name, '>', mt3.type_name, '>', mt2.type_name, '>',
|
||||
mt1.type_name,'>', mt.type_name)
|
||||
WHEN mt.level = 6 THEN CONCAT(mt5.type_name, '>', mt4.type_name, '>', mt3.type_name, '>',
|
||||
mt2.type_name,'>', mt1.type_name, '>', mt.type_name)
|
||||
ELSE mt.type_name
|
||||
END AS category,
|
||||
mdi.device_name AS typeName,
|
||||
mdi.item_type_model AS typeModelName,
|
||||
mdi.manage_type AS manageType,
|
||||
mdi.code AS devCode,
|
||||
1 AS storageNum,
|
||||
1 AS devType,
|
||||
mdi.type_id AS typeId
|
||||
FROM ma_dev_info mdi
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
LEFT JOIN ma_type mt5 ON mt4.parent_id = mt5.type_id
|
||||
<where>
|
||||
mdi.is_active = '1'
|
||||
<if test="typeName!=null and typeName!=''">
|
||||
AND mdi.device_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName!=null and typeModelName!=''">
|
||||
AND mdi.item_type_model like concat('%',#{typeModelName},'%')
|
||||
</if>
|
||||
<if test="devCode!=null and devCode!=''">
|
||||
AND mdi.code like concat('%',#{devCode},'%')
|
||||
</if>
|
||||
</where>
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT CONCAT(tt4.type_name, '>', tt3.type_name, '>', tt2.type_name) as category,
|
||||
tt1.type_name as typeName,
|
||||
tt.type_name as typeModelName,
|
||||
tl.manage_mode as manageType,
|
||||
IFNULL(tl.tool_code,'/') as devCode,
|
||||
tl.available_num as storageNum,
|
||||
2 as devType,
|
||||
tl.type_id as typeId
|
||||
FROM tool_ledger tl
|
||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
<where>
|
||||
<if test="typeName!=null and typeName!=''">
|
||||
AND tt1.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName!=null and typeModelName!=''">
|
||||
AND tt.type_name like concat('%',#{typeModelName},'%')
|
||||
</if>
|
||||
<if test="devCode!=null and devCode!=''">
|
||||
AND tl.tool_code like concat('%',#{devCode},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getMonthMaxOrderByDate" resultType="java.lang.Integer">
|
||||
select COUNT(*) from cs_device_change
|
||||
where
|
||||
month(create_time) = #{month} and year(create_time) = #{year}
|
||||
<if test="taskType != null and taskType !=''">
|
||||
and task_type = #{taskType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDevInfoById" resultType="com.bonus.material.devchange.domain.CsDeviceInfo">
|
||||
select
|
||||
id as id,
|
||||
type as type,
|
||||
lease_type as leaseType,
|
||||
pro_code as proCode,
|
||||
pro_name as proName,
|
||||
pro_type as proType,
|
||||
voltage_level as voltageLevel,
|
||||
use_unit as useUnit,
|
||||
pro_province as proProvince,
|
||||
pro_city as proCity,
|
||||
pro_county as proCounty,
|
||||
use_time as useTime,
|
||||
code as code
|
||||
from cs_device_change
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getDevDetailsById" resultType="com.bonus.material.devchange.domain.CsDeviceDetails">
|
||||
SELECT CASE
|
||||
WHEN mt.level = 1 THEN mt.type_name
|
||||
WHEN mt.level = 2 THEN CONCAT(mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 3 THEN CONCAT(mt2.type_name, '>', mt1.type_name, '>', mt.type_name)
|
||||
WHEN mt.level = 4 THEN CONCAT(mt3.type_name, '>', mt2.type_name, '>', mt1.type_name, '>',
|
||||
mt.type_name)
|
||||
WHEN mt.level = 5 THEN CONCAT(mt4.type_name, '>', mt3.type_name, '>', mt2.type_name, '>',
|
||||
mt1.type_name,'>', mt.type_name)
|
||||
WHEN mt.level = 6 THEN CONCAT(mt5.type_name, '>', mt4.type_name, '>', mt3.type_name, '>',
|
||||
mt2.type_name,'>', mt1.type_name, '>', mt.type_name)
|
||||
ELSE mt.type_name
|
||||
END AS category,
|
||||
mdi.device_name AS typeName,
|
||||
mdi.item_type_model AS typeModelName,
|
||||
mdi.manage_type AS manageType,
|
||||
mdi.code AS devCode,
|
||||
1 AS storageNum,
|
||||
1 AS devType,
|
||||
mdi.type_id AS typeId
|
||||
cd.num AS num,
|
||||
cd.use_time AS useTime
|
||||
FROM cs_device_change_details cd
|
||||
LEFT JOIN ma_dev_info mdi ON mdi.type_id = cd.dev_type_id
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||
LEFT JOIN ma_type mt5 ON mt4.parent_id = mt5.type_id
|
||||
where cd.change_id = #{id} and cd.dev_type = '1' and cd.del_flag = '0'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT CONCAT(tt4.type_name, '>', tt3.type_name, '>', tt2.type_name) as category,
|
||||
tt1.type_name as typeName,
|
||||
tt.type_name as typeModelName,
|
||||
tl.manage_mode as manageType,
|
||||
IFNULL(tl.tool_code,'/') as devCode,
|
||||
tl.available_num as storageNum,
|
||||
2 as devType,
|
||||
tl.type_id as typeId,
|
||||
cd.num as num,
|
||||
cd.use_time as useTime
|
||||
FROM cs_device_change_details cd
|
||||
LEFT JOIN tool_ledger tl ON tl.type_id = cd.dev_type_id
|
||||
LEFT JOIN tool_type tt ON tl.type_id = tt.type_id
|
||||
LEFT JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
LEFT JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
LEFT JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
LEFT JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
where cd.change_id = #{id} and cd.dev_type = '2' and cd.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="getList" resultType="com.bonus.material.devchange.domain.CsDeviceInfo">
|
||||
SELECT
|
||||
id AS id,
|
||||
type AS type,
|
||||
lease_type AS leaseType,
|
||||
pro_code AS proCode,
|
||||
pro_name AS proName,
|
||||
pro_type AS proType,
|
||||
voltage_level AS voltageLevel,
|
||||
use_unit AS useUnit,
|
||||
pro_province AS proProvince,
|
||||
pro_city AS proCity,
|
||||
pro_county AS proCounty,
|
||||
use_time AS useTime,
|
||||
CODE AS CODE,
|
||||
review_status AS taskStatus,
|
||||
su.nickname AS createBy,
|
||||
cd.create_time AS createTime,
|
||||
SUM(IF( cdc.dev_type = '1', cdc.num, 0 )) AS devNum,
|
||||
SUM(IF( cdc.dev_type = '2', cdc.num, 0 )) AS toolNum
|
||||
FROM
|
||||
cs_device_change cd
|
||||
LEFT JOIN cs_device_change_details cdc ON cd.id = cdc.change_id
|
||||
LEFT JOIN sys_user su ON cd.create_user = su.user_id
|
||||
WHERE
|
||||
cdc.del_flag = '0'
|
||||
GROUP BY
|
||||
cd.id
|
||||
ORDER BY
|
||||
cd.create_time
|
||||
DESC
|
||||
</select>
|
||||
|
||||
<insert id="addChangeInfoNew" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into cs_device_change(change_status, type, lease_type, pro_code, pro_name,
|
||||
pro_type, voltage_level, use_unit, pro_province, pro_city,
|
||||
pro_county, create_time, create_user, del_flag, change_unit, code, use_time)
|
||||
values ( #{changeStatus}, #{type}, #{leaseType}, #{proCode}, #{proName}, #{proType},
|
||||
#{voltageLevel}, #{useUnit}, #{proProvince}, #{proCity}, #{proCounty},
|
||||
now(), #{createUser}, 0, #{changeUnit}, #{code}, #{useTime})
|
||||
</insert>
|
||||
|
||||
<insert id="addDetails">
|
||||
insert into cs_device_change_details(change_id, dev_code, dev_type_id, dev_type, num, use_time,
|
||||
create_user, create_time, update_user, update_time, del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.changeId},#{item.devCode},#{item.typeId},#{item.devType},#{item.num},#{item.useTime},
|
||||
#{item.createBy}, #{item.createTime},#{item.updateBy}, #{item.updateTime}, 0)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateCsDevInfo">
|
||||
update cs_device_change
|
||||
<set>
|
||||
<if test="proCode != null and proCode != ''">
|
||||
pro_code = #{proCode},
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
pro_name = #{proName},
|
||||
</if>
|
||||
<if test="proType != null and proType != ''">
|
||||
pro_type = #{proType},
|
||||
</if>
|
||||
<if test="voltageLevel != null and voltageLevel != ''">
|
||||
voltage_level = #{voltageLevel},
|
||||
</if>
|
||||
<if test="useUnit != null and useUnit != ''">
|
||||
use_unit = #{useUnit},
|
||||
</if>
|
||||
<if test="proProvince != null and proProvince != ''">
|
||||
pro_province = #{proProvince},
|
||||
</if>
|
||||
<if test="proCity != null and proCity != ''">
|
||||
pro_city = #{proCity},
|
||||
</if>
|
||||
<if test="proCounty != null and proCounty != ''">
|
||||
pro_county = #{proCounty},
|
||||
</if>
|
||||
<if test="useTime != null and useTime != ''">
|
||||
use_time = #{useTime},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_user = #{updateBy},
|
||||
</if>
|
||||
update_time = NOW()
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteChangeDetails">
|
||||
update cs_device_change_details set del_flag = '1' where change_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteChangeInfo">
|
||||
update cs_device_change set del_flag = '1' where id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue