现场维修
This commit is contained in:
parent
955147c80f
commit
3d6558f07f
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bonus.common.biz.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : mashuai
|
||||||
|
* @version : 1.0
|
||||||
|
* 退料任务状态枚举
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum FieldTaskStatusEnum {
|
||||||
|
|
||||||
|
FIELD_TASK_NO_FINISHED(0, "维修未完成"),
|
||||||
|
FIELD_TASK_TO_REJECT(1, "维修删除"),
|
||||||
|
FIELD_TASK_IN_FINISHED(2, "维修已完成");
|
||||||
|
|
||||||
|
private final Integer status;
|
||||||
|
private final String statusName;
|
||||||
|
|
||||||
|
FieldTaskStatusEnum(Integer status, String statusName) {
|
||||||
|
this.status = status;
|
||||||
|
this.statusName = statusName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
package com.bonus.material.fieldMaintenance.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.bonus.common.biz.config.ListPagingUtil;
|
||||||
|
import com.bonus.common.core.utils.ServletUtils;
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
|
import com.bonus.common.log.enums.OperaType;
|
||||||
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
import com.bonus.material.fieldMaintenance.domain.FieldApplyDetails;
|
||||||
|
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
|
||||||
|
import com.bonus.material.fieldMaintenance.service.FieldMaintenanceService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Api(tags = "现场维修接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/field_apply_info")
|
||||||
|
public class FieldMaintenanceController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private FieldMaintenanceService fieldMaintenanceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询现场维修列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询现场维修列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(FieldApplyInfo fieldApplyInfo) {
|
||||||
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||||
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||||
|
List<FieldApplyInfo> list = fieldMaintenanceService.selectFieldApplyInfoList(fieldApplyInfo);
|
||||||
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询现场维修列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询现场维修列表")
|
||||||
|
@GetMapping("/listDetails")
|
||||||
|
public AjaxResult listDetails(FieldApplyDetails fieldApplyDetails) {
|
||||||
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||||
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||||
|
List<FieldApplyDetails> list = fieldMaintenanceService.selectFieldApplyDetailsList(fieldApplyDetails);
|
||||||
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修任务app
|
||||||
|
*
|
||||||
|
* @param fieldApplyInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增任务app")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->新增现场维修任务app")
|
||||||
|
@PostMapping("/insert")
|
||||||
|
public AjaxResult insertApp(@RequestBody FieldApplyInfo fieldApplyInfo) {
|
||||||
|
try {
|
||||||
|
return fieldMaintenanceService.insert(fieldApplyInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取任务详情")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->获取任务详情")
|
||||||
|
@PostMapping("/selectFieldApplyInfoById")
|
||||||
|
public AjaxResult selectFieldApplyInfoById(@RequestBody FieldApplyInfo fieldApplyInfo) {
|
||||||
|
try {
|
||||||
|
return fieldMaintenanceService.selectFieldApplyInfoById(fieldApplyInfo.getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除任务")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->删除任务")
|
||||||
|
@PostMapping("/deleteFieldApplyInfoById")
|
||||||
|
public AjaxResult deleteFieldApplyInfoById(@RequestBody FieldApplyInfo fieldApplyInfo) {
|
||||||
|
try {
|
||||||
|
return fieldMaintenanceService.deleteFieldApplyInfoById(fieldApplyInfo.getId(), fieldApplyInfo.getTaskId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "提交任务")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->删除任务")
|
||||||
|
@PostMapping("/submitTask")
|
||||||
|
public AjaxResult submitTask(@RequestBody FieldApplyInfo fieldApplyInfo) {
|
||||||
|
try {
|
||||||
|
return fieldMaintenanceService.submitTask(fieldApplyInfo.getTaskId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.bonus.material.fieldMaintenance.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.BmFileInfo;
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.material.back.domain.MaCodeDto;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class FieldApplyDetails {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 退料单号 */
|
||||||
|
@Excel(name = "退料单号")
|
||||||
|
@ApiModelProperty(value = "退料单号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机具id")
|
||||||
|
private Long maId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机具id")
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
/** 任务ID */
|
||||||
|
@Excel(name = "任务ID")
|
||||||
|
@ApiModelProperty(value = "任务ID")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物资类型")
|
||||||
|
private String materialType;
|
||||||
|
|
||||||
|
/** 规格ID */
|
||||||
|
@Excel(name = "规格ID")
|
||||||
|
@ApiModelProperty(value = "规格ID")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格型号")
|
||||||
|
private String typeModel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "单位名称")
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "单位名称数值")
|
||||||
|
private String unitValue;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "管理方式(0编号 1计数)")
|
||||||
|
private String manageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机具编码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "机具编码")
|
||||||
|
private String maCode;
|
||||||
|
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
private String maStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机具编码集合(可能存在多个,数据库存储用逗号分割)
|
||||||
|
*/
|
||||||
|
private List<MaCodeDto> maCodeList;
|
||||||
|
|
||||||
|
/** 退料数量 */
|
||||||
|
@ApiModelProperty(value = "维修数量")
|
||||||
|
private BigDecimal preNum;
|
||||||
|
|
||||||
|
/** 审批数量 */
|
||||||
|
@ApiModelProperty(value = "审批数量")
|
||||||
|
private BigDecimal auditNum;
|
||||||
|
|
||||||
|
|
||||||
|
/** 在用数量 */
|
||||||
|
@ApiModelProperty(value = "在用数量")
|
||||||
|
private BigDecimal num;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "退料状态")
|
||||||
|
private String backStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否完成 (0:未完成退料,可以撤回 1:已完成退料,不能撤回)")
|
||||||
|
private Integer isFinished;
|
||||||
|
|
||||||
|
private String keyWord;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.bonus.material.fieldMaintenance.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class FieldApplyInfo implements Serializable {
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务ID
|
||||||
|
*/
|
||||||
|
private Long taskId;
|
||||||
|
/**
|
||||||
|
* 协议id
|
||||||
|
*/
|
||||||
|
private Long agreementId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务编号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现场维修人
|
||||||
|
*/
|
||||||
|
private String fieldPerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系方式
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
private Integer proId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String proName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位ID
|
||||||
|
*/
|
||||||
|
private Integer unitId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位名称
|
||||||
|
*/
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务状态
|
||||||
|
*/
|
||||||
|
private String taskStatus;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型ID列表(逗号分隔)
|
||||||
|
*/
|
||||||
|
private String typeIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型名称列表(逗号分隔)
|
||||||
|
*/
|
||||||
|
private String typeNames;
|
||||||
|
/**
|
||||||
|
* 关键字
|
||||||
|
*/
|
||||||
|
private String keyWord;
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private String startTime;
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private String endTime;
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Integer isValid;
|
||||||
|
/**
|
||||||
|
* 维修数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.bonus.material.fieldMaintenance.mapper;
|
||||||
|
|
||||||
|
import com.bonus.material.fieldMaintenance.domain.FieldApplyDetails;
|
||||||
|
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface FieldMaintenanceMapper {
|
||||||
|
/**
|
||||||
|
* 查询现场维修任务列表
|
||||||
|
*
|
||||||
|
* @param fieldApplyInfo 现场维修任务
|
||||||
|
* @return 现场维修任务集合
|
||||||
|
*/
|
||||||
|
List<FieldApplyInfo> selectFieldApplyInfoList(FieldApplyInfo fieldApplyInfo);
|
||||||
|
|
||||||
|
|
||||||
|
List<FieldApplyDetails> selectFieldApplyDetailsList(FieldApplyDetails fieldApplyInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id获取
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return 信息
|
||||||
|
*/
|
||||||
|
FieldApplyInfo selectFieldApplyInfoById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修任务
|
||||||
|
*
|
||||||
|
* @param fieldApplyInfo 信息
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
int insert(FieldApplyInfo fieldApplyInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
int deleteFieldApplyInfoById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.bonus.material.fieldMaintenance.service;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.back.domain.BackApplyInfo;
|
||||||
|
import com.bonus.material.fieldMaintenance.domain.FieldApplyDetails;
|
||||||
|
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface FieldMaintenanceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询现场维修任务列表
|
||||||
|
*
|
||||||
|
* @param fieldApplyInfo 现场维修任务
|
||||||
|
* @return 现场维修任务集合
|
||||||
|
*/
|
||||||
|
List<FieldApplyInfo> selectFieldApplyInfoList(FieldApplyInfo fieldApplyInfo);
|
||||||
|
|
||||||
|
List<FieldApplyDetails> selectFieldApplyDetailsList(FieldApplyDetails fieldApplyInfo);
|
||||||
|
/**
|
||||||
|
* 通过id获取
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return 信息
|
||||||
|
*/
|
||||||
|
AjaxResult selectFieldApplyInfoById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修任务
|
||||||
|
*
|
||||||
|
* @param fieldApplyInfo 信息
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
AjaxResult insert(FieldApplyInfo fieldApplyInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
AjaxResult deleteFieldApplyInfoById(Integer id, Long taskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交任务
|
||||||
|
*
|
||||||
|
* @param taskId 任务id
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
AjaxResult submitTask(Long taskId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
package com.bonus.material.fieldMaintenance.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||||
|
import com.bonus.common.biz.constant.MaterialConstants;
|
||||||
|
import com.bonus.common.biz.enums.FieldTaskStatusEnum;
|
||||||
|
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||||
|
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.fieldMaintenance.domain.FieldApplyDetails;
|
||||||
|
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
|
||||||
|
import com.bonus.material.fieldMaintenance.mapper.FieldMaintenanceMapper;
|
||||||
|
import com.bonus.material.fieldMaintenance.service.FieldMaintenanceService;
|
||||||
|
import com.bonus.material.task.domain.TmTask;
|
||||||
|
import com.bonus.material.task.domain.TmTaskAgreement;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class FieldMaintenanceImpl implements FieldMaintenanceService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FieldMaintenanceMapper fieldMaintenanceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TmTaskMapper taskMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TmTaskAgreementMapper taskAgreementMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询现场维修任务列表
|
||||||
|
*
|
||||||
|
* @param fieldApplyInfo 现场维修任务
|
||||||
|
* @return 现场维修任务集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FieldApplyInfo> selectFieldApplyInfoList(FieldApplyInfo fieldApplyInfo) {
|
||||||
|
try {
|
||||||
|
List<FieldApplyInfo> list = fieldMaintenanceMapper.selectFieldApplyInfoList(fieldApplyInfo);
|
||||||
|
// 如果列表为空,直接返回空列表
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fieldApplyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FieldApplyDetails> selectFieldApplyDetailsList(FieldApplyDetails fieldApplyDetails) {
|
||||||
|
try {
|
||||||
|
List<FieldApplyDetails> list = fieldMaintenanceMapper.selectFieldApplyDetailsList(fieldApplyDetails);
|
||||||
|
// 如果列表为空,直接返回空列表
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id获取
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return 信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult selectFieldApplyInfoById(Integer id) {
|
||||||
|
try {
|
||||||
|
return AjaxResult.success(fieldMaintenanceMapper.selectFieldApplyInfoById(id));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增维修任务
|
||||||
|
*
|
||||||
|
* @param fieldApplyInfo 信息
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult insert(FieldApplyInfo fieldApplyInfo) {
|
||||||
|
try {
|
||||||
|
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_FIELD.getTaskTypeId());
|
||||||
|
String code = genderTaskCode(thisMonthMaxOrder);
|
||||||
|
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_FIELD.getTaskTypeId(),
|
||||||
|
FieldTaskStatusEnum.FIELD_TASK_NO_FINISHED.getStatus(),
|
||||||
|
null, thisMonthMaxOrder + 1, code);
|
||||||
|
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||||
|
tmTask.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
fieldApplyInfo.setCode(code);
|
||||||
|
fieldApplyInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
fieldApplyInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
int i = taskMapper.insertTmTask(tmTask);
|
||||||
|
if (i > 0) {
|
||||||
|
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), fieldApplyInfo.getAgreementId());
|
||||||
|
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||||
|
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||||
|
fieldApplyInfo.setTaskId(tmTask.getTaskId());
|
||||||
|
fieldApplyInfo.setAgreementId(tmTaskAgreement.getAgreementId());
|
||||||
|
int insert = fieldMaintenanceMapper.insert(fieldApplyInfo);
|
||||||
|
return insert > 0 ? AjaxResult.success() : AjaxResult.error("保存失败,请重试!");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error("保存失败,请重试!");
|
||||||
|
}
|
||||||
|
return AjaxResult.error("保存失败,请重试!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult deleteFieldApplyInfoById(Integer id, Long taskId) {
|
||||||
|
try {
|
||||||
|
taskMapper.deleteTmTaskByTaskId(taskId);
|
||||||
|
int i = fieldMaintenanceMapper.deleteFieldApplyInfoById(id);
|
||||||
|
return i > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交任务
|
||||||
|
*
|
||||||
|
* @param taskId 任务id
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult submitTask(Long taskId) {
|
||||||
|
try {
|
||||||
|
int i = taskMapper.updateTaskStatus(taskId.toString(), FieldTaskStatusEnum.FIELD_TASK_IN_FINISHED.getStatus());
|
||||||
|
return i > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成现场维修任务单号
|
||||||
|
*
|
||||||
|
* @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 MaterialConstants.FIELD_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,169 @@
|
||||||
|
<?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.fieldMaintenance.mapper.FieldMaintenanceMapper">
|
||||||
|
<insert id="insert">
|
||||||
|
INSERT INTO field_apply_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">task_id,</if>
|
||||||
|
<if test="agreementId != null">agreement_id,</if>
|
||||||
|
<if test="fieldPerson != null">field_person,</if>
|
||||||
|
<if test="phone != null">phone,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">#{taskId},</if>
|
||||||
|
<if test="agreementId != null">#{agreementId},</if>
|
||||||
|
<if test="fieldPerson != null">#{fieldPerson},</if>
|
||||||
|
<if test="phone != null">#{phone},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="deleteFieldApplyInfoById" parameterType="java.lang.Integer">
|
||||||
|
UPDATE field_apply_info
|
||||||
|
SET is_valid = 0,
|
||||||
|
update_time = NOW()
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectFieldApplyInfoList"
|
||||||
|
resultType="com.bonus.material.fieldMaintenance.domain.FieldApplyInfo">
|
||||||
|
SELECT
|
||||||
|
fai.id AS id,
|
||||||
|
fai.task_id AS taskId,
|
||||||
|
fai.agreement_id AS agreementId,
|
||||||
|
tt.`code` as code,
|
||||||
|
fai.field_person AS fieldPerson,
|
||||||
|
fai.phone AS phone,
|
||||||
|
bp.pro_id AS proId,
|
||||||
|
bp.pro_name AS proName,
|
||||||
|
bu.unit_id AS unitId,
|
||||||
|
bu.unit_name AS unitName,
|
||||||
|
tt.task_status AS taskStatus,
|
||||||
|
fai.create_by AS createBy,
|
||||||
|
fai.create_time AS createTime,
|
||||||
|
mt.typeIds,
|
||||||
|
mt.typeNames,
|
||||||
|
mt.num
|
||||||
|
FROM field_apply_info fai
|
||||||
|
LEFT JOIN tm_task tt ON tt.task_id = fai.task_id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id AND bagi.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id AND bp.del_flag = '0'
|
||||||
|
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id AND bu.del_flag = '0'
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
bad.parent_id,
|
||||||
|
GROUP_CONCAT(DISTINCT mt2.type_id) AS typeIds,
|
||||||
|
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeNames,
|
||||||
|
SUM(bad.pre_num) AS num
|
||||||
|
FROM field_apply_details bad
|
||||||
|
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id AND mt1.del_flag = '0'
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0'
|
||||||
|
GROUP BY bad.parent_id
|
||||||
|
) mt ON mt.parent_id = fai.id
|
||||||
|
<where>
|
||||||
|
<if test="keyWord != null">
|
||||||
|
and (tt.`code` like concat('%', #{keyWord}, '%') or bp.pro_name like concat('%', #{keyWord}, '%')
|
||||||
|
or bu.unit_name like concat('%', #{keyWord}, '%') or fai.create_by like concat('%', #{keyWord}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
<![CDATA[and DATE_FORMAT( fai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||||
|
</if>
|
||||||
|
<if test="taskStatus != null">
|
||||||
|
and tt.task_status = #{taskStatus}
|
||||||
|
</if>
|
||||||
|
and is_valid = 1
|
||||||
|
</where>
|
||||||
|
ORDER BY fai.create_time desc
|
||||||
|
</select>
|
||||||
|
<select id="selectFieldApplyInfoById"
|
||||||
|
resultType="com.bonus.material.fieldMaintenance.domain.FieldApplyInfo">
|
||||||
|
SELECT
|
||||||
|
fai.id AS id,
|
||||||
|
fai.task_id AS taskId,
|
||||||
|
tt.`code` as code,
|
||||||
|
fai.field_person AS fieldPerson,
|
||||||
|
fai.phone AS phone,
|
||||||
|
bp.pro_id AS proId,
|
||||||
|
bp.pro_name AS proName,
|
||||||
|
bu.unit_id AS unitId,
|
||||||
|
bu.unit_name AS unitName,
|
||||||
|
tt.task_status AS taskStatus,
|
||||||
|
fai.create_by AS createBy,
|
||||||
|
fai.create_time AS createTime,
|
||||||
|
mt.typeIds,
|
||||||
|
mt.typeNames
|
||||||
|
FROM field_apply_info fai
|
||||||
|
LEFT JOIN tm_task tt ON tt.task_id = fai.task_id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id AND bagi.`status` = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id AND bp.del_flag = '0'
|
||||||
|
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id AND bu.del_flag = '0'
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
bad.parent_id,
|
||||||
|
GROUP_CONCAT(DISTINCT mt2.type_id) AS typeIds,
|
||||||
|
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeNames
|
||||||
|
FROM field_apply_details bad
|
||||||
|
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id AND mt1.del_flag = '0'
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0'
|
||||||
|
GROUP BY bad.parent_id
|
||||||
|
) mt ON mt.parent_id = fai.id
|
||||||
|
<where>
|
||||||
|
fai.id =#{id}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFieldApplyDetailsList"
|
||||||
|
resultType="com.bonus.material.fieldMaintenance.domain.FieldApplyDetails">
|
||||||
|
SELECT
|
||||||
|
fad.id AS id,
|
||||||
|
fad.CODE AS CODE,
|
||||||
|
fad.parent_id AS parentId,
|
||||||
|
fad.type_id AS typeId,
|
||||||
|
mt2.type_name AS materialType,
|
||||||
|
mt.type_name AS typeModel,
|
||||||
|
mt1.type_name AS typeName,
|
||||||
|
mt.unit_name AS unitName,
|
||||||
|
mt.unit_value AS unitValue,
|
||||||
|
mt.manage_type AS manageType,
|
||||||
|
SUM(fad.pre_num) AS preNum,
|
||||||
|
fad.use_num AS num,
|
||||||
|
fad.STATUS AS STATUS,
|
||||||
|
fad.create_by AS createBy,
|
||||||
|
fad.create_time AS createTime,
|
||||||
|
fad.update_by AS updateBy,
|
||||||
|
fad.update_time AS updateTime,
|
||||||
|
fad.remark AS remark,
|
||||||
|
fad.ap_detection AS apDetection,
|
||||||
|
fad.bad_num AS badNum,
|
||||||
|
fad.good_num AS goodNum,
|
||||||
|
mt.manage_type AS manageType
|
||||||
|
FROM
|
||||||
|
field_apply_details fad
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = fad.type_id and mt.del_flag = 0
|
||||||
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = 0
|
||||||
|
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = 0
|
||||||
|
WHERE
|
||||||
|
fad.parent_id = #{parentId}
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
mt1.type_name like concat('%', #{keyWord}, '%')
|
||||||
|
OR mt.type_name like concat('%', #{keyWord}, '%')
|
||||||
|
OR mt2.type_name like concat('%', #{keyWord}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
GROUP BY fad.type_id,mt.manage_type
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue