Przeglądaj źródła

订单管理修复

wangxy 2 miesięcy temu
rodzic
commit
ed3b407d81

+ 155 - 0
fs-admin-saas/src/main/java/com/fs/company/controller/company/CompanyDeptController.java

@@ -0,0 +1,155 @@
+package com.fs.company.controller.company;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.constant.UserConstants;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.model.LoginUser;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.SecurityUtils;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
+import com.fs.company.domain.CompanyDept;
+import com.fs.company.service.ICompanyDeptService;
+import com.fs.framework.web.service.TokenService;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Iterator;
+import java.util.List;
+
+@RestController
+@RequestMapping("/company/companyDept")
+public class CompanyDeptController extends BaseController
+{
+    @Autowired
+    private ICompanyDeptService deptService;
+    @Autowired
+    private TokenService tokenService;
+
+    @PreAuthorize("@ss.hasPermi('company:dept:list')")
+    @GetMapping("/list")
+    public AjaxResult list(CompanyDept dept)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (dept.getCompanyId() == null && loginUser.getUser() != null && loginUser.getUser().getCompanyId() != null) { dept.setCompanyId(loginUser.getUser().getCompanyId()); };
+        List<CompanyDept> depts = deptService.selectCompanyDeptList(dept);
+        return AjaxResult.success(depts);
+    }
+
+    @GetMapping("/myDeptTreeselect")
+    public AjaxResult myDeptTreeselect(CompanyDept dept)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (dept.getCompanyId() == null && loginUser.getUser() != null && loginUser.getUser().getCompanyId() != null) { dept.setCompanyId(loginUser.getUser().getCompanyId()); }
+        dept.setStatus("0");
+        dept.setParentId(loginUser.getUser().getDeptId());
+        List<CompanyDept> depts = deptService.selectCompanyDeptListByDeptAndParent(dept);
+        return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:dept:list')")
+    @GetMapping("/list/exclude/{deptId}")
+    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyDept dept=new CompanyDept();
+        if (dept.getCompanyId() == null && loginUser.getUser() != null && loginUser.getUser().getCompanyId() != null) { dept.setCompanyId(loginUser.getUser().getCompanyId()); }
+        List<CompanyDept> depts = deptService.selectCompanyDeptList(dept);
+        Iterator<CompanyDept> it = depts.iterator();
+        while (it.hasNext())
+        {
+            CompanyDept d = (CompanyDept) it.next();
+            if (d.getDeptId().intValue() == deptId
+                    || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
+            {
+                it.remove();
+            }
+        }
+        return AjaxResult.success(depts);
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:dept:query')")
+    @GetMapping(value = "/{deptId}")
+    public AjaxResult getInfo(@PathVariable Long deptId)
+    {
+        return AjaxResult.success(deptService.selectCompanyDeptById(deptId));
+    }
+
+    @GetMapping("/treeselect")
+    public AjaxResult treeselect(CompanyDept dept)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (dept.getCompanyId() == null && loginUser.getUser() != null && loginUser.getUser().getCompanyId() != null) { dept.setCompanyId(loginUser.getUser().getCompanyId()); }
+        dept.setStatus("0");
+        List<CompanyDept> depts = deptService.selectCompanyDeptList(dept);
+        return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
+    }
+
+    @GetMapping(value = "/roleDeptTreeselect/{roleId}")
+    public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        CompanyDept dept=new CompanyDept();
+        if (dept.getCompanyId() == null && loginUser.getUser() != null && loginUser.getUser().getCompanyId() != null) { dept.setCompanyId(loginUser.getUser().getCompanyId()); }
+        dept.setStatus("0");
+        List<CompanyDept> depts = deptService.selectCompanyDeptList(dept);
+        AjaxResult ajax = AjaxResult.success();
+        ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
+        ajax.put("depts", deptService.buildDeptTreeSelect(depts));
+        return ajax;
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:dept:add')")
+    @Log(title = "部门管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@Validated @RequestBody CompanyDept dept)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (dept.getCompanyId() == null && loginUser.getUser() != null && loginUser.getUser().getCompanyId() != null) { dept.setCompanyId(loginUser.getUser().getCompanyId()); }
+        if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
+        {
+            return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+        }
+        dept.setCreateBy(SecurityUtils.getUsername());
+        return toAjax(deptService.insertCompanyDept(dept));
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:dept:edit')")
+    @Log(title = "部门管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@Validated @RequestBody CompanyDept dept) {
+        if(dept.getParentId().equals(dept.getDeptId())) {
+            return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
+        }
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (dept.getCompanyId() == null && loginUser.getUser() != null && loginUser.getUser().getCompanyId() != null) { dept.setCompanyId(loginUser.getUser().getCompanyId()); }
+        if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
+            return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
+        } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
+                && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) {
+            return AjaxResult.error("该部门包含未停用的子部门!");
+        }
+        dept.setUpdateBy(SecurityUtils.getUsername());
+        return toAjax(deptService.updateCompanyDept(dept));
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:dept:remove')")
+    @Log(title = "部门管理", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{deptId}")
+    public AjaxResult remove(@PathVariable Long deptId)
+    {
+        if (deptService.hasChildByDeptId(deptId)>0)
+        {
+            return AjaxResult.error("存在下级部门,不允许删除");
+        }
+        if (deptService.checkDeptExistUser(deptId)>0)
+        {
+            return AjaxResult.error("部门存在用户,不允许删除");
+        }
+        return toAjax(deptService.deleteCompanyDeptById(deptId));
+    }
+}

+ 23 - 23
fs-admin-saas/src/main/java/com/fs/course/controller/FsCoursePlaySourceConfigController.java

@@ -56,29 +56,29 @@ public class FsCoursePlaySourceConfigController extends BaseController {
                               @RequestParam(required = false, defaultValue = "10") Integer pageSize,
                               @RequestParam(required = false, defaultValue = "10") Integer pageSize,
                               @RequestParam(required = false) Long companyId
                               @RequestParam(required = false) Long companyId
     ) {
     ) {
-//        Map<String, Object> params = new HashMap<>();
-//        params.put("name", name);
-//        params.put("appid", appid);
-//        params.put("isMall", isMall);
-//        params.put("companyId", companyId);
-//        com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
-//        String json = configService.selectConfigByKey("course.config");
-//        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
-//        Long userId = null;
-//        Long deptId = null;
-//        if(!loginUser.isAdmin() && config.getDept() != null && config.getDept()){
-//            deptId = loginUser.getDeptId();
-//            if(config.getDept() == null || !config.getDept()){
-//                userId = loginUser.getUserId();
-//            }
-//        }
-//        params.put("userId", userId);
-//        params.put("deptId", deptId);
-//
-//        PageHelper.startPage(pageNum, pageSize);
-//        List<FsCoursePlaySourceConfigVO> list = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigVOListByMap(params);
-//        return getDataTable(list);
-        throw new RuntimeException("未实现");
+        Map<String, Object> params = new HashMap<>();
+        params.put("name", name);
+        params.put("appid", appid);
+        params.put("isMall", isMall);
+        params.put("companyId", companyId);
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        Long userId = null;
+        Long deptId = null;
+        if(!loginUser.isAdmin() && config.getDept() != null && config.getDept()){
+            deptId = loginUser.getDeptId();
+            if(config.getDept() == null || !config.getDept()){
+                userId = loginUser.getUserId();
+            }
+        }
+        params.put("userId", userId);
+        params.put("deptId", deptId);
+
+        PageHelper.startPage(pageNum, pageSize);
+        List<FsCoursePlaySourceConfigVO> list = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigVOListByMap(params);
+        return getDataTable(list);
+//        throw new RuntimeException("未实现");
     }
     }
 
 
     @PreAuthorize("@ss.hasPermi('course:playSourceConfig:query')")
     @PreAuthorize("@ss.hasPermi('course:playSourceConfig:query')")

+ 2 - 1
fs-admin-saas/src/main/java/com/fs/hisStore/controller/FsStoreAfterSalesScrmController.java

@@ -99,7 +99,8 @@ public class FsStoreAfterSalesScrmController extends BaseController
         }
         }
 
 
         List<FsStoreAfterSalesVO> list = fsStoreAfterSalesService.selectFsStoreAfterSalesListVOExport(fsStoreAfterSales);
         List<FsStoreAfterSalesVO> list = fsStoreAfterSalesService.selectFsStoreAfterSalesListVOExport(fsStoreAfterSales);
-        if("北京卓美".equals(com.fs.config.saas.ProjectConfig.getFromDB(sysConfigMapper).getCloudHost().getCompanyName())){
+        com.fs.config.saas.ProjectConfig projectConfig = com.fs.config.saas.ProjectConfig.getFromDB(sysConfigMapper);
+        if(projectConfig != null && projectConfig.getCloudHost() != null && "北京卓美".equals(projectConfig.getCloudHost().getCompanyName())){
             List<FsStoreOrderItemExportRefundZMVO> zmvoList = list.stream()
             List<FsStoreOrderItemExportRefundZMVO> zmvoList = list.stream()
                     .map(vo -> {
                     .map(vo -> {
                         FsStoreOrderItemExportRefundZMVO zmvo = new FsStoreOrderItemExportRefundZMVO();
                         FsStoreOrderItemExportRefundZMVO zmvo = new FsStoreOrderItemExportRefundZMVO();

+ 213 - 215
fs-admin-saas/src/main/java/com/fs/hisStore/controller/FsStoreHealthOrderScrmController.java

@@ -7,6 +7,7 @@ import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.CloudHostUtils;
 import com.fs.common.utils.CloudHostUtils;
@@ -82,83 +83,82 @@ public class FsStoreHealthOrderScrmController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('store:healthStoreOrder:list')")
 //    @PreAuthorize("@ss.hasPermi('store:healthStoreOrder:list')")
       @PostMapping("/healthList")
       @PostMapping("/healthList")
       public TableDataInfo healthStoreList(@RequestBody FsStoreOrderParam param) {
       public TableDataInfo healthStoreList(@RequestBody FsStoreOrderParam param) {
-//          PageHelper.startPage(param.getPageNum(), param.getPageSize());
-//        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.setIsHealth("1");
-//        List<FsStoreOrderVO> list = fsStoreOrderService.selectFsStoreOrderListVO(param);
-//        //金牛需求 区别其他项目 status = 6 (金牛代服管家) ,其他项目请避免使用订单状态status = 6
-//        TableDataInfo dataTable = getDataTable(list);
-//        if (CloudHostUtils.hasCloudHostName("康年堂")){
-//            dataTable.setMsg("knt");
-//        }
-//        if (list != null) {
-//            com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
-//            for (FsStoreOrderVO vo : list) {
-//                if(StringUtils.isNotEmpty(vo.getPhone())){
-//                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
-//                }
-//                if (StringUtils.isNotEmpty(vo.getUserPhone())){
-//                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
-//                }
-//                if (CloudHostUtils.hasCloudHostName("康年堂")){
-//                    //查询顺丰代服账号
-//                    FsStoreOrderDf df = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(vo.getId());
-//                    if (df != null){
-//                        vo.setErpAccount(df.getLoginAccount());
-//                    }
-//                }
-//                //
-//                if (loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) {
-//                    if((vo.getCost() !=null && vo.getTotalNum() != null)){
-//                        vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
-//                    }
-//                } else {
-//                    vo.setPayPostage(BigDecimal.ZERO);
-//                    vo.setCost(BigDecimal.ZERO);
-//                    vo.setFPrice(BigDecimal.ZERO);
-//                    vo.setPayDelivery(BigDecimal.ZERO);
-//                    vo.setBarCode("");
-//                    vo.setCateName("");
-//                    vo.setBankTransactionId("");
-//                }
-//
-//            }
-//        }
-//        FsStoreOrderListAndStatisticsVo vo = new FsStoreOrderListAndStatisticsVo();
-//        BeanUtils.copyProperties(dataTable, vo);
-//        if (dataTable.getTotal()>0){
-//            Map<String, BigDecimal> statistics= fsStoreOrderService.selectFsStoreOrderStatistics(param);
-//            if (statistics != null && statistics.size() >= 3){
-//                vo.setPayPriceTotal(statistics.get("pay_price").toString());
-//                vo.setPayMoneyTotal(statistics.get("pay_money").toString());
-//                vo.setPayRemainTotal(statistics.get("pay_remain").toString());
-//            }else {
-//                vo.setPayPriceTotal("0");
-//                vo.setPayMoneyTotal("0");
-//                vo.setPayRemainTotal("0");
-//            }
-//            //商品数量合计
-//            String productStatistics= fsStoreOrderService.selectFsStoreOrderProductStatistics(param);
-//            if (StringUtils.isNotBlank(productStatistics)){
-//                vo.setProductInfo(productStatistics);
-//            } else {
-//                vo.setProductInfo("");
-//            }
-//
-//        }
-//        return vo;
-          throw new RuntimeException("未实现");
+          PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        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.setIsHealth("1");
+        List<FsStoreOrderVO> list = fsStoreOrderService.selectFsStoreOrderListVO(param);
+        //金牛需求 区别其他项目 status = 6 (金牛代服管家) ,其他项目请避免使用订单状态status = 6
+        TableDataInfo dataTable = getDataTable(list);
+        if (CloudHostUtils.hasCloudHostName("康年堂")){
+            dataTable.setMsg("knt");
+        }
+        if (list != null) {
+            LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+            for (FsStoreOrderVO vo : list) {
+                if(StringUtils.isNotEmpty(vo.getPhone())){
+                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                }
+                if (StringUtils.isNotEmpty(vo.getUserPhone())){
+                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                }
+                if (CloudHostUtils.hasCloudHostName("康年堂")){
+                    //查询顺丰代服账号
+                    FsStoreOrderDf df = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(vo.getId());
+                    if (df != null){
+                        vo.setErpAccount(df.getLoginAccount());
+                    }
+                }
+                //
+                if (loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) {
+                    if((vo.getCost() !=null && vo.getTotalNum() != null)){
+                        vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
+                    }
+                } else {
+                    vo.setPayPostage(BigDecimal.ZERO);
+                    vo.setCost(BigDecimal.ZERO);
+                    vo.setFPrice(BigDecimal.ZERO);
+                    vo.setPayDelivery(BigDecimal.ZERO);
+                    vo.setBarCode("");
+                    vo.setCateName("");
+                    vo.setBankTransactionId("");
+                }
+
+            }
+        }
+        FsStoreOrderListAndStatisticsVo vo = new FsStoreOrderListAndStatisticsVo();
+        BeanUtils.copyProperties(dataTable, vo);
+        if (dataTable.getTotal()>0){
+            Map<String, BigDecimal> statistics= fsStoreOrderService.selectFsStoreOrderStatistics(param);
+            if (statistics != null && statistics.size() >= 3){
+                vo.setPayPriceTotal(statistics.get("pay_price").toString());
+                vo.setPayMoneyTotal(statistics.get("pay_money").toString());
+                vo.setPayRemainTotal(statistics.get("pay_remain").toString());
+            }else {
+                vo.setPayPriceTotal("0");
+                vo.setPayMoneyTotal("0");
+                vo.setPayRemainTotal("0");
+            }
+            //商品数量合计
+            String productStatistics= fsStoreOrderService.selectFsStoreOrderProductStatistics(param);
+            if (StringUtils.isNotBlank(productStatistics)){
+                vo.setProductInfo(productStatistics);
+            } else {
+                vo.setProductInfo("");
+            }
+
+        }
+        return vo;
     }
     }
 
 
     /**
     /**
@@ -274,150 +274,148 @@ public class FsStoreHealthOrderScrmController extends BaseController {
     @Log(title = "商城订单明细导出", businessType = BusinessType.EXPORT)
     @Log(title = "商城订单明细导出", businessType = BusinessType.EXPORT)
     @GetMapping("/healthExportItems")
     @GetMapping("/healthExportItems")
     public AjaxResult exportItems1(FsStoreOrderParam param) {
     public AjaxResult exportItems1(FsStoreOrderParam param) {
-//        if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
-//            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.setIsHealth("1");
-//        List<FsStoreOrderItemExportVO> list = orderItemService.selectFsStoreOrderItemListExportVO(param);
-//        //对手机号脱敏
-//        if (list != null) {
-//            com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
-//            for (FsStoreOrderItemExportVO vo : list) {
-//                if (vo.getUserPhone() != null) {
-//                    String phone = vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2");
-//                    vo.setUserPhone(phone);
-//                }
-//                if (!StringUtils.isEmpty(vo.getJsonInfo())) {
-//                    try {
-//                        StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
-//                        BeanUtil.copyProperties(orderProductDTO, vo);
-//                    } catch (Exception e) {
-//                    }
-//                }
-//                //
-//                if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !Objects.isNull(vo.getCost())) {
-//                    vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
-//                } else {
-//                    vo.setPayPostage(BigDecimal.ZERO);
-//                    vo.setCost(BigDecimal.ZERO);
-//                    vo.setFPrice(BigDecimal.ZERO);
-//                    vo.setBarCode("");
-//                    vo.setCateName("");
-//                    vo.setBankTransactionId("");
-//                }
-//            }
-//        }
-//        ExcelUtil<FsStoreOrderItemExportVO> util = new ExcelUtil<FsStoreOrderItemExportVO>(FsStoreOrderItemExportVO.class);
-//        return util.exportExcel(list, "订单明细数据");
-        throw new RuntimeException("未实现");
+        if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
+            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.setIsHealth("1");
+        List<FsStoreOrderItemExportVO> list = orderItemService.selectFsStoreOrderItemListExportVO(param);
+        //对手机号脱敏
+        if (list != null) {
+            LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+            for (FsStoreOrderItemExportVO vo : list) {
+                if (vo.getUserPhone() != null) {
+                    String phone = vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2");
+                    vo.setUserPhone(phone);
+                }
+                if (!StringUtils.isEmpty(vo.getJsonInfo())) {
+                    try {
+                        StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
+                        BeanUtil.copyProperties(orderProductDTO, vo);
+                    } catch (Exception e) {
+                    }
+                }
+                //
+                if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !Objects.isNull(vo.getCost())) {
+                    vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
+                } else {
+                    vo.setPayPostage(BigDecimal.ZERO);
+                    vo.setCost(BigDecimal.ZERO);
+                    vo.setFPrice(BigDecimal.ZERO);
+                    vo.setBarCode("");
+                    vo.setCateName("");
+                    vo.setBankTransactionId("");
+                }
+            }
+        }
+        ExcelUtil<FsStoreOrderItemExportVO> util = new ExcelUtil<FsStoreOrderItemExportVO>(FsStoreOrderItemExportVO.class);
+        return util.exportExcel(list, "订单明细数据");
     }
     }
 
 
     @PreAuthorize("@ss.hasPermi('store:healthStoreOrder:exportItems:details')")
     @PreAuthorize("@ss.hasPermi('store:healthStoreOrder:exportItems:details')")
     @Log(title = "商城订单明细导出", businessType = BusinessType.EXPORT)
     @Log(title = "商城订单明细导出", businessType = BusinessType.EXPORT)
     @GetMapping("/healthExportItemsDetails")
     @GetMapping("/healthExportItemsDetails")
     public AjaxResult healthExportItemsDetails(FsStoreOrderParam param) {
     public AjaxResult healthExportItemsDetails(FsStoreOrderParam param) {
-//        if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
-//            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.setIsHealth("1");
-//        List<FsStoreOrderItemExportVO> list = orderItemService.selectFsStoreOrderItemListExportVO(param);
-//        if("北京卓美".equals(com.fs.config.saas.ProjectConfig.getFromDB(sysConfigMapper).getCloudHost().getCompanyName())){
-//            List<FsStoreOrderItemExportZMVO> zmvoList = list.stream()
-//                    .map(vo -> {
-//                        FsStoreOrderItemExportZMVO zmvo = new FsStoreOrderItemExportZMVO();
-//                        try {
-//                            BeanUtil.copyProperties( vo,zmvo);
-//                        } catch (Exception e) {
-//                            // 处理异常
-//                            e.printStackTrace();
-//                        }
-//                        return zmvo;
-//                    })
-//                    .collect(Collectors.toList());
-//            //对手机号脱敏
-//            if (zmvoList != null) {
-//                    com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
-//                    for (FsStoreOrderItemExportZMVO vo : zmvoList) {
-//                        if (!StringUtils.isEmpty(vo.getJsonInfo())) {
-//                            try {
-//                                StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
-//                                BeanUtil.copyProperties(orderProductDTO, vo);
-//                            } catch (Exception e) {
-//                            }
-//                        }
-//                        if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !Objects.isNull(vo.getCost())) {
-//                            vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
-//                        } else {
-//                            vo.setPayPostage(BigDecimal.ZERO);
-//                            vo.setCost(BigDecimal.ZERO);
-//                            vo.setFPrice(BigDecimal.ZERO);
-//                            vo.setBarCode("");
-//                            vo.setCateName("");
-//                            vo.setBankTransactionId("");
-//                        }
-//                    }
-//                }
-//                ExcelUtil<FsStoreOrderItemExportZMVO> util = new ExcelUtil<FsStoreOrderItemExportZMVO>(FsStoreOrderItemExportZMVO.class);
-//                return util.exportExcel(zmvoList, "订单明细数据");
-//        }
-//        //对手机号脱敏
-//        if (list != null) {
-//            com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
-//            for (FsStoreOrderItemExportVO vo : list) {
-//                if (!StringUtils.isEmpty(vo.getJsonInfo())) {
-//                    try {
-//                        StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
-//                        BeanUtil.copyProperties(orderProductDTO, vo);
-//                    } catch (Exception e) {
-//                    }
-//                }
-//                if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !Objects.isNull(vo.getCost())) {
-//                    vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
-//                } else {
-//                    vo.setPayPostage(BigDecimal.ZERO);
-//                    vo.setCost(BigDecimal.ZERO);
-//                    vo.setFPrice(BigDecimal.ZERO);
-//                    vo.setBarCode("");
-//                    vo.setCateName("");
-//                    vo.setBankTransactionId("");
-//                }
-//            }
-//        }
-//        ExcelUtil<FsStoreOrderItemExportVO> util = new ExcelUtil<FsStoreOrderItemExportVO>(FsStoreOrderItemExportVO.class);
-//        return util.exportExcel(list, "订单明细数据");
-        throw new RuntimeException("未实现");
+        if ("".equals(param.getBeginTime()) && "".equals(param.getEndTime())){
+            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.setIsHealth("1");
+        List<FsStoreOrderItemExportVO> list = orderItemService.selectFsStoreOrderItemListExportVO(param);
+        if("北京卓美".equals(com.fs.config.saas.ProjectConfig.getFromDB(sysConfigMapper).getCloudHost().getCompanyName())){
+            List<FsStoreOrderItemExportZMVO> zmvoList = list.stream()
+                    .map(vo -> {
+                        FsStoreOrderItemExportZMVO zmvo = new FsStoreOrderItemExportZMVO();
+                        try {
+                            BeanUtil.copyProperties( vo,zmvo);
+                        } catch (Exception e) {
+                            // 处理异常
+                            e.printStackTrace();
+                        }
+                        return zmvo;
+                    })
+                    .collect(Collectors.toList());
+            //对手机号脱敏
+            if (zmvoList != null) {
+                LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+                    for (FsStoreOrderItemExportZMVO vo : zmvoList) {
+                        if (!StringUtils.isEmpty(vo.getJsonInfo())) {
+                            try {
+                                StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
+                                BeanUtil.copyProperties(orderProductDTO, vo);
+                            } catch (Exception e) {
+                            }
+                        }
+                        if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !Objects.isNull(vo.getCost())) {
+                            vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
+                        } else {
+                            vo.setPayPostage(BigDecimal.ZERO);
+                            vo.setCost(BigDecimal.ZERO);
+                            vo.setFPrice(BigDecimal.ZERO);
+                            vo.setBarCode("");
+                            vo.setCateName("");
+                            vo.setBankTransactionId("");
+                        }
+                    }
+                }
+                ExcelUtil<FsStoreOrderItemExportZMVO> util = new ExcelUtil<FsStoreOrderItemExportZMVO>(FsStoreOrderItemExportZMVO.class);
+                return util.exportExcel(zmvoList, "订单明细数据");
+        }
+        //对手机号脱敏
+        if (list != null) {
+            LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+            for (FsStoreOrderItemExportVO vo : list) {
+                if (!StringUtils.isEmpty(vo.getJsonInfo())) {
+                    try {
+                        StoreOrderProductDTO orderProductDTO = JSONObject.parseObject(vo.getJsonInfo(), StoreOrderProductDTO.class);
+                        BeanUtil.copyProperties(orderProductDTO, vo);
+                    } catch (Exception e) {
+                    }
+                }
+                if ((loginUser.getPermissions().contains("his:storeAfterSales:finance") || loginUser.getPermissions().contains("*:*:*") ) && !Objects.isNull(vo.getCost())) {
+                    vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
+                } else {
+                    vo.setPayPostage(BigDecimal.ZERO);
+                    vo.setCost(BigDecimal.ZERO);
+                    vo.setFPrice(BigDecimal.ZERO);
+                    vo.setBarCode("");
+                    vo.setCateName("");
+                    vo.setBankTransactionId("");
+                }
+            }
+        }
+        ExcelUtil<FsStoreOrderItemExportVO> util = new ExcelUtil<FsStoreOrderItemExportVO>(FsStoreOrderItemExportVO.class);
+        return util.exportExcel(list, "订单明细数据");
     }
     }
 
 
     //订单发货批量导入
     //订单发货批量导入

+ 74 - 74
fs-admin-saas/src/main/java/com/fs/hisStore/controller/FsStoreOrderScrmController.java

@@ -11,6 +11,7 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.entity.SysRole;
 import com.fs.common.core.domain.entity.SysRole;
 import com.fs.common.core.domain.entity.SysUser;
 import com.fs.common.core.domain.entity.SysUser;
+import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.CloudHostUtils;
 import com.fs.common.utils.CloudHostUtils;
@@ -182,80 +183,79 @@ public class FsStoreOrderScrmController extends BaseController {
     @PreAuthorize("@ss.hasPermi('store:storeOrder:list')")
     @PreAuthorize("@ss.hasPermi('store:storeOrder:list')")
     @PostMapping("/list")
     @PostMapping("/list")
     public TableDataInfo list(@RequestBody FsStoreOrderParam param) {
     public TableDataInfo list(@RequestBody FsStoreOrderParam param) {
-//        PageHelper.startPage(param.getPageNum(), param.getPageSize());
-//        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);
-//        //金牛需求 区别其他项目 status = 6 (金牛代服管家) ,其他项目请避免使用订单状态status = 6
-//        TableDataInfo dataTable = getDataTable(list);
-//        if (CloudHostUtils.hasCloudHostName("康年堂")){
-//            dataTable.setMsg("knt");
-//        }
-//        if (list != null) {
-//            com.fs.framework.security.LoginUser loginUser = (com.fs.framework.security.LoginUser) tokenService.getLoginUser(ServletUtils.getRequest());
-//            for (FsStoreOrderVO vo : list) {
-//                if(vo.getPhone()!=null){
-//                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
-//                }
-//                if(ObjectUtil.isNotEmpty(vo.getUserPhone())){
-//                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
-//                }
-//                if (CloudHostUtils.hasCloudHostName("康年堂")){
-//                    //查询顺丰代服账号
-//                    FsStoreOrderDf df = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(vo.getId());
-//                    if (df != null){
-//                        vo.setErpAccount(df.getLoginAccount());
-//                    }
-//                }
-//                //
-//                if ((loginUser.getPermissions().contains("his:storeAfterSales:finance")) || loginUser.getPermissions().contains("*:*:*") && (vo.getCost() != null && vo.getTotalNum() != null)) {
-//                    vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
-//                } else {
-//                    vo.setPayPostage(BigDecimal.ZERO);
-//                    vo.setCost(BigDecimal.ZERO);
-//                    vo.setFPrice(BigDecimal.ZERO);
-//                    vo.setPayDelivery(BigDecimal.ZERO);
-//                    vo.setBarCode("");
-//                    vo.setCateName("");
-//                    vo.setBankTransactionId("");
-//                }
-//            }
-//        }
-//        FsStoreOrderListAndStatisticsVo vo = new FsStoreOrderListAndStatisticsVo();
-//        BeanUtils.copyProperties(dataTable, vo);
-//        if (dataTable.getTotal()>0){
-//            Map<String, BigDecimal> statistics= fsStoreOrderService.selectFsStoreOrderStatistics(param);
-//            if (statistics != null && statistics.size() >= 3){
-//                vo.setPayPriceTotal(statistics.get("pay_price").toString());
-//                vo.setPayMoneyTotal(statistics.get("pay_money").toString());
-//                vo.setPayRemainTotal(statistics.get("pay_remain").toString());
-//            }else {
-//                vo.setPayPriceTotal("0");
-//                vo.setPayMoneyTotal("0");
-//                vo.setPayRemainTotal("0");
-//            }
-//            //商品数量合计
-//            String productStatistics= fsStoreOrderService.selectFsStoreOrderProductStatistics(param);
-//            if (StringUtils.isNotBlank(productStatistics)){
-//                vo.setProductInfo(productStatistics);
-//            } else {
-//                vo.setProductInfo("");
-//            }
-//
-//        }
-//        return vo;
-        throw new RuntimeException("未实现");
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        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);
+        //金牛需求 区别其他项目 status = 6 (金牛代服管家) ,其他项目请避免使用订单状态status = 6
+        TableDataInfo dataTable = getDataTable(list);
+        if (CloudHostUtils.hasCloudHostName("康年堂")){
+            dataTable.setMsg("knt");
+        }
+        if (list != null) {
+            LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+            for (FsStoreOrderVO vo : list) {
+                if(vo.getPhone()!=null){
+                    vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                }
+                if(ObjectUtil.isNotEmpty(vo.getUserPhone())){
+                    vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                }
+                if (CloudHostUtils.hasCloudHostName("康年堂")){
+                    //查询顺丰代服账号
+                    FsStoreOrderDf df = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(vo.getId());
+                    if (df != null){
+                        vo.setErpAccount(df.getLoginAccount());
+                    }
+                }
+                //
+                if ((loginUser.getPermissions().contains("his:storeAfterSales:finance")) || loginUser.getPermissions().contains("*:*:*") && (vo.getCost() != null && vo.getTotalNum() != null)) {
+                    vo.setFPrice(vo.getCost().multiply(BigDecimal.valueOf(vo.getTotalNum())));
+                } else {
+                    vo.setPayPostage(BigDecimal.ZERO);
+                    vo.setCost(BigDecimal.ZERO);
+                    vo.setFPrice(BigDecimal.ZERO);
+                    vo.setPayDelivery(BigDecimal.ZERO);
+                    vo.setBarCode("");
+                    vo.setCateName("");
+                    vo.setBankTransactionId("");
+                }
+            }
+        }
+        FsStoreOrderListAndStatisticsVo vo = new FsStoreOrderListAndStatisticsVo();
+        BeanUtils.copyProperties(dataTable, vo);
+        if (dataTable.getTotal()>0){
+            Map<String, BigDecimal> statistics= fsStoreOrderService.selectFsStoreOrderStatistics(param);
+            if (statistics != null && statistics.size() >= 3){
+                vo.setPayPriceTotal(statistics.get("pay_price").toString());
+                vo.setPayMoneyTotal(statistics.get("pay_money").toString());
+                vo.setPayRemainTotal(statistics.get("pay_remain").toString());
+            }else {
+                vo.setPayPriceTotal("0");
+                vo.setPayMoneyTotal("0");
+                vo.setPayRemainTotal("0");
+            }
+            //商品数量合计
+            String productStatistics= fsStoreOrderService.selectFsStoreOrderProductStatistics(param);
+            if (StringUtils.isNotBlank(productStatistics)){
+                vo.setProductInfo(productStatistics);
+            } else {
+                vo.setProductInfo("");
+            }
+
+        }
+        return vo;
     }
     }
 
 
     @PreAuthorize("@ss.hasPermi('store:storeOrder:payRemainList')")
     @PreAuthorize("@ss.hasPermi('store:storeOrder:payRemainList')")