缓存线区域
This commit is contained in:
@@ -24,7 +24,7 @@ public class CachelinePositionDto implements Serializable {
|
||||
private BigDecimal positionOrder_no;
|
||||
|
||||
/** 缓存线编码 */
|
||||
private String cacheLine_code;
|
||||
private String cacheline_code;
|
||||
|
||||
/** 缓存线层数 */
|
||||
private BigDecimal layer_num;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.wms.cacheline.region.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.wms.cacheline.region.service.CachelineRegionRelationService;
|
||||
import org.nl.wms.cacheline.region.service.dto.CachelineRegionRelationDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-03-24
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "个缓存线区域关系管理")
|
||||
@RequestMapping("/api/cachelineRegionRelation")
|
||||
@Slf4j
|
||||
public class CachelineRegionRelationController {
|
||||
|
||||
private final CachelineRegionRelationService cachelineRegionRelationService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询个缓存线区域关系")
|
||||
@ApiOperation("查询个缓存线区域关系")
|
||||
//@PreAuthorize("@el.check('cachelineRegionRelation:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(cachelineRegionRelationService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增个缓存线区域关系")
|
||||
@ApiOperation("新增个缓存线区域关系")
|
||||
//@PreAuthorize("@el.check('cachelineRegionRelation:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody CachelineRegionRelationDto dto){
|
||||
cachelineRegionRelationService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改个缓存线区域关系")
|
||||
@ApiOperation("修改个缓存线区域关系")
|
||||
//@PreAuthorize("@el.check('cachelineRegionRelation:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody CachelineRegionRelationDto dto){
|
||||
cachelineRegionRelationService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除个缓存线区域关系")
|
||||
@ApiOperation("删除个缓存线区域关系")
|
||||
//@PreAuthorize("@el.check('cachelineRegionRelation:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
cachelineRegionRelationService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package org.nl.wms.cacheline.region.service;
|
||||
|
||||
import org.nl.wms.cacheline.region.service.dto.CachelineRegionRelationDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-03-24
|
||||
**/
|
||||
public interface CachelineRegionRelationService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<CachelineRegionRelationDto>
|
||||
*/
|
||||
List<CachelineRegionRelationDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param relation_id ID
|
||||
* @return CachelineRegionRelation
|
||||
*/
|
||||
CachelineRegionRelationDto findById(String relation_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return CachelineRegionRelation
|
||||
*/
|
||||
CachelineRegionRelationDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(CachelineRegionRelationDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(CachelineRegionRelationDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.wms.cacheline.region.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description /
|
||||
* @date 2023-03-24
|
||||
**/
|
||||
@Data
|
||||
public class CachelineRegionRelationDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
private String relation_id;
|
||||
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
private String region_code;
|
||||
|
||||
/**
|
||||
* 缓存线编码
|
||||
*/
|
||||
private String cacheline_code;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 是否可用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package org.nl.wms.cacheline.region.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.cacheline.region.service.CachelineRegionRelationService;
|
||||
import org.nl.wms.cacheline.region.service.dto.CachelineRegionRelationDto;
|
||||
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.common.utils.SecurityUtils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-03-24
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CachelineRegionRelationServiceImpl implements CachelineRegionRelationService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_cacheline_region_relation");
|
||||
String where = "1 = 1";
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("search"))){
|
||||
String search = whereJson.get("search").toString();
|
||||
where = "region_code like '%" + search + "%' " +
|
||||
"OR cacheline_code like '%" + search + "%'";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "region_code, cacheline_code");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CachelineRegionRelationDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_cacheline_region_relation");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(CachelineRegionRelationDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CachelineRegionRelationDto findById(String relation_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_cacheline_region_relation");
|
||||
JSONObject json = wo.query("relation_id = '" + relation_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( CachelineRegionRelationDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CachelineRegionRelationDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_cacheline_region_relation");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( CachelineRegionRelationDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(CachelineRegionRelationDto dto) {
|
||||
dto.setRelation_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_cacheline_region_relation");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(CachelineRegionRelationDto dto) {
|
||||
CachelineRegionRelationDto entity = this.findById(dto.getRelation_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_cacheline_region_relation");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_cacheline_region_relation");
|
||||
for (String relation_id: ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("relation_id", String.valueOf(relation_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", DateUtil.now());
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -71,8 +72,10 @@ public class ProduceWorkorderServiceImpl implements ProduceWorkorderService {
|
||||
String product_area = MapUtil.getStr(whereJson, "product_area");
|
||||
String product_series = "";
|
||||
// 员工只能看到自己创建的工单
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
SysUser one = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, currentUsername));
|
||||
String currentUserId = "";
|
||||
if (!SecurityUtils.getCurrentUsername().equals("admin")) currentUserId = SecurityUtils.getCurrentUserId();
|
||||
if (!one.getIsAdmin()) currentUserId = SecurityUtils.getCurrentUserId();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
//map.put("order_status", order_status);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user