|
@@ -78,7 +78,7 @@ public class OrderBaseExcelLogic {
|
|
|
* @param rows
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void importOrder(List<Object> rows, String createWebsitId, String createWebsitName) {
|
|
|
+ public void importOrder(List<Object> rows) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
//品牌map
|
|
|
Map<String, Brand> brandMap = sysDictCompanyLogic.brandMapOfName(adminUser.getCompanyWechatId());
|
|
@@ -117,9 +117,11 @@ public class OrderBaseExcelLogic {
|
|
|
int index = 0;
|
|
|
for (Object o : rows) {
|
|
|
++index;
|
|
|
- String errPrefix = "第" + (index) + "行,工单号:"+ rows.get(1)+":";
|
|
|
+
|
|
|
OrderBaseStatusEnum orderBaseStatusEnum = OrderBaseStatusEnum.DSHPG;
|
|
|
List<String> row = (List<String>) o;
|
|
|
+
|
|
|
+ String errPrefix = "第" + (index) + "行,工单号:"+ row.get(1)+":";
|
|
|
CommonUtils.initList(row, 100);
|
|
|
String websitName = row.get(0);
|
|
|
String orderBaseId = row.get(1);
|
|
@@ -130,14 +132,19 @@ public class OrderBaseExcelLogic {
|
|
|
String linkName = row.get(6);
|
|
|
String userMobile = row.get(7);
|
|
|
String userMobile2 = row.get(8);
|
|
|
- String address = row.get(9);
|
|
|
- String saleCompany = row.get(10);
|
|
|
- String orderStatus = row.get(11);
|
|
|
- String workerName = row.get(12);
|
|
|
- String workerMobile = row.get(13);
|
|
|
- String createTime = row.get(14);
|
|
|
- String isQdText = row.get(15);
|
|
|
- String remark = row.get(16);
|
|
|
+
|
|
|
+ String p = row.get(9);
|
|
|
+ String c = row.get(10);
|
|
|
+ String a = row.get(11);
|
|
|
+ String s = row.get(12);
|
|
|
+ String address = row.get(13);
|
|
|
+ String saleCompany = row.get(14);
|
|
|
+ String orderStatus = row.get(15);
|
|
|
+ String workerName = row.get(16);
|
|
|
+ String workerMobile = row.get(17);
|
|
|
+ String createTime = row.get(18);
|
|
|
+ String isQdText = row.get(19);
|
|
|
+ String remark = row.get(20);
|
|
|
|
|
|
Boolean isQd = StringUtils.equals(isQdText, "是");
|
|
|
|
|
@@ -199,7 +206,7 @@ public class OrderBaseExcelLogic {
|
|
|
}
|
|
|
SysDictCompany orderChannelDict = orderChannelMap.get(orderChannel);
|
|
|
if (orderChannelDict == null) {
|
|
|
- throw new RemoteServiceException(errPrefix + "工单渠道不存在");
|
|
|
+ throw new RemoteServiceException(errPrefix + "销售类型不存在");
|
|
|
}
|
|
|
|
|
|
//工单状态
|
|
@@ -328,8 +335,10 @@ public class OrderBaseExcelLogic {
|
|
|
pgOrderBase.setSource(source);
|
|
|
pgOrderBase.setOrderChannelId(orderChannelDict.getDictCode());
|
|
|
pgOrderBase.setOrderChannelText(orderChannelDict.getDictValue());
|
|
|
- pgOrderBase.setCreateWebsitId(createWebsitId);
|
|
|
- pgOrderBase.setCreateWebsitName(createWebsitName);
|
|
|
+ if (!StringUtil.isEmpty(pgOrderBase.getWebsitId())) {
|
|
|
+ pgOrderBase.setCreateWebsitId(pgOrderBase.getWebsitId());
|
|
|
+ pgOrderBase.setCreateWebsitName(pgOrderBase.getWebsitName());
|
|
|
+ }
|
|
|
if (importBaseStatusEnum != null) {
|
|
|
pgOrderBase.setOrderStatus(importBaseStatusEnum.getKey());
|
|
|
pgOrderBase.setOrderStatusText(importBaseStatusEnum.getRemark());
|
|
@@ -395,13 +404,16 @@ public class OrderBaseExcelLogic {
|
|
|
List<PgOrderProduct> pgOrderProducts = new ArrayList<>();
|
|
|
//默认最多10个机型
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
- String brandName = row.get(6 * i + 17);
|
|
|
- String mainName = row.get(6 * i + 18);
|
|
|
- String smallName = row.get(6 * i + 19);
|
|
|
- String productName = row.get(6 * i + 20);
|
|
|
- String productNum = row.get(6 * i + 21);
|
|
|
- String remark = row.get(6 * i + 22);
|
|
|
+ String brandName = row.get(6 * i + 21);
|
|
|
+ String mainName = row.get(6 * i + 22);
|
|
|
+ String smallName = row.get(6 * i + 23);
|
|
|
+ String productName = row.get(6 * i + 24);
|
|
|
+ String productNum = row.get(6 * i + 25);
|
|
|
+ String remark = row.get(6 * i + 26);
|
|
|
if (StringUtils.isBlank(brandName)) {
|
|
|
+ brandName = "格力";
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(mainName)) {
|
|
|
continue;
|
|
|
}
|
|
|
if (StringUtils.isAnyBlank(mainName, smallName, productNum)) {
|
|
@@ -423,7 +435,12 @@ public class OrderBaseExcelLogic {
|
|
|
|
|
|
PgOrderProduct pgOrderProduct = new PgOrderProduct();
|
|
|
pgOrderProduct.setOrderBaseId(orderBaseId);
|
|
|
- pgOrderProduct.setNum(Integer.parseInt(productNum));
|
|
|
+ try {
|
|
|
+ pgOrderProduct.setNum(Integer.parseInt(productNum));
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new RemoteServiceException("第" + (index) + "行 商品数量填入数字");
|
|
|
+ }
|
|
|
+
|
|
|
pgOrderProduct.setMainId(mainGoodsCategory.getCategoryId());
|
|
|
pgOrderProduct.setMainName(mainName);
|
|
|
pgOrderProduct.setSmallId(smallGoodsCategory.getCategoryId());
|
|
@@ -443,7 +460,7 @@ public class OrderBaseExcelLogic {
|
|
|
*
|
|
|
* @param rows
|
|
|
*/
|
|
|
- public void importOrder2(List<Object> rows, String createWebsitId, String createWebsitName) {
|
|
|
+ public void importOrder2(List<Object> rows) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
//品牌map
|
|
|
Map<String, Brand> brandMap = sysDictCompanyLogic.brandMapOfName(adminUser.getCompanyWechatId());
|
|
@@ -492,17 +509,18 @@ public class OrderBaseExcelLogic {
|
|
|
String userName = row.get(3);
|
|
|
String userMobile = row.get(4);
|
|
|
String userMobile2 = row.get(5);
|
|
|
- String address = row.get(6);
|
|
|
- String mainName = row.get(7);
|
|
|
- String smallName = row.get(8);
|
|
|
- String productName = row.get(9);
|
|
|
- String workerName = row.get(10);
|
|
|
- String workerMobile = row.get(11);
|
|
|
- String orderStatus = row.get(12);
|
|
|
- String orderSmallType = row.get(13);
|
|
|
- String brandName = row.get(14);
|
|
|
- Integer num = StringUtils.isBlank(row.get(15)) ? 1 : Integer.parseInt(row.get(15));
|
|
|
- BigDecimal amount = StringUtils.isBlank(row.get(16)) ? BigDecimal.ZERO : new BigDecimal(row.get(16));
|
|
|
+
|
|
|
+ String address = row.get(9);
|
|
|
+ String mainName = row.get(10);
|
|
|
+ String smallName = row.get(11);
|
|
|
+ String productName = row.get(12);
|
|
|
+ String workerName = row.get(13);
|
|
|
+ String workerMobile = row.get(14);
|
|
|
+ String orderStatus = row.get(15);
|
|
|
+ String orderSmallType = row.get(16);
|
|
|
+ String brandName = row.get(17);
|
|
|
+ Integer num = StringUtils.isBlank(row.get(18)) ? 1 : Integer.parseInt(row.get(18));
|
|
|
+ BigDecimal amount = StringUtils.isBlank(row.get(19)) ? BigDecimal.ZERO : new BigDecimal(row.get(19));
|
|
|
|
|
|
if (StringUtils.isAnyBlank(orderBaseId, orderChannel, userName, userMobile, address, mainName, smallName, productName, orderSmallType, brandName)) {
|
|
|
throw new RemoteServiceException(errPrefix + "黄色区域为必填项");
|
|
@@ -552,7 +570,7 @@ public class OrderBaseExcelLogic {
|
|
|
}
|
|
|
SysDictCompany orderChannelDict = orderChannelMap.get(orderChannel);
|
|
|
if (orderChannelDict == null) {
|
|
|
- throw new RemoteServiceException(errPrefix + "工单渠道不存在");
|
|
|
+ throw new RemoteServiceException(errPrefix + "销售类型不存在");
|
|
|
}
|
|
|
|
|
|
//工单状态
|
|
@@ -672,8 +690,10 @@ public class OrderBaseExcelLogic {
|
|
|
pgOrderBase.setSource("导入");
|
|
|
pgOrderBase.setOrderChannelId(orderChannelDict.getDictCode());
|
|
|
pgOrderBase.setOrderChannelText(orderChannelDict.getDictValue());
|
|
|
- pgOrderBase.setCreateWebsitId(createWebsitId);
|
|
|
- pgOrderBase.setCreateWebsitName(createWebsitName);
|
|
|
+ if (!StringUtil.isEmpty(pgOrderBase.getWebsitId())) {
|
|
|
+ pgOrderBase.setCreateWebsitId(pgOrderBase.getWebsitId());
|
|
|
+ pgOrderBase.setCreateWebsitName(pgOrderBase.getWebsitName());
|
|
|
+ }
|
|
|
if (importBaseStatusEnum != null) {
|
|
|
pgOrderBase.setOrderStatus(importBaseStatusEnum.getKey());
|
|
|
pgOrderBase.setOrderStatusText(importBaseStatusEnum.getRemark());
|