设备代码提交

dev
郑明梁 2 years ago
parent 76e3df3611
commit 6c66ec37ca

@ -2,6 +2,8 @@ package com.glxp.api.common.req;
import lombok.Data;
import java.util.Date;
/**
*
*/
@ -43,4 +45,8 @@ public class UpdateRequest {
*/
private String repariRemark;
private String inspectUser;
private Date expectedTime;
}

@ -58,6 +58,11 @@ public class Constant {
*/
public static final String DEVICE_INSPECT_PLAN_ORDER = "DIP";
/**
*
*/
public static final String DEVICE_INSPECT_TAKE_ORDER = "DIT";
/**
*
*/

@ -96,7 +96,7 @@ public class DeviceInspectPlanController {
if (null == updateRequest || StrUtil.isBlank(updateRequest.getOrderId())) {
return ResultVOUtils.paramVerifyFail();
}
return deviceInspectPlanService.updateStatus(updateRequest.getOrderId(), updateRequest.getStatus());
return deviceInspectPlanService.updateStatus(updateRequest.getOrderId(), updateRequest.getStatus(), updateRequest.getInspectUser(),updateRequest.getExpectedTime());
}
/**

@ -0,0 +1,105 @@
package com.glxp.api.controller.inv;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity;
import com.glxp.api.entity.inv.DeviceInspectSetEntity;
import com.glxp.api.req.inv.AddDeviceInspectSetRequest;
import com.glxp.api.res.inv.DeviceInspectSetResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.inv.DeviceInspectPlanDelectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.lucene.util.CollectionUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Slf4j
@RestController
public class DeviceInspectPlanDelectController {
@Resource
DeviceInspectPlanDelectService deviceInspectPlanDelectService;
@Resource
CustomerService customerService;
/**
*
*
* @param deviceInspectPlanDelectEntity
* @return
*/
@GetMapping("/udiwms/inv/device/inspect/plan/selectDeviceInspectPlanDelect")
public BaseResponse selectDeviceInspectPlanDelect(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
List<DeviceInspectPlanDelectEntity> deviceInspectPlanDelectEntityList = deviceInspectPlanDelectService.selectDeviceInspectPlanDelect(deviceInspectPlanDelectEntity);
return ResultVOUtils.success(deviceInspectPlanDelectEntityList);
}
/**
*
*
* @param deviceInspectPlanDelectEntity
* @return
*/
@PostMapping("/udiwms/inv/device/inspect/plan/addDeviceInspectPlanDelect")
public BaseResponse addDeviceInspectPlanDelect(@RequestBody DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
AuthAdmin authAdmin=customerService.getUserBean();
deviceInspectPlanDelectEntity.setId(IdUtil.getSnowflakeNextId());
deviceInspectPlanDelectEntity.setUpdateTime(new Date());
deviceInspectPlanDelectEntity.setUpdateUser(authAdmin.getId() + "");
Boolean falg=deviceInspectPlanDelectService.addDeviceInspectPlanDelectEntity(deviceInspectPlanDelectEntity);
if(!falg){
return ResultVOUtils.error(999,"添加失败!");
}
return ResultVOUtils.success();
}
/**
*
*
* @param deviceInspectPlanDelectEntity
* @return
*/
@PostMapping("/udiwms/inv/device/inspect/plan/uploadDeviceInspectPlanDelect")
public BaseResponse uploadDeviceInspectPlanDelect(@RequestBody DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
AuthAdmin authAdmin=customerService.getUserBean();
deviceInspectPlanDelectEntity.setUpdateTime(new Date());
deviceInspectPlanDelectEntity.setUpdateUser(authAdmin.getId() + "");
Boolean falg=deviceInspectPlanDelectService.uploadDeviceInspectPlanDelectEntity(deviceInspectPlanDelectEntity);
if(!falg){
return ResultVOUtils.error(999,"更新失败!");
}
return ResultVOUtils.success();
}
/**
*
*
* @param deviceInspectPlanDelectEntity
* @return
*/
@PostMapping("/udiwms/inv/device/inspect/plan/delectDeviceInspectPlanDelect")
public BaseResponse delectDeviceInspectPlanDelect(@RequestBody DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
Boolean falg=deviceInspectPlanDelectService.delectDeviceInspectPlanDelectEntity(deviceInspectPlanDelectEntity);
if(!falg){
return ResultVOUtils.error(999,"删除失败!");
}
return ResultVOUtils.success();
}
}

@ -0,0 +1,106 @@
package com.glxp.api.controller.inv;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.req.UpdateRequest;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity;
import com.glxp.api.entity.inv.DeviceInspectPlanEntity;
import com.glxp.api.entity.inv.DeviceInspectTaskDetailEntity;
import com.glxp.api.entity.inv.DeviceInspectTaskEntity;
import com.glxp.api.req.inv.AddDeviceInspectPlanRequest;
import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest;
import com.glxp.api.req.inv.FilterDeviceInspectTakeRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.inv.DeviceInspectPlanResponse;
import com.glxp.api.res.inv.DeviceInspectTakeResponse;
import com.glxp.api.service.inv.DeviceInspectPlanService;
import com.glxp.api.service.inv.DeviceInspectTaskDetailService;
import com.glxp.api.service.inv.DeviceInspectTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
*
*/
@Slf4j
@RestController
public class DeviceInspectTakeController {
@Resource
DeviceInspectTaskService deviceInspectTaskService;
@Resource
DeviceInspectTaskDetailService deviceInspectTaskDetailService;
/**
*
*
* @param filterDeviceInspectTakeRequest
* @return
*/
@GetMapping("/udiwms/inv/device/inspect/take/filter")
public BaseResponse filterList(FilterDeviceInspectTakeRequest filterDeviceInspectTakeRequest) {
List<DeviceInspectTakeResponse> list = deviceInspectTaskService.filterList(filterDeviceInspectTakeRequest);
PageInfo<DeviceInspectTakeResponse> pageInfo = new PageInfo<>(list);
return ResultVOUtils.page(pageInfo);
}
@PostMapping("/udiwms/inv/device/inspect/take/uploadDeviceInspecTake")
public BaseResponse uploadDeviceInspecTake(@RequestBody DeviceInspectTaskEntity deviceInspectTaskEntity) {
deviceInspectTaskEntity.setUpdateTime(new Date());
if(deviceInspectTaskEntity.getStatus() == 1){
deviceInspectTaskEntity.setStrartTime(new Date());
}else{
deviceInspectTaskEntity.setEndTime(new Date());
}
boolean falg=deviceInspectTaskService.updateById(deviceInspectTaskEntity);
if(!falg){
return ResultVOUtils.error(999,"更新失败");
}
return ResultVOUtils.success();
}
//------------------------------------------ 详情方法--------------------------------------------------------------//
@GetMapping("/udiwms/inv/device/inspect/take/detail/selectDeviceInspecTakeDetail")
public BaseResponse selectDeviceInspecTakeDetail(DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity) {
List<DeviceInspectTaskDetailEntity> deviceInspectPlanDelectEntityList = deviceInspectTaskDetailService.selectDeviceInspectTakeDetail(deviceInspectTaskDetailEntity);
return ResultVOUtils.success(deviceInspectPlanDelectEntityList);
}
@PostMapping("/udiwms/inv/device/inspect/take/detail/uploadDeviceInspecTakeDetail")
public BaseResponse uploadDeviceInspecTakeDetail(@RequestBody DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity) {
deviceInspectTaskDetailEntity.setUpdateTime(new Date());
boolean falg=deviceInspectTaskDetailService.uploadDeviceInspecTakeDetail(deviceInspectTaskDetailEntity);
if(!falg){
return ResultVOUtils.error(999,"更新失败");
}
return ResultVOUtils.success();
}
@PostMapping("/udiwms/inv/device/inspect/take/detail/addDeviceInspecTakeDetail")
public BaseResponse addDeviceInspecTakeDetail(@RequestBody DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity) {
boolean falg=deviceInspectTaskDetailService.addDeviceInspectTaskDelect(deviceInspectTaskDetailEntity);
if(!falg){
return ResultVOUtils.error(999,"更新失败");
}
return ResultVOUtils.success();
}
}

@ -0,0 +1,9 @@
package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DeviceInspectPlanDelectMapper extends BaseMapper<DeviceInspectPlanDelectEntity> {
}

@ -1,9 +1,12 @@
package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.inv.DeviceInspectTaskDetail;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.dao.purchase.PurOrderDao;
import com.glxp.api.entity.inv.DeviceInspectTaskDetailEntity;
import com.glxp.api.entity.purchase.PurOrderEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DeviceInspectTaskDetailMapper extends BaseMapper<DeviceInspectTaskDetail> {
public interface DeviceInspectTaskDetailMapper extends BaseMapperPlus<DeviceInspectTaskDetailMapper, DeviceInspectTaskDetailEntity, DeviceInspectTaskDetailEntity> {
}

@ -1,9 +1,17 @@
package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.inv.DeviceInspectTask;
import com.glxp.api.entity.inv.DeviceInspectTaskEntity;
import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest;
import com.glxp.api.req.inv.FilterDeviceInspectTakeRequest;
import com.glxp.api.res.inv.DeviceInspectPlanResponse;
import com.glxp.api.res.inv.DeviceInspectTakeResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DeviceInspectTaskMapper extends BaseMapper<DeviceInspectTask> {
public interface DeviceInspectTaskMapper extends BaseMapper<DeviceInspectTaskEntity> {
List<DeviceInspectTakeResponse> filterList(FilterDeviceInspectTakeRequest filterDeviceInspectTakeRequest);
}

@ -0,0 +1,54 @@
package com.glxp.api.entity.inv;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;
@Data
@TableName(value = "device_inspect_plan_delect")
public class DeviceInspectPlanDelectEntity {
@TableId(value = "id", type = IdType.INPUT)
private Long id;
@TableField(value = "orderIdFk")
private String orderIdFk;
/**
*
*/
@TableField(value = "code")
private String code;
/**
*
*/
@TableField(value = "content")
private String content;
/**
* 12
*/
@TableField(value = "`type`")
private Integer type;
/**
*
*/
@TableField(value = "remark")
private String remark;
/**
*
*/
@TableField(value = "updateUser")
private String updateUser;
/**
*
*/
@TableField(value = "updateTime")
private Date updateTime;
}

@ -10,7 +10,7 @@ import lombok.Data;
@Data
@TableName(value = "device_inspect_task_detail")
public class DeviceInspectTaskDetail implements Serializable {
public class DeviceInspectTaskDetailEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
private Integer id;
@ -30,7 +30,7 @@ public class DeviceInspectTaskDetail implements Serializable {
* 1234
*/
@TableField(value = "`status`")
private String status;
private Integer status;
/**
*
@ -62,5 +62,8 @@ public class DeviceInspectTaskDetail implements Serializable {
@TableField(value = "taskOrderIdFk")
private String taskOrderIdFk;
@TableField(exist = false)
private String inspectName;
private static final long serialVersionUID = 1L;
}

@ -10,7 +10,7 @@ import lombok.Data;
@Data
@TableName(value = "device_inspect_task")
public class DeviceInspectTask implements Serializable {
public class DeviceInspectTaskEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
private Integer id;
@ -45,10 +45,10 @@ public class DeviceInspectTask implements Serializable {
private String code;
/**
*
* 0 1 2
*/
@TableField(value = "`status`")
private String status;
private Integer status;
/**
*
@ -92,5 +92,8 @@ public class DeviceInspectTask implements Serializable {
@TableField(value = "updateTime")
private Date updateTime;
@TableField(value = "expectedTime")
private Date expectedTime;
private static final long serialVersionUID = 1L;
}

@ -2,6 +2,8 @@ package com.glxp.api.req.inv;
import lombok.Data;
import java.util.Date;
/**
*
*/
@ -38,4 +40,39 @@ public class AddDeviceInspectPlanRequest {
*/
private String remark;
/**
*
*/
private Date startTime;
/**
*
*/
private Date endTime;
/**
*
*/
private String frequency;
/**
* 12345 6
*/
private Integer frequencyUnit;
/**
* (1:234
*/
private Integer planStatus;
/**
*
*/
private String inspectUser;
/**
*
*/
private Date lastTime;
/**
*
*/
private Date nextTime;
}

@ -3,6 +3,8 @@ package com.glxp.api.req.inv;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
import java.util.List;
/**
*
*/
@ -41,4 +43,24 @@ public class FilterDeviceInspectPlanRequest extends ListPageRequest {
*/
private Integer status;
private List<Integer> statusList;
private Integer planStatus;
private String ksStartDate;
private String ksEndDate;
private String jsStartDate;
private String jsEndDate;
private String auditStartDate;
private String auditEndDate;
}

@ -0,0 +1,64 @@
package com.glxp.api.req.inv;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
*
*/
@Data
public class FilterDeviceInspectTakeRequest extends ListPageRequest {
private Integer id;
/**
*
*/
private String orderId;
/**
*
*/
private String deptCode;
/**
*
*/
private String invCode;
/**
*
*/
private String code;
/**
* 123
*/
private Integer level;
/**
* 123
*/
private Integer status;
private List<Integer> statusList;
private Date expectedTime;
private String ksStartDate;
private String ksEndDate;
private String jsStartDate;
private String jsEndDate;
private String yjjsStartDate;
private String yjjsEndDate;
}

@ -102,4 +102,37 @@ public class DeviceInspectPlanResponse {
*/
private String auditUserName;
/**
*
*/
private Date startTime;
/**
*
*/
private Date endTime;
/**
*
*/
private String frequency;
/**
* 12345 6
*/
private Integer frequencyUnit;
/**
* (1:234
*/
private Integer planStatus;
/**
*
*/
private String inspectUser;
/**
*
*/
private Date lastTime;
/**
*
*/
private Date nextTime;
}

@ -0,0 +1,114 @@
package com.glxp.api.res.inv;
import lombok.Data;
import java.util.Date;
/**
* VO
*/
@Data
public class DeviceInspectTakeResponse {
private Integer id;
/**
*
*/
private String orderId;
/**
*
*/
private String deptCode;
/**
*
*/
private String invCode;
/**
*
*/
private String code;
private String planOrderIdFk;
/**
* 012
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private String remark;
/**
*
*/
private String deptName;
/**
*
*/
private String invName;
/**
*
*/
private String deviceName;
/**
*
*/
private String ggxh;
/**
*
*/
private String batchNo;
/**
*
*/
private String createUserName;
/**
*
*/
private String auditUserName;
/**
*
*/
private Date strartTime;
/**
*
*/
private Date endTime;
/**
* (1:234
*/
private Integer planStatus;
/**
*
*/
private String inspectUser;
/**
*
*/
private Date remindTime;
private String inspectName;
private Date expectedTime;
}

@ -0,0 +1,20 @@
package com.glxp.api.service.inv;
import com.glxp.api.dao.inv.DeviceInspectPlanDelectMapper;
import com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.annotation.Resource;
import java.util.List;
public interface DeviceInspectPlanDelectService extends IService<DeviceInspectPlanDelectEntity> {
List<DeviceInspectPlanDelectEntity> selectDeviceInspectPlanDelect(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity);
Boolean addDeviceInspectPlanDelectEntity(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity);
Boolean uploadDeviceInspectPlanDelectEntity(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity);
Boolean delectDeviceInspectPlanDelectEntity(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity);
}

@ -6,6 +6,7 @@ import com.glxp.api.req.inv.AddDeviceInspectPlanRequest;
import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest;
import com.glxp.api.res.inv.DeviceInspectPlanResponse;
import java.util.Date;
import java.util.List;
/**
@ -52,7 +53,7 @@ public interface DeviceInspectPlanService {
* @param status
* @return
*/
BaseResponse updateStatus(String orderId, Integer status);
BaseResponse updateStatus(String orderId, Integer status, String inspectUser, Date expectedTime);
/**
*

@ -1,12 +1,60 @@
package com.glxp.api.service.inv;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.dao.inv.DeviceInspectTaskMapper;
import com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity;
import com.glxp.api.entity.inv.DeviceInspectTaskEntity;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.entity.inv.DeviceInspectTaskDetail;
import com.glxp.api.entity.inv.DeviceInspectTaskDetailEntity;
import com.glxp.api.dao.inv.DeviceInspectTaskDetailMapper;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class DeviceInspectTaskDetailService extends ServiceImpl<DeviceInspectTaskDetailMapper, DeviceInspectTaskDetail> {
public class DeviceInspectTaskDetailService extends ServiceImpl<DeviceInspectTaskDetailMapper, DeviceInspectTaskDetailEntity> {
@Resource
private DeviceInspectTaskDetailMapper deviceInspectTaskDetailMapper;
public Boolean addDeviceInspectTaskDelect(DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity){
deviceInspectTaskDetailEntity.setUpdateTime(new Date());
deviceInspectTaskDetailMapper.insert(deviceInspectTaskDetailEntity);
return true;
}
public Boolean addDeviceInspectTaskDelectList(List<DeviceInspectTaskDetailEntity> deviceInspectTaskDetailEntityList){
deviceInspectTaskDetailMapper.insertBatch(deviceInspectTaskDetailEntityList);
return true;
}
public List<DeviceInspectTaskDetailEntity> selectDeviceInspectTakeDetail(DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity) {
QueryWrapper<DeviceInspectTaskDetailEntity> ew = new QueryWrapper<>();
if(deviceInspectTaskDetailEntity.getProjectCode() != null){
ew.eq("projectCode",deviceInspectTaskDetailEntity.getProjectCode());
}
if(deviceInspectTaskDetailEntity.getId() != null){
ew.eq("id",deviceInspectTaskDetailEntity.getId());
}
if(deviceInspectTaskDetailEntity.getTaskOrderIdFk() != null){
ew.eq("taskOrderIdFk",deviceInspectTaskDetailEntity.getTaskOrderIdFk());
}
if(deviceInspectTaskDetailEntity.getStatus() != null){
ew.like("status",deviceInspectTaskDetailEntity.getStatus());
}
ew.select("*, ( SELECT `employeeName` FROM auth_user WHERE id = device_inspect_task_detail.inspectUser ) inspectName");
List<DeviceInspectTaskDetailEntity> deviceInspectPlanDelectEntities=deviceInspectTaskDetailMapper.selectList(ew);
return deviceInspectPlanDelectEntities;
}
public Boolean uploadDeviceInspecTakeDetail(DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntityList){
return deviceInspectTaskDetailMapper.updateById(deviceInspectTaskDetailEntityList) > 0 ? true : false;
}
}

@ -1,12 +1,42 @@
package com.glxp.api.service.inv;
import com.github.pagehelper.PageHelper;
import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest;
import com.glxp.api.req.inv.FilterDeviceInspectTakeRequest;
import com.glxp.api.res.inv.DeviceInspectPlanResponse;
import com.glxp.api.res.inv.DeviceInspectTakeResponse;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.inv.DeviceInspectTaskMapper;
import com.glxp.api.entity.inv.DeviceInspectTask;
import com.glxp.api.entity.inv.DeviceInspectTaskEntity;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service
public class DeviceInspectTaskService extends ServiceImpl<DeviceInspectTaskMapper, DeviceInspectTask> {
public class DeviceInspectTaskService extends ServiceImpl<DeviceInspectTaskMapper, DeviceInspectTaskEntity> {
@Resource
private DeviceInspectTaskMapper deviceInspectTaskMapper;
public Boolean addDeviceInspectTask(DeviceInspectTaskEntity deviceInspectTaskEntity){
deviceInspectTaskEntity.setUpdateTime(new Date());
deviceInspectTaskMapper.insert(deviceInspectTaskEntity);
return true;
}
public List<DeviceInspectTakeResponse> filterList(FilterDeviceInspectTakeRequest filterDeviceInspectTakeRequest) {
if (null == filterDeviceInspectTakeRequest) {
return Collections.emptyList();
}
if (null != filterDeviceInspectTakeRequest.getPage() && null != filterDeviceInspectTakeRequest.getLimit()) {
PageHelper.offsetPage((filterDeviceInspectTakeRequest.getPage() - 1) * filterDeviceInspectTakeRequest.getLimit(), filterDeviceInspectTakeRequest.getLimit());
}
return deviceInspectTaskMapper.filterList(filterDeviceInspectTakeRequest);
}
}

@ -0,0 +1,56 @@
package com.glxp.api.service.inv.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.inv.DeviceInspectPlanDelectMapper;
import com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity;
import com.glxp.api.service.inv.DeviceInspectPlanDelectService;
import javax.annotation.Resource;
import java.util.List;
@Service
public class DeviceInspectPlanDelectServiceImpl extends ServiceImpl<DeviceInspectPlanDelectMapper, DeviceInspectPlanDelectEntity> implements DeviceInspectPlanDelectService {
@Resource
DeviceInspectPlanDelectMapper deviceInspectPlanDelectMapper;
@Override
public List<DeviceInspectPlanDelectEntity> selectDeviceInspectPlanDelect(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
QueryWrapper<DeviceInspectPlanDelectEntity> ew = new QueryWrapper<>();
if(deviceInspectPlanDelectEntity.getOrderIdFk() != null){
ew.eq("orderIdFk",deviceInspectPlanDelectEntity.getOrderIdFk());
}
if(deviceInspectPlanDelectEntity.getId() != null){
ew.eq("id",deviceInspectPlanDelectEntity.getId());
}
if(deviceInspectPlanDelectEntity.getCode() != null){
ew.eq("code",deviceInspectPlanDelectEntity.getCode());
}
if(deviceInspectPlanDelectEntity.getContent() != null){
ew.like("content",deviceInspectPlanDelectEntity.getContent());
}
if(deviceInspectPlanDelectEntity.getType() != null){
ew.eq("type",deviceInspectPlanDelectEntity.getType());
}
List<DeviceInspectPlanDelectEntity> deviceInspectPlanDelectEntities=deviceInspectPlanDelectMapper.selectList(ew);
return deviceInspectPlanDelectEntities;
}
@Override
public Boolean addDeviceInspectPlanDelectEntity(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
return deviceInspectPlanDelectMapper.insert(deviceInspectPlanDelectEntity) > 0;
}
@Override
public Boolean uploadDeviceInspectPlanDelectEntity(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
return deviceInspectPlanDelectMapper.updateById(deviceInspectPlanDelectEntity) > 0;
}
@Override
public Boolean delectDeviceInspectPlanDelectEntity(DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity) {
return deviceInspectPlanDelectMapper.deleteById(deviceInspectPlanDelectEntity) > 0;
}
}

@ -2,18 +2,27 @@ package com.glxp.api.service.inv.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.Constant;
import com.glxp.api.dao.inv.DeviceInspectPlanDao;
import com.glxp.api.dao.inv.DeviceInspectPlanDelectMapper;
import com.glxp.api.dao.inv.DeviceInspectTaskDetailMapper;
import com.glxp.api.dao.inv.DeviceInspectTaskMapper;
import com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity;
import com.glxp.api.entity.inv.DeviceInspectPlanEntity;
import com.glxp.api.entity.inv.DeviceInspectTaskDetailEntity;
import com.glxp.api.entity.inv.DeviceInspectTaskEntity;
import com.glxp.api.req.inv.AddDeviceInspectPlanRequest;
import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest;
import com.glxp.api.res.inv.DeviceInspectPlanResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.inv.DeviceInspectOrderService;
import com.glxp.api.service.inv.DeviceInspectPlanService;
import com.glxp.api.service.inv.DeviceInspectTaskDetailService;
import com.glxp.api.service.inv.DeviceInspectTaskService;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import lombok.extern.slf4j.Slf4j;
@ -21,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@ -38,6 +48,12 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
private GennerOrderUtils gennerOrderUtils;
@Resource
private DeviceInspectOrderService deviceInspectOrderService;
@Resource
private DeviceInspectTaskService deviceInspectTaskService;
@Resource
private DeviceInspectPlanDelectMapper deviceInspectPlanDelectMapper;
@Resource
private DeviceInspectTaskDetailService deviceInspectTaskDetailService;
@Override
public List<DeviceInspectPlanResponse> filterList(FilterDeviceInspectPlanRequest filterDeviceInspectPlanRequest) {
@ -52,6 +68,15 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
@Override
public BaseResponse addDeviceInspectPlan(AddDeviceInspectPlanRequest deviceInspectPlanRequest) {
//判断启用状态下只有一条
QueryWrapper<DeviceInspectPlanEntity> ew = new QueryWrapper<>();
ew.eq("code", deviceInspectPlanRequest.getCode());
ew.eq("planStatus", 2);
Long count = deviceInspectPlanDao.selectCount(ew);
if (count > 0) {
return ResultVOUtils.error(999, "已存在该设备启用的计划!");
}
DeviceInspectPlanEntity deviceInspectPlanEntity = new DeviceInspectPlanEntity();
BeanUtil.copyProperties(deviceInspectPlanRequest, deviceInspectPlanEntity);
deviceInspectPlanEntity.setCreateUser(customerService.getUserIdStr());
@ -62,16 +87,27 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
deviceInspectPlanEntity.setCreateTime(date);
deviceInspectPlanEntity.setUpdateTime(date);
deviceInspectPlanDao.insert(deviceInspectPlanEntity);
return ResultVOUtils.success();
return ResultVOUtils.success(deviceInspectPlanEntity);
}
@Override
public BaseResponse updateDeviceInspectPlan(DeviceInspectPlanEntity deviceInspectPlanEntity) {
if(deviceInspectPlanEntity.getPlanStatus() == 2){
QueryWrapper<DeviceInspectPlanEntity> ew = new QueryWrapper<>();
ew.eq("code", deviceInspectPlanEntity.getCode());
ew.eq("planStatus", 2);
ew.last("limit 1");
DeviceInspectPlanEntity deviceInspectPlanEntity1 = deviceInspectPlanDao.selectOne(ew);
if (deviceInspectPlanEntity1 != null && !deviceInspectPlanEntity1.getId().equals(deviceInspectPlanEntity.getId())) {
return ResultVOUtils.error(999, "已存在该设备启用的计划!");
}
}
DeviceInspectPlanEntity deviceInspectPlan = deviceInspectPlanDao.selectById(deviceInspectPlanEntity.getId());
BeanUtil.copyProperties(deviceInspectPlanEntity, deviceInspectPlan, "id", "createTime", "createUser");
deviceInspectPlan.setUpdateTime(new Date());
deviceInspectPlanDao.updateById(deviceInspectPlan);
return ResultVOUtils.success();
return ResultVOUtils.success(deviceInspectPlan);
}
@Override
@ -87,18 +123,23 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
}
@Override
public BaseResponse updateStatus(String orderId, Integer status) {
public BaseResponse updateStatus(String orderId, Integer status, String inspectUser,Date expectedTime) {
if (StrUtil.isBlank(orderId) || null == status) {
return ResultVOUtils.paramVerifyFail();
}
DeviceInspectPlanEntity deviceInspectPlanEntity = deviceInspectPlanDao.selectByOrderId(orderId);
deviceInspectPlanEntity.setStatus(status);
deviceInspectPlanEntity.setUpdateTime(new Date());
deviceInspectPlanEntity.setInspectUser(inspectUser);
if (status == 2) {
//审核通过,生成维保单
deviceInspectOrderService.addByPlanOrderId(orderId);
deviceInspectPlanEntity.setAuditTime(new Date());
deviceInspectPlanEntity.setAuditUser(customerService.getUserIdStr());
// //审核通过,生成任务单
// deviceInspectOrderService.addByPlanOrderId(orderId);
//生成计划主表
DeviceInspectTaskEntity deviceInspectTaskEntity = getDeviceInspectTaskEntity(orderId,expectedTime);
//生成计划详情主表
getDeviceInspectTaskDetailEntity(orderId, deviceInspectTaskEntity.getOrderId());
}
deviceInspectPlanDao.updateById(deviceInspectPlanEntity);
return ResultVOUtils.success();
@ -113,4 +154,53 @@ public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
return ResultVOUtils.success();
}
//组装任务实体
public DeviceInspectTaskEntity getDeviceInspectTaskEntity(String orderId,Date expectedTime) {
//查询计划单
DeviceInspectPlanEntity deviceInspectPlanEntity = deviceInspectPlanDao.selectByOrderId(orderId);
if (deviceInspectPlanEntity == null) {
return null;
}
String takeOrderId = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.DEVICE_INSPECT_TAKE_ORDER, "yyyyMMdd"));
DeviceInspectTaskEntity deviceInspectTaskEntity = new DeviceInspectTaskEntity();
deviceInspectTaskEntity.setOrderId(takeOrderId);
deviceInspectTaskEntity.setPlanOrderIdFk(orderId);
deviceInspectTaskEntity.setExpectedTime(expectedTime);
deviceInspectTaskEntity.setDeptCode(deviceInspectPlanEntity.getDeptCode());
deviceInspectTaskEntity.setInvCode(deviceInspectPlanEntity.getInvCode());
deviceInspectTaskEntity.setCode(deviceInspectPlanEntity.getCode());
deviceInspectTaskEntity.setStatus(0);
deviceInspectTaskEntity.setInspectUser(deviceInspectPlanEntity.getInspectUser());
deviceInspectTaskEntity.setRemark(deviceInspectPlanEntity.getRemark());
deviceInspectTaskEntity.setCreateTime(new Date());
deviceInspectTaskEntity.setUpdateTime(new Date());
deviceInspectTaskService.addDeviceInspectTask(deviceInspectTaskEntity);
return deviceInspectTaskEntity;
}
//组装任务实体
public List<DeviceInspectTaskDetailEntity> getDeviceInspectTaskDetailEntity(String orderId, String taskOrderIdFk) {
//查询计划详情单
DeviceInspectPlanEntity deviceInspectPlanEntity = deviceInspectPlanDao.selectByOrderId(orderId);
List<DeviceInspectTaskDetailEntity> deviceInspectTaskDetailEntityLis = new ArrayList<>();
QueryWrapper<DeviceInspectPlanDelectEntity> ew = new QueryWrapper<>();
ew.eq("orderIdFK", orderId);
List<DeviceInspectPlanDelectEntity> deviceInspectPlanDelectEntityList = deviceInspectPlanDelectMapper.selectList(ew);
if (deviceInspectPlanDelectEntityList == null && deviceInspectPlanDelectEntityList.size() == 0) {
return null;
}
for (DeviceInspectPlanDelectEntity deviceInspectPlanDelectEntity : deviceInspectPlanDelectEntityList) {
DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity = new DeviceInspectTaskDetailEntity();
deviceInspectTaskDetailEntity.setProjectCode(deviceInspectPlanEntity.getCode());
deviceInspectTaskDetailEntity.setProjectContent(deviceInspectPlanDelectEntity.getContent());
deviceInspectTaskDetailEntity.setStatus(1);
deviceInspectTaskDetailEntity.setInspectUser(deviceInspectPlanEntity.getInspectUser());
deviceInspectTaskDetailEntity.setUpdateTime(new Date());
deviceInspectTaskDetailEntity.setTaskOrderIdFk(taskOrderIdFk);
deviceInspectTaskDetailEntityLis.add(deviceInspectTaskDetailEntity);
}
deviceInspectTaskDetailService.addDeviceInspectTaskDelectList(deviceInspectTaskDetailEntityLis);
return deviceInspectTaskDetailEntityLis;
}
}

@ -21,6 +21,14 @@
t.auditUser,
t.auditTime,
t.remark,
t.startTime,
t.endTime,
t.frequency,
t.frequencyUnit,
t.planStatus,
t.inspectUser,
t.lastTime,
t.nextTime,
(select employeeName from auth_user where id = t.createUser) createUserName,
(select employeeName from auth_user where id = t.auditUser) auditUserName,
(select `name` from auth_dept where code = t.deptCode) deptName,
@ -29,7 +37,7 @@
t1.ggxh,
t1.batchNo
from device_inspect_plan t
left join dept_device_detail t1 on t.code = t1.code
left join dept_device_detail t1 on t.code = t1.code
<where>
<if test="orderId != null and orderId != ''">
AND t.orderId like concat('%', #{orderId}, '%')
@ -49,6 +57,27 @@
<if test="status != null">
AND t.status = #{status}
</if>
<if test="planStatus != null">
AND t.planStatus = #{planStatus}
</if>
<if test="statusList != null and statusList.size()>0">
AND t.status in
<foreach close=")" collection="statusList" item="item" open="(" separator=", ">
#{item,jdbcType=INTEGER}
</foreach>
</if>
<if test="ksStartDate != null and ksStartDate != '' and ksEndDate != null and ksEndDate != ''">
AND date_format(t.startTime, '%Y-%m-%d') between date_format(#{ksStartDate},
'%Y-%m-%d') and date_format(#{ksEndDate}, '%Y-%m-%d')
</if>
<if test="jsStartDate != null and jsStartDate != '' and jsEndDate != null and jsEndDate != ''">
AND date_format(t.endTime, '%Y-%m-%d') between date_format(#{jsStartDate},
'%Y-%m-%d') and date_format(#{jsEndDate}, '%Y-%m-%d')
</if>
<if test="auditStartDate != null and auditStartDate != '' and auditEndDate != null and auditEndDate != ''">
AND date_format(t.auditTime, '%Y-%m-%d') between date_format(#{auditStartDate},
'%Y-%m-%d') and date_format(#{auditEndDate}, '%Y-%m-%d')
</if>
</where>
order by t.updateTime desc
</select>

@ -0,0 +1,16 @@
<?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.glxp.api.dao.inv.DeviceInspectPlanDelectMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.DeviceInspectPlanDelectEntity">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="orderIdFk" jdbcType="VARCHAR" property="orderIdFk" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="updateUser" jdbcType="VARCHAR" property="updateUser" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
</mapper>

@ -1,7 +1,7 @@
<?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.glxp.api.dao.inv.DeviceInspectTaskDetailMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.DeviceInspectTaskDetail">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.DeviceInspectTaskDetailEntity">
<!--@mbg.generated-->
<!--@Table device_inspect_task_detail-->
<id column="id" jdbcType="INTEGER" property="id" />

@ -1,7 +1,7 @@
<?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.glxp.api.dao.inv.DeviceInspectTaskMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.DeviceInspectTask">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.DeviceInspectTaskEntity">
<!--@mbg.generated-->
<!--@Table device_inspect_task-->
<id column="id" jdbcType="INTEGER" property="id" />
@ -24,4 +24,74 @@
id, orderId, planOrderIdFk, deptCode, invCode, code, `status`, inspectUser, remindTime,
remark, strartTime, endTime, createTime, updateTime
</sql>
<select id="filterList" resultType="com.glxp.api.res.inv.DeviceInspectTakeResponse">
select
t.id,
t.orderId,
t.planOrderIdFk,
t.deptCode,
t.invCode,
t.code,
t.status,
t.inspectUser,
t.updateTime,
t.createTime,
t.endTime,
t.strartTime,
t.remark,
t.remindTime,
t.expectedTime,
(select `name` from auth_dept where code = t.deptCode) deptName,
(select `name` from auth_warehouse where code = t.invCode) invName,
( SELECT `employeeName` FROM auth_user WHERE id = t.inspectUser ) inspectName,
t1.deviceName,
t1.ggxh,
t1.batchNo
from device_inspect_task t
left join dept_device_detail t1 on t.code = t1.code
<where>
<if test="orderId != null and orderId != ''">
AND t.orderId like concat('%', #{orderId}, '%')
</if>
<if test="deptCode != null and deptCode != ''">
AND t.deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND t.invCode = #{invCode}
</if>
<if test="code != null and code != ''">
AND t.code like concat('%', #{code}, '%')
</if>
<if test="level != null">
AND t.level = #{level}
</if>
<if test="status != null">
AND t.status = #{status}
</if>
<if test="ksStartDate != null and ksStartDate != '' and ksEndDate != null and ksEndDate != ''">
AND date_format(t.strartTime, '%Y-%m-%d') between date_format(#{ksStartDate},
'%Y-%m-%d') and date_format(#{ksEndDate}, '%Y-%m-%d')
</if>
<if test="jsStartDate != null and jsStartDate != '' and jsEndDate != null and jsEndDate != ''">
AND date_format(t.endTime, '%Y-%m-%d') between date_format(#{jsStartDate},
'%Y-%m-%d') and date_format(#{jsEndDate}, '%Y-%m-%d')
</if>
<if test="yjjsStartDate != null and yjjsStartDate != '' and yjjsEndDate != null and yjjsEndDate != ''">
AND date_format(t.expectedTime, '%Y-%m-%d') between date_format(#{yjjsStartDate},
'%Y-%m-%d') and date_format(#{yjjsEndDate}, '%Y-%m-%d')
</if>
<if test="statusList != null and statusList.size()>0">
AND t.status in
<foreach close=")" collection="statusList" item="item" open="(" separator=", ">
#{item,jdbcType=INTEGER}
</foreach>
</if>
</where>
order by t.updateTime desc
</select>
</mapper>

@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS `device_inspect_task`
`deptCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '部门',
`invCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '仓库',
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资产编码',
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态',
`status` int NULL DEFAULT NULL COMMENT '状态',
`inspectUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人',
`remindTime` datetime(0) NULL DEFAULT NULL COMMENT '提醒时间',
`remark` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检备注',
@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS `device_inspect_task`
`endTime` datetime(0) NULL DEFAULT NULL COMMENT '任务结束时间',
`createTime` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`updateTime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`expectedTime` datetime(0) NULL DEFAULT NULL COMMENT '预期结束时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
@ -30,7 +31,7 @@ CREATE TABLE IF NOT EXISTS `device_inspect_task_detail`
`id` int NOT NULL AUTO_INCREMENT,
`projectCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检项目编码',
`projectContent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检内容',
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态1未开始2已检查3异常4不巡检',
`status` int NULL DEFAULT NULL COMMENT '状态1未开始2已检查3异常4不巡检',
`result` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检结果备注',
`inspectImage` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检图片',
`inspectUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人',

Loading…
Cancel
Save