diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java index 0acca2d2..efa565dc 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java @@ -380,7 +380,7 @@ public class OrderController extends BaseController { // 创建子订单 OrderDetail od = new OrderDetail(); od.setDeptId(om.getDeptId()); - od.setCode(orderDetailService.createCode()); + od.setCode(orderDetailService.createCode(om.getCode())); od.setOrderMasterId(om.getId()); od.setOrderMasterCode(om.getCode()); od.setCustomerId(om.getCustomerId()); diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java index 71ef8fca..98233f89 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderDetailController.java @@ -206,6 +206,10 @@ public class OrderDetailController extends BaseController { // 填充商品三级类目 if(good.getDeptGoodsCategoryId() != null){ DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(good.getDeptGoodsCategoryId()); + if(deptGoodsCategory == null){ + deptGoodsCategory = new DeptGoodsCategory(); + deptGoodsCategory.setGoodsCategoryId(good.getDeptGoodsCategoryId()); + } if(deptGoodsCategory != null){ GoodsCategory one = goodsCategoryService.selectById(deptGoodsCategory.getGoodsCategoryId()); if(one != null && one.getParentCategoryId() != null){ diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java index 070bc85d..8440c45a 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java @@ -1,6 +1,7 @@ package com.ghy.web.controller.order; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.db.sql.Order; import com.ghy.common.adapay.model.AdapayStatusEnum; import com.ghy.common.adapay.model.PayParam; @@ -215,7 +216,9 @@ public class OrderMasterController extends BaseController { ExcelUtil util = new ExcelUtil(SysOrderRequest.class); List jsonObjects = util.importExcel(file.getInputStream()); for (SysOrderRequest model : jsonObjects) { - this.sysOrder(format(model)); + if(NumberUtil.isNumber(model.getSeq())){ + this.sysOrder(format(model)); + } } return AjaxResult.success(jsonObjects); } @@ -223,14 +226,14 @@ public class OrderMasterController extends BaseController { public SysOrderAssignRequest format(SysOrderRequest orderRequest) throws Exception{ SysOrderAssignRequest request = new SysOrderAssignRequest(); if(StringUtils.isEmpty(orderRequest.getSeq())){ - throw new Exception("导入列表中,序号不能为空!"); + throw new Exception("导入表格序号,序号不能为空!"); } if(StringUtils.isEmpty(orderRequest.getName())){ - throw new Exception(orderRequest.getSeq() + "行,导入姓名不能为空!"); + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",姓名不能为空!"); } request.setCustomerName(orderRequest.getName()); if(StringUtils.isEmpty(orderRequest.getPhone())){ - throw new Exception(orderRequest.getSeq() + "行,导入手机号不能为空!"); + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",导入手机号不能为空!"); } request.setCustomerPhone(orderRequest.getPhone()); request.setServDate(orderRequest.getDate()); @@ -238,32 +241,50 @@ public class OrderMasterController extends BaseController { request.setGoodsBrand(orderRequest.getBrand()); request.setRemark(orderRequest.getRemark()); if(StringUtils.isEmpty(orderRequest.getMode())){ - throw new Exception(orderRequest.getSeq() + "行,下单模式不能为空!"); + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",下单模式不能为空!"); }else { - if("带价发布".equals(orderRequest.getMode())){ - request.setOrderMode("02"); - request.setPayMode("02"); - }else if("一票价".equals(orderRequest.getMode())){ - request.setOrderMode("01"); - request.setPayMode("02"); + if(orderRequest.getMode().contains("-")){ + String orderModel = orderRequest.getMode().split("-")[0]; + String payType = orderRequest.getMode().split("-")[1]; + if("带价下单".equals(orderModel)){ + request.setOrderMode("02"); + }else if("一票价".equals(orderModel)){ + request.setOrderMode("01"); + }else { + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",下单模式填写错误!"); + } + if("到付".equals(payType)){ + request.setPayMode("02"); + }else { + request.setPayMode("01"); + } }else { - throw new Exception(orderRequest.getSeq() + "行,下单模式填写错误!"); + if("带价下单".equals(orderRequest.getMode())){ + request.setOrderMode("02"); + request.setPayMode("02"); + }else if("一票价".equals(orderRequest.getMode())){ + request.setOrderMode("01"); + request.setPayMode("02"); + }else { + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",下单模式填写错误!"); + } } + } if(StringUtils.isEmpty(orderRequest.getPrice())){ - throw new Exception(orderRequest.getSeq() + "行,导入价格不能为空!"); + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",价格不能为空!"); } request.setPrice(new BigDecimal(orderRequest.getPrice())); request.setVideoUrl(orderRequest.getUrl()); request.setImageUrl("http://gqz.opsoul.com/default.jpeg"); List goodsStandards = new ArrayList<>(); String [] categoryNames = orderRequest.getCategory().split("-"); - if(categoryNames.length != 4){ - throw new Exception(orderRequest.getSeq() + "行,导入四级类目数据格式错误"); + if(categoryNames.length != 3){ + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",三级类目数据格式错误"); }else { - if(StringUtils.isEmpty(categoryNames[0])||StringUtils.isEmpty(categoryNames[1])||StringUtils.isEmpty(categoryNames[2])){ - throw new Exception(orderRequest.getSeq() + "行,前三级类目不能为空,请参照系统填写"); + if(StringUtils.isEmpty(categoryNames[0])||StringUtils.isEmpty(categoryNames[1])||StringUtils.isEmpty(orderRequest.getLastCategory())){ + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",前三级类目不能为空,请参照系统填写"); } try { // 第一层 @@ -287,16 +308,22 @@ public class OrderMasterController extends BaseController { // 第四层 GoodsCategory param4 = new GoodsCategory(); param4.setParentCategoryId(category3.getGoodsCategoryId()); - param4.setGoodsCategoryName(categoryNames[3]); - GoodsCategory category4 = goodsCategoryService.selectGoodsCategoryList(param4).get(0); + param4.setGoodsCategoryName(orderRequest.getLastCategory()); + List categories = goodsCategoryService.selectGoodsCategoryList(param4); + if(CollectionUtils.isEmpty(categories)){ + param4.setGoodsCategoryName(null); + categories = goodsCategoryService.selectGoodsCategoryList(param4); + } + GoodsCategory category4 = categories.get(0); SysOrderGoodsStandards standards = new SysOrderGoodsStandards(); DeptGoodsCategory deptGoodsCategory2 = deptGoodsCategoryService.selectOneByGoodsCategoryId(category4.getGoodsCategoryId()); standards.setDeptCategoryId(deptGoodsCategory2.getDeptGoodsCategoryId()); standards.setGoodsStandardNum(Integer.parseInt(orderRequest.getNum())); + standards.setGoodsStandardName(orderRequest.getLastCategory()); goodsStandards.add(standards); }catch (Exception e){ - throw new Exception(orderRequest.getSeq() + "行,前三级类目有错误,请参照系统填写"); + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",前三级类目有错误,请参照系统填写"); } } @@ -306,10 +333,12 @@ public class OrderMasterController extends BaseController { addressName = orderRequest.getAddress().split(","); if(addressName.length == 1){ addressName = orderRequest.getAddress().split(" "); + }if(addressName.length == 1){ + addressName = orderRequest.getAddress().split("/"); } } if(addressName.length < 4){ - throw new Exception("导入地址数据格式错误"); + throw new Exception("导入表格序号" + orderRequest.getSeq() + ",地址数据格式错误"); }else { // 省 SysArea param1 = new SysArea(); @@ -406,7 +435,7 @@ public class OrderMasterController extends BaseController { request.getOrderGoodsStandards().forEach(list -> { DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(list.getDeptCategoryId()); GoodsStandard standard = new GoodsStandard(); - standard.setGoodsStandardName(deptGoodsCategory.getGoodsCategoryName()); + standard.setGoodsStandardName(list.getGoodsStandardName()); standard.setDeptGoodsCategoryId(deptGoodsCategory.getDeptGoodsCategoryId()); standard.setGoodsCategoryName(deptGoodsCategory.getGoodsCategoryName()); standard.setGoodsPrice(goodsPrice); @@ -1146,6 +1175,10 @@ public class OrderMasterController extends BaseController { // 填充商品三级类目 if(good.getDeptGoodsCategoryId() != null){ DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(good.getDeptGoodsCategoryId()); + if(deptGoodsCategory == null){ + deptGoodsCategory = new DeptGoodsCategory(); + deptGoodsCategory.setGoodsCategoryId(good.getDeptGoodsCategoryId()); + } if(deptGoodsCategory != null){ GoodsCategory one = goodsCategoryService.selectById(deptGoodsCategory.getGoodsCategoryId()); if(one != null && one.getParentCategoryId() != null){ diff --git a/ghy-admin/src/main/java/com/ghy/web/pojo/vo/SysOrderRequest.java b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/SysOrderRequest.java index 67343ee6..82a4a0e6 100644 --- a/ghy-admin/src/main/java/com/ghy/web/pojo/vo/SysOrderRequest.java +++ b/ghy-admin/src/main/java/com/ghy/web/pojo/vo/SysOrderRequest.java @@ -12,20 +12,26 @@ public class SysOrderRequest { @Excel(name = "category") private String category; + @Excel(name = "lastCategory") + private String lastCategory; + @Excel(name = "brand") private String brand; - @Excel(name = "num") - private String num; - @Excel(name = "date") private String date; @Excel(name = "time") private String time; - @Excel(name = "address") - private String address; + @Excel(name = "mode") + private String mode; + + @Excel(name = "num") + private String num; + + @Excel(name = "price") + private String price; @Excel(name = "name") private String name; @@ -33,11 +39,8 @@ public class SysOrderRequest { @Excel(name = "phone") private String phone; - @Excel(name = "mode") - private String mode; - - @Excel(name = "price") - private String price; + @Excel(name = "address") + private String address; @Excel(name = "remark") private String remark; @@ -48,6 +51,9 @@ public class SysOrderRequest { @Excel(name = "award") private String award; + @Excel(name = "infoMoney") + private String infoMoney; + @Excel(name = "url") private String url; diff --git a/ghy-admin/src/main/resources/application-druid.yml b/ghy-admin/src/main/resources/application-druid.yml index 4d732b21..ca1ad4d2 100644 --- a/ghy-admin/src/main/resources/application-druid.yml +++ b/ghy-admin/src/main/resources/application-druid.yml @@ -24,7 +24,7 @@ shiro: cipherKey: session: # Session超时时间,-1代表永不过期(默认30分钟) - expireTime: 30 + expireTime: 720 # 同步session到数据库的周期(默认1分钟) dbSyncPeriod: 1 # 相隔多久检查一次session的有效性,默认就是10分钟 diff --git a/ghy-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ghy-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 585e5b87..abc13b24 100644 --- a/ghy-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ghy-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -391,7 +391,7 @@ var table = { importTemplate: function() { $.get(activeWindow().table.options.importTemplateUrl, function(result) { if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + window.location.href = "http://gqz.opsoul.com/%E6%89%B9%E9%87%8F%E4%B8%8B%E5%8D%95%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xls"; } else if (result.code == web_status.WARNING) { $.modal.alertWarning(result.msg) } else { diff --git a/ghy-admin/src/main/resources/templates/order/master.html b/ghy-admin/src/main/resources/templates/order/master.html index 8c63a09d..23a62ad9 100644 --- a/ghy-admin/src/main/resources/templates/order/master.html +++ b/ghy-admin/src/main/resources/templates/order/master.html @@ -632,8 +632,9 @@ + '
' + ' ' + row.code + '
' + ' ' + row.consoleGoodsName+ '
' - + '' + row.addressName +' ' + row.addressName + '
' - + '' + row.address + '
' + + ' 联系人:' + row.addressName + '
' + + ' 联系电话:' + row.addressPhone + '
' + + ' 联系地址:' + row.address + '
' + ' 下单时间:' + row.createTime + '
' + ' 预约时间:' + row.mixExpectTime + '
' + ' 总金额:' + row.financialMasterMoney + '元 应得金额:' + row.financialDetailMoney + '元
' diff --git a/ghy-admin/src/main/resources/templates/order/orderManager.html b/ghy-admin/src/main/resources/templates/order/orderManager.html index 7cf913a6..077cccbb 100644 --- a/ghy-admin/src/main/resources/templates/order/orderManager.html +++ b/ghy-admin/src/main/resources/templates/order/orderManager.html @@ -313,8 +313,7 @@ shiro:hasPermission="order:order:export"> 导出 - + 导入 @@ -997,7 +996,7 @@ 提示:仅允许导入“xls”或“xlsx”格式文件! diff --git a/ghy-order/src/main/java/com/ghy/order/request/SysOrderGoodsStandards.java b/ghy-order/src/main/java/com/ghy/order/request/SysOrderGoodsStandards.java index 0065f07b..11e0bdcd 100644 --- a/ghy-order/src/main/java/com/ghy/order/request/SysOrderGoodsStandards.java +++ b/ghy-order/src/main/java/com/ghy/order/request/SysOrderGoodsStandards.java @@ -15,4 +15,6 @@ public class SysOrderGoodsStandards { private Integer goodsStandardNum; + private String goodsStandardName; + } diff --git a/ghy-order/src/main/java/com/ghy/order/service/OrderDetailService.java b/ghy-order/src/main/java/com/ghy/order/service/OrderDetailService.java index 1a6c04d1..f8705a92 100644 --- a/ghy-order/src/main/java/com/ghy/order/service/OrderDetailService.java +++ b/ghy-order/src/main/java/com/ghy/order/service/OrderDetailService.java @@ -64,7 +64,7 @@ public interface OrderDetailService { /** * 创建code */ - String createCode(); + String createCode(String orderMasterCode); /** * 根据订单id集合信息进行查询封装成为map数据, diff --git a/ghy-order/src/main/java/com/ghy/order/service/impl/OrderDetailServiceImpl.java b/ghy-order/src/main/java/com/ghy/order/service/impl/OrderDetailServiceImpl.java index 1823060e..10b209f4 100644 --- a/ghy-order/src/main/java/com/ghy/order/service/impl/OrderDetailServiceImpl.java +++ b/ghy-order/src/main/java/com/ghy/order/service/impl/OrderDetailServiceImpl.java @@ -225,11 +225,15 @@ public class OrderDetailServiceImpl implements OrderDetailService { } @Override - public synchronized String createCode() { - INDEX.compareAndSet(9999L, 1L); - LocalDateTime now = LocalDateTime.now(); - // 得到的CODE长度相同 - return "od" + now.format(MINI_FORMATTER) + String.format("%04d", INDEX.getAndIncrement()); + public synchronized String createCode(String orderMasterCode) { + OrderDetail param = new OrderDetail(); + param.setOrderMasterCode(orderMasterCode); + List details = orderDetailMapper.selectOrderDetailList(param); + int count = 0; + if(CollectionUtils.isNotEmpty(details)){ + count = details.size(); + } + return orderMasterCode + "-" + (count+1); } @Override