|
@@ -17,6 +17,7 @@ import com.gree.mall.manager.bean.material.stock.WorkerStockDTO;
|
|
|
import com.gree.mall.manager.bean.material.worker.OldRefundManageBean;
|
|
|
import com.gree.mall.manager.bean.material.worker.OldRefundManageItemBean;
|
|
|
import com.gree.mall.manager.commonmapper.CommonMapper;
|
|
|
+import com.gree.mall.manager.enums.UserTypeEnum;
|
|
|
import com.gree.mall.manager.enums.material.*;
|
|
|
import com.gree.mall.manager.exception.RemoteServiceException;
|
|
|
import com.gree.mall.manager.inf.ValidGroup;
|
|
@@ -162,10 +163,10 @@ public class WorkerStockLogic {
|
|
|
CommonUtils.initList(row, 10);
|
|
|
if (websitGoodsTypeEnum.getKey().equals(WebsitGoodsTypeEnum.M.getKey())) {
|
|
|
String goodsId = row.get(0);
|
|
|
- String workerNumber = row.get(1);
|
|
|
+ String idCard = row.get(1);
|
|
|
String qty = row.get(2);
|
|
|
String price = row.get(3);
|
|
|
- if (StringUtils.isAnyBlank(goodsId, workerNumber, qty, price)) {
|
|
|
+ if (StringUtils.isAnyBlank(goodsId, idCard, qty, price)) {
|
|
|
throw new RemoteServiceException("第" + (i + 1) + "行请补充完整内容");
|
|
|
}
|
|
|
WorkerGoods workerGoods = workerGoodsService.lambdaQuery()
|
|
@@ -177,18 +178,21 @@ public class WorkerStockLogic {
|
|
|
}
|
|
|
|
|
|
//判断师傅信息
|
|
|
- User user = userService.lambdaQuery()
|
|
|
- .eq(User::getWorkerNumber, workerNumber)
|
|
|
+ List<User> userList = userService.lambdaQuery()
|
|
|
+ .eq(User::getIdCard, idCard)
|
|
|
+ .eq(User::getType, UserTypeEnum.WORKER.getKey())
|
|
|
+ .eq(User::getStatus, true)
|
|
|
.eq(User::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
- .last("limit 1")
|
|
|
- .one();
|
|
|
- if (user == null) {
|
|
|
- throw new RemoteServiceException("师傅编号【" + workerNumber + "】不存在");
|
|
|
+ .list();
|
|
|
+ if (CollectionUtil.isEmpty(userList)) {
|
|
|
+ throw new RemoteServiceException("师傅身份证【" + idCard + "】不存在");
|
|
|
}
|
|
|
+ User user = userList.get(0);
|
|
|
Integer count = workerStockService.lambdaQuery()
|
|
|
.eq(WorkerStock::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
- .eq(WorkerStock::getWorkerId, user.getUserId())
|
|
|
- .eq(WorkerStock::getGoodsId, goodsId).count();
|
|
|
+ .eq(WorkerStock::getIdentity, user.getIdCard())
|
|
|
+ .eq(WorkerStock::getGoodsId, goodsId)
|
|
|
+ .count();
|
|
|
if (count > 0) {
|
|
|
throw new RemoteServiceException(tipsGoodsName + "编号【" + goodsId + "】的库存记录已存在于系统,导入失败");
|
|
|
}
|
|
@@ -223,8 +227,8 @@ public class WorkerStockLogic {
|
|
|
String stock = row.get(1);
|
|
|
String oldQty = row.get(2);
|
|
|
//String websitName = row.get(4);
|
|
|
- String workerId = row.get(4);
|
|
|
- if (StringUtils.isAnyBlank(goodsId, stock, oldQty, workerId)) {
|
|
|
+ String idCard = row.get(4);
|
|
|
+ if (StringUtils.isAnyBlank(goodsId, stock, oldQty, idCard)) {
|
|
|
throw new RemoteServiceException("第" + (i + 1) + "行请补充完整内容");
|
|
|
}
|
|
|
WebsitGoods websitGoods = websitGoodsService.lambdaQuery()
|
|
@@ -237,17 +241,19 @@ public class WorkerStockLogic {
|
|
|
}
|
|
|
|
|
|
//判断师傅信息
|
|
|
- User user = userService.lambdaQuery()
|
|
|
- .eq(User::getWorkerNumber, workerId)
|
|
|
+ List<User> userList = userService.lambdaQuery()
|
|
|
+ .eq(User::getIdCard, idCard)
|
|
|
+ .eq(User::getType, UserTypeEnum.WORKER.getKey())
|
|
|
+ .eq(User::getStatus, true)
|
|
|
.eq(User::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
- .last("limit 1")
|
|
|
- .one();
|
|
|
- if (user == null) {
|
|
|
- throw new RemoteServiceException("师傅编号【" + workerId + "】不存在");
|
|
|
+ .list();
|
|
|
+ if (CollectionUtil.isEmpty(userList)) {
|
|
|
+ throw new RemoteServiceException("师傅编号【" + idCard + "】不存在");
|
|
|
}
|
|
|
+ User user = userList.get(0);
|
|
|
Integer count = workerStockService.lambdaQuery()
|
|
|
.eq(WorkerStock::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
- .eq(WorkerStock::getWorkerId, user.getWorkerNumber())
|
|
|
+ .eq(WorkerStock::getIdentity, user.getIdCard())
|
|
|
.eq(WorkerStock::getGoodsId, goodsId)
|
|
|
.count();
|
|
|
if (count > 0) {
|
|
@@ -332,12 +338,13 @@ public class WorkerStockLogic {
|
|
|
List<WorkerStockAcc> workerStockRemoveAccs = new ArrayList<>();
|
|
|
// 按师傅分组
|
|
|
final Map<String, List<WorkerStock>> workerGroupMap = stockList.stream()
|
|
|
- .collect(Collectors.groupingBy(WorkerStock::getWorkerId));
|
|
|
+ .collect(Collectors.groupingBy(WorkerStock::getIdentity));
|
|
|
|
|
|
for (Map.Entry<String, List<WorkerStock>> workerStock : workerGroupMap.entrySet()) {
|
|
|
// 需要删除的商品编号
|
|
|
final List<String> goodsIds = workerStock.getValue().stream()
|
|
|
- .map(WorkerStock::getGoodsId).collect(Collectors.toList());
|
|
|
+ .map(WorkerStock::getGoodsId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
final List<WorkerStockAcc> workerStockAccs = workerStockAccService.lambdaQuery()
|
|
|
.eq(WorkerStockAcc::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
.in(WorkerStockAcc::getGoodsId, goodsIds)
|