Ver código fonte

提交配置文件

yuhongqi 1 semana atrás
pai
commit
306229c140

+ 11 - 5
fs-admin/src/main/java/com/fs/store/controller/FsStoreHealthOrderController.java

@@ -17,13 +17,16 @@ import com.fs.store.param.FsStoreOrderParam;
 import com.fs.store.service.*;
 import com.fs.store.vo.FsStoreOrderExportVO;
 import com.fs.store.vo.FsStoreOrderItemExportVO;
+import com.fs.store.vo.FsStoreOrderPlainExportVO;
 import com.fs.store.vo.FsStoreOrderVO;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @RestController
@@ -98,20 +101,23 @@ public class FsStoreHealthOrderController extends BaseController {
         }
         param.setIsHealth("1");
         List<FsStoreOrderExportVO> list = fsStoreOrderService.selectFsStoreOrderListVOByExport(param);
+        List<FsStoreOrderPlainExportVO> exportList = new ArrayList<>();
         //对手机号脱敏
         if (list != null) {
             for (FsStoreOrderExportVO vo : list) {
+                FsStoreOrderPlainExportVO exportVo = new FsStoreOrderPlainExportVO();
+                BeanUtils.copyProperties(vo, exportVo);
                 if (vo.getPhone() != null) {
-                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                    exportVo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                 }
                 if (vo.getUserPhone() != null) {
-                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                    exportVo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                 }
-
+                exportList.add(exportVo);
             }
         }
-        ExcelUtil<FsStoreOrderExportVO> util = new ExcelUtil<FsStoreOrderExportVO>(FsStoreOrderExportVO.class);
-        return util.exportExcel(list, "订单数据");
+        ExcelUtil<FsStoreOrderPlainExportVO> util = new ExcelUtil<>(FsStoreOrderPlainExportVO.class);
+        return util.exportExcel(exportList, "订单数据");
     }
 
 

+ 9 - 5
fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderController.java

@@ -207,22 +207,26 @@ public class FsStoreOrderController extends BaseController {
         }
         param.setNotHealth(1);
         List<FsStoreOrderExportVO> list = fsStoreOrderService.selectFsStoreOrderListVOByExport(param);
+        List<FsStoreOrderPlainExportVO> exportList = new ArrayList<>();
         //对手机号脱敏
         if (list != null) {
             for (FsStoreOrderExportVO vo : list) {
+                FsStoreOrderPlainExportVO exportVo = new FsStoreOrderPlainExportVO();
+                org.springframework.beans.BeanUtils.copyProperties(vo, exportVo);
                 if (vo.getPhone() != null) {
-                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                    exportVo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                 }
                 if (vo.getUserPhone() != null) {
-                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                    exportVo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                 }
                 if (vo.getUserAddress()!=null){
-                    vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
+                    exportVo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
                 }
+                exportList.add(exportVo);
             }
         }
-        ExcelUtil<FsStoreOrderExportVO> util = new ExcelUtil<FsStoreOrderExportVO>(FsStoreOrderExportVO.class);
-        return util.exportExcel(list, "订单数据");
+        ExcelUtil<FsStoreOrderPlainExportVO> util = new ExcelUtil<>(FsStoreOrderPlainExportVO.class);
+        return util.exportExcel(exportList, "订单数据");
     }
 
 

+ 53 - 32
fs-service-system/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java

@@ -9,6 +9,10 @@ import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.stream.Collectors;
@@ -61,8 +65,10 @@ import com.fs.live.param.LiveOrderFinishParam;
 import com.fs.live.service.*;
 import com.fs.live.vo.*;
 import com.fs.store.cache.IFsExpressCacheService;
+import com.fs.store.enums.OrderInfoEnum;
 import com.fs.store.cache.IFsStoreProductAttrValueCacheService;
 import com.fs.store.cache.impl.IFsStoreProductCacheServiceImpl;
+import com.fs.store.config.StoreConfig;
 import com.fs.store.domain.*;
 import com.fs.store.dto.*;
 import com.fs.store.enums.*;
@@ -1858,7 +1864,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
             Long attrValueId = param.getAttrValueId();
             String attrValueCacheKey = String.format("product:attr:value:id:%s", attrValueId);
             String attrValueCacheJson = stringRedisTemplate.opsForValue().get(attrValueCacheKey);
-            
+
             if (StringUtils.isNotEmpty(attrValueCacheJson)) {
                 try {
                     // 缓存命中,解析 JSON 字符串
@@ -1870,11 +1876,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                     attrValueCacheJson = null;
                 }
             }
-            
+
             if (fsStoreProductAttrValueForDelivery == null) {
                 // 缓存未命中或解析失败,查询数据库
                 fsStoreProductAttrValueForDelivery = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueById(attrValueId);
-                
+
                 // 将结果存入缓存,设置过期时间为12小时
                 if (fsStoreProductAttrValueForDelivery != null) {
                     String jsonStr = JSON.toJSONString(fsStoreProductAttrValueForDelivery);
@@ -1882,7 +1888,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                 }
             }
         }
-        
+
         if (param.getCityId() != null) {
 //            payDelivery = handleDeliveryMoney(param.getCityId(), fsStoreProduct, param.getTotalNum(), fsStoreProductAttrValueForDelivery);
             totalPrice = totalPrice.add(payDelivery);
@@ -1912,7 +1918,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
             Long attrValueId = param.getAttrValueId();
             String attrValueCacheKey = String.format("product:attr:value:id:%s", attrValueId);
             String attrValueCacheJson = stringRedisTemplate.opsForValue().get(attrValueCacheKey);
-            
+
             if (StringUtils.isNotEmpty(attrValueCacheJson)) {
                 try {
                     // 缓存命中,解析 JSON 字符串
@@ -1924,11 +1930,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                     attrValueCacheJson = null;
                 }
             }
-            
+
             if (fsStoreProductAttrValue == null) {
                 // 缓存未命中或解析失败,查询数据库
                 fsStoreProductAttrValue = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueById(attrValueId);
-                
+
                 // 将结果存入缓存,设置过期时间为12小时
                 if (fsStoreProductAttrValue != null) {
                     String jsonStr = JSON.toJSONString(fsStoreProductAttrValue);
@@ -2178,11 +2184,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
     public static class ShippingTemplateCacheData {
         private Map<Long, Integer> shippingTemplatesMap;
         private Map<Long, FsShippingTemplatesRegion> shippingTemplatesRegionMap;
-        
+
         public ShippingTemplateCacheData() {
         }
-        
-        public ShippingTemplateCacheData(Map<Long, Integer> shippingTemplatesMap, 
+
+        public ShippingTemplateCacheData(Map<Long, Integer> shippingTemplatesMap,
                                         Map<Long, FsShippingTemplatesRegion> shippingTemplatesRegionMap) {
             this.shippingTemplatesMap = shippingTemplatesMap;
             this.shippingTemplatesRegionMap = shippingTemplatesRegionMap;
@@ -2200,15 +2206,15 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         // 优化:直接字符串拼接,避免创建List和Stream中间对象
         String ids = String.valueOf(fsStoreProduct.getTempId());
         String cityIds = cityId + ",0";
-        
+
         // 构建缓存 key:基于 tempId 和 cityIds
         String cacheKey = String.format("shipping:template:%s:city:%s", ids, cityIds);
-        
+
         // 先查缓存(使用 JSON 字符串存储,避免 FastJSON autoType 问题)
         String cacheJson = stringRedisTemplate.opsForValue().get(cacheKey);
         Map<Long, Integer> shippingTemplatesMap = null;
         Map<Long, FsShippingTemplatesRegion> shippingTemplatesRegionMap = null;
-        
+
         if (StringUtils.isNotEmpty(cacheJson)) {
             try {
                 // 缓存命中,解析 JSON 字符串
@@ -2224,25 +2230,25 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                 cacheJson = null;
             }
         }
-        
+
         if (shippingTemplatesMap == null || shippingTemplatesRegionMap == null) {
             // 缓存未命中或解析失败,查询数据库并计算
             List<FsShippingTemplates> shippingTemplatesList = shippingTemplatesService.selectFsShippingTemplatesByIds(ids);
             List<FsShippingTemplatesRegion> shippingTemplatesRegionList = shippingTemplatesRegionService.selectFsShippingTemplatesRegionListByTempIdsAndCityIds(ids, cityIds);
-            
+
             // 优化:使用传统for循环替代Stream操作,减少对象创建
             shippingTemplatesMap = new HashMap<>(shippingTemplatesList.size());
             for (FsShippingTemplates template : shippingTemplatesList) {
                 shippingTemplatesMap.put(template.getId(), template.getType());
             }
-            
+
             // 优化:使用传统for循环替代Stream操作,减少对象创建
             shippingTemplatesRegionMap = new HashMap<>(shippingTemplatesRegionList.size());
             for (FsShippingTemplatesRegion region : shippingTemplatesRegionList) {
                 // 相同tempId时,后面的值覆盖前面的值
                 shippingTemplatesRegionMap.put(region.getTempId(), region);
             }
-            
+
             // 将计算结果放入缓存(使用 JSON 字符串存储),设置过期时间为12小时
             ShippingTemplateCacheData cacheData = new ShippingTemplateCacheData(shippingTemplatesMap, shippingTemplatesRegionMap);
             String jsonStr = JSON.toJSONString(cacheData);
@@ -2251,17 +2257,17 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         Long tempId = Long.valueOf(fsStoreProduct.getTempId());
         double num = 0d;
         Integer templateType = shippingTemplatesMap.get(tempId);
-        
+
         // 如果传入的 fsStoreProductAttrValue 不为空,直接使用;如果为空,查询数据库
         FsStoreProductAttrValue productAttrValue = fsStoreProductAttrValue;
-        
+
         if (productAttrValue == null) {
             // 查询商品属性值,使用缓存
             Long productId = fsStoreProduct.getProductId();
             String productAttrCacheKey = String.format("product:attr:value:productId:%s", productId);
             String productAttrCacheJson = stringRedisTemplate.opsForValue().get(productAttrCacheKey);
             List<FsStoreProductAttrValue> productAttrValues = null;
-            
+
             if (StringUtils.isNotEmpty(productAttrCacheJson)) {
                 try {
                     // 缓存命中,解析 JSON 字符串
@@ -2273,11 +2279,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                     productAttrCacheJson = null;
                 }
             }
-            
+
             if (productAttrValues == null) {
                 // 缓存未命中或解析失败,查询数据库
                 productAttrValues = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueByProductId(productId);
-                
+
                 // 将结果存入缓存(包括空 list),设置过期时间为12小时
                 if (productAttrValues == null) {
                     productAttrValues = new ArrayList<>(); // 确保不为 null,空数据也缓存空 list
@@ -2285,11 +2291,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                 String jsonStr = JSON.toJSONString(productAttrValues);
                 stringRedisTemplate.opsForValue().set(productAttrCacheKey, jsonStr, 12, TimeUnit.HOURS);
             }
-            
+
             if (productAttrValues.isEmpty()) {
                 return storePostage;
             }
-            
+
             productAttrValue = productAttrValues.get(0);
         }
         Integer totalNum = Integer.valueOf(totalNumSize);
@@ -3260,21 +3266,28 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         }
 
         LiveUserFirstEntry liveUserFirstEntry = liveUserFirstEntryService.selectEntityByLiveIdUserId(liveOrder.getLiveId(), Long.parseLong(liveOrder.getUserId()));
-        liveOrder.setCompanyId(liveUserFirstEntry.getCompanyId());
-        liveOrder.setCompanyUserId(liveUserFirstEntry.getCompanyUserId());
-        liveOrder.setTuiUserId(liveUserFirstEntry.getCompanyUserId());
+        Long companyId = liveUserFirstEntry.getCompanyId();
+        Long companyUserId = liveUserFirstEntry.getCompanyUserId();
+        if (companyId != null && companyId == -1L && companyUserId != null && companyUserId == -1L) {
+            StoreConfig storeConfig = loadStoreConfig();
+            companyId = storeConfig.getDefaultLiveCompanyId() != null ? storeConfig.getDefaultLiveCompanyId() : 309L;
+            companyUserId = storeConfig.getDefaultLiveCompanyUserId() != null ? storeConfig.getDefaultLiveCompanyUserId() : 8647L;
+        }
+        liveOrder.setCompanyId(companyId);
+        liveOrder.setCompanyUserId(companyUserId);
+        liveOrder.setTuiUserId(companyUserId);
 
         String orderSn = SnowflakeUtils.nextId();
         log.info("订单生成:" + orderSn);
         liveOrder.setOrderCode(orderSn);
-        
+
         // 查询商品属性值,使用缓存
         FsStoreProductAttrValue fsStoreProductAttrValue = null;
         if (!Objects.isNull(liveOrder.getAttrValueId())) {
             Long attrValueId = liveOrder.getAttrValueId();
             String attrValueCacheKey = String.format("product:attr:value:id:%s", attrValueId);
             String attrValueCacheJson = stringRedisTemplate.opsForValue().get(attrValueCacheKey);
-            
+
             if (StringUtils.isNotEmpty(attrValueCacheJson)) {
                 try {
                     // 缓存命中,解析 JSON 字符串
@@ -3286,11 +3299,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                     attrValueCacheJson = null;
                 }
             }
-            
+
             if (fsStoreProductAttrValue == null) {
                 // 缓存未命中或解析失败,查询数据库
                 fsStoreProductAttrValue = fsStoreProductAttrValueMapper.selectFsStoreProductAttrValueById(attrValueId);
-                
+
                 // 将结果存入缓存,设置过期时间为12小时
                 if (fsStoreProductAttrValue != null) {
                     String jsonStr = JSON.toJSONString(fsStoreProductAttrValue);
@@ -3298,7 +3311,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
                 }
             }
         }
-        
+
         // 计算价格(仿照 FsStoreOrderServiceImpl):
         // totalPrice = 商品总价(不含邮费)
         // payPostage = 应付邮费
@@ -3586,4 +3599,12 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
     public void handleOrderStatus(LiveOrder liveOrder) {
 
     }
+
+    private StoreConfig loadStoreConfig() {
+        String configJson = configService.selectConfigByKey("store.config");
+        if (StringUtils.isEmpty(configJson)) {
+            return new StoreConfig();
+        }
+        return JSONUtil.toBean(configJson, StoreConfig.class);
+    }
 }

+ 4 - 0
fs-service-system/src/main/java/com/fs/store/config/StoreConfig.java

@@ -17,6 +17,10 @@ public class StoreConfig implements Serializable {
     private Integer tuiMoneyRate;//公司佣金比例 支付金额-(订单金额*rate%)
     private Integer createMoneyRate;//公司制单金额最低比例
     private Integer storeAfterSalesDay;//已完成订单售后有效天数
+    /** 直播订单默认销售公司ID(用户首次进入记录为-1时使用) */
+    private Long defaultLiveCompanyId;
+    /** 直播订单默认销售员ID(用户首次进入记录为-1时使用) */
+    private Long defaultLiveCompanyUserId;
     private String refundConsignee;
     private String videoUrl;
     private String refundPhoneNumber;

+ 155 - 0
fs-service-system/src/main/java/com/fs/store/vo/FsStoreOrderPlainExportVO.java

@@ -0,0 +1,155 @@
+package com.fs.store.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 商城/健康商城订单导出(不含院端用户、部门、销售字段)
+ */
+@Data
+public class FsStoreOrderPlainExportVO implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    @Excel(name = "订单号")
+    private String orderCode;
+    @Excel(name = "会员ID")
+    private Long userId;
+
+    @Excel(name = "管易云订单号")
+    private String extendOrderId;
+
+    @Excel(name = "所属公司")
+    private String companyName;
+    @Excel(name = "所属销售")
+    private String companyUserNickName;
+
+    @Excel(name = "推线编号")
+    private String pushCode;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "客户创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date customerCreateTime;
+
+    @Excel(name = "客户来源",dictType = "crm_customer_source")
+    private String source;
+
+    @Excel(name = "成单类型", dictType = "store_order_type")
+    private String orderType;
+    @Excel(name = "套餐包分类", dictType = "store_product_package_cate")
+    private String cateId;
+
+    @Excel(name = "收货人姓名")
+    private String realName;
+
+    @Excel(name = "收货人电话")
+    private String userPhone;
+
+    @Excel(name = "详细地址")
+    private String userAddress;
+
+    @Excel(name = "商品金额",cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal totalPrice;
+
+    @Excel(name = "应付金额",cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal payPrice;
+
+    @Excel(name = "实付金额",cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal payMoney;
+
+    @Excel(name = "物流代收金额",cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal payDelivery;
+
+    @Excel(name = "支付邮费", cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal payPostage;
+
+    @Excel(name = "抵扣金额",cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal deductionPrice;
+
+    @Excel(name = "优惠券金额",cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal couponPrice;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "下单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date payTime;
+
+    @Excel(name = "支付方式")
+    private String payType;
+
+    @Excel(name = "订单状态", dictType = "store_order_status")
+    private String status;
+
+    @Excel(name = "交易单号")
+    private String bankTrxId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "退款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date refundReasonTime;
+
+    @Excel(name = "退款金额",cellType= Excel.ColumnType.NUMERIC)
+    private BigDecimal refundPrice;
+
+    @Excel(name = "快递公司编号")
+    private String deliverySn;
+
+    @Excel(name = "快递公司")
+    private String deliveryName;
+
+    private String deliveryId;
+
+    @Excel(name = "快递单号")
+    private String deliverCode;
+
+    @Excel(name = "备注")
+    private String mark;
+
+    private String phone;
+
+    @Excel(name = "物流代收结算状态", dictType = "store_delivery_pay_status")
+    private Integer deliveryPayStatus;
+
+    @Excel(name = "快递帐单日期")
+    private String deliveryTime;
+
+    @Excel(name = "快递结算日期")
+    private String deliveryPayTime;
+
+    @Excel(name = "物流结算费用")
+    private BigDecimal deliveryPayMoney;
+
+    private String deliveryStatus;
+
+    private String deliveryType;
+    @Excel(name = "物流跟踪状态" , dictType = "store_order_delivery_type")
+    private String deliveryTypeCode;
+
+    @Excel(name = "物流状态" , dictType = "store_order_delivery_status")
+    private String kdnDeliveryStatus;
+
+    @Excel(name = "客户编码")
+    private String customerCode;
+
+    @Excel(name = "套餐名称",width = 60)
+    private String packageTitle;
+
+    @Excel(name = "是否上传凭证 0:未上传 1:已上传")
+    private Integer isUpload;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date uploadTime;
+
+    @Excel(name = "归属档期")
+    private String scheduleName;
+}