add:设备点检管理
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
|
||||
package org.nl.wms.device_manage.sportcheck.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.device_manage.sportcheck.service.DevicesportcheckmstService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-06-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "设备点检单管理")
|
||||
@RequestMapping("/api/devicesportcheckmst")
|
||||
@Slf4j
|
||||
public class DevicesportcheckmstController {
|
||||
|
||||
private final DevicesportcheckmstService devicesportcheckmstService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("点检单维护查询")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicesportcheckmstService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/query")
|
||||
@ApiOperation("点检单审核查询")
|
||||
public ResponseEntity<Object> query2(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicesportcheckmstService.query2(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("query3")
|
||||
@ApiOperation("点检单实施填报查询")
|
||||
public ResponseEntity<Object> query3(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicesportcheckmstService.query3(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增设备点检单")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckmstService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@GetMapping("/findByCode")
|
||||
@ApiOperation("查询")
|
||||
public ResponseEntity<Object> findByCode(@RequestParam Map whereJson) {
|
||||
String code = (String) whereJson.get("id");
|
||||
return new ResponseEntity<>(devicesportcheckmstService.findByCode(code), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改设备点检单")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckmstService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@ApiOperation("删除设备点检单")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
devicesportcheckmstService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getDtl")
|
||||
@ApiOperation("获取明细")
|
||||
public ResponseEntity<Object> getDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(devicesportcheckmstService.getDtl(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/putIn")
|
||||
@ApiOperation("提交")
|
||||
public ResponseEntity<Object> putIn(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckmstService.putIn(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/startMaintain")
|
||||
@ApiOperation("开始点检")
|
||||
public ResponseEntity<Object> startMaintain(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckmstService.startMaintain(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/endMaintain")
|
||||
@ApiOperation("结束点检")
|
||||
public ResponseEntity<Object> endMaintain(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckmstService.endMaintain(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/auditMaintain")
|
||||
@ApiOperation("审核")
|
||||
public ResponseEntity<Object> auditMaintain(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckmstService.auditMaintain(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/submitMain")
|
||||
@ApiOperation("保存")
|
||||
public ResponseEntity<Object> submitMain(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckmstService.submitMain(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
package org.nl.wms.device_manage.sportcheck.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.device_manage.sportcheck.service.DevicesportcheckplanmstService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-06-16
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "设备点检计划维护管理")
|
||||
@RequestMapping("/api/devicesportcheckplanmst")
|
||||
@Slf4j
|
||||
public class DevicesportcheckplanmstController {
|
||||
|
||||
private final DevicesportcheckplanmstService devicesportcheckplanmstService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询设备点检计划维护")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicesportcheckplanmstService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryDevice")
|
||||
@ApiOperation("查询设备档案")
|
||||
public ResponseEntity<Object> queryDevice(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicesportcheckplanmstService.queryDevice(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryDevice2")
|
||||
@ApiOperation("查询设备档案2")
|
||||
public ResponseEntity<Object> queryDevice2(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicesportcheckplanmstService.queryDevice2(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增设备点检计划维护")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckplanmstService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改设备点检计划维护")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckplanmstService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@ApiOperation("删除设备点检计划维护")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
devicesportcheckplanmstService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getDtl")
|
||||
@ApiOperation("获取点检明细")
|
||||
public ResponseEntity<Object> getDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(devicesportcheckplanmstService.getDtl(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@ApiOperation("修改启用状态")
|
||||
public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) {
|
||||
devicesportcheckplanmstService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/copyAdd")
|
||||
@ApiOperation("复制新增")
|
||||
public ResponseEntity<Object> copyAdd(@RequestBody JSONObject whereJson) {
|
||||
devicesportcheckplanmstService.copyAdd(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
|
||||
package org.nl.wms.device_manage.sportcheck.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.device_manage.sportcheck.service.dto.DevicesportcheckmstDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-06-17
|
||||
**/
|
||||
public interface DevicesportcheckmstService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> query2(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<DevicesportcheckmstDto>
|
||||
*/
|
||||
List<DevicesportcheckmstDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param maint_id ID
|
||||
* @return Devicemaintenancemst
|
||||
*/
|
||||
DevicesportcheckmstDto findById(Long maint_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Devicemaintenancemst
|
||||
*/
|
||||
DevicesportcheckmstDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void create(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取明细
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getDtl(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void putIn(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 开始点检
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void startMaintain(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 结束点检
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void endMaintain(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 点检执行
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void submitMain(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void auditMaintain(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> query3(Map whereJson, Pageable page);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
|
||||
package org.nl.wms.device_manage.sportcheck.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.device_manage.sportcheck.service.dto.DevicesportcheckplanmstDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-06-16
|
||||
**/
|
||||
public interface DevicesportcheckplanmstService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<DevicesportcheckplanmstDto>
|
||||
*/
|
||||
List<DevicesportcheckplanmstDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param maint_plan_id ID
|
||||
* @return Devicemaintenanceplanmst
|
||||
*/
|
||||
DevicesportcheckplanmstDto findById(Long maint_plan_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Devicemaintenanceplanmst
|
||||
*/
|
||||
DevicesportcheckplanmstDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void create(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryDevice(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryDevice2(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 获取明细
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getDtl(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 修改启用状态
|
||||
*
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
|
||||
/**
|
||||
* 复制新增
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void copyAdd(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package org.nl.wms.device_manage.sportcheck.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description /
|
||||
* @date 2022-06-17
|
||||
**/
|
||||
@Data
|
||||
public class DevicesportcheckmstDto implements Serializable {
|
||||
|
||||
/** 设备保养单标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long maint_id;
|
||||
|
||||
/**
|
||||
* 设备保养单编码
|
||||
*/
|
||||
private String maint_code;
|
||||
|
||||
/**
|
||||
* 设备档案标识
|
||||
*/
|
||||
private Long devicerecord_id;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private String maintenancecycle;
|
||||
|
||||
/**
|
||||
* 单据状态
|
||||
*/
|
||||
private String invstatus;
|
||||
|
||||
/**
|
||||
* 计划保养日期
|
||||
*/
|
||||
private String plan_start_date;
|
||||
|
||||
/**
|
||||
* 明细数
|
||||
*/
|
||||
private BigDecimal detail_count;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String real_start_date;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String real_end_date;
|
||||
|
||||
/**
|
||||
* 来源单据标识
|
||||
*/
|
||||
private Long source_bill_id;
|
||||
|
||||
/**
|
||||
* 来源单据类型
|
||||
*/
|
||||
private String source_bill_type;
|
||||
|
||||
/**
|
||||
* 来源单据编号
|
||||
*/
|
||||
private String source_bill_code;
|
||||
|
||||
/**
|
||||
* 制单人
|
||||
*/
|
||||
private Long input_optid;
|
||||
|
||||
/**
|
||||
* 制单人姓名
|
||||
*/
|
||||
private String input_optname;
|
||||
|
||||
/**
|
||||
* 制单时间
|
||||
*/
|
||||
private String input_time;
|
||||
|
||||
/**
|
||||
* 保养人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 保养人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 保养时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
*/
|
||||
private Long confirm_optid;
|
||||
|
||||
/**
|
||||
* 确认人姓名
|
||||
*/
|
||||
private String confirm_optname;
|
||||
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 审核人
|
||||
*/
|
||||
private Long audit_optid;
|
||||
|
||||
/**
|
||||
* 审核人姓名
|
||||
*/
|
||||
private String audit_optname;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private String audit_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long sysdeptid;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
private Long syscompanyid;
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package org.nl.wms.device_manage.sportcheck.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description /
|
||||
* @date 2022-06-16
|
||||
**/
|
||||
@Data
|
||||
public class DevicesportcheckplanmstDto implements Serializable {
|
||||
|
||||
/** 设备点检计划标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long maint_plan_id;
|
||||
|
||||
/**
|
||||
* 设备点检计划编码
|
||||
*/
|
||||
private String maint_plan_code;
|
||||
|
||||
/**
|
||||
* 设备点检计划名称
|
||||
*/
|
||||
private String maint_plan_name;
|
||||
|
||||
/**
|
||||
* 设备档案标识
|
||||
*/
|
||||
private Long devicerecord_id;
|
||||
|
||||
/**
|
||||
* 点检周期
|
||||
*/
|
||||
private String maintenancecycle;
|
||||
|
||||
/**
|
||||
* 点检计划开始日期
|
||||
*/
|
||||
private String plan_start_date;
|
||||
|
||||
/**
|
||||
* 明细数
|
||||
*/
|
||||
private BigDecimal detail_count;
|
||||
|
||||
/**
|
||||
* 点检实际开始日期
|
||||
*/
|
||||
private String real_start_date;
|
||||
|
||||
/**
|
||||
* 点检实际结束日期
|
||||
*/
|
||||
private String real_end_date;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 审核人
|
||||
*/
|
||||
private Long confirm_optid;
|
||||
|
||||
/**
|
||||
* 审核人姓名
|
||||
*/
|
||||
private String confirm_optname;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long sysdeptid;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
private Long syscompanyid;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
}
|
||||
@@ -0,0 +1,441 @@
|
||||
|
||||
package org.nl.wms.device_manage.sportcheck.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.device_manage.sportcheck.service.DevicesportcheckmstService;
|
||||
import org.nl.wms.device_manage.sportcheck.service.dto.DevicesportcheckmstDto;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
|
||||
import org.nl.wms.system_manage.service.dept.ISysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-06-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DevicesportcheckmstServiceImpl implements DevicesportcheckmstService {
|
||||
private final ClassstandardService classstandardService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle");
|
||||
String maint_code = MapUtil.getStr(whereJson, "maint_code");
|
||||
String invstatus = MapUtil.getStr(whereJson, "invstatus");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("maintenancecycle", maintenancecycle);
|
||||
map.put("invstatus", invstatus);
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%" + device_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(maint_code)) map.put("maint_code", "%" + maint_code + "%");
|
||||
//处理物料当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
map.put("material_type_id", material_type_id);
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICESPORTCHECK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> query2(Map whereJson, Pageable page) {
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle");
|
||||
String maint_code = MapUtil.getStr(whereJson, "maint_code");
|
||||
String invstatus = MapUtil.getStr(whereJson, "invstatus");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "3");
|
||||
map.put("maintenancecycle", maintenancecycle);
|
||||
map.put("invstatus", invstatus);
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%" + device_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(maint_code)) map.put("maint_code", "%" + maint_code + "%");
|
||||
//处理物料当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
map.put("material_type_id", material_type_id);
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICESPORTCHECK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.invstatus,mst.input_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevicesportcheckmstDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicesportcheckmstDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicesportcheckmstDto findById(Long maint_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
JSONObject json = wo.query("maint_id = '" + maint_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicesportcheckmstDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicesportcheckmstDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
JSONObject json = wo.query("maint_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicesportcheckmstDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(JSONObject whereJson) {
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("em_bi_devicesportcheckdtl");
|
||||
|
||||
// 插入主表
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst.put("maint_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonMst.put("maint_code", CodeUtil.getNewCode("SPORT_CODE"));
|
||||
jsonMst.put("devicerecord_id", whereJson.get("devicerecord_id"));
|
||||
jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle"));
|
||||
jsonMst.put("invstatus", "01");
|
||||
jsonMst.put("plan_start_date", whereJson.getString("plan_start_date"));
|
||||
jsonMst.put("detail_count", tableData.size());
|
||||
jsonMst.put("input_optid", currentUserId);
|
||||
jsonMst.put("input_optname", nickName);
|
||||
jsonMst.put("input_time", now);
|
||||
jsonMst.put("sysdeptid", 1);
|
||||
jsonMst.put("syscompanyid", 1);
|
||||
mstTab.insert(jsonMst);
|
||||
|
||||
// 插入明细表
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("maint_dtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("maint_id", jsonMst.get("maint_id"));
|
||||
jsonDtl.put("device_item_id", json.get("maint_item_id"));
|
||||
jsonDtl.put("dtl_remark", json.getString("dtl_remark"));
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("em_bi_devicesportcheckdtl");
|
||||
|
||||
// 插入主表
|
||||
JSONObject jsonMst = mstTab.query("maint_id = '" + whereJson.getString("maint_id") + "'").uniqueResult(0);
|
||||
jsonMst.put("devicerecord_id", whereJson.get("devicerecord_id"));
|
||||
jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle"));
|
||||
jsonMst.put("plan_start_date", whereJson.getString("plan_start_date"));
|
||||
jsonMst.put("detail_count", tableData.size());
|
||||
mstTab.update(jsonMst);
|
||||
|
||||
// 插入明细表
|
||||
dtlTab.delete("maint_id = '" + whereJson.getString("maint_id") + "'");
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("maint_dtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("maint_id", jsonMst.get("maint_id"));
|
||||
jsonDtl.put("device_item_id", json.get("maint_item_id"));
|
||||
jsonDtl.put("dtl_remark", json.getString("dtl_remark"));
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject mstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
for (Long maint_id : ids) {
|
||||
JSONObject json = mstTab.query("maint_id ='" + maint_id + "'").uniqueResult(0);
|
||||
if (!StrUtil.equals(json.getString("invstatus"), "01")) throw new BadRequestException("只能删除生成状态的单据");
|
||||
json.put("is_delete", "1");
|
||||
wo.update(json);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONArray getDtl(JSONObject whereJson) {
|
||||
String maint_id = whereJson.getString("maint_id");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
map.put("maint_id", maint_id);
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("EM_BIDEVICESPORTCHECK_01").addParamMap(map).process().getResultJSONArray(0);
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void putIn(JSONObject whereJson) {
|
||||
String maint_id = whereJson.getString("maint_id");
|
||||
WQLObject mstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
JSONObject jsonMst = mstTab.query("maint_id = '" + maint_id + "'").uniqueResult(0);
|
||||
jsonMst.put("invstatus", "02");
|
||||
mstTab.update(jsonMst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void startMaintain(JSONObject whereJson) {
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
WQLObject mainMstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst"); // 点检单主表
|
||||
WQLObject fileTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 设备档案表
|
||||
WQLObject lifeTab = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 设备声明周期表
|
||||
WQLObject planMstTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst"); // 设备点检计划主表
|
||||
|
||||
// 更新点检单主表
|
||||
JSONObject jsonMainMst = mainMstTab.query("maint_id = '" + whereJson.getString("maint_id") + "'").uniqueResult(0);
|
||||
jsonMainMst.put("invstatus", "03");
|
||||
jsonMainMst.put("update_optname",whereJson.getString("update_optname") );
|
||||
jsonMainMst.put("update_optname",whereJson.getString("update_optname") );
|
||||
jsonMainMst.put("real_start_date", DateUtil.now());
|
||||
mainMstTab.update(jsonMainMst);
|
||||
|
||||
// 更新设备档案表
|
||||
JSONObject jsonFile = fileTab.query("devicerecord_id ='" + jsonMainMst.getString("devicerecord_id") + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonFile)) throw new BadRequestException("此设备档案不存在");
|
||||
jsonFile.put("status", "40");
|
||||
fileTab.update(jsonFile);
|
||||
|
||||
// 插入设备声明周期表
|
||||
JSONObject jsonLife = new JSONObject();
|
||||
jsonLife.put("devicechangedtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonLife.put("devicerecord_id", jsonMainMst.get("devicerecord_id"));
|
||||
jsonLife.put("changetype", "20");
|
||||
jsonLife.put("change_id", currentUserId);
|
||||
jsonLife.put("change_name", nickName);
|
||||
jsonLife.put("change_time", DateUtil.now());
|
||||
jsonLife.put("change_reason", "点检开始");
|
||||
jsonLife.put("invtype", "点检单");
|
||||
jsonLife.put("invsid", jsonMainMst.get("maint_id"));
|
||||
jsonLife.put("invcode", jsonMainMst.getString("maint_code"));
|
||||
jsonLife.put("create_id", currentUserId);
|
||||
jsonLife.put("create_name", nickName);
|
||||
jsonLife.put("create_time", DateUtil.now());
|
||||
lifeTab.insert(jsonLife);
|
||||
|
||||
// 根据来源标识 : 为空不处理、否则更新设备点检计划表
|
||||
String source_bill_id = jsonMainMst.getString("source_bill_id");
|
||||
if (ObjectUtil.isNotEmpty(source_bill_id)) {
|
||||
JSONObject jsonPlanMst = planMstTab.query("maint_plan_id = '" + source_bill_id + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonPlanMst)) throw new BadRequestException("此设备点检计划不存在");
|
||||
jsonPlanMst.put("real_start_date", DateUtil.today());
|
||||
planMstTab.update(jsonPlanMst);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void endMaintain(JSONObject whereJson) {
|
||||
String maint_id = whereJson.getString("maint_id");
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
WQLObject mainMstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst"); // 点检单主表
|
||||
WQLObject fileTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 设备档案表
|
||||
WQLObject lifeTab = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 设备声明周期表
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("em_bi_devicesportcheckdtl");
|
||||
|
||||
this.submitMain(whereJson);
|
||||
|
||||
// 1.明细中的是否完成 :必须为全部完成
|
||||
JSONArray dtlArr = dtlTab.query("maint_id = '" + maint_id + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < dtlArr.size(); i++) {
|
||||
JSONObject json = dtlArr.getJSONObject(i);
|
||||
if (StrUtil.equals(json.getString("isfinish"), "0")) throw new BadRequestException("点检项目未完成");
|
||||
}
|
||||
|
||||
// 更新点检单主表
|
||||
JSONObject jsonMainMst = mainMstTab.query("maint_id = '" + whereJson.getString("maint_id") + "'").uniqueResult(0);
|
||||
jsonMainMst.put("invstatus", "04");
|
||||
jsonMainMst.put("real_end_date", DateUtil.now());
|
||||
mainMstTab.update(jsonMainMst);
|
||||
|
||||
// 更新设备档案表
|
||||
JSONObject jsonFile = fileTab.query("devicerecord_id ='" + jsonMainMst.getString("devicerecord_id") + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonFile)) throw new BadRequestException("此设备档案不存在");
|
||||
jsonFile.put("status", "10");
|
||||
fileTab.update(jsonFile);
|
||||
|
||||
// 插入设备声明周期表
|
||||
JSONObject jsonLife = new JSONObject();
|
||||
jsonLife.put("devicechangedtl_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonLife.put("devicerecord_id", jsonMainMst.get("devicerecord_id"));
|
||||
jsonLife.put("changetype", "21");
|
||||
jsonLife.put("change_id", currentUserId);
|
||||
jsonLife.put("change_name", nickName);
|
||||
jsonLife.put("change_time", DateUtil.now());
|
||||
jsonLife.put("change_reason", "点检结束");
|
||||
jsonLife.put("invsid", jsonMainMst.get("maint_id"));
|
||||
jsonLife.put("invcode", jsonMainMst.getString("maint_code"));
|
||||
jsonLife.put("create_id", currentUserId);
|
||||
jsonLife.put("create_name", nickName);
|
||||
jsonLife.put("create_time", DateUtil.now());
|
||||
lifeTab.insert(jsonLife);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submitMain(JSONObject whereJson) {
|
||||
String maint_id = whereJson.getString("maint_id");
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("em_bi_devicesportcheckdtl");
|
||||
|
||||
// 更新主表
|
||||
JSONObject jsonMst = mstTab.query("maint_id ='" + maint_id + "'").uniqueResult(0);
|
||||
jsonMst.put("update_optname", whereJson.getString("update_optname"));
|
||||
jsonMst.put("update_time", DateUtil.now());
|
||||
mstTab.update(jsonMst);
|
||||
|
||||
// 更新明细表
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
JSONObject jsonDtl = dtlTab.query("maint_dtl_id = '" + json.getString("maint_dtl_id") + "'").uniqueResult(0);
|
||||
jsonDtl.put("isfinish", json.getString("isfinish"));
|
||||
dtlTab.update(jsonDtl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void auditMaintain(JSONObject whereJson) {
|
||||
String maint_id = whereJson.getString("maint_id");
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("em_bi_devicesportcheckmst");
|
||||
WQLObject planMstTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst"); // 设备点检计划主表
|
||||
|
||||
// 1.更新主表
|
||||
JSONObject jsonMst = mstTab.query("maint_id = '" + maint_id + "'").uniqueResult(0);
|
||||
jsonMst.put("invstatus", "99");
|
||||
jsonMst.put("audit_optid", currentUserId);
|
||||
jsonMst.put("audit_optname", nickName);
|
||||
jsonMst.put("audit_time", DateUtil.now());
|
||||
jsonMst.put("confirm_optid", currentUserId);
|
||||
jsonMst.put("confirm_optname", nickName);
|
||||
jsonMst.put("confirm_time", DateUtil.now());
|
||||
mstTab.update(jsonMst);
|
||||
|
||||
// 2.根据来源标识 : 为空不处理、否则更新设备点检计划表
|
||||
String source_bill_id = jsonMst.getString("source_bill_id");
|
||||
if (ObjectUtil.isNotEmpty(source_bill_id)) {
|
||||
JSONObject jsonPlanMst = planMstTab.query("maint_plan_id = '" + source_bill_id + "' and is_delete = '0'").uniqueResult(0);
|
||||
// 更新点检结束日期
|
||||
if (ObjectUtil.isEmpty(jsonPlanMst)) throw new BadRequestException("此设备点检计划不存在");
|
||||
jsonPlanMst.put("real_end_date", DateUtil.today());
|
||||
// 更新点检开始日期(如果为空)
|
||||
if (ObjectUtil.isEmpty(jsonPlanMst.getString("real_start_date"))) {
|
||||
jsonPlanMst.put("real_start_date", DateUtil.today());
|
||||
}
|
||||
planMstTab.update(jsonPlanMst);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> query3(Map whereJson, Pageable page) {
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle");
|
||||
String maint_code = MapUtil.getStr(whereJson, "maint_code");
|
||||
String invstatus = MapUtil.getStr(whereJson, "invstatus");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "4");
|
||||
map.put("maintenancecycle", maintenancecycle);
|
||||
map.put("invstatus", invstatus);
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%" + device_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(maint_code)) map.put("maint_code", "%" + maint_code + "%");
|
||||
//处理物料当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
map.put("material_type_id", material_type_id);
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICESPORTCHECK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "input_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
|
||||
package org.nl.wms.device_manage.sportcheck.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.device_manage.sportcheck.service.DevicesportcheckplanmstService;
|
||||
import org.nl.wms.device_manage.sportcheck.service.dto.DevicesportcheckplanmstDto;
|
||||
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
|
||||
import org.nl.wms.system_manage.service.dept.ISysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-06-16
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DevicesportcheckplanmstServiceImpl implements DevicesportcheckplanmstService {
|
||||
private final ClassstandardService classstandardService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle");
|
||||
String maint_plan_code = MapUtil.getStr(whereJson, "maint_plan_code");
|
||||
String is_active = MapUtil.getStr(whereJson, "is_active");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
String maint_object = MapUtil.getStr(whereJson, "maint_object");
|
||||
String class_idStr = (String) whereJson.get("class_idStr");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("maintenancecycle", maintenancecycle);
|
||||
map.put("is_active", is_active);
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
map.put("maint_object", maint_object);
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(maint_plan_code)) map.put("maint_plan_code","%"+maint_plan_code+"%");
|
||||
//处理物料当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
map.put("material_type_id", material_type_id);
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICESPORTCHECKPLAN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.update_time DESC");
|
||||
JSONArray ja = json.getJSONArray("content");
|
||||
JSONArray ja2 = new JSONArray();
|
||||
for(int i=0;i<ja.size();i++){
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
String plan_start_date = jo.getString("plan_start_date");
|
||||
String real_end_date = jo.getString("real_end_date");
|
||||
String maintenancecycle2 = jo.getString("maintenancecycle");
|
||||
if(StrUtil.isEmpty(real_end_date)){
|
||||
jo.put("next_end_date",plan_start_date);
|
||||
ja2.add(jo);
|
||||
}else{
|
||||
Date real_end_date2 = DateUtil.parse(real_end_date);
|
||||
if(maintenancecycle2.equals("01")){//年
|
||||
Date next_end_date = DateUtil.offsetMonth(real_end_date2,12);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else if(maintenancecycle2.equals("02")){//月
|
||||
Date next_end_date = DateUtil.offsetMonth(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else if(maintenancecycle2.equals("03")){//周
|
||||
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
|
||||
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
|
||||
ja2.add(jo);
|
||||
}else{
|
||||
jo.put("next_end_date","");
|
||||
ja2.add(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
json.put("content",ja2);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevicesportcheckplanmstDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicesportcheckplanmstDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicesportcheckplanmstDto findById(Long maint_plan_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
JSONObject json = wo.query("maint_plan_id = '" + maint_plan_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicesportcheckplanmstDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicesportcheckplanmstDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicesportcheckplanmstDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(JSONObject whereJson) {
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanDtl");
|
||||
|
||||
// 校验:相同的设备、周期只能存在一个
|
||||
JSONObject jsonObject = mstTab.query("devicerecord_id = '" + whereJson.getString("devicerecord_id") + "' and maintenancecycle = '" + whereJson.getString("maintenancecycle") + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("该设备当前周期计划已经存在");
|
||||
|
||||
// 插入主表
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst.put("maint_plan_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonMst.put("maint_plan_code", CodeUtil.getNewCode("SPORT_PLAN_CODE"));
|
||||
jsonMst.put("maint_plan_name", whereJson.getString("maint_plan_name"));
|
||||
jsonMst.put("devicerecord_id", whereJson.getString("devicerecord_id"));
|
||||
jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle"));
|
||||
jsonMst.put("plan_start_date", whereJson.getString("plan_start_date"));
|
||||
jsonMst.put("maint_object", whereJson.getString("maint_object"));
|
||||
jsonMst.put("detail_count", tableData.size());
|
||||
jsonMst.put("create_id", currentUserId);
|
||||
jsonMst.put("create_name", nickName);
|
||||
jsonMst.put("create_time", now);
|
||||
jsonMst.put("update_optid", currentUserId);
|
||||
jsonMst.put("update_optname", nickName);
|
||||
jsonMst.put("update_time", now);
|
||||
jsonMst.put("remark", whereJson.getString("remark"));
|
||||
jsonMst.put("sysdeptid", 1);
|
||||
jsonMst.put("syscompanyid", 1);
|
||||
mstTab.insert(jsonMst);
|
||||
// 插入明细
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("maint_plan_dtl_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonDtl.put("maint_plan_id", jsonMst.get("maint_plan_id"));
|
||||
jsonDtl.put("maint_item_id", json.get("maint_item_id"));
|
||||
jsonDtl.put("dtl_remark", json.getString("dtl_remark"));
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanDtl");
|
||||
|
||||
// 更新主表
|
||||
JSONObject jsonMst = mstTab.query("maint_plan_id = '" + whereJson.getString("maint_plan_id") + "'").uniqueResult(0);
|
||||
jsonMst.put("maint_plan_name", whereJson.getString("maint_plan_name"));
|
||||
jsonMst.put("devicerecord_id", whereJson.getString("devicerecord_id"));
|
||||
jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle"));
|
||||
jsonMst.put("plan_start_date", whereJson.getString("plan_start_date"));
|
||||
jsonMst.put("maint_object", whereJson.getString("maint_object"));
|
||||
jsonMst.put("detail_count", tableData.size());
|
||||
jsonMst.put("update_optid", currentUserId);
|
||||
jsonMst.put("update_optname", nickName);
|
||||
jsonMst.put("update_time", now);
|
||||
jsonMst.put("remark", whereJson.getString("remark"));
|
||||
jsonMst.put("sysdeptid", 1);
|
||||
jsonMst.put("syscompanyid", 1);
|
||||
mstTab.update(jsonMst);
|
||||
// 插入明细
|
||||
if (ObjectUtil.isNotEmpty(tableData)) {
|
||||
dtlTab.delete("maint_plan_id = '"+whereJson.getString("maint_plan_id")+"'");
|
||||
}
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("maint_plan_dtl_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonDtl.put("maint_plan_id", jsonMst.get("maint_plan_id"));
|
||||
jsonDtl.put("maint_item_id", json.get("maint_item_id"));
|
||||
jsonDtl.put("dtl_remark", json.getString("dtl_remark"));
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
|
||||
JSONArray jsonObject = mstTab.query("devicerecord_id = '" + whereJson.getString("devicerecord_id") + "' and maintenancecycle = '" + whereJson.getString("maintenancecycle") + "' and is_delete = '0'").getResultJSONArray(0);
|
||||
if (jsonObject.size() > 1) throw new BadRequestException("该设备当前周期计划已经存在");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
for (Long maint_plan_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("maint_plan_id", String.valueOf(maint_plan_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, Object> queryDevice(Map whereJson, Pageable page) {
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
// 查询设备档案
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%"+device_code+"%");
|
||||
|
||||
String dept_id = MapUtil.getStr(whereJson, "dept_id");
|
||||
if (!StrUtil.isEmpty(dept_id)) {
|
||||
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
|
||||
map.put("deptIds", deptIds);
|
||||
}
|
||||
|
||||
String use_id = MapUtil.getStr(whereJson, "use_id");
|
||||
if (!StrUtil.isEmpty(use_id)) {
|
||||
String useIds = deptService.getChildIdStr(Long.parseLong(use_id));
|
||||
map.put("useIds", useIds);
|
||||
}
|
||||
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICESPORTCHECKPLAN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.update_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDevice2(Map whereJson, Pageable page) {
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
// 查询设备档案
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "4");
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%"+device_code+"%");
|
||||
|
||||
String dept_id = MapUtil.getStr(whereJson, "dept_id");
|
||||
if (!StrUtil.isEmpty(dept_id)) {
|
||||
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
|
||||
map.put("deptIds", deptIds);
|
||||
}
|
||||
|
||||
String use_id = MapUtil.getStr(whereJson, "use_id");
|
||||
if (!StrUtil.isEmpty(use_id)) {
|
||||
String useIds = deptService.getChildIdStr(Long.parseLong(use_id));
|
||||
map.put("useIds", useIds);
|
||||
}
|
||||
|
||||
// 如果班组为空 则默认当前用户部门
|
||||
/* if (ObjectUtil.isEmpty(use_id) && ObjectUtil.isEmpty(dept_id)) {
|
||||
// 获取当前登陆用户
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
JSONObject jsonUser = WQLObject.getWQLObject("sys_user").query("user_id = '" + currentUserId + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonUser)) {
|
||||
String dept_str = deptService.getChildIdStr(jsonUser.getLong("dept_id"));
|
||||
if (ObjectUtil.isNotEmpty(dept_str)) {
|
||||
map.put("dept_str",dept_str);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICESPORTCHECKPLAN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.update_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONArray getDtl(JSONObject whereJson) {
|
||||
String maint_plan_id = whereJson.getString("maint_plan_id");
|
||||
JSONArray resultJSONArray = WQL.getWO("EM_BIDEVICESPORTCHECKPLAN_01").addParam("flag", "3").addParam("maint_plan_id", maint_plan_id).process().getResultJSONArray(0);
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(JSONObject whereJson) {
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
JSONObject json = tab.query("maint_plan_id = '" + whereJson.getString("maint_plan_id") + "'").uniqueResult(0);
|
||||
String is_active = "1";
|
||||
if (StrUtil.equals("1", json.getString("is_active"))) {
|
||||
is_active = "0";
|
||||
json.put("confirm_optid", "");
|
||||
json.put("confirm_optname", "");
|
||||
json.put("confirm_time", "");
|
||||
} else {
|
||||
json.put("confirm_optid", currentUserId);
|
||||
json.put("confirm_optname", nickName);
|
||||
json.put("confirm_time", now);
|
||||
}
|
||||
json.put("is_active", is_active);
|
||||
tab.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void copyAdd(JSONObject whereJson) {
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanMst");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceSportCheckPlanDtl");
|
||||
|
||||
// 校验:相同的设备、周期只能存在一个
|
||||
JSONObject jsonObject = mstTab.query("devicerecord_id = '" + whereJson.getString("devicerecord_id") + "' and maintenancecycle = '" + whereJson.getString("maintenancecycle") + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此计划的周期只能存在一个");
|
||||
|
||||
// 插入主表
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst.put("maint_plan_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonMst.put("maint_plan_code", CodeUtil.getNewCode("MAINT_PLAN_CODE"));
|
||||
jsonMst.put("maint_plan_name", whereJson.getString("maint_plan_name"));
|
||||
jsonMst.put("devicerecord_id", whereJson.getString("devicerecord_id"));
|
||||
jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle"));
|
||||
jsonMst.put("plan_start_date", whereJson.getString("plan_start_date"));
|
||||
jsonMst.put("maint_object", whereJson.getString("maint_object"));
|
||||
jsonMst.put("detail_count", tableData.size());
|
||||
jsonMst.put("create_id", currentUserId);
|
||||
jsonMst.put("create_name", nickName);
|
||||
jsonMst.put("create_time", now);
|
||||
jsonMst.put("update_optid", currentUserId);
|
||||
jsonMst.put("update_optname", nickName);
|
||||
jsonMst.put("update_time", now);
|
||||
jsonMst.put("remark", whereJson.getString("remark"));
|
||||
jsonMst.put("sysdeptid", 1);
|
||||
jsonMst.put("syscompanyid", 1);
|
||||
mstTab.insert(jsonMst);
|
||||
// 插入明细
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("maint_plan_dtl_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonDtl.put("maint_plan_id", jsonMst.get("maint_plan_id"));
|
||||
jsonDtl.put("maint_item_id", json.get("maint_item_id"));
|
||||
jsonDtl.put("dtl_remark", json.getString("dtl_remark"));
|
||||
dtlTab.insert(jsonDtl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
[交易说明]
|
||||
交易名: 设备点检计划维护分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.classIds TYPEAS f_string
|
||||
输入.dept_str TYPEAS f_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
输入.useIds TYPEAS f_string
|
||||
输入.device_code TYPEAS s_string
|
||||
输入.maintenancecycle TYPEAS s_string
|
||||
输入.maint_plan_id TYPEAS s_string
|
||||
输入.maint_plan_code TYPEAS s_string
|
||||
输入.is_active TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.maint_object TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
mst.*,
|
||||
class.class_name,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
file.extend_code
|
||||
FROM
|
||||
EM_BI_DeviceSportCheckPlanMst mst
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maint_plan_code <> ""
|
||||
(mst.maint_plan_code like 输入.maint_plan_code or
|
||||
mst.maint_plan_name like 输入.maint_plan_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maintenancecycle <> ""
|
||||
mst.maintenancecycle = 输入.maintenancecycle
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.is_active <> ""
|
||||
mst.is_active = 输入.is_active
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
mst.plan_start_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
mst.plan_start_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maint_object <> ""
|
||||
mst.maint_object = 输入.maint_object
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
file.*,
|
||||
class.class_name,
|
||||
work.workprocedure_name,
|
||||
d1.name AS dept_name,
|
||||
d2.name AS use_name
|
||||
FROM
|
||||
EM_BI_EquipmentFile file
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN pdm_bi_workprocedure work ON file.workprocedure_id = work.workprocedure_id
|
||||
LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id
|
||||
LEFT JOIN sys_dept d2 ON file.use_deptid = d2.dept_id
|
||||
WHERE
|
||||
file.is_delete = '0'
|
||||
AND file.status not in (90,91)
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.deptIds <> ""
|
||||
d1.dept_id in 输入.deptIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.useIds <> ""
|
||||
d2.dept_id in 输入.useIds
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
dtl.maint_plan_dtl_id,
|
||||
dtl.maint_plan_id,
|
||||
dtl.dtl_remark,
|
||||
item.*
|
||||
FROM
|
||||
EM_BI_DeviceSportCheckPlanDtl dtl
|
||||
LEFT JOIN EM_BI_DeviceSportCheckItems item ON item.maint_item_id = dtl.maint_item_id
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
OPTION 输入.maint_plan_id <> ""
|
||||
dtl.maint_plan_id = 输入.maint_plan_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
file.*,
|
||||
class.class_name,
|
||||
work.workprocedure_name,
|
||||
d1.name AS dept_name,
|
||||
d2.name AS use_name
|
||||
FROM
|
||||
EM_BI_EquipmentFile file
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN pdm_bi_workprocedure work ON file.workprocedure_id = work.workprocedure_id
|
||||
LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id
|
||||
LEFT JOIN sys_dept d2 ON file.use_deptid = d2.dept_id
|
||||
WHERE
|
||||
file.is_delete = '0'
|
||||
AND file.status not in (90,91)
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.deptIds <> ""
|
||||
d1.dept_id in 输入.deptIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.useIds <> ""
|
||||
d2.dept_id in 输入.useIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.dept_str <> ""
|
||||
d2.dept_id in 输入.dept_str
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
[交易说明]
|
||||
交易名: 设备点检单维护分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.classIds TYPEAS f_string
|
||||
输入.device_code TYPEAS s_string
|
||||
输入.maintenancecycle TYPEAS s_string
|
||||
输入.maint_id TYPEAS s_string
|
||||
输入.maint_code TYPEAS s_string
|
||||
输入.invstatus TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.maint_object TYPEAS s_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
mst.*,
|
||||
class.class_name,
|
||||
file.device_code,
|
||||
file.material_type_id,
|
||||
file.device_name,
|
||||
file.extend_code,
|
||||
d1.name AS dept_name,
|
||||
d2.name AS use_name
|
||||
FROM
|
||||
EM_BI_DeviceSportCheckMst mst
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id
|
||||
LEFT JOIN sys_dept d2 ON file.use_deptid = d2.dept_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maint_code <> ""
|
||||
(mst.maint_code like 输入.maint_code or
|
||||
mst.maint_code like 输入.maint_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maintenancecycle <> ""
|
||||
mst.maintenancecycle = 输入.maintenancecycle
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
mst.plan_start_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
mst.plan_start_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.invstatus <> ""
|
||||
mst.invstatus = 输入.invstatus
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
mst.*,
|
||||
class.class_name,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
file.extend_code
|
||||
FROM
|
||||
EM_BI_DeviceSportCheckMst mst
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
AND mst.invstatus in ('04','99')
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maint_code <> ""
|
||||
(mst.maint_code like 输入.maint_code or
|
||||
mst.maint_code like 输入.maint_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maintenancecycle <> ""
|
||||
mst.maintenancecycle = 输入.maintenancecycle
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
mst.plan_start_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
mst.plan_start_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.invstatus <> ""
|
||||
mst.invstatus = 输入.invstatus
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
dtl.maint_dtl_id,
|
||||
dtl.maint_id,
|
||||
dtl.device_item_id,
|
||||
dtl.isfinish,
|
||||
dtl.dtl_remark,
|
||||
item.*
|
||||
FROM
|
||||
EM_BI_DeviceSportCheckDtl dtl
|
||||
LEFT JOIN EM_BI_DeviceSportCheckItems item ON item.maint_item_id = dtl.device_item_id
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
OPTION 输入.maint_id <> ""
|
||||
dtl.maint_id = 输入.maint_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
mst.*,
|
||||
class.class_name,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
file.extend_code,
|
||||
d1.name AS dept_name,
|
||||
d2.name AS use_name
|
||||
FROM
|
||||
EM_BI_DeviceSportCheckMst mst
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id
|
||||
LEFT JOIN sys_dept d2 ON file.use_deptid = d2.dept_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
AND mst.invstatus in ('02','03')
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maint_code <> ""
|
||||
(mst.maint_code like 输入.maint_code or
|
||||
mst.maint_code like 输入.maint_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maintenancecycle <> ""
|
||||
mst.maintenancecycle = 输入.maintenancecycle
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
mst.plan_start_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
mst.plan_start_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.invstatus <> ""
|
||||
mst.invstatus = 输入.invstatus
|
||||
ENDOPTION
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
mst.*,
|
||||
class.class_name,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
file.extend_code,
|
||||
d1.name AS dept_name,
|
||||
d2.name AS use_name
|
||||
FROM
|
||||
EM_BI_DeviceSportCheckMst mst
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id
|
||||
LEFT JOIN sys_dept d2 ON file.use_deptid = d2.dept_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
AND mst.invstatus in ('04')
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maint_code <> ""
|
||||
(mst.maint_code like 输入.maint_code or
|
||||
mst.maint_code like 输入.maint_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.maintenancecycle <> ""
|
||||
mst.maintenancecycle = 输入.maintenancecycle
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
mst.plan_start_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
mst.plan_start_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.invstatus <> ""
|
||||
mst.invstatus = 输入.invstatus
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -110,4 +110,11 @@ public class DevicemaintenancemstController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/submitMain")
|
||||
@ApiOperation("保存")
|
||||
public ResponseEntity<Object> submitMain(@RequestBody JSONObject whereJson) {
|
||||
devicemaintenancemstService.submitMain(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user