add:设备点检项目维护、设备润滑项目维护

This commit is contained in:
2023-09-06 14:44:56 +08:00
parent 166139ed59
commit 18d0c11a69
13 changed files with 1683 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
package org.nl.wms.masterdata_manage.em.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.masterdata_manage.em.service.DeviceLubricateitemsService;
import org.nl.wms.masterdata_manage.em.service.DeviceSportCheckitemsService;
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/devicelubricateitems")
@Slf4j
public class DeviceLubricateitemsController {
private final DeviceLubricateitemsService deviceLubricateitemsService;
@GetMapping
@ApiOperation("查询设备润滑项目维护")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(deviceLubricateitemsService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增设备润滑项目维护")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
deviceLubricateitemsService.create(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改设备润滑项目维护")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
deviceLubricateitemsService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ApiOperation("删除设备润滑项目维护")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
deviceLubricateitemsService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,57 @@
package org.nl.wms.masterdata_manage.em.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.masterdata_manage.em.service.DeviceSportCheckitemsService;
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/devicesportcheckitems")
@Slf4j
public class DeviceSportCheckitemsController {
private final DeviceSportCheckitemsService deviceSportCheckitemsService;
@GetMapping
@ApiOperation("查询设备点检项目维护")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(deviceSportCheckitemsService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增设备点检项目维护")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
deviceSportCheckitemsService.create(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改设备点检项目维护")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
deviceSportCheckitemsService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ApiOperation("删除设备点检项目维护")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
deviceSportCheckitemsService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,72 @@
package org.nl.wms.masterdata_manage.em.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.masterdata_manage.em.service.dto.DevicemaintenanceitemsDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务接口
* @date 2022-06-16
**/
public interface DeviceLubricateitemsService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<DevicemaintenanceitemsDto>
*/
List<DevicemaintenanceitemsDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param maint_item_id ID
* @return Devicemaintenanceitems
*/
DevicemaintenanceitemsDto findById(Long maint_item_id);
/**
* 根据编码查询
*
* @param code code
* @return Devicemaintenanceitems
*/
DevicemaintenanceitemsDto findByCode(String code);
/**
* 创建
*
* @param whereJson /
*/
void create(JSONObject whereJson);
/**
* 编辑
*
* @param whereJson /
*/
void update(JSONObject whereJson);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
}

View File

@@ -0,0 +1,72 @@
package org.nl.wms.masterdata_manage.em.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.masterdata_manage.em.service.dto.DevicemaintenanceitemsDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务接口
* @date 2022-06-16
**/
public interface DeviceSportCheckitemsService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<DevicemaintenanceitemsDto>
*/
List<DevicemaintenanceitemsDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param maint_item_id ID
* @return Devicemaintenanceitems
*/
DevicemaintenanceitemsDto findById(Long maint_item_id);
/**
* 根据编码查询
*
* @param code code
* @return Devicemaintenanceitems
*/
DevicemaintenanceitemsDto findByCode(String code);
/**
* 创建
*
* @param whereJson /
*/
void create(JSONObject whereJson);
/**
* 编辑
*
* @param whereJson /
*/
void update(JSONObject whereJson);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
}

View File

@@ -0,0 +1,168 @@
package org.nl.wms.masterdata_manage.em.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.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.masterdata_manage.em.service.DeviceLubricateitemsService;
import org.nl.wms.masterdata_manage.em.service.dto.DevicemaintenanceitemsDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
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-16
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class DeviceLubricateitemsServiceImpl implements DeviceLubricateitemsService {
private final ClassstandardService classstandardService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String class_idStr = (String) whereJson.get("class_idStr");
String maint_item_code = MapUtil.getStr(whereJson, "maint_item_code");
String contents = MapUtil.getStr(whereJson, "contents");
String requirement = MapUtil.getStr(whereJson, "requirement");
String item_level = MapUtil.getStr(whereJson, "item_level");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
map.put("item_level", item_level);
if (ObjectUtil.isNotEmpty(maint_item_code)) map.put("maint_item_code","%"+maint_item_code+"%");
if (ObjectUtil.isNotEmpty(contents)) map.put("contents","%"+contents+"%");
if (ObjectUtil.isNotEmpty(requirement)) map.put("requirement","%"+requirement+"%");
//处理物料当前节点的所有子节点
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", "");
}
JSONObject json = WQL.getWO("EM_BI_DEVICELUBRICATE_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "maint_item_code DESC");
return json;
}
@Override
public List<DevicemaintenanceitemsDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicelubricateitems");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicemaintenanceitemsDto.class);
return null;
}
@Override
public DevicemaintenanceitemsDto findById(Long maint_item_id) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicelubricateitems");
JSONObject json = wo.query("maint_item_id = '" + maint_item_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicemaintenanceitemsDto.class);
}
return null;
}
@Override
public DevicemaintenanceitemsDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicelubricateitems");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicemaintenanceitemsDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject json = new JSONObject();
json.put("maint_item_id", IdUtil.getSnowflake(1,1).nextId());
json.put("maint_item_code", CodeUtil.getNewCode("LUBRI_ITEM_CODE"));
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));
json.put("requirement", whereJson.getString("requirement"));
json.put("acceptancecriteria", whereJson.getString("acceptancecriteria"));
json.put("remark", whereJson.getString("remark"));
json.put("create_id", currentUserId);
json.put("create_name", nickName);
json.put("create_time", now);
WQLObject wo = WQLObject.getWQLObject("em_bi_devicelubricateitems");
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicelubricateitems");
JSONObject json = wo.query("maint_item_id = '" + whereJson.getString("maint_item_id") + "'").uniqueResult(0);
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));
json.put("requirement", whereJson.getString("requirement"));
json.put("acceptancecriteria", whereJson.getString("acceptancecriteria"));
json.put("remark", whereJson.getString("remark"));
json.put("update_optid", currentUserId);
json.put("update_optname", nickName);
json.put("update_time", now);
wo.update(json);
}
@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_devicelubricateitems");
for (Long maint_item_id : ids) {
JSONObject param = new JSONObject();
param.put("maint_item_id", String.valueOf(maint_item_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
}

View File

@@ -0,0 +1,168 @@
package org.nl.wms.masterdata_manage.em.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.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.masterdata_manage.em.service.DeviceSportCheckitemsService;
import org.nl.wms.masterdata_manage.em.service.dto.DevicemaintenanceitemsDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
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-16
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class DeviceSportCheckitemsServiceImpl implements DeviceSportCheckitemsService {
private final ClassstandardService classstandardService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String class_idStr = (String) whereJson.get("class_idStr");
String maint_item_code = MapUtil.getStr(whereJson, "maint_item_code");
String contents = MapUtil.getStr(whereJson, "contents");
String requirement = MapUtil.getStr(whereJson, "requirement");
String item_level = MapUtil.getStr(whereJson, "item_level");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
map.put("item_level", item_level);
if (ObjectUtil.isNotEmpty(maint_item_code)) map.put("maint_item_code","%"+maint_item_code+"%");
if (ObjectUtil.isNotEmpty(contents)) map.put("contents","%"+contents+"%");
if (ObjectUtil.isNotEmpty(requirement)) map.put("requirement","%"+requirement+"%");
//处理物料当前节点的所有子节点
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", "");
}
JSONObject json = WQL.getWO("EM_BI_DEVICESPORTCHECK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "maint_item_code DESC");
return json;
}
@Override
public List<DevicemaintenanceitemsDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckitems");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicemaintenanceitemsDto.class);
return null;
}
@Override
public DevicemaintenanceitemsDto findById(Long maint_item_id) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckitems");
JSONObject json = wo.query("maint_item_id = '" + maint_item_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicemaintenanceitemsDto.class);
}
return null;
}
@Override
public DevicemaintenanceitemsDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckitems");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicemaintenanceitemsDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject json = new JSONObject();
json.put("maint_item_id", IdUtil.getSnowflake(1,1).nextId());
json.put("maint_item_code", CodeUtil.getNewCode("SPORT_ITEM_CODE"));
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));
json.put("requirement", whereJson.getString("requirement"));
json.put("acceptancecriteria", whereJson.getString("acceptancecriteria"));
json.put("remark", whereJson.getString("remark"));
json.put("create_id", currentUserId);
json.put("create_name", nickName);
json.put("create_time", now);
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckitems");
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesportcheckitems");
JSONObject json = wo.query("maint_item_id = '" + whereJson.getString("maint_item_id") + "'").uniqueResult(0);
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));
json.put("requirement", whereJson.getString("requirement"));
json.put("acceptancecriteria", whereJson.getString("acceptancecriteria"));
json.put("remark", whereJson.getString("remark"));
json.put("update_optid", currentUserId);
json.put("update_optname", nickName);
json.put("update_time", now);
wo.update(json);
}
@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_devicesportcheckitems");
for (Long maint_item_id : ids) {
JSONObject param = new JSONObject();
param.put("maint_item_id", String.valueOf(maint_item_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
}

View File

@@ -0,0 +1,82 @@
[交易说明]
交易名: 设备保养项目维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.maint_item_code TYPEAS s_string
输入.contents TYPEAS s_string
输入.requirement TYPEAS s_string
输入.item_level TYPEAS s_string
输入.classIds TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
item.*,
class.class_name
FROM
em_bi_devicelubricateitems item
LEFT JOIN md_pb_classstandard class ON item.material_type_id = class.class_id
WHERE
item.is_delete = '0'
OPTION 输入.item_level <> ""
item.item_level = 输入.item_level
ENDOPTION
OPTION 输入.maint_item_code <> ""
(item.maint_item_code like 输入.maint_item_code or
item.maint_item_name like 输入.maint_item_code)
ENDOPTION
OPTION 输入.contents <> ""
item.contents like 输入.contents
ENDOPTION
OPTION 输入.requirement <> ""
item.requirement like 输入.requirement
ENDOPTION
OPTION 输入.classIds <> ""
class.class_id in 输入.classIds
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,82 @@
[交易说明]
交易名: 设备保养项目维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.maint_item_code TYPEAS s_string
输入.contents TYPEAS s_string
输入.requirement TYPEAS s_string
输入.item_level TYPEAS s_string
输入.classIds TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
item.*,
class.class_name
FROM
em_bi_devicesportcheckitems item
LEFT JOIN md_pb_classstandard class ON item.material_type_id = class.class_id
WHERE
item.is_delete = '0'
OPTION 输入.item_level <> ""
item.item_level = 输入.item_level
ENDOPTION
OPTION 输入.maint_item_code <> ""
(item.maint_item_code like 输入.maint_item_code or
item.maint_item_name like 输入.maint_item_code)
ENDOPTION
OPTION 输入.contents <> ""
item.contents like 输入.contents
ENDOPTION
OPTION 输入.requirement <> ""
item.requirement like 输入.requirement
ENDOPTION
OPTION 输入.classIds <> ""
class.class_id in 输入.classIds
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF