|
@@ -18,6 +18,7 @@ import com.gree.mall.manager.logic.common.CommonLogic;
|
|
|
import com.gree.mall.manager.logic.common.SysDictCompanyLogic;
|
|
|
import com.gree.mall.manager.plus.entity.*;
|
|
|
import com.gree.mall.manager.plus.service.*;
|
|
|
+import com.gree.mall.manager.utils.StringUtil;
|
|
|
import com.gree.mall.manager.utils.excel.ExcelUtils;
|
|
|
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
import com.gree.mall.manager.zfire.util.FieldUtils;
|
|
@@ -176,9 +177,27 @@ public class ChangeOrderLogic {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ List<String> orderIds = new ArrayList<>();
|
|
|
+
|
|
|
+ for (String id : ids) {
|
|
|
+ PgOrderBase pgOrderBase = pgOrderBaseService.getById(id);
|
|
|
+
|
|
|
+ PgOrderProduct pgOrderProduct = pgOrderProductService.lambdaQuery().eq(PgOrderProduct::getOrderBaseId, id)
|
|
|
+ .one();
|
|
|
+
|
|
|
+ if (websitDispatchService.lambdaQuery()
|
|
|
+ .eq( WebsitDispatch::getStreetCode, pgOrderBase.getStreetId())
|
|
|
+ .eq(WebsitDispatch::getSaleTypeId, pgOrderBase.getSaleType())
|
|
|
+ .eq( WebsitDispatch::getCategoryId,pgOrderProduct.getMainId())
|
|
|
+ .eq( WebsitDispatch::getOrderSmallId, pgOrderBase.getOrderSmallType())
|
|
|
+ .eq(!StringUtil.isEmpty(websitId), WebsitDispatch::getWebsitId, websitId).count() > 0) {
|
|
|
+ orderIds.add(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
pgOrderBaseService.lambdaUpdate()
|
|
|
- .in(PgOrderBase::getId, ids)
|
|
|
+ .in(PgOrderBase::getId, orderIds)
|
|
|
.set(PgOrderBase::getWorkerName, userOne.getNickName())
|
|
|
.set(PgOrderBase::getWebsitId, websitId)
|
|
|
.set(PgOrderBase::getWebsitName, adminWebsit.getName())
|
|
@@ -333,33 +352,33 @@ public class ChangeOrderLogic {
|
|
|
return websitDispatchVOIPage;
|
|
|
}
|
|
|
|
|
|
- public List<DispatchCherVO> pList(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
|
+ public List<DispatchCherVO> pList(String pId, String cityCode, String areaCode, String streetCode, List<String> sales, List<String> orderSmallId, List<String> categoryId) {
|
|
|
//获取当前登录企业id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
|
|
|
List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
|
|
|
- return increMapper.pList(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
+ return increMapper.pList(pId, cityCode, areaCode, streetCode, sales, orderSmallId, categoryId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
- public List<DispatchCherVO> cList(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
|
+ public List<DispatchCherVO> cList(String pId, String cityCode, String areaCode, String streetCode, List<String> sales, List<String> orderSmallId, List<String> categoryId) {
|
|
|
//获取当前登录企业id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
|
|
|
- return increMapper.cList(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
+ return increMapper.cList(pId, cityCode, areaCode, streetCode, sales, orderSmallId, categoryId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
- public List<DispatchCherVO> aList(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
|
+ public List<DispatchCherVO> aList(String pId, String cityCode, String areaCode, String streetCode, List<String> sales, List<String> orderSmallId, List<String> categoryId) {
|
|
|
//获取当前登录企业id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
|
|
|
- return increMapper.aList(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
+ return increMapper.aList(pId, cityCode, areaCode, streetCode, sales, orderSmallId, categoryId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
- public List<DispatchCherVO> sList(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
|
+ public List<DispatchCherVO> sList(String pId, String cityCode, String areaCode, String streetCode, List<String> sales, List<String> orderSmallId, List<String> categoryId) {
|
|
|
//获取当前登录企业id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
|
|
|
- return increMapper.sList(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
+ return increMapper.sList(pId, cityCode, areaCode, streetCode, sales, orderSmallId, categoryId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
public List<DispatchCherVO> channel(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
@@ -369,25 +388,25 @@ public class ChangeOrderLogic {
|
|
|
return increMapper.channel(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
- public List<DispatchCherVO> smallList(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
|
+ public List<DispatchCherVO> smallList(String pId, String cityCode, String areaCode, String streetCode, List<String> sales, List<String> orderSmallId, List<String> categoryId) {
|
|
|
//获取当前登录企业id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
|
|
|
- return increMapper.smallList(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
+ return increMapper.smallList(pId, cityCode, areaCode, streetCode, sales, orderSmallId, categoryId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
- public List<DispatchCherVO> categoryList(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
|
+ public List<DispatchCherVO> categoryList(String pId, String cityCode, String areaCode, String streetCode, List<String> sales, List<String> orderSmallId, List<String> categoryId) {
|
|
|
//获取当前登录企业id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
|
|
|
- return increMapper.categoryList(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
+ return increMapper.categoryList(pId, cityCode, areaCode, streetCode, sales, orderSmallId, categoryId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
- public List<DispatchCherVO> sourceList(String pId, String cityCode, String areaCode, String streetCode, List<String> dictCode, List<String> orderSmallId, List<String> categoryId, List<String> orderSourceId) {
|
|
|
+ public List<DispatchCherVO> sourceList(String pId, String cityCode, String areaCode, String streetCode, List<String> sales, List<String> orderSmallId, List<String> categoryId) {
|
|
|
//获取当前登录企业id
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
|
|
|
- return increMapper.sourceList(pId, cityCode, areaCode, streetCode, dictCode, orderSmallId, categoryId, orderSourceId, adminCompanyIds);
|
|
|
+ return increMapper.sourceList(pId, cityCode, areaCode, streetCode, sales, orderSmallId, categoryId, adminCompanyIds);
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -406,7 +425,7 @@ public class ChangeOrderLogic {
|
|
|
|
|
|
GoodsCategory goodsCategory = goodsCategoryService.getById(categoryId);
|
|
|
|
|
|
- for (String salesId : websitDispatchAdd.getCategoryIds()) {
|
|
|
+ for (String salesId : websitDispatchAdd.getSaleIds()) {
|
|
|
|
|
|
SysDictCompany sales = sysDictCompanyService.lambdaQuery().eq(SysDictCompany::getDictCode, salesId).last("limit 1").one();
|
|
|
|
|
@@ -540,8 +559,8 @@ public class ChangeOrderLogic {
|
|
|
websitDispatch.setCategoryId(goodsCategory.getCategoryId());
|
|
|
websitDispatch.setCategoryName(goodsCategory.getName());
|
|
|
|
|
|
- websitDispatch.setSaleTypeName(saleOne.getDictCode());
|
|
|
- websitDispatch.setSaleTypeId(saleOne.getDictValue());
|
|
|
+ websitDispatch.setSaleTypeName(saleOne.getDictValue());
|
|
|
+ websitDispatch.setSaleTypeId(saleOne.getDictCode());
|
|
|
|
|
|
|
|
|
if (websitDispatchService.lambdaQuery().eq(WebsitDispatch::getStreetCode, region.getId())
|
|
@@ -550,7 +569,7 @@ public class ChangeOrderLogic {
|
|
|
.eq(WebsitDispatch::getSaleTypeId, websitDispatch.getSaleTypeId())
|
|
|
.count() > 0) {
|
|
|
throw new RemoteServiceException("存在街道:" + websitDispatch.getStreetName() + ",产品大类:" + websitDispatch.getCategoryName() +
|
|
|
- ",承接渠道:" + websitDispatch.getSaleTypeName() + ",工单类型:" + websitDispatch.getOrderSmallTypeText());
|
|
|
+ ",销量类型:" + websitDispatch.getSaleTypeName() + ",工单类型:" + websitDispatch.getOrderSmallTypeText());
|
|
|
}
|
|
|
|
|
|
websitDispatches.add(websitDispatch);
|
|
@@ -587,4 +606,50 @@ public class ChangeOrderLogic {
|
|
|
|
|
|
return websitDispatchService.getById(id);
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void changWebsit(List<String> ids) {
|
|
|
+
|
|
|
+ List<String> orderIds = new ArrayList<>();
|
|
|
+
|
|
|
+ for (String id : ids) {
|
|
|
+ PgOrderBase pgOrderBase = pgOrderBaseService.getById(id);
|
|
|
+
|
|
|
+ PgOrderProduct pgOrderProduct = pgOrderProductService.lambdaQuery().eq(PgOrderProduct::getOrderBaseId, id)
|
|
|
+ .one();
|
|
|
+
|
|
|
+ if (!StringUtils.equalsAny(pgOrderBase.getOrderStatus(),"DSHPG","CJ","YPD","DXSPD","DZBPG","DWDSPGP","DXSSPGP","DTJXSSPGP","DZBSPGP","DFZXPD","DFZXSPGP")){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (websitDispatchService.lambdaQuery()
|
|
|
+ .eq( WebsitDispatch::getStreetCode, pgOrderBase.getStreetId())
|
|
|
+ .eq(WebsitDispatch::getSaleTypeId, pgOrderBase.getSaleType())
|
|
|
+ .eq( WebsitDispatch::getCategoryId,pgOrderProduct.getMainId())
|
|
|
+ .eq( WebsitDispatch::getOrderSmallId, pgOrderBase.getOrderSmallType())
|
|
|
+ .count() > 0) {
|
|
|
+
|
|
|
+ WebsitDispatch websitDispatch = websitDispatchService.lambdaQuery()
|
|
|
+ .eq(WebsitDispatch::getStreetCode, pgOrderBase.getStreetId())
|
|
|
+ .eq(WebsitDispatch::getSaleTypeId, pgOrderBase.getSaleType())
|
|
|
+ .eq(WebsitDispatch::getCategoryId, pgOrderProduct.getMainId())
|
|
|
+ .eq(WebsitDispatch::getOrderSmallId, pgOrderBase.getOrderSmallType())
|
|
|
+ .last("limit 1").one();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ pgOrderBase.setWebsitId(websitDispatch.getWebsitId());
|
|
|
+ pgOrderBase.setOrderStatus(OrderBaseStatusEnum.DWDPG.getKey());
|
|
|
+ pgOrderBase.setOrderStatusText(OrderBaseStatusEnum.DWDPG.getRemark());
|
|
|
+ pgOrderBase.setWebsitName(websitDispatch.getWebsitName());
|
|
|
+ pgOrderBase.setDispatchWebsitTime(new Date());
|
|
|
+ pgOrderBase.updateById();
|
|
|
+
|
|
|
+ orderLogLogic.addLog(pgOrderBase.getId(), "指派网点", "自动派工给网点【" +(pgOrderBase.getWebsitId())+ pgOrderBase.getWebsitName() + "】", pgOrderBase.getWebsitName());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|