add: 新增pc端组盘
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package org.nl.wms.basedata.rest;
|
||||
|
||||
import org.nl.wms.basedata.service.MaterialDetailService;
|
||||
import org.nl.wms.basedata.service.dto.MaterialDetailDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-04-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "物料详情管理")
|
||||
@RequestMapping("/api/materialDetail")
|
||||
@Slf4j
|
||||
public class MaterialDetailController {
|
||||
|
||||
private final MaterialDetailService materialDetailService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询物料详情")
|
||||
@ApiOperation("查询物料详情")
|
||||
//@SaCheckPermission("@el.check('materialDetail:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(materialDetailService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增物料详情")
|
||||
@ApiOperation("新增物料详情")
|
||||
//@SaCheckPermission("@el.check('materialDetail:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MaterialDetailDto dto){
|
||||
materialDetailService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改物料详情")
|
||||
@ApiOperation("修改物料详情")
|
||||
//@SaCheckPermission("@el.check('materialDetail:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MaterialDetailDto dto){
|
||||
materialDetailService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除物料详情")
|
||||
@ApiOperation("删除物料详情")
|
||||
//@SaCheckPermission("@el.check('materialDetail:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
materialDetailService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
|
||||
package org.nl.wms.basedata.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.service.VehicleDetailService;
|
||||
import org.nl.wms.basedata.service.dto.VehicleDetailDto;
|
||||
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-04-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "组盘信息管理")
|
||||
@RequestMapping("/api/vehicleDetail")
|
||||
@Slf4j
|
||||
public class VehicleDetailController {
|
||||
|
||||
private final VehicleDetailService vehicleDetailService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询组盘信息")
|
||||
@ApiOperation("查询组盘信息")
|
||||
//@SaCheckPermission("@el.check('vehicleDetail:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(vehicleDetailService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增组盘信息")
|
||||
@ApiOperation("新增组盘信息")
|
||||
//@SaCheckPermission("@el.check('vehicleDetail:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody VehicleDetailDto dto){
|
||||
vehicleDetailService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改组盘信息")
|
||||
@ApiOperation("修改组盘信息")
|
||||
//@SaCheckPermission("@el.check('vehicleDetail:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody VehicleDetailDto dto){
|
||||
vehicleDetailService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除组盘信息")
|
||||
@ApiOperation("删除组盘信息")
|
||||
//@SaCheckPermission("@el.check('vehicleDetail:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
vehicleDetailService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
package org.nl.wms.basedata.service;
|
||||
|
||||
import org.nl.wms.basedata.service.dto.MaterialDetailDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 服务接口
|
||||
* @date 2023-04-17
|
||||
**/
|
||||
public interface MaterialDetailService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<MaterialDetailDto>
|
||||
*/
|
||||
List<MaterialDetailDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param material_id ID
|
||||
* @return MaterialDetail
|
||||
*/
|
||||
MaterialDetailDto findById(Long material_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return MaterialDetail
|
||||
*/
|
||||
MaterialDetailDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(MaterialDetailDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(MaterialDetailDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
package org.nl.wms.basedata.service;
|
||||
|
||||
import org.nl.wms.basedata.service.dto.VehicleDetailDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 服务接口
|
||||
* @date 2023-04-17
|
||||
**/
|
||||
public interface VehicleDetailService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<VehicleDetailDto>
|
||||
*/
|
||||
List<VehicleDetailDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param vd_id ID
|
||||
* @return VehicleDetail
|
||||
*/
|
||||
VehicleDetailDto findById(Long vd_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return VehicleDetail
|
||||
*/
|
||||
VehicleDetailDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(VehicleDetailDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(VehicleDetailDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.nl.wms.basedata.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description /
|
||||
* @date 2023-04-17
|
||||
**/
|
||||
@Data
|
||||
public class MaterialDetailDto implements Serializable {
|
||||
|
||||
/** 物料标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long material_id;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String order_number;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String customer_name;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String product_name;
|
||||
|
||||
/**
|
||||
* 产品牌号
|
||||
*/
|
||||
private String product_grade;
|
||||
|
||||
/**
|
||||
* 砖型
|
||||
*/
|
||||
private String brick_type;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package org.nl.wms.basedata.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 lyd
|
||||
* @description /
|
||||
* @date 2023-04-17
|
||||
**/
|
||||
@Data
|
||||
public class VehicleDetailDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long vd_id;
|
||||
|
||||
private String vehicle_type;
|
||||
|
||||
private String vehicle_code;
|
||||
|
||||
private Long material_id;
|
||||
|
||||
private BigDecimal qty;
|
||||
|
||||
private BigDecimal weight;
|
||||
|
||||
private String is_full;
|
||||
|
||||
private Long workorder_id;
|
||||
|
||||
private String point_code;
|
||||
|
||||
private String tray_high;
|
||||
|
||||
private String crib_category;
|
||||
|
||||
private String palletX1_line;
|
||||
|
||||
private String palletY1_row;
|
||||
|
||||
private String palletA1_angle;
|
||||
|
||||
private String palletX2_line;
|
||||
|
||||
private String palletY2_row;
|
||||
|
||||
private String palletA2_angle;
|
||||
|
||||
private String palletX3_line;
|
||||
|
||||
private String palletY3_row;
|
||||
|
||||
private String palletA3_angle;
|
||||
|
||||
private String pressCribX1_line;
|
||||
|
||||
private String pressCribY1_row;
|
||||
|
||||
private String pressCribA1_angle;
|
||||
|
||||
private String pressCribX2_line;
|
||||
|
||||
private String pressCribY2_row;
|
||||
|
||||
private String pressCribA2_angle;
|
||||
|
||||
private String pressCribX3_line;
|
||||
|
||||
private String pressCribY3_row;
|
||||
|
||||
private String pressCribA3_angle;
|
||||
|
||||
private String Zoffset;
|
||||
|
||||
private String pallet_layerQty;
|
||||
|
||||
private String pressCrib_layerQty;
|
||||
|
||||
private String codeLayerX1_interval;
|
||||
|
||||
private String codeLayerY1_interval;
|
||||
|
||||
private String codeLayerX2_interval;
|
||||
|
||||
private String codeLayerY2_interval;
|
||||
|
||||
private String codeLayerX3_interval;
|
||||
|
||||
private String codeLayerY3_interval;
|
||||
|
||||
private String codeLayerX1_offset;
|
||||
|
||||
private String codeLayerY1_offset;
|
||||
|
||||
private String codeLayerX2_offset;
|
||||
|
||||
private String codeLayerY2_offset;
|
||||
|
||||
private String codeLayerX3_offset;
|
||||
|
||||
private String codeLayerY3_offset;
|
||||
|
||||
private String pressLayerX1_interval;
|
||||
|
||||
private String pressLayerY1_interval;
|
||||
|
||||
private String pressLayerX2_interval;
|
||||
|
||||
private String pressLayerY2_interval;
|
||||
|
||||
private String pressLayerX3_interval;
|
||||
|
||||
private String pressLayerY3_interval;
|
||||
|
||||
private String pressLayerX1_offset;
|
||||
|
||||
private String pressLayerY1_offset;
|
||||
|
||||
private String pressLayerX2_offset;
|
||||
|
||||
private String pressLayerY2_offset;
|
||||
|
||||
private String pressLayerX3_offset;
|
||||
|
||||
private String pressLayerY3_offset;
|
||||
|
||||
private String tool_coordinate;
|
||||
|
||||
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 is_fire;
|
||||
|
||||
private String is_in_kiln;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
|
||||
package org.nl.wms.basedata.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata.service.MaterialDetailService;
|
||||
import org.nl.wms.basedata.service.dto.MaterialDetailDto;
|
||||
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.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 服务实现
|
||||
* @date 2023-04-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MaterialDetailServiceImpl implements MaterialDetailService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_material_detail");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaterialDetailDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_material_detail");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(MaterialDetailDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialDetailDto findById(Long material_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_material_detail");
|
||||
JSONObject json = wo.query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(MaterialDetailDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialDetailDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_material_detail");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(MaterialDetailDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(MaterialDetailDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setMaterial_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("md_me_material_detail");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(MaterialDetailDto dto) {
|
||||
MaterialDetailDto entity = this.findById(dto.getMaterial_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_material_detail");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_me_material_detail");
|
||||
for (Long material_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", String.valueOf(material_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
|
||||
package org.nl.wms.basedata.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.basedata.service.VehicleDetailService;
|
||||
import org.nl.wms.basedata.service.dto.VehicleDetailDto;
|
||||
import org.nl.wms.util.MapOf;
|
||||
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.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 服务实现
|
||||
* @date 2023-04-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class VehicleDetailServiceImpl implements VehicleDetailService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
JSONObject pageQuery = WQL.getWO("QMD_PB_VEHICLE_GROUP").addParamMap(MapOf.of("flag", "1"
|
||||
, "vehicle_code", whereJson.get("vehicle_code")))
|
||||
.pageQuery(WqlUtil.getHttpContext(page), "vehicle_code asc");
|
||||
return pageQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VehicleDetailDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(VehicleDetailDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VehicleDetailDto findById(Long vd_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
JSONObject json = wo.query("vd_id = '" + vd_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(VehicleDetailDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VehicleDetailDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(VehicleDetailDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(VehicleDetailDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setVd_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("st_ivt_vehicle_detail");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(VehicleDetailDto dto) {
|
||||
VehicleDetailDto entity = this.findById(dto.getVd_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
for (Long vd_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("vd_id", String.valueOf(vd_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
[交易说明]
|
||||
交易名: 载具组盘
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.vehicle_code TYPEAS s_string
|
||||
输入.vehicle_type TYPEAS s_string
|
||||
输入.vehicle_status TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
vd.*,
|
||||
p.point_name
|
||||
FROM
|
||||
st_ivt_vehicle_detail vd
|
||||
LEFT JOIN sch_base_point p ON p.point_code = vd.point_code
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.vehicle_code <> ""
|
||||
vd.vehicle_code LIKE '%' 输入.vehicle_code '%'
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user