Ver Fonte

订单日志以及订单查询统计

ct há 1 semana atrás
pai
commit
ce2f287ab5
19 ficheiros alterados com 527 adições e 16 exclusões
  1. 2 1
      fs-admin/src/main/java/com/fs/his/controller/FsPackageOrderController.java
  2. 40 2
      fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java
  3. 28 0
      fs-admin/src/main/java/com/fs/his/controller/FsUserController.java
  4. 2 1
      fs-company/src/main/java/com/fs/company/controller/store/FsPackageOrderController.java
  5. 1 1
      fs-company/src/main/java/com/fs/company/controller/store/FsStoreOrderController.java
  6. 1 2
      fs-service/src/main/java/com/fs/course/service/impl/FsUserWatchStatisticsServiceImpl.java
  7. 4 3
      fs-service/src/main/java/com/fs/his/domain/FsUser.java
  8. 6 1
      fs-service/src/main/java/com/fs/his/enums/FsStoreOrderLogEnum.java
  9. 5 0
      fs-service/src/main/java/com/fs/his/mapper/FsStoreOrderMapper.java
  10. 1 0
      fs-service/src/main/java/com/fs/his/param/FsStoreOrderSetErpPhoneParam.java
  11. 1 1
      fs-service/src/main/java/com/fs/his/service/IFsPackageOrderService.java
  12. 5 0
      fs-service/src/main/java/com/fs/his/service/IFsStoreOrderService.java
  13. 3 2
      fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java
  14. 2 0
      fs-service/src/main/java/com/fs/his/service/impl/FsStoreAfterSalesServiceImpl.java
  15. 18 1
      fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java
  16. 14 0
      fs-service/src/main/java/com/fs/his/vo/FsStoreOrderListAndStatisticsVo.java
  17. 1 1
      fs-service/src/main/resources/application-druid-jnmy-test.yml
  18. 392 0
      fs-service/src/main/resources/mapper/his/FsStoreOrderMapper.xml
  19. 1 0
      fs-store/src/main/java/com/fs/store/controller/store/FsStoreOrderController.java

+ 2 - 1
fs-admin/src/main/java/com/fs/his/controller/FsPackageOrderController.java

@@ -193,7 +193,8 @@ public class FsPackageOrderController extends BaseController
     @GetMapping("storeRefund/{orderId}")
     public AjaxResult storeRefund(@PathVariable("orderId") Long orderId)
     {
-        return AjaxResult.success(fsPackageOrderService.PackageStoreOrderRefund(orderId));
+        String nickName = getLoginUser().getUser().getNickName();
+        return AjaxResult.success(fsPackageOrderService.PackageStoreOrderRefund(orderId,nickName));
     }
 
     /**

+ 40 - 2
fs-admin/src/main/java/com/fs/his/controller/FsStoreOrderController.java

@@ -1,9 +1,11 @@
 package com.fs.his.controller;
 
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 import cn.hutool.core.util.StrUtil;
@@ -35,6 +37,7 @@ import com.fs.his.domain.*;
 import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.dto.StoreOrderExpressExportDTO;
 import com.fs.his.dto.TracesDTO;
+import com.fs.his.enums.FsStoreOrderLogEnum;
 import com.fs.his.enums.ShipperCodeEnum;
 import com.fs.his.param.FsFollowMsgParam;
 import com.fs.his.param.FsStoreOrderParam;
@@ -48,6 +51,7 @@ import com.fs.system.mapper.SysConfigMapper;
 import com.fs.system.service.ISysRoleService;
 import com.github.pagehelper.PageHelper;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -120,11 +124,14 @@ public class FsStoreOrderController extends BaseController
 
     @Autowired
     private CloudHostProper cloudHostProper;
+
+    @Autowired
+    private IFsStoreOrderLogsService fsStoreOrderLogsService;
     /**
      * 查询订单列表
      */
     @PostMapping("/list")
-    public TableDataInfo list(@RequestBody FsStoreOrderParam fsStoreOrder)
+    public FsStoreOrderListAndStatisticsVo list(@RequestBody FsStoreOrderParam fsStoreOrder)
     {
         PageHelper.startPage(fsStoreOrder);
         if (fsStoreOrder.getUserPhoneMk()!=null&& !fsStoreOrder.getUserPhoneMk().isEmpty()){
@@ -151,7 +158,29 @@ public class FsStoreOrderController extends BaseController
             }
             dataTable.setMsg("jnmy");
         }
-        return dataTable;
+        FsStoreOrderListAndStatisticsVo vo = new FsStoreOrderListAndStatisticsVo();
+        BeanUtils.copyProperties(dataTable, vo);
+        if (dataTable.getTotal()>0){
+            Map<String,BigDecimal> statistics= fsStoreOrderService.selectFsStoreOrderStatistics(fsStoreOrder);
+            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(fsStoreOrder);
+            if (StringUtils.isNotBlank(productStatistics)){
+                vo.setProductInfo(productStatistics);
+            } else {
+                vo.setProductInfo("");
+            }
+
+        }
+        return vo;
     }
 
     /**
@@ -598,6 +627,7 @@ public class FsStoreOrderController extends BaseController
     @PostMapping(value = "/batchCreateErpOrder")
     public R batchCreateErpOrder(@RequestBody FsStoreOrderSetErpPhoneParam param)
     {
+        String nickName = getLoginUser().getUser().getNickName();
         String loginAccount = param.getLoginAccount();
         if (StringUtils.isBlank(loginAccount)){
             return R.error("未选择推送erp账户");
@@ -629,8 +659,12 @@ public class FsStoreOrderController extends BaseController
                 FsStoreOrderDf temp = fsStoreOrderDfService.selectFsStoreOrderDfByOrderId(df.getOrderId());
                 if (temp == null){
                     fsStoreOrderDfService.insertFsStoreOrderDf(df);
+                    fsStoreOrderLogsService.create(orderId, FsStoreOrderLogEnum.SET_PUSH_ACCOUNT.getValue(),
+                            nickName + " " +FsStoreOrderLogEnum.SET_PUSH_ACCOUNT.getDesc() + ":" + df.getLoginAccount());
                 }
                 fsStoreOrderService.createOmsOrder(orderId);
+                fsStoreOrderLogsService.create(orderId, FsStoreOrderLogEnum.PUSH_ORDER_ERP.getValue(),
+                        nickName + " " +FsStoreOrderLogEnum.PUSH_ORDER_ERP.getDesc() + ":" + df.getLoginAccount());
             } catch (ParseException e) {
                 throw new RuntimeException(e);
             }
@@ -645,6 +679,7 @@ public class FsStoreOrderController extends BaseController
     @PostMapping(value = "/batchSetErpOrder")
     public R batchSetErpOrder(@RequestBody FsStoreOrderSetErpPhoneParam param)
     {
+        String nickName = getLoginUser().getUser().getNickName();
         String loginAccount = param.getLoginAccount();
         if (StringUtils.isBlank(loginAccount)){
             return R.error("未选择erp账户");
@@ -673,6 +708,8 @@ public class FsStoreOrderController extends BaseController
             } else {
                 fsStoreOrderDfService.insertFsStoreOrderDf(df);
             }
+            fsStoreOrderLogsService.create(orderId, FsStoreOrderLogEnum.SET_PUSH_ACCOUNT.getValue(),
+                    nickName + " " +FsStoreOrderLogEnum.SET_PUSH_ACCOUNT.getDesc() + ":" + df.getLoginAccount());
         });
         return R.ok();
     }
@@ -855,6 +892,7 @@ public class FsStoreOrderController extends BaseController
     @PostMapping("/editErpPhone")
     public AjaxResult editErpPhone(@RequestBody FsStoreOrderSetErpPhoneParam param)
     {
+        param.setOpeName(getLoginUser().getUser().getNickName());
         List<String> erpPhone = param.getErpPhone();
         if (erpPhone == null || erpPhone.isEmpty()) {
             return AjaxResult.error("请选择手机号");

+ 28 - 0
fs-admin/src/main/java/com/fs/his/controller/FsUserController.java

@@ -162,6 +162,34 @@ public class FsUserController extends BaseController
         return getDataTable(list);
     }
 
+    @PreAuthorize("@ss.hasPermi('his:user:export')")
+    @GetMapping("/exportListProject")
+    public AjaxResult exportListProject(FsUser fsUser)
+    {
+        if(StringUtils.isNotEmpty(fsUser.getPhone())){
+            fsUser.setPhone(encryptPhone(fsUser.getPhone()));
+        }
+        List<FsUserVO> list = fsUserService.selectFsUserVOListByProject(fsUser);
+        boolean checkPhone = isCheckPhone();
+        for (FsUserVO fsUserVO : list) {
+            if(fsUserVO.getPhone() != null&&fsUserVO.getPhone()!=""){
+                if (!checkPhone){
+                    if (fsUserVO.getPhone().length()>11){
+                        fsUserVO.setPhone(decryptPhoneMk(fsUserVO.getPhone()));
+                    }else {
+                        fsUserVO.setPhone(fsUserVO.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+                    }
+                } else {
+                    if (fsUserVO.getPhone().length()>11) {
+                        fsUserVO.setPhone(decryptPhone(fsUserVO.getPhone()));
+                    }
+                }
+            }
+        }
+        ExcelUtil<FsUserVO> util = new ExcelUtil<FsUserVO>(FsUserVO.class);
+        return util.exportExcel(list, "项目会员数据");
+    }
+
     /**
      * 导出用户列表
      */

+ 2 - 1
fs-company/src/main/java/com/fs/company/controller/store/FsPackageOrderController.java

@@ -235,7 +235,8 @@ public class FsPackageOrderController extends BaseController
     @GetMapping("storeRefund/{orderId}")
     public AjaxResult storeRefund(@PathVariable("orderId") Long orderId)
     {
-        return AjaxResult.success(fsPackageOrderService.PackageStoreOrderRefund(orderId));
+        String nickName = getLoginUser().getUser().getNickName();
+        return AjaxResult.success(fsPackageOrderService.PackageStoreOrderRefund(orderId,nickName));
     }
 
 

+ 1 - 1
fs-company/src/main/java/com/fs/company/controller/store/FsStoreOrderController.java

@@ -390,7 +390,7 @@ public class FsStoreOrderController extends BaseController
         }
         LoginUser loginUser = SecurityUtils.getLoginUser();
         fsStoreOrder.setCompanyId(loginUser.getCompany().getCompanyId());
-        fsStoreOrder.setOperator(loginUser.getUser().getNickName());
+        fsStoreOrder.setOperator("销售端:" + loginUser.getUser().getNickName());
         return toAjax(fsStoreOrderService.afterSales(fsStoreOrder));
     }
 

+ 1 - 2
fs-service/src/main/java/com/fs/course/service/impl/FsUserWatchStatisticsServiceImpl.java

@@ -141,9 +141,8 @@ public class FsUserWatchStatisticsServiceImpl extends ServiceImpl<FsUserWatchSta
         //获取公司的会员数量和今日新增会员数量
         List<FsUserWatchStatistics> userTotal = fsUserMapper.selectFsUserTotal();
         Map<String, FsUserWatchStatistics> userTotalMap;
-        if (userTotal != null && userTotal.size() > 0) {
+        if (userTotal != null && !userTotal.isEmpty()) {
             userTotalMap = userTotal.stream().collect(Collectors.toMap(FsUserWatchStatistics::getCompanyId, Function.identity()));
-
         } else {
             userTotalMap = null;
         }

+ 4 - 3
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -22,6 +22,7 @@ public class FsUser extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 用户id */
+    @Excel(name = "ID", sort = 0)
     private Long userId;
     private String username;
     private String password;
@@ -35,7 +36,7 @@ public class FsUser extends BaseEntity
     private String nickName;
 
     /** 用户头像 */
-    @Excel(name = "用户头像")
+//    @Excel(name = "用户头像")
     private String avatar;
     private String remark;
 
@@ -73,11 +74,11 @@ public class FsUser extends BaseEntity
     private Long tuiUserCount;
 
     /** 微信小程序OPENID */
-    @Excel(name = "微信小程序OPENID")
+//    @Excel(name = "微信小程序OPENID")
     private String maOpenId;
 
     /** 微信公众号OPENID */
-    @Excel(name = "微信公众号OPENID")
+//    @Excel(name = "微信公众号OPENID")
     private String mpOpenId;
 
     /** 关联ID */

+ 6 - 1
fs-service/src/main/java/com/fs/his/enums/FsStoreOrderLogEnum.java

@@ -13,6 +13,7 @@ public enum FsStoreOrderLogEnum {
     REMOVE_ORDER("remove_order","删除订单"),
     EVAL_ORDER("order_eval","用户评价"),
     REFUND_ORDER_APPLY("apply_refund","用户申请退款"),
+    REFUND_ORDER_PLATFORM("REFUND_ORDER_PLATFORM","平台申请退款"),
     REFUND_ORDER_DF("refund_order_df","代服取消订单,申请退款"),
     TAKE_ORDER_DELIVERY("user_take_delivery","用户已收货"),
     PAY_ORDER_SUCCESS("pay_success","用户付款成功"),
@@ -30,7 +31,11 @@ public enum FsStoreOrderLogEnum {
     PLATFORM_REVIEW_SALES("PLATFORM_REVIEW_SALES","平台已审核"),
     WAREHOUSE_REVIEW_SALES("WAREHOUSE_REVIEW_SALES","仓库已审核"),
     FINANCE_REVIEW_SALES("FINANCE_REVIEW_SALES","财务已审核"),
-    PLATFORM_REVIEW_CANCEL("PLATFORM_REVIEW_CANCEL","平台已取消售后");
+    PLATFORM_REVIEW_CANCEL("PLATFORM_REVIEW_CANCEL","平台已取消售后"),
+
+    SET_PUSH_MOBILE("SET_PUSH_MOBILE","设置推送手机号"),
+    SET_PUSH_ACCOUNT("SET_PUSH_ACCOUNT","数据分拣"),
+    PUSH_ORDER_ERP("PUSH_ORDER_ERP","创建ERP");
     private String value;
     private String desc;
 

+ 5 - 0
fs-service/src/main/java/com/fs/his/mapper/FsStoreOrderMapper.java

@@ -1,5 +1,6 @@
 package com.fs.his.mapper;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -1163,4 +1164,8 @@ public interface FsStoreOrderMapper
     Long selectFsStoreOrderListVOByErpAccountByExportCount(@Param("maps")FsStoreOrderParam param);
 
     List<FsStoreOrderErpExportVO> selectFsStoreOrderListErpVOByExport(@Param("maps")FsStoreOrderParam fsStoreOrder);
+
+    Map<String,BigDecimal> selectFsStoreOrderStatistics(@Param("maps") FsStoreOrderParam fsStoreOrder);
+
+    String selectFsStoreOrderProductStatistics(@Param("maps")FsStoreOrderParam fsStoreOrder);
 }

+ 1 - 0
fs-service/src/main/java/com/fs/his/param/FsStoreOrderSetErpPhoneParam.java

@@ -9,4 +9,5 @@ public class FsStoreOrderSetErpPhoneParam extends FsStoreOrderParam{
     private List<String> erpPhone;
     private List<Long> orderIds;
     private String loginAccount;
+    private String opeName; //操作人
 }

+ 1 - 1
fs-service/src/main/java/com/fs/his/service/IFsPackageOrderService.java

@@ -94,7 +94,7 @@ public interface IFsPackageOrderService
 
     Integer PackageInquiryOrderRefund(Long orderId);
 
-    Integer PackageStoreOrderRefund(Long orderId);
+    Integer PackageStoreOrderRefund(Long orderId,String opeName);
 
     R payment(FsPackageOrderDoPayParam param);
 

+ 5 - 0
fs-service/src/main/java/com/fs/his/service/IFsStoreOrderService.java

@@ -1,5 +1,6 @@
 package com.fs.his.service;
 
+import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
@@ -260,4 +261,8 @@ public interface IFsStoreOrderService
     String importOrderStatusData(List<FsStoreOrderStatusExcelVO> list);
 
     Long selectFsStoreOrderListVOByErpAccountByExportCount(FsStoreOrderParam param);
+
+    Map<String,BigDecimal> selectFsStoreOrderStatistics(FsStoreOrderParam fsStoreOrder);
+
+    String selectFsStoreOrderProductStatistics(FsStoreOrderParam fsStoreOrder);
 }

+ 3 - 2
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -846,7 +846,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
     }
 
     @Override
-    public Integer PackageStoreOrderRefund(Long orderId) {
+    public Integer PackageStoreOrderRefund(Long orderId,String opeName) {
         FsPackageOrder fsPackageOrder = fsPackageOrderMapper.selectFsPackageOrderByOrderId(orderId);
         if (fsPackageOrder.getStatus()!=2&&fsPackageOrder.getStatus()!=3){
             throw  new CustomException("非法操作");
@@ -857,6 +857,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         }
         FsStoreOrderSalesParam fsStoreOrderSalesParam = new FsStoreOrderSalesParam();
         fsStoreOrderSalesParam.setOrderId(fsPackageOrder.getStoreOrderId());
+        fsStoreOrderSalesParam.setOperator(opeName);
         return fsStoreOrderService.afterSales(fsStoreOrderSalesParam);
     }
 
@@ -1029,7 +1030,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
             }
         }
         else{
-            return R.error("用户OPENID不存在");
+            return R.error(401,"用户OPENID不存在"); //触发前端重新登录
         }
         return R.error();
     }

+ 2 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStoreAfterSalesServiceImpl.java

@@ -719,6 +719,8 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
         logs.setStoreAfterSalesId(storeAfterSales.getId());
         logs.setChangeMessage(FsStoreAfterSalesStatusEnum.STATUS_0.getDesc());
         fsStoreAfterSalesLogsMapper.insertFsStoreAfterSalesLogs(logs);
+        fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.REFUND_ORDER_APPLY.getValue(),
+                FsStoreOrderLogEnum.REFUND_ORDER_APPLY.getDesc());
         if (order.getExtendOrderId() != null) {
             ErpRefundUpdateRequest request = new ErpRefundUpdateRequest();
             request.setTid(order.getOrderCode());

+ 18 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -1606,6 +1606,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         logs.setCompanyId(fsStoreOrderSalesParam.getCompanyId());
         logs.setChangeMessage("平台提交售后");
         fsStoreAfterSalesLogsMapper.insertFsStoreAfterSalesLogs(logs);
+        //添加订单日志
+        fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.REFUND_ORDER_PLATFORM.getValue(),
+                fsStoreOrderSalesParam.getOperator() + " " +FsStoreOrderLogEnum.REFUND_ORDER_PLATFORM.getDesc());
         //判断是否开启erp
         FsSysConfig sysConfig = configUtil.getSysConfig();
         Integer erpOpen = sysConfig.getErpOpen();
@@ -2311,7 +2314,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
             order.setStatus(4);
             fsStoreOrderMapper.updateFsStoreOrder(order);
             fsStoreOrderLogsService.create(order.getOrderId(), FsStoreOrderLogEnum.FINISH_ORDER.getValue(),
-                    FsStoreOrderLogEnum.FINISH_ORDER.getDesc());
+                    "用户"+FsStoreOrderLogEnum.FINISH_ORDER.getDesc());
             return R.ok("操作成功");
         } else {
             return R.error("非法操作");
@@ -3290,6 +3293,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                 map.put("orderId", orderIds.get(i).toString());
                 map.put("erpPhone", erpPhones.get(i));
                 maps.add(map);
+                fsStoreOrderLogsService.create(orderIds.get(i), FsStoreOrderLogEnum.SET_PUSH_MOBILE.getValue(),
+                        param.getOpeName() + " " +FsStoreOrderLogEnum.SET_PUSH_MOBILE.getDesc() + ":" + erpPhones.get(i));
             }
         } else {
             //2.手机号小于orderIds长度
@@ -3309,6 +3314,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
                     map.put("erpPhone", erpPhone);
                     maps.add(map);
                     orderIndex++;
+                    fsStoreOrderLogsService.create(orderIds.get(i), FsStoreOrderLogEnum.SET_PUSH_MOBILE.getValue(),
+                            param.getOpeName() + " " +FsStoreOrderLogEnum.SET_PUSH_MOBILE.getDesc() + ":" + erpPhone);
                 }
             }
         }
@@ -3688,4 +3695,14 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         return fsStoreOrderMapper.selectFsStoreOrderListVOByErpAccountByExportCount(param);
     }
 
+    @Override
+    public Map<String,BigDecimal> selectFsStoreOrderStatistics(FsStoreOrderParam fsStoreOrder) {
+        return fsStoreOrderMapper.selectFsStoreOrderStatistics(fsStoreOrder);
+    }
+
+    @Override
+    public String selectFsStoreOrderProductStatistics(FsStoreOrderParam fsStoreOrder) {
+        return fsStoreOrderMapper.selectFsStoreOrderProductStatistics(fsStoreOrder);
+    }
+
 }

+ 14 - 0
fs-service/src/main/java/com/fs/his/vo/FsStoreOrderListAndStatisticsVo.java

@@ -0,0 +1,14 @@
+package com.fs.his.vo;
+
+import com.fs.common.core.page.TableDataInfo;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class FsStoreOrderListAndStatisticsVo extends TableDataInfo{
+    private String payPriceTotal;
+    private String payMoneyTotal;
+    private String payRemainTotal;
+    private String productInfo;
+}

+ 1 - 1
fs-service/src/main/resources/application-druid-jnmy-test.yml

@@ -41,7 +41,7 @@ spring:
             druid:
                 # 主库数据源
                 master:
-                    url: jdbc:mysql://120.46.174.121:2345/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    url: jdbc:mysql://120.46.174.121:2345/fs_his_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                     username: root
                     password: Ylrztek250218!3@.
                 # 从库数据源

+ 392 - 0
fs-service/src/main/resources/mapper/his/FsStoreOrderMapper.xml

@@ -1598,5 +1598,397 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LIMIT 30000
 
 
+    </select>
+    <select id="selectFsStoreOrderStatistics" resultType="java.util.Map">
+        select sum(so.pay_price) pay_price,sum(so.pay_money) pay_money,sum(so.pay_remain) pay_remain
+        FROM fs_store_order so LEFT JOIN fs_store st ON so.store_id =st.store_id
+        LEFT JOIN fs_user us ON us.user_id=so.user_id
+        LEFT JOIN fs_prescribe p ON p.prescribe_id =so.prescribe_id
+        LEFT JOIN fs_doctor d ON so.doctor_id= d.doctor_id
+        LEFT JOIN company_user cu on cu.user_id=so.company_user_id
+        LEFT JOIN fs_store_order_df df on df.order_id=so.order_id
+        <where>
+            <if test="maps.packageSecondName != null and maps.packageSecondName != ''">
+                and so.package_second_name like concat('%', #{maps.packageSecondName}, '%')
+            </if>
+            <if test="maps.storeId != null">
+                and so.store_id = #{maps.storeId}
+            </if>
+            <if test="maps.orderCodes != null  and maps.orderCodes.size > 0">
+                and so.order_code in
+                <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
+                    #{orderCode}
+                </foreach>
+            </if>
+            <if test="maps.orderCode != null  and maps.orderCode != ''">
+                and so.order_code = #{maps.orderCode}
+            </if>
+            <if test="maps.prescribeCode != null  and maps.prescribeCode != ''">
+                and p.prescribe_code = #{maps.prescribeCode}
+            </if>
+            <if test="maps.userName != null  and maps.userName != ''">
+                and so.user_name like concat('%', #{maps.userName}, '%')
+            </if>
+            <if test="maps.userPhone != null  and maps.userPhone != ''">
+                and so.user_phone = #{maps.userPhone}
+            </if>
+            <if test="maps.userId != null ">
+                and so.user_id = #{maps.userId}
+            </if>
+            <if test="maps.isFirst != null">
+                and so.is_first = #{maps.isFirst}
+            </if>
+            <if test="maps.status != null and maps.status != 6">
+                and so.status = #{maps.status}
+            </if>
+            <if test="maps.status == 6">
+                and so.`status`= 2
+                and (
+                so.store_id in (select store_id from fs_store where delivery_type=2 or delivery_type=1)
+                )
+                and  (so.extend_order_id is null or  so.extend_order_id like '')
+            </if>
+            <if test="maps.source != null">
+                and so.source = #{maps.source}
+            </if>
+            <if test="maps.deliverySn != null  and maps.deliverySn != ''">
+                and so.delivery_sn = #{maps.deliverySn}
+            </if>
+            <if test="maps.prescribeId != null">
+                and so.prescribe_id = #{maps.prescribeId}
+            </if>
+            <if test="maps.companyUserId != null">
+                and so.company_user_id = #{maps.companyUserId}
+            </if>
+            <if test="maps.sTime != null">
+                and DATE(so.create_time) &gt;= DATE(#{maps.sTime})
+            </if>
+            <if test="maps.eTime != null">
+                and DATE(so.create_time) &lt;= DATE(#{maps.eTime})
+            </if>
+            <if test="maps.paysTime != null">
+                and DATE(so.pay_time) &gt;= DATE(#{maps.paysTime})
+            </if>
+            <if test="maps.payeTime != null">
+                and DATE(so.pay_time) &lt;= DATE(#{maps.payeTime})
+            </if>
+            <if test="maps.orderCreateType != null">
+                and so.order_create_type = #{maps.orderCreateType}
+            </if>
+            <if test="maps.patientName != null">
+                and p.patient_name like concat('%', #{maps.patientName}, '%')
+            </if>
+            <if test="maps.doctorName != null">
+                and d.doctor_name like concat('%', #{maps.doctorName}, '%')
+            </if>
+            <if test="maps.orderType != null">
+                and so.order_type = #{maps.orderType}
+            </if>
+            <if test="maps.deliverySendsTime != null">
+                and DATE(so.delivery_send_time) &gt;= DATE(#{maps.deliverySendsTime})
+            </if>
+            <if test="maps.deliverySendeTime != null">
+                and DATE(so.delivery_send_time) &lt;= DATE(#{maps.deliverySendeTime})
+            </if>
+            <if test="maps.deliveryImportsTime != null">
+                and DATE(so.delivery_import_time) &gt;= DATE(#{maps.deliveryImportsTime})
+            </if>
+            <if test="maps.deliveryImporteTime != null">
+                and DATE(so.delivery_import_time) &lt;= DATE(#{maps.deliveryImporteTime})
+            </if>
+            <if test="maps.tuisTime != null">
+                and DATE(so.tui_money_time) &gt;= DATE(#{maps.tuisTime})
+            </if>
+            <if test="maps.tuieTime != null">
+                and DATE(so.tui_money_time) &lt;= DATE(#{maps.tuieTime})
+            </if>
+            <if test="maps.companyUserNickName != null and  maps.companyUserNickName !=''">
+                and cu.nick_name like concat( #{maps.companyUserNickName}, '%')
+            </if>
+            <if test="maps.companyIds != null and  maps.companyIds.size >0">
+                and so.company_id in
+                <foreach collection="maps.companyIds" item="companyId" open="(" close=")" separator=",">
+                    #{companyId}
+                </foreach>
+            </if>
+            <if test="maps.companyId != null and  maps.companyId != -1">
+                and so.company_id =#{maps.companyId}
+            </if>
+            <if test="maps.companyId == -1">
+                and so.company_id is null
+            </if>
+            <if test="maps.deliveryStatus != null">
+                and so.delivery_status =#{maps.deliveryStatus}
+            </if>
+            <if test="maps.customerId != null">
+                and so.customer_id =#{maps.customerId}
+            </if>
+            <if test="maps.deliveryPayStatus != null">
+                and so.delivery_pay_status =#{maps.deliveryPayStatus}
+            </if>
+            <if test="maps.tuiMoneyStatus != null">
+                and so.tui_money_status =#{maps.tuiMoneyStatus}
+            </if>
+            <if test="maps.deptId != null">
+                AND (so.dept_id = #{maps.deptId} OR so.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
+            </if>
+            <if test="maps.packageName != null and maps.packageName != ''">
+                and so.package_name like concat('%', #{maps.packageName}, '%')
+            </if>
+            <if test="maps.payType != null">
+                and so.pay_type IN
+                <foreach collection="maps.payType.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.scheduleId != null  and  maps.scheduleId != -1">
+                and so.schedule_id IN
+                <foreach collection="maps.scheduleId.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.scheduleId == -1">
+                and so.schedule_id is null
+            </if>
+            <if test="maps.orderBuyType != null and maps.orderBuyType != -1">
+                and so.order_buy_type IN
+                <foreach collection="maps.orderBuyType.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.orderBuyType == -1">
+                and so.order_buy_type is null
+            </if>
+            <if test="maps.orderChannel == -1">
+                and so.order_channel is null
+            </if>
+            <if test="maps.orderChannel != null and maps.orderChannel != -1">
+                and so.order_channel IN
+                <foreach collection="maps.orderChannel.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.qwSubject == -1">
+                and so.qw_subject is null
+            </if>
+            <if test="maps.qwSubject != null and maps.qwSubject != -1">
+                and so.qw_subject IN
+                <foreach collection="maps.qwSubject.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
+                and so.erp_phone like concat(#{maps.erpPhoneNumber},'%')
+            </if>
+            <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
+                and df.login_account like #{maps.erpAccount}
+            </if>
+            <if test="maps.erpAccount == '未分拣'">
+                and ( df.login_account is null or df.login_account like '')
+            </if>
+
+        </where>
+        ${maps.params.dataScope}
+    </select>
+    <select id="selectFsStoreOrderProductStatistics" resultType="java.lang.String">
+        SELECT GROUP_CONCAT(
+        CONCAT(product_name, ':', product_num)
+        ORDER BY product_name
+        SEPARATOR '   '
+        ) AS product_num_list
+        FROM (
+        SELECT sp.product_name,SUM(IF(soi.num IS NULL,0,soi.num)) product_num FROM fs_store_product sp
+        INNER JOIN fs_store_order_item soi ON soi.product_id = sp.product_id
+        INNER JOIN fs_store_order so ON soi.order_id = so.order_id
+        LEFT JOIN fs_user us ON us.user_id=so.user_id
+        LEFT JOIN fs_prescribe p ON p.prescribe_id =so.prescribe_id
+        LEFT JOIN fs_doctor d ON so.doctor_id= d.doctor_id
+        LEFT JOIN company_user cu on cu.user_id=so.company_user_id
+        LEFT JOIN fs_store_order_df df on df.order_id=so.order_id
+        <where>
+            <if test="maps.packageSecondName != null and maps.packageSecondName != ''">
+                and so.package_second_name like concat('%', #{maps.packageSecondName}, '%')
+            </if>
+            <if test="maps.storeId != null">
+                and so.store_id = #{maps.storeId}
+            </if>
+            <if test="maps.orderCodes != null  and maps.orderCodes.size > 0">
+                and so.order_code in
+                <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
+                    #{orderCode}
+                </foreach>
+            </if>
+            <if test="maps.orderCode != null  and maps.orderCode != ''">
+                and so.order_code = #{maps.orderCode}
+            </if>
+            <if test="maps.prescribeCode != null  and maps.prescribeCode != ''">
+                and p.prescribe_code = #{maps.prescribeCode}
+            </if>
+            <if test="maps.userName != null  and maps.userName != ''">
+                and so.user_name like concat('%', #{maps.userName}, '%')
+            </if>
+            <if test="maps.userPhone != null  and maps.userPhone != ''">
+                and so.user_phone = #{maps.userPhone}
+            </if>
+            <if test="maps.userId != null ">
+                and so.user_id = #{maps.userId}
+            </if>
+            <if test="maps.isFirst != null">
+                and so.is_first = #{maps.isFirst}
+            </if>
+            <if test="maps.status != null and maps.status != 6">
+                and so.status = #{maps.status}
+            </if>
+            <if test="maps.status == 6">
+                and so.`status`= 2
+                and (
+                so.store_id in (select store_id from fs_store where delivery_type=2 or delivery_type=1)
+                )
+                and  (so.extend_order_id is null or  so.extend_order_id like '')
+            </if>
+            <if test="maps.source != null">
+                and so.source = #{maps.source}
+            </if>
+            <if test="maps.deliverySn != null  and maps.deliverySn != ''">
+                and so.delivery_sn = #{maps.deliverySn}
+            </if>
+            <if test="maps.prescribeId != null">
+                and so.prescribe_id = #{maps.prescribeId}
+            </if>
+            <if test="maps.companyUserId != null">
+                and so.company_user_id = #{maps.companyUserId}
+            </if>
+            <if test="maps.sTime != null">
+                and DATE(so.create_time) &gt;= DATE(#{maps.sTime})
+            </if>
+            <if test="maps.eTime != null">
+                and DATE(so.create_time) &lt;= DATE(#{maps.eTime})
+            </if>
+            <if test="maps.paysTime != null">
+                and DATE(so.pay_time) &gt;= DATE(#{maps.paysTime})
+            </if>
+            <if test="maps.payeTime != null">
+                and DATE(so.pay_time) &lt;= DATE(#{maps.payeTime})
+            </if>
+            <if test="maps.orderCreateType != null">
+                and so.order_create_type = #{maps.orderCreateType}
+            </if>
+            <if test="maps.patientName != null">
+                and p.patient_name like concat('%', #{maps.patientName}, '%')
+            </if>
+            <if test="maps.doctorName != null">
+                and d.doctor_name like concat('%', #{maps.doctorName}, '%')
+            </if>
+            <if test="maps.orderType != null">
+                and so.order_type = #{maps.orderType}
+            </if>
+            <if test="maps.deliverySendsTime != null">
+                and DATE(so.delivery_send_time) &gt;= DATE(#{maps.deliverySendsTime})
+            </if>
+            <if test="maps.deliverySendeTime != null">
+                and DATE(so.delivery_send_time) &lt;= DATE(#{maps.deliverySendeTime})
+            </if>
+            <if test="maps.deliveryImportsTime != null">
+                and DATE(so.delivery_import_time) &gt;= DATE(#{maps.deliveryImportsTime})
+            </if>
+            <if test="maps.deliveryImporteTime != null">
+                and DATE(so.delivery_import_time) &lt;= DATE(#{maps.deliveryImporteTime})
+            </if>
+            <if test="maps.tuisTime != null">
+                and DATE(so.tui_money_time) &gt;= DATE(#{maps.tuisTime})
+            </if>
+            <if test="maps.tuieTime != null">
+                and DATE(so.tui_money_time) &lt;= DATE(#{maps.tuieTime})
+            </if>
+            <if test="maps.companyUserNickName != null and  maps.companyUserNickName !=''">
+                and cu.nick_name like concat( #{maps.companyUserNickName}, '%')
+            </if>
+            <if test="maps.companyIds != null and  maps.companyIds.size >0">
+                and so.company_id in
+                <foreach collection="maps.companyIds" item="companyId" open="(" close=")" separator=",">
+                    #{companyId}
+                </foreach>
+            </if>
+            <if test="maps.companyId != null and  maps.companyId != -1">
+                and so.company_id =#{maps.companyId}
+            </if>
+            <if test="maps.companyId == -1">
+                and so.company_id is null
+            </if>
+            <if test="maps.deliveryStatus != null">
+                and so.delivery_status =#{maps.deliveryStatus}
+            </if>
+            <if test="maps.customerId != null">
+                and so.customer_id =#{maps.customerId}
+            </if>
+            <if test="maps.deliveryPayStatus != null">
+                and so.delivery_pay_status =#{maps.deliveryPayStatus}
+            </if>
+            <if test="maps.tuiMoneyStatus != null">
+                and so.tui_money_status =#{maps.tuiMoneyStatus}
+            </if>
+            <if test="maps.deptId != null">
+                AND (so.dept_id = #{maps.deptId} OR so.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
+            </if>
+            <if test="maps.packageName != null and maps.packageName != ''">
+                and so.package_name like concat('%', #{maps.packageName}, '%')
+            </if>
+            <if test="maps.payType != null">
+                and so.pay_type IN
+                <foreach collection="maps.payType.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.scheduleId != null  and  maps.scheduleId != -1">
+                and so.schedule_id IN
+                <foreach collection="maps.scheduleId.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.scheduleId == -1">
+                and so.schedule_id is null
+            </if>
+            <if test="maps.orderBuyType != null and maps.orderBuyType != -1">
+                and so.order_buy_type IN
+                <foreach collection="maps.orderBuyType.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.orderBuyType == -1">
+                and so.order_buy_type is null
+            </if>
+            <if test="maps.orderChannel == -1">
+                and so.order_channel is null
+            </if>
+            <if test="maps.orderChannel != null and maps.orderChannel != -1">
+                and so.order_channel IN
+                <foreach collection="maps.orderChannel.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.qwSubject == -1">
+                and so.qw_subject is null
+            </if>
+            <if test="maps.qwSubject != null and maps.qwSubject != -1">
+                and so.qw_subject IN
+                <foreach collection="maps.qwSubject.split(',')" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
+                and so.erp_phone like concat(#{maps.erpPhoneNumber},'%')
+            </if>
+            <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
+                and df.login_account like #{maps.erpAccount}
+            </if>
+            <if test="maps.erpAccount == '未分拣'">
+                and ( df.login_account is null or df.login_account like '')
+            </if>
+
+        </where>
+        ${maps.params.dataScope} GROUP BY sp.product_id
+        ) AS t
+
+
     </select>
 </mapper>

+ 1 - 0
fs-store/src/main/java/com/fs/store/controller/store/FsStoreOrderController.java

@@ -281,6 +281,7 @@ public class FsStoreOrderController extends BaseController
     @PutMapping("/afterSales")
     public AjaxResult afterSales(@RequestBody FsStoreOrderSalesParam fsStoreOrder)
     {
+        fsStoreOrder.setOperator("店铺");
         return toAjax(fsStoreOrderService.afterSales(fsStoreOrder));
     }