代码更新
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.DcBaseDeviceService;
|
||||
import org.nl.wms.dc.service.dto.DcBaseDeviceDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "采集设备管理")
|
||||
@RequestMapping("/api/dcBaseDevice")
|
||||
@Slf4j
|
||||
public class DcBaseDeviceController {
|
||||
|
||||
private final DcBaseDeviceService dcBaseDeviceService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询采集设备")
|
||||
@ApiOperation("查询采集设备")
|
||||
//@PreAuthorize("@el.check('dcBaseDevice:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(dcBaseDeviceService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增采集设备")
|
||||
@ApiOperation("新增采集设备")
|
||||
//@PreAuthorize("@el.check('dcBaseDevice:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DcBaseDeviceDto dto){
|
||||
dcBaseDeviceService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改采集设备")
|
||||
@ApiOperation("修改采集设备")
|
||||
//@PreAuthorize("@el.check('dcBaseDevice:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DcBaseDeviceDto dto){
|
||||
dcBaseDeviceService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除采集设备")
|
||||
@ApiOperation("删除采集设备")
|
||||
//@PreAuthorize("@el.check('dcBaseDevice:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
dcBaseDeviceService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getItemByDeviceTypeId")
|
||||
@Log("动态获取表格列")
|
||||
@ApiOperation("动态获取表格列")
|
||||
//@PreAuthorize("@el.check('dcBaseDevice:list')")
|
||||
public ResponseEntity<Object> getItemByDeviceTypeId(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(dcBaseDeviceService.getItemByDeviceTypeId(param),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.DevicetypeService;
|
||||
import org.nl.wms.dc.service.dto.DevicetypeDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "设备类型管理")
|
||||
@RequestMapping("/api/devicetype")
|
||||
@Slf4j
|
||||
public class DevicetypeController {
|
||||
|
||||
private final DevicetypeService devicetypeService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备类型")
|
||||
@ApiOperation("查询设备类型")
|
||||
//@PreAuthorize("@el.check('devicetype:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(devicetypeService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备类型")
|
||||
@ApiOperation("新增设备类型")
|
||||
//@PreAuthorize("@el.check('devicetype:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DevicetypeDto dto){
|
||||
devicetypeService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备类型")
|
||||
@ApiOperation("修改设备类型")
|
||||
//@PreAuthorize("@el.check('devicetype:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DevicetypeDto dto){
|
||||
devicetypeService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备类型")
|
||||
@ApiOperation("删除设备类型")
|
||||
//@PreAuthorize("@el.check('devicetype:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
devicetypeService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getWorksection")
|
||||
@Log("查询所属工段")
|
||||
@ApiOperation("查询所属工段")
|
||||
//@PreAuthorize("@el.check('devicetype:list')")
|
||||
public ResponseEntity<Object> getWorksection(){
|
||||
return new ResponseEntity<>(devicetypeService.getWorksection(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改启用禁用状态")
|
||||
@ApiOperation("修改启用禁用状态")
|
||||
//@PreAuthorize("@el.check('store:edit')")
|
||||
public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) {
|
||||
devicetypeService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.ItemService;
|
||||
import org.nl.wms.dc.service.dto.ItemDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "采集项管理管理")
|
||||
@RequestMapping("/api/item")
|
||||
@Slf4j
|
||||
public class ItemController {
|
||||
|
||||
private final ItemService itemService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询采集项管理")
|
||||
@ApiOperation("查询采集项管理")
|
||||
//@PreAuthorize("@el.check('item:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(itemService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增采集项管理")
|
||||
@ApiOperation("新增采集项管理")
|
||||
//@PreAuthorize("@el.check('item:add')")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject param){
|
||||
itemService.create(param);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改采集项管理")
|
||||
@ApiOperation("修改采集项管理")
|
||||
//@PreAuthorize("@el.check('item:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject param){
|
||||
itemService.update(param);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除采集项管理")
|
||||
@ApiOperation("删除采集项管理")
|
||||
//@PreAuthorize("@el.check('item:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
itemService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getDeviceTypeBySection")
|
||||
@Log("根据工段查询设备类型")
|
||||
@ApiOperation("根据工段查询设备类型")
|
||||
//@PreAuthorize("@el.check('item:add')")
|
||||
public ResponseEntity<Object> getDeviceTypeBySection(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(itemService.getDeviceTypeBySection(param),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getDtlByDevicetypeId")
|
||||
@Log("根据设备类型id查询项点")
|
||||
@ApiOperation("根据设备类型id查询项点")
|
||||
//@PreAuthorize("@el.check('item:add')")
|
||||
public ResponseEntity<Object> getDtlByDevicetypeId(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(itemService.getDtlByDevicetypeId(param),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/saveItem")
|
||||
@Log("根据设备类型id查询项点")
|
||||
@ApiOperation("根据设备类型id查询项点")
|
||||
//@PreAuthorize("@el.check('item:add')")
|
||||
public ResponseEntity<Object> saveItem(@RequestBody JSONObject param){
|
||||
itemService.saveItem(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改启用禁用状态")
|
||||
@ApiOperation("修改启用禁用状态")
|
||||
//@PreAuthorize("@el.check('store:edit')")
|
||||
public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) {
|
||||
itemService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.WorksectionService;
|
||||
import org.nl.wms.dc.service.dto.WorksectionDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "工段基本信息管理")
|
||||
@RequestMapping("/api/worksection")
|
||||
@Slf4j
|
||||
public class WorksectionController {
|
||||
|
||||
private final WorksectionService worksectionService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询工段基本信息")
|
||||
@ApiOperation("查询工段基本信息")
|
||||
//@PreAuthorize("@el.check('worksection:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(worksectionService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增工段基本信息")
|
||||
@ApiOperation("新增工段基本信息")
|
||||
//@PreAuthorize("@el.check('worksection:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody WorksectionDto dto){
|
||||
worksectionService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改工段基本信息")
|
||||
@ApiOperation("修改工段基本信息")
|
||||
//@PreAuthorize("@el.check('worksection:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody WorksectionDto dto){
|
||||
worksectionService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除工段基本信息")
|
||||
@ApiOperation("删除工段基本信息")
|
||||
//@PreAuthorize("@el.check('worksection:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
worksectionService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改启用禁用状态")
|
||||
@ApiOperation("修改启用禁用状态")
|
||||
//@PreAuthorize("@el.check('store:edit')")
|
||||
public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) {
|
||||
worksectionService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.dto.DcBaseDeviceDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
public interface DcBaseDeviceService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<DcBaseDeviceDto>
|
||||
*/
|
||||
List<DcBaseDeviceDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param device_id ID
|
||||
* @return DcBaseDevice
|
||||
*/
|
||||
DcBaseDeviceDto findById(Long device_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return DcBaseDevice
|
||||
*/
|
||||
DcBaseDeviceDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(DcBaseDeviceDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(DcBaseDeviceDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询设备类型
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> getItemByDeviceTypeId(JSONObject param);
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.dto.DevicetypeDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
public interface DevicetypeService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<DevicetypeDto>
|
||||
*/
|
||||
List<DevicetypeDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param section_id ID
|
||||
* @return Devicetype
|
||||
*/
|
||||
DevicetypeDto findById(Long section_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Devicetype
|
||||
*/
|
||||
DevicetypeDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(DevicetypeDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(DevicetypeDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取所属工段
|
||||
* @return
|
||||
*/
|
||||
JSONArray getWorksection();
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
* @param json
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.dto.ItemDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
public interface ItemService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<ItemDto>
|
||||
*/
|
||||
List<ItemDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param iteml_id ID
|
||||
* @return Item
|
||||
*/
|
||||
ItemDto findById(Long iteml_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Item
|
||||
*/
|
||||
ItemDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param param /
|
||||
*/
|
||||
void create(JSONObject param);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param param /
|
||||
*/
|
||||
void update(JSONObject param);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据工段查询设备类型
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
JSONArray getDeviceTypeBySection(JSONObject param);
|
||||
|
||||
/**
|
||||
* 根据设备类型id查询项点
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
JSONArray getDtlByDevicetypeId(JSONObject param);
|
||||
|
||||
void saveItem(JSONObject param);
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
* @param json
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dc.service.dto.WorksectionDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
public interface WorksectionService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<WorksectionDto>
|
||||
*/
|
||||
List<WorksectionDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param worksection_id ID
|
||||
* @return Worksection
|
||||
*/
|
||||
WorksectionDto findById(Long worksection_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Worksection
|
||||
*/
|
||||
WorksectionDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(WorksectionDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(WorksectionDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
* @param json
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package org.nl.wms.dc.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Data
|
||||
public class DcBaseDeviceDto implements Serializable {
|
||||
|
||||
/** 设备标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long device_id;
|
||||
|
||||
/** 设备编码 */
|
||||
private String device_code;
|
||||
|
||||
/** 设备名称 */
|
||||
private String device_name;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 创建人 */
|
||||
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 String is_delete;
|
||||
|
||||
/** 数据采集设备类型 */
|
||||
private String devicetype_id;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package org.nl.wms.dc.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Data
|
||||
public class DevicetypeDto implements Serializable {
|
||||
|
||||
/** 设备类型标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long devicetype_id;
|
||||
|
||||
/** 设备类型编码 */
|
||||
private String devicetype_code;
|
||||
|
||||
/** 设备类型名称 */
|
||||
private String devicetype_name;
|
||||
|
||||
/** 工段标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long section_id;
|
||||
|
||||
/** 创建人 */
|
||||
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 String is_used;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package org.nl.wms.dc.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @description /
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Data
|
||||
public class ItemDto implements Serializable {
|
||||
|
||||
/** 项点标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long iteml_id;
|
||||
|
||||
/**
|
||||
* 项点编码
|
||||
*/
|
||||
private String item_code;
|
||||
|
||||
/**
|
||||
* 项点名称
|
||||
*/
|
||||
private String item_name;
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
*/
|
||||
private String default_value;
|
||||
|
||||
/**
|
||||
* 明细序号
|
||||
*/
|
||||
private BigDecimal seq_no;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
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 String is_used;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 数据采集设备类型
|
||||
*/
|
||||
private String devicetype_id;
|
||||
|
||||
/**
|
||||
* acs项点编码
|
||||
*/
|
||||
private String acs_item_code;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package org.nl.wms.dc.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author geng by
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Data
|
||||
public class WorksectionDto implements Serializable {
|
||||
|
||||
/** 工段标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long worksection_id;
|
||||
|
||||
/** 工段编码 */
|
||||
private String worksection_code;
|
||||
|
||||
/** 工段名称 */
|
||||
private String worksection_name;
|
||||
|
||||
/** 创建人 */
|
||||
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 String is_used;
|
||||
|
||||
/** 是否删除 */
|
||||
private String is_delete;
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.dc.service.DcBaseDeviceService;
|
||||
import org.nl.wms.dc.service.dto.DcBaseDeviceDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @description 服务实现
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DcBaseDeviceServiceImpl implements DcBaseDeviceService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String devicetype_id = MapUtil.getStr(whereJson, "devicetype_id");
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
JSONObject map2 = new JSONObject();
|
||||
map2.put("flag", "2");
|
||||
map2.put("devicetype_id", devicetype_id);
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
map2.put("search", "%" + search + "%");
|
||||
}
|
||||
//根据设备类型获取设备信息
|
||||
JSONObject json = WQL.getWO("DC_DEVICE_01").addParamMap(map2).pageQuery(WqlUtil.getHttpContext(page), "device.update_time desc");
|
||||
JSONArray jsonArray = json.getJSONArray("content");
|
||||
JSONArray newContent = new JSONArray();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
JSONObject map = new JSONObject();
|
||||
String device_id = jsonObject.getString("device_id");
|
||||
map.put("flag", "1");
|
||||
map.put("device_id", device_id);
|
||||
//获取设备所拥有的项点信息
|
||||
JSONArray itemArray = WQL.getWO("DC_DEVICE_01").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject newMap = new JSONObject();
|
||||
newMap.put("device_id", jsonObject.getString("device_id"));
|
||||
newMap.put("device_code", jsonObject.getString("device_code"));
|
||||
newMap.put("device_name", jsonObject.getString("device_name"));
|
||||
newMap.put("devicetype_id", jsonObject.getString("devicetype_id"));
|
||||
newMap.put("devicetype_name", jsonObject.getString("devicetype_name"));
|
||||
newMap.put("worksection_name", jsonObject.getString("worksection_name"));
|
||||
newMap.put("section_id", jsonObject.getString("section_id"));
|
||||
//循环每个设备的项点信息,将项点所对应的键设为项点编码,对应动态表格的prop
|
||||
for (int j = 0; j < itemArray.size(); j++) {
|
||||
JSONObject itemObject = itemArray.getJSONObject(j);
|
||||
newMap.put(itemObject.getString("item_code"), itemObject.getString("item_value"));
|
||||
}
|
||||
newContent.add(newMap);
|
||||
}
|
||||
json.put("content", newContent);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DcBaseDeviceDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_device");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DcBaseDeviceDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DcBaseDeviceDto findById(Long device_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_device");
|
||||
JSONObject json = wo.query("device_id = '" + device_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DcBaseDeviceDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DcBaseDeviceDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_device");
|
||||
JSONObject json = wo.query("is_delete = '0' and device_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DcBaseDeviceDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DcBaseDeviceDto dto) {
|
||||
|
||||
//编码唯一性校验
|
||||
String device_code = dto.getDevice_code();
|
||||
DcBaseDeviceDto byCode = this.findByCode(device_code);
|
||||
if (ObjectUtil.isNotEmpty(byCode)) throw new BadRequestException("编码已存在!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject wo_deviceItem = WQLObject.getWQLObject("dc_base_deviceItem");
|
||||
WQLObject wo_device = WQLObject.getWQLObject("dc_base_device");
|
||||
WQLObject wo_item = WQLObject.getWQLObject("dc_base_item");
|
||||
long device_id = IdUtil.getSnowflake(1, 1).nextId();
|
||||
dto.setDevice_id(device_id);
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
//先向设备表中添加数据,再向中间表添加具体信息
|
||||
wo_device.insert(json);
|
||||
JSONArray jsonArray = wo_item.query("is_delete = '0' and devicetype_id = '" + dto.getDevicetype_id() + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("deviceitem_id",IdUtil.getSnowflake(1, 1).nextId());
|
||||
map.put("iteml_id", jsonObject.getString("iteml_id"));
|
||||
map.put("device_id", device_id);
|
||||
wo_deviceItem.insert(map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DcBaseDeviceDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
DcBaseDeviceDto entity = this.findById(dto.getDevice_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
//编码唯一性校验
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_device");
|
||||
String where = "is_delete = '0' and device_code = '" + dto.getDevice_code() + "' and device_id != '" + dto.getDevice_id() + "'";
|
||||
JSONObject jsonObject = wo.query(where).uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
||||
throw new BadRequestException("编码已存在!");
|
||||
}
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
//先修改设备表信息,然后删除中间表中设备项点对应关系,再向中间表插入新的对应关系
|
||||
WQLObject wo_deviceItem = WQLObject.getWQLObject("dc_base_deviceItem");
|
||||
wo_deviceItem.delete("device_id = '" + dto.getDevice_id() + "'");
|
||||
WQLObject wo_item = WQLObject.getWQLObject("dc_base_item");
|
||||
JSONArray jsonArray = wo_item.query("is_delete = '0' and devicetype_id = '" + dto.getDevicetype_id() + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("deviceitem_id",IdUtil.getSnowflake(1, 1).nextId());
|
||||
map.put("iteml_id", jsonObject1.getString("iteml_id"));
|
||||
map.put("device_id", dto.getDevice_id());
|
||||
wo_deviceItem.insert(map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_device");
|
||||
WQLObject wo_deviceItem = WQLObject.getWQLObject("dc_base_deviceItem");
|
||||
for (Long device_id : ids) {
|
||||
wo.delete("device_id = '" + device_id + "'");
|
||||
wo_deviceItem.delete("device_id = '" + device_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getItemByDeviceTypeId(JSONObject param) {
|
||||
//动态获取设备类型下对应的项点信息
|
||||
String devicetype_id = param.getString("devicetype_id");
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
JSONArray jsonArray = wo.query("is_delete = '0' and devicetype_id = '" + devicetype_id + "'", "seq_no").getResultJSONArray(0);
|
||||
JSONArray newArray = new JSONArray();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String item_name = jsonObject.getString("item_name");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("label", item_name);
|
||||
//将表格prop设置为项点编码
|
||||
json.put("prop", jsonObject.getString("item_code"));
|
||||
json.put("show", true);
|
||||
if (item_name.length() >= 6) {
|
||||
json.put("width", "150");
|
||||
}
|
||||
newArray.add(json);
|
||||
}
|
||||
JSONObject resultMap = new JSONObject();
|
||||
resultMap.put("newArray", newArray);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.dc.service.DevicetypeService;
|
||||
import org.nl.wms.dc.service.dto.DevicetypeDto;
|
||||
import org.nl.wms.dc.service.dto.WorksectionDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @description 服务实现
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DevicetypeServiceImpl implements DevicetypeService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_devicetype");
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
map.put("search", search);
|
||||
}
|
||||
JSONObject json = WQL.getWO("DC_DEVICETYPE_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "devicetype.update_time desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevicetypeDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_devicetype");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicetypeDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicetypeDto findById(Long devicetype_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_devicetype");
|
||||
JSONObject json = wo.query("devicetype_id = '" + devicetype_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicetypeDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicetypeDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_devicetype");
|
||||
JSONObject json = wo.query("is_delete = '0' and devicetype_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicetypeDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DevicetypeDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
//编码唯一性校验
|
||||
String devicetype_code = dto.getDevicetype_code();
|
||||
DevicetypeDto byCode = this.findByCode(devicetype_code);
|
||||
if (ObjectUtil.isNotEmpty(byCode)) throw new BadRequestException("编码已存在!");
|
||||
|
||||
dto.setDevicetype_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_devicetype");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DevicetypeDto dto) {
|
||||
DevicetypeDto entity = this.findById(dto.getDevicetype_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
//编码唯一性校验
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_deviceType");
|
||||
String where = "is_delete = '0' and devicetype_code = '" + dto.getDevicetype_code() + "' and devicetype_id != '" + dto.getDevicetype_id() + "'";
|
||||
|
||||
JSONObject jsonObject = wo.query(where).uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
||||
throw new BadRequestException("编码已存在!");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_devicetype");
|
||||
for (Long devicetype_id : ids) {
|
||||
wo.delete("devicetype_id = '" + devicetype_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getWorksection() {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_worksection");
|
||||
JSONArray resultJSONArray = wo.query("is_delete = '0'").getResultJSONArray(0);
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String is_used = "1";
|
||||
if (StrUtil.equals("1", json.getString("is_used"))) {
|
||||
is_used = "0";
|
||||
}
|
||||
json.put("is_used", is_used);
|
||||
json.put("update_optid", currentUserId);
|
||||
json.put("update_optname", nickName);
|
||||
json.put("update_time", now);
|
||||
WQLObject.getWQLObject("dc_base_deviceType").update(json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.dc.service.ItemService;
|
||||
import org.nl.wms.dc.service.dto.ItemDto;
|
||||
import org.nl.wms.dc.service.dto.WorksectionDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @description 服务实现
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ItemServiceImpl implements ItemService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
String devicetype_id = MapUtil.getStr(whereJson, "devicetype_id");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
map.put("devicetype_id", devicetype_id);
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
map.put("search", "%" + search + "%");
|
||||
}
|
||||
JSONObject json = WQL.getWO("DC_ITEM_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "item.update_time desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(ItemDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDto findById(Long iteml_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
JSONObject json = wo.query("iteml_id = '" + iteml_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(ItemDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
JSONObject json = wo.query("is_delete = '0' and item_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(ItemDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(JSONObject param) {
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
String devicetype_id = param.getString("devicetype_id");
|
||||
|
||||
final JSONArray existJSONArray = wo.query("is_delete = '0' and devicetype_id = '" + devicetype_id + "'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(existJSONArray)) {
|
||||
throw new BadRequestException("该数据采集设备类型已存在,请重新选择!");
|
||||
}
|
||||
|
||||
JSONArray jsonArray = param.getJSONArray("tableData");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("iteml_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
map.put("item_code", jsonObject.getString("item_code"));
|
||||
ItemDto itemDto = this.findByCode(jsonObject.getString("item_code"));
|
||||
if (ObjectUtil.isNotEmpty(itemDto))
|
||||
throw new BadRequestException("'" + jsonObject.getString("item_code") + "'编码已存在!");
|
||||
map.put("item_name", jsonObject.getString("item_name"));
|
||||
map.put("default_value", jsonObject.getString("default_value"));
|
||||
map.put("seq_no", jsonObject.getString("seq_no"));
|
||||
map.put("devicetype_id", devicetype_id);
|
||||
map.put("remark", jsonObject.getString("remark"));
|
||||
map.put("create_id", currentUserId);
|
||||
map.put("create_name", nickName);
|
||||
map.put("create_time", now);
|
||||
map.put("update_optid", currentUserId);
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
wo.insert(map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject param) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
String devicetype_id = param.getString("devicetype_id");
|
||||
JSONArray jsonArray = param.getJSONArray("tableData");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String iteml_id = jsonObject.getString("iteml_id");
|
||||
if (StrUtil.isNotEmpty(iteml_id)) {
|
||||
//编码唯一性校验
|
||||
String where = "is_delete = '0' and item_code = '" + jsonObject.getString("item_code") + "' and iteml_id != '" + iteml_id + "'";
|
||||
JSONObject is_exist = wo.query(where).uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(is_exist)) {
|
||||
throw new BadRequestException("'" + jsonObject.getString("item_code") + "'编码已存在!");
|
||||
}
|
||||
JSONObject editMap = new JSONObject();
|
||||
editMap.put("item_code", jsonObject.getString("item_code"));
|
||||
editMap.put("item_name", jsonObject.getString("item_name"));
|
||||
editMap.put("default_value", jsonObject.getString("default_value"));
|
||||
editMap.put("seq_no", jsonObject.getString("seq_no"));
|
||||
editMap.put("remark", jsonObject.getString("remark"));
|
||||
editMap.put("update_optid", currentUserId);
|
||||
editMap.put("update_optname", nickName);
|
||||
editMap.put("update_time", now);
|
||||
wo.update(editMap, "iteml_id = '" + iteml_id + "'");
|
||||
} else {
|
||||
JSONObject addMap = new JSONObject();
|
||||
addMap.put("iteml_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
addMap.put("item_code", jsonObject.getString("item_code"));
|
||||
ItemDto itemDto = this.findByCode(jsonObject.getString("item_code"));
|
||||
if (ObjectUtil.isNotEmpty(itemDto))
|
||||
throw new BadRequestException("'" + jsonObject.getString("item_code") + "'编码已存在!");
|
||||
addMap.put("item_name", jsonObject.getString("item_name"));
|
||||
addMap.put("default_value", jsonObject.getString("default_value"));
|
||||
addMap.put("seq_no", jsonObject.getString("seq_no"));
|
||||
addMap.put("devicetype_id", devicetype_id);
|
||||
addMap.put("remark", jsonObject.getString("remark"));
|
||||
addMap.put("create_id", currentUserId);
|
||||
addMap.put("create_name", nickName);
|
||||
addMap.put("create_time", now);
|
||||
addMap.put("update_optid", currentUserId);
|
||||
addMap.put("update_optname", nickName);
|
||||
addMap.put("update_time", now);
|
||||
wo.insert(addMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
for (Long iteml_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iteml_id", String.valueOf(iteml_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
|
||||
public JSONArray getDeviceTypeBySection(JSONObject param) {
|
||||
//获取所属工段下的设备类型
|
||||
String section_id = param.getString("section_id");
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_deviceType");
|
||||
JSONArray resultJSONArray = wo.query("is_delete = '0' and section_id = '" + section_id + "'").getResultJSONArray(0);
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getDtlByDevicetypeId(JSONObject param) {
|
||||
//根据设备类型id获取项点明细
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
String devicetype_id = param.getString("devicetype_id");
|
||||
JSONArray resultJSONArray = wo.query("is_delete = '0' and devicetype_id = '" + devicetype_id + "' ").getResultJSONArray(0);
|
||||
JSONArray array = new JSONArray();
|
||||
for (int i = 0; i < resultJSONArray.size(); i++) {
|
||||
JSONObject jsonObject = resultJSONArray.getJSONObject(i);
|
||||
//为了显示隐藏表格中每条明细修改、完成按钮
|
||||
jsonObject.put("is_show", "1");
|
||||
array.add(jsonObject);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveItem(JSONObject param) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_item");
|
||||
String devicetype_id = param.getString("devicetype_id");
|
||||
JSONArray jsonArray = param.getJSONArray("tableData");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
List<String> list = new ArrayList<>();
|
||||
//循环判断前端传入的项点信息判断是否是数据库中已经存在的,如果已经存在将id添加到集合中
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String iteml_id = jsonObject.getString("iteml_id");
|
||||
if (StrUtil.isNotEmpty(iteml_id)) {
|
||||
list.add(iteml_id);
|
||||
}
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (list.size() > 0) {
|
||||
sb.append("and iteml_id not in (");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i != list.size() - 1) {
|
||||
sb.append("'" + list.get(i) + "',");
|
||||
}
|
||||
if (i == list.size() - 1) {
|
||||
sb.append("'" + list.get(i) + "')");
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除表中已经存在的,但前台传入的项点明细中删除了的
|
||||
wo.delete("devicetype_id = '" + devicetype_id + "'" + sb);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String iteml_id = jsonObject.getString("iteml_id");
|
||||
//通过前端传入的明细项点id判断是否存在数据表中,如果存在,就根据项点id修改,不存在就新增
|
||||
if (StrUtil.isNotEmpty(iteml_id)) {
|
||||
//编码唯一性校验
|
||||
String where = "is_delete = '0' and item_code = '" + jsonObject.getString("item_code") + "' and iteml_id != '" + iteml_id + "'";
|
||||
JSONObject is_exist = wo.query(where).uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(is_exist)) {
|
||||
throw new BadRequestException("'" + jsonObject.getString("item_code") + "'编码已存在!");
|
||||
}
|
||||
JSONObject editMap = new JSONObject();
|
||||
editMap.put("item_code", jsonObject.getString("item_code"));
|
||||
editMap.put("item_name", jsonObject.getString("item_name"));
|
||||
editMap.put("acs_item_code", jsonObject.getString("acs_item_code"));
|
||||
editMap.put("default_value", jsonObject.getString("default_value"));
|
||||
editMap.put("seq_no", jsonObject.getString("seq_no"));
|
||||
editMap.put("remark", jsonObject.getString("remark"));
|
||||
editMap.put("update_optid", currentUserId);
|
||||
editMap.put("update_optname", nickName);
|
||||
editMap.put("update_time", now);
|
||||
wo.update(editMap, "iteml_id = '" + iteml_id + "'");
|
||||
} else {
|
||||
JSONObject addMap = new JSONObject();
|
||||
addMap.put("iteml_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
addMap.put("item_code", jsonObject.getString("item_code"));
|
||||
//编码唯一性校验
|
||||
ItemDto itemDto = this.findByCode(jsonObject.getString("item_code"));
|
||||
if (ObjectUtil.isNotEmpty(itemDto))
|
||||
throw new BadRequestException("'" + jsonObject.getString("item_code") + "'编码已存在!");
|
||||
addMap.put("item_name", jsonObject.getString("item_name"));
|
||||
addMap.put("acs_item_code", jsonObject.getString("acs_item_code"));
|
||||
addMap.put("default_value", jsonObject.getString("default_value"));
|
||||
addMap.put("seq_no", jsonObject.getString("seq_no"));
|
||||
addMap.put("devicetype_id", devicetype_id);
|
||||
addMap.put("remark", jsonObject.getString("remark"));
|
||||
addMap.put("create_id", currentUserId);
|
||||
addMap.put("create_name", nickName);
|
||||
addMap.put("create_time", now);
|
||||
addMap.put("update_optid", currentUserId);
|
||||
addMap.put("update_optname", nickName);
|
||||
addMap.put("update_time", now);
|
||||
wo.insert(addMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String is_used = "1";
|
||||
if (StrUtil.equals("1", json.getString("is_used"))) {
|
||||
is_used = "0";
|
||||
}
|
||||
json.put("is_used", is_used);
|
||||
json.put("update_optid", currentUserId);
|
||||
json.put("update_optname", nickName);
|
||||
json.put("update_time", now);
|
||||
WQLObject.getWQLObject("dc_base_item").update(json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
|
||||
package org.nl.wms.dc.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.dc.service.WorksectionService;
|
||||
import org.nl.wms.dc.service.dto.WorksectionDto;
|
||||
import org.nl.wms.pdm.service.dto.DeviceDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
* @description 服务实现
|
||||
* @date 2022-05-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WorksectionServiceImpl implements WorksectionService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
String where = "";
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
where = " AND (worksection_code like '%" + search + "%' OR worksection_name like '%" + search + "%' ) ";
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_worksection");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "is_delete = '0'" + where, "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorksectionDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_worksection");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(WorksectionDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorksectionDto findById(Long worksection_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_worksection");
|
||||
JSONObject json = wo.query("worksection_id = '" + worksection_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(WorksectionDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorksectionDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_worksection");
|
||||
JSONObject json = wo.query("is_delete = '0' and worksection_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(WorksectionDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(WorksectionDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
//编码唯一性校验
|
||||
String worksection_code = dto.getWorksection_code();
|
||||
WorksectionDto byCode = this.findByCode(worksection_code);
|
||||
if (ObjectUtil.isNotEmpty(byCode)) throw new BadRequestException("编码已存在!");
|
||||
|
||||
dto.setWorksection_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_worksection");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(WorksectionDto dto) {
|
||||
WorksectionDto entity = this.findById(dto.getWorksection_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
//编码唯一性校验
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_workSection");
|
||||
String where = "is_delete = '0' and worksection_code = '" + dto.getWorksection_code() + "' and worksection_id != '" + dto.getWorksection_id() + "'";
|
||||
|
||||
JSONObject jsonObject = wo.query(where).uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
||||
throw new BadRequestException("编码已存在!");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("dc_base_worksection");
|
||||
for (Long worksection_id : ids) {
|
||||
wo.delete("worksection_id = '" + worksection_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String is_used = "1";
|
||||
if (StrUtil.equals("1", json.getString("is_used"))) {
|
||||
is_used = "0";
|
||||
}
|
||||
json.put("is_used", is_used);
|
||||
json.put("update_optid", currentUserId);
|
||||
json.put("update_optname", nickName);
|
||||
json.put("update_time", now);
|
||||
WQLObject.getWQLObject("dc_base_workSection").update(json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 设备类型
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.search TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
devicetype.*,
|
||||
section.worksection_name
|
||||
FROM
|
||||
dc_base_deviceType devicetype
|
||||
left join dc_base_workSection section on devicetype.section_id = section.worksection_id
|
||||
WHERE
|
||||
devicetype.is_delete = '0'
|
||||
OPTION 输入.search <> ""
|
||||
(devicetype.devicetype_code like 输入.search or
|
||||
devicetype.devicetype_name like 输入.search)
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -1,87 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 设备
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.device_id TYPEAS s_string
|
||||
输入.devicetype_id TYPEAS s_string
|
||||
输入.search TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
deviceItem.device_id,
|
||||
deviceItem.iteml_id,
|
||||
deviceItem.item_value,
|
||||
item.item_code
|
||||
FROM
|
||||
dc_base_deviceItem deviceItem
|
||||
LEFT JOIN dc_base_device device ON deviceItem.device_id = device.device_id
|
||||
LEFT JOIN dc_base_item item ON deviceItem.iteml_id = item.iteml_id
|
||||
where
|
||||
deviceItem.device_id = 输入.device_id
|
||||
order by
|
||||
item.seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
device.*,
|
||||
deviceType.section_id,
|
||||
deviceType.devicetype_name,
|
||||
workSection.worksection_name
|
||||
FROM
|
||||
dc_base_device device
|
||||
LEFT JOIN dc_base_deviceType deviceType ON device.devicetype_id = deviceType.devicetype_id
|
||||
LEFT JOIN dc_base_workSection workSection ON deviceType.section_id = workSection.worksection_id
|
||||
WHERE
|
||||
device.devicetype_id = 输入.devicetype_id
|
||||
OPTION 输入.search <> ""
|
||||
(device.device_code like 输入.search or
|
||||
device.device_name like 输入.search)
|
||||
ENDOPTION
|
||||
OPTION 输入.devicetype_id <> ""
|
||||
device.devicetype_id = 输入.devicetype_id
|
||||
ENDOPTION
|
||||
OPTION 输入.device_id <> ""
|
||||
device.device_id = 输入.device_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -1,64 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 采集项管理
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.search TYPEAS s_string
|
||||
输入.devicetype_id TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
item.*,
|
||||
section.worksection_id,
|
||||
section.worksection_name,
|
||||
devicetype.devicetype_name
|
||||
FROM
|
||||
dc_base_item item
|
||||
left join dc_base_deviceType devicetype on item.devicetype_id = devicetype.devicetype_id
|
||||
left join dc_base_workSection section on section.worksection_id = devicetype.section_id
|
||||
WHERE
|
||||
item.is_delete = '0'
|
||||
OPTION 输入.search <> ""
|
||||
(item.item_code like 输入.search or
|
||||
item.item_name like 输入.search)
|
||||
ENDOPTION
|
||||
OPTION 输入.devicetype_id <> ""
|
||||
item.devicetype_id = 输入.devicetype_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -1,76 +0,0 @@
|
||||
|
||||
package org.nl.wms.device.rest;
|
||||
|
||||
|
||||
import org.nl.wms.device.service.dto.PdmBaseLineproceduredeviceDto;
|
||||
import org.nl.wms.device.service.PdmBaseLineproceduredeviceService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @date 2022-03-29
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "产线工序业务管理")
|
||||
@RequestMapping("/api/pdmBaseLineproceduredevice")
|
||||
@Slf4j
|
||||
public class PdmBaseLineproceduredeviceController {
|
||||
|
||||
private final PdmBaseLineproceduredeviceService pdmBaseLineproceduredeviceService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询产线工序业务")
|
||||
@ApiOperation("查询产线工序业务")
|
||||
//@PreAuthorize("@el.check('pdmBaseLineproceduredevice:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(pdmBaseLineproceduredeviceService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增产线工序业务")
|
||||
@ApiOperation("新增产线工序业务")
|
||||
//@PreAuthorize("@el.check('pdmBaseLineproceduredevice:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody PdmBaseLineproceduredeviceDto dto){
|
||||
pdmBaseLineproceduredeviceService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改产线工序业务")
|
||||
@ApiOperation("修改产线工序业务")
|
||||
//@PreAuthorize("@el.check('pdmBaseLineproceduredevice:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody PdmBaseLineproceduredeviceDto dto){
|
||||
pdmBaseLineproceduredeviceService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除产线工序业务")
|
||||
@ApiOperation("删除产线工序业务")
|
||||
//@PreAuthorize("@el.check('pdmBaseLineproceduredevice:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
pdmBaseLineproceduredeviceService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出产线工序业务")
|
||||
@ApiOperation("导出产线工序业务")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('pdmBaseLineproceduredevice:list')")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
pdmBaseLineproceduredeviceService.download(pdmBaseLineproceduredeviceService.queryAll(whereJson), response);
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
|
||||
package org.nl.wms.device.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mysql.cj.protocol.Security;
|
||||
import org.nl.wms.device.service.dto.PdmBaseProducelineDto;
|
||||
import org.nl.wms.device.service.PdmBaseProducelineService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @date 2022-03-31
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "生产产线管理")
|
||||
@RequestMapping("/api/pdmBaseProduceline")
|
||||
@Slf4j
|
||||
public class PdmBaseProducelineController {
|
||||
|
||||
private final PdmBaseProducelineService pdmBaseProducelineService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询生产产线")
|
||||
@ApiOperation("查询生产产线")
|
||||
//@PreAuthorize("@el.check('pdmBaseProduceline:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(pdmBaseProducelineService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增生产产线")
|
||||
@ApiOperation("新增生产产线")
|
||||
//@PreAuthorize("@el.check('pdmBaseProduceline:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody PdmBaseProducelineDto dto){
|
||||
pdmBaseProducelineService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改生产产线")
|
||||
@ApiOperation("修改生产产线")
|
||||
//@PreAuthorize("@el.check('pdmBaseProduceline:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody PdmBaseProducelineDto dto){
|
||||
pdmBaseProducelineService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除生产产线")
|
||||
@ApiOperation("删除生产产线")
|
||||
//@PreAuthorize("@el.check('pdmBaseProduceline:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
pdmBaseProducelineService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出生产产线")
|
||||
@ApiOperation("导出生产产线")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('pdmBaseProduceline:list')")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
pdmBaseProducelineService.download(pdmBaseProducelineService.queryAll(whereJson), response);
|
||||
}
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改点位启用状态")
|
||||
@ApiOperation("修改点位启用状态")
|
||||
//@PreAuthorize("@el.check('store:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject json) {
|
||||
pdmBaseProducelineService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
|
||||
package org.nl.wms.device.service;
|
||||
|
||||
import org.nl.wms.device.service.dto.PdmBaseLineproceduredeviceDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author qinx
|
||||
* @date 2022-03-29
|
||||
**/
|
||||
public interface PdmBaseLineproceduredeviceService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<PdmBaseLineproceduredeviceDto>
|
||||
*/
|
||||
List<PdmBaseLineproceduredeviceDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param relation_id ID
|
||||
* @return PdmBaseLineproceduredevice
|
||||
*/
|
||||
PdmBaseLineproceduredeviceDto findById(Long relation_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return PdmBaseLineproceduredevice
|
||||
*/
|
||||
PdmBaseLineproceduredeviceDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(PdmBaseLineproceduredeviceDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(PdmBaseLineproceduredeviceDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<PdmBaseLineproceduredeviceDto> dtos, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
|
||||
package org.nl.wms.device.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.device.service.dto.PdmBaseProducelineDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author qinx
|
||||
* @date 2022-03-31
|
||||
**/
|
||||
public interface PdmBaseProducelineService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<PdmBaseProducelineDto>
|
||||
*/
|
||||
List<PdmBaseProducelineDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param produceLine_id ID
|
||||
* @return PdmBaseProduceline
|
||||
*/
|
||||
PdmBaseProducelineDto findById(Long produceLine_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return PdmBaseProduceline
|
||||
*/
|
||||
PdmBaseProducelineDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(PdmBaseProducelineDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(PdmBaseProducelineDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<PdmBaseProducelineDto> dtos, HttpServletResponse response) throws IOException;
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param json /
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package org.nl.wms.device.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author qinx
|
||||
* @date 2022-03-29
|
||||
**/
|
||||
@Data
|
||||
public class PdmBaseLineproceduredeviceDto implements Serializable {
|
||||
|
||||
/** 关系标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long relation_id;
|
||||
|
||||
/** 产线标识 */
|
||||
private Long produceLine_id;
|
||||
|
||||
/** 工序标识 */
|
||||
private Long workprocedure_id;
|
||||
|
||||
/** 设备标识 */
|
||||
private Long device_id;
|
||||
|
||||
/** 顺序号 */
|
||||
private BigDecimal seq_no;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 创建人 */
|
||||
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 String is_delete;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package org.nl.wms.device.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author qinx
|
||||
* @date 2022-03-31
|
||||
**/
|
||||
@Data
|
||||
public class PdmBaseProducelineDto implements Serializable {
|
||||
|
||||
/** 产线标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long produceline_id;
|
||||
|
||||
/** 产线编码 */
|
||||
private String produceline_code;
|
||||
|
||||
/** 产线名称 */
|
||||
private String produceline_name;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 创建人 */
|
||||
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 String is_delete;
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
|
||||
package org.nl.wms.device.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.device.service.PdmBaseLineproceduredeviceService;
|
||||
import org.nl.wms.device.service.dto.PdmBaseLineproceduredeviceDto;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description 服务实现
|
||||
* @date 2022-03-29
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PdmBaseLineproceduredeviceServiceImpl implements PdmBaseLineproceduredeviceService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_lineproceduredevice");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PdmBaseLineproceduredeviceDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_lineproceduredevice");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<PdmBaseLineproceduredeviceDto> list = arr.toJavaList(PdmBaseLineproceduredeviceDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBaseLineproceduredeviceDto findById(Long relation_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_lineproceduredevice");
|
||||
JSONObject json = wo.query("relation_id ='" + relation_id + "'").uniqueResult(0);
|
||||
final PdmBaseLineproceduredeviceDto obj = (PdmBaseLineproceduredeviceDto) JSONObject.toJavaObject(json, PdmBaseLineproceduredeviceDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBaseLineproceduredeviceDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_lineproceduredevice");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final PdmBaseLineproceduredeviceDto obj = (PdmBaseLineproceduredeviceDto) JSONObject.toJavaObject(json, PdmBaseLineproceduredeviceDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(PdmBaseLineproceduredeviceDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setRelation_id(Long.valueOf(IdUtil.getSnowflake(1, 1).nextId() + ""));
|
||||
dto.setCreate_name(currentUsername);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_lineproceduredevice");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(PdmBaseLineproceduredeviceDto dto) {
|
||||
PdmBaseLineproceduredeviceDto entity = this.findById(dto.getRelation_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_lineproceduredevice");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_lineproceduredevice");
|
||||
for (Long relation_id : ids) {
|
||||
wo.delete("relation_id = '" + relation_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<PdmBaseLineproceduredeviceDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (PdmBaseLineproceduredeviceDto pdmBaseLineproceduredevice : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("产线标识", pdmBaseLineproceduredevice.getProduceLine_id());
|
||||
map.put("工序标识", pdmBaseLineproceduredevice.getWorkprocedure_id());
|
||||
map.put("设备标识", pdmBaseLineproceduredevice.getDevice_id());
|
||||
map.put("顺序号", pdmBaseLineproceduredevice.getSeq_no());
|
||||
map.put("是否启用", pdmBaseLineproceduredevice.getIs_used());
|
||||
map.put("创建人", pdmBaseLineproceduredevice.getCreate_id());
|
||||
map.put("创建人姓名", pdmBaseLineproceduredevice.getCreate_name());
|
||||
map.put("创建时间", pdmBaseLineproceduredevice.getCreate_time());
|
||||
map.put("修改人", pdmBaseLineproceduredevice.getUpdate_optid());
|
||||
map.put("修改人姓名", pdmBaseLineproceduredevice.getUpdate_optname());
|
||||
map.put("修改时间", pdmBaseLineproceduredevice.getUpdate_time());
|
||||
map.put("是否删除", pdmBaseLineproceduredevice.getIs_delete());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
|
||||
package org.nl.wms.device.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.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.device.service.PdmBaseProducelineService;
|
||||
import org.nl.wms.device.service.dto.PdmBaseProducelineDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description 服务实现
|
||||
* @date 2022-03-31
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PdmBaseProducelineServiceImpl implements PdmBaseProducelineService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_produceline");
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
if (StrUtil.isNotEmpty(search)) {
|
||||
map.put("search", "%" + search + "%");
|
||||
}
|
||||
JSONObject json = WQL.getWO("QL_PRODUCELINE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PdmBaseProducelineDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_produceline");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<PdmBaseProducelineDto> list = arr.toJavaList(PdmBaseProducelineDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBaseProducelineDto findById(Long produceLine_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_produceline");
|
||||
JSONObject json = wo.query("produceLine_id ='" + produceLine_id + "'").uniqueResult(0);
|
||||
final PdmBaseProducelineDto obj = (PdmBaseProducelineDto) JSONObject.toJavaObject(json, PdmBaseProducelineDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBaseProducelineDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_produceline");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final PdmBaseProducelineDto obj = (PdmBaseProducelineDto) JSONObject.toJavaObject(json, PdmBaseProducelineDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(PdmBaseProducelineDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setProduceline_id(Long.valueOf(IdUtil.getSnowflake(1, 1).nextId() + ""));
|
||||
dto.setCreate_name(currentUsername);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_produceline");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(PdmBaseProducelineDto dto) {
|
||||
PdmBaseProducelineDto entity = this.findById(dto.getProduceline_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_produceline");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_base_produceline");
|
||||
for (Long produceLine_id : ids) {
|
||||
wo.delete("produceLine_id = '" + produceLine_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<PdmBaseProducelineDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (PdmBaseProducelineDto pdmBaseProduceline : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("产线编码", pdmBaseProduceline.getProduceline_code());
|
||||
map.put("产线名称", pdmBaseProduceline.getProduceline_name());
|
||||
map.put("是否启用", pdmBaseProduceline.getIs_used());
|
||||
map.put("创建人", pdmBaseProduceline.getCreate_id());
|
||||
map.put("创建人姓名", pdmBaseProduceline.getCreate_name());
|
||||
map.put("创建时间", pdmBaseProduceline.getCreate_time());
|
||||
map.put("修改人", pdmBaseProduceline.getUpdate_optid());
|
||||
map.put("修改人姓名", pdmBaseProduceline.getUpdate_optname());
|
||||
map.put("修改时间", pdmBaseProduceline.getUpdate_time());
|
||||
map.put("是否删除", pdmBaseProduceline.getIs_delete());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeActive(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String is_used = "1";
|
||||
if (StrUtil.equals("1", json.getString("is_used"))) {
|
||||
is_used = "0";
|
||||
}
|
||||
json.put("is_used", is_used);
|
||||
json.put("update_optid", currentUserId);
|
||||
json.put("update_optname", nickName);
|
||||
json.put("update_time", now);
|
||||
WQLObject.getWQLObject("pdm_base_produceline").update(json);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 工作量汇报分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.search TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
PDM_BASE_produceLine line
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.search <> ""
|
||||
line.produceline_code like 输入.search
|
||||
or line.produceline_name like 输入.search
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user