|  | @@ -0,0 +1,644 @@
 | 
	
		
			
				|  |  | +package com.fs.hisStore;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import cn.hutool.core.bean.BeanUtil;
 | 
	
		
			
				|  |  | +import cn.hutool.core.util.StrUtil;
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | +import com.fs.common.annotation.Log;
 | 
	
		
			
				|  |  | +import com.fs.common.core.controller.BaseController;
 | 
	
		
			
				|  |  | +import com.fs.common.core.domain.AjaxResult;
 | 
	
		
			
				|  |  | +import com.fs.common.core.domain.R;
 | 
	
		
			
				|  |  | +import com.fs.common.core.page.TableDataInfo;
 | 
	
		
			
				|  |  | +import com.fs.common.enums.BusinessType;
 | 
	
		
			
				|  |  | +import com.fs.common.utils.ParseUtils;
 | 
	
		
			
				|  |  | +import com.fs.common.utils.StringUtils;
 | 
	
		
			
				|  |  | +import com.fs.common.utils.poi.ExcelUtil;
 | 
	
		
			
				|  |  | +import com.fs.company.param.CompanyStoreOrderMoneyLogsListParam;
 | 
	
		
			
				|  |  | +import com.fs.company.service.ICompanyMoneyLogsService;
 | 
	
		
			
				|  |  | +import com.fs.company.vo.CompanyStoreOrderMoneyLogsVO;
 | 
	
		
			
				|  |  | +import com.fs.erp.domain.ErpDeliverys;
 | 
	
		
			
				|  |  | +import com.fs.erp.domain.ErpOrderQuery;
 | 
	
		
			
				|  |  | +import com.fs.erp.dto.ErpOrderQueryRequert;
 | 
	
		
			
				|  |  | +import com.fs.erp.dto.ErpOrderQueryResponse;
 | 
	
		
			
				|  |  | +import com.fs.erp.service.IErpOrderService;
 | 
	
		
			
				|  |  | +import com.fs.his.domain.FsUser;
 | 
	
		
			
				|  |  | +import com.fs.his.service.IFsExpressService;
 | 
	
		
			
				|  |  | +import com.fs.his.service.IFsUserService;
 | 
	
		
			
				|  |  | +import com.fs.his.utils.ConfigUtil;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.config.FsErpConfig;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.domain.FsStoreOrderItemScrm;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.domain.FsStoreOrderScrm;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.domain.FsStoreOrderStatusScrm;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.domain.FsStorePaymentScrm;
 | 
	
		
			
				|  |  | +import com.fs.his.dto.ExpressInfoDTO;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.dto.StoreOrderExpressExportDTO;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.dto.StoreOrderProductDTO;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.enums.ShipperCodeEnum;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.param.*;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.service.*;
 | 
	
		
			
				|  |  | +import com.fs.hisStore.vo.*;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | +import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Qualifier;
 | 
	
		
			
				|  |  | +import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  | +import org.springframework.validation.annotation.Validated;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | +import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +import java.util.Collections;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * 订单Controller
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * @author fs
 | 
	
		
			
				|  |  | + * @date 2022-03-15
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +@RestController
 | 
	
		
			
				|  |  | +@RequestMapping("/store/store/storeOrder")
 | 
	
		
			
				|  |  | +public class FsStoreOrderScrmController extends BaseController {
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IFsExpressService expressService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IFsStoreOrderScrmService fsStoreOrderService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IFsStoreOrderItemScrmService orderItemService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IFsUserService userService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IFsStoreOrderStatusScrmService orderStatusService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    IFsStorePaymentScrmService paymentService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ICompanyMoneyLogsService moneyLogsService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    @Qualifier("erpOrderServiceImpl")
 | 
	
		
			
				|  |  | +    private IErpOrderService gyOrderService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    @Qualifier("wdtErpOrderServiceImpl")
 | 
	
		
			
				|  |  | +    private IErpOrderService wdtOrderService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    @Qualifier("k9OrderScrmServiceImpl")
 | 
	
		
			
				|  |  | +    private IErpOrderService k9OrderService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ConfigUtil configUtil;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IFsStoreOrderAuditLogScrmService orderAuditLogService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private IErpOrderService getErpService(){
 | 
	
		
			
				|  |  | +        //判断是否开启erp
 | 
	
		
			
				|  |  | +        IErpOrderService erpOrderService = null;
 | 
	
		
			
				|  |  | +        FsErpConfig erpConfig = configUtil.getErpConfig();
 | 
	
		
			
				|  |  | +        Integer erpOpen = erpConfig.getErpOpen();
 | 
	
		
			
				|  |  | +        if (erpOpen != null && erpOpen == 1) {
 | 
	
		
			
				|  |  | +            //判断erp类型
 | 
	
		
			
				|  |  | +            Integer erpType = erpConfig.getErpType();
 | 
	
		
			
				|  |  | +            if (erpType != null) {
 | 
	
		
			
				|  |  | +                if (erpType == 1) {
 | 
	
		
			
				|  |  | +                    //管易
 | 
	
		
			
				|  |  | +                    erpOrderService = gyOrderService;
 | 
	
		
			
				|  |  | +                } else if (erpType == 2) {
 | 
	
		
			
				|  |  | +                    //旺店通
 | 
	
		
			
				|  |  | +                    erpOrderService = wdtOrderService;
 | 
	
		
			
				|  |  | +                } else if (erpType == 3) {
 | 
	
		
			
				|  |  | +                    //旺店通
 | 
	
		
			
				|  |  | +                    erpOrderService = k9OrderService;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return erpOrderService;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查询订单列表
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:list')")
 | 
	
		
			
				|  |  | +    @GetMapping("/list")
 | 
	
		
			
				|  |  | +    public TableDataInfo list(FsStoreOrderParam param) {
 | 
	
		
			
				|  |  | +        startPage();
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
 | 
	
		
			
				|  |  | +            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getPayTimeRange())){
 | 
	
		
			
				|  |  | +            param.setPayTimeList(param.getPayTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliverySendTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliverySendTimeList(param.getDeliverySendTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        param.setNotHealth(1);
 | 
	
		
			
				|  |  | +        List<FsStoreOrderVO> list = fsStoreOrderService.selectFsStoreOrderListVO(param);
 | 
	
		
			
				|  |  | +        if (list != null) {
 | 
	
		
			
				|  |  | +            for (FsStoreOrderVO vo : list) {
 | 
	
		
			
				|  |  | +                if(vo.getPhone()!=null){
 | 
	
		
			
				|  |  | +                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
 | 
	
		
			
				|  |  | +                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return getDataTable(list);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:payRemainList')")
 | 
	
		
			
				|  |  | +    @GetMapping("/payRemainList")
 | 
	
		
			
				|  |  | +    public TableDataInfo payRemainList(FsStoreOrderParam param) {
 | 
	
		
			
				|  |  | +        startPage();
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
 | 
	
		
			
				|  |  | +            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getPayTimeRange())){
 | 
	
		
			
				|  |  | +            param.setPayTimeList(param.getPayTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<FsStoreOrderVO> list = fsStoreOrderService.selectPayRemainListVO(param);
 | 
	
		
			
				|  |  | +        if (list != null) {
 | 
	
		
			
				|  |  | +            for (FsStoreOrderVO vo : list) {
 | 
	
		
			
				|  |  | +                if(vo.getPhone()!=null){
 | 
	
		
			
				|  |  | +                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
 | 
	
		
			
				|  |  | +                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return getDataTable(list);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 导出付尾款订单列表
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Log(title = "付尾款订单", businessType = BusinessType.EXPORT)
 | 
	
		
			
				|  |  | +    @GetMapping("/payRemainExport")
 | 
	
		
			
				|  |  | +    public AjaxResult payRemainExport(FsStoreOrderParam param) {
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
 | 
	
		
			
				|  |  | +            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getPayTimeRange())){
 | 
	
		
			
				|  |  | +            param.setPayTimeList(param.getPayTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<FsStorePayRemainOrderExportVO> list = fsStoreOrderService.selectFsStorePayRemainOrderListVOByExport(param);
 | 
	
		
			
				|  |  | +        //对手机号脱敏
 | 
	
		
			
				|  |  | +        if (list != null) {
 | 
	
		
			
				|  |  | +            for (FsStorePayRemainOrderExportVO vo : list) {
 | 
	
		
			
				|  |  | +                if (vo.getPhone() != null) {
 | 
	
		
			
				|  |  | +                    vo.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"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (vo.getUserAddress()!=null){
 | 
	
		
			
				|  |  | +                    vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        ExcelUtil<FsStorePayRemainOrderExportVO> util = new ExcelUtil<FsStorePayRemainOrderExportVO>(FsStorePayRemainOrderExportVO.class);
 | 
	
		
			
				|  |  | +        return util.exportExcel(list, "付尾款订单数据");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 导出订单列表
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:export')")
 | 
	
		
			
				|  |  | +    @Log(title = "订单", businessType = BusinessType.EXPORT)
 | 
	
		
			
				|  |  | +    @GetMapping("/export")
 | 
	
		
			
				|  |  | +    public AjaxResult export(FsStoreOrderParam param) {
 | 
	
		
			
				|  |  | +        if (param.getBeginTime().equals("") && param.getEndTime().equals("")){
 | 
	
		
			
				|  |  | +            param.setBeginTime(null);
 | 
	
		
			
				|  |  | +            param.setEndTime(null);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (fsStoreOrderService.isEntityNull(param)){
 | 
	
		
			
				|  |  | +            return AjaxResult.error("请筛选数据导出");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
 | 
	
		
			
				|  |  | +            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getPayTimeRange())){
 | 
	
		
			
				|  |  | +            param.setPayTimeList(param.getPayTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliverySendTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliverySendTimeList(param.getDeliverySendTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        param.setNotHealth(1);
 | 
	
		
			
				|  |  | +        List<FsStoreOrderExportVO> list = fsStoreOrderService.selectFsStoreOrderListVOByExport(param);
 | 
	
		
			
				|  |  | +        //对手机号脱敏
 | 
	
		
			
				|  |  | +        if (list != null) {
 | 
	
		
			
				|  |  | +            for (FsStoreOrderExportVO vo : list) {
 | 
	
		
			
				|  |  | +                if (vo.getPhone() != null) {
 | 
	
		
			
				|  |  | +                    vo.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"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (vo.getUserAddress()!=null){
 | 
	
		
			
				|  |  | +                    vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        ExcelUtil<FsStoreOrderExportVO> util = new ExcelUtil<FsStoreOrderExportVO>(FsStoreOrderExportVO.class);
 | 
	
		
			
				|  |  | +        return util.exportExcel(list, "订单数据");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:exportItems')")
 | 
	
		
			
				|  |  | +    @Log(title = "订单明细导出", businessType = BusinessType.EXPORT)
 | 
	
		
			
				|  |  | +    @GetMapping("/exportItems")
 | 
	
		
			
				|  |  | +    public AjaxResult exportItems(FsStoreOrderParam param) {
 | 
	
		
			
				|  |  | +        if (param.getBeginTime().equals("") && param.getEndTime().equals("")){
 | 
	
		
			
				|  |  | +            param.setBeginTime(null);
 | 
	
		
			
				|  |  | +            param.setEndTime(null);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (fsStoreOrderService.isEntityNull(param)){
 | 
	
		
			
				|  |  | +            return AjaxResult.error("请筛选数据导出");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
 | 
	
		
			
				|  |  | +            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getPayTimeRange())){
 | 
	
		
			
				|  |  | +            param.setPayTimeList(param.getPayTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliverySendTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliverySendTimeList(param.getDeliverySendTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        param.setNotHealth(1);
 | 
	
		
			
				|  |  | +        List<FsStoreOrderItemExportVO> list = orderItemService.selectFsStoreOrderItemListExportVO(param);
 | 
	
		
			
				|  |  | +        //对手机号脱敏
 | 
	
		
			
				|  |  | +        if (list != null) {
 | 
	
		
			
				|  |  | +            for (FsStoreOrderItemExportVO vo : list) {
 | 
	
		
			
				|  |  | +                if (vo.getUserPhone() != null) {
 | 
	
		
			
				|  |  | +                    String phone = vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2");
 | 
	
		
			
				|  |  | +                    vo.setUserPhone(phone);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (vo.getUserAddress()!=null){
 | 
	
		
			
				|  |  | +                    vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (!StringUtils.isEmpty(vo.getJsonInfo())) {
 | 
	
		
			
				|  |  | +                    try {
 | 
	
		
			
				|  |  | +                        StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
 | 
	
		
			
				|  |  | +                        BeanUtil.copyProperties(orderProductDTO, vo);
 | 
	
		
			
				|  |  | +                    } catch (Exception e) {
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        ExcelUtil<FsStoreOrderItemExportVO> util = new ExcelUtil<FsStoreOrderItemExportVO>(FsStoreOrderItemExportVO.class);
 | 
	
		
			
				|  |  | +        return util.exportExcel(list, "订单明细数据");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping("/orderItemsNum")
 | 
	
		
			
				|  |  | +    public R orderItemsNum(FsStoreOrderParam param) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getCreateTimeRange())){
 | 
	
		
			
				|  |  | +            param.setCreateTimeList(param.getCreateTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getPayTimeRange())){
 | 
	
		
			
				|  |  | +            param.setPayTimeList(param.getPayTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliveryImportTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliveryImportTimeList(param.getDeliveryImportTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(!StringUtils.isEmpty(param.getDeliverySendTimeRange())){
 | 
	
		
			
				|  |  | +            param.setDeliverySendTimeList(param.getDeliverySendTimeRange().split("--"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        param.setNotHealth(1);
 | 
	
		
			
				|  |  | +        Long orderItemsNum = orderItemService.countFsStoreOrderItemListExportVO(param);
 | 
	
		
			
				|  |  | +        return R.ok().put("orderItemsNum","订单明细数目:"+orderItemsNum);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取订单详细信息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:query')")
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/{id}")
 | 
	
		
			
				|  |  | +    public R getInfo(@PathVariable("id") Long id) {
 | 
	
		
			
				|  |  | +        FsStoreOrderScrm order = fsStoreOrderService.selectFsStoreOrderById(id);
 | 
	
		
			
				|  |  | +        order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
 | 
	
		
			
				|  |  | +        order.setUserAddress(ParseUtils.parseAddress(order.getUserAddress()));
 | 
	
		
			
				|  |  | +        FsUser user = userService.selectFsUserById(order.getUserId());
 | 
	
		
			
				|  |  | +        if (user != null) {
 | 
	
		
			
				|  |  | +            user.setPhone(ParseUtils.parsePhone(user.getPhone()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        FsStoreOrderItemScrm itemMap = new FsStoreOrderItemScrm();
 | 
	
		
			
				|  |  | +        itemMap.setOrderId(order.getId());
 | 
	
		
			
				|  |  | +        List<FsStoreOrderItemScrm> items = orderItemService.selectFsStoreOrderItemList(itemMap);
 | 
	
		
			
				|  |  | +        FsStoreOrderStatusScrm statusMap = new FsStoreOrderStatusScrm();
 | 
	
		
			
				|  |  | +        statusMap.setOrderId(order.getId());
 | 
	
		
			
				|  |  | +        List<FsStoreOrderStatusScrm> logs = orderStatusService.selectFsStoreOrderStatusList(statusMap);
 | 
	
		
			
				|  |  | +        List<FsStorePaymentScrm> payments=paymentService.selectFsStorePaymentByOrderId(order.getId());
 | 
	
		
			
				|  |  | +        List<CompanyStoreOrderMoneyLogsVO> tuiMoneyLogs=new ArrayList<>();
 | 
	
		
			
				|  |  | +        if(order.getCompanyId()!=null){
 | 
	
		
			
				|  |  | +            CompanyStoreOrderMoneyLogsListParam moneyLogsMap=new CompanyStoreOrderMoneyLogsListParam();
 | 
	
		
			
				|  |  | +            moneyLogsMap.setCompanyId(order.getCompanyId());
 | 
	
		
			
				|  |  | +            moneyLogsMap.setBusinessId(order.getId().toString());
 | 
	
		
			
				|  |  | +            tuiMoneyLogs=moneyLogsService.selectCompanyStoreOrderMoneyLogsList(moneyLogsMap);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<FsStoreOrderAuditLogVO> auditLogs = orderAuditLogService.selectStoreOrderAuditLogVOByOrderId(order.getId());
 | 
	
		
			
				|  |  | +        return R.ok().put("order", order).put("items", items).put("logs", logs).put("user", user).put("payments",payments).put("tuiMoneyLogs",tuiMoneyLogs)
 | 
	
		
			
				|  |  | +                .put("auditLogs",auditLogs);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/queryAddress/{id}")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:queryAddress')")
 | 
	
		
			
				|  |  | +    public R getAddress(@PathVariable("id") Long id)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        FsStoreOrderScrm order = fsStoreOrderService.selectFsStoreOrderById(id);
 | 
	
		
			
				|  |  | +        String address = order.getUserAddress();
 | 
	
		
			
				|  |  | +        return R.ok().put("address",address);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/queryPhone/{id}")
 | 
	
		
			
				|  |  | +    @Log(title = "查看电话", businessType = BusinessType.GRANT)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:queryPhone')")
 | 
	
		
			
				|  |  | +    public R getPhone(@PathVariable("id") Long id)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        FsStoreOrderScrm order = fsStoreOrderService.selectFsStoreOrderById(id);
 | 
	
		
			
				|  |  | +        String userPhone = order.getUserPhone();
 | 
	
		
			
				|  |  | +        return R.ok().put("userPhone",userPhone);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:express')")
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/getExpress/{id}")
 | 
	
		
			
				|  |  | +    public R getExpress(@PathVariable("id") Long id) {
 | 
	
		
			
				|  |  | +        FsStoreOrderScrm order = fsStoreOrderService.selectFsStoreOrderById(id);
 | 
	
		
			
				|  |  | +        ExpressInfoDTO expressInfoDTO = null;
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotEmpty(order.getDeliveryId())) {
 | 
	
		
			
				|  |  | +            String lastFourNumber = "";
 | 
	
		
			
				|  |  | +            if (order.getDeliverySn().equals(ShipperCodeEnum.SF.getValue())) {
 | 
	
		
			
				|  |  | +                lastFourNumber = order.getUserPhone();
 | 
	
		
			
				|  |  | +                if (lastFourNumber.length() == 11) {
 | 
	
		
			
				|  |  | +                    lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            expressInfoDTO = expressService.getExpressInfo(order.getOrderCode(), order.getDeliverySn(), order.getDeliveryId(), lastFourNumber);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return R.ok().put("data", expressInfoDTO);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 新增订单
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:add')")
 | 
	
		
			
				|  |  | +    @Log(title = "订单", businessType = BusinessType.INSERT)
 | 
	
		
			
				|  |  | +    @PostMapping
 | 
	
		
			
				|  |  | +    public AjaxResult add(@RequestBody FsStoreOrderScrm fsStoreOrder) {
 | 
	
		
			
				|  |  | +        return toAjax(fsStoreOrderService.insertFsStoreOrder(fsStoreOrder));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 修改订单
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:edit')")
 | 
	
		
			
				|  |  | +    @Log(title = "订单", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PutMapping
 | 
	
		
			
				|  |  | +    public AjaxResult edit(@RequestBody FsStoreOrderScrm fsStoreOrder) {
 | 
	
		
			
				|  |  | +        return toAjax(fsStoreOrderService.updateFsStoreOrder(fsStoreOrder));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 修改物流
 | 
	
		
			
				|  |  | +     * @param fsStoreOrder
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Log(title = "修改物流", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:editDeliveryId')")
 | 
	
		
			
				|  |  | +    @PutMapping("/editDeliveryId")
 | 
	
		
			
				|  |  | +    public AjaxResult editDeliveryId(@RequestBody FsStoreOrderScrm fsStoreOrder) {
 | 
	
		
			
				|  |  | +        return toAjax(fsStoreOrderService.updateFsStoreOrder(fsStoreOrder));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "同步管易物流单号", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:updateErpOrder')")
 | 
	
		
			
				|  |  | +    @PostMapping("/updateErpOrder")
 | 
	
		
			
				|  |  | +    public R updateErpOrder(@Validated @RequestBody FsStoreOrderExpressEditParam param) {
 | 
	
		
			
				|  |  | +        FsStoreOrderScrm order = fsStoreOrderService.selectFsStoreOrderById(param.getOrderId());
 | 
	
		
			
				|  |  | +        FsErpConfig erpConfig = configUtil.getErpConfig();
 | 
	
		
			
				|  |  | +        List<Long> noErpCompany = erpConfig.getNoErpCompany();
 | 
	
		
			
				|  |  | +        if (noErpCompany.contains(order.getCompanyId())) {
 | 
	
		
			
				|  |  | +            logger.info("订单:{},相关公司不推送erp", order.getOrderCode());
 | 
	
		
			
				|  |  | +            return R.ok("订单:"+ order.getOrderCode()+"相关公司不推送erp");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        IErpOrderService erpOrderService = getErpService();
 | 
	
		
			
				|  |  | +        ErpOrderQueryRequert request = new ErpOrderQueryRequert();
 | 
	
		
			
				|  |  | +        request.setCode(order.getExtendOrderId());
 | 
	
		
			
				|  |  | +        ErpOrderQueryResponse response = erpOrderService.getOrder(request);
 | 
	
		
			
				|  |  | +        if(response.getOrders()!=null&&response.getOrders().size()>0){
 | 
	
		
			
				|  |  | +            for(ErpOrderQuery orderQuery : response.getOrders()){
 | 
	
		
			
				|  |  | +                if(orderQuery.getDeliverys()!=null&&orderQuery.getDeliverys().size()>0){
 | 
	
		
			
				|  |  | +                    for(ErpDeliverys delivery:orderQuery.getDeliverys()){
 | 
	
		
			
				|  |  | +                        if(delivery.getDelivery()&& StringUtils.isNotEmpty(delivery.getMail_no())){
 | 
	
		
			
				|  |  | +                            //更新商订单状态
 | 
	
		
			
				|  |  | +                            fsStoreOrderService.updateDeliveryOrder(param.getOrderId(), delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name());
 | 
	
		
			
				|  |  | +                            return R.ok();
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return R.error("未查询到快递信息");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 删除订单
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:remove')")
 | 
	
		
			
				|  |  | +    @Log(title = "订单", businessType = BusinessType.DELETE)
 | 
	
		
			
				|  |  | +    @DeleteMapping("/{ids}")
 | 
	
		
			
				|  |  | +    public AjaxResult remove(@PathVariable Long[] ids) {
 | 
	
		
			
				|  |  | +        return toAjax(fsStoreOrderService.deleteFsStoreOrderByIds(ids));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @PostMapping("/createUserOrder")
 | 
	
		
			
				|  |  | +    public R createUserOrder(@Validated @RequestBody FsStoreOrderCreateUserParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.createUserOrder(param);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "确认订单", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:finishOrder')")
 | 
	
		
			
				|  |  | +    @PostMapping("/finishOrder")
 | 
	
		
			
				|  |  | +    public R finishOrder(@Validated @RequestBody FsStoreOrderFinishParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.finishOrder(param.getOrderId());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:auditPayRemain')")
 | 
	
		
			
				|  |  | +    @PostMapping("/auditPayRemain")
 | 
	
		
			
				|  |  | +    public R auditPayRemain(@Validated @RequestBody FsStoreOrderAuditPayRemainParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.auditPayRemain(param.getOrderId());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "导入", businessType = BusinessType.IMPORT)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:importExpress')")
 | 
	
		
			
				|  |  | +    @PostMapping("/importExpress")
 | 
	
		
			
				|  |  | +    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
 | 
	
		
			
				|  |  | +        ExcelUtil<StoreOrderExpressExportDTO> util = new ExcelUtil<StoreOrderExpressExportDTO>(StoreOrderExpressExportDTO.class);
 | 
	
		
			
				|  |  | +        List<StoreOrderExpressExportDTO> list = util.importExcel(file.getInputStream());
 | 
	
		
			
				|  |  | +        String message = fsStoreOrderService.importExpress(list, updateSupport);
 | 
	
		
			
				|  |  | +        return AjaxResult.success(message);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    //下载模板
 | 
	
		
			
				|  |  | +    @GetMapping("/importTemplate")
 | 
	
		
			
				|  |  | +    public AjaxResult importTemplate() {
 | 
	
		
			
				|  |  | +        ExcelUtil<StoreOrderExpressExportDTO> util = new ExcelUtil<StoreOrderExpressExportDTO>(StoreOrderExpressExportDTO.class);
 | 
	
		
			
				|  |  | +        return util.importTemplateExcel("物流回单数据");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping("/getStoreOrder")
 | 
	
		
			
				|  |  | +    public R getStoreOrder(@RequestParam("orderCode") String orderCode) {
 | 
	
		
			
				|  |  | +        FsStoreOrderVO vo = fsStoreOrderService.selectFsStoreOrderVOByOrderCode(orderCode);
 | 
	
		
			
				|  |  | +        return R.ok().put("data", vo);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "冻结、解冻佣金", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:editTuiMoney')")
 | 
	
		
			
				|  |  | +    @PostMapping("/editTuiMoney")
 | 
	
		
			
				|  |  | +    public R editTuiMoney(@Validated @RequestBody FsStoreOrderEditTuiMoneyParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.editTuiMoney(param);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "退款", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:refundOrderMoney')")
 | 
	
		
			
				|  |  | +    @PostMapping("/refundOrderMoney")
 | 
	
		
			
				|  |  | +    public synchronized R refundOrderMoney(@Validated @RequestBody FsStoreOrderRefundParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.refundOrderMoney(param.getOrderId());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:getEroOrder')")
 | 
	
		
			
				|  |  | +    @GetMapping("/getEroOrder")
 | 
	
		
			
				|  |  | +    public R getEroOrder(@RequestParam("extendOrderId") String extendOrderId) {
 | 
	
		
			
				|  |  | +        IErpOrderService erpOrderService = getErpService();
 | 
	
		
			
				|  |  | +        ErpOrderQueryRequert request = new ErpOrderQueryRequert();
 | 
	
		
			
				|  |  | +        request.setCode(extendOrderId);
 | 
	
		
			
				|  |  | +        ErpOrderQueryResponse response = erpOrderService.getOrder(request);
 | 
	
		
			
				|  |  | +        return R.ok().put("data",response);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:updateExpress')")
 | 
	
		
			
				|  |  | +    @PostMapping("/updateExpress")
 | 
	
		
			
				|  |  | +    public R updateExpress(@Validated @RequestBody FsStoreOrderExpressEditParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.updateExpress(param);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "同步物流", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:syncExpress')")
 | 
	
		
			
				|  |  | +    @PostMapping("/syncExpress")
 | 
	
		
			
				|  |  | +    public R syncExpress(@Validated @RequestBody FsStoreOrderExpressEditParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.syncExpress(param);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "分佣", businessType = BusinessType.UPDATE)
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:addTuiMoney')")
 | 
	
		
			
				|  |  | +    @PostMapping("/addTuiMoney")
 | 
	
		
			
				|  |  | +    public R addTuiMoney(@Validated @RequestBody FsStoreOrderAddTuiMoneyParam param, HttpServletRequest request) {
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.addTuiMoney(param);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping("/getCustomerOrderList")
 | 
	
		
			
				|  |  | +    public TableDataInfo getCustomerOrderList(FsStoreOrderParam param) {
 | 
	
		
			
				|  |  | +        startPage();
 | 
	
		
			
				|  |  | +        List<FsStoreOrderVO> list = fsStoreOrderService.selectFsCustomerStoreOrderListVO(param);
 | 
	
		
			
				|  |  | +        if (list != null) {
 | 
	
		
			
				|  |  | +            for (FsStoreOrderVO vo : list) {
 | 
	
		
			
				|  |  | +                if(vo.getPhone()!=null){
 | 
	
		
			
				|  |  | +                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2"));
 | 
	
		
			
				|  |  | +                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return getDataTable(list);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Log(title = "手动推管易", businessType = BusinessType.INSERT)
 | 
	
		
			
				|  |  | +    @ApiOperation("创建ERP订单")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@ss.hasPermi('store:storeOrder:createErpOrder')")
 | 
	
		
			
				|  |  | +    @GetMapping("/createErpOrder")
 | 
	
		
			
				|  |  | +    public R createErpOrder(@RequestParam("orderCode") String orderCode) throws Exception
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        logger.info("手动推管易订单号:{}",orderCode);
 | 
	
		
			
				|  |  | +        FsStoreOrderScrm order=fsStoreOrderService.selectFsStoreOrderByOrderCode(orderCode);
 | 
	
		
			
				|  |  | +        return fsStoreOrderService.createOmsOrder(order.getId());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 订单维度分页查询接口
 | 
	
		
			
				|  |  | +     * @param param 查询条件
 | 
	
		
			
				|  |  | +     * @return AjaxResult
 | 
	
		
			
				|  |  | +     * **/
 | 
	
		
			
				|  |  | +    @GetMapping("/orderDimensionStatisticsList")
 | 
	
		
			
				|  |  | +    public TableDataInfo orderDimensionStatisticsList(OrderStatisticsParam param){
 | 
	
		
			
				|  |  | +        return getDataTable(fsStoreOrderService.selectOrderDimensionStatisticsList(param));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 导出订单维度统计接口
 | 
	
		
			
				|  |  | +     * @param param 查询条件
 | 
	
		
			
				|  |  | +     * @return AjaxResult
 | 
	
		
			
				|  |  | +     * **/
 | 
	
		
			
				|  |  | +    @Log(title = "订单维度统计", businessType = BusinessType.EXPORT)
 | 
	
		
			
				|  |  | +    @GetMapping("/orderDimensionStatisticsExport")
 | 
	
		
			
				|  |  | +    public AjaxResult orderDimensionStatisticsExport(OrderStatisticsParam param){
 | 
	
		
			
				|  |  | +        List<OrderStatisticsVo> list = fsStoreOrderService.selectOrderDimensionStatisticsList(param);
 | 
	
		
			
				|  |  | +//        switch (param.getGroupType()){
 | 
	
		
			
				|  |  | +//            case 2:
 | 
	
		
			
				|  |  | +//                List<OrderCateStatisticsVo> cateStatisticsVoList = convertTo(list,OrderCateStatisticsVo.class);
 | 
	
		
			
				|  |  | +//                ExcelUtil<OrderCateStatisticsVo> cateUtil = new ExcelUtil<>(OrderCateStatisticsVo.class);
 | 
	
		
			
				|  |  | +//                return cateUtil.exportExcel(cateStatisticsVoList, "订单标签维度统计");
 | 
	
		
			
				|  |  | +//            case 3:
 | 
	
		
			
				|  |  | +//                List<OrderProductStatisticsVo> productStatisticsVoList =  convertTo(list,OrderProductStatisticsVo.class);
 | 
	
		
			
				|  |  | +//                ExcelUtil<OrderProductStatisticsVo> productUtil = new ExcelUtil<>(OrderProductStatisticsVo.class);
 | 
	
		
			
				|  |  | +//                return productUtil.exportExcel(productStatisticsVoList, "订单商品维度统计");
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        ExcelUtil<OrderStatisticsVo> util = new ExcelUtil<>(OrderStatisticsVo.class);
 | 
	
		
			
				|  |  | +        return util.exportExcel(list, "订单员工维度统计");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 对象列表类型转换
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public static <T> List<T> convertTo(List<?> sourceList, Class<T> targetClass) {
 | 
	
		
			
				|  |  | +        if (sourceList == null || sourceList.isEmpty()) {
 | 
	
		
			
				|  |  | +            return Collections.emptyList();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<T> resultList = new ArrayList<>(sourceList.size());
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            for (Object source : sourceList) {
 | 
	
		
			
				|  |  | +                T target = targetClass.getDeclaredConstructor().newInstance();
 | 
	
		
			
				|  |  | +                BeanUtils.copyProperties(source, target);
 | 
	
		
			
				|  |  | +                resultList.add(target);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } catch (Exception e) {
 | 
	
		
			
				|  |  | +            throw new RuntimeException("数据转换异常", e);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return resultList;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |