diff --git a/lms/nladmin-system/src/main/java/org/nl/system/controller/user/UserController.java b/lms/nladmin-system/src/main/java/org/nl/system/controller/user/UserController.java index ebbbdbd..2b746c9 100644 --- a/lms/nladmin-system/src/main/java/org/nl/system/controller/user/UserController.java +++ b/lms/nladmin-system/src/main/java/org/nl/system/controller/user/UserController.java @@ -39,6 +39,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.List; import java.util.Map; import java.util.Set; @@ -61,8 +62,13 @@ public class UserController { return new ResponseEntity(TableDataInfo.build(userService.getUserDetail(query, page)), HttpStatus.OK); } - @Log("新增用户") + @PostMapping(value = "/getUserList") + public ResponseEntity query() { + List userList = userService.list(new QueryWrapper().eq("is_used", true)); + return new ResponseEntity(userList, HttpStatus.OK); + } + @Log("新增用户") @PostMapping // @SaCheckPermission("user:add") public ResponseEntity create(@RequestBody Map user) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/controller/DeviceStatusController.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/controller/DeviceStatusController.java new file mode 100644 index 0000000..d214381 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/controller/DeviceStatusController.java @@ -0,0 +1,50 @@ +package org.nl.wms.basedata.master.devicestatus.controller; + + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.TableDataInfo; +import org.nl.common.domain.query.PageQuery; +import org.nl.modules.logging.annotation.Log; +import org.nl.wms.basedata.master.devicestatus.service.DeviceStatusService; +import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus; +import org.nl.wms.basedata.master.devicestatus.service.dto.DeviceStatusQuery; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + + +/** + * @author ldjun + * @date 2021-12-06 + **/ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/devicestatus") +@Slf4j +public class DeviceStatusController { + + private final DeviceStatusService deviceStatusService; + + @GetMapping + @Log("查询设备状态监控") + public ResponseEntity query(DeviceStatusQuery whereJson, PageQuery page) { + return new ResponseEntity<>(TableDataInfo.build(deviceStatusService.queryAll(whereJson, page)), HttpStatus.OK); + + } + + @PostMapping + @Log("新增客户基础表") + public ResponseEntity create(@RequestBody DeviceStatus jo) { + deviceStatusService.create(jo); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + + @PutMapping + @Log("修改客户基础表") + public ResponseEntity update(@RequestBody DeviceStatus jo) { + deviceStatusService.update(jo); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/DeviceStatusService.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/DeviceStatusService.java new file mode 100644 index 0000000..87a922e --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/DeviceStatusService.java @@ -0,0 +1,35 @@ +package org.nl.wms.basedata.master.devicestatus.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.common.domain.query.PageQuery; +import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus; +import org.nl.wms.basedata.master.devicestatus.service.dto.DeviceStatusQuery; + +/** + * @author liuxy + * @description 服务接口 + * @date 2023-04-20 + **/ +public interface DeviceStatusService extends IService { + + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + IPage queryAll(DeviceStatusQuery whereJson, PageQuery page); + /** + * 新增 + * + * @param jo / + */ + void create(DeviceStatus jo); + /** + * 编辑 + * + */ + void update(DeviceStatus jo); +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/DeviceStatus.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/DeviceStatus.java new file mode 100644 index 0000000..66243a9 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/DeviceStatus.java @@ -0,0 +1,54 @@ +package org.nl.wms.basedata.master.devicestatus.service.dao; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @author: zds + * @date: 2024-09-27 + * @description: + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("em_bi_devicestatus") +public class DeviceStatus implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "devicestatus_id", type = IdType.NONE) + private String devicestatus_id; + + private String device_code; + + private String device_name; + + private String product_area; + + private String plan; + + private String device_type; + + private String mode; + + private String mode_update_time; + + private String error; + + private String error_msg; + + private String error_update_time; + + private String is_upload; + + private String upload_time; + + private String upload_flag; + + private String upload_user; + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java new file mode 100644 index 0000000..94d21e4 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.java @@ -0,0 +1,14 @@ +package org.nl.wms.basedata.master.devicestatus.service.dao.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus; +import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice; + +/** + * @author: zds + * @date: 2024-09-27 + * @description: + */ +public interface DeviceStatusMapper extends BaseMapper { + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml new file mode 100644 index 0000000..6e6b2d5 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dao/mapper/DeviceStatusMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dto/DeviceStatusQuery.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dto/DeviceStatusQuery.java new file mode 100644 index 0000000..578ec1d --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/dto/DeviceStatusQuery.java @@ -0,0 +1,20 @@ +package org.nl.wms.basedata.master.devicestatus.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author: zds + * @date: 2024-09-27 + * @description: + */ +@Data +public class DeviceStatusQuery implements Serializable { + //设备编码或设备名称 + private String search; + //车间区域 + private String product_area; + //类型 + private String device_type; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/impl/DeviceStatusServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/impl/DeviceStatusServiceImpl.java new file mode 100644 index 0000000..115a9f2 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/devicestatus/service/impl/DeviceStatusServiceImpl.java @@ -0,0 +1,80 @@ +package org.nl.wms.basedata.master.devicestatus.service.impl; + + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.domain.query.PageQuery; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.wms.basedata.master.devicestatus.service.DeviceStatusService; +import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus; +import org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper; +import org.nl.wms.basedata.master.devicestatus.service.dto.DeviceStatusQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +/** + * @author liuxy + * @description 服务实现 + * @date 2023-04-20 + **/ +@Service +@Slf4j +public class DeviceStatusServiceImpl extends ServiceImpl implements DeviceStatusService { + + @Autowired + private DeviceStatusMapper deviceStatusMapper; + + @Override + public IPage queryAll(DeviceStatusQuery whereJson, PageQuery page) { + + IPage pages = new Page<>(page.getPage() + 1, page.getSize()); + LambdaQueryWrapper lam = new LambdaQueryWrapper(); + + lam.eq(ObjectUtil.isNotEmpty(whereJson.getDevice_type()), DeviceStatus::getDevice_type, whereJson.getDevice_type()) + .eq(ObjectUtil.isNotEmpty(whereJson.getProduct_area()), DeviceStatus::getProduct_area, whereJson.getProduct_area()) + .and(ObjectUtil.isNotEmpty(whereJson.getSearch()),blam -> blam.like(DeviceStatus::getDevice_code, whereJson.getSearch()).or() + .like(DeviceStatus::getDevice_name, whereJson.getSearch())) + .orderByDesc(DeviceStatus::getDevice_code); + deviceStatusMapper.selectPage(pages, lam); + return pages; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(DeviceStatus jo) { + LambdaQueryWrapper lam = new LambdaQueryWrapper(); + lam.eq(DeviceStatus::getDevice_code,jo.getDevice_code()); + DeviceStatus deviceStatus = deviceStatusMapper.selectOne(lam); + + if (ObjectUtil.isNotEmpty(deviceStatus)) { + throw new BadRequestException("已存在相同的设备编码!"); + }else{//新增 + deviceStatusMapper.insert(jo); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DeviceStatus jo) { + LambdaQueryWrapper lam = new LambdaQueryWrapper(); + lam.eq(DeviceStatus::getDevice_code,jo.getDevice_code()); + DeviceStatus deviceStatus = deviceStatusMapper.selectOne(lam); + + if (ObjectUtil.isNotEmpty(deviceStatus)) { + String devicestatus_id = deviceStatus.getDevicestatus_id(); + if(devicestatus_id.equals(jo.getDevicestatus_id())){ + deviceStatusMapper.updateById(jo); + }else{ + throw new BadRequestException("已存在相同的设备编码!"); + } + }else{//新增 + deviceStatusMapper.insert(jo); + } + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/DeviceStatusController.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/DeviceStatusController.java deleted file mode 100644 index a1d7dbe..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/DeviceStatusController.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.nl.wms.basedata.master.rest; - - -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.logging.annotation.Log; -import org.nl.wms.basedata.master.service.DeviceStatusService; -import org.springframework.data.domain.Pageable; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** - * @author ldjun - * @date 2021-12-06 - **/ -@RestController -@RequiredArgsConstructor - -@RequestMapping("/api/devicestatus") -@Slf4j -public class DeviceStatusController { - - private final DeviceStatusService deviceStatusService; - - @GetMapping - @Log("查询设备状态监控") - - //@PreAuthorize("@el.check('customerbase:list')") - public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { - return new ResponseEntity<>(deviceStatusService.queryAll(whereJson, page), HttpStatus.OK); - } - - @PostMapping - @Log("新增客户基础表") - - //@PreAuthorize("@el.check('customerbase:add')") - public ResponseEntity create(@RequestBody JSONObject jo) { - deviceStatusService.create(jo); - return new ResponseEntity<>(HttpStatus.CREATED); - } - - - @PutMapping - @Log("修改客户基础表") - - //@PreAuthorize("@el.check('customerbase:edit')") - public ResponseEntity update(@RequestBody JSONObject jo) { - deviceStatusService.update(jo); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除客户基础表") - - //@PreAuthorize("@el.check('customerbase:del')") - @DeleteMapping - public ResponseEntity delete(@RequestBody Long[] ids) { - deviceStatusService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/DeviceStatusService.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/DeviceStatusService.java deleted file mode 100644 index 240c8ce..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/DeviceStatusService.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.nl.wms.basedata.master.service; - -import com.alibaba.fastjson.JSONObject; -import org.nl.wms.basedata.master.service.dto.CustomerbaseDto; -import org.springframework.data.domain.Pageable; - -import java.util.List; -import java.util.Map; - -/** - * @author ldjun - * @description 服务接口 - * @date 2021-12-06 - **/ -public interface DeviceStatusService { - - /** - * 查询数据分页 - * - * @param whereJson 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(Map whereJson, Pageable page); - - /** - * 查询所有数据不分页 - * - * @param whereJson 条件参数 - * @return List - */ - List queryAll(Map whereJson); - - /** - * 新增 - * - * @param jo / - */ - void create(JSONObject jo); - - /** - * 编辑 - * - * @param jo / - */ - void update(JSONObject jo); - - /** - * 多选删除 - * - * @param ids / - */ - void deleteAll(Long[] ids); -} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/DeviceStatusServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/DeviceStatusServiceImpl.java deleted file mode 100644 index 0aacdb9..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/DeviceStatusServiceImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.nl.wms.basedata.master.service.impl; - - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.common.utils.SecurityUtils; -import org.nl.modules.common.exception.BadRequestException; -import org.nl.modules.wql.core.bean.ResultBean; -import org.nl.modules.wql.core.bean.WQLObject; -import org.nl.modules.wql.util.WqlUtil; -import org.nl.wms.basedata.master.service.DeviceStatusService; -import org.nl.wms.basedata.master.service.dto.CustomerbaseDto; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author ldjun - * @description 服务实现 - * @date 2021-12-06 - **/ -@Service -@RequiredArgsConstructor -@Slf4j -public class DeviceStatusServiceImpl implements DeviceStatusService { - @Autowired - private DeviceStatusService deviceStatusService; - - @Override - public Map queryAll(Map whereJson, Pageable page) { - String where = "1=1"; - WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus"); - String search = (String) whereJson.get("search"); - if (!StrUtil.isEmpty(search)) { - where += " AND (device_code like '%" + search + "%' OR device_name like '%" + search + "%')"; - } - String product_area = (String) whereJson.get("product_area"); - if (!StrUtil.isEmpty(product_area)) { - where += " AND product_area = '" + product_area + "'"; - } - String device_type = (String) whereJson.get("device_type"); - if (!StrUtil.isEmpty(device_type)) { - where += " AND device_type = '" + device_type + "'"; - } - ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "device_code desc"); - final JSONObject json = rb.pageResult(); - return json; - } - - @Override - public List queryAll(Map whereJson) { - WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase"); - JSONArray arr = wo.query().getResultJSONArray(0); - List list = arr.toJavaList(CustomerbaseDto.class); - return list; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void create(JSONObject jo) { - WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus"); - if (ObjectUtil.isNotEmpty(jo.getJSONArray("upload_user"))) { - JSONArray rows = jo.getJSONArray("upload_user"); - HashMap map = new HashMap<>(); - String msg = ""; - for (int i = 0; i < rows.size(); i++) { - if (i != rows.size() - 1) { - msg += rows.getString(i) + ","; - } else { - msg += rows.getString(i); - } - } - jo.put("upload_user", msg); - } - try { - wo.insert(jo); - } catch (Exception e) { - throw new BadRequestException("存在相同的设备编码!"); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(JSONObject jo) { - WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus"); - String device_code = jo.getString("device_code"); - try { - if (!jo.containsKey("need_update_flag")) { - JSONArray rows = jo.getJSONArray("upload_user"); - if (ObjectUtil.isEmpty(rows)) { - rows = new JSONArray(); - } - HashMap map = new HashMap<>(); - String msg = ""; - for (int i = 0; i < rows.size(); i++) { - if (i != rows.size() - 1) { - msg += rows.getString(i) + ","; - } else { - msg += rows.getString(i); - } - } - map.put("upload_user", msg); - wo.update(map, "device_code = '" + device_code + "'"); - } else { - wo.update(jo); - } - } catch (Exception e) { - throw new BadRequestException("存在相同的设备编码!"); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids) { - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - - WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase"); - for (Long cust_id : ids) { - JSONObject param = new JSONObject(); - param.put("cust_id", String.valueOf(cust_id)); - param.put("is_delete", "1"); - param.put("update_optid", currentUserId); - param.put("update_optname", nickName); - param.put("update_time", now); - wo.update(param); - } - } -} diff --git a/lms/nladmin-ui/src/views/wms/agvrush/devicestatus/index.vue b/lms/nladmin-ui/src/views/wms/agvrush/devicestatus/index.vue index eb15eff..f635e42 100644 --- a/lms/nladmin-ui/src/views/wms/agvrush/devicestatus/index.vue +++ b/lms/nladmin-ui/src/views/wms/agvrush/devicestatus/index.vue @@ -137,8 +137,7 @@ - + {{ item.username }} - {{ item.personName }} + {{ item.person_name }} @@ -167,16 +166,15 @@ style="width: 100%;" @selection-change="crud.selectionChangeHandler" > - - - - - - - - - - + + + + + + + + + - +