后台维修代码提交
This commit is contained in:
parent
8f71aa835e
commit
0533581024
|
|
@ -47,6 +47,18 @@ public class BmProjectInfoController extends BaseController{
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程项目下拉选
|
||||
*/
|
||||
@ApiOperation(value = "获取工程项目下拉选")
|
||||
@GetMapping("/getProjectSelect")
|
||||
public AjaxResult getProjectSelect(BmProjectInfo bmProjectInfo)
|
||||
{
|
||||
List<BmProjectInfo> list = bmProjectInfoService.getProjectInfoAll(bmProjectInfo);
|
||||
return AjaxResult.success(list);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件进行查询
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -47,6 +47,18 @@ public class BmUnitInfoController extends BaseController{
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取往来单位下拉选
|
||||
*/
|
||||
@ApiOperation(value = "获取往来单位下拉选")
|
||||
@GetMapping("/getUnitInfoSelect")
|
||||
public AjaxResult getUnitInfoSelect(BmUnitInfo bmUnitInfo)
|
||||
{
|
||||
List<BmUnitInfo> list = bmUnitInfoService.getUnitInfoAll(bmUnitInfo);
|
||||
return AjaxResult.success(list);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件进行查询往来单位
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
* @since 2023-11-27 16:44:02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/maPartType")
|
||||
@RequestMapping("maPartType")
|
||||
public class MaPartTypeController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
|
|
@ -39,7 +39,6 @@ public class MaPartTypeController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public AjaxResult list(MaPartType maPartType)
|
||||
{
|
||||
startPage();
|
||||
List<MaPartType> list = maPartTypeService.selectMaPartList(maPartType);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,17 @@ public class MaSupplierInfoController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询供应商管理下拉选
|
||||
*/
|
||||
@ApiOperation(value = "查询供应商管理下拉选")
|
||||
@GetMapping("/getSupplierSelect")
|
||||
public AjaxResult getSupplierSelect(MaSupplierInfo maSupplierInfo)
|
||||
{
|
||||
List<MaSupplierInfo> list = maSupplierInfoService.selectMaSupplierInfoList(maSupplierInfo);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出供应商管理列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,20 +1,25 @@
|
|||
package com.bonus.sgzb.base.controller;
|
||||
|
||||
import com.bonus.sgzb.base.domain.BmProjectLot;
|
||||
import com.bonus.sgzb.base.domain.RepairTask;
|
||||
import com.bonus.sgzb.base.domain.RepairTaskDetails;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.sgzb.base.domain.*;
|
||||
import com.bonus.sgzb.base.domain.vo.TreeSelect;
|
||||
import com.bonus.sgzb.base.service.RepairService;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.sgzb.common.log.annotation.Log;
|
||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.sgzb.system.api.domain.SysUser;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
|
|
@ -52,4 +57,63 @@ public class RepairController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增维修记录
|
||||
*/
|
||||
@ApiOperation(value = "新增维修记录")
|
||||
@Log(title = "新增维修记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/submitRepairApply")
|
||||
public AjaxResult submitRepairApply(@RequestBody RepairApplyRecord bean) {
|
||||
String partStrList = bean.getPartStrList();
|
||||
List<RepairPartDetails> repairPartDetails = JSONObject.parseArray(partStrList, RepairPartDetails.class);
|
||||
bean.setPartList(repairPartDetails);
|
||||
AjaxResult ajaxResult = service.submitRepairApply(bean);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷维修记录
|
||||
*/
|
||||
@ApiOperation(value = "快捷维修记录")
|
||||
@Log(title = "快捷维修记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/fastRepairApply")
|
||||
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
|
||||
AjaxResult ajaxResult = service.fastRepairApply(list);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成维修
|
||||
*/
|
||||
@ApiOperation(value = "完成维修")
|
||||
@Log(title = "完成维修", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/completeRepair")
|
||||
public AjaxResult completeRepair(List<Long> ids) {
|
||||
|
||||
return toAjax(service.completeRepair(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交审核
|
||||
*/
|
||||
@ApiOperation(value = "提交审核")
|
||||
@Log(title = "提交审核", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/endRepairTask")
|
||||
public AjaxResult endRepairTask(List<RepairTask> taskList) {
|
||||
|
||||
return toAjax(service.endRepairTask(taskList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户下拉选
|
||||
*/
|
||||
@GetMapping("/getUserSelect")
|
||||
public AjaxResult getUserSelect()
|
||||
{
|
||||
List<SysUser> list = service.selectUserList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,125 @@
|
|||
package com.bonus.sgzb.base.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="维修任务详细")
|
||||
public class RepairApplyRecord {
|
||||
private Long id;
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private String taskId;
|
||||
/**
|
||||
* 机具ID
|
||||
*/
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private String maId;
|
||||
/**
|
||||
* 规格ID
|
||||
*/
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private String typeId;
|
||||
/**
|
||||
* 维修数量
|
||||
*/
|
||||
@ApiModelProperty(value = "维修数量")
|
||||
private int repairNum;
|
||||
/**
|
||||
* 报废数量
|
||||
*/
|
||||
@ApiModelProperty(value = "报废数量")
|
||||
private int scrapNum;
|
||||
/**
|
||||
* 维修方式(1内部2返厂3报废)
|
||||
*/
|
||||
@ApiModelProperty(value = "维修方式(1内部2返厂3报废)")
|
||||
private String repairType;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private Long createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;//
|
||||
/**
|
||||
* 报废原因
|
||||
*/
|
||||
@ApiModelProperty(value = "报废原因")
|
||||
private String scrapReason;//
|
||||
/**
|
||||
* 报废类型(0:自然报废,1任务报废)
|
||||
*/
|
||||
@ApiModelProperty(value = "报废类型(0:自然报废,1任务报废)")
|
||||
private String scrapType;
|
||||
/**
|
||||
* 返厂id
|
||||
*/
|
||||
@ApiModelProperty(value = "返厂id")
|
||||
private String supplierId;
|
||||
/**
|
||||
* 配件数量
|
||||
*/
|
||||
@ApiModelProperty(value = "配件数量")
|
||||
private int partNum;
|
||||
/**
|
||||
* 配件单价
|
||||
*/
|
||||
@ApiModelProperty(value = "配件单价")
|
||||
private String partPrice;
|
||||
/**
|
||||
* 维修内容
|
||||
*/
|
||||
@ApiModelProperty(value = "维修内容")
|
||||
private String repairContent;
|
||||
/**
|
||||
* 类型(0不收费,1收费)
|
||||
*/
|
||||
@ApiModelProperty(value = "类型(0不收费,1收费)")
|
||||
private String partType;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "配件名称")
|
||||
private String partName;
|
||||
/**
|
||||
* 维修人
|
||||
*/
|
||||
@ApiModelProperty(value = "维修人")
|
||||
private Long repairer;
|
||||
private List<RepairPartDetails> partList;
|
||||
private String partStrList;
|
||||
private Long companyId;
|
||||
/**
|
||||
* 损坏照片id
|
||||
*/
|
||||
@ApiModelProperty(value = "损坏照片id")
|
||||
private String fileId;
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.bonus.sgzb.base.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="维修配件")
|
||||
public class RepairPartDetails {
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private String taskId;
|
||||
/**
|
||||
* 机具ID
|
||||
*/
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private String maId;
|
||||
/**
|
||||
* 规格ID
|
||||
*/
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private String typeId;
|
||||
/**
|
||||
* 配件ID
|
||||
*/
|
||||
@ApiModelProperty(value = "配件ID")
|
||||
private Long partId;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "配件名称")
|
||||
private String partName;
|
||||
/**
|
||||
* 返厂id
|
||||
*/
|
||||
@ApiModelProperty(value = "返厂id")
|
||||
private String supplierId;
|
||||
/**
|
||||
* 配件数量
|
||||
*/
|
||||
@ApiModelProperty(value = "配件数量")
|
||||
private int partNum;
|
||||
/**
|
||||
* 配件费用
|
||||
*/
|
||||
@ApiModelProperty(value = "配件费用")
|
||||
private String partCost;
|
||||
/**
|
||||
* 配件单价
|
||||
*/
|
||||
@ApiModelProperty(value = "配件单价")
|
||||
private String partPrice;
|
||||
/**
|
||||
* 类型(0不收费,1收费)
|
||||
*/
|
||||
@ApiModelProperty(value = "类型(0不收费,1收费)")
|
||||
private String partType;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private Long createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;//
|
||||
/**
|
||||
* 维修内容
|
||||
*/
|
||||
@ApiModelProperty(value = "维修内容")
|
||||
private String repairContent;
|
||||
private Long companyId;
|
||||
private Long repairer;
|
||||
@ApiModelProperty(value = "维修数量")
|
||||
private int repairNum;
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class RepairTask {
|
|||
* 退料工程名称
|
||||
*/
|
||||
@ApiModelProperty(value = "退料工程名称")
|
||||
private String backProName;
|
||||
private String backPro;
|
||||
/**
|
||||
* 维修机具类型
|
||||
*/
|
||||
|
|
@ -40,7 +40,13 @@ public class RepairTask {
|
|||
* 任务创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "任务创建人")
|
||||
private String createBy;
|
||||
private Long createBy;
|
||||
/**
|
||||
* 任务创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "任务创建人")
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 任务创建时间
|
||||
*/
|
||||
|
|
@ -59,4 +65,6 @@ public class RepairTask {
|
|||
private String keyword;//关键字
|
||||
private String startTime;//开始时间
|
||||
private String endTime;//结束时间
|
||||
private String companyId;//
|
||||
private Long agreementId;//
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,47 +11,73 @@ import lombok.Data;
|
|||
@Data
|
||||
@ApiModel(value="维修任务明细")
|
||||
public class RepairTaskDetails {
|
||||
/**
|
||||
* 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 taskId;
|
||||
private String typeName;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String repairCode;
|
||||
private String type;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码")
|
||||
private String backUnit;
|
||||
private String code;
|
||||
/**
|
||||
* 待修数量
|
||||
* 维修总量
|
||||
*/
|
||||
@ApiModelProperty(value = "待修数量")
|
||||
private String repairNum;
|
||||
@ApiModelProperty(value = "维修总量")
|
||||
private int repairNum;
|
||||
/**
|
||||
* 已修数量
|
||||
* 维修合格数量
|
||||
*/
|
||||
@ApiModelProperty(value = "已修数量")
|
||||
private String repairedNum;
|
||||
@ApiModelProperty(value = "维修合格数量")
|
||||
private int repairedNum;
|
||||
/**
|
||||
* 维修报废数量
|
||||
*/
|
||||
@ApiModelProperty(value = "维修报废数量")
|
||||
private int scrapNum;
|
||||
/**
|
||||
* 待修状态
|
||||
*/
|
||||
@ApiModelProperty(value = "待修状态")
|
||||
private String status;
|
||||
/**
|
||||
* 维修人员
|
||||
* 更新者
|
||||
*/
|
||||
@ApiModelProperty(value = "维修人员")
|
||||
private String createTime;
|
||||
@ApiModelProperty(value = "更新者")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 维修时间
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "维修时间")
|
||||
private String backCode;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
/**
|
||||
* 维修人
|
||||
*/
|
||||
@ApiModelProperty(value = "维修人")
|
||||
private Long repairer;
|
||||
private String keyword;//关键字
|
||||
private String typeId;//规格ID
|
||||
private Long companyId;//规格ID
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.bonus.sgzb.base.mapper;
|
||||
|
||||
import com.bonus.sgzb.base.domain.RepairApplyRecord;
|
||||
import com.bonus.sgzb.base.domain.RepairPartDetails;
|
||||
import com.bonus.sgzb.base.domain.RepairTask;
|
||||
import com.bonus.sgzb.base.domain.RepairTaskDetails;
|
||||
import com.bonus.sgzb.system.api.domain.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -16,6 +19,34 @@ public interface RepairMapper {
|
|||
|
||||
List<RepairTask> getRepairTaskList(RepairTask bean);
|
||||
|
||||
|
||||
List<RepairTaskDetails> getRepairMaTypeList(RepairTask bean);
|
||||
|
||||
List<String> getTypeList(String taskId);
|
||||
|
||||
String getType(String typeId);
|
||||
|
||||
|
||||
int addRecord(RepairApplyRecord bean);
|
||||
|
||||
RepairTaskDetails getById(Long id);
|
||||
|
||||
int updateRepairedNum(@Param("id") Long id, @Param("repairNum")int repairNum,@Param("repairer") Long repairer,@Param("userId") Long userId);
|
||||
|
||||
int updateScrapNum(@Param("id")Long id, @Param("scrapNum")int scrapNum,@Param("userId")Long userId);
|
||||
|
||||
int addPart(RepairPartDetails partDetails);
|
||||
|
||||
int completeRepair(List<Long> ids,Long userId);
|
||||
|
||||
List<SysUser> selectUserList();
|
||||
|
||||
int updateTaskStatus(List<RepairTask> taskList, Long userid);
|
||||
|
||||
int addTask(RepairTask task);
|
||||
|
||||
Long getAgreementId(RepairTask task);
|
||||
|
||||
int createAgreementTask(RepairTask task);
|
||||
|
||||
int updateRepairedNumTwo(@Param("id")Long id, @Param("repairNum")int repairNum, @Param("userId")Long userid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
package com.bonus.sgzb.base.service;
|
||||
|
||||
import com.bonus.sgzb.base.domain.RepairApplyRecord;
|
||||
import com.bonus.sgzb.base.domain.RepairTask;
|
||||
import com.bonus.sgzb.base.domain.RepairTaskDetails;
|
||||
import com.bonus.sgzb.base.domain.vo.TreeSelect;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.system.api.domain.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -16,4 +20,15 @@ public interface RepairService {
|
|||
|
||||
|
||||
List<RepairTaskDetails> getRepairMaTypeList(RepairTask bean);
|
||||
|
||||
AjaxResult submitRepairApply(RepairApplyRecord bean);
|
||||
|
||||
|
||||
AjaxResult fastRepairApply(List<RepairTaskDetails> list);
|
||||
|
||||
int completeRepair(List<Long> ids);
|
||||
|
||||
List<SysUser> selectUserList();
|
||||
|
||||
int endRepairTask(List<RepairTask> taskList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,23 @@
|
|||
package com.bonus.sgzb.base.service.impl;
|
||||
|
||||
import com.bonus.sgzb.base.domain.RepairApplyRecord;
|
||||
import com.bonus.sgzb.base.domain.RepairPartDetails;
|
||||
import com.bonus.sgzb.base.domain.RepairTask;
|
||||
import com.bonus.sgzb.base.domain.RepairTaskDetails;
|
||||
import com.bonus.sgzb.base.domain.vo.TreeSelect;
|
||||
import com.bonus.sgzb.base.mapper.RepairMapper;
|
||||
import com.bonus.sgzb.base.service.RepairService;
|
||||
import com.bonus.sgzb.common.core.utils.SpringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.system.api.domain.SysUser;
|
||||
import com.bonus.sgzb.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
|
|
@ -21,13 +31,145 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
@Override
|
||||
public List<RepairTask> getRepairTaskList(RepairTask bean) {
|
||||
return mapper.getRepairTaskList(bean);
|
||||
List<RepairTask> repairTaskList = mapper.getRepairTaskList(bean);
|
||||
for (RepairTask repairTask : repairTaskList){
|
||||
List<String> typeList = mapper.getTypeList(repairTask.getTaskId());
|
||||
if (typeList != null && typeList.size() > 0){
|
||||
StringBuilder type = new StringBuilder();
|
||||
for (String s : typeList){
|
||||
type.append(s);
|
||||
type.append(";");
|
||||
}
|
||||
repairTask.setType(String.valueOf(type));
|
||||
}
|
||||
|
||||
}
|
||||
return repairTaskList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RepairTaskDetails> getRepairMaTypeList(RepairTask bean) {
|
||||
return mapper.getRepairMaTypeList(bean);
|
||||
List<RepairTaskDetails> repairMaTypeList = mapper.getRepairMaTypeList(bean);
|
||||
for (RepairTaskDetails repairTaskDetails : repairMaTypeList){
|
||||
String typeName = mapper.getType(repairTaskDetails.getTypeId());
|
||||
repairTaskDetails.setTypeName(typeName);
|
||||
}
|
||||
return repairMaTypeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult submitRepairApply(RepairApplyRecord bean) {
|
||||
RepairTaskDetails details = mapper.getById(bean.getId());
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
bean.setCreateBy(loginUser.getUserid());
|
||||
List<RepairPartDetails> partList = bean.getPartList();
|
||||
if (partList != null && partList.size()>0){
|
||||
bean.setRepairNum(partList.get(0).getRepairNum());
|
||||
}
|
||||
switch (bean.getRepairType()) {
|
||||
case "1":{
|
||||
int repairNum = details.getRepairedNum() + bean.getRepairNum();
|
||||
int num = repairNum + details.getScrapNum();
|
||||
if (num > details.getRepairNum()) {
|
||||
return AjaxResult.error("维修数量大于维修总量");
|
||||
}
|
||||
mapper.updateRepairedNum(bean.getId(), repairNum,bean.getRepairer(),loginUser.getUserid());
|
||||
break;
|
||||
}
|
||||
case "2": {
|
||||
int repairNum = details.getRepairedNum() + bean.getRepairNum();
|
||||
int num = repairNum + details.getScrapNum();
|
||||
if (num > details.getRepairNum()) {
|
||||
return AjaxResult.error("维修数量大于维修总量");
|
||||
}
|
||||
mapper.updateRepairedNumTwo(bean.getId(), repairNum,loginUser.getUserid());
|
||||
break;
|
||||
}
|
||||
case "3": {
|
||||
int scrapNum = details.getScrapNum() + bean.getScrapNum();
|
||||
int num = scrapNum + details.getRepairedNum();
|
||||
if (num > details.getRepairNum()) {
|
||||
return AjaxResult.error("维修数量大于维修总量");
|
||||
}
|
||||
mapper.updateScrapNum(bean.getId(), scrapNum,loginUser.getUserid());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (partList != null && partList.size()>0){
|
||||
for (RepairPartDetails partDetails : partList){
|
||||
if (partDetails.getPartId() == null && bean.getRepairType().equals("1")){
|
||||
return AjaxResult.error("请选择配件");
|
||||
}
|
||||
if (bean.getRepairType().equals("1")){
|
||||
partDetails.setTaskId(bean.getTaskId());
|
||||
partDetails.setMaId(bean.getMaId());
|
||||
partDetails.setTypeId(bean.getTypeId());
|
||||
partDetails.setCreateBy(loginUser.getUserid());
|
||||
partDetails.setCompanyId(bean.getCompanyId());
|
||||
mapper.addPart(partDetails);
|
||||
}
|
||||
}
|
||||
if (!bean.getRepairType().equals("1")){
|
||||
bean.setPartName(partList.get(0).getPartName());
|
||||
bean.setPartType(partList.get(0).getPartType());
|
||||
bean.setRepairContent(partList.get(0).getRepairContent());
|
||||
bean.setSupplierId(partList.get(0).getSupplierId());
|
||||
bean.setPartPrice(partList.get(0).getPartPrice());
|
||||
bean.setPartNum(partList.get(0).getPartNum());
|
||||
}
|
||||
bean.setRepairer(partList.get(0).getRepairer());
|
||||
}
|
||||
mapper.addRecord(bean);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
for (RepairTaskDetails bean : list){
|
||||
int repaired_num = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
|
||||
RepairApplyRecord partDetails = new RepairApplyRecord();
|
||||
partDetails.setTaskId(bean.getTaskId());
|
||||
partDetails.setMaId(bean.getMaId());
|
||||
partDetails.setTypeId(bean.getTypeId());
|
||||
partDetails.setRepairNum(repaired_num);
|
||||
partDetails.setRepairType("1");
|
||||
partDetails.setCreateBy(loginUser.getUserid());
|
||||
partDetails.setCompanyId(bean.getCompanyId());
|
||||
mapper.addRecord(partDetails);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int endRepairTask(List<RepairTask> taskList) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
int i = mapper.updateTaskStatus(taskList,loginUser.getUserid());
|
||||
for (RepairTask task : taskList){
|
||||
task.setCreateBy(loginUser.getUserid());
|
||||
Long agreementId = mapper.getAgreementId(task);
|
||||
mapper.addTask(task);
|
||||
task.setAgreementId(agreementId);
|
||||
mapper.createAgreementTask(task);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int completeRepair(List<Long> ids) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
return mapper.completeRepair(ids,loginUser.getUserid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserList() {
|
||||
return mapper.selectUserList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,175 @@
|
|||
<?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.sgzb.base.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)
|
||||
values (#{taskId},#{maId},#{typeId},#{repairNum},#{scrapNum},#{repairType},#{createBy},now(),#{repairContent},#{companyId},#{scrapReason},#{scrapType},#{supplierId},#{partNum},#{partPrice},#{partType},#{partName},#{repairer});
|
||||
</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 (45,46,#{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>
|
||||
<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.sgzb.base.domain.RepairTask">
|
||||
SELECT
|
||||
ts.task_id as taskId,
|
||||
ts.CODE AS repairCode,
|
||||
bui.unit_name AS backUnit,
|
||||
bpi.pro_name AS backProName,
|
||||
ts.create_by AS createBy,
|
||||
bpi.pro_name AS backPro,
|
||||
su.user_name AS createUser,
|
||||
ts.create_time AS createTime,
|
||||
bai.CODE AS backCode,
|
||||
CASE
|
||||
WHEN rad.radCount = rad2.radCount1 THEN '1' ELSE '0'
|
||||
END AS repairStatus
|
||||
ts.task_status AS repairStatus,
|
||||
ts.company_id AS companyId
|
||||
FROM
|
||||
tm_task ts
|
||||
LEFT JOIN ( SELECT task_id, COUNT(*) AS radCount,back_id FROM repair_apply_details GROUP BY task_id,back_id ) rad ON ts.task_id = rad.task_id
|
||||
LEFT JOIN ( SELECT task_id, COUNT(*) AS radCount1,back_id FROM repair_apply_details WHERE STATUS = '1' GROUP BY task_id,back_id ) rad2 ON ts.task_id = rad2.task_id
|
||||
LEFT JOIN repair_apply_details rad ON ts.task_id = rad.task_id
|
||||
LEFT JOIN back_apply_info bai ON rad.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_info bpi ON bai2.project_id = bpi.pro_id
|
||||
where ts.task_type = '1'
|
||||
|
||||
left join sys_user su on rad.create_by = su.user_id
|
||||
where ts.task_type = '41'
|
||||
GROUP BY ts.task_id, bui.unit_name,bpi.pro_name,bai.code,su.user_name
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (locate(#{keyword}, su.user_name) > 0
|
||||
or locate(#{keyword}, ts.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="backCode != null and backCode != ''">
|
||||
AND bai.CODE = #{backCode}
|
||||
</if>
|
||||
<if test="repairStatus != null and repairStatus != ''">
|
||||
AND ts.task_status = #{repairStatus}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND ts.create_time between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getRepairMaTypeList" resultType="com.bonus.sgzb.base.domain.RepairTaskDetails">
|
||||
|
||||
select rad.id as id,
|
||||
rad.task_id as taskId,
|
||||
rad.ma_id as maId,
|
||||
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.user_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
|
||||
where rad.task_id = #{taskId}
|
||||
</select>
|
||||
<select id="getTypeList" resultType="java.lang.String">
|
||||
SELECT
|
||||
m.type_name
|
||||
FROM
|
||||
ma_type m
|
||||
WHERE
|
||||
m.type_id IN (
|
||||
SELECT
|
||||
mt.parent_id
|
||||
FROM
|
||||
ma_type mt
|
||||
WHERE
|
||||
mt.type_id IN ( SELECT ad.type_id FROM repair_apply_details ad WHERE ad.task_id = #{taskId}))
|
||||
GROUP BY
|
||||
m.type_name
|
||||
</select>
|
||||
<select id="getType" resultType="java.lang.String">
|
||||
SELECT
|
||||
m.type_name
|
||||
FROM
|
||||
ma_type m
|
||||
WHERE
|
||||
m.type_id = (
|
||||
SELECT
|
||||
mt.parent_id
|
||||
FROM
|
||||
ma_type mt
|
||||
WHERE
|
||||
mt.type_id = #{typeId})
|
||||
</select>
|
||||
<select id="getById" resultType="com.bonus.sgzb.base.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.sgzb.system.api.domain.SysUser">
|
||||
select user_id as userId,
|
||||
nick_name as nickName
|
||||
from sys_user
|
||||
</select>
|
||||
<select id="getAgreementId" resultType="java.lang.Long">
|
||||
select agreement_id
|
||||
from tm_task_agreement
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import com.bonus.sgzb.material.service.IPurchaseCheckInfoService;
|
|||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.material.vo.NoticeInfoVO;
|
||||
import com.bonus.sgzb.system.api.RemoteUserService;
|
||||
import javafx.concurrent.Task;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue