Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
819db25805
|
|
@ -0,0 +1,153 @@
|
||||||
|
package com.bonus.material.repair.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
|
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.security.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.material.repair.domain.RepairApplyRecord;
|
||||||
|
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||||
|
import com.bonus.material.repair.domain.RepairTask;
|
||||||
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
|
import com.bonus.material.repair.service.RepairService;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author syruan
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/repair")
|
||||||
|
@Api(tags = "维修管理")
|
||||||
|
public class RepairController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RepairService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jackson -- 避免反序列化漏洞
|
||||||
|
*/
|
||||||
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修任务列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取维修任务列表")
|
||||||
|
@GetMapping("/getRepairTaskList")
|
||||||
|
@RequiresPermissions(value = "repair:manage:list")
|
||||||
|
public TableDataInfo getRepairTaskList(RepairTask bean) {
|
||||||
|
startPage();
|
||||||
|
List<RepairTask> list = service.getRepairTaskList(bean);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出维修任务列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
@RequiresPermissions("repair:manage:export")
|
||||||
|
@ApiOperation(value = "导出维修任务列表")
|
||||||
|
public void export(HttpServletResponse response, RepairTask bean) {
|
||||||
|
List<RepairTask> list = service.exportRepairTaskList(bean);
|
||||||
|
ExcelUtil<RepairTask> util = new ExcelUtil<>(RepairTask.class);
|
||||||
|
util.exportExcel(response, list, "维修任务列表");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修任务列表--APP
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取维修任务列表---APP")
|
||||||
|
@GetMapping("/getAppRepairTaskList")
|
||||||
|
@RequiresPermissions("repair:manage:list")
|
||||||
|
public AjaxResult getAppRepairTaskList(RepairTask bean) {
|
||||||
|
List<RepairTask> list = service.getRepairTaskList(bean);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修任务物资设备列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取维修物资设备列表")
|
||||||
|
@GetMapping("/getRepairMaTypeList")
|
||||||
|
@RequiresPermissions("repair:manage:preview")
|
||||||
|
public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
|
startPage();
|
||||||
|
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修任务机具列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取维修任务机具列表")
|
||||||
|
@GetMapping("/getAppRepairMaTypeList")
|
||||||
|
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
|
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修记录
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增维修记录")
|
||||||
|
@PostMapping("/submitRepairApply")
|
||||||
|
public AjaxResult submitRepairApply(@RequestBody @NotNull RepairApplyRecord bean) {
|
||||||
|
try {
|
||||||
|
String partStrList = bean.getPartStrList();
|
||||||
|
List<RepairPartDetails> repairPartDetails = objectMapper.readValue(partStrList, new TypeReference<List<RepairPartDetails>>() {});
|
||||||
|
bean.setPartList(repairPartDetails);
|
||||||
|
return service.submitRepairApply(bean);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new ServiceException("Jackson反序列化异常:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷维修记录
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "快捷维修记录")
|
||||||
|
@PostMapping("/fastRepairApply")
|
||||||
|
public AjaxResult fastRepairApply(@RequestBody List<RepairTaskDetails> list) {
|
||||||
|
return service.fastRepairApply(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成维修
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "完成维修")
|
||||||
|
@PostMapping("/completeRepair")
|
||||||
|
public AjaxResult completeRepair(@RequestBody ArrayList<Long> ids) {
|
||||||
|
return toAjax(service.completeRepair(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交审核
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "提交审核")
|
||||||
|
@PostMapping("/endRepairTask")
|
||||||
|
public AjaxResult endRepairTask(@RequestBody ArrayList<RepairTask> taskList) {
|
||||||
|
return service.endRepairTask(taskList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修员下拉选
|
||||||
|
*/
|
||||||
|
@GetMapping("/getUserSelect")
|
||||||
|
public AjaxResult getUserSelect() {
|
||||||
|
List<SysUser> list = service.selectUserList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.bonus.material.repair.domain;
|
package com.bonus.material.repair.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.bonus.common.core.annotation.Excel;
|
import com.bonus.common.core.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -41,12 +44,12 @@ public class RepairApplyRecord extends BaseEntity {
|
||||||
/** 维修数量 */
|
/** 维修数量 */
|
||||||
@Excel(name = "维修数量")
|
@Excel(name = "维修数量")
|
||||||
@ApiModelProperty(value = "维修数量")
|
@ApiModelProperty(value = "维修数量")
|
||||||
private Long repairNum;
|
private Integer repairNum;
|
||||||
|
|
||||||
/** 报废数量 */
|
/** 报废数量 */
|
||||||
@Excel(name = "报废数量")
|
@Excel(name = "报废数量")
|
||||||
@ApiModelProperty(value = "报废数量")
|
@ApiModelProperty(value = "报废数量")
|
||||||
private Long scrapNum;
|
private Integer scrapNum;
|
||||||
|
|
||||||
/** 维修方式(1内部2返厂3报废) */
|
/** 维修方式(1内部2返厂3报废) */
|
||||||
@Excel(name = "维修方式", readConverterExp = "1=内部2返厂3报废")
|
@Excel(name = "维修方式", readConverterExp = "1=内部2返厂3报废")
|
||||||
|
|
@ -74,7 +77,7 @@ public class RepairApplyRecord extends BaseEntity {
|
||||||
/** 配件数量 */
|
/** 配件数量 */
|
||||||
@Excel(name = "配件数量")
|
@Excel(name = "配件数量")
|
||||||
@ApiModelProperty(value = "配件数量")
|
@ApiModelProperty(value = "配件数量")
|
||||||
private Long partNum;
|
private Integer partNum;
|
||||||
|
|
||||||
/** 配件单价 */
|
/** 配件单价 */
|
||||||
@Excel(name = "配件单价")
|
@Excel(name = "配件单价")
|
||||||
|
|
@ -119,5 +122,10 @@ public class RepairApplyRecord extends BaseEntity {
|
||||||
@Excel(name = "是否结算", readConverterExp = "0=,未=结算,1=已结算")
|
@Excel(name = "是否结算", readConverterExp = "0=,未=结算,1=已结算")
|
||||||
private Long isSlt;
|
private Long isSlt;
|
||||||
|
|
||||||
|
/** 配件明细 */
|
||||||
|
private List<RepairPartDetails> partList = new ArrayList<>();
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配件明细string字符串")
|
||||||
|
private String partStrList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class RepairPartDetails extends BaseEntity {
|
||||||
/** 配件数量 */
|
/** 配件数量 */
|
||||||
@Excel(name = "配件数量")
|
@Excel(name = "配件数量")
|
||||||
@ApiModelProperty(value = "配件数量")
|
@ApiModelProperty(value = "配件数量")
|
||||||
private Long partNum;
|
private Integer partNum;
|
||||||
|
|
||||||
/** 配件费用 */
|
/** 配件费用 */
|
||||||
@Excel(name = "配件费用")
|
@Excel(name = "配件费用")
|
||||||
|
|
@ -67,5 +67,18 @@ public class RepairPartDetails extends BaseEntity {
|
||||||
@ApiModelProperty(value = "维修内容")
|
@ApiModelProperty(value = "维修内容")
|
||||||
private String repairContent;
|
private String repairContent;
|
||||||
|
|
||||||
|
/** 维修数量 */
|
||||||
|
private Integer repairNum;
|
||||||
|
|
||||||
|
/** 维修人员 */
|
||||||
|
private String repairer;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配件名称")
|
||||||
|
private String partName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物资厂家id")
|
||||||
|
private Long supplierId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配件价格")
|
||||||
|
private BigDecimal partPrice;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,150 @@
|
||||||
|
package com.bonus.material.repair.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author syruan
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value="维修任务")
|
||||||
|
public class RepairTask {
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "任务id")
|
||||||
|
private String taskId;
|
||||||
|
/**
|
||||||
|
* 维修单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修单号")
|
||||||
|
@Excel(name = "维修单号",sort = 1)
|
||||||
|
private String repairCode;
|
||||||
|
/**
|
||||||
|
* 退料单位名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "退料单位名称")
|
||||||
|
@Excel(name = "退料单位名称",sort = 2)
|
||||||
|
private String backUnit;
|
||||||
|
/**
|
||||||
|
* 退料工程名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "退料工程名称")
|
||||||
|
@Excel(name = "退料工程名称",sort = 3)
|
||||||
|
private String backPro;
|
||||||
|
/**
|
||||||
|
* 任务创建人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "任务创建人")
|
||||||
|
private Long createBy;
|
||||||
|
/**
|
||||||
|
* 任务创建人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "任务创建人")
|
||||||
|
@Excel(name = "任务创建人",sort = 4)
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "任务创建时间")
|
||||||
|
@Excel(name = "任务创建时间",sort = 5)
|
||||||
|
private String createTime;
|
||||||
|
/**
|
||||||
|
* 退料单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "退料单号")
|
||||||
|
@Excel(name = "退料单号",sort = 6)
|
||||||
|
private String backCode;
|
||||||
|
/**
|
||||||
|
* 维修状态
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修状态")
|
||||||
|
@Excel(name = "维修状态",sort = 7)
|
||||||
|
private String repairStatus;
|
||||||
|
/**
|
||||||
|
* 关键字
|
||||||
|
*/
|
||||||
|
private String keyword;
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private String startTime;
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "组织id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "协议id")
|
||||||
|
private Long agreementId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "维修状态编码CODE")
|
||||||
|
private String repairStatusCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修机具类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修机具类型")
|
||||||
|
@Excel(name = "维修机具类型",sort = 8)
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 规格型号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "规格型号")
|
||||||
|
@Excel(name = "规格型号",sort = 9)
|
||||||
|
private String typeName;
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "编码")
|
||||||
|
@Excel(name = "编码",sort = 10)
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 维修总量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修总量")
|
||||||
|
@Excel(name = "维修总量",sort = 11)
|
||||||
|
private int repairNum;
|
||||||
|
/**
|
||||||
|
* 维修合格数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修合格数量")
|
||||||
|
@Excel(name = "维修合格数量",sort = 12)
|
||||||
|
private int repairedNum;
|
||||||
|
/**
|
||||||
|
* 维修报废数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "报废数量")
|
||||||
|
@Excel(name = "维修报废数量",sort = 13)
|
||||||
|
private int scrapNum;
|
||||||
|
/**
|
||||||
|
* 待修状态
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "待修状态")
|
||||||
|
@Excel(name = "待修状态",sort = 14)
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 维修人员
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修人员")
|
||||||
|
@Excel(name = "维修人员",sort = 15)
|
||||||
|
private String repairer;
|
||||||
|
/**
|
||||||
|
* 维修时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修时间")
|
||||||
|
@Excel(name = "维修时间",sort = 16)
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
/** 导出选中列表 */
|
||||||
|
@ApiModelProperty(value = "导出选中列表")
|
||||||
|
private List<Long> dataCondition;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.bonus.material.repair.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author syruan
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Data
|
||||||
|
@ApiModel(value="维修任务明细")
|
||||||
|
public class RepairTaskDetails extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 任务ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "任务ID")
|
||||||
|
private String taskId;
|
||||||
|
/**
|
||||||
|
* 机具ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "机具ID")
|
||||||
|
private String maId;
|
||||||
|
/**
|
||||||
|
* 类型名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
/**
|
||||||
|
* 规格型号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "规格型号")
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "编码")
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 维修总量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修总量")
|
||||||
|
private int repairNum;
|
||||||
|
/**
|
||||||
|
* 维修合格数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修合格数量")
|
||||||
|
private int repairedNum;
|
||||||
|
/**
|
||||||
|
* 维修报废数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "维修报废数量")
|
||||||
|
private int scrapNum;
|
||||||
|
/**
|
||||||
|
* 待修状态
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "待修状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格类型id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "规格型号id")
|
||||||
|
private String typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "组织id")
|
||||||
|
private Long companyId;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.bonus.material.repair.mapper;
|
||||||
|
|
||||||
|
import com.bonus.material.repair.domain.RepairApplyRecord;
|
||||||
|
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||||
|
import com.bonus.material.repair.domain.RepairTask;
|
||||||
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author syruan
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RepairMapper {
|
||||||
|
/**
|
||||||
|
* 获取维修任务列表
|
||||||
|
* @param bean 维修任务信息--查询条件
|
||||||
|
*/
|
||||||
|
List<RepairTask> getRepairTaskList(RepairTask bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修详细列表
|
||||||
|
* @param bean 维修任务详情--查询条件
|
||||||
|
*/
|
||||||
|
List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修记录
|
||||||
|
* @param bean 维修记录信息
|
||||||
|
*/
|
||||||
|
int addRecord(RepairApplyRecord bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询维修明细
|
||||||
|
* @param id 主键key
|
||||||
|
*/
|
||||||
|
RepairTaskDetails getById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改维修数量
|
||||||
|
* @param id 主键key
|
||||||
|
* @param repairNum 维修数量
|
||||||
|
* @param repairer 维修人员
|
||||||
|
* @param userId 用户id
|
||||||
|
*/
|
||||||
|
int updateRepairedNum(@Param("id") Long id, @Param("repairNum")int repairNum,@Param("repairer") Long repairer,@Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改报废数量
|
||||||
|
* @param id 主键key
|
||||||
|
* @param scrapNum 报废数量
|
||||||
|
* @param userId 用户id
|
||||||
|
*/
|
||||||
|
int updateScrapNum(@Param("id")Long id, @Param("scrapNum")int scrapNum,@Param("userId")Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增配件维修记录
|
||||||
|
* @param partDetails 配件详情
|
||||||
|
*/
|
||||||
|
int addPart(RepairPartDetails partDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成维修--更改维修状态
|
||||||
|
* @param ids 主键集合
|
||||||
|
* @param userId 用户id
|
||||||
|
*/
|
||||||
|
int completeRepair(@Param("ids") ArrayList<Long> ids, @Param("userId")Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询维修人员列表
|
||||||
|
*/
|
||||||
|
List<SysUser> selectUserList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改维修任务状态
|
||||||
|
* @param taskList 任务列表集合
|
||||||
|
* @param userid 用户id
|
||||||
|
*/
|
||||||
|
int updateTaskStatus(@Param("taskList") List<RepairTask> taskList, @Param("userId") Long userid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增任务
|
||||||
|
* @param task 任务信息
|
||||||
|
*/
|
||||||
|
int addTask(RepairTask task);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询协议Id
|
||||||
|
* @param task 任务信息
|
||||||
|
*/
|
||||||
|
Long getAgreementId(RepairTask task);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增 协议与任务关联
|
||||||
|
* @param task 任务信息
|
||||||
|
*/
|
||||||
|
int createAgreementTask(RepairTask task);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改维修数量
|
||||||
|
* @param id 主键 key
|
||||||
|
* @param repairNum 维修数量
|
||||||
|
* @param userid 用户id
|
||||||
|
*/
|
||||||
|
int updateRepairedNumTwo(@Param("id")Long id, @Param("repairNum")int repairNum, @Param("userId")Long userid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询是否存在未完成维修的
|
||||||
|
* @param task 任务信息
|
||||||
|
*/
|
||||||
|
int getUnFinish(RepairTask task);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务Id获取维修详细
|
||||||
|
* @param task 任务信息
|
||||||
|
*/
|
||||||
|
List<RepairTaskDetails> getDetailsListByTaskId(RepairTask task);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增实验建议审核数据
|
||||||
|
* @param details 数据详情
|
||||||
|
*/
|
||||||
|
int addAuditDetails(RepairTaskDetails details);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出维修任务
|
||||||
|
*/
|
||||||
|
List<RepairTask> exportRepairTaskList(RepairTask bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修费用
|
||||||
|
*/
|
||||||
|
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配件价格
|
||||||
|
* @param partId 配件id
|
||||||
|
*/
|
||||||
|
BigDecimal selectPartPrice(Long partId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.bonus.material.repair.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.repair.domain.RepairApplyRecord;
|
||||||
|
import com.bonus.material.repair.domain.RepairTask;
|
||||||
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author syruan
|
||||||
|
*/
|
||||||
|
public interface RepairService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修任务列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairTask> getRepairTaskList(RepairTask bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取维修详细列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修记录
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult submitRepairApply(RepairApplyRecord bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快捷维修记录
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult fastRepairApply(List<RepairTaskDetails> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成维修
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int completeRepair(ArrayList<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询维修人员列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysUser> selectUserList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交审核
|
||||||
|
* @param taskList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult endRepairTask(List<RepairTask> taskList);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出维修列表
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RepairTask> exportRepairTaskList(RepairTask bean);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,231 @@
|
||||||
|
package com.bonus.material.repair.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.material.repair.domain.RepairApplyRecord;
|
||||||
|
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||||
|
import com.bonus.material.repair.domain.RepairTask;
|
||||||
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
|
import com.bonus.material.repair.mapper.RepairMapper;
|
||||||
|
import com.bonus.material.repair.service.RepairService;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
import com.bonus.system.api.model.LoginUser;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author syruan
|
||||||
|
*/
|
||||||
|
@Service("RepairService")
|
||||||
|
public class RepairServiceImpl implements RepairService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RepairMapper repairMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RepairTask> getRepairTaskList(RepairTask bean) {
|
||||||
|
return repairMapper.getRepairTaskList(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RepairTask> exportRepairTaskList(RepairTask bean) {
|
||||||
|
return repairMapper.exportRepairTaskList(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
|
//Long companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
|
bean.setCompanyId(null);
|
||||||
|
return repairMapper.getRepairMaTypeList(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修记录
|
||||||
|
* @param bean repairApplyRecord
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult submitRepairApply(RepairApplyRecord bean) {
|
||||||
|
RepairTaskDetails details = repairMapper.getById(bean.getId());
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
bean.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||||
|
List<RepairPartDetails> partList = bean.getPartList();
|
||||||
|
BigDecimal sfCosts = new BigDecimal("0");
|
||||||
|
String nbType = "1";
|
||||||
|
String fcType = "2";
|
||||||
|
String sfPart = "1";
|
||||||
|
String bsfPart = "0";
|
||||||
|
if (partList != null && !partList.isEmpty()) {
|
||||||
|
bean.setRepairNum(partList.get(0).getRepairNum());
|
||||||
|
bean.setRepairer(partList.get(0).getRepairer());
|
||||||
|
}
|
||||||
|
switch (bean.getRepairType()) {
|
||||||
|
case "1": {
|
||||||
|
int repairNum = (details.getRepairedNum() + bean.getRepairNum());
|
||||||
|
int num = repairNum + details.getScrapNum();
|
||||||
|
if (num > details.getRepairNum()) {
|
||||||
|
throw new ServiceException("维修数量大于维修总量");
|
||||||
|
}
|
||||||
|
repairMapper.updateRepairedNum(bean.getId(), repairNum, Long.valueOf(bean.getRepairer()), loginUser.getUserid());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "2": {
|
||||||
|
int repairNum = (int) (details.getRepairedNum() + bean.getRepairNum());
|
||||||
|
int num = repairNum + details.getScrapNum();
|
||||||
|
if (num > details.getRepairNum()) {
|
||||||
|
throw new ServiceException("维修数量大于维修总量");
|
||||||
|
}
|
||||||
|
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "3": {
|
||||||
|
int scrapNum = (int) (details.getScrapNum() + bean.getScrapNum());
|
||||||
|
int num = scrapNum + details.getRepairedNum();
|
||||||
|
if (num > details.getRepairNum()) {
|
||||||
|
throw new ServiceException("维修数量大于维修总量");
|
||||||
|
}
|
||||||
|
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (partList != null && !partList.isEmpty()) {
|
||||||
|
if (nbType.equals(bean.getRepairType())) {
|
||||||
|
for (RepairPartDetails partDetails : partList) {
|
||||||
|
if (partDetails.getPartId() != null) {
|
||||||
|
// 有维修配件时
|
||||||
|
if (partDetails.getPartCost() == null) {
|
||||||
|
partDetails.setPartCost(new BigDecimal(0));
|
||||||
|
}
|
||||||
|
partDetails.setTaskId(bean.getTaskId());
|
||||||
|
partDetails.setMaId(bean.getMaId());
|
||||||
|
partDetails.setTypeId(bean.getTypeId());
|
||||||
|
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||||
|
partDetails.setCompanyId(bean.getCompanyId());
|
||||||
|
// 根据partid 找到配件单价
|
||||||
|
BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId());
|
||||||
|
partDetails.setPartCost(partPrice);
|
||||||
|
repairMapper.addPart(partDetails);
|
||||||
|
bean.setPartPrice(partDetails.getPartCost());
|
||||||
|
bean.setPartId((long) partDetails.getPartId().intValue());
|
||||||
|
bean.setPartNum(partDetails.getPartNum());
|
||||||
|
bean.setRepairContent(partDetails.getRepairContent());
|
||||||
|
bean.setPartType(partDetails.getPartType());
|
||||||
|
repairMapper.addRecord(bean);
|
||||||
|
} else {
|
||||||
|
// 不选维修配件时
|
||||||
|
repairMapper.addRecord(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fcType.equals(bean.getRepairType())) {
|
||||||
|
bean.setPartName(partList.get(0).getPartName());
|
||||||
|
bean.setPartType(partList.get(0).getPartType());
|
||||||
|
bean.setRepairContent(partList.get(0).getRepairContent());
|
||||||
|
if (partList.get(0).getSupplierId() == null) {
|
||||||
|
throw new ServiceException("请选择返厂厂家");
|
||||||
|
} else {
|
||||||
|
bean.setSupplierId(partList.get(0).getSupplierId());
|
||||||
|
}
|
||||||
|
if (partList.get(0).getPartPrice() == null) {
|
||||||
|
bean.setPartPrice(new BigDecimal(0));
|
||||||
|
} else {
|
||||||
|
bean.setPartPrice(partList.get(0).getPartPrice());
|
||||||
|
}
|
||||||
|
bean.setPartNum(partList.get(0).getPartNum());
|
||||||
|
repairMapper.addRecord(bean);
|
||||||
|
}
|
||||||
|
for (RepairPartDetails partDetails : partList) {
|
||||||
|
if (partDetails.getPartCost() != null) {
|
||||||
|
BigDecimal partCost = partDetails.getPartCost();
|
||||||
|
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
|
||||||
|
sfCosts = sfCosts.add(partCost.multiply(partNumber));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!"0".equals(sfCosts.toString())) {
|
||||||
|
repairMapper.addRepairCost(bean, sfCosts, sfPart);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 新增预报废记录
|
||||||
|
repairMapper.addRecord(bean);
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
for (RepairTaskDetails bean : list) {
|
||||||
|
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
|
||||||
|
if (repairedNum <= 0) {
|
||||||
|
throw new ServiceException("选中的数据中包含待维修数量为0的机具,请重新选择");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (RepairTaskDetails bean : list) {
|
||||||
|
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
|
||||||
|
RepairApplyRecord partDetails = new RepairApplyRecord();
|
||||||
|
partDetails.setTaskId(Long.valueOf(bean.getTaskId()));
|
||||||
|
partDetails.setMaId(Long.valueOf(bean.getMaId()));
|
||||||
|
partDetails.setTypeId(Long.valueOf(bean.getTypeId()));
|
||||||
|
partDetails.setRepairNum(repairedNum);
|
||||||
|
partDetails.setRepairType("1");
|
||||||
|
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||||
|
partDetails.setCompanyId(bean.getCompanyId());
|
||||||
|
repairMapper.addRecord(partDetails);
|
||||||
|
int i = repairedNum + bean.getRepairedNum();
|
||||||
|
repairMapper.updateRepairedNumTwo(bean.getId(), i, loginUser.getUserid());
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult endRepairTask(List<RepairTask> taskList) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
for (RepairTask task : taskList) {
|
||||||
|
int i = repairMapper.getUnFinish(task);
|
||||||
|
if (i > 0) {
|
||||||
|
throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int i = repairMapper.updateTaskStatus(taskList, loginUser.getUserid());
|
||||||
|
for (RepairTask task : taskList) {
|
||||||
|
task.setCreateBy(loginUser.getUserid());
|
||||||
|
Long agreementId = repairMapper.getAgreementId(task);
|
||||||
|
List<RepairTaskDetails> detailsList = repairMapper.getDetailsListByTaskId(task);
|
||||||
|
repairMapper.addTask(task);
|
||||||
|
for (RepairTaskDetails details : detailsList) {
|
||||||
|
details.setCreateBy(String.valueOf(loginUser.getUserid()));
|
||||||
|
details.setTaskId(task.getTaskId());
|
||||||
|
repairMapper.addAuditDetails(details);
|
||||||
|
}
|
||||||
|
task.setAgreementId(agreementId);
|
||||||
|
repairMapper.createAgreementTask(task);
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int completeRepair(ArrayList<Long> ids) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
return repairMapper.completeRepair(ids, loginUser.getUserid());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUser> selectUserList() {
|
||||||
|
return repairMapper.selectUserList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,296 @@
|
||||||
|
<?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.repair.mapper.RepairMapper">
|
||||||
|
<insert id="addRecord">
|
||||||
|
insert into repair_apply_record (task_id,ma_id,type_id,repair_num,scrap_num,repair_type,create_by,create_time,repair_content,company_id,scrap_reason,scrap_type,supplier_id,part_num,part_price,part_type,part_name,repairer,file_ids,remark,part_id)
|
||||||
|
values (#{taskId},#{maId},#{typeId},#{repairNum},#{scrapNum},#{repairType},#{createBy},now(),#{repairContent},#{companyId},#{scrapReason},#{scrapType},#{supplierId},#{partNum},#{partPrice},#{partType},#{partName},#{repairer},#{fileIds},#{remark},#{partId});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="addPart">
|
||||||
|
insert into repair_part_details (task_id,ma_id,type_id,part_id,part_num,part_cost,part_type,create_by,create_time,company_id,repair_content)
|
||||||
|
values (#{taskId},#{maId},#{typeId},#{partId},#{partNum},#{partCost},#{partType},#{createBy},now(),#{companyId},#{repairContent});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="addTask" useGeneratedKeys="true" keyProperty="taskId">
|
||||||
|
insert into tm_task (task_status,task_type,code,create_by,create_time,company_id)
|
||||||
|
values (46,45,#{repairCode},#{createBy},now(),#{companyId});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="createAgreementTask">
|
||||||
|
insert into tm_task_agreement (task_id,agreement_id,create_by,create_time,company_id)
|
||||||
|
values (#{taskId},#{agreementId},#{createBy},now(),#{companyId});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="addAuditDetails">
|
||||||
|
insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status,create_by,create_time,company_id)
|
||||||
|
values (#{taskId},#{id},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},'0',#{createBy},now(),#{companyId});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="addRepairCost">
|
||||||
|
insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status,company_id)
|
||||||
|
values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0',#{bean.companyId});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateRepairedNum">
|
||||||
|
update repair_apply_details
|
||||||
|
set repaired_num = #{repairNum},
|
||||||
|
repairer = #{repairer},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateScrapNum">
|
||||||
|
update repair_apply_details
|
||||||
|
set scrap_num = #{scrapNum},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="completeRepair">
|
||||||
|
update repair_apply_details
|
||||||
|
set status = '1',
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id in
|
||||||
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateTaskStatus">
|
||||||
|
update tm_task
|
||||||
|
set task_status = '44',
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where task_id in
|
||||||
|
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||||
|
#{task.taskId}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateRepairedNumTwo">
|
||||||
|
update repair_apply_details
|
||||||
|
set repaired_num = #{repairNum},
|
||||||
|
update_by = #{userId},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getRepairTaskList" resultType="com.bonus.material.repair.domain.RepairTask">
|
||||||
|
SELECT
|
||||||
|
rd.task_id,
|
||||||
|
tt.CODE AS repairCode,
|
||||||
|
bui.unit_name AS backUnit,
|
||||||
|
bpi.lot_name AS backPro,
|
||||||
|
su.nick_name AS createName,
|
||||||
|
tt.create_time AS createTime,
|
||||||
|
bai.CODE AS backCode,
|
||||||
|
sd.name AS repairStatus,
|
||||||
|
tt.task_status AS repairStatusCode,
|
||||||
|
tt.company_id AS companyId,
|
||||||
|
GROUP_CONCAT(DISTINCT mt2.type_name) as type
|
||||||
|
FROM
|
||||||
|
repair_apply_details rd
|
||||||
|
LEFT JOIN ma_type mt on rd.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN tm_task tt on rd.task_id = tt.task_id
|
||||||
|
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON bai.task_id = tta.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
|
||||||
|
LEFT JOIN bm_unit_info bui ON bai2.unit_id = bui.unit_id
|
||||||
|
LEFT JOIN bm_project_lot bpi ON bai2.project_id = bpi.lot_id and bpi.status = '0' and bpi.del_flag = '0'
|
||||||
|
left join sys_user su on rd.create_by = su.user_id
|
||||||
|
left join sys_dic sd on sd.id = tt.task_status
|
||||||
|
where 1=1
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (locate(#{keyword}, su.nick_name) > 0
|
||||||
|
or locate(#{keyword}, tt.CODE) > 0)
|
||||||
|
</if>
|
||||||
|
<if test="backUnit != null and backUnit != ''">
|
||||||
|
AND bui.unit_id = #{backUnit}
|
||||||
|
</if>
|
||||||
|
<if test="backPro != null and backPro != ''">
|
||||||
|
AND bpi.lot_id = #{backPro}
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND mt2.type_id = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="backCode != null and backCode != ''">
|
||||||
|
AND locate(#{backCode}, bai.CODE) > 0
|
||||||
|
</if>
|
||||||
|
<if test="repairStatus != null and repairStatus != ''">
|
||||||
|
AND tt.task_status = #{repairStatus}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
AND tt.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
|
</if>
|
||||||
|
GROUP BY rd.task_id,bui.unit_name,bpi.lot_name,bai.code,su.nick_name
|
||||||
|
order by tt.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="exportRepairTaskList" resultType="com.bonus.material.repair.domain.RepairTask">
|
||||||
|
SELECT
|
||||||
|
rd.task_id,
|
||||||
|
tt.CODE AS repairCode,
|
||||||
|
bui.unit_name AS backUnit,
|
||||||
|
bpi.lot_name AS backPro,
|
||||||
|
su.nick_name AS createName,
|
||||||
|
tt.create_time AS createTime,
|
||||||
|
bai.CODE AS backCode,
|
||||||
|
sd.NAME AS repairStatus,
|
||||||
|
tt.task_status AS repairStatusCode,
|
||||||
|
tt.company_id AS companyId,
|
||||||
|
mt2.type_name AS type,
|
||||||
|
mt.type_name AS typeName,
|
||||||
|
mm.ma_code AS CODE,
|
||||||
|
rd.repair_num AS repairNum,
|
||||||
|
rd.repaired_num AS repairedNum,
|
||||||
|
rd.scrap_num AS scrapNum,
|
||||||
|
case rd.status when '0' then '未完成' when '1' then '已完成' else '' end as status,
|
||||||
|
su2.nick_name as repairer,
|
||||||
|
rd.update_time as updateTime
|
||||||
|
FROM
|
||||||
|
repair_apply_details rd
|
||||||
|
LEFT JOIN ma_type mt ON rd.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN tm_task tt ON rd.task_id = tt.task_id
|
||||||
|
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON bai.task_id = tta.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
|
||||||
|
LEFT JOIN bm_unit_info bui ON bai2.unit_id = bui.unit_id
|
||||||
|
LEFT JOIN bm_project_lot bpi ON bai2.project_id = bpi.lot_id AND bpi.STATUS = '0' AND bpi.del_flag = '0'
|
||||||
|
LEFT JOIN sys_user su ON rd.create_by = su.user_id
|
||||||
|
left join sys_user su2 on rd.repairer = su2.user_id
|
||||||
|
LEFT JOIN sys_dic sd ON sd.id = tt.task_status
|
||||||
|
LEFT JOIN ma_machine mm ON mm.ma_id = rd.ma_id
|
||||||
|
where 1=1
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (locate(#{keyword}, su.nick_name) > 0
|
||||||
|
or locate(#{keyword}, tt.CODE) > 0)
|
||||||
|
</if>
|
||||||
|
<if test="backUnit != null and backUnit != ''">
|
||||||
|
AND bui.unit_id = #{backUnit}
|
||||||
|
</if>
|
||||||
|
<if test="backPro != null and backPro != ''">
|
||||||
|
AND bpi.pro_id = #{backPro}
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND mt2.type_id = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="backCode != null and backCode != ''">
|
||||||
|
AND locate(#{backCode}, bai.CODE) > 0
|
||||||
|
</if>
|
||||||
|
<if test="repairStatus != null and repairStatus != ''">
|
||||||
|
AND tt.task_status = #{repairStatus}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
AND tt.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
|
</if>
|
||||||
|
<if test="dataCondition != null and dataCondition.size()>0">
|
||||||
|
AND rd.task_id in
|
||||||
|
<foreach collection="dataCondition" item="taskId" index="index" open="(" separator="," close=")">
|
||||||
|
#{taskId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
ORDER BY
|
||||||
|
tt.create_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRepairMaTypeList" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||||
|
select
|
||||||
|
rad.id as id,
|
||||||
|
rad.task_id as taskId,
|
||||||
|
rad.ma_id as maId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt.type_name as type,
|
||||||
|
mm.ma_code as code,
|
||||||
|
rad.repair_num as repairNum,
|
||||||
|
rad.repaired_num as repairedNum,
|
||||||
|
rad.scrap_num as scrapNum,
|
||||||
|
rad.status as status,
|
||||||
|
su.nick_name as repairer,
|
||||||
|
rad.update_time as updateTime,
|
||||||
|
rad.type_id as typeId
|
||||||
|
from repair_apply_details rad
|
||||||
|
left join ma_type mt on rad.type_id = mt.type_id
|
||||||
|
left join ma_machine mm on mm.ma_id = rad.ma_id
|
||||||
|
left join sys_user su on rad.repairer = su.user_id
|
||||||
|
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
|
where rad.task_id = #{taskId}
|
||||||
|
<if test="companyId != null and companyId != ''">
|
||||||
|
and rad.company_id = #{companyId}
|
||||||
|
</if>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (locate(#{keyword}, mm.ma_code) > 0
|
||||||
|
or locate(#{keyword}, su.nick_name) > 0
|
||||||
|
or locate(#{keyword}, mt2.type_name) > 0
|
||||||
|
or locate(#{keyword}, mt.type_name) > 0)
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND mt.type_id = #{type}
|
||||||
|
</if>
|
||||||
|
<if test="typeName != null and typeName != ''">
|
||||||
|
AND mt2.type_id = #{typeName}
|
||||||
|
</if>
|
||||||
|
order by rad.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getById" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||||
|
select rad.id as id,
|
||||||
|
rad.repair_num as repairNum,
|
||||||
|
rad.repaired_num as repairedNum,
|
||||||
|
rad.scrap_num as scrapNum
|
||||||
|
from repair_apply_details rad
|
||||||
|
where rad.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserList" resultType="com.bonus.system.api.domain.SysUser">
|
||||||
|
SELECT
|
||||||
|
su.user_id AS userId,
|
||||||
|
su.nick_name AS nickName
|
||||||
|
FROM
|
||||||
|
sys_user su
|
||||||
|
LEFT JOIN sys_user_role sur on su.user_id = sur.user_id
|
||||||
|
LEFT JOIN sys_role sr on sur.role_id = sr.role_id
|
||||||
|
WHERE sr.role_key = 'wx'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAgreementId" resultType="java.lang.Long">
|
||||||
|
select agreement_id
|
||||||
|
from tm_task_agreement
|
||||||
|
where task_id = #{taskId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getUnFinish" resultType="java.lang.Integer">
|
||||||
|
select count(*)
|
||||||
|
from repair_apply_details
|
||||||
|
where task_id = #{taskId} and status = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDicSelect" resultType="com.bonus.sgzb.base.domain.vo.DictVo">
|
||||||
|
select s2.id,
|
||||||
|
s2.name
|
||||||
|
from sys_dic s1
|
||||||
|
left join sys_dic s2 on s2.p_id = s1.id
|
||||||
|
where s1.value = #{value} and s2.status = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDetailsListByTaskId" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
|
||||||
|
select id,
|
||||||
|
ma_id as maId,
|
||||||
|
type_id as typeId,
|
||||||
|
repair_num as repairNum,
|
||||||
|
repaired_num as repairedNum,
|
||||||
|
scrap_num as scrapNum,
|
||||||
|
company_id as companyId
|
||||||
|
from repair_apply_details
|
||||||
|
where task_id = #{taskId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPartPrice" resultType="java.math.BigDecimal">
|
||||||
|
select ifnull(buy_price,0) from ma_part_type where pa_id = #{partId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue