导入问题,子单号问题

This commit is contained in:
kuang.yife 2024-01-31 23:32:54 +08:00
parent 6f2c5f534d
commit 0a4264c9ac
11 changed files with 95 additions and 46 deletions

View File

@ -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());

View File

@ -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){

View File

@ -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<SysOrderRequest> util = new ExcelUtil<SysOrderRequest>(SysOrderRequest.class);
List<SysOrderRequest> 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<SysOrderGoodsStandards> 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<GoodsCategory> 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){

View File

@ -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;

View File

@ -24,7 +24,7 @@ shiro:
cipherKey:
session:
# Session超时时间-1代表永不过期默认30分钟
expireTime: 30
expireTime: 720
# 同步session到数据库的周期默认1分钟
dbSyncPeriod: 1
# 相隔多久检查一次session的有效性默认就是10分钟

View File

@ -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 {

View File

@ -632,8 +632,9 @@
+ '<div>'
+ '<small> ' + row.code + '<small/> <br>'
+ '<small> ' + row.consoleGoodsName+ '<small/> <br>'
+ '<small>' + row.addressName +' ' + row.addressName + '</small> <br>'
+ '<small>' + row.address + '</small> <br>'
+ '<small> 联系人:' + row.addressName + '</small> <br>'
+ '<small> 联系电话:' + row.addressPhone + '</small> <br>'
+ '<small> 联系地址:' + row.address + '</small> <br>'
+ '<small> 下单时间:' + row.createTime + '</small> <br>'
+ '<small> 预约时间:' + row.mixExpectTime + '</small> <br>'
+ '<small> 总金额:' + row.financialMasterMoney + '元 应得金额:' + row.financialDetailMoney + '元</small> <br>'

View File

@ -313,8 +313,7 @@
shiro:hasPermission="order:order:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-warning" onclick="$.table.importExcel()"
shiro:hasPermission="order:order:import">
<a class="btn btn-warning" onclick="$.table.importExcel()">
<i class="fa fa-download"></i> 导入
</a>
<a class="btn btn-default" onclick="mergePay()">
@ -997,7 +996,7 @@
<input type="file" id="file" name="file"/>
<div class="mt10 pt5">
<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
&nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
&nbsp; <a 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" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
</div>
<font color="red" class="pull-left mt10">
提示仅允许导入“xls”或“xlsx”格式文件

View File

@ -15,4 +15,6 @@ public class SysOrderGoodsStandards {
private Integer goodsStandardNum;
private String goodsStandardName;
}

View File

@ -64,7 +64,7 @@ public interface OrderDetailService {
/**
* 创建code
*/
String createCode();
String createCode(String orderMasterCode);
/**
* 根据订单id集合信息进行查询封装成为map数据

View File

@ -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<OrderDetail> details = orderDetailMapper.selectOrderDetailList(param);
int count = 0;
if(CollectionUtils.isNotEmpty(details)){
count = details.size();
}
return orderMasterCode + "-" + (count+1);
}
@Override