41 changed files with 2642 additions and 1149 deletions
@ -1,60 +1,60 @@ |
|||
package org.nl.wms.basedata.master.rest; |
|||
|
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
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.UnitDto; |
|||
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/sales") |
|||
@Slf4j |
|||
public class SalesController { |
|||
private final SalesService salesService; |
|||
|
|||
@GetMapping |
|||
@Log("查询业务员") |
|||
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable 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); |
|||
} |
|||
} |
|||
//package org.nl.wms.basedata.master.rest;
|
|||
//
|
|||
//
|
|||
//import lombok.RequiredArgsConstructor;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.nl.modules.logging.annotation.Log;
|
|||
//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.UnitDto;
|
|||
//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/sales")
|
|||
//@Slf4j
|
|||
//public class SalesController {
|
|||
// private final SalesService salesService;
|
|||
//
|
|||
// @GetMapping
|
|||
// @Log("查询业务员")
|
|||
//
|
|||
// public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable 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);
|
|||
// }
|
|||
//}
|
|||
|
@ -1,82 +1,83 @@ |
|||
package org.nl.wms.basedata.master.rest; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.basedata.master.service.StoragevehicleinfoService; |
|||
import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto; |
|||
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 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(@RequestParam Map whereJson, Pageable page) { |
|||
return new ResponseEntity<>(storagevehicleinfoService.queryAll(whereJson, page), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增载具") |
|||
|
|||
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:add')")
|
|||
public ResponseEntity<Object> create(@RequestBody Map map) { |
|||
return new ResponseEntity<>(storagevehicleinfoService.create(map), HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改载具") |
|||
|
|||
//@PreAuthorize("@el.check('mdPbStoragevehicleinfo:edit')")
|
|||
public ResponseEntity<Object> update(@RequestBody JSONObject 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 JSONObject 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); |
|||
} |
|||
} |
|||
//package org.nl.wms.basedata.master.rest;
|
|||
//
|
|||
//
|
|||
//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.service.StoragevehicleinfoService;
|
|||
//import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto;
|
|||
//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 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(@RequestParam Map whereJson, Pageable page) {
|
|||
// return new ResponseEntity<>(storagevehicleinfoService.queryAll(whereJson, page), HttpStatus.OK);
|
|||
// }
|
|||
//
|
|||
// @PostMapping
|
|||
// @Log("新增载具")
|
|||
//
|
|||
// //@PreAuthorize("@el.check('mdPbStoragevehicleinfo:add')")
|
|||
// public ResponseEntity<Object> create(@RequestBody Map map) {
|
|||
// return new ResponseEntity<>(storagevehicleinfoService.create(map), HttpStatus.CREATED);
|
|||
// }
|
|||
//
|
|||
// @PutMapping
|
|||
// @Log("修改载具")
|
|||
//
|
|||
// //@PreAuthorize("@el.check('mdPbStoragevehicleinfo:edit')")
|
|||
// public ResponseEntity<Object> update(@RequestBody JSONObject 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 JSONObject 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);
|
|||
// }
|
|||
//}
|
|||
|
@ -1,71 +1,71 @@ |
|||
package org.nl.wms.basedata.master.rest; |
|||
|
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.basedata.master.service.UnitService; |
|||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
|||
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 Map whereJson, Pageable 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); |
|||
} |
|||
} |
|||
//package org.nl.wms.basedata.master.rest;
|
|||
//
|
|||
//
|
|||
//import lombok.RequiredArgsConstructor;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.nl.modules.logging.annotation.Log;
|
|||
//import org.nl.wms.basedata.master.service.UnitService;
|
|||
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
|||
//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 Map whereJson, Pageable 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,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; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.basedata.master.service.dto.SalesDto; |
|||
import org.nl.wms.basedata.master.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> |
|||
*/ |
|||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param whereJson 条件参数 |
|||
* @return List<UnitDto> |
|||
*/ |
|||
List<UnitDto> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param measure_unit_id ID |
|||
* @return Unit |
|||
*/ |
|||
SalesDto findById(Long measure_unit_id); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* |
|||
* @param code code |
|||
* @return Unit |
|||
*/ |
|||
SalesDto findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void create(SalesDto dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(SalesDto dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Long[] ids); |
|||
|
|||
|
|||
} |
|||
//package org.nl.wms.basedata.master.service;
|
|||
//
|
|||
//import com.alibaba.fastjson.JSONObject;
|
|||
//import org.nl.wms.basedata.master.service.dto.SalesDto;
|
|||
//import org.nl.wms.basedata.master.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>
|
|||
// */
|
|||
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
|||
//
|
|||
// /**
|
|||
// * 查询所有数据不分页
|
|||
// *
|
|||
// * @param whereJson 条件参数
|
|||
// * @return List<UnitDto>
|
|||
// */
|
|||
// List<UnitDto> queryAll(Map whereJson);
|
|||
//
|
|||
// /**
|
|||
// * 根据ID查询
|
|||
// *
|
|||
// * @param measure_unit_id ID
|
|||
// * @return Unit
|
|||
// */
|
|||
// SalesDto findById(Long measure_unit_id);
|
|||
//
|
|||
// /**
|
|||
// * 根据编码查询
|
|||
// *
|
|||
// * @param code code
|
|||
// * @return Unit
|
|||
// */
|
|||
// SalesDto findByCode(String code);
|
|||
//
|
|||
//
|
|||
// /**
|
|||
// * 创建
|
|||
// *
|
|||
// * @param dto /
|
|||
// */
|
|||
// void create(SalesDto dto);
|
|||
//
|
|||
// /**
|
|||
// * 编辑
|
|||
// *
|
|||
// * @param dto /
|
|||
// */
|
|||
// void update(SalesDto dto);
|
|||
//
|
|||
// /**
|
|||
// * 多选删除
|
|||
// *
|
|||
// * @param ids /
|
|||
// */
|
|||
// void deleteAll(Long[] ids);
|
|||
//
|
|||
//
|
|||
//}
|
|||
|
@ -1,86 +1,84 @@ |
|||
package org.nl.wms.basedata.master.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.basedata.master.service.dto.StoragevehicleinfoDto; |
|||
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> |
|||
*/ |
|||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param whereJson 条件参数 |
|||
* @return List<StoragevehicleinfoDto> |
|||
*/ |
|||
List<StoragevehicleinfoDto> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param storagevehicle_id ID |
|||
* @return MdPbStoragevehicleinfo |
|||
*/ |
|||
StoragevehicleinfoDto findById(Long storagevehicle_id); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* |
|||
* @param code code |
|||
* @return MdPbStoragevehicleinfo |
|||
*/ |
|||
StoragevehicleinfoDto findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param map / |
|||
*/ |
|||
JSONArray create(Map map); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(JSONObject dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Long[] ids); |
|||
|
|||
/** |
|||
* 多修改启用状态 |
|||
* |
|||
* @param json / |
|||
*/ |
|||
void changeActive(JSONObject json); |
|||
|
|||
/** |
|||
* 获取起始载具号 |
|||
* |
|||
* @param code / |
|||
*/ |
|||
JSONObject getVehicle(String code); |
|||
} |
|||
//package org.nl.wms.basedata.master.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.service.dto.StoragevehicleinfoDto;
|
|||
//import org.nl.wms.basedata.master.storagevehicleinfo.service.dao.Storagevehicleinfo;
|
|||
//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>
|
|||
// */
|
|||
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
|||
//
|
|||
//
|
|||
//
|
|||
// /**
|
|||
// * 根据ID查询
|
|||
// *
|
|||
// * @param storagevehicle_id ID
|
|||
// * @return MdPbStoragevehicleinfo
|
|||
// */
|
|||
// StoragevehicleinfoDto findById(Long storagevehicle_id);
|
|||
//
|
|||
// /**
|
|||
// * 根据编码查询
|
|||
// *
|
|||
// * @param code code
|
|||
// * @return MdPbStoragevehicleinfo
|
|||
// */
|
|||
// StoragevehicleinfoDto findByCode(String code);
|
|||
//
|
|||
//
|
|||
// /**
|
|||
// * 创建
|
|||
// *
|
|||
// * @param map /
|
|||
// */
|
|||
// JSONArray create(Map map);
|
|||
//
|
|||
// /**
|
|||
// * 编辑
|
|||
// *
|
|||
// * @param dto /
|
|||
// */
|
|||
// void update(JSONObject dto);
|
|||
//
|
|||
// /**
|
|||
// * 多选删除
|
|||
// *
|
|||
// * @param ids /
|
|||
// */
|
|||
// void deleteAll(Long[] ids);
|
|||
//
|
|||
// /**
|
|||
// * 多修改启用状态
|
|||
// *
|
|||
// * @param json /
|
|||
// */
|
|||
// void changeActive(JSONObject json);
|
|||
//
|
|||
// /**
|
|||
// * 获取起始载具号
|
|||
// *
|
|||
// * @param code /
|
|||
// */
|
|||
// JSONObject getVehicle(String code);
|
|||
//}
|
|||
|
@ -1,74 +1,76 @@ |
|||
package org.nl.wms.basedata.master.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.basedata.master.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 UnitService { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param page 分页参数 |
|||
* @return Map<String, Object> |
|||
*/ |
|||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param whereJson 条件参数 |
|||
* @return List<UnitDto> |
|||
*/ |
|||
List<UnitDto> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param measure_unit_id ID |
|||
* @return Unit |
|||
*/ |
|||
UnitDto findById(Long measure_unit_id); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* |
|||
* @param code code |
|||
* @return Unit |
|||
*/ |
|||
UnitDto findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void create(UnitDto dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(UnitDto dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(String[] ids); |
|||
|
|||
JSONObject getUnit(Map whereJson); |
|||
|
|||
} |
|||
//package org.nl.wms.basedata.master.service;
|
|||
//
|
|||
//import com.alibaba.fastjson.JSONObject;
|
|||
//import org.nl.common.domain.query.PageQuery;
|
|||
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
|||
//import org.nl.wms.basedata.master.unit.service.dto.UnitQuery;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//
|
|||
//import java.util.List;
|
|||
//import java.util.Map;
|
|||
//
|
|||
///**
|
|||
// * @author loujf
|
|||
// * @description 服务接口
|
|||
// * @date 2021-12-07
|
|||
// **/
|
|||
//public interface UnitService {
|
|||
//
|
|||
// /**
|
|||
// * 查询数据分页
|
|||
// *
|
|||
// * @param whereJson 条件
|
|||
// * @param page 分页参数
|
|||
// * @return Map<String, Object>
|
|||
// */
|
|||
// Map<String, Object> queryAll(Map whereJson, Pageable page);
|
|||
//
|
|||
// /**
|
|||
// * 查询所有数据不分页
|
|||
// *
|
|||
// * @param whereJson 条件参数
|
|||
// * @return List<UnitDto>
|
|||
// */
|
|||
// List<UnitDto> queryAll(Map whereJson);
|
|||
//
|
|||
// /**
|
|||
// * 根据ID查询
|
|||
// *
|
|||
// * @param measure_unit_id ID
|
|||
// * @return Unit
|
|||
// */
|
|||
// UnitDto findById(Long measure_unit_id);
|
|||
//
|
|||
// /**
|
|||
// * 根据编码查询
|
|||
// *
|
|||
// * @param code code
|
|||
// * @return Unit
|
|||
// */
|
|||
// UnitDto findByCode(String code);
|
|||
//
|
|||
//
|
|||
// /**
|
|||
// * 创建
|
|||
// *
|
|||
// * @param dto /
|
|||
// */
|
|||
// void create(UnitDto dto);
|
|||
//
|
|||
// /**
|
|||
// * 编辑
|
|||
// *
|
|||
// * @param dto /
|
|||
// */
|
|||
// void update(UnitDto dto);
|
|||
//
|
|||
// /**
|
|||
// * 多选删除
|
|||
// *
|
|||
// * @param ids /
|
|||
// */
|
|||
// void deleteAll(String[] ids);
|
|||
//
|
|||
// JSONObject getUnit(Map whereJson);
|
|||
//
|
|||
//}
|
|||
|
@ -1,26 +1,26 @@ |
|||
package org.nl.wms.basedata.master.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @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; |
|||
|
|||
} |
|||
//package org.nl.wms.basedata.master.service.dto;
|
|||
//
|
|||
//import lombok.Data;
|
|||
//
|
|||
//import java.io.Serializable;
|
|||
//import java.math.BigDecimal;
|
|||
//
|
|||
///**
|
|||
// * @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;
|
|||
//
|
|||
//}
|
|||
|
@ -1,63 +1,63 @@ |
|||
package org.nl.wms.basedata.master.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 ldjun |
|||
* @description / |
|||
* @date 2021-12-09 |
|||
**/ |
|||
@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 BigDecimal vehicle_width; |
|||
|
|||
private BigDecimal vehicle_long; |
|||
|
|||
private BigDecimal vehicle_height; |
|||
|
|||
private String overstruct_type; |
|||
|
|||
private BigDecimal occupystruct_qty; |
|||
|
|||
private String ext_id; |
|||
} |
|||
//package org.nl.wms.basedata.master.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 ldjun
|
|||
// * @description /
|
|||
// * @date 2021-12-09
|
|||
// **/
|
|||
//@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 BigDecimal vehicle_width;
|
|||
//
|
|||
// private BigDecimal vehicle_long;
|
|||
//
|
|||
// private BigDecimal vehicle_height;
|
|||
//
|
|||
// private String overstruct_type;
|
|||
//
|
|||
// private BigDecimal occupystruct_qty;
|
|||
//
|
|||
// private String ext_id;
|
|||
//}
|
|||
|
@ -1,41 +1,41 @@ |
|||
package org.nl.wms.basedata.master.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; |
|||
} |
|||
//package org.nl.wms.basedata.master.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;
|
|||
//}
|
|||
|
@ -1,131 +1,131 @@ |
|||
package org.nl.wms.basedata.master.service.impl; |
|||
|
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
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 lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.nl.modules.wql.core.bean.ResultBean; |
|||
import org.nl.modules.wql.core.bean.WQLObject; |
|||
import org.nl.modules.wql.util.WqlUtil; |
|||
import org.nl.wms.basedata.master.service.SalesService; |
|||
import org.nl.wms.basedata.master.service.dto.SalesDto; |
|||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author loujf |
|||
* @description 服务实现 |
|||
* @date 2021-12-07 |
|||
**/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class SalesServiceImpl implements SalesService { |
|||
|
|||
@Override |
|||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
|||
String where = ""; |
|||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
|||
String search = (String) whereJson.get("search"); |
|||
if (!StrUtil.isEmpty(search)) { |
|||
where = " AND (sales_code like '%" + search + "%' OR sales_name like '%" + search + "%' ) "; |
|||
} |
|||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1 " + where, "sales_code"); |
|||
final JSONObject json = rb.pageResult(); |
|||
return json; |
|||
} |
|||
|
|||
@Override |
|||
public List<UnitDto> queryAll(Map whereJson) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
JSONArray arr = wo.query().getResultJSONArray(0); |
|||
List<UnitDto> list = arr.toJavaList(UnitDto.class); |
|||
return list; |
|||
} |
|||
|
|||
@Override |
|||
public SalesDto findById(Long sales_id) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
|||
JSONObject json = wo.query("sales_id =" + sales_id + "").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(json)) { |
|||
return null; |
|||
} |
|||
final SalesDto obj = json.toJavaObject(SalesDto.class); |
|||
return obj; |
|||
} |
|||
|
|||
@Override |
|||
public SalesDto findByCode(String code) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
|||
JSONObject json = wo.query("sales_code ='" + code + "'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(json)) { |
|||
return null; |
|||
} |
|||
final SalesDto obj = json.toJavaObject(SalesDto.class); |
|||
return obj; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void create(SalesDto dto) { |
|||
String sales_code = dto.getSales_code(); |
|||
SalesDto unitDto = this.findByCode(sales_code); |
|||
if (unitDto != null) { |
|||
if (unitDto.getArea().equals(dto.getArea())) { |
|||
throw new BadRequestException("存在相同区域的业务员!"); |
|||
} |
|||
} |
|||
|
|||
dto.setSales_id(IdUtil.getSnowflake(1, 1).nextId()); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.insert(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(SalesDto dto) { |
|||
SalesDto entity = this.findById(dto.getSales_id()); |
|||
if (entity == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
|
|||
String sales_code = dto.getSales_code(); |
|||
SalesDto unitDto = this.findByCode(sales_code); |
|||
if (unitDto != null && !unitDto.getSales_id().equals(dto.getSales_id())) { |
|||
throw new BadRequestException("存在相同的编码"); |
|||
} |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.update(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deleteAll(Long[] ids) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo"); |
|||
for (Long sales_id : ids) { |
|||
wo.delete("sales_id = '" + sales_id + "'"); |
|||
} |
|||
} |
|||
|
|||
} |
|||
//package org.nl.wms.basedata.master.service.impl;
|
|||
//
|
|||
//
|
|||
//import cn.hutool.core.date.DateUtil;
|
|||
//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 lombok.RequiredArgsConstructor;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.nl.common.utils.SecurityUtils;
|
|||
//import org.nl.modules.common.exception.BadRequestException;
|
|||
//import org.nl.modules.wql.core.bean.ResultBean;
|
|||
//import org.nl.modules.wql.core.bean.WQLObject;
|
|||
//import org.nl.modules.wql.util.WqlUtil;
|
|||
//import org.nl.wms.basedata.master.service.SalesService;
|
|||
//import org.nl.wms.basedata.master.service.dto.SalesDto;
|
|||
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//import org.springframework.stereotype.Service;
|
|||
//import org.springframework.transaction.annotation.Transactional;
|
|||
//
|
|||
//import java.util.List;
|
|||
//import java.util.Map;
|
|||
//
|
|||
///**
|
|||
// * @author loujf
|
|||
// * @description 服务实现
|
|||
// * @date 2021-12-07
|
|||
// **/
|
|||
//@Service
|
|||
//@RequiredArgsConstructor
|
|||
//@Slf4j
|
|||
//public class SalesServiceImpl implements SalesService {
|
|||
//
|
|||
// @Override
|
|||
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|||
// String where = "";
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
|||
// String search = (String) whereJson.get("search");
|
|||
// if (!StrUtil.isEmpty(search)) {
|
|||
// where = " AND (sales_code like '%" + search + "%' OR sales_name like '%" + search + "%' ) ";
|
|||
// }
|
|||
// ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1 " + where, "sales_code");
|
|||
// final JSONObject json = rb.pageResult();
|
|||
// return json;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<UnitDto> queryAll(Map whereJson) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// JSONArray arr = wo.query().getResultJSONArray(0);
|
|||
// List<UnitDto> list = arr.toJavaList(UnitDto.class);
|
|||
// return list;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public SalesDto findById(Long sales_id) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
|||
// JSONObject json = wo.query("sales_id =" + sales_id + "").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(json)) {
|
|||
// return null;
|
|||
// }
|
|||
// final SalesDto obj = json.toJavaObject(SalesDto.class);
|
|||
// return obj;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public SalesDto findByCode(String code) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
|||
// JSONObject json = wo.query("sales_code ='" + code + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(json)) {
|
|||
// return null;
|
|||
// }
|
|||
// final SalesDto obj = json.toJavaObject(SalesDto.class);
|
|||
// return obj;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void create(SalesDto dto) {
|
|||
// String sales_code = dto.getSales_code();
|
|||
// SalesDto unitDto = this.findByCode(sales_code);
|
|||
// if (unitDto != null) {
|
|||
// if (unitDto.getArea().equals(dto.getArea())) {
|
|||
// throw new BadRequestException("存在相同区域的业务员!");
|
|||
// }
|
|||
// }
|
|||
//
|
|||
// dto.setSales_id(IdUtil.getSnowflake(1, 1).nextId());
|
|||
//
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
|||
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.insert(json);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void update(SalesDto dto) {
|
|||
// SalesDto entity = this.findById(dto.getSales_id());
|
|||
// if (entity == null) {
|
|||
// throw new BadRequestException("被删除或无权限,操作失败!");
|
|||
// }
|
|||
//
|
|||
// String sales_code = dto.getSales_code();
|
|||
// SalesDto unitDto = this.findByCode(sales_code);
|
|||
// if (unitDto != null && !unitDto.getSales_id().equals(dto.getSales_id())) {
|
|||
// throw new BadRequestException("存在相同的编码");
|
|||
// }
|
|||
//
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
|||
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.update(json);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void deleteAll(Long[] ids) {
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
// String now = DateUtil.now();
|
|||
//
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_cs_areasalesinfo");
|
|||
// for (Long sales_id : ids) {
|
|||
// wo.delete("sales_id = '" + sales_id + "'");
|
|||
// }
|
|||
// }
|
|||
//
|
|||
//}
|
|||
|
@ -1,277 +1,271 @@ |
|||
package org.nl.wms.basedata.master.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 lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.nl.common.utils.CodeUtil; |
|||
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.service.ClassstandardService; |
|||
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.StoragevehicleinfoDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author ldjun |
|||
* @description 服务实现 |
|||
* @date 2021-12-09 |
|||
**/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class StoragevehicleinfoServiceImpl implements StoragevehicleinfoService { |
|||
|
|||
private final ClassstandardService classstandardService; |
|||
|
|||
@Override |
|||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
|||
WQLObject taskService = WQLObject.getWQLObject("sch_base_task"); |
|||
HashMap<String, Object> map = new HashMap(); |
|||
|
|||
String storagevehicle_code_begin = (String) whereJson.get("storagevehicle_code_begin"); |
|||
String storagevehicle_code_end = (String) whereJson.get("storagevehicle_code_end"); |
|||
|
|||
if (StrUtil.isNotEmpty((String) whereJson.get("storagevehicle_type"))) { |
|||
ClassstandardDto dto = classstandardService.findById((String) whereJson.get("storagevehicle_type")); |
|||
String storagevehicle_type = classstandardService.getChildIdStr(dto.getClass_id().toString()); |
|||
map.put("storagevehicle_type", storagevehicle_type); |
|||
|
|||
} |
|||
map.put("storagevehicle_code_begin", storagevehicle_code_begin); |
|||
map.put("storagevehicle_code_end", storagevehicle_code_end); |
|||
map.put("flag", "1"); |
|||
JSONObject json = WQL.getWO("QMD_PB_STORAGEVEHICLEINFO").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "s.storagevehicle_code ASC"); |
|||
/*JSONArray content = json.getJSONArray("content"); |
|||
for (int i = 0; i < content.size(); 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); |
|||
if (ObjectUtil.isNotEmpty(jsonTask)) { |
|||
jsonObject.put("start_point_code", jsonTask.getString("start_point_code")); |
|||
jsonObject.put("next_point_code", jsonTask.getString("next_point_code")); |
|||
jsonObject.put("is_task", "1"); |
|||
jsonObject.put("point_code", ""); |
|||
} else { |
|||
jsonObject.put("is_task", "0"); |
|||
} |
|||
}*/ |
|||
return json; |
|||
} |
|||
|
|||
@Override |
|||
public List<StoragevehicleinfoDto> queryAll(Map whereJson) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
|||
JSONArray arr = wo.query().getResultJSONArray(0); |
|||
List<StoragevehicleinfoDto> list = arr.toJavaList(StoragevehicleinfoDto.class); |
|||
return list; |
|||
} |
|||
|
|||
@Override |
|||
public StoragevehicleinfoDto findById(Long storagevehicle_id) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
|||
JSONObject json = wo.query("storagevehicle_id =" + storagevehicle_id + "").uniqueResult(0); |
|||
final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class); |
|||
return obj; |
|||
} |
|||
|
|||
@Override |
|||
public StoragevehicleinfoDto findByCode(String code) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
|||
JSONObject json = wo.query("storagevehicle_code ='" + code + "'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(json)) { |
|||
throw new BadRequestException("请输入正确的载具号!"); |
|||
} |
|||
final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class); |
|||
return obj; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public JSONArray create(Map map) { |
|||
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)) { |
|||
throw new BadRequestException("此载具已存在"); |
|||
} |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
String storagevehicle_type = ((String) map.get("storagevehicle_type")); |
|||
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); |
|||
; |
|||
String code = ""; |
|||
switch (class_code) { |
|||
case "0001": |
|||
//气涨轴编码
|
|||
code = "VEHICCLE_CODE_QZZ"; |
|||
break; |
|||
case "0002": |
|||
code = "VEHICLE_CODE_GXTP"; |
|||
break; |
|||
case "0003": |
|||
if (class_jo.getString("class_code").equals("000301")){ |
|||
code = "VEHICLE_CODE_LK"; |
|||
} |
|||
if (class_jo.getString("class_code").equals("000302")){ |
|||
code = "VEHICLE_CODE_LKB"; |
|||
} |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
if (StrUtil.isEmpty(code)) { |
|||
throw new BadRequestException("请选择正确的载具类型!"); |
|||
} |
|||
JSONArray resultCodeArr = new JSONArray(); |
|||
int num = MapUtil.getInt(map, "num"); |
|||
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(class_jo.getString("class_code")); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.insert(json); |
|||
resultCodeArr.add(dto.getStoragevehicle_code()); |
|||
} |
|||
return resultCodeArr; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(JSONObject dto) { |
|||
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); |
|||
if (!ObjectUtil.isEmpty(jsonObject)) { |
|||
throw new BadRequestException("此载具已存在"); |
|||
} |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
|
|||
String qty = dto.getString("qty"); |
|||
String pcsn = dto.getString("pcsn"); |
|||
if (StrUtil.isNotEmpty(qty) || StrUtil.isNotEmpty(pcsn)) { |
|||
JSONObject ext_jo = veExtTab.query("storagevehicle_code = '"+dto.getString("storagevehicle_code")+"'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(ext_jo)) { |
|||
//新增一条记录
|
|||
JSONObject jsonVeExt = new JSONObject(); |
|||
jsonVeExt.put("storagevehicleext_id", org.nl.common.utils.IdUtil.getLongId()); |
|||
jsonVeExt.put("storagevehicle_id", dto.getLongValue("storagevehicle_id")); |
|||
jsonVeExt.put("storagevehicle_code", dto.getString("storagevehicle_code")); |
|||
jsonVeExt.put("storagevehicle_type", dto.getString("storagevehicle_type")); |
|||
if (StrUtil.isNotEmpty(pcsn)) { |
|||
jsonVeExt.put("pcsn", pcsn); |
|||
} |
|||
if (StrUtil.isNotEmpty(qty)) { |
|||
jsonVeExt.put("qty", qty); |
|||
} |
|||
jsonVeExt.put("device_uuid", org.nl.common.utils.IdUtil.getLongId()); |
|||
jsonVeExt.put("update_time", DateUtil.now()); |
|||
veExtTab.insert(jsonVeExt); |
|||
} else { |
|||
if (StrUtil.isNotEmpty(pcsn)) { |
|||
ext_jo.put("pcsn", pcsn); |
|||
} |
|||
if (StrUtil.isNotEmpty(qty)) { |
|||
ext_jo.put("qty", qty); |
|||
} |
|||
veExtTab.update(ext_jo); |
|||
} |
|||
} |
|||
|
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.update(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deleteAll(Long[] ids) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo"); |
|||
for (Long storagevehicle_id : ids) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("storagevehicle_id", String.valueOf(storagevehicle_id)); |
|||
param.put("is_delete", "1"); |
|||
param.put("update_optid", currentUserId); |
|||
param.put("update_optname", nickName); |
|||
param.put("update_time", now); |
|||
wo.update(param); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void changeActive(JSONObject json) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
String is_used = "1"; |
|||
if (StrUtil.equals("1", json.getString("is_used"))) { |
|||
is_used = "0"; |
|||
} |
|||
json.put("is_used", is_used); |
|||
json.put("update_optid", currentUserId); |
|||
json.put("update_optname", nickName); |
|||
json.put("update_time", now); |
|||
WQLObject.getWQLObject("md_pb_storagevehicleinfo").update(json); |
|||
} |
|||
|
|||
@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; |
|||
} |
|||
|
|||
} |
|||
//package org.nl.wms.basedata.master.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 lombok.RequiredArgsConstructor;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.nl.common.utils.SecurityUtils;
|
|||
//import org.nl.modules.common.exception.BadRequestException;
|
|||
//import org.nl.common.utils.CodeUtil;
|
|||
//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.service.ClassstandardService;
|
|||
//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.StoragevehicleinfoDto;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//import org.springframework.stereotype.Service;
|
|||
//import org.springframework.transaction.annotation.Transactional;
|
|||
//
|
|||
//import java.util.HashMap;
|
|||
//import java.util.List;
|
|||
//import java.util.Map;
|
|||
//
|
|||
///**
|
|||
// * @author ldjun
|
|||
// * @description 服务实现
|
|||
// * @date 2021-12-09
|
|||
// **/
|
|||
//@Service
|
|||
//@RequiredArgsConstructor
|
|||
//@Slf4j
|
|||
//public class StoragevehicleinfoServiceImpl implements StoragevehicleinfoService {
|
|||
//
|
|||
// private final ClassstandardService classstandardService;
|
|||
//
|
|||
// @Override
|
|||
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|||
// WQLObject taskService = WQLObject.getWQLObject("sch_base_task");
|
|||
// HashMap<String, Object> map = new HashMap();
|
|||
//
|
|||
// String storagevehicle_code_begin = (String) whereJson.get("storagevehicle_code_begin");
|
|||
// String storagevehicle_code_end = (String) whereJson.get("storagevehicle_code_end");
|
|||
//
|
|||
// if (StrUtil.isNotEmpty((String) whereJson.get("storagevehicle_type"))) {
|
|||
// ClassstandardDto dto = classstandardService.findById((String) whereJson.get("storagevehicle_type"));
|
|||
// String storagevehicle_type = classstandardService.getChildIdStr(dto.getClass_id().toString());
|
|||
// map.put("storagevehicle_type", storagevehicle_type);
|
|||
//
|
|||
// }
|
|||
// map.put("storagevehicle_code_begin", storagevehicle_code_begin);
|
|||
// map.put("storagevehicle_code_end", storagevehicle_code_end);
|
|||
// map.put("flag", "1");
|
|||
// JSONObject json = WQL.getWO("QMD_PB_STORAGEVEHICLEINFO").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "s.storagevehicle_code ASC");
|
|||
// /*JSONArray content = json.getJSONArray("content");
|
|||
// for (int i = 0; i < content.size(); 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);
|
|||
// if (ObjectUtil.isNotEmpty(jsonTask)) {
|
|||
// jsonObject.put("start_point_code", jsonTask.getString("start_point_code"));
|
|||
// jsonObject.put("next_point_code", jsonTask.getString("next_point_code"));
|
|||
// jsonObject.put("is_task", "1");
|
|||
// jsonObject.put("point_code", "");
|
|||
// } else {
|
|||
// jsonObject.put("is_task", "0");
|
|||
// }
|
|||
// }*/
|
|||
// return json;
|
|||
// }
|
|||
//
|
|||
//
|
|||
//
|
|||
// @Override
|
|||
// public StoragevehicleinfoDto findById(Long storagevehicle_id) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|||
// JSONObject json = wo.query("storagevehicle_id =" + storagevehicle_id + "").uniqueResult(0);
|
|||
// final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class);
|
|||
// return obj;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public StoragevehicleinfoDto findByCode(String code) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|||
// JSONObject json = wo.query("storagevehicle_code ='" + code + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(json)) {
|
|||
// throw new BadRequestException("请输入正确的载具号!");
|
|||
// }
|
|||
// final StoragevehicleinfoDto obj = json.toJavaObject(StoragevehicleinfoDto.class);
|
|||
// return obj;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public JSONArray create(Map map) {
|
|||
// 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)) {
|
|||
// throw new BadRequestException("此载具已存在");
|
|||
// }
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
// String now = DateUtil.now();
|
|||
//
|
|||
// String storagevehicle_type = ((String) map.get("storagevehicle_type"));
|
|||
// 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);
|
|||
// ;
|
|||
// String code = "";
|
|||
// switch (class_code) {
|
|||
// case "0001":
|
|||
// //气涨轴编码
|
|||
// code = "VEHICCLE_CODE_QZZ";
|
|||
// break;
|
|||
// case "0002":
|
|||
// code = "VEHICLE_CODE_GXTP";
|
|||
// break;
|
|||
// case "0003":
|
|||
// if (class_jo.getString("class_code").equals("000301")){
|
|||
// code = "VEHICLE_CODE_LK";
|
|||
// }
|
|||
// if (class_jo.getString("class_code").equals("000302")){
|
|||
// code = "VEHICLE_CODE_LKB";
|
|||
// }
|
|||
// break;
|
|||
// default:
|
|||
// break;
|
|||
// }
|
|||
// if (StrUtil.isEmpty(code)) {
|
|||
// throw new BadRequestException("请选择正确的载具类型!");
|
|||
// }
|
|||
// JSONArray resultCodeArr = new JSONArray();
|
|||
// int num = MapUtil.getInt(map, "num");
|
|||
// 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(class_jo.getString("class_code"));
|
|||
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.insert(json);
|
|||
// resultCodeArr.add(dto.getStoragevehicle_code());
|
|||
// }
|
|||
// return resultCodeArr;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void update(JSONObject dto) {
|
|||
// 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);
|
|||
// if (!ObjectUtil.isEmpty(jsonObject)) {
|
|||
// throw new BadRequestException("此载具已存在");
|
|||
// }
|
|||
//
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
//
|
|||
// String qty = dto.getString("qty");
|
|||
// String pcsn = dto.getString("pcsn");
|
|||
// if (StrUtil.isNotEmpty(qty) || StrUtil.isNotEmpty(pcsn)) {
|
|||
// JSONObject ext_jo = veExtTab.query("storagevehicle_code = '"+dto.getString("storagevehicle_code")+"'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(ext_jo)) {
|
|||
// //新增一条记录
|
|||
// JSONObject jsonVeExt = new JSONObject();
|
|||
// jsonVeExt.put("storagevehicleext_id", org.nl.common.utils.IdUtil.getLongId());
|
|||
// jsonVeExt.put("storagevehicle_id", dto.getLongValue("storagevehicle_id"));
|
|||
// jsonVeExt.put("storagevehicle_code", dto.getString("storagevehicle_code"));
|
|||
// jsonVeExt.put("storagevehicle_type", dto.getString("storagevehicle_type"));
|
|||
// if (StrUtil.isNotEmpty(pcsn)) {
|
|||
// jsonVeExt.put("pcsn", pcsn);
|
|||
// }
|
|||
// if (StrUtil.isNotEmpty(qty)) {
|
|||
// jsonVeExt.put("qty", qty);
|
|||
// }
|
|||
// jsonVeExt.put("device_uuid", org.nl.common.utils.IdUtil.getLongId());
|
|||
// jsonVeExt.put("update_time", DateUtil.now());
|
|||
// veExtTab.insert(jsonVeExt);
|
|||
// } else {
|
|||
// if (StrUtil.isNotEmpty(pcsn)) {
|
|||
// ext_jo.put("pcsn", pcsn);
|
|||
// }
|
|||
// if (StrUtil.isNotEmpty(qty)) {
|
|||
// ext_jo.put("qty", qty);
|
|||
// }
|
|||
// veExtTab.update(ext_jo);
|
|||
// }
|
|||
// }
|
|||
//
|
|||
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.update(json);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void deleteAll(Long[] ids) {
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
// String now = DateUtil.now();
|
|||
//
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|||
// for (Long storagevehicle_id : ids) {
|
|||
// JSONObject param = new JSONObject();
|
|||
// param.put("storagevehicle_id", String.valueOf(storagevehicle_id));
|
|||
// param.put("is_delete", "1");
|
|||
// param.put("update_optid", currentUserId);
|
|||
// param.put("update_optname", nickName);
|
|||
// param.put("update_time", now);
|
|||
// wo.update(param);
|
|||
// }
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void changeActive(JSONObject json) {
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
// String now = DateUtil.now();
|
|||
//
|
|||
// String is_used = "1";
|
|||
// if (StrUtil.equals("1", json.getString("is_used"))) {
|
|||
// is_used = "0";
|
|||
// }
|
|||
// json.put("is_used", is_used);
|
|||
// json.put("update_optid", currentUserId);
|
|||
// json.put("update_optname", nickName);
|
|||
// json.put("update_time", now);
|
|||
// WQLObject.getWQLObject("md_pb_storagevehicleinfo").update(json);
|
|||
// }
|
|||
//
|
|||
// @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;
|
|||
// }
|
|||
//
|
|||
//}
|
|||
|
@ -1,161 +1,161 @@ |
|||
package org.nl.wms.basedata.master.service.impl; |
|||
|
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
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 lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.nl.modules.wql.core.bean.ResultBean; |
|||
import org.nl.modules.wql.core.bean.WQLObject; |
|||
import org.nl.modules.wql.util.WqlUtil; |
|||
import org.nl.wms.basedata.master.service.UnitService; |
|||
import org.nl.wms.basedata.master.service.dto.UnitDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author loujf |
|||
* @description 服务实现 |
|||
* @date 2021-12-07 |
|||
**/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class UnitServiceImpl implements UnitService { |
|||
|
|||
@Override |
|||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
|||
String where = ""; |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
String search = (String) whereJson.get("search"); |
|||
if (!StrUtil.isEmpty(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"); |
|||
final JSONObject json = rb.pageResult(); |
|||
return json; |
|||
} |
|||
|
|||
@Override |
|||
public List<UnitDto> queryAll(Map whereJson) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
JSONArray arr = wo.query().getResultJSONArray(0); |
|||
List<UnitDto> list = arr.toJavaList(UnitDto.class); |
|||
return list; |
|||
} |
|||
|
|||
@Override |
|||
public UnitDto findById(Long measure_unit_id) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
JSONObject json = wo.query("measure_unit_id =" + measure_unit_id + "").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(json)) { |
|||
return null; |
|||
} |
|||
final UnitDto obj = json.toJavaObject(UnitDto.class); |
|||
return obj; |
|||
} |
|||
|
|||
@Override |
|||
public UnitDto findByCode(String code) { |
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
JSONObject json = wo.query("unit_code ='" + code + "'").uniqueResult(0); |
|||
if (ObjectUtil.isEmpty(json)) { |
|||
return null; |
|||
} |
|||
final UnitDto obj = json.toJavaObject(UnitDto.class); |
|||
return obj; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void create(UnitDto dto) { |
|||
String unit_code = dto.getUnit_code(); |
|||
UnitDto unitDto = this.findByCode(unit_code); |
|||
if (unitDto != null && "0".equals(unitDto.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); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.insert(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(UnitDto dto) { |
|||
UnitDto entity = this.findById(dto.getMeasure_unit_id()); |
|||
if (entity == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
|
|||
String unit_code = dto.getUnit_code(); |
|||
UnitDto unitDto = this.findByCode(unit_code); |
|||
if (unitDto != null && |
|||
!unitDto.getMeasure_unit_id().equals(dto.getMeasure_unit_id()) |
|||
&& "0".equals(unitDto.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); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.update(json); |
|||
} |
|||
|
|||
@Override |
|||
public JSONObject getUnit(Map whereJson) { |
|||
JSONArray units = WQLObject.getWQLObject("md_pb_measureunit").query("is_used = '1' AND is_delete = '0'").getResultJSONArray(0); |
|||
JSONObject jo = new JSONObject(); |
|||
jo.put("content", units); |
|||
return jo; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deleteAll(String[] ids) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit"); |
|||
for (String measure_unit_id : ids) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("measure_unit_id", String.valueOf(measure_unit_id)); |
|||
param.put("is_delete", "1"); |
|||
param.put("update_optid", currentUserId); |
|||
param.put("update_optname", nickName); |
|||
param.put("update_time", now); |
|||
wo.update(param); |
|||
} |
|||
} |
|||
|
|||
} |
|||
//package org.nl.wms.basedata.master.service.impl;
|
|||
//
|
|||
//
|
|||
//import cn.hutool.core.date.DateUtil;
|
|||
//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 lombok.RequiredArgsConstructor;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.nl.common.utils.SecurityUtils;
|
|||
//import org.nl.modules.common.exception.BadRequestException;
|
|||
//import org.nl.modules.wql.core.bean.ResultBean;
|
|||
//import org.nl.modules.wql.core.bean.WQLObject;
|
|||
//import org.nl.modules.wql.util.WqlUtil;
|
|||
//import org.nl.wms.basedata.master.service.UnitService;
|
|||
//import org.nl.wms.basedata.master.service.dto.UnitDto;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//import org.springframework.stereotype.Service;
|
|||
//import org.springframework.transaction.annotation.Transactional;
|
|||
//
|
|||
//import java.util.List;
|
|||
//import java.util.Map;
|
|||
//
|
|||
///**
|
|||
// * @author loujf
|
|||
// * @description 服务实现
|
|||
// * @date 2021-12-07
|
|||
// **/
|
|||
//@Service
|
|||
//@RequiredArgsConstructor
|
|||
//@Slf4j
|
|||
//public class UnitServiceImpl implements UnitService {
|
|||
//
|
|||
// @Override
|
|||
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|||
// String where = "";
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// String search = (String) whereJson.get("search");
|
|||
// if (!StrUtil.isEmpty(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");
|
|||
// final JSONObject json = rb.pageResult();
|
|||
// return json;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<UnitDto> queryAll(Map whereJson) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// JSONArray arr = wo.query().getResultJSONArray(0);
|
|||
// List<UnitDto> list = arr.toJavaList(UnitDto.class);
|
|||
// return list;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public UnitDto findById(Long measure_unit_id) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// JSONObject json = wo.query("measure_unit_id =" + measure_unit_id + "").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(json)) {
|
|||
// return null;
|
|||
// }
|
|||
// final UnitDto obj = json.toJavaObject(UnitDto.class);
|
|||
// return obj;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public UnitDto findByCode(String code) {
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// JSONObject json = wo.query("unit_code ='" + code + "'").uniqueResult(0);
|
|||
// if (ObjectUtil.isEmpty(json)) {
|
|||
// return null;
|
|||
// }
|
|||
// final UnitDto obj = json.toJavaObject(UnitDto.class);
|
|||
// return obj;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void create(UnitDto dto) {
|
|||
// String unit_code = dto.getUnit_code();
|
|||
// UnitDto unitDto = this.findByCode(unit_code);
|
|||
// if (unitDto != null && "0".equals(unitDto.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);
|
|||
//
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.insert(json);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void update(UnitDto dto) {
|
|||
// UnitDto entity = this.findById(dto.getMeasure_unit_id());
|
|||
// if (entity == null) {
|
|||
// throw new BadRequestException("被删除或无权限,操作失败!");
|
|||
// }
|
|||
//
|
|||
// String unit_code = dto.getUnit_code();
|
|||
// UnitDto unitDto = this.findByCode(unit_code);
|
|||
// if (unitDto != null &&
|
|||
// !unitDto.getMeasure_unit_id().equals(dto.getMeasure_unit_id())
|
|||
// && "0".equals(unitDto.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);
|
|||
//
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|||
// wo.update(json);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public JSONObject getUnit(Map whereJson) {
|
|||
// JSONArray units = WQLObject.getWQLObject("md_pb_measureunit").query("is_used = '1' AND is_delete = '0'").getResultJSONArray(0);
|
|||
// JSONObject jo = new JSONObject();
|
|||
// jo.put("content", units);
|
|||
// return jo;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public void deleteAll(String[] ids) {
|
|||
// String currentUserId = SecurityUtils.getCurrentUserId();
|
|||
// String nickName = SecurityUtils.getCurrentNickName();
|
|||
// String now = DateUtil.now();
|
|||
//
|
|||
// WQLObject wo = WQLObject.getWQLObject("md_pb_measureunit");
|
|||
// for (String measure_unit_id : ids) {
|
|||
// JSONObject param = new JSONObject();
|
|||
// param.put("measure_unit_id", String.valueOf(measure_unit_id));
|
|||
// param.put("is_delete", "1");
|
|||
// param.put("update_optid", currentUserId);
|
|||
// param.put("update_optname", nickName);
|
|||
// param.put("update_time", now);
|
|||
// wo.update(param);
|
|||
// }
|
|||
// }
|
|||
//
|
|||
//}
|
|||
|
@ -0,0 +1,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