|
@@ -142,9 +142,7 @@ public class WebsitGoodsLogic {
|
|
|
|
|
|
WebsitGoods goods = new WebsitGoods();
|
|
|
BeanUtils.copyProperties(bean, goods);
|
|
|
- // 库存单位与销售单位一致
|
|
|
- goods.setGoodsSalesUnit(goods.getGoodsStockUnit());
|
|
|
-// goods.setManageWorkerStock(JudgeEnum.YES.getKey());
|
|
|
+
|
|
|
if (StringUtils.isBlank(goods.getNormType())) {
|
|
|
goods.setNormType(NormTypeEnum.M.getKey());
|
|
|
}
|
|
@@ -187,21 +185,28 @@ public class WebsitGoodsLogic {
|
|
|
}
|
|
|
|
|
|
private void stockUnitEmptyAdd(WebsitGoods goods) {
|
|
|
- if (StringUtils.isNotBlank(goods.getGoodsStockUnit())) {
|
|
|
+ if (goods.getGoodsType().equals(WebsitGoodsTypeEnum.M.getKey())) {
|
|
|
+ if (StringUtils.isNotBlank(goods.getGoodsStockUnit())) {
|
|
|
+ throw new RemoteServiceException("库存单位不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(goods.getGoodsSalesUnit())) {
|
|
|
+ throw new RemoteServiceException("销售单位不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- String type = goods.getGoodsType().equals(WebsitGoodsTypeEnum.M.getKey()) ? "ASSIST_UNIT" : "PARTS_UNIT";
|
|
|
- Integer count = sysDictCompanyService.lambdaQuery()
|
|
|
- .eq(SysDictCompany::getDictType, type)
|
|
|
- .eq(SysDictCompany::getDictValue, goods.getGoodsStockUnit())
|
|
|
- .count();
|
|
|
+ String type = goods.getGoodsType().equals(WebsitGoodsTypeEnum.M.getKey()) ? "ASSIST_UNIT" : "PARTS_UNIT";
|
|
|
+ Integer count = sysDictCompanyService.lambdaQuery()
|
|
|
+ .eq(SysDictCompany::getDictType, type)
|
|
|
+ .eq(SysDictCompany::getDictValue, goods.getGoodsStockUnit())
|
|
|
+ .count();
|
|
|
|
|
|
- if (count == 0) {
|
|
|
- SysDictCompany company = new SysDictCompany();
|
|
|
- company.setDictType(type)
|
|
|
- .setDictValue(goods.getGoodsStockUnit());
|
|
|
- sysDictCompanyLogic.saveOpenDict(company);
|
|
|
- }
|
|
|
+ if (count == 0) {
|
|
|
+ SysDictCompany company = new SysDictCompany();
|
|
|
+ company.setDictType(type)
|
|
|
+ .setDictValue(goods.getGoodsStockUnit());
|
|
|
+ sysDictCompanyLogic.saveOpenDict(company);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void handlePartsInfo(HttpServletRequest request, WebsitGoods goods, WebsitGoodsBean bean) {
|
|
@@ -273,44 +278,44 @@ public class WebsitGoodsLogic {
|
|
|
if (goods.getNormType().equals(NormTypeEnum.M.getKey()) && Objects.isNull(goods.getNormAmount())) {
|
|
|
throw new RemoteServiceException("收费标准不能为空");
|
|
|
}
|
|
|
-
|
|
|
- if (Objects.isNull(goods.getSelfWorkerAmount())) {
|
|
|
- if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
|
|
|
- throw new RemoteServiceException("自有库存师傅分账金额不能为空");
|
|
|
- } else {
|
|
|
- throw new RemoteServiceException("师傅分账比例不能为空");
|
|
|
- }
|
|
|
- }
|
|
|
+//
|
|
|
+// if (Objects.isNull(goods.getSelfWorkerAmount())) {
|
|
|
+// if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
|
|
|
+// throw new RemoteServiceException("自有库存师傅分账金额不能为空");
|
|
|
+// } else {
|
|
|
+// throw new RemoteServiceException("师傅分账比例不能为空");
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
// if (goods.getNormType().equals(NormTypeEnum.M.getKey()) && Objects.isNull(goods.getOutWorkerAmount())) {
|
|
|
// throw new RemoteServiceException("外购配件师傅分账金额不能为空");
|
|
|
// }
|
|
|
|
|
|
// 检查收费标准和分账金额
|
|
|
- BigDecimal selWorkerAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal selWorkerAmount = goods.getNormAmount();
|
|
|
BigDecimal selWebsitAmount = BigDecimal.ZERO;
|
|
|
// BigDecimal outWorkerAmount = BigDecimal.ZERO;
|
|
|
// BigDecimal outWebsitAmount = BigDecimal.ZERO;
|
|
|
- if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
|
|
|
- if (goods.getSelfWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
-
|
|
|
- if (goods.getSelfWorkerAmount().compareTo(goods.getNormAmount()) > 0) {
|
|
|
- throw new RemoteServiceException("自有库存师傅分账金额不能大于收费标准");
|
|
|
- }
|
|
|
-
|
|
|
- selWorkerAmount = goods.getSelfWorkerAmount();
|
|
|
- selWebsitAmount = goods.getNormAmount().subtract(selWorkerAmount);
|
|
|
- } else {
|
|
|
- selWebsitAmount = goods.getNormAmount();
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- if (goods.getSelfWorkerAmount().add(goods.getSelfWebsitAmount()).compareTo(BigDecimal.valueOf(100)) > 0) {
|
|
|
- throw new RemoteServiceException("分账比例不能大于100%");
|
|
|
- }
|
|
|
- selWorkerAmount = goods.getSelfWorkerAmount();
|
|
|
- selWebsitAmount = goods.getSelfWebsitAmount();
|
|
|
- }
|
|
|
+// if (goods.getNormType().equals(NormTypeEnum.M.getKey())) {
|
|
|
+// if (goods.getSelfWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+//
|
|
|
+// if (goods.getSelfWorkerAmount().compareTo(goods.getNormAmount()) > 0) {
|
|
|
+// throw new RemoteServiceException("自有库存师傅分账金额不能大于收费标准");
|
|
|
+// }
|
|
|
+//
|
|
|
+// selWorkerAmount = goods.getSelfWorkerAmount();
|
|
|
+// selWebsitAmount = goods.getNormAmount().subtract(selWorkerAmount);
|
|
|
+// } else {
|
|
|
+// selWebsitAmount = goods.getNormAmount();
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// if (goods.getSelfWorkerAmount().add(goods.getSelfWebsitAmount()).compareTo(BigDecimal.valueOf(100)) > 0) {
|
|
|
+// throw new RemoteServiceException("分账比例不能大于100%");
|
|
|
+// }
|
|
|
+// selWorkerAmount = goods.getSelfWorkerAmount();
|
|
|
+// selWebsitAmount = goods.getSelfWebsitAmount();
|
|
|
+// }
|
|
|
|
|
|
// if (Objects.nonNull(goods.getOutWorkerAmount())
|
|
|
// && goods.getOutWorkerAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
@@ -345,9 +350,6 @@ public class WebsitGoodsLogic {
|
|
|
BeanUtils.copyProperties(bean, goods);
|
|
|
goods.setCompanyWechatId(oldGoods.getCompanyWechatId())
|
|
|
.setCompanyWechatName(oldGoods.getCompanyWechatName());
|
|
|
- // 库存单位与销售单位一致
|
|
|
- goods.setGoodsSalesUnit(goods.getGoodsStockUnit());
|
|
|
-// goods.setManageWorkerStock(JudgeEnum.YES.getKey());
|
|
|
|
|
|
if (StringUtils.isNotBlank(goods.getGoodsCategoryId())) {
|
|
|
WebsitGoodsCategory category = websitGoodsCategoryService.getById(goods.getGoodsCategoryId());
|
|
@@ -565,11 +567,11 @@ public class WebsitGoodsLogic {
|
|
|
for (int i = 0; i < objects.size(); i++) {
|
|
|
List<Object> row = (List<Object>) objects.get(i);
|
|
|
CommonUtils.initList2(row, 11);
|
|
|
- if (row.size() < 8) {
|
|
|
+ if (row.size() < 7) {
|
|
|
row.add(null);
|
|
|
row.add(null);
|
|
|
}
|
|
|
- if (row.size() < 9) {
|
|
|
+ if (row.size() < 8) {
|
|
|
row.add(null);
|
|
|
}
|
|
|
if (Objects.isNull(row.get(0))) {
|
|
@@ -590,9 +592,9 @@ public class WebsitGoodsLogic {
|
|
|
if (Objects.isNull(row.get(5))) {
|
|
|
throw new RemoteServiceException("第" + (i+1) + "行, 适用产品大类不能为空");
|
|
|
}
|
|
|
- if (Objects.isNull(row.get(6))) {
|
|
|
- throw new RemoteServiceException("第" + (i+1) + "行, 自有库存师傅分账金额不能为空");
|
|
|
- }
|
|
|
+// if (Objects.isNull(row.get(6))) {
|
|
|
+// throw new RemoteServiceException("第" + (i+1) + "行, 自有库存师傅分账金额不能为空");
|
|
|
+// }
|
|
|
// if (Objects.isNull(row.get(7))) {
|
|
|
// throw new RemoteServiceException("第" + (i+1) + "行, 外购库存师傅分账金额不能为空");
|
|
|
// }
|
|
@@ -603,10 +605,10 @@ public class WebsitGoodsLogic {
|
|
|
String normAmountStr = (String) row.get(3);
|
|
|
String brandStr = (String) row.get(4);
|
|
|
String categoryStr = (String) row.get(5);
|
|
|
- String selfAmountStr = (String) row.get(6);
|
|
|
+// String selfAmountStr = (String) row.get(6);
|
|
|
String partType = (String) row.get(7);
|
|
|
- String goodsCodeStr = (String) row.get(8);
|
|
|
- String remark = (String) row.get(9);
|
|
|
+ String goodsCodeStr = (String) row.get(7);
|
|
|
+ String remark = (String) row.get(8);
|
|
|
|
|
|
// Integer count = websitGoodsService.lambdaQuery()
|
|
|
// .eq(WebsitGoods::getCompanyWechatId, companyWechatId)
|
|
@@ -646,12 +648,12 @@ public class WebsitGoodsLogic {
|
|
|
}
|
|
|
|
|
|
BigDecimal normAmount = new BigDecimal(normAmountStr);
|
|
|
- BigDecimal selfAmount = new BigDecimal(selfAmountStr);
|
|
|
+// BigDecimal selfAmount = new BigDecimal(selfAmountStr);
|
|
|
// BigDecimal outAmount = new BigDecimal(outAmountStr);
|
|
|
-
|
|
|
- if (selfAmount.compareTo(normAmount) > 0) {
|
|
|
- throw new RemoteServiceException("第" + (i + 1) + "行, 自有库存师傅分账金额不能大于收费标准");
|
|
|
- }
|
|
|
+//
|
|
|
+// if (selfAmount.compareTo(normAmount) > 0) {
|
|
|
+// throw new RemoteServiceException("第" + (i + 1) + "行, 自有库存师傅分账金额不能大于收费标准");
|
|
|
+// }
|
|
|
|
|
|
if (!"空调-冰箱-生活电器".contains(partType)) {
|
|
|
throw new RemoteServiceException("第" + (i + 1) + "行, 配件类型错误");
|
|
@@ -668,8 +670,8 @@ public class WebsitGoodsLogic {
|
|
|
goods.setRemark(remark);
|
|
|
goods.setMarketPrice(new BigDecimal(salesStr));
|
|
|
goods.setNormAmount(normAmount);
|
|
|
- goods.setSelfWorkerAmount(selfAmount);
|
|
|
- goods.setSelfWebsitAmount(normAmount.subtract(selfAmount));
|
|
|
+ goods.setSelfWorkerAmount(normAmount);
|
|
|
+// goods.setSelfWebsitAmount(normAmount.subtract(selfAmount));
|
|
|
// goods.setOutWorkerAmount(outAmount);
|
|
|
// goods.setOutWebsitAmount(normAmount.subtract(outAmount));
|
|
|
goods.setBrandRelaName(brandStr);
|