41 changed files with 2642 additions and 1149 deletions
@ -1,60 +1,60 @@ |
|||||
package org.nl.wms.basedata.master.rest; |
//package org.nl.wms.basedata.master.rest;
|
||||
|
//
|
||||
|
//
|
||||
import lombok.RequiredArgsConstructor; |
//import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j; |
//import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log; |
//import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.service.SalesService; |
//import org.nl.wms.basedata.master.service.SalesService;
|
||||
import org.nl.wms.basedata.master.service.dto.SalesDto; |
//import org.nl.wms.basedata.master.service.dto.SalesDto;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus; |
//import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity; |
//import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated; |
//import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*; |
//import org.springframework.web.bind.annotation.*;
|
||||
|
//
|
||||
import java.util.Map; |
//import java.util.Map;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author loujf |
// * @author loujf
|
||||
* @date 2021-12-07 |
// * @date 2021-12-07
|
||||
**/ |
// **/
|
||||
@RestController |
//@RestController
|
||||
@RequiredArgsConstructor |
//@RequiredArgsConstructor
|
||||
|
//
|
||||
@RequestMapping("/api/sales") |
//@RequestMapping("/api/sales")
|
||||
@Slf4j |
//@Slf4j
|
||||
public class SalesController { |
//public class SalesController {
|
||||
private final SalesService salesService; |
// private final SalesService salesService;
|
||||
|
//
|
||||
@GetMapping |
// @GetMapping
|
||||
@Log("查询业务员") |
// @Log("查询业务员")
|
||||
|
//
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) { |
// public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(salesService.queryAll(whereJson, page), HttpStatus.OK); |
// return new ResponseEntity<>(salesService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
} |
// }
|
||||
|
//
|
||||
@PostMapping |
// @PostMapping
|
||||
@Log("查询业务员") |
// @Log("查询业务员")
|
||||
|
//
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SalesDto dto) { |
// public ResponseEntity<Object> create(@Validated @RequestBody SalesDto dto) {
|
||||
salesService.create(dto); |
// salesService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED); |
// return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
} |
// }
|
||||
|
//
|
||||
@PutMapping |
// @PutMapping
|
||||
@Log("查询业务员") |
// @Log("查询业务员")
|
||||
|
//
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SalesDto dto) { |
// public ResponseEntity<Object> update(@Validated @RequestBody SalesDto dto) {
|
||||
salesService.update(dto); |
// salesService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
} |
// }
|
||||
|
//
|
||||
@Log("查询业务员") |
// @Log("查询业务员")
|
||||
|
//
|
||||
@DeleteMapping |
// @DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) { |
// public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
salesService.deleteAll(ids); |
// salesService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK); |
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
} |
// }
|
||||
} |
//}
|
||||
|
@ -1,82 +1,83 @@ |
|||||
package org.nl.wms.basedata.master.rest; |
//package org.nl.wms.basedata.master.rest;
|
||||
|
//
|
||||
|
//
|
||||
import com.alibaba.fastjson.JSONObject; |
//import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor; |
//import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j; |
//import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log; |
//import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata.master.service.StoragevehicleinfoService; |
//import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto; |
//import org.nl.wms.basedata.master.service.StoragevehicleinfoService;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto;
|
||||
import org.springframework.http.HttpStatus; |
//import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity; |
//import org.springframework.http.HttpStatus;
|
||||
import org.springframework.validation.annotation.Validated; |
//import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*; |
//import org.springframework.validation.annotation.Validated;
|
||||
|
//import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Map; |
//
|
||||
|
//import java.util.Map;
|
||||
/** |
//
|
||||
* @author ldjun |
///**
|
||||
* @date 2021-12-09 |
// * @author ldjun
|
||||
**/ |
// * @date 2021-12-09
|
||||
@RestController |
// **/
|
||||
@RequiredArgsConstructor |
//@RestController
|
||||
|
//@RequiredArgsConstructor
|
||||
@RequestMapping("/api/storagevehicleinfo") |
//
|
||||
@Slf4j |
//@RequestMapping("/api/storagevehicleinfo")
|
||||
public class StoragevehicleinfoController { |
//@Slf4j
|
||||
|
//public class StoragevehicleinfoController {
|
||||
private final StoragevehicleinfoService storagevehicleinfoService; |
//
|
||||
|
// private final StoragevehicleinfoService storagevehicleinfoService;
|
||||
@GetMapping |
//
|
||||
@Log("查询载具") |
// @GetMapping
|
||||
|
// @Log("查询载具")
|
||||
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:list')")
|
//
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) { |
// //@PreAuthorize("@el.check('mdPbStoragevehicleinfo:list')")
|
||||
return new ResponseEntity<>(storagevehicleinfoService.queryAll(whereJson, page), HttpStatus.OK); |
// public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
} |
// return new ResponseEntity<>(storagevehicleinfoService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
|
// }
|
||||
@PostMapping |
//
|
||||
@Log("新增载具") |
// @PostMapping
|
||||
|
// @Log("新增载具")
|
||||
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:add')")
|
//
|
||||
public ResponseEntity<Object> create(@RequestBody Map map) { |
// //@PreAuthorize("@el.check('mdPbStoragevehicleinfo:add')")
|
||||
return new ResponseEntity<>(storagevehicleinfoService.create(map), HttpStatus.CREATED); |
// public ResponseEntity<Object> create(@RequestBody Map map) {
|
||||
} |
// return new ResponseEntity<>(storagevehicleinfoService.create(map), HttpStatus.CREATED);
|
||||
|
// }
|
||||
@PutMapping |
//
|
||||
@Log("修改载具") |
// @PutMapping
|
||||
|
// @Log("修改载具")
|
||||
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:edit')")
|
//
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject map) { |
// //@PreAuthorize("@el.check('mdPbStoragevehicleinfo:edit')")
|
||||
storagevehicleinfoService.update(map); |
// public ResponseEntity<Object> update(@RequestBody JSONObject map) {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
// storagevehicleinfoService.update(map);
|
||||
} |
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
// }
|
||||
@Log("删除载具") |
//
|
||||
|
// @Log("删除载具")
|
||||
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:del')")
|
//
|
||||
@DeleteMapping |
// //@PreAuthorize("@el.check('mdPbStoragevehicleinfo:del')")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) { |
// @DeleteMapping
|
||||
storagevehicleinfoService.deleteAll(ids); |
// public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
return new ResponseEntity<>(HttpStatus.OK); |
// storagevehicleinfoService.deleteAll(ids);
|
||||
} |
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
// }
|
||||
@PutMapping("/changeActive") |
//
|
||||
@Log("修改点位启用状态") |
// @PutMapping("/changeActive")
|
||||
|
// @Log("修改点位启用状态")
|
||||
//@PreAuthorize("@el.check('store:edit')")
|
//
|
||||
public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) { |
// //@PreAuthorize("@el.check('store:edit')")
|
||||
storagevehicleinfoService.changeActive(json); |
// public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
// storagevehicleinfoService.changeActive(json);
|
||||
} |
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
// }
|
||||
@GetMapping("/getVehicle/{code}") |
//
|
||||
@Log("获取起始载具号") |
// @GetMapping("/getVehicle/{code}")
|
||||
|
// @Log("获取起始载具号")
|
||||
//@PreAuthorize("@el.check('store:edit')")
|
//
|
||||
public ResponseEntity<Object> getVehicle(@PathVariable String code) { |
// //@PreAuthorize("@el.check('store:edit')")
|
||||
JSONObject json = storagevehicleinfoService.getVehicle(code); |
// public ResponseEntity<Object> getVehicle(@PathVariable String code) {
|
||||
return new ResponseEntity<>(json, HttpStatus.OK); |
// JSONObject json = storagevehicleinfoService.getVehicle(code);
|
||||
} |
// return new ResponseEntity<>(json, HttpStatus.OK);
|
||||
} |
// }
|
||||
|
//}
|
||||
|
@ -1,71 +1,71 @@ |
|||||
package org.nl.wms.basedata.master.rest; |
//package org.nl.wms.basedata.master.rest;
|
||||
|
//
|
||||
|
//
|
||||
import lombok.RequiredArgsConstructor; |
//import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j; |
//import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log; |
//import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.service.UnitService; |
//import org.nl.wms.basedata.master.service.UnitService;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus; |
//import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity; |
//import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated; |
//import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*; |
//import org.springframework.web.bind.annotation.*;
|
||||
|
//
|
||||
import java.util.Map; |
//import java.util.Map;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author loujf |
// * @author loujf
|
||||
* @date 2021-12-07 |
// * @date 2021-12-07
|
||||
**/ |
// **/
|
||||
@RestController |
//@RestController
|
||||
@RequiredArgsConstructor |
//@RequiredArgsConstructor
|
||||
|
//
|
||||
@RequestMapping("/api/mdPbMeasureunit") |
//@RequestMapping("/api/mdPbMeasureunit")
|
||||
@Slf4j |
//@Slf4j
|
||||
public class UnitController { |
//public class UnitController {
|
||||
private final UnitService unitService; |
// private final UnitService unitService;
|
||||
|
//
|
||||
@GetMapping |
// @GetMapping
|
||||
@Log("查询计量单位") |
// @Log("查询计量单位")
|
||||
|
//
|
||||
//@PreAuthorize("@el.check('Unit:list')")
|
// //@PreAuthorize("@el.check('Unit:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) { |
// public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(unitService.queryAll(whereJson, page), HttpStatus.OK); |
// return new ResponseEntity<>(unitService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
} |
// }
|
||||
|
//
|
||||
@PostMapping |
// @PostMapping
|
||||
@Log("新增计量单位") |
// @Log("新增计量单位")
|
||||
|
//
|
||||
//@PreAuthorize("@el.check('Unit:add')")
|
// //@PreAuthorize("@el.check('Unit:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody UnitDto dto) { |
// public ResponseEntity<Object> create(@Validated @RequestBody UnitDto dto) {
|
||||
unitService.create(dto); |
// unitService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED); |
// return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
} |
// }
|
||||
|
//
|
||||
@PutMapping |
// @PutMapping
|
||||
@Log("修改计量单位") |
// @Log("修改计量单位")
|
||||
|
//
|
||||
//@PreAuthorize("@el.check('Unit:edit')")
|
// //@PreAuthorize("@el.check('Unit:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody UnitDto dto) { |
// public ResponseEntity<Object> update(@Validated @RequestBody UnitDto dto) {
|
||||
unitService.update(dto); |
// unitService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
} |
// }
|
||||
|
//
|
||||
@Log("删除计量单位") |
// @Log("删除计量单位")
|
||||
|
//
|
||||
//@PreAuthorize("@el.check('Unit:del')")
|
// //@PreAuthorize("@el.check('Unit:del')")
|
||||
@DeleteMapping |
// @DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) { |
// public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
unitService.deleteAll(ids); |
// unitService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK); |
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
} |
// }
|
||||
|
//
|
||||
@GetMapping("/getUnit") |
// @GetMapping("/getUnit")
|
||||
@Log("查询单位下拉框") |
// @Log("查询单位下拉框")
|
||||
|
//
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
// //@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> queryUnit(@RequestParam Map whereJson) { |
// public ResponseEntity<Object> queryUnit(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(unitService.getUnit(whereJson), HttpStatus.OK); |
// return new ResponseEntity<>(unitService.getUnit(whereJson), HttpStatus.OK);
|
||||
} |
// }
|
||||
} |
//}
|
||||
|
@ -0,0 +1,60 @@ |
|||||
|
package org.nl.wms.basedata.master.sales.cotroller; |
||||
|
|
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.modules.logging.annotation.Log; |
||||
|
import org.nl.wms.basedata.master.sales.service.SalesService; |
||||
|
import org.nl.wms.basedata.master.sales.service.dto.SalesDto; |
||||
|
import org.nl.wms.basedata.master.sales.service.dto.SalesQuery; |
||||
|
|
||||
|
|
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequiredArgsConstructor |
||||
|
|
||||
|
@RequestMapping("/api/sales") |
||||
|
@Slf4j |
||||
|
public class SalesController { |
||||
|
private final SalesService salesService; |
||||
|
|
||||
|
@GetMapping |
||||
|
@Log("查询业务员") |
||||
|
|
||||
|
public ResponseEntity<Object> query(@RequestParam SalesQuery whereJson, PageQuery page) { |
||||
|
return new ResponseEntity<>(salesService.queryAll(whereJson, page), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
@Log("创建业务员") |
||||
|
|
||||
|
public ResponseEntity<Object> create(@Validated @RequestBody SalesDto dto) { |
||||
|
salesService.create(dto); |
||||
|
return new ResponseEntity<>(HttpStatus.CREATED); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
@Log("更新业务员") |
||||
|
|
||||
|
public ResponseEntity<Object> update(@Validated @RequestBody SalesDto dto) { |
||||
|
salesService.update(dto); |
||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
||||
|
} |
||||
|
|
||||
|
@Log("删除业务员") |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) { |
||||
|
salesService.deleteAll(ids); |
||||
|
return new ResponseEntity<>(HttpStatus.OK); |
||||
|
} |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package org.nl.wms.basedata.master.sales.service;//package org.nl.wms.basedata.master.service;
|
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.wms.basedata.master.sales.service.dao.Sales; |
||||
|
import org.nl.wms.basedata.master.sales.service.dto.SalesDto; |
||||
|
import org.nl.wms.basedata.master.sales.service.dto.SalesQuery; |
||||
|
|
||||
|
import org.nl.wms.basedata.master.unit.service.dto.UnitDto; |
||||
|
import org.springframework.data.domain.Pageable; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description 服务接口 |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
public interface SalesService { |
||||
|
|
||||
|
/** |
||||
|
* 查询数据分页 |
||||
|
* |
||||
|
* @param whereJson 条件 |
||||
|
* @param page 分页参数 |
||||
|
* @return Map<String, Object> |
||||
|
*/ |
||||
|
IPage<Sales> queryAll(SalesQuery whereJson, PageQuery page); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 创建 |
||||
|
* |
||||
|
* @param dto / |
||||
|
*/ |
||||
|
void create(SalesDto dto); |
||||
|
|
||||
|
/** |
||||
|
* 编辑 |
||||
|
* |
||||
|
* @param dto / |
||||
|
*/ |
||||
|
void update(SalesDto dto); |
||||
|
|
||||
|
/** |
||||
|
* 多选删除 |
||||
|
* |
||||
|
* @param ids / |
||||
|
*/ |
||||
|
void deleteAll(Long[] ids); |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package org.nl.wms.basedata.master.sales.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; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("md_cs_areasalesinfo") |
||||
|
public class Sales implements Serializable { |
||||
|
@TableId(value = "sales_id", type = IdType.NONE) |
||||
|
private Long sales_id; |
||||
|
|
||||
|
private String sales_code; |
||||
|
|
||||
|
private String sales_name; |
||||
|
|
||||
|
private String area; |
||||
|
|
||||
|
private String is_active; |
||||
|
|
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
package org.nl.wms.basedata.master.sales.service.dao.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.nl.wms.basedata.master.sales.service.dao.Sales; |
||||
|
|
||||
|
public interface SalesMapper extends BaseMapper<Sales> { |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package org.nl.wms.basedata.master.sales.service.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SalesDto implements Serializable { |
||||
|
|
||||
|
private Long sales_id; |
||||
|
|
||||
|
private String sales_code; |
||||
|
|
||||
|
private String sales_name; |
||||
|
|
||||
|
private String area; |
||||
|
|
||||
|
private String is_active; |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package org.nl.wms.basedata.master.sales.service.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class SalesQuery implements Serializable { |
||||
|
|
||||
|
|
||||
|
private String search; |
||||
|
|
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
package org.nl.wms.basedata.master.sales.service.impl; |
||||
|
|
||||
|
|
||||
|
import cn.dev33.satoken.json.SaJsonTemplate; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
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.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.common.utils.SecurityUtils; |
||||
|
import org.nl.modules.common.exception.BadRequestException; |
||||
|
import org.nl.modules.wql.core.bean.WQLObject; |
||||
|
import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus; |
||||
|
import org.nl.wms.basedata.master.sales.service.SalesService; |
||||
|
import org.nl.wms.basedata.master.sales.service.dao.Sales; |
||||
|
import org.nl.wms.basedata.master.sales.service.dao.mapper.SalesMapper; |
||||
|
import org.nl.wms.basedata.master.sales.service.dto.SalesDto; |
||||
|
import org.nl.wms.basedata.master.sales.service.dto.SalesQuery; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.lang.reflect.Array; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description 服务实现 |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
public class SalesServiceImpl implements SalesService { |
||||
|
|
||||
|
private final SaJsonTemplate getSaJsonTemplateForJackson; |
||||
|
|
||||
|
@Autowired |
||||
|
private SalesMapper salesMapper; |
||||
|
|
||||
|
@Override |
||||
|
public IPage<Sales> queryAll(SalesQuery whereJson, PageQuery page) { |
||||
|
|
||||
|
IPage<Sales> pages = new Page<>(page.getPage() + 1, page.getSize()); |
||||
|
LambdaQueryWrapper<Sales> lam = new LambdaQueryWrapper<Sales>(); |
||||
|
lam.and(ObjectUtil.isNotEmpty(whereJson.getSearch()), blam -> blam.like(Sales::getSales_code, whereJson.getSearch()).or() |
||||
|
.like(Sales::getSales_name, whereJson.getSearch())) |
||||
|
.orderByDesc(Sales::getSales_code); |
||||
|
salesMapper.selectPage(pages, lam); |
||||
|
return pages; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void create(SalesDto dto) { |
||||
|
LambdaQueryWrapper<Sales> lam = new LambdaQueryWrapper<Sales>(); |
||||
|
lam.eq(Sales::getSales_id, dto.getSales_code()); |
||||
|
Sales salesByCode = salesMapper.selectOne(lam); |
||||
|
if (salesByCode != null) { |
||||
|
if (salesByCode.getArea().equals(dto.getArea())) { |
||||
|
throw new BadRequestException("存在相同区域的业务员!"); |
||||
|
} |
||||
|
} |
||||
|
Sales sales = new Sales(); |
||||
|
BeanUtils.copyProperties(dto, sales); |
||||
|
salesMapper.insert(sales); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(SalesDto dto) { |
||||
|
LambdaQueryWrapper<Sales> lam = new LambdaQueryWrapper<Sales>(); |
||||
|
lam.eq(Sales::getSales_id, dto.getSales_id()); |
||||
|
Sales salesById = salesMapper.selectOne(lam); |
||||
|
if (salesById == null) { |
||||
|
throw new BadRequestException("被删除或无权限,操作失败!"); |
||||
|
} |
||||
|
LambdaQueryWrapper<Sales> lamCode = new LambdaQueryWrapper<Sales>(); |
||||
|
lamCode.eq(Sales::getSales_id, dto.getSales_code()); |
||||
|
Sales salesByCode = salesMapper.selectOne(lamCode); |
||||
|
if (salesByCode != null && !salesByCode.getSales_id().equals(dto.getSales_id())) { |
||||
|
throw new BadRequestException("存在相同的编码"); |
||||
|
} |
||||
|
Sales sales = new Sales(); |
||||
|
BeanUtils.copyProperties(dto, sales); |
||||
|
salesMapper.updateById(sales); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void deleteAll(Long[] ids) { |
||||
|
if (ids != null) { |
||||
|
List<Long> list = Arrays.asList(ids); |
||||
|
salesMapper.deleteBatchIds(list); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -1,74 +1,74 @@ |
|||||
package org.nl.wms.basedata.master.service; |
//package org.nl.wms.basedata.master.service;
|
||||
|
//
|
||||
import com.alibaba.fastjson.JSONObject; |
//import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.master.service.dto.SalesDto; |
//import org.nl.wms.basedata.master.service.dto.SalesDto;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.springframework.data.domain.Pageable;
|
||||
|
//
|
||||
import java.util.List; |
//import java.util.List;
|
||||
import java.util.Map; |
//import java.util.Map;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author loujf |
// * @author loujf
|
||||
* @description 服务接口 |
// * @description 服务接口
|
||||
* @date 2021-12-07 |
// * @date 2021-12-07
|
||||
**/ |
// **/
|
||||
public interface SalesService { |
//public interface SalesService {
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 查询数据分页 |
// * 查询数据分页
|
||||
* |
// *
|
||||
* @param whereJson 条件 |
// * @param whereJson 条件
|
||||
* @param page 分页参数 |
// * @param page 分页参数
|
||||
* @return Map<String, Object> |
// * @return Map<String, Object>
|
||||
*/ |
// */
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 查询所有数据不分页 |
// * 查询所有数据不分页
|
||||
* |
// *
|
||||
* @param whereJson 条件参数 |
// * @param whereJson 条件参数
|
||||
* @return List<UnitDto> |
// * @return List<UnitDto>
|
||||
*/ |
// */
|
||||
List<UnitDto> queryAll(Map whereJson); |
// List<UnitDto> queryAll(Map whereJson);
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 根据ID查询 |
// * 根据ID查询
|
||||
* |
// *
|
||||
* @param measure_unit_id ID |
// * @param measure_unit_id ID
|
||||
* @return Unit |
// * @return Unit
|
||||
*/ |
// */
|
||||
SalesDto findById(Long measure_unit_id); |
// SalesDto findById(Long measure_unit_id);
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 根据编码查询 |
// * 根据编码查询
|
||||
* |
// *
|
||||
* @param code code |
// * @param code code
|
||||
* @return Unit |
// * @return Unit
|
||||
*/ |
// */
|
||||
SalesDto findByCode(String code); |
// SalesDto findByCode(String code);
|
||||
|
//
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 创建 |
// * 创建
|
||||
* |
// *
|
||||
* @param dto / |
// * @param dto /
|
||||
*/ |
// */
|
||||
void create(SalesDto dto); |
// void create(SalesDto dto);
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 编辑 |
// * 编辑
|
||||
* |
// *
|
||||
* @param dto / |
// * @param dto /
|
||||
*/ |
// */
|
||||
void update(SalesDto dto); |
// void update(SalesDto dto);
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 多选删除 |
// * 多选删除
|
||||
* |
// *
|
||||
* @param ids / |
// * @param ids /
|
||||
*/ |
// */
|
||||
void deleteAll(Long[] ids); |
// void deleteAll(Long[] ids);
|
||||
|
//
|
||||
|
//
|
||||
} |
//}
|
||||
|
@ -1,86 +1,84 @@ |
|||||
package org.nl.wms.basedata.master.service; |
//package org.nl.wms.basedata.master.service;
|
||||
|
//
|
||||
import com.alibaba.fastjson.JSONArray; |
//import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject; |
//import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto; |
//import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.nl.common.domain.query.PageQuery;
|
||||
|
//import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto;
|
||||
import java.util.List; |
//import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo;
|
||||
import java.util.Map; |
//import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoQuery;
|
||||
|
//import org.springframework.data.domain.Pageable;
|
||||
/** |
//
|
||||
* @author ldjun |
//import java.util.List;
|
||||
* @description 服务接口 |
//import java.util.Map;
|
||||
* @date 2021-12-09 |
//
|
||||
**/ |
///**
|
||||
public interface StoragevehicleinfoService { |
// * @author ldjun
|
||||
|
// * @description 服务接口
|
||||
/** |
// * @date 2021-12-09
|
||||
* 查询数据分页 |
// **/
|
||||
* |
//public interface StoragevehicleinfoService {
|
||||
* @param whereJson 条件 |
//
|
||||
* @param page 分页参数 |
// /**
|
||||
* @return Map<String, Object> |
// * 查询数据分页
|
||||
*/ |
// *
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
// * @param whereJson 条件
|
||||
|
// * @param page 分页参数
|
||||
/** |
// * @return Map<String, Object>
|
||||
* 查询所有数据不分页 |
// */
|
||||
* |
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
* @param whereJson 条件参数 |
//
|
||||
* @return List<StoragevehicleinfoDto> |
//
|
||||
*/ |
//
|
||||
List<StoragevehicleinfoDto> queryAll(Map whereJson); |
// /**
|
||||
|
// * 根据ID查询
|
||||
/** |
// *
|
||||
* 根据ID查询 |
// * @param storagevehicle_id ID
|
||||
* |
// * @return MdPbStoragevehicleinfo
|
||||
* @param storagevehicle_id ID |
// */
|
||||
* @return MdPbStoragevehicleinfo |
// StoragevehicleinfoDto findById(Long storagevehicle_id);
|
||||
*/ |
//
|
||||
StoragevehicleinfoDto findById(Long storagevehicle_id); |
// /**
|
||||
|
// * 根据编码查询
|
||||
/** |
// *
|
||||
* 根据编码查询 |
// * @param code code
|
||||
* |
// * @return MdPbStoragevehicleinfo
|
||||
* @param code code |
// */
|
||||
* @return MdPbStoragevehicleinfo |
// StoragevehicleinfoDto findByCode(String code);
|
||||
*/ |
//
|
||||
StoragevehicleinfoDto findByCode(String code); |
//
|
||||
|
// /**
|
||||
|
// * 创建
|
||||
/** |
// *
|
||||
* 创建 |
// * @param map /
|
||||
* |
// */
|
||||
* @param map / |
// JSONArray create(Map map);
|
||||
*/ |
//
|
||||
JSONArray create(Map map); |
// /**
|
||||
|
// * 编辑
|
||||
/** |
// *
|
||||
* 编辑 |
// * @param dto /
|
||||
* |
// */
|
||||
* @param dto / |
// void update(JSONObject dto);
|
||||
*/ |
//
|
||||
void update(JSONObject dto); |
// /**
|
||||
|
// * 多选删除
|
||||
/** |
// *
|
||||
* 多选删除 |
// * @param ids /
|
||||
* |
// */
|
||||
* @param ids / |
// void deleteAll(Long[] ids);
|
||||
*/ |
//
|
||||
void deleteAll(Long[] ids); |
// /**
|
||||
|
// * 多修改启用状态
|
||||
/** |
// *
|
||||
* 多修改启用状态 |
// * @param json /
|
||||
* |
// */
|
||||
* @param json / |
// void changeActive(JSONObject json);
|
||||
*/ |
//
|
||||
void changeActive(JSONObject json); |
// /**
|
||||
|
// * 获取起始载具号
|
||||
/** |
// *
|
||||
* 获取起始载具号 |
// * @param code /
|
||||
* |
// */
|
||||
* @param code / |
// JSONObject getVehicle(String code);
|
||||
*/ |
//}
|
||||
JSONObject getVehicle(String code); |
|
||||
} |
|
||||
|
@ -1,74 +1,76 @@ |
|||||
package org.nl.wms.basedata.master.service; |
//package org.nl.wms.basedata.master.service;
|
||||
|
//
|
||||
import com.alibaba.fastjson.JSONObject; |
//import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
//import org.nl.common.domain.query.PageQuery;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
|
//import org.nl.wms.basedata.master.unit.service.dto.UnitQuery;
|
||||
import java.util.List; |
//import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map; |
//
|
||||
|
//import java.util.List;
|
||||
/** |
//import java.util.Map;
|
||||
* @author loujf |
//
|
||||
* @description 服务接口 |
///**
|
||||
* @date 2021-12-07 |
// * @author loujf
|
||||
**/ |
// * @description 服务接口
|
||||
public interface UnitService { |
// * @date 2021-12-07
|
||||
|
// **/
|
||||
/** |
//public interface UnitService {
|
||||
* 查询数据分页 |
//
|
||||
* |
// /**
|
||||
* @param whereJson 条件 |
// * 查询数据分页
|
||||
* @param page 分页参数 |
// *
|
||||
* @return Map<String, Object> |
// * @param whereJson 条件
|
||||
*/ |
// * @param page 分页参数
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
// * @return Map<String, Object>
|
||||
|
// */
|
||||
/** |
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
* 查询所有数据不分页 |
//
|
||||
* |
// /**
|
||||
* @param whereJson 条件参数 |
// * 查询所有数据不分页
|
||||
* @return List<UnitDto> |
// *
|
||||
*/ |
// * @param whereJson 条件参数
|
||||
List<UnitDto> queryAll(Map whereJson); |
// * @return List<UnitDto>
|
||||
|
// */
|
||||
/** |
// List<UnitDto> queryAll(Map whereJson);
|
||||
* 根据ID查询 |
//
|
||||
* |
// /**
|
||||
* @param measure_unit_id ID |
// * 根据ID查询
|
||||
* @return Unit |
// *
|
||||
*/ |
// * @param measure_unit_id ID
|
||||
UnitDto findById(Long measure_unit_id); |
// * @return Unit
|
||||
|
// */
|
||||
/** |
// UnitDto findById(Long measure_unit_id);
|
||||
* 根据编码查询 |
//
|
||||
* |
// /**
|
||||
* @param code code |
// * 根据编码查询
|
||||
* @return Unit |
// *
|
||||
*/ |
// * @param code code
|
||||
UnitDto findByCode(String code); |
// * @return Unit
|
||||
|
// */
|
||||
|
// UnitDto findByCode(String code);
|
||||
/** |
//
|
||||
* 创建 |
//
|
||||
* |
// /**
|
||||
* @param dto / |
// * 创建
|
||||
*/ |
// *
|
||||
void create(UnitDto dto); |
// * @param dto /
|
||||
|
// */
|
||||
/** |
// void create(UnitDto dto);
|
||||
* 编辑 |
//
|
||||
* |
// /**
|
||||
* @param dto / |
// * 编辑
|
||||
*/ |
// *
|
||||
void update(UnitDto dto); |
// * @param dto /
|
||||
|
// */
|
||||
/** |
// void update(UnitDto dto);
|
||||
* 多选删除 |
//
|
||||
* |
// /**
|
||||
* @param ids / |
// * 多选删除
|
||||
*/ |
// *
|
||||
void deleteAll(String[] ids); |
// * @param ids /
|
||||
|
// */
|
||||
JSONObject getUnit(Map whereJson); |
// void deleteAll(String[] ids);
|
||||
|
//
|
||||
} |
// JSONObject getUnit(Map whereJson);
|
||||
|
//
|
||||
|
//}
|
||||
|
@ -1,26 +1,26 @@ |
|||||
package org.nl.wms.basedata.master.service.dto; |
//package org.nl.wms.basedata.master.service.dto;
|
||||
|
//
|
||||
import lombok.Data; |
//import lombok.Data;
|
||||
|
//
|
||||
import java.io.Serializable; |
//import java.io.Serializable;
|
||||
import java.math.BigDecimal; |
//import java.math.BigDecimal;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author loujf |
// * @author loujf
|
||||
* @description / |
// * @description /
|
||||
* @date 2021-12-07 |
// * @date 2021-12-07
|
||||
**/ |
// **/
|
||||
@Data |
//@Data
|
||||
public class SalesDto implements Serializable { |
//public class SalesDto implements Serializable {
|
||||
|
//
|
||||
private Long sales_id; |
// private Long sales_id;
|
||||
|
//
|
||||
private String sales_code; |
// private String sales_code;
|
||||
|
//
|
||||
private String sales_name; |
// private String sales_name;
|
||||
|
//
|
||||
private String area; |
// private String area;
|
||||
|
//
|
||||
private String is_active; |
// private String is_active;
|
||||
|
//
|
||||
} |
//}
|
||||
|
@ -1,63 +1,63 @@ |
|||||
package org.nl.wms.basedata.master.service.dto; |
//package org.nl.wms.basedata.master.service.dto;
|
||||
|
//
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
//import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data; |
//import lombok.Data;
|
||||
|
//
|
||||
import java.io.Serializable; |
//import java.io.Serializable;
|
||||
import java.math.BigDecimal; |
//import java.math.BigDecimal;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author ldjun |
// * @author ldjun
|
||||
* @description / |
// * @description /
|
||||
* @date 2021-12-09 |
// * @date 2021-12-09
|
||||
**/ |
// **/
|
||||
@Data |
//@Data
|
||||
public class StoragevehicleinfoDto implements Serializable { |
//public class StoragevehicleinfoDto implements Serializable {
|
||||
|
//
|
||||
/** |
// /**
|
||||
* 防止精度丢失 |
// * 防止精度丢失
|
||||
*/ |
// */
|
||||
@JsonSerialize(using = ToStringSerializer.class) |
// @JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long storagevehicle_id; |
// private Long storagevehicle_id;
|
||||
|
//
|
||||
private String storagevehicle_code; |
// private String storagevehicle_code;
|
||||
|
//
|
||||
private String storagevehicle_name; |
// private String storagevehicle_name;
|
||||
|
//
|
||||
private String one_code; |
// private String one_code;
|
||||
|
//
|
||||
private String two_code; |
// private String two_code;
|
||||
|
//
|
||||
private String rfid_code; |
// private String rfid_code;
|
||||
|
//
|
||||
private String create_id; |
// private String create_id;
|
||||
|
//
|
||||
private String create_name; |
// private String create_name;
|
||||
|
//
|
||||
private String create_time; |
// private String create_time;
|
||||
|
//
|
||||
private String update_optid; |
// private String update_optid;
|
||||
|
//
|
||||
private String update_optname; |
// private String update_optname;
|
||||
|
//
|
||||
private String update_time; |
// private String update_time;
|
||||
|
//
|
||||
private String is_delete; |
// private String is_delete;
|
||||
|
//
|
||||
private String is_used; |
// private String is_used;
|
||||
|
//
|
||||
private String storagevehicle_type; |
// private String storagevehicle_type;
|
||||
|
//
|
||||
private BigDecimal vehicle_width; |
// private BigDecimal vehicle_width;
|
||||
|
//
|
||||
private BigDecimal vehicle_long; |
// private BigDecimal vehicle_long;
|
||||
|
//
|
||||
private BigDecimal vehicle_height; |
// private BigDecimal vehicle_height;
|
||||
|
//
|
||||
private String overstruct_type; |
// private String overstruct_type;
|
||||
|
//
|
||||
private BigDecimal occupystruct_qty; |
// private BigDecimal occupystruct_qty;
|
||||
|
//
|
||||
private String ext_id; |
// private String ext_id;
|
||||
} |
//}
|
||||
|
@ -1,41 +1,41 @@ |
|||||
package org.nl.wms.basedata.master.service.dto; |
//package org.nl.wms.basedata.master.service.dto;
|
||||
|
//
|
||||
import lombok.Data; |
//import lombok.Data;
|
||||
|
//
|
||||
import java.io.Serializable; |
//import java.io.Serializable;
|
||||
import java.math.BigDecimal; |
//import java.math.BigDecimal;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author loujf |
// * @author loujf
|
||||
* @description / |
// * @description /
|
||||
* @date 2021-12-07 |
// * @date 2021-12-07
|
||||
**/ |
// **/
|
||||
@Data |
//@Data
|
||||
public class UnitDto implements Serializable { |
//public class UnitDto implements Serializable {
|
||||
|
//
|
||||
private Long measure_unit_id; |
// private Long measure_unit_id;
|
||||
|
//
|
||||
private String unit_code; |
// private String unit_code;
|
||||
|
//
|
||||
private String unit_name; |
// private String unit_name;
|
||||
|
//
|
||||
private BigDecimal qty_precision; |
// private BigDecimal qty_precision;
|
||||
|
//
|
||||
private String is_used; |
// private String is_used;
|
||||
|
//
|
||||
private String create_id; |
// private String create_id;
|
||||
|
//
|
||||
private String create_name; |
// private String create_name;
|
||||
|
//
|
||||
private String create_time; |
// private String create_time;
|
||||
|
//
|
||||
private String update_optid; |
// private String update_optid;
|
||||
|
//
|
||||
private String update_optname; |
// private String update_optname;
|
||||
|
//
|
||||
private String update_time; |
// private String update_time;
|
||||
|
//
|
||||
private String is_delete; |
// private String is_delete;
|
||||
|
//
|
||||
private String ext_id; |
// private String ext_id;
|
||||
} |
//}
|
||||
|
@ -1,131 +1,131 @@ |
|||||
package org.nl.wms.basedata.master.service.impl; |
//package org.nl.wms.basedata.master.service.impl;
|
||||
|
//
|
||||
|
//
|
||||
import cn.hutool.core.date.DateUtil; |
//import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil; |
//import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil; |
//import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil; |
//import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON; |
//import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray; |
//import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject; |
//import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor; |
//import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j; |
//import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils; |
//import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException; |
//import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.ResultBean; |
//import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject; |
//import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil; |
//import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.SalesService; |
//import org.nl.wms.basedata.master.service.SalesService;
|
||||
import org.nl.wms.basedata.master.service.dto.SalesDto; |
//import org.nl.wms.basedata.master.service.dto.SalesDto;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service; |
//import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional; |
//import org.springframework.transaction.annotation.Transactional;
|
||||
|
//
|
||||
import java.util.List; |
//import java.util.List;
|
||||
import java.util.Map; |
//import java.util.Map;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author loujf |
// * @author loujf
|
||||
* @description 服务实现 |
// * @description 服务实现
|
||||
* @date 2021-12-07 |
// * @date 2021-12-07
|
||||
**/ |
// **/
|
||||
@Service |
//@Service
|
||||
@RequiredArgsConstructor |
//@RequiredArgsConstructor
|
||||
@Slf4j |
//@Slf4j
|
||||
public class SalesServiceImpl implements SalesService { |
//public class SalesServiceImpl implements SalesService {
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String where = ""; |
// String where = "";
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
String search = (String) whereJson.get("search"); |
// String search = (String) whereJson.get("search");
|
||||
if (!StrUtil.isEmpty(search)) { |
// if (!StrUtil.isEmpty(search)) {
|
||||
where = " AND (sales_code like '%" + search + "%' OR sales_name like '%" + search + "%' ) "; |
// where = " AND (sales_code like '%" + search + "%' OR sales_name like '%" + search + "%' ) ";
|
||||
} |
// }
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1 " + where, "sales_code"); |
// ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1 " + where, "sales_code");
|
||||
final JSONObject json = rb.pageResult(); |
// final JSONObject json = rb.pageResult();
|
||||
return json; |
// return json;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public List<UnitDto> queryAll(Map whereJson) { |
// public List<UnitDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0); |
// JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<UnitDto> list = arr.toJavaList(UnitDto.class); |
// List<UnitDto> list = arr.toJavaList(UnitDto.class);
|
||||
return list; |
// return list;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public SalesDto findById(Long sales_id) { |
// public SalesDto findById(Long sales_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = wo.query("sales_id =" + sales_id + "").uniqueResult(0); |
// JSONObject json = wo.query("sales_id =" + sales_id + "").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) { |
// if (ObjectUtil.isEmpty(json)) {
|
||||
return null; |
// return null;
|
||||
} |
// }
|
||||
final SalesDto obj = json.toJavaObject(SalesDto.class); |
// final SalesDto obj = json.toJavaObject(SalesDto.class);
|
||||
return obj; |
// return obj;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public SalesDto findByCode(String code) { |
// public SalesDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = wo.query("sales_code ='" + code + "'").uniqueResult(0); |
// JSONObject json = wo.query("sales_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) { |
// if (ObjectUtil.isEmpty(json)) {
|
||||
return null; |
// return null;
|
||||
} |
// }
|
||||
final SalesDto obj = json.toJavaObject(SalesDto.class); |
// final SalesDto obj = json.toJavaObject(SalesDto.class);
|
||||
return obj; |
// return obj;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
@Transactional(rollbackFor = Exception.class) |
// @Transactional(rollbackFor = Exception.class)
|
||||
public void create(SalesDto dto) { |
// public void create(SalesDto dto) {
|
||||
String sales_code = dto.getSales_code(); |
// String sales_code = dto.getSales_code();
|
||||
SalesDto unitDto = this.findByCode(sales_code); |
// SalesDto unitDto = this.findByCode(sales_code);
|
||||
if (unitDto != null) { |
// if (unitDto != null) {
|
||||
if (unitDto.getArea().equals(dto.getArea())) { |
// if (unitDto.getArea().equals(dto.getArea())) {
|
||||
throw new BadRequestException("存在相同区域的业务员!"); |
// throw new BadRequestException("存在相同区域的业务员!");
|
||||
} |
// }
|
||||
} |
// }
|
||||
|
//
|
||||
dto.setSales_id(IdUtil.getSnowflake(1, 1).nextId()); |
// dto.setSales_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
|
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json); |
// wo.insert(json);
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
@Transactional(rollbackFor = Exception.class) |
// @Transactional(rollbackFor = Exception.class)
|
||||
public void update(SalesDto dto) { |
// public void update(SalesDto dto) {
|
||||
SalesDto entity = this.findById(dto.getSales_id()); |
// SalesDto entity = this.findById(dto.getSales_id());
|
||||
if (entity == null) { |
// if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!"); |
// throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
} |
// }
|
||||
|
//
|
||||
String sales_code = dto.getSales_code(); |
// String sales_code = dto.getSales_code();
|
||||
SalesDto unitDto = this.findByCode(sales_code); |
// SalesDto unitDto = this.findByCode(sales_code);
|
||||
if (unitDto != null && !unitDto.getSales_id().equals(dto.getSales_id())) { |
// if (unitDto != null && !unitDto.getSales_id().equals(dto.getSales_id())) {
|
||||
throw new BadRequestException("存在相同的编码"); |
// throw new BadRequestException("存在相同的编码");
|
||||
} |
// }
|
||||
|
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json); |
// wo.update(json);
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
@Transactional(rollbackFor = Exception.class) |
// @Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) { |
// public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now(); |
// String now = DateUtil.now();
|
||||
|
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
||||
for (Long sales_id : ids) { |
// for (Long sales_id : ids) {
|
||||
wo.delete("sales_id = '" + sales_id + "'"); |
// wo.delete("sales_id = '" + sales_id + "'");
|
||||
} |
// }
|
||||
} |
// }
|
||||
|
//
|
||||
} |
//}
|
||||
|
@ -1,277 +1,271 @@ |
|||||
package org.nl.wms.basedata.master.service.impl; |
//package org.nl.wms.basedata.master.service.impl;
|
||||
|
//
|
||||
|
//
|
||||
import cn.hutool.core.date.DateUtil; |
//import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil; |
//import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil; |
//import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil; |
//import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil; |
//import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON; |
//import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray; |
//import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject; |
//import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor; |
//import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j; |
//import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils; |
//import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException; |
//import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil; |
//import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.modules.wql.WQL; |
//import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject; |
//import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil; |
//import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.system.service.coderule.impl.SysCodeRuleServiceImpl; |
//import org.nl.system.service.coderule.impl.SysCodeRuleServiceImpl;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService; |
//import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.StoragevehicleinfoService; |
//import org.nl.wms.basedata.master.service.StoragevehicleinfoService;
|
||||
import org.nl.wms.basedata.master.service.dto.ClassstandardDto; |
//import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
|
||||
import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto; |
//import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service; |
//import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional; |
//import org.springframework.transaction.annotation.Transactional;
|
||||
|
//
|
||||
import java.util.HashMap; |
//import java.util.HashMap;
|
||||
import java.util.List; |
//import java.util.List;
|
||||
import java.util.Map; |
//import java.util.Map;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author ldjun |
// * @author ldjun
|
||||
* @description 服务实现 |
// * @description 服务实现
|
||||
* @date 2021-12-09 |
// * @date 2021-12-09
|
||||
**/ |
// **/
|
||||
@Service |
//@Service
|
||||
@RequiredArgsConstructor |
//@RequiredArgsConstructor
|
||||
@Slf4j |
//@Slf4j
|
||||
public class StoragevehicleinfoServiceImpl implements StoragevehicleinfoService { |
//public class StoragevehicleinfoServiceImpl implements StoragevehicleinfoService {
|
||||
|
//
|
||||
private final ClassstandardService classstandardService; |
// private final ClassstandardService classstandardService;
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject taskService = WQLObject.getWQLObject("sch_base_task"); |
// WQLObject taskService = WQLObject.getWQLObject("sch_base_task");
|
||||
HashMap<String, Object> map = new HashMap(); |
// HashMap<String, Object> map = new HashMap();
|
||||
|
//
|
||||
String storagevehicle_code_begin = (String) whereJson.get("storagevehicle_code_begin"); |
// String storagevehicle_code_begin = (String) whereJson.get("storagevehicle_code_begin");
|
||||
String storagevehicle_code_end = (String) whereJson.get("storagevehicle_code_end"); |
// String storagevehicle_code_end = (String) whereJson.get("storagevehicle_code_end");
|
||||
|
//
|
||||
if (StrUtil.isNotEmpty((String) whereJson.get("storagevehicle_type"))) { |
// if (StrUtil.isNotEmpty((String) whereJson.get("storagevehicle_type"))) {
|
||||
ClassstandardDto dto = classstandardService.findById((String) whereJson.get("storagevehicle_type")); |
// ClassstandardDto dto = classstandardService.findById((String) whereJson.get("storagevehicle_type"));
|
||||
String storagevehicle_type = classstandardService.getChildIdStr(dto.getClass_id().toString()); |
// String storagevehicle_type = classstandardService.getChildIdStr(dto.getClass_id().toString());
|
||||
map.put("storagevehicle_type", storagevehicle_type); |
// map.put("storagevehicle_type", storagevehicle_type);
|
||||
|
//
|
||||
} |
// }
|
||||
map.put("storagevehicle_code_begin", storagevehicle_code_begin); |
// map.put("storagevehicle_code_begin", storagevehicle_code_begin);
|
||||
map.put("storagevehicle_code_end", storagevehicle_code_end); |
// map.put("storagevehicle_code_end", storagevehicle_code_end);
|
||||
map.put("flag", "1"); |
// map.put("flag", "1");
|
||||
JSONObject json = WQL.getWO("QMD_PB_STORAGEVEHICLEINFO").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "s.storagevehicle_code ASC"); |
// JSONObject json = WQL.getWO("QMD_PB_STORAGEVEHICLEINFO").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "s.storagevehicle_code ASC");
|
||||
/*JSONArray content = json.getJSONArray("content"); |
// /*JSONArray content = json.getJSONArray("content");
|
||||
for (int i = 0; i < content.size(); i++) { |
// for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject jsonObject = content.getJSONObject(i); |
// JSONObject jsonObject = content.getJSONObject(i);
|
||||
JSONObject jsonTask = taskService.query("vehicle_code = '" + jsonObject.getString("storagevehicle_code") + "' and task_status <> '99' and is_delete = '0'").uniqueResult(0); |
// JSONObject jsonTask = taskService.query("vehicle_code = '" + jsonObject.getString("storagevehicle_code") + "' and task_status <> '99' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonTask)) { |
// if (ObjectUtil.isNotEmpty(jsonTask)) {
|
||||
jsonObject.put("start_point_code", jsonTask.getString("start_point_code")); |
// jsonObject.put("start_point_code", jsonTask.getString("start_point_code"));
|
||||
jsonObject.put("next_point_code", jsonTask.getString("next_point_code")); |
// jsonObject.put("next_point_code", jsonTask.getString("next_point_code"));
|
||||
jsonObject.put("is_task", "1"); |
// jsonObject.put("is_task", "1");
|
||||
jsonObject.put("point_code", ""); |
// jsonObject.put("point_code", "");
|
||||
} else { |
// } else {
|
||||
jsonObject.put("is_task", "0"); |
// jsonObject.put("is_task", "0");
|
||||
} |
// }
|
||||
}*/ |
// }*/
|
||||
return json; |
// return json;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
//
|
||||
public List<StoragevehicleinfoDto> queryAll(Map whereJson) { |
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
// @Override
|
||||
JSONArray arr = wo.query().getResultJSONArray(0); |
// public StoragevehicleinfoDto findById(Long storagevehicle_id) {
|
||||
List<StoragevehicleinfoDto> list = arr.toJavaList(StoragevehicleinfoDto.class); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
return list; |
// JSONObject json = wo.query("storagevehicle_id =" + storagevehicle_id + "").uniqueResult(0);
|
||||
} |
// final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class);
|
||||
|
// return obj;
|
||||
@Override |
// }
|
||||
public StoragevehicleinfoDto findById(Long storagevehicle_id) { |
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
// @Override
|
||||
JSONObject json = wo.query("storagevehicle_id =" + storagevehicle_id + "").uniqueResult(0); |
// public StoragevehicleinfoDto findByCode(String code) {
|
||||
final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
return obj; |
// JSONObject json = wo.query("storagevehicle_code ='" + code + "'").uniqueResult(0);
|
||||
} |
// if (ObjectUtil.isEmpty(json)) {
|
||||
|
// throw new BadRequestException("请输入正确的载具号!");
|
||||
@Override |
// }
|
||||
public StoragevehicleinfoDto findByCode(String code) { |
// final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class);
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
// return obj;
|
||||
JSONObject json = wo.query("storagevehicle_code ='" + code + "'").uniqueResult(0); |
// }
|
||||
if (ObjectUtil.isEmpty(json)) { |
//
|
||||
throw new BadRequestException("请输入正确的载具号!"); |
// @Override
|
||||
} |
// @Transactional(rollbackFor = Exception.class)
|
||||
final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class); |
// public JSONArray create(Map map) {
|
||||
return obj; |
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
} |
// JSONObject jsonObject = wo.query("storagevehicle_code = '" + map.get("storagevehicle_code") + "' and is_delete = '0'").uniqueResult(0);
|
||||
|
// if (!ObjectUtil.isEmpty(jsonObject)) {
|
||||
@Override |
// throw new BadRequestException("此载具已存在");
|
||||
@Transactional(rollbackFor = Exception.class) |
// }
|
||||
public JSONArray create(Map map) { |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
JSONObject jsonObject = wo.query("storagevehicle_code = '" + map.get("storagevehicle_code") + "' and is_delete = '0'").uniqueResult(0); |
// String now = DateUtil.now();
|
||||
if (!ObjectUtil.isEmpty(jsonObject)) { |
//
|
||||
throw new BadRequestException("此载具已存在"); |
// String storagevehicle_type = ((String) map.get("storagevehicle_type"));
|
||||
} |
// JSONObject class_jo = WQLObject.getWQLObject("md_pb_classstandard").query("class_id = '" + storagevehicle_type + "'").uniqueResult(0);
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// String class_code = class_jo.getString("class_code").substring(0, 4);
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// ;
|
||||
String now = DateUtil.now(); |
// String code = "";
|
||||
|
// switch (class_code) {
|
||||
String storagevehicle_type = ((String) map.get("storagevehicle_type")); |
// case "0001":
|
||||
JSONObject class_jo = WQLObject.getWQLObject("md_pb_classstandard").query("class_id = '" + storagevehicle_type + "'").uniqueResult(0); |
// //气涨轴编码
|
||||
String class_code = class_jo.getString("class_code").substring(0, 4); |
// code = "VEHICCLE_CODE_QZZ";
|
||||
; |
// break;
|
||||
String code = ""; |
// case "0002":
|
||||
switch (class_code) { |
// code = "VEHICLE_CODE_GXTP";
|
||||
case "0001": |
// break;
|
||||
//气涨轴编码
|
// case "0003":
|
||||
code = "VEHICCLE_CODE_QZZ"; |
// if (class_jo.getString("class_code").equals("000301")){
|
||||
break; |
// code = "VEHICLE_CODE_LK";
|
||||
case "0002": |
// }
|
||||
code = "VEHICLE_CODE_GXTP"; |
// if (class_jo.getString("class_code").equals("000302")){
|
||||
break; |
// code = "VEHICLE_CODE_LKB";
|
||||
case "0003": |
// }
|
||||
if (class_jo.getString("class_code").equals("000301")){ |
// break;
|
||||
code = "VEHICLE_CODE_LK"; |
// default:
|
||||
} |
// break;
|
||||
if (class_jo.getString("class_code").equals("000302")){ |
// }
|
||||
code = "VEHICLE_CODE_LKB"; |
// if (StrUtil.isEmpty(code)) {
|
||||
} |
// throw new BadRequestException("请选择正确的载具类型!");
|
||||
break; |
// }
|
||||
default: |
// JSONArray resultCodeArr = new JSONArray();
|
||||
break; |
// int num = MapUtil.getInt(map, "num");
|
||||
} |
// for (int i = 0; i < num; i++) {
|
||||
if (StrUtil.isEmpty(code)) { |
// StoragevehicleinfoDto dto = new StoragevehicleinfoDto();
|
||||
throw new BadRequestException("请选择正确的载具类型!"); |
// dto.setStoragevehicle_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
} |
// dto.setStoragevehicle_code(CodeUtil.getNewCode(code));
|
||||
JSONArray resultCodeArr = new JSONArray(); |
// dto.setCreate_id(currentUserId);
|
||||
int num = MapUtil.getInt(map, "num"); |
// dto.setStoragevehicle_name(dto.getStoragevehicle_code());
|
||||
for (int i = 0; i < num; i++) { |
// dto.setCreate_name(nickName);
|
||||
StoragevehicleinfoDto dto = new StoragevehicleinfoDto(); |
// dto.setUpdate_optid(currentUserId);
|
||||
dto.setStoragevehicle_id(IdUtil.getSnowflake(1, 1).nextId()); |
// dto.setUpdate_optname(nickName);
|
||||
dto.setStoragevehicle_code(CodeUtil.getNewCode(code)); |
// dto.setUpdate_time(now);
|
||||
dto.setCreate_id(currentUserId); |
// dto.setCreate_time(now);
|
||||
dto.setStoragevehicle_name(dto.getStoragevehicle_code()); |
// dto.setStoragevehicle_type(class_jo.getString("class_code"));
|
||||
dto.setCreate_name(nickName); |
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
dto.setUpdate_optid(currentUserId); |
// wo.insert(json);
|
||||
dto.setUpdate_optname(nickName); |
// resultCodeArr.add(dto.getStoragevehicle_code());
|
||||
dto.setUpdate_time(now); |
// }
|
||||
dto.setCreate_time(now); |
// return resultCodeArr;
|
||||
dto.setStoragevehicle_type(class_jo.getString("class_code")); |
// }
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
//
|
||||
wo.insert(json); |
// @Override
|
||||
resultCodeArr.add(dto.getStoragevehicle_code()); |
// @Transactional(rollbackFor = Exception.class)
|
||||
} |
// public void update(JSONObject dto) {
|
||||
return resultCodeArr; |
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
} |
// WQLObject veExtTab = WQLObject.getWQLObject("md_pb_storagevehicleext");
|
||||
|
// JSONObject jsonObject = wo.query("storagevehicle_code = '" + dto.getString("storagevehicle_code") + "' and is_delete = '0' AND storagevehicle_id != '" + dto.getString("storagevehicle_id") + "'").uniqueResult(0);
|
||||
@Override |
// if (!ObjectUtil.isEmpty(jsonObject)) {
|
||||
@Transactional(rollbackFor = Exception.class) |
// throw new BadRequestException("此载具已存在");
|
||||
public void update(JSONObject dto) { |
// }
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
//
|
||||
WQLObject veExtTab = WQLObject.getWQLObject("md_pb_storagevehicleext"); |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
JSONObject jsonObject = wo.query("storagevehicle_code = '" + dto.getString("storagevehicle_code") + "' and is_delete = '0' AND storagevehicle_id != '" + dto.getString("storagevehicle_id") + "'").uniqueResult(0); |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
if (!ObjectUtil.isEmpty(jsonObject)) { |
//
|
||||
throw new BadRequestException("此载具已存在"); |
// String qty = dto.getString("qty");
|
||||
} |
// String pcsn = dto.getString("pcsn");
|
||||
|
// if (StrUtil.isNotEmpty(qty) || StrUtil.isNotEmpty(pcsn)) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// JSONObject ext_jo = veExtTab.query("storagevehicle_code = '"+dto.getString("storagevehicle_code")+"'").uniqueResult(0);
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// if (ObjectUtil.isEmpty(ext_jo)) {
|
||||
|
// //新增一条记录
|
||||
String qty = dto.getString("qty"); |
// JSONObject jsonVeExt = new JSONObject();
|
||||
String pcsn = dto.getString("pcsn"); |
// jsonVeExt.put("storagevehicleext_id", org.nl.common.utils.IdUtil.getLongId());
|
||||
if (StrUtil.isNotEmpty(qty) || StrUtil.isNotEmpty(pcsn)) { |
// jsonVeExt.put("storagevehicle_id", dto.getLongValue("storagevehicle_id"));
|
||||
JSONObject ext_jo = veExtTab.query("storagevehicle_code = '"+dto.getString("storagevehicle_code")+"'").uniqueResult(0); |
// jsonVeExt.put("storagevehicle_code", dto.getString("storagevehicle_code"));
|
||||
if (ObjectUtil.isEmpty(ext_jo)) { |
// jsonVeExt.put("storagevehicle_type", dto.getString("storagevehicle_type"));
|
||||
//新增一条记录
|
// if (StrUtil.isNotEmpty(pcsn)) {
|
||||
JSONObject jsonVeExt = new JSONObject(); |
// jsonVeExt.put("pcsn", pcsn);
|
||||
jsonVeExt.put("storagevehicleext_id", org.nl.common.utils.IdUtil.getLongId()); |
// }
|
||||
jsonVeExt.put("storagevehicle_id", dto.getLongValue("storagevehicle_id")); |
// if (StrUtil.isNotEmpty(qty)) {
|
||||
jsonVeExt.put("storagevehicle_code", dto.getString("storagevehicle_code")); |
// jsonVeExt.put("qty", qty);
|
||||
jsonVeExt.put("storagevehicle_type", dto.getString("storagevehicle_type")); |
// }
|
||||
if (StrUtil.isNotEmpty(pcsn)) { |
// jsonVeExt.put("device_uuid", org.nl.common.utils.IdUtil.getLongId());
|
||||
jsonVeExt.put("pcsn", pcsn); |
// jsonVeExt.put("update_time", DateUtil.now());
|
||||
} |
// veExtTab.insert(jsonVeExt);
|
||||
if (StrUtil.isNotEmpty(qty)) { |
// } else {
|
||||
jsonVeExt.put("qty", qty); |
// if (StrUtil.isNotEmpty(pcsn)) {
|
||||
} |
// ext_jo.put("pcsn", pcsn);
|
||||
jsonVeExt.put("device_uuid", org.nl.common.utils.IdUtil.getLongId()); |
// }
|
||||
jsonVeExt.put("update_time", DateUtil.now()); |
// if (StrUtil.isNotEmpty(qty)) {
|
||||
veExtTab.insert(jsonVeExt); |
// ext_jo.put("qty", qty);
|
||||
} else { |
// }
|
||||
if (StrUtil.isNotEmpty(pcsn)) { |
// veExtTab.update(ext_jo);
|
||||
ext_jo.put("pcsn", pcsn); |
// }
|
||||
} |
// }
|
||||
if (StrUtil.isNotEmpty(qty)) { |
//
|
||||
ext_jo.put("qty", qty); |
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
} |
// wo.update(json);
|
||||
veExtTab.update(ext_jo); |
// }
|
||||
} |
//
|
||||
} |
// @Override
|
||||
|
// @Transactional(rollbackFor = Exception.class)
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
// public void deleteAll(Long[] ids) {
|
||||
wo.update(json); |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
} |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
// String now = DateUtil.now();
|
||||
@Override |
//
|
||||
@Transactional(rollbackFor = Exception.class) |
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
public void deleteAll(Long[] ids) { |
// for (Long storagevehicle_id : ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// JSONObject param = new JSONObject();
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// param.put("storagevehicle_id", String.valueOf(storagevehicle_id));
|
||||
String now = DateUtil.now(); |
// param.put("is_delete", "1");
|
||||
|
// param.put("update_optid", currentUserId);
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
// param.put("update_optname", nickName);
|
||||
for (Long storagevehicle_id : ids) { |
// param.put("update_time", now);
|
||||
JSONObject param = new JSONObject(); |
// wo.update(param);
|
||||
param.put("storagevehicle_id", String.valueOf(storagevehicle_id)); |
// }
|
||||
param.put("is_delete", "1"); |
// }
|
||||
param.put("update_optid", currentUserId); |
//
|
||||
param.put("update_optname", nickName); |
// @Override
|
||||
param.put("update_time", now); |
// @Transactional(rollbackFor = Exception.class)
|
||||
wo.update(param); |
// public void changeActive(JSONObject json) {
|
||||
} |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
} |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
// String now = DateUtil.now();
|
||||
@Override |
//
|
||||
@Transactional(rollbackFor = Exception.class) |
// String is_used = "1";
|
||||
public void changeActive(JSONObject json) { |
// if (StrUtil.equals("1", json.getString("is_used"))) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// is_used = "0";
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// }
|
||||
String now = DateUtil.now(); |
// json.put("is_used", is_used);
|
||||
|
// json.put("update_optid", currentUserId);
|
||||
String is_used = "1"; |
// json.put("update_optname", nickName);
|
||||
if (StrUtil.equals("1", json.getString("is_used"))) { |
// json.put("update_time", now);
|
||||
is_used = "0"; |
// WQLObject.getWQLObject("md_pb_storagevehicleinfo").update(json);
|
||||
} |
// }
|
||||
json.put("is_used", is_used); |
//
|
||||
json.put("update_optid", currentUserId); |
// @Override
|
||||
json.put("update_optname", nickName); |
// @Transactional(rollbackFor = Exception.class)
|
||||
json.put("update_time", now); |
// public JSONObject getVehicle(String code) {
|
||||
WQLObject.getWQLObject("md_pb_storagevehicleinfo").update(json); |
// String term = "";
|
||||
} |
// switch (code) {
|
||||
|
// case "00":
|
||||
@Override |
// term = "VEHICCLE_CODE_MTP";
|
||||
@Transactional(rollbackFor = Exception.class) |
// break;
|
||||
public JSONObject getVehicle(String code) { |
// case "01":
|
||||
String term = ""; |
// term = "VEHICCLE_CODE_TTP";
|
||||
switch (code) { |
// break;
|
||||
case "00": |
// default:
|
||||
term = "VEHICCLE_CODE_MTP"; |
// break;
|
||||
break; |
// }
|
||||
case "01": |
//
|
||||
term = "VEHICCLE_CODE_TTP"; |
// HashMap<String, String> map = new HashMap<>();
|
||||
break; |
// map.put("code", term);
|
||||
default: |
// map.put("flag", "0");
|
||||
break; |
// SysCodeRuleServiceImpl genCodeService = new SysCodeRuleServiceImpl();
|
||||
} |
// String value = genCodeService.codeDemo(map);
|
||||
|
//
|
||||
HashMap<String, String> map = new HashMap<>(); |
// JSONObject json = new JSONObject();
|
||||
map.put("code", term); |
// json.put("value", value);
|
||||
map.put("flag", "0"); |
// return json;
|
||||
SysCodeRuleServiceImpl genCodeService = new SysCodeRuleServiceImpl(); |
// }
|
||||
String value = genCodeService.codeDemo(map); |
//
|
||||
|
//}
|
||||
JSONObject json = new JSONObject(); |
|
||||
json.put("value", value); |
|
||||
return json; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
@ -1,161 +1,161 @@ |
|||||
package org.nl.wms.basedata.master.service.impl; |
//package org.nl.wms.basedata.master.service.impl;
|
||||
|
//
|
||||
|
//
|
||||
import cn.hutool.core.date.DateUtil; |
//import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil; |
//import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil; |
//import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil; |
//import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON; |
//import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray; |
//import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject; |
//import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor; |
//import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j; |
//import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils; |
//import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException; |
//import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.ResultBean; |
//import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject; |
//import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil; |
//import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.UnitService; |
//import org.nl.wms.basedata.master.service.UnitService;
|
||||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
||||
import org.springframework.data.domain.Pageable; |
//import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service; |
//import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional; |
//import org.springframework.transaction.annotation.Transactional;
|
||||
|
//
|
||||
import java.util.List; |
//import java.util.List;
|
||||
import java.util.Map; |
//import java.util.Map;
|
||||
|
//
|
||||
/** |
///**
|
||||
* @author loujf |
// * @author loujf
|
||||
* @description 服务实现 |
// * @description 服务实现
|
||||
* @date 2021-12-07 |
// * @date 2021-12-07
|
||||
**/ |
// **/
|
||||
@Service |
//@Service
|
||||
@RequiredArgsConstructor |
//@RequiredArgsConstructor
|
||||
@Slf4j |
//@Slf4j
|
||||
public class UnitServiceImpl implements UnitService { |
//public class UnitServiceImpl implements UnitService {
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String where = ""; |
// String where = "";
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
String search = (String) whereJson.get("search"); |
// String search = (String) whereJson.get("search");
|
||||
if (!StrUtil.isEmpty(search)) { |
// if (!StrUtil.isEmpty(search)) {
|
||||
where = " AND (unit_code like '%" + search + "%' OR unit_name like '%" + search + "%' ) "; |
// where = " AND (unit_code like '%" + search + "%' OR unit_name like '%" + search + "%' ) ";
|
||||
} |
// }
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "is_delete='0' " + where, "update_time desc"); |
// ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "is_delete='0' " + where, "update_time desc");
|
||||
final JSONObject json = rb.pageResult(); |
// final JSONObject json = rb.pageResult();
|
||||
return json; |
// return json;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public List<UnitDto> queryAll(Map whereJson) { |
// public List<UnitDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0); |
// JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<UnitDto> list = arr.toJavaList(UnitDto.class); |
// List<UnitDto> list = arr.toJavaList(UnitDto.class);
|
||||
return list; |
// return list;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public UnitDto findById(Long measure_unit_id) { |
// public UnitDto findById(Long measure_unit_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
JSONObject json = wo.query("measure_unit_id =" + measure_unit_id + "").uniqueResult(0); |
// JSONObject json = wo.query("measure_unit_id =" + measure_unit_id + "").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) { |
// if (ObjectUtil.isEmpty(json)) {
|
||||
return null; |
// return null;
|
||||
} |
// }
|
||||
final UnitDto obj = json.toJavaObject(UnitDto.class); |
// final UnitDto obj = json.toJavaObject(UnitDto.class);
|
||||
return obj; |
// return obj;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public UnitDto findByCode(String code) { |
// public UnitDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
JSONObject json = wo.query("unit_code ='" + code + "'").uniqueResult(0); |
// JSONObject json = wo.query("unit_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) { |
// if (ObjectUtil.isEmpty(json)) {
|
||||
return null; |
// return null;
|
||||
} |
// }
|
||||
final UnitDto obj = json.toJavaObject(UnitDto.class); |
// final UnitDto obj = json.toJavaObject(UnitDto.class);
|
||||
return obj; |
// return obj;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
@Transactional(rollbackFor = Exception.class) |
// @Transactional(rollbackFor = Exception.class)
|
||||
public void create(UnitDto dto) { |
// public void create(UnitDto dto) {
|
||||
String unit_code = dto.getUnit_code(); |
// String unit_code = dto.getUnit_code();
|
||||
UnitDto unitDto = this.findByCode(unit_code); |
// UnitDto unitDto = this.findByCode(unit_code);
|
||||
if (unitDto != null && "0".equals(unitDto.getIs_delete())) { |
// if (unitDto != null && "0".equals(unitDto.getIs_delete())) {
|
||||
throw new BadRequestException("存在相同的编码"); |
// throw new BadRequestException("存在相同的编码");
|
||||
} |
// }
|
||||
|
//
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now(); |
// String now = DateUtil.now();
|
||||
|
//
|
||||
dto.setMeasure_unit_id(IdUtil.getSnowflake(1, 1).nextId()); |
// dto.setMeasure_unit_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(String.valueOf(currentUserId)); |
// dto.setCreate_id(String.valueOf(currentUserId));
|
||||
dto.setCreate_name(nickName); |
// dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(String.valueOf(currentUserId)); |
// dto.setUpdate_optid(String.valueOf(currentUserId));
|
||||
dto.setUpdate_optname(nickName); |
// dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now); |
// dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now); |
// dto.setCreate_time(now);
|
||||
|
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json); |
// wo.insert(json);
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
@Transactional(rollbackFor = Exception.class) |
// @Transactional(rollbackFor = Exception.class)
|
||||
public void update(UnitDto dto) { |
// public void update(UnitDto dto) {
|
||||
UnitDto entity = this.findById(dto.getMeasure_unit_id()); |
// UnitDto entity = this.findById(dto.getMeasure_unit_id());
|
||||
if (entity == null) { |
// if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!"); |
// throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
} |
// }
|
||||
|
//
|
||||
String unit_code = dto.getUnit_code(); |
// String unit_code = dto.getUnit_code();
|
||||
UnitDto unitDto = this.findByCode(unit_code); |
// UnitDto unitDto = this.findByCode(unit_code);
|
||||
if (unitDto != null && |
// if (unitDto != null &&
|
||||
!unitDto.getMeasure_unit_id().equals(dto.getMeasure_unit_id()) |
// !unitDto.getMeasure_unit_id().equals(dto.getMeasure_unit_id())
|
||||
&& "0".equals(unitDto.getIs_delete())) { |
// && "0".equals(unitDto.getIs_delete())) {
|
||||
throw new BadRequestException("存在相同的编码"); |
// throw new BadRequestException("存在相同的编码");
|
||||
} |
// }
|
||||
|
//
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now(); |
// String now = DateUtil.now();
|
||||
dto.setUpdate_time(now); |
// dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(String.valueOf(currentUserId)); |
// dto.setUpdate_optid(String.valueOf(currentUserId));
|
||||
dto.setUpdate_optname(nickName); |
// dto.setUpdate_optname(nickName);
|
||||
|
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json); |
// wo.update(json);
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
public JSONObject getUnit(Map whereJson) { |
// public JSONObject getUnit(Map whereJson) {
|
||||
JSONArray units = WQLObject.getWQLObject("md_pb_measureunit").query("is_used = '1' AND is_delete = '0'").getResultJSONArray(0); |
// JSONArray units = WQLObject.getWQLObject("md_pb_measureunit").query("is_used = '1' AND is_delete = '0'").getResultJSONArray(0);
|
||||
JSONObject jo = new JSONObject(); |
// JSONObject jo = new JSONObject();
|
||||
jo.put("content", units); |
// jo.put("content", units);
|
||||
return jo; |
// return jo;
|
||||
} |
// }
|
||||
|
//
|
||||
@Override |
// @Override
|
||||
@Transactional(rollbackFor = Exception.class) |
// @Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) { |
// public void deleteAll(String[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId(); |
// String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName(); |
// String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now(); |
// String now = DateUtil.now();
|
||||
|
//
|
||||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
for (String measure_unit_id : ids) { |
// for (String measure_unit_id : ids) {
|
||||
JSONObject param = new JSONObject(); |
// JSONObject param = new JSONObject();
|
||||
param.put("measure_unit_id", String.valueOf(measure_unit_id)); |
// param.put("measure_unit_id", String.valueOf(measure_unit_id));
|
||||
param.put("is_delete", "1"); |
// param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId); |
// param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName); |
// param.put("update_optname", nickName);
|
||||
param.put("update_time", now); |
// param.put("update_time", now);
|
||||
wo.update(param); |
// wo.update(param);
|
||||
} |
// }
|
||||
} |
// }
|
||||
|
//
|
||||
} |
//}
|
||||
|
@ -0,0 +1,83 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.cotroller; |
||||
|
|
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.modules.logging.annotation.Log; |
||||
|
|
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.StoragevehicleinfoService; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoQuery; |
||||
|
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-09 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequiredArgsConstructor |
||||
|
|
||||
|
@RequestMapping("/api/storagevehicleinfo") |
||||
|
@Slf4j |
||||
|
public class StoragevehicleinfoController { |
||||
|
|
||||
|
private final StoragevehicleinfoService storagevehicleinfoService; |
||||
|
|
||||
|
@GetMapping |
||||
|
@Log("查询载具") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:list')")
|
||||
|
public ResponseEntity<Object> query(StoragevehicleinfoQuery whereJson, PageQuery page) { |
||||
|
return new ResponseEntity<>(storagevehicleinfoService.queryAll(whereJson, page), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
@Log("新增载具") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:add')")
|
||||
|
public ResponseEntity<Object> create(@RequestBody StoragevehicleinfoQuery map) { |
||||
|
return new ResponseEntity<>(storagevehicleinfoService.create(map), HttpStatus.CREATED); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
@Log("修改载具") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:edit')")
|
||||
|
public ResponseEntity<Object> update(@RequestBody StoragevehicleinfoQuery map) { |
||||
|
storagevehicleinfoService.update(map); |
||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
||||
|
} |
||||
|
|
||||
|
@Log("删除载具") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:del')")
|
||||
|
@DeleteMapping |
||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) { |
||||
|
storagevehicleinfoService.deleteAll(ids); |
||||
|
return new ResponseEntity<>(HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
@PutMapping("/changeActive") |
||||
|
@Log("修改点位启用状态") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('store:edit')")
|
||||
|
public ResponseEntity<Object> changeActive(@RequestBody StoragevehicleinfoQuery json) { |
||||
|
storagevehicleinfoService.changeActive(json); |
||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getVehicle/{code}") |
||||
|
@Log("获取起始载具号") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('store:edit')")
|
||||
|
public ResponseEntity<Object> getVehicle(@PathVariable String code) { |
||||
|
JSONObject json = storagevehicleinfoService.getVehicle(code); |
||||
|
return new ResponseEntity<>(json, HttpStatus.OK); |
||||
|
} |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
|
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoDto; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoQuery; |
||||
|
import org.springframework.data.domain.Pageable; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author ldjun |
||||
|
* @description 服务接口 |
||||
|
* @date 2021-12-09 |
||||
|
**/ |
||||
|
public interface StoragevehicleinfoService { |
||||
|
|
||||
|
/** |
||||
|
* 查询数据分页 |
||||
|
* |
||||
|
* @param whereJson 条件 |
||||
|
* @param page 分页参数 |
||||
|
* @return Map<String, Object> |
||||
|
*/ |
||||
|
JSONObject queryAll(StoragevehicleinfoQuery whereJson, PageQuery page); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 创建 |
||||
|
* |
||||
|
* @param map / |
||||
|
*/ |
||||
|
JSONArray create(StoragevehicleinfoQuery map); |
||||
|
|
||||
|
/** |
||||
|
* 编辑 |
||||
|
* |
||||
|
* @param map / |
||||
|
*/ |
||||
|
void update(StoragevehicleinfoQuery map); |
||||
|
|
||||
|
/** |
||||
|
* 多选删除 |
||||
|
* |
||||
|
* @param ids / |
||||
|
*/ |
||||
|
void deleteAll(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 多修改启用状态 |
||||
|
* |
||||
|
* @param json / |
||||
|
*/ |
||||
|
void changeActive(StoragevehicleinfoQuery json); |
||||
|
|
||||
|
/** |
||||
|
* 获取起始载具号 |
||||
|
* |
||||
|
* @param code / |
||||
|
*/ |
||||
|
JSONObject getVehicle(String code); |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service.dao; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("md_pb_storagevehicleext") |
||||
|
public class Storagevehicleex { |
||||
|
|
||||
|
|
||||
|
private Long storagevehicleext_id; |
||||
|
|
||||
|
private Long storagevehicle_id; |
||||
|
private Long material_id; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
private String storagevehicle_code; |
||||
|
|
||||
|
private String pcsn; |
||||
|
|
||||
|
private String storagevehicle_type; |
||||
|
private String remark; |
||||
|
|
||||
|
private String update_optid; |
||||
|
|
||||
|
private String update_optname; |
||||
|
|
||||
|
private String update_time; |
||||
|
private Long device_uuid; |
||||
|
private String qty; |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service.dao; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("md_pb_storagevehicleinfo") |
||||
|
public class Storagevehicleinfo implements Serializable { |
||||
|
@TableId(value = "storagevehicle_id", type = IdType.NONE) |
||||
|
/** |
||||
|
* 防止精度丢失 |
||||
|
*/ |
||||
|
@JsonSerialize(using = ToStringSerializer.class) |
||||
|
private Long storagevehicle_id; |
||||
|
|
||||
|
private String storagevehicle_code; |
||||
|
|
||||
|
private String storagevehicle_name; |
||||
|
|
||||
|
private String rfid_code; |
||||
|
|
||||
|
private String create_id; |
||||
|
|
||||
|
private String create_name; |
||||
|
|
||||
|
private String create_time; |
||||
|
|
||||
|
private String update_optid; |
||||
|
|
||||
|
private String update_optname; |
||||
|
|
||||
|
private String update_time; |
||||
|
|
||||
|
private String is_delete; |
||||
|
|
||||
|
private String is_used; |
||||
|
|
||||
|
private String storagevehicle_type; |
||||
|
|
||||
|
private String overstruct_type; |
||||
|
|
||||
|
private BigDecimal occupystruct_qty; |
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service.dao.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import io.lettuce.core.dynamic.annotation.Param; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleex; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoDto; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoQuery; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface StoragevehicleexMapper extends BaseMapper<Storagevehicleex> { |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service.dao.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import io.lettuce.core.dynamic.annotation.Param; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoDto; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoQuery; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface StoragevehicleinfoMapper extends BaseMapper<Storagevehicleinfo> { |
||||
|
|
||||
|
|
||||
|
|
||||
|
IPage<StoragevehicleinfoDto> selectByParam(@Param("whereJson") StoragevehicleinfoQuery whereJson,IPage<Storagevehicleinfo> page); |
||||
|
|
||||
|
void insertList(@Param("list") List<StoragevehicleinfoDto> storagevehicleinfoDtoArrayList); |
||||
|
|
||||
|
void updateBatchById(@Param("list") List<Storagevehicleinfo> storagevehicleinfos); |
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="org.nl.wms.basedata.master.storagevehicleinfo.service.dao.mapper.StoragevehicleinfoMapper"> |
||||
|
<insert id="insertList" |
||||
|
parameterType="org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoDto"> |
||||
|
insert into md_pb_storagevehicleinfo |
||||
|
( |
||||
|
storagevehicle_code, |
||||
|
storagevehicle_id, |
||||
|
storagevehicle_name, |
||||
|
storagevehicle_type, |
||||
|
create_name, |
||||
|
create_id, |
||||
|
create_time, |
||||
|
update_optid, |
||||
|
update_time |
||||
|
) |
||||
|
values |
||||
|
<foreach collection="list" item="item" separator=","> |
||||
|
(#{item.storagevehicle_code},#{item.storagevehicle_id},#{item.storagevehicle_name},#{item.storagevehicle_type},#{item.create_name},#{item.create_id},#{item.create_time},#{item.update_optid},#{item.update_time}) |
||||
|
</foreach> |
||||
|
</insert> |
||||
|
<select id="selectByParam" |
||||
|
resultType="org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoDto"> |
||||
|
SELECT |
||||
|
s.*, |
||||
|
ext.pcsn, |
||||
|
ext.qty, |
||||
|
ext.update_time AS change_time, |
||||
|
point.point_code, |
||||
|
point.point_name, |
||||
|
class.class_name AS storagevehicle_type_name |
||||
|
FROM |
||||
|
md_pb_storagevehicleinfo s |
||||
|
LEFT JOIN sch_base_point point ON point.vehicle_code = s.storagevehicle_code |
||||
|
LEFT JOIN md_pb_classstandard class ON class.class_code = s.storagevehicle_type |
||||
|
LEFT JOIN md_pb_storagevehicleext ext ON ext.storagevehicle_code = s.storagevehicle_code |
||||
|
WHERE |
||||
|
1=1 |
||||
|
<if test="whereJson.storagevehicle_types != null"> |
||||
|
s.storagevehicle_type in |
||||
|
<foreach collection="whereJson.storagevehicle_types" item="type" open="(" separator="," close=")"> |
||||
|
#{type} |
||||
|
</foreach> |
||||
|
</if> |
||||
|
and s.is_delete = '0' |
||||
|
<if test="whereJson.storagevehicle_code_begin != null"> |
||||
|
AND s.storagevehicle_code >= #{whereJson.storagevehicle_code_begin} |
||||
|
</if> |
||||
|
|
||||
|
<if test="whereJson.storagevehicle_code_end != null"> |
||||
|
AND s.storagevehicle_code <= #{whereJson.storagevehicle_code_end} |
||||
|
</if> |
||||
|
order by s.storagevehicle_code ASC |
||||
|
</select> |
||||
|
<update id="updateBatchById" parameterType="org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo"> |
||||
|
<foreach collection="list" item="item" > |
||||
|
update md_pb_storagevehicleinfo |
||||
|
set |
||||
|
|
||||
|
<if test="item.is_delete!=null"> |
||||
|
is_delete = #{item.is_delete}, |
||||
|
</if> |
||||
|
<if test="item.update_optid!=null"> |
||||
|
update_optid = #{item.update_optid}, |
||||
|
</if> |
||||
|
<if test="item.update_optname!=null"> |
||||
|
update_optname = #{item.update_optname}, |
||||
|
</if> |
||||
|
<if test="item.update_time!=null"> |
||||
|
update_time = #{item.update_time} |
||||
|
</if> |
||||
|
where storagevehicle_id = #{item.storagevehicle_id}; |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,67 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service.dto; |
||||
|
|
||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class StoragevehicleinfoDto implements Serializable { |
||||
|
|
||||
|
/** |
||||
|
* 防止精度丢失 |
||||
|
*/ |
||||
|
@JsonSerialize(using = ToStringSerializer.class) |
||||
|
private Long storagevehicle_id; |
||||
|
|
||||
|
private String storagevehicle_code; |
||||
|
|
||||
|
private String storagevehicle_name; |
||||
|
|
||||
|
private String one_code; |
||||
|
|
||||
|
private String two_code; |
||||
|
|
||||
|
private String rfid_code; |
||||
|
|
||||
|
private String create_id; |
||||
|
|
||||
|
private String create_name; |
||||
|
|
||||
|
private String create_time; |
||||
|
|
||||
|
private String update_optid; |
||||
|
|
||||
|
private String update_optname; |
||||
|
|
||||
|
private String update_time; |
||||
|
|
||||
|
private String is_delete; |
||||
|
|
||||
|
private String is_used; |
||||
|
|
||||
|
private String storagevehicle_type; |
||||
|
private String storagevehicle_type_name; |
||||
|
|
||||
|
|
||||
|
|
||||
|
private BigDecimal vehicle_width; |
||||
|
|
||||
|
private BigDecimal vehicle_long; |
||||
|
|
||||
|
private BigDecimal vehicle_height; |
||||
|
|
||||
|
private String overstruct_type; |
||||
|
|
||||
|
private BigDecimal occupystruct_qty; |
||||
|
|
||||
|
private String ext_id; |
||||
|
|
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class StoragevehicleinfoQuery implements Serializable { |
||||
|
|
||||
|
|
||||
|
private String storagevehicle_code_end; |
||||
|
|
||||
|
private String storagevehicle_code_begin; |
||||
|
|
||||
|
private String storagevehicle_code; |
||||
|
|
||||
|
private List<String> storagevehicle_types; |
||||
|
|
||||
|
private String storagevehicle_type; |
||||
|
private Long storagevehicle_id; |
||||
|
private String num; |
||||
|
private String qty; |
||||
|
private String pcsn; |
||||
|
|
||||
|
private String is_used; |
||||
|
private String update_optid; |
||||
|
|
||||
|
private String update_optname; |
||||
|
|
||||
|
private String update_time; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,248 @@ |
|||||
|
package org.nl.wms.basedata.master.storagevehicleinfo.service.impl; |
||||
|
|
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import cn.hutool.core.map.MapUtil; |
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.common.utils.CodeUtil; |
||||
|
import org.nl.common.utils.SecurityUtils; |
||||
|
import org.nl.modules.common.exception.BadRequestException; |
||||
|
import org.nl.modules.wql.WQL; |
||||
|
import org.nl.modules.wql.core.bean.WQLObject; |
||||
|
import org.nl.modules.wql.util.WqlUtil; |
||||
|
import org.nl.system.service.coderule.impl.SysCodeRuleServiceImpl; |
||||
|
import org.nl.wms.basedata.master.sectattr.service.dao.Sectattr; |
||||
|
import org.nl.wms.basedata.master.standard.service.IClassStandardService; |
||||
|
import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; |
||||
|
import org.nl.wms.basedata.master.standard.service.dao.mapper.ClassStandardMapper; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.StoragevehicleinfoService; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleex; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.mapper.StoragevehicleexMapper; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.mapper.StoragevehicleinfoMapper; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoDto; |
||||
|
import org.nl.wms.basedata.master.storagevehicleinfo.service.dto.StoragevehicleinfoQuery; |
||||
|
import org.nl.wms.basedata.master.unit.service.dao.Unit; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
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.*; |
||||
|
|
||||
|
/** |
||||
|
* @author ldjun |
||||
|
* @description 服务实现 |
||||
|
* @date 2021-12-09 |
||||
|
**/ |
||||
|
@Service |
||||
|
@Slf4j |
||||
|
public class StoragevehicleinfoServiceImpl implements StoragevehicleinfoService { |
||||
|
@Autowired |
||||
|
IClassStandardService classstandardService; |
||||
|
|
||||
|
@Autowired |
||||
|
ClassStandardMapper classStandardMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
StoragevehicleinfoMapper storagevehicleinfoMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
StoragevehicleexMapper storagevehicleexMapper; |
||||
|
|
||||
|
@Override |
||||
|
public JSONObject queryAll(StoragevehicleinfoQuery whereJson, PageQuery page) { |
||||
|
if (StrUtil.isNotEmpty((String) whereJson.getStoragevehicle_type())) { |
||||
|
ClassStandard dto = classStandardMapper.selectById(whereJson.getStoragevehicle_type()); |
||||
|
List<String> storagevehicle_types = classstandardService.getAllChildrenIds(dto.getClass_id().toString()); |
||||
|
whereJson.setStoragevehicle_types(storagevehicle_types); |
||||
|
|
||||
|
} |
||||
|
IPage<Storagevehicleinfo> pages = new Page<>(page.getPage() + 1, page.getSize()); |
||||
|
IPage<StoragevehicleinfoDto> storagevehicleinfoIPage = storagevehicleinfoMapper.selectByParam(whereJson,pages); |
||||
|
JSONObject jo = new JSONObject(); |
||||
|
jo.put("content", storagevehicleinfoIPage.getRecords()); |
||||
|
jo.put("totalElements", storagevehicleinfoIPage.getTotal()); |
||||
|
return jo; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public JSONArray create(StoragevehicleinfoQuery map) { |
||||
|
|
||||
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
||||
|
String nickName = SecurityUtils.getCurrentNickName(); |
||||
|
String now = DateUtil.now(); |
||||
|
|
||||
|
String storagevehicle_type = map.getStoragevehicle_type(); |
||||
|
ClassStandard classstandardServiceById = classStandardMapper.selectById(storagevehicle_type); |
||||
|
String class_code = classstandardServiceById.getClass_code().substring(0, 4); |
||||
|
; |
||||
|
String code = ""; |
||||
|
switch (class_code) { |
||||
|
case "0001": |
||||
|
//气涨轴编码
|
||||
|
code = "VEHICCLE_CODE_QZZ"; |
||||
|
break; |
||||
|
case "0002": |
||||
|
code = "VEHICLE_CODE_GXTP"; |
||||
|
break; |
||||
|
case "0003": |
||||
|
if (classstandardServiceById.getClass_code().equals("000301")){ |
||||
|
code = "VEHICLE_CODE_LK"; |
||||
|
} |
||||
|
if (classstandardServiceById.getClass_code().equals("000302")){ |
||||
|
code = "VEHICLE_CODE_LKB"; |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
if (StrUtil.isEmpty(code)) { |
||||
|
throw new BadRequestException("请选择正确的载具类型!"); |
||||
|
} |
||||
|
JSONArray resultCodeArr = new JSONArray(); |
||||
|
int num = Integer.valueOf(map.getNum()); |
||||
|
List<StoragevehicleinfoDto> storagevehicleinfoDtoArrayList = new ArrayList<>(); |
||||
|
for (int i = 0; i < num; i++) { |
||||
|
StoragevehicleinfoDto dto = new StoragevehicleinfoDto(); |
||||
|
dto.setStoragevehicle_id(IdUtil.getSnowflake(1, 1).nextId()); |
||||
|
dto.setStoragevehicle_code(CodeUtil.getNewCode(code)); |
||||
|
dto.setCreate_id(currentUserId); |
||||
|
dto.setStoragevehicle_name(dto.getStoragevehicle_code()); |
||||
|
dto.setCreate_name(nickName); |
||||
|
dto.setUpdate_optid(currentUserId); |
||||
|
dto.setUpdate_optname(nickName); |
||||
|
dto.setUpdate_time(now); |
||||
|
dto.setCreate_time(now); |
||||
|
dto.setStoragevehicle_type(classstandardServiceById.getClass_code()); |
||||
|
storagevehicleinfoDtoArrayList.add(dto); |
||||
|
resultCodeArr.add(dto.getStoragevehicle_code()); |
||||
|
} |
||||
|
storagevehicleinfoMapper.insertList(storagevehicleinfoDtoArrayList); |
||||
|
return resultCodeArr; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(StoragevehicleinfoQuery dto) { |
||||
|
|
||||
|
String qty = dto.getQty(); |
||||
|
String pcsn = dto.getPcsn(); |
||||
|
if (StrUtil.isNotEmpty(qty) || StrUtil.isNotEmpty(pcsn)) { |
||||
|
|
||||
|
Storagevehicleex storagevehicleex = storagevehicleexMapper.selectOne(new LambdaQueryWrapper<Storagevehicleex>().eq(Storagevehicleex::getStoragevehicle_code, dto.getStoragevehicle_code())); |
||||
|
if (ObjectUtil.isEmpty(storagevehicleex)) { |
||||
|
//新增一条记录
|
||||
|
storagevehicleex.setStoragevehicleext_id(org.nl.common.utils.IdUtil.getLongId()); |
||||
|
storagevehicleex.setStoragevehicle_id(dto.getStoragevehicle_id()); |
||||
|
storagevehicleex.setStoragevehicle_code(dto.getStoragevehicle_code()); |
||||
|
storagevehicleex.setStoragevehicle_type(dto.getStoragevehicle_type()); |
||||
|
if (StrUtil.isNotEmpty(pcsn)) { |
||||
|
storagevehicleex.setPcsn(dto.getPcsn()); |
||||
|
|
||||
|
} |
||||
|
if (StrUtil.isNotEmpty(qty)) { |
||||
|
storagevehicleex.setQty(dto.getQty()); |
||||
|
} |
||||
|
storagevehicleex.setDevice_uuid(org.nl.common.utils.IdUtil.getLongId()); |
||||
|
storagevehicleex.setUpdate_time(DateUtil.now()); |
||||
|
storagevehicleexMapper.insert(storagevehicleex); |
||||
|
} else { |
||||
|
if (StrUtil.isNotEmpty(pcsn)) { |
||||
|
storagevehicleex.setPcsn(dto.getPcsn()); |
||||
|
|
||||
|
} |
||||
|
if (StrUtil.isNotEmpty(qty)) { |
||||
|
storagevehicleex.setQty(dto.getQty()); |
||||
|
} |
||||
|
storagevehicleexMapper.update(storagevehicleex, new LambdaQueryWrapper<Storagevehicleex>().eq(Storagevehicleex::getStoragevehicleext_id, storagevehicleex.getStoragevehicleext_id())); |
||||
|
} |
||||
|
} |
||||
|
Storagevehicleinfo storagevehicleinfoUpdate = new Storagevehicleinfo(); |
||||
|
BeanUtils.copyProperties(dto, storagevehicleinfoUpdate); |
||||
|
storagevehicleinfoMapper.update(storagevehicleinfoUpdate, new LambdaQueryWrapper<Storagevehicleinfo>()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void deleteAll(Long[] ids) { |
||||
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
||||
|
String nickName = SecurityUtils.getCurrentNickName(); |
||||
|
String now = DateUtil.now(); |
||||
|
List<Storagevehicleinfo> storagevehicleinfos = new ArrayList<>(); |
||||
|
for (Long storagevehicle_id : ids) { |
||||
|
Storagevehicleinfo storagevehicleinfo = new Storagevehicleinfo(); |
||||
|
storagevehicleinfo.setStoragevehicle_id(storagevehicle_id); |
||||
|
storagevehicleinfo.setIs_delete("1"); |
||||
|
storagevehicleinfo.setUpdate_optid(currentUserId); |
||||
|
storagevehicleinfo.setUpdate_optname(nickName); |
||||
|
storagevehicleinfo.setUpdate_time(now); |
||||
|
storagevehicleinfos.add(storagevehicleinfo); |
||||
|
} |
||||
|
storagevehicleinfoMapper.updateBatchById(storagevehicleinfos); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void changeActive(StoragevehicleinfoQuery json) { |
||||
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
||||
|
String nickName = SecurityUtils.getCurrentNickName(); |
||||
|
String now = DateUtil.now(); |
||||
|
|
||||
|
String is_used = "1"; |
||||
|
if (StrUtil.equals("1", json.getIs_used())) { |
||||
|
is_used = "0"; |
||||
|
} |
||||
|
Storagevehicleinfo storagevehicleinfo = new Storagevehicleinfo(); |
||||
|
storagevehicleinfo.setIs_used(is_used); |
||||
|
storagevehicleinfo.setUpdate_optid(currentUserId); |
||||
|
storagevehicleinfo.setUpdate_optname(nickName); |
||||
|
storagevehicleinfo.setUpdate_time(now); |
||||
|
storagevehicleinfo.setStoragevehicle_id(json.getStoragevehicle_id()); |
||||
|
storagevehicleinfoMapper.updateById(storagevehicleinfo); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public JSONObject getVehicle(String code) { |
||||
|
String term = ""; |
||||
|
switch (code) { |
||||
|
case "00": |
||||
|
term = "VEHICCLE_CODE_MTP"; |
||||
|
break; |
||||
|
case "01": |
||||
|
term = "VEHICCLE_CODE_TTP"; |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
HashMap<String, String> map = new HashMap<>(); |
||||
|
map.put("code", term); |
||||
|
map.put("flag", "0"); |
||||
|
SysCodeRuleServiceImpl genCodeService = new SysCodeRuleServiceImpl(); |
||||
|
String value = genCodeService.codeDemo(map); |
||||
|
|
||||
|
JSONObject json = new JSONObject(); |
||||
|
json.put("value", value); |
||||
|
return json; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package org.nl.wms.basedata.master.unit.cotroller; |
||||
|
|
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.modules.logging.annotation.Log; |
||||
|
|
||||
|
import org.nl.wms.basedata.master.unit.service.UnitService; |
||||
|
import org.nl.wms.basedata.master.unit.service.dto.UnitDto; |
||||
|
import org.nl.wms.basedata.master.unit.service.dto.UnitQuery; |
||||
|
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 loujf |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequiredArgsConstructor |
||||
|
|
||||
|
@RequestMapping("/api/mdPbMeasureunit") |
||||
|
@Slf4j |
||||
|
public class UnitController { |
||||
|
private final UnitService unitService; |
||||
|
|
||||
|
@GetMapping |
||||
|
@Log("查询计量单位") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('Unit:list')")
|
||||
|
public ResponseEntity<Object> query(@RequestParam UnitQuery whereJson, PageQuery page) { |
||||
|
return new ResponseEntity<>(unitService.queryAll(whereJson, page), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
@Log("新增计量单位") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('Unit:add')")
|
||||
|
public ResponseEntity<Object> create(@Validated @RequestBody UnitDto dto) { |
||||
|
unitService.create(dto); |
||||
|
return new ResponseEntity<>(HttpStatus.CREATED); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
@Log("修改计量单位") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('Unit:edit')")
|
||||
|
public ResponseEntity<Object> update(@Validated @RequestBody UnitDto dto) { |
||||
|
unitService.update(dto); |
||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
||||
|
} |
||||
|
|
||||
|
@Log("删除计量单位") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('Unit:del')")
|
||||
|
@DeleteMapping |
||||
|
public ResponseEntity<Object> delete(@RequestBody String[] ids) { |
||||
|
unitService.deleteAll(ids); |
||||
|
return new ResponseEntity<>(HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getUnit") |
||||
|
@Log("查询单位下拉框") |
||||
|
|
||||
|
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
|
public ResponseEntity<Object> queryUnit(@RequestParam Map whereJson) { |
||||
|
return new ResponseEntity<>(unitService.getUnit(whereJson), HttpStatus.OK); |
||||
|
} |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
package org.nl.wms.basedata.master.unit.service; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.wms.basedata.master.unit.service.dao.Unit; |
||||
|
import org.nl.wms.basedata.master.unit.service.dto.UnitDto; |
||||
|
import org.nl.wms.basedata.master.unit.service.dto.UnitQuery; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description 服务接口 |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
public interface UnitService { |
||||
|
|
||||
|
/** |
||||
|
* 查询数据分页 |
||||
|
* |
||||
|
* @param whereJson 条件 |
||||
|
* @param page 分页参数 |
||||
|
* @return Map<String, Object> |
||||
|
*/ |
||||
|
IPage<Unit> queryAll(UnitQuery whereJson, PageQuery page); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 创建 |
||||
|
* |
||||
|
* @param dto / |
||||
|
*/ |
||||
|
void create(UnitDto dto); |
||||
|
|
||||
|
/** |
||||
|
* 编辑 |
||||
|
* |
||||
|
* @param dto / |
||||
|
*/ |
||||
|
void update(UnitDto dto); |
||||
|
|
||||
|
/** |
||||
|
* 多选删除 |
||||
|
* |
||||
|
* @param ids / |
||||
|
*/ |
||||
|
void deleteAll(String[] ids); |
||||
|
|
||||
|
|
||||
|
JSONObject getUnit(Map whereJson); |
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package org.nl.wms.basedata.master.unit.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; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("md_pb_measureunit") |
||||
|
public class Unit implements Serializable { |
||||
|
@TableId(value = "measure_unit_id", type = IdType.NONE) |
||||
|
private Long measure_unit_id; |
||||
|
|
||||
|
private String unit_code; |
||||
|
|
||||
|
private String unit_name; |
||||
|
|
||||
|
private BigDecimal qty_precision; |
||||
|
|
||||
|
private String is_used; |
||||
|
|
||||
|
private String create_id; |
||||
|
|
||||
|
private String create_name; |
||||
|
|
||||
|
private String create_time; |
||||
|
|
||||
|
private String update_optid; |
||||
|
|
||||
|
private String update_optname; |
||||
|
|
||||
|
private String update_time; |
||||
|
|
||||
|
private String is_delete; |
||||
|
|
||||
|
private String ext_id; |
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package org.nl.wms.basedata.master.unit.service.dao.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import io.lettuce.core.dynamic.annotation.Param; |
||||
|
import org.nl.wms.basedata.master.unit.service.dao.Unit; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface UnitMapper extends BaseMapper<Unit> { |
||||
|
|
||||
|
|
||||
|
void updateBatchById(@Param("unitList") List<Unit> unitList); |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="org.nl.wms.basedata.master.unit.service.dao.mapper.UnitMapper"> |
||||
|
|
||||
|
<update id="updateBatchById" parameterType="org.nl.wms.basedata.master.unit.service.dao.Unit"> |
||||
|
<foreach collection="unitList" item="item" > |
||||
|
update md_pb_measureunit |
||||
|
set |
||||
|
<if test="item.measure_unit_id!=null"> |
||||
|
measure_unit_id = #{item.measure_unit_id}, |
||||
|
</if> |
||||
|
<if test="item.unit_code!=null"> |
||||
|
unit_code = #{item.unit_code}, |
||||
|
</if> |
||||
|
<if test="item.unit_name!=null"> |
||||
|
unit_name = #{item.unit_name}, |
||||
|
</if> |
||||
|
<if test="item.qty_precision!=null"> |
||||
|
qty_precision = #{item.qty_precision}, |
||||
|
</if> |
||||
|
<if test="item.is_used!=null"> |
||||
|
is_used = #{item.is_used}, |
||||
|
</if> |
||||
|
<if test="item.create_name!=null"> |
||||
|
create_name = #{item.create_name}, |
||||
|
</if> |
||||
|
where measure_unit_id = #{item.measure_unit_id}; |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,42 @@ |
|||||
|
package org.nl.wms.basedata.master.unit.service.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class UnitDto implements Serializable { |
||||
|
|
||||
|
private Long measure_unit_id; |
||||
|
|
||||
|
private String unit_code; |
||||
|
|
||||
|
private String unit_name; |
||||
|
|
||||
|
private BigDecimal qty_precision; |
||||
|
|
||||
|
private String is_used; |
||||
|
|
||||
|
private String create_id; |
||||
|
|
||||
|
private String create_name; |
||||
|
|
||||
|
private String create_time; |
||||
|
|
||||
|
private String update_optid; |
||||
|
|
||||
|
private String update_optname; |
||||
|
|
||||
|
private String update_time; |
||||
|
|
||||
|
private String is_delete; |
||||
|
|
||||
|
private String ext_id; |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package org.nl.wms.basedata.master.unit.service.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description / |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class UnitQuery implements Serializable { |
||||
|
|
||||
|
|
||||
|
private String search; |
||||
|
|
||||
|
} |
@ -0,0 +1,151 @@ |
|||||
|
package org.nl.wms.basedata.master.unit.service.impl; |
||||
|
|
||||
|
|
||||
|
import cn.dev33.satoken.json.SaJsonTemplate; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
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.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.common.utils.SecurityUtils; |
||||
|
import org.nl.modules.common.exception.BadRequestException; |
||||
|
import org.nl.modules.wql.core.bean.WQLObject; |
||||
|
import org.nl.wms.basedata.master.sales.service.dao.Sales; |
||||
|
import org.nl.wms.basedata.master.unit.service.UnitService; |
||||
|
import org.nl.wms.basedata.master.unit.service.dao.Unit; |
||||
|
import org.nl.wms.basedata.master.unit.service.dao.mapper.UnitMapper; |
||||
|
import org.nl.wms.basedata.master.unit.service.dto.UnitDto; |
||||
|
import org.nl.wms.basedata.master.unit.service.dto.UnitQuery; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author loujf |
||||
|
* @description 服务实现 |
||||
|
* @date 2021-12-07 |
||||
|
**/ |
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
public class UnitServiceImpl implements UnitService { |
||||
|
|
||||
|
private final SaJsonTemplate getSaJsonTemplateForJackson; |
||||
|
|
||||
|
@Autowired |
||||
|
private UnitMapper unitMapper; |
||||
|
|
||||
|
@Override |
||||
|
public IPage<Unit> queryAll(UnitQuery whereJson, PageQuery page) { |
||||
|
|
||||
|
IPage<Unit> pages = new Page<>(page.getPage() + 1, page.getSize()); |
||||
|
LambdaQueryWrapper<Unit> lam = new LambdaQueryWrapper<Unit>(); |
||||
|
lam.eq(Unit::getIs_delete, "0") |
||||
|
.and(ObjectUtil.isNotEmpty(whereJson.getSearch()), blam -> blam.like(Unit::getUnit_code, whereJson.getSearch()).or() |
||||
|
.like(Unit::getUnit_name, whereJson.getSearch())) |
||||
|
.orderByDesc(Unit::getUpdate_time); |
||||
|
unitMapper.selectPage(pages, lam); |
||||
|
return pages; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void create(UnitDto dto) { |
||||
|
LambdaQueryWrapper<Unit> lam = new LambdaQueryWrapper<Unit>(); |
||||
|
lam.eq(Unit::getUnit_code, dto.getUnit_code()); |
||||
|
Unit unit = unitMapper.selectOne(lam); |
||||
|
if (unit != null && "0".equals(unit.getIs_delete())) { |
||||
|
throw new BadRequestException("存在相同的编码"); |
||||
|
} |
||||
|
|
||||
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
||||
|
String nickName = SecurityUtils.getCurrentNickName(); |
||||
|
String now = DateUtil.now(); |
||||
|
|
||||
|
dto.setMeasure_unit_id(IdUtil.getSnowflake(1, 1).nextId()); |
||||
|
dto.setCreate_id(String.valueOf(currentUserId)); |
||||
|
dto.setCreate_name(nickName); |
||||
|
dto.setUpdate_optid(String.valueOf(currentUserId)); |
||||
|
dto.setUpdate_optname(nickName); |
||||
|
dto.setUpdate_time(now); |
||||
|
dto.setCreate_time(now); |
||||
|
|
||||
|
Unit unitInsert = new Unit(); |
||||
|
BeanUtils.copyProperties(dto,unitInsert); |
||||
|
unitMapper.insert(unitInsert); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(UnitDto dto) { |
||||
|
LambdaQueryWrapper<Unit> lam = new LambdaQueryWrapper<Unit>(); |
||||
|
lam.eq(Unit::getMeasure_unit_id, dto.getMeasure_unit_id()); |
||||
|
Unit unitById = unitMapper.selectOne(lam); |
||||
|
if (unitById == null) { |
||||
|
throw new BadRequestException("被删除或无权限,操作失败!"); |
||||
|
} |
||||
|
LambdaQueryWrapper<Unit> lamCode = new LambdaQueryWrapper<Unit>(); |
||||
|
lamCode.eq(Unit::getUnit_code, dto.getUnit_code()); |
||||
|
Unit unitByCode = unitMapper.selectOne(lamCode); |
||||
|
if (unitByCode != null && !unitByCode.getMeasure_unit_id().equals(dto.getMeasure_unit_id())&&"0".equals(unitByCode.getIs_delete())) { |
||||
|
throw new BadRequestException("存在相同的编码"); |
||||
|
} |
||||
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
||||
|
String nickName = SecurityUtils.getCurrentNickName(); |
||||
|
String now = DateUtil.now(); |
||||
|
dto.setUpdate_time(now); |
||||
|
dto.setUpdate_optid(String.valueOf(currentUserId)); |
||||
|
dto.setUpdate_optname(nickName); |
||||
|
Unit unit = new Unit(); |
||||
|
BeanUtils.copyProperties(dto, unit); |
||||
|
unitMapper.updateById(unit); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void deleteAll(String[] ids) { |
||||
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
||||
|
String nickName = SecurityUtils.getCurrentNickName(); |
||||
|
String now = DateUtil.now(); |
||||
|
List<Unit> unitList = new ArrayList<>(); |
||||
|
for (String measure_unit_id : ids) { |
||||
|
Unit unit = new Unit(); |
||||
|
unit.setIs_delete("1"); |
||||
|
unit.setUpdate_optid(currentUserId); |
||||
|
unit.setUpdate_optname(nickName); |
||||
|
unit.setUpdate_time(now); |
||||
|
unit.setMeasure_unit_id(Long.valueOf(measure_unit_id)); |
||||
|
unitList.add(unit); |
||||
|
|
||||
|
} |
||||
|
unitMapper.updateBatchById(unitList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public JSONObject getUnit(Map whereJson) { |
||||
|
LambdaQueryWrapper<Unit> lam = new LambdaQueryWrapper<Unit>(); |
||||
|
lam.eq(Unit::getIs_used, "1").eq(Unit::getIs_delete, "0"); |
||||
|
List<Unit> units = unitMapper.selectList(lam); |
||||
|
JSONObject jo = new JSONObject(); |
||||
|
jo.put("content", units); |
||||
|
return jo; |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue