当前位置:网站首页>Commodity management - merge purchase demand into purchase order
Commodity management - merge purchase demand into purchase order
2020-11-10 07:37:00 【osc_y8ifc29r】
One Brief purchasing process

Two Query for unclaimed purchase orders
1 request
GET /ware/purchase/unreceive/list
2 The response data
{
"msg": "success",
"code": 0,
"page": {
"totalCount": 0,
"pageSize": 10,
"totalPage": 0,
"currPage": 1,
"list": [{
"id": 1,
"assigneeId": 1,
"assigneeName": "aa",
"phone": "123",
"priority": 1,
"status": 1,
"wareId": 1,
"amount": 22.0000,
"createTime": "2019-12-12",
"updateTime": "2019-12-12"
}]
}
}
3、 ... and Merge purchasing requirements
1 request
POST /ware/purchase/merge
2 Request parameters
{
purchaseId: 1, // Whole order id
items: [1, 2, 3, 4] // Merge item sets
}
3 The response data
{
"msg": "success",
"code": 0
}
Four controller
/**
* Function description : Merge purchasing requirements
*
* @param mergeVo Purchase orders to be consolidated
* @return R Data returned to the front end
* @author cakin
* @date 2020/11/9
*/
@PostMapping("/merge")
public R merge(@RequestBody MergeVo mergeVo) {
purchaseService.mergePurchase(mergeVo);
return R.ok();
}
/**
* Function description : Query for unclaimed purchase orders
*
* @param params Filter conditions
* @return R Data returned to the front end
* @author cakin
* @date 2020/11/9
*/
@RequestMapping("/unreceive/list")
public R unreceivelist(@RequestParam Map<String, Object> params) {
PageUtils page = purchaseService.queryPageUnreceivePurchase(params);
return R.ok().put("page", page);
}
5、 ... and Service layer
/**
* Function description : Query for unclaimed purchase orders
*
* @param params Filter conditions
* @return PageUtils Paging results
* @author cakin
* @date 2020/11/9
*/
@Override
public PageUtils queryPageUnreceivePurchase(Map<String, Object> params) {
IPage<PurchaseEntity> page = this.page(
new Query<PurchaseEntity>().getPage(params),
// 0- Just built 1- Just assigned
new QueryWrapper<PurchaseEntity>().eq("status", 0).or().eq("status", 1)
);
return new PageUtils(page);
}
/**
* Function description : Merge purchasing requirements
*
* @param mergeVo Purchase orders to be consolidated
* @author cakin
* @date 2020/11/9
*/
@Transactional
@Override
public void mergePurchase(MergeVo mergeVo) {
Long purchaseId = mergeVo.getPurchaseId();
if (purchaseId == null) {
// Create a new purchase order
PurchaseEntity purchaseEntity = new PurchaseEntity();
// Purchase order initialization
purchaseEntity.setStatus(WareConstant.PurchaseStatusEnum.CREATED.getCode());
purchaseEntity.setCreateTime(new Date());
purchaseEntity.setUpdateTime(new Date());
this.save(purchaseEntity);
purchaseId = purchaseEntity.getId();
}
// TODO Confirm that the purchase order status is 0,1 To merge
List<Long> items = mergeVo.getItems();
Long finalPurchaseId = purchaseId;
List<PurchaseDetailEntity> collect = items.stream().map(i -> {
PurchaseDetailEntity detailEntity = new PurchaseDetailEntity();
detailEntity.setId(i);
detailEntity.setPurchaseId(finalPurchaseId);
detailEntity.setStatus(WareConstant.PurchaseDetailStatusEnum.ASSIGNED.getCode());
return detailEntity;
}).collect(Collectors.toList());
// Update purchasing requirements
detailService.updateBatchById(collect);
// Update the time field of purchase order
PurchaseEntity purchaseEntity = new PurchaseEntity();
purchaseEntity.setId(purchaseId);
purchaseEntity.setUpdateTime(new Date());
this.updateById(purchaseEntity);
}
6、 ... and VO
/**
* @className: MergeVo
* @description: Purchase order
* @date: 2020/11/9
* @author: cakin
*/
@Data
public class MergeVo {
/**
* Whole order id
*/
private Long purchaseId;
/**
* Merge item sets
*/
private List<Long> items;
}
7、 ... and Enumeration class
/**
* @className: WareConstant
* @description: Warehouse enumeration class
* @date: 2020/11/9
* @author: cakin
*/
public class WareConstant {
/**
* @className: PurchaseStatusEnum
* @description: Enumeration of purchase order status
* @date: 2020/11/9
* @author: cakin
*/
public enum PurchaseStatusEnum {
CREATED(0, " newly build "), ASSIGNED(1, " Already allocated "),
RECEIVE(2, " Have received "), FINISH(3, " Completed "),
HASERROR(4, " There are abnormal ");
private int code;
private String msg;
PurchaseStatusEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
/**
* @className: PurchaseDetailStatusEnum
* @description: Procurement requirements enumeration
* @date: 2020/11/9
* @author: cakin
*/
public enum PurchaseDetailStatusEnum {
CREATED(0, " newly build "), ASSIGNED(1, " Already allocated "),
BUYING(2, " Purchasing "), FINISH(3, " Completed "),
HASERROR(4, " Purchase failure ");
private int code;
private String msg;
PurchaseDetailStatusEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
}
8、 ... and test

版权声明
本文为[osc_y8ifc29r]所创,转载请带上原文链接,感谢
边栏推荐
- 树莓派鼓捣记 - 设置 wifi
- CUDA_ constant memory
- 大专学历的我工作六年了,还有机会进大厂吗?
- About CentOS start error: the solution of failed to start crash recovery kernel arming
- Exhibition cloud technology interpretation | in the face of emergencies, how does app do a good job in crash analysis and performance monitoring?
- JMeter的简单使用
- Validation failed for one or more entities. See 'entityvalidationerrors' solution
- CUDA_ Memory model
- lodash.js源码-flatten
- 完美日记母公司逸仙电商招股书:重营销、轻研发,前三季度亏11亿
猜你喜欢

JMeter interface test -- a solution with token

史上最全异常检测算法概述

CUDA_ Memory model

完美日记母公司逸仙电商招股书:重营销、轻研发,前三季度亏11亿

If you need a million objects

Error running app:Default Activity not found 解决方法
![[python学习手册-笔记]001.python前言](/img/c0/b4d34272d3f845ac717d48c669d974.jpg)
[python学习手册-笔记]001.python前言

Filezilla server配置FTP服务器中的各种问题与解决方法

iNeuOS工业互联平台,WEB组态(iNeuView)增加工程视图导入、导出功能,及优化和修复,发布:v3.2.1版本

Fire knowledge online answer activity small program
随机推荐
使用call、apply和bind解决js中烦人的this,事件绑定时的this和传参问题
Algorithm template arrangement (1)
坚持追查7年,近10亿美元比特币终被美国政府没收充公
分布式文档存储数据库之MongoDB索引管理
jt-day10
Must see! RDS database all in one
编码风格:Mvc模式下SSM环境,代码分层管理
Visit 2020 PG Technology Conference
Mongodb index management of distributed document storage database
Error running app: default activity not found solution
YouTube subscription: solve the problem of incomplete height display of YouTube subscription button in pop-up window
C/C++编程笔记:C语言开发坦克大战!纪念我们逝去的小霸王游戏
Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
接缝雕刻算法:一种看似不可能的图像大小调整方法
Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
Seam engraving algorithm: a seemingly impossible image size adjustment method
Assign the corresponding key and value in the map to the object
z-index属性详解
异常:Invalid or unexpected token
Baishan cloud technology is selected as the top 100 Internet enterprises in China in 2020