Ver Fonte

Merge branch 'master' of http://1.14.104.71:10880/root/ylrz_scrm_java

# Conflicts:
#	fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java
#	fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java
#	fs-service-system/src/main/java/com/fs/company/service/ICompanyUserService.java
caoliqin há 1 semana atrás
pai
commit
488b2bdbed
60 ficheiros alterados com 1023 adições e 109 exclusões
  1. 3 3
      fs-admin/src/main/java/com/fs/course/controller/FsCourseQuestionBankController.java
  2. 21 14
      fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerController.java
  3. 84 0
      fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java
  4. 54 0
      fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderStatisticsController.java
  5. 28 0
      fs-admin/src/main/java/com/fs/store/vo/StoreOrderStatisticsVo.java
  6. 1 1
      fs-admin/src/main/resources/application.yml
  7. 110 4
      fs-company-app/src/main/java/com/fs/app/controller/VoiceApiController.java
  8. 12 0
      fs-company/src/main/java/com/fs/company/controller/CompanyRechargeController.java
  9. 5 0
      fs-company/src/main/java/com/fs/company/controller/CompanyUserController.java
  10. 29 3
      fs-company/src/main/java/com/fs/crm/controller/CrmCustomerController.java
  11. 40 0
      fs-company/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java
  12. 19 27
      fs-company/src/main/java/com/fs/pay/controller/WxPayController.java
  13. 11 0
      fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java
  14. 1 1
      fs-service-system/src/main/java/com/fs/company/mapper/CompanyRechargeOrderMapper.java
  15. 4 0
      fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java
  16. 2 0
      fs-service-system/src/main/java/com/fs/company/service/CompanyRechargeOrderService.java
  17. 8 1
      fs-service-system/src/main/java/com/fs/company/service/ICompanyRechargeService.java
  18. 2 0
      fs-service-system/src/main/java/com/fs/company/service/ICompanyUserService.java
  19. 2 0
      fs-service-system/src/main/java/com/fs/company/service/ICompanyVoiceCallerService.java
  20. 7 3
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyRechargeOrderServiceImpl.java
  21. 7 2
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyRechargeServiceImpl.java
  22. 4 1
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java
  23. 6 0
      fs-service-system/src/main/java/com/fs/company/service/impl/CompanyVoiceCallerServiceImpl.java
  24. 1 1
      fs-service-system/src/main/java/com/fs/course/mapper/FsUserCourseCategoryMapper.java
  25. 2 1
      fs-service-system/src/main/java/com/fs/course/service/IFsCourseQuestionBankService.java
  26. 7 4
      fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseQuestionBankServiceImpl.java
  27. 10 6
      fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomer.java
  28. 28 0
      fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomerLevel.java
  29. 18 0
      fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerLevelMapper.java
  30. 17 5
      fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java
  31. 26 0
      fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelParm.java
  32. 11 0
      fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelQueryParam.java
  33. 4 1
      fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerListQueryParam.java
  34. 3 0
      fs-service-system/src/main/java/com/fs/crm/param/CrmFullCustomerListQueryParam.java
  35. 2 0
      fs-service-system/src/main/java/com/fs/crm/param/CrmLineCustomerListQueryParam.java
  36. 3 0
      fs-service-system/src/main/java/com/fs/crm/param/CrmMyCustomerListQueryParam.java
  37. 3 0
      fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerAssistService.java
  38. 40 0
      fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerLevelService.java
  39. 12 5
      fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerService.java
  40. 9 8
      fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerAssistServiceImpl.java
  41. 102 0
      fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerLevelServiceImpl.java
  42. 72 0
      fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerServiceImpl.java
  43. 23 0
      fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerLevelVO.java
  44. 5 0
      fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerListVO.java
  45. 3 0
      fs-service-system/src/main/java/com/fs/crm/vo/CrmFullCustomerListQueryVO.java
  46. 4 0
      fs-service-system/src/main/java/com/fs/crm/vo/CrmLineCustomerListQueryVO.java
  47. 3 0
      fs-service-system/src/main/java/com/fs/crm/vo/CrmMyCustomerListQueryVO.java
  48. 10 5
      fs-service-system/src/main/java/com/fs/store/mapper/FsStoreOrderMapper.java
  49. 5 0
      fs-service-system/src/main/java/com/fs/store/param/FsStoreOrderParam.java
  50. 26 0
      fs-service-system/src/main/java/com/fs/store/param/FsStoreOrderStatisticsParam.java
  51. 15 0
      fs-service-system/src/main/java/com/fs/store/service/IFsStoreOrderService.java
  52. 10 0
      fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreOrderServiceImpl.java
  53. 5 0
      fs-service-system/src/main/resources/application-config-bly.yml
  54. 2 0
      fs-service-system/src/main/resources/application-config-dev.yml
  55. 2 0
      fs-service-system/src/main/resources/application-dev.yml
  56. 14 0
      fs-service-system/src/main/resources/db/upgrade/20250621客户分级.sql
  57. 17 0
      fs-service-system/src/main/resources/mapper/crm/CrmCustomerLevelMapper.xml
  58. 20 3
      fs-service-system/src/main/resources/mapper/crm/CrmCustomerMapper.xml
  59. 6 10
      fs-service-system/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml
  60. 23 0
      fs-service-system/src/main/resources/mapper/store/FsStoreOrderMapper.xml

+ 3 - 3
fs-admin/src/main/java/com/fs/course/controller/FsCourseQuestionBankController.java

@@ -58,14 +58,15 @@ public class FsCourseQuestionBankController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsCourseQuestionBank fsCourseQuestionBank)
     {
+        List<FsCourseQuestionBankImportDTO> list = fsCourseQuestionBankService.exportData(fsCourseQuestionBank);
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long userId = loginUser.getUser().getUserId();
         fsCourseQuestionBank.setUserId(userId);
-        List<FsCourseQuestionBankImportDTO> list = fsCourseQuestionBankService.exportData(fsCourseQuestionBank);
         ExcelUtil<FsCourseQuestionBankImportDTO> util = new ExcelUtil<>(FsCourseQuestionBankImportDTO.class);
         return util.exportExcel(list, "题库数据");
     }
 
+
     /**
      * 获取题库详细信息
      */
@@ -126,9 +127,8 @@ public class FsCourseQuestionBankController extends BaseController
     public AjaxResult importData(MultipartFile file) throws Exception {
         ExcelUtil<FsCourseQuestionBankImportDTO> util = new ExcelUtil<>(FsCourseQuestionBankImportDTO.class);
         List<FsCourseQuestionBankImportDTO> list = util.importExcel(file.getInputStream());
-
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        String message = fsCourseQuestionBankService.importData(list, loginUser.getUser().getNickName(), loginUser.getUser().getUserId());
+        String message = fsCourseQuestionBankService.importData(list, loginUser.getUser().getNickName(),loginUser.getUser().getUserId());
         return AjaxResult.success(message);
     }
 

+ 21 - 14
fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerController.java

@@ -1,35 +1,35 @@
 package com.fs.crm.controller;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
+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.OrderUtils;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.Company;
 import com.fs.company.service.ICompanyService;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
+import com.fs.crm.domain.CrmCustomer;
 import com.fs.crm.param.*;
-import com.fs.crm.vo.CrmCustomerListVO;
+import com.fs.crm.service.ICrmCustomerService;
 import com.fs.crm.vo.CrmCustomerExportVO;
-import com.fs.store.vo.FsStoreOrderVO;
+import com.fs.crm.vo.CrmCustomerListVO;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
 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 com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.enums.BusinessType;
-import com.fs.crm.domain.CrmCustomer;
-import com.fs.crm.service.ICrmCustomerService;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.common.core.page.TableDataInfo;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 客户Controller
  *
@@ -282,5 +282,12 @@ public class CrmCustomerController extends BaseController
         return R.ok().put("data",customerList);
     }
 
+    @ApiOperation("置顶切换")
+    @PreAuthorize("@ss.hasPermi('crm:customer:switchToTop')")
+    @PostMapping("/switchToTop/{customerId}")
+    public R switchToTop(@PathVariable Long customerId) {
+        crmCustomerService.switchToTop(customerId);
+        return R.ok();
+    }
 
 }

+ 84 - 0
fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java

@@ -0,0 +1,84 @@
+package com.fs.crm.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+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.crm.domain.CrmCustomerLevel;
+import com.fs.crm.param.CrmCustomerLevelParm;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.service.ICrmCustomerLevelService;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+import com.fs.his.vo.OptionsVO;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/crm/customerLevel")
+@AllArgsConstructor
+public class CrmCustomerLevelController extends BaseController {
+
+    private final ICrmCustomerLevelService customerLevelService;
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CrmCustomerLevelQueryParam param) {
+        startPage();
+        List<CrmCustomerLevelVO> list = customerLevelService.selectCrmCustomerLevelVOList(param);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:add')")
+    @Log(title = "客户级别", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    public AjaxResult add(@Valid @RequestBody CrmCustomerLevelParm param) {
+        return toAjax(customerLevelService.saveCustomerLevel(param));
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:edit')")
+    @Log(title = "客户级别", businessType = BusinessType.UPDATE)
+    @PutMapping("/edit")
+    public AjaxResult edit(@Valid @RequestBody CrmCustomerLevelParm param) {
+        return toAjax(customerLevelService.editCustomerLevel(param));
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable Long id) {
+        return AjaxResult.success(customerLevelService.selectCrmCustomerLevelVOById(id));
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:delete')")
+    @Log(title = "客户", businessType = BusinessType.DELETE)
+    @DeleteMapping("/delete/{ids}")
+    public AjaxResult delete(@PathVariable Long[] ids) {
+        customerLevelService.removeByIds(Arrays.asList(ids));
+        return AjaxResult.success();
+    }
+
+    @GetMapping("/getCustomerLevelOption")
+    public R getCustomerLevelOption(Integer status) {
+        LambdaQueryWrapper<CrmCustomerLevel> wrapper = Wrappers.lambdaQuery();
+        if (Objects.nonNull(status)) {
+            wrapper.eq(CrmCustomerLevel::getStatus, status);
+        }
+        List<OptionsVO> options = customerLevelService.list(wrapper).stream().map(l -> {
+            OptionsVO vo = new OptionsVO();
+            vo.setDictLabel(l.getName());
+            vo.setDictValue(l.getId());
+            return vo;
+        }).collect(Collectors.toList());
+        return R.ok().put("data", options);
+    }
+}

+ 54 - 0
fs-admin/src/main/java/com/fs/store/controller/FsStoreOrderStatisticsController.java

@@ -0,0 +1,54 @@
+package com.fs.store.controller;
+
+import com.baomidou.mybatisplus.extension.api.R;
+import com.fs.store.param.FsStoreOrderStatisticsParam;
+import com.fs.store.service.IFsStoreOrderService;
+import com.fs.store.vo.StoreOrderStatisticsVo;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+
+
+@RestController
+@RequestMapping("/store/storeOrder/statistics")
+public class FsStoreOrderStatisticsController {
+
+    @Autowired
+    private IFsStoreOrderService storeOrderService;
+
+    @ApiOperation("订单统计")
+    @GetMapping("/getStoreOrderStatistics")
+    public R getStoreOrderStatistics(FsStoreOrderStatisticsParam param)
+    {
+        Integer orderCount = storeOrderService.selectFsStoreOrderCount(param);
+        param.setPaid(1);
+        //实际支付金额
+        BigDecimal totalAmount = storeOrderService.selectFsStoreOrderByPayPriceCount(param);
+        //已支付的总订单数
+        Integer orderPayCount = storeOrderService.selectFsStoreOrderCount(param);
+        //已完成订单
+        param.setStatus(5);
+        Integer orderCompleteCount = storeOrderService.selectFsStoreOrderCount(param);
+        //退货成功订单
+        param.setStatus(-2);
+        Integer orderReturnCount = storeOrderService.selectFsStoreOrderCount(param);
+        //成交率
+        int successRate = 0;
+        //退货率
+        int returnRate = 0;
+        if (orderPayCount != null && orderPayCount != 0) {
+            successRate = (int) Math.round((orderCompleteCount != null ? orderCompleteCount : 0) * 100.0 / orderPayCount);
+            returnRate = (int) Math.round((orderReturnCount != null ? orderReturnCount : 0) * 100.0 / orderPayCount);
+        }
+        StoreOrderStatisticsVo storeOrderStatisticsVo = new StoreOrderStatisticsVo();
+        storeOrderStatisticsVo.setOrderCount(orderCount);
+        storeOrderStatisticsVo.setTotalAmount(totalAmount);
+        storeOrderStatisticsVo.setSuccessRate(successRate);
+        storeOrderStatisticsVo.setReturnRate(returnRate);
+        return R.ok(storeOrderStatisticsVo);
+    }
+}

+ 28 - 0
fs-admin/src/main/java/com/fs/store/vo/StoreOrderStatisticsVo.java

@@ -0,0 +1,28 @@
+package com.fs.store.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class StoreOrderStatisticsVo {
+    /**
+     * 订单总量
+     */
+    Integer orderCount;
+
+    /**
+     * 总金额
+     */
+    BigDecimal totalAmount;
+
+    /**
+     * 成交率
+     */
+    Integer successRate;
+
+    /**
+     * 退货率
+     */
+    Integer returnRate;
+}

+ 1 - 1
fs-admin/src/main/resources/application.yml

@@ -5,7 +5,7 @@ server:
   port: 7011
 spring:
   profiles:
-    active: druid-bly-test
+    active: dev
 #    include: common,config-bly
 #    active: druid-fby
 #    include: common,config-fby

+ 110 - 4
fs-company-app/src/main/java/com/fs/app/controller/VoiceApiController.java

@@ -15,11 +15,12 @@ import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
-import com.fs.company.domain.CompanyUser;
-import com.fs.company.domain.CompanyVoiceApi;
-import com.fs.company.domain.CompanyVoiceLogs;
-import com.fs.company.domain.CompanyVoiceMobile;
+import com.fs.company.domain.*;
 import com.fs.company.service.*;
+import com.fs.crm.domain.CrmCustomer;
+import com.fs.crm.domain.CrmCustomerContacts;
+import com.fs.crm.service.ICrmCustomerContactsService;
+import com.fs.crm.service.ICrmCustomerService;
 import com.fs.system.oss.CloudStorageService;
 import com.fs.system.oss.OSSFactory;
 import com.fs.voice.service.IVoiceService;
@@ -72,6 +73,28 @@ public class VoiceApiController extends AppBaseController {
     private ICompanyVoiceService companyVoiceService;
     @Autowired
     private ICompanyVoiceMobileService companyVoiceMobileService;
+
+    @Autowired
+    private ICompanyVoiceCallerService callerService;
+
+    @Autowired
+    private ICompanyService companyService;
+
+    @Autowired
+    private ICompanyUserService userService;
+
+    @Autowired
+    private ICrmCustomerService crmService;
+
+    @Autowired
+    private ICrmCustomerContactsService crmContactsService;
+
+    @Autowired
+    private ICompanyVoiceBlacklistService blacklistService;
+
+    @Autowired
+    ICompanyVoiceLogsService logsService;
+
     @Autowired
     JwtUtils jwtUtils;
     @Login
@@ -154,6 +177,31 @@ public class VoiceApiController extends AppBaseController {
                 logs.setStatus(-1);
                 companyVoiceLogsService.updateCompanyVoiceLogs(logs);
             }
+        }else{
+            JSONObject callObj=JSON.parseObject(json);
+            JSONObject notifyObj=callObj.getJSONObject("notify");
+            String type=notifyObj.getString("type");
+            String session=notifyObj.getString("session");
+            String callee=notifyObj.getString("agent");//被叫/坐席号
+            String caller=notifyObj.getString("number");//主叫
+            if(type.contentEquals("callin")){   //回拨接听
+                CompanyVoiceCaller callerEE=callerService.selectCompanyVoiceCallerByCallerNo(callee);
+                CrmCustomer customer=crmService.selectFscrmByMobile(caller);
+                Long customerId=0L;
+                if(customer!=null){
+                    customerId=customer.getCustomerId();
+                }
+                else{
+                    CrmCustomerContacts contactsMap=new CrmCustomerContacts();
+                    contactsMap.setMobile(caller);
+                    List<CrmCustomerContacts>  contactsList=crmContactsService.selectCrmCustomerContactsList(contactsMap);
+                    if(contactsList.size()>0){
+                        CrmCustomerContacts contacts=contactsList.get(0);
+                        customerId=contacts.getCustomerId();
+                    }
+                }
+                callInAction(callerEE.getCompanyId(),customerId,callerEE.getCompanyUserId(),session,caller,callerEE);
+            }
         }
         CallResult result=new CallResult();
         result.setMsg("");
@@ -161,6 +209,64 @@ public class VoiceApiController extends AppBaseController {
         return result;
     }
 
+    private  R callInAction(Long companyId, Long customerId, Long userId,String session,String caller,CompanyVoiceCaller callerEE){
+        //查询主叫号是不是坐席 查询主叫号是否已过期
+        Company company=companyService.selectCompanyById(companyId);
+        if(company.getStatus()==0){
+            return R.error("公司已停用");
+        }
+        if(company.getVoiceApiId()==null){
+            return R.error("未配置外呼接口");
+        }
+        CompanyVoiceApi api=companyVoiceApiService.selectCompanyVoiceApiById(company.getVoiceApiId());
+        if(api==null){
+            return R.error("外呼接口不存在");
+        }
+        if(api.getStatus().equals(0)){
+            return R.error("外呼接口已禁用");
+        }
+        CompanyUser user=userService.selectCompanyUserById(userId);
+        //CompanyVoiceCaller voiceCaller=callerService.selectCompanyVoiceCallerByUserId(companyId,userId);
+        CompanyVoice companyVoice=companyVoiceService.selectCompanyVoiceByCompanyId(user.getCompanyId());
+        if(callerEE==null){
+            return R.error("未绑定坐席");
+        }
+        if(companyVoice.getTimes()<=0){
+            return R.error("剩余时长不足,请购买套餐");
+        }
+
+//      CompanyVoiceMobile voiceMobile=mobileService.selectEmptyCompanyVoiceMobile(companyId,api.getApiId());
+//      if(voiceMobile==null){
+//           return R.error("没有空闲号码");
+//      }
+
+        //黑名单处理
+        if(blacklistService.selectCompanyVoiceBlacklistByMobile(caller)>0){
+            return R.error("主叫号码已被设置为黑名单");
+        }
+        //写入SESSION
+        CompanyVoiceLogs logs=new CompanyVoiceLogs();
+        logs.setCompanyId(companyId);
+        logs.setVoiceTitle(caller+"回拨:"+user.getNickName());
+        logs.setStartTime(new Date());
+        logs.setVoiceType(1);
+        logs.setCalleePhone(callerEE.getMobile());
+        logs.setCallerPhone(caller);
+        logs.setDisplayCalleeNumber(callerEE.getMobile());
+        logs.setDisplayCallerNumber(caller);
+        logs.setRemark(caller +"回拨呼叫"+user.getNickName());
+        logs.setCompanyUserId(userId);
+        logs.setCustomerId(customerId);
+        logs.setApiId(api.getApiId());
+        logs.setSessionId(session);
+        logs.setCallerNo(caller);
+        logsService.insertCompanyVoiceLogs(logs);
+//        voiceMobile.setStatus(0);
+//        mobileService.updateCompanyVoiceMobile(voiceMobile);
+        return R.ok();
+
+    }
+
     @Login
     @ApiOperation("获取SIP")
     @GetMapping(value="/getSipAccount")

+ 12 - 0
fs-company/src/main/java/com/fs/company/controller/CompanyRechargeController.java

@@ -21,6 +21,7 @@ import com.fs.company.service.ICompanyService;
 import com.fs.company.vo.CompanyRechargeVO;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
+import com.tencentcloudapi.organization.v20181225.OrganizationErrorCode;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
@@ -97,6 +98,17 @@ public class CompanyRechargeController extends BaseController
         return AjaxResult.success(companyRechargeOrder);
     }
 
+    /**
+     * 查询订单
+     * @param orderNo 订单号
+     * @return AjaxResult
+     */
+    @GetMapping("/queryOrder")
+    public AjaxResult queryOrder(@RequestParam("orderNo") String orderNo) {
+        CompanyRechargeOrder order = companyRechargeService.queryOrder(orderNo);
+
+        return AjaxResult.success(order);
+    }
 
 
     /**

+ 5 - 0
fs-company/src/main/java/com/fs/company/controller/CompanyUserController.java

@@ -355,6 +355,11 @@ public class CompanyUserController extends BaseController {
             return AjaxResult.error("操作失败");
         }
     }
+    @PutMapping("/updateVolume")
+    public AjaxResult updateVolume(@RequestBody CompanyUser user) {
+        user.setUpdateBy(SecurityUtils.getUsername());
+        return toAjax(companyUserService.updateVolume(user));
+    }
 
     @Log(title = "是否允许所有方式注册会员", businessType = BusinessType.UPDATE)
     @PutMapping("/allowedAllRegister")

+ 29 - 3
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerController.java

@@ -13,12 +13,14 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyUserService;
+import com.fs.crm.domain.CrmCustomerContacts;
 import com.fs.crm.param.CrmCompanyLineCustomerImportParam;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
 import com.fs.crm.domain.CrmCustomer;
 import com.fs.crm.param.*;
 import com.fs.crm.service.ICrmCustomerAssistService;
+import com.fs.crm.service.ICrmCustomerContactsService;
 import com.fs.crm.service.ICrmCustomerService;
 import com.fs.crm.service.ICrmCustomerUserService;
 import com.fs.crm.service.impl.CrmCustomerAssistServiceImpl;
@@ -55,8 +57,7 @@ public class CrmCustomerController extends BaseController
     @Autowired
     ICrmCustomerUserService crmCustomerUserService;
     @Autowired
-    private ICrmCustomerAssistService crmCustomerAssistService;
-
+    private ICrmCustomerContactsService crmContactsService;
     @ApiOperation("获取线索客户")
     @PreAuthorize("@ss.hasPermi('crm:customer:lineList')")
     @GetMapping("/getLineCustomerList")
@@ -249,7 +250,7 @@ public class CrmCustomerController extends BaseController
         }
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId(loginUser.getCompany().getCompanyId());
-        return crmCustomerAssistService.assistToUser(loginUser.getUsername(),loginUser.getUser().getUserId(),param);
+        return crmCustomerService.assistToUser(loginUser.getUsername(),loginUser.getUser().getUserId(),param);
     }
 
 
@@ -453,4 +454,29 @@ public class CrmCustomerController extends BaseController
         return R.ok().put("data",list);
     }
 
+    @ApiOperation("置顶切换")
+    @PreAuthorize("@ss.hasPermi('crm:customer:switchToTop')")
+    @PostMapping("/switchToTop/{customerId}")
+    public R switchToTop(@PathVariable Long customerId) {
+        crmCustomerService.switchToTop(customerId);
+        return R.ok();
+    }
+    @PreAuthorize("@ss.hasPermi('crm:customer:query2')")
+    @GetMapping(value = "/getInfoByMobile/{mobile}")
+    public R getInfoByMobile(@PathVariable("mobile") String mobile)
+    {
+        CrmCustomer customer=crmCustomerService.selectFscrmByMobile(mobile);
+        Long customerId=0L;
+        if(customer==null){
+            CrmCustomerContacts contactsMap=new CrmCustomerContacts();
+            contactsMap.setMobile(mobile);
+            List<CrmCustomerContacts>  contactsList=crmContactsService.selectCrmCustomerContactsList(contactsMap);
+            if(contactsList.size()>0){
+                CrmCustomerContacts contacts=contactsList.get(0);
+                customerId=contacts.getCustomerId();
+                customer=crmCustomerService.selectCrmCustomerById(customerId);
+            }
+        }
+        return R.ok().put("data",customer);
+    }
 }

+ 40 - 0
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java

@@ -0,0 +1,40 @@
+package com.fs.crm.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.service.ICrmCustomerLevelService;
+import com.fs.his.vo.OptionsVO;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/crm/customerLevel")
+@AllArgsConstructor
+public class CrmCustomerLevelController extends BaseController {
+
+    private final ICrmCustomerLevelService customerLevelService;
+
+    @GetMapping("/getCustomerLevelOption")
+    public R getCustomerLevelOption(Integer status) {
+        LambdaQueryWrapper<CrmCustomerLevel> wrapper = Wrappers.lambdaQuery();
+        if (Objects.nonNull(status)) {
+            wrapper.eq(CrmCustomerLevel::getStatus, status);
+        }
+        List<OptionsVO> options = customerLevelService.list(wrapper).stream().map(l -> {
+            OptionsVO vo = new OptionsVO();
+            vo.setDictLabel(l.getName());
+            vo.setDictValue(l.getId());
+            return vo;
+        }).collect(Collectors.toList());
+        return R.ok().put("data", options);
+    }
+}

+ 19 - 27
fs-company/src/main/java/com/fs/pay/controller/WxPayController.java

@@ -7,6 +7,8 @@ import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyRecharge;
 import com.fs.company.service.ICompanyRechargeService;
 import com.fs.pay.bean.WxPayBean;
+import com.fs.wx.pay.config.WxPayProperties;
+import com.github.binarywang.wxpay.util.SignUtils;
 import com.ijpay.core.enums.SignType;
 import com.ijpay.core.enums.TradeType;
 import com.ijpay.core.kit.HttpKit;
@@ -45,6 +47,8 @@ public class WxPayController extends WxPayApiController {
     @Autowired
     ICompanyRechargeService rechargeService;
 
+    @Autowired
+    private WxPayProperties wxPayProperties;
 
 
     @Override
@@ -151,40 +155,28 @@ public class WxPayController extends WxPayApiController {
         Map<String, String> params = WxPayKit.xmlToMap(xmlMsg);
         String returnCode = params.get("return_code");
         // 微信支付订单号
-        String transaction_id      = params.get("transaction_id");
+        String transaction_id = params.get("transaction_id");
         // 商户订单号
-        String out_trade_no      = params.get("out_trade_no");
+        String out_trade_no = params.get("out_trade_no");
         // 注意重复通知的情况,同一订单号可能收到多次通知,请注意一定先判断订单状态
-        // 注意此处签名方式需与统一下单的签名类型一致
-        if (WxPayKit.verifyNotify(params, WxPayApiConfigKit.getWxPayApiConfig().getPartnerKey(), SignType.HMACSHA256)) {
+        // 注意此处签名方式需与统一下单的签名类型一致1
+        if (SignUtils.checkSign(params, String.valueOf(SignType.HMACSHA256), wxPayProperties.getMchKey())) {
             if (WxPayKit.codeIsOk(returnCode)) {
                 // 更新订单信息
                 // 发送通知等
                 String[] order=out_trade_no.split("-");
                 R r;
-                switch (order[0]){
-                    case "recharge":
-                        CompanyRecharge recharge=rechargeService.selectCompanyRechargeByNo(order[1]);
-
-                        if(recharge!=null&&recharge.getStatus()==1){
-                            Map<String, String> xml = new HashMap<String, String>(2);
-                            xml.put("return_code", "SUCCESS");
-                            xml.put("return_msg", "OK");
-                            return WxPayKit.toXml(xml);
-                        }
-                        recharge.setTradeNo(transaction_id);
-                        r= rechargeService.payNotify(recharge);
-                        if(r.get("code").equals(200)){
-                            Map<String, String> xml = new HashMap<String, String>(2);
-                            xml.put("return_code", "SUCCESS");
-                            xml.put("return_msg", "OK");
-                            return WxPayKit.toXml(xml);
-
-                        }
-                        else {
-                            return null;
-                        }
-
+                if (order[0].equals("recharge")) {
+                    r = rechargeService.payNotify(order[1],transaction_id);
+                    if (r.get("code").equals(200)) {
+                        Map<String, String> xml = new HashMap<String, String>(2);
+                        xml.put("return_code", "SUCCESS");
+                        xml.put("return_msg", "OK");
+                        return WxPayKit.toXml(xml);
+
+                    } else {
+                        return null;
+                    }
                 }
             }
         }

+ 11 - 0
fs-service-system/src/main/java/com/fs/company/domain/CompanyUser.java

@@ -132,6 +132,10 @@ public class CompanyUser extends BaseEntity
 
     private Integer qwStatus;
 
+    /** 音量 */
+    private double volume;
+
+
     /** 用户上级id */
     private Long parentId;
 
@@ -147,6 +151,13 @@ public class CompanyUser extends BaseEntity
     /** 是否允许所有方式注册会员,1-是,0-否,默认1(用于个微注册会员) */
     private Integer isAllowedAllRegister;
 
+    public double getVolume() {
+        return volume;
+    }
+
+    public void setVolume(double volume) {
+        this.volume = volume;
+    }
     public Integer getIsAudit() {
         return isAudit;
     }

+ 1 - 1
fs-service-system/src/main/java/com/fs/company/mapper/CompanyRechargeOrderMapper.java

@@ -68,7 +68,7 @@ public interface CompanyRechargeOrderMapper {
     int updatePayStatus(CompanyRechargeOrder order);
 
     @Select("SELECT * FROM company_recharge_order " +
-            "WHERE pay_status = 0 " +
+            "WHERE pay_status = 1 " +
             "AND create_time <= DATE_SUB(NOW(), INTERVAL 2 HOUR)")
     List<CompanyRechargeOrder> queryOverdueOrder();
 }

+ 4 - 0
fs-service-system/src/main/java/com/fs/company/mapper/CompanyUserMapper.java

@@ -292,6 +292,10 @@ public interface CompanyUserMapper
 
     List<String> selectCompanyUserNameByIds(@Param("companyUserIDs")List<Long> companyUserID);
 
+
+    @Update(" update company_user set volume=#{maps.volume} where user_id=#{maps.userId} ")
+    public int updateVolume(@Param("maps") CompanyUser user);
+
     int updateAllowedAllRegister(@Param("status") boolean status, @Param("userIds")List<Long> userIds);
 
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/company/service/CompanyRechargeOrderService.java

@@ -11,4 +11,6 @@ public interface CompanyRechargeOrderService {
     void autoClosedOrder();
 
     CompanyRechargeOrder createOrder(CompanyRechargeOrder order) throws Exception;
+
+    CompanyRechargeOrder queryOrder(String orderNo);
 }

+ 8 - 1
fs-service-system/src/main/java/com/fs/company/service/ICompanyRechargeService.java

@@ -72,7 +72,7 @@ public interface ICompanyRechargeService
     CompanyRecharge selectCompanyRechargeByNo(String s);
 
     R payNotify(CompanyRecharge recharge);
-    R payNotify(String orderNo);
+    R payNotify(String orderNo,String transactionId);
 
     BigDecimal selectCompanyRechargeMoney();
 
@@ -90,4 +90,11 @@ public interface ICompanyRechargeService
      * @return 地址
      */
     CompanyRechargeOrder recharge(RechargeDTO dto) throws Exception;
+
+    /**
+     * 查询订单
+     * @param orderNo 订单号
+     * @return CompanyRechargeOrder
+     */
+    CompanyRechargeOrder queryOrder(String orderNo);
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/company/service/ICompanyUserService.java

@@ -204,6 +204,8 @@ public interface ICompanyUserService {
      */
     Boolean setIsRegisterMember(boolean status,  List<Long> userIds);
 
+    int updateVolume(CompanyUser user);
+
     /**
      * 批量设置是否允许所有方式注册会员
      * @param status 开/关

+ 2 - 0
fs-service-system/src/main/java/com/fs/company/service/ICompanyVoiceCallerService.java

@@ -73,4 +73,6 @@ public interface ICompanyVoiceCallerService
     List<CompanyVoiceCaller> selectCompanyVoiceCallerByEnable(Long callerLine);
 
     Integer selectCompanyVoiceCallerCountsByCompanyId(Long companyId);
+
+    CompanyVoiceCaller selectCompanyVoiceCallerByCallerNo(String callee);
 }

+ 7 - 3
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyRechargeOrderServiceImpl.java

@@ -67,9 +67,9 @@ public class CompanyRechargeOrderServiceImpl implements CompanyRechargeOrderServ
         wxPayService.setConfig(payConfig);
 
         WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
-
+        String orderNo = OrderUtils.getOrderNo();
         orderRequest.setBody("公司余额充值");
-        orderRequest.setOutTradeNo("recharge-"+OrderUtils.getOrderNo());
+        orderRequest.setOutTradeNo("recharge-"+orderNo);
         orderRequest.setTotalFee(order.getPayAmount().multiply(BigDecimal.valueOf(100)).intValue());
         orderRequest.setSpbillCreateIp(IpUtil.getLocalhostIp());
         orderRequest.setNotifyUrl(wxPayProperties.getNativeNotifyUrl());
@@ -80,7 +80,7 @@ public class CompanyRechargeOrderServiceImpl implements CompanyRechargeOrderServ
         WxPayNativeOrderResult wxOrder = wxPayService.createOrder(orderRequest);
 
 
-        order.setOrderNo(OrderUtils.getOrderNo());
+        order.setOrderNo(orderNo);
         order.setPayType(1);
         order.setPayStatus(1);
         order.setCreateTime(LocalDateTime.now());
@@ -92,6 +92,10 @@ public class CompanyRechargeOrderServiceImpl implements CompanyRechargeOrderServ
         return order;
     }
 
+    @Override
+    public CompanyRechargeOrder queryOrder(String orderNo) {
+        return companyRechargeOrderMapper.selectByOrderNo(orderNo);
+    }
 
 
 }

+ 7 - 2
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyRechargeServiceImpl.java

@@ -153,15 +153,15 @@ public class CompanyRechargeServiceImpl implements ICompanyRechargeService
     private CompanyRechargeOrderMapper companyRechargeOrderMapper;
 
     @Override
-    public R payNotify(String orderNo) {
+    public R payNotify(String orderNo,String transactionId) {
         CompanyRechargeOrder order = companyRechargeOrderMapper.selectByOrderNo(orderNo);
 
         //修改状态
         order.setPayStatus(PaymentStatus.SUCCESS.getCode());
+        order.setTransactionId(transactionId);
         companyRechargeOrderMapper.updateByOrderNo(order);
 
         Company company=companyMapper.selectCompanyByIdForUpdate(order.getCompanyId());
-        company.setMoney(company.getMoney().add(order.getPayAmount()));
         //写入日志
         CompanyMoneyLogs log=new CompanyMoneyLogs();
         log.setCompanyId(order.getCompanyId());
@@ -196,4 +196,9 @@ public class CompanyRechargeServiceImpl implements ICompanyRechargeService
         order.setUserId(dto.getUserId());
         return companyRechargeOrderService.createOrder(order);
     }
+
+    @Override
+    public CompanyRechargeOrder queryOrder(String orderNo) {
+        return companyRechargeOrderService.queryOrder(orderNo);
+    }
 }

+ 4 - 1
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -555,5 +555,8 @@ public class CompanyUserServiceImpl implements ICompanyUserService
     public List<CompanyUser> getCompanyUserListByCompanyIdAndDeptId(Long companyId, Long deptId) {
         return companyUserMapper.selectAllCompanyUserByCompanyIdAndDeptId(companyId, deptId);
     }
-
+    @Override
+    public int updateVolume(CompanyUser user){
+        return companyUserMapper.updateVolume(user);
+    }
 }

+ 6 - 0
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyVoiceCallerServiceImpl.java

@@ -190,4 +190,10 @@ public class CompanyVoiceCallerServiceImpl implements ICompanyVoiceCallerService
     public Integer selectCompanyVoiceCallerCountsByCompanyId(Long companyId) {
         return companyVoiceCallerMapper.selectCompanyVoiceCallerCountsByCompanyId(companyId);
     }
+
+    @Override
+    public CompanyVoiceCaller selectCompanyVoiceCallerByCallerNo(String callerNo) {
+        return companyVoiceCallerMapper.selectCompanyVoiceCallerByCallerNo(callerNo);
+    }
+
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/course/mapper/FsUserCourseCategoryMapper.java

@@ -86,7 +86,7 @@ public interface FsUserCourseCategoryMapper
      * 查询所有分类
      * @return
      */
-    @Select("select cate_id,cate_name, pid from fs_user_course_category where is_del=0")
+    @Select("select cate_id as cateId, cate_name as cateName, pid from fs_user_course_category where is_del=0")
     @MapKey("cateName")
     Map<String,FsUserCourseCategory> queryAllCategoryData();
 

+ 2 - 1
fs-service-system/src/main/java/com/fs/course/service/IFsCourseQuestionBankService.java

@@ -79,9 +79,10 @@ public interface IFsCourseQuestionBankService
      *
      * @param list     数据
      * @param nickName 昵称
+     * @param userId
      * @return String
      */
-    String importData(List<FsCourseQuestionBankImportDTO> list, String nickName,Long userId);
+    String importData(List<FsCourseQuestionBankImportDTO> list, String nickName, Long userId);
 
     /**
      * 根据ID查询题目

+ 7 - 4
fs-service-system/src/main/java/com/fs/course/service/impl/FsCourseQuestionBankServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.validation.constraints.Size;
 import java.util.*;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
@@ -368,10 +369,11 @@ public class FsCourseQuestionBankServiceImpl implements IFsCourseQuestionBankSer
      *
      * @param list     数据
      * @param nickName 昵称
+     * @param userId
      * @return String
      */
     @Override
-    public String importData(List<FsCourseQuestionBankImportDTO> list, String nickName,Long userId) {
+    public String importData(List<FsCourseQuestionBankImportDTO> list, @Size String nickName, Long userId) {
         if (Objects.isNull(list) || list.isEmpty()) {
             throw new ServiceException("导入数据不能为空");
         }
@@ -390,8 +392,7 @@ public class FsCourseQuestionBankServiceImpl implements IFsCourseQuestionBankSer
                 }
 
                 // 构建题目对象
-                FsCourseQuestionBank questionBank = buildQuestionBank(importDTO, categoryData, nickName);
-                questionBank.setUserId(userId);
+                FsCourseQuestionBank questionBank = buildQuestionBank(importDTO, categoryData, nickName,userId);
                 importData.add(questionBank);
                 result.addSuccess(importDTO.getTitle());
 
@@ -408,6 +409,7 @@ public class FsCourseQuestionBankServiceImpl implements IFsCourseQuestionBankSer
         return result.buildResultMessage();
     }
 
+
     /**
      * 验证导入数据
      */
@@ -498,11 +500,12 @@ public class FsCourseQuestionBankServiceImpl implements IFsCourseQuestionBankSer
      */
     private FsCourseQuestionBank buildQuestionBank(FsCourseQuestionBankImportDTO importDTO,
                                                    Map<String, FsUserCourseCategory> categoryData,
-                                                   String nickName) {
+                                                   String nickName, Long userId) {
         FsCourseQuestionBank questionBank = new FsCourseQuestionBank();
 
         // 基础信息
         questionBank.setTitle(importDTO.getTitle());
+        questionBank.setUserId(userId);
         questionBank.setType(getQuestionTypeCode(importDTO.getType()));
         questionBank.setSort(importDTO.getSort());
         questionBank.setStatus(parseStatus(importDTO.getStatus()));

+ 10 - 6
fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomer.java

@@ -1,16 +1,13 @@
 package com.fs.crm.domain;
 
-import java.math.BigDecimal;
-import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
+import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 客户对象 crm_customer
@@ -177,5 +174,12 @@ public class CrmCustomer extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date visitTime;
 
-
+    /**
+     * 客户级别
+     */
+    private Long customerLevel;
+    /**
+     * 是否置顶
+     */
+    private Integer isTop;
 }

+ 28 - 0
fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomerLevel.java

@@ -0,0 +1,28 @@
+package com.fs.crm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@TableName("crm_customer_level")
+@Data
+public class CrmCustomerLevel {
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 级别名称
+     */
+    private String name;
+    /**
+     * 状态 0显示 1停用
+     */
+    private Integer status;
+    /**
+     * 序号
+     */
+    private Integer sort;
+}

+ 18 - 0
fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerLevelMapper.java

@@ -0,0 +1,18 @@
+package com.fs.crm.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+
+import java.util.List;
+
+public interface CrmCustomerLevelMapper extends BaseMapper<CrmCustomerLevel> {
+
+    /**
+     * 查询客户级别列表
+     * @param param 参数
+     * @return  list
+     */
+    List<CrmCustomerLevelVO> selectCrmCustomerLevelVOList(CrmCustomerLevelQueryParam param);
+}

+ 17 - 5
fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java

@@ -1,8 +1,5 @@
 package com.fs.crm.mapper;
 
-import java.util.List;
-import java.util.Map;
-
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.crm.domain.CrmCustomer;
@@ -13,6 +10,9 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 客户Mapper接口
 
@@ -143,6 +143,9 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.deptId != null  and maps.deptId != 0 '> " +
             "AND (c.dept_id = #{maps.deptId} OR c.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
             "</if>" +
+            "<if test = 'maps.customerLevel != null'> " +
+            "and c.customer_level =#{maps.customerLevel} " +
+            "</if>" +
             "${maps.params.dataScope}"+
             " order by c.customer_id desc "+
             "</script>"})
@@ -266,8 +269,11 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.deptId != null  and maps.deptId != 0 '> " +
             "AND (c.dept_id = #{maps.deptId} OR c.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
             "</if>" +
+            "<if test = 'maps.customerLevel != null'> " +
+            "and c.customer_level = #{maps.customerLevel} " +
+            "</if>" +
             "${maps.params.dataScope}"+
-            " order by c.customer_id desc "+
+            " order by c.is_top desc, c.customer_id desc "+
             "</script>"})
     List<CrmCustomerListVO> selectCrmCustomerListQueryParam(@Param("maps")CrmCustomerListQueryParam crmCustomer);
 
@@ -412,7 +418,10 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
             "and date_format(c.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
             "</if>" +
-            " order by c.customer_id desc "+
+            "<if test = 'maps.customerLevel != null'> " +
+            "and c.customer_level =#{maps.customerLevel} " +
+            "</if>" +
+            " order by c.is_top desc,c.customer_id desc "+
             "</script>"})
     List<CrmLineCustomerListQueryVO> selectCrmLineCustomerListQuery(@Param("maps")CrmLineCustomerListQueryParam param);
 
@@ -620,4 +629,7 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
      * @return
      */
     List<Long> selectCustomerIdByCompanyUserId(@Param("companyUserId") Long companyUserId);
+
+    @Select("select *  from crm_customer where mobile=#{mobile} limit 1")
+    CrmCustomer selectFscrmByMobile(String mobile);
 }

+ 26 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelParm.java

@@ -0,0 +1,26 @@
+package com.fs.crm.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class CrmCustomerLevelParm {
+    /**
+     * 主键ID
+     */
+    private Long id;
+    /**
+     * 级别名称
+     */
+    @NotBlank(message = "级别名称不能为空")
+    private String name;
+    /**
+     * 状态 0显示 1停用
+     */
+    private Integer status;
+    /**
+     * 序号
+     */
+    private Integer sort;
+}

+ 11 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelQueryParam.java

@@ -0,0 +1,11 @@
+package com.fs.crm.param;
+
+import lombok.Data;
+
+@Data
+public class CrmCustomerLevelQueryParam {
+    /**
+     * 级别名称
+     */
+    private String name;
+}

+ 4 - 1
fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerListQueryParam.java

@@ -2,7 +2,6 @@ package com.fs.crm.param;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
-import com.fs.common.core.domain.BaseEntity;
 import com.fs.common.param.BaseQueryParam;
 import lombok.Data;
 
@@ -98,5 +97,9 @@ public class CrmCustomerListQueryParam extends BaseQueryParam
 
     private String[] receiveTimeList;
 
+    /**
+     * 客户级别
+     */
+    private Long customerLevel;
 
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmFullCustomerListQueryParam.java

@@ -87,4 +87,7 @@ public class CrmFullCustomerListQueryParam extends BaseQueryParam
 
     private Integer isPool;
 
+    /** 客户级别 */
+    private Long customerLevel;
+
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmLineCustomerListQueryParam.java

@@ -86,4 +86,6 @@ public class CrmLineCustomerListQueryParam extends BaseQueryParam
     @Excel(name = "标签" )
     private String tags;
 
+    /** 客户级别 */
+    private Long customerLevel;
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmMyCustomerListQueryParam.java

@@ -94,4 +94,7 @@ public class CrmMyCustomerListQueryParam extends BaseQueryParam
     private Integer isHisOrder;
     private String corpId;
 
+    /** 客户级别 */
+    private Long customerLevel;
+
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerAssistService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.fs.common.core.domain.R;
 import com.fs.crm.domain.CrmCustomerAssist;
+import com.fs.crm.domain.CrmCustomerContacts;
 import com.fs.crm.param.CrmCustomeAssignParam;
 import com.fs.crm.param.CrmCustomerAssistDeLParam;
 import com.fs.crm.param.CrmCustomerAssistOperationParam;
@@ -72,4 +73,6 @@ public interface ICrmCustomerAssistService
     List<CrmCustomerAssistVo> selectByCustomerIds(List<Long> customerIds);
 
     int allOperation(List<CrmCustomerAssistOperationParam> params,Long companyId,Long companyUserId);
+
+    List<CrmCustomerContacts> selectCrmCustomerContactsList(CrmCustomerContacts contactsMap);
 }

+ 40 - 0
fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerLevelService.java

@@ -0,0 +1,40 @@
+package com.fs.crm.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.param.CrmCustomerLevelParm;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+
+import java.util.List;
+
+public interface ICrmCustomerLevelService extends IService<CrmCustomerLevel> {
+
+    /**
+     * 查询客户级别列表
+     * @param param 参数
+     * @return  list
+     */
+    List<CrmCustomerLevelVO> selectCrmCustomerLevelVOList(CrmCustomerLevelQueryParam param);
+
+    /**
+     * 新增客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    int saveCustomerLevel(CrmCustomerLevelParm param);
+
+    /**
+     * 修改客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    int editCustomerLevel(CrmCustomerLevelParm param);
+
+    /**
+     * 根据ID查询
+     * @param id id
+     * @return CrmCustomerLevelVO
+     */
+    CrmCustomerLevelVO selectCrmCustomerLevelVOById(Long id);
+}

+ 12 - 5
fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerService.java

@@ -1,16 +1,14 @@
 package com.fs.crm.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.alibaba.fastjson.JSONObject;
 import com.fs.common.core.domain.R;
 import com.fs.crm.domain.CrmCustomer;
 import com.fs.crm.param.*;
 import com.fs.crm.vo.*;
 import com.fs.qwApi.param.QwCustomerDetailParam;
-import com.fs.store.dto.StoreOrderExpressExportDTO;
-import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * 客户Service接口
@@ -44,6 +42,7 @@ public interface ICrmCustomerService
      */
     public List<CrmCustomer> selectCrmCustomerList(CrmCustomer crmCustomer);
 
+    R assistToUser(String opeUserName, Long opeUserId, CrmCustomeAssignParam param);
     /**
      * 新增客户
      *
@@ -138,4 +137,12 @@ public interface ICrmCustomerService
     public List<CrmCustomerListVO> selectCrmCustomer1();
 
     List<CrmMyCustomerListQueryVO> selectCrmMyAssistListQuery(CrmMyCustomerListQueryParam param);
+
+    /**
+     * 置顶切换
+     * @param customerId 客户ID
+     */
+    void switchToTop(Long customerId);
+
+    CrmCustomer selectFscrmByMobile(String mobile);
 }

+ 9 - 8
fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerAssistServiceImpl.java

@@ -12,14 +12,10 @@ import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyUserMapper;
-import com.fs.crm.domain.CrmCustomer;
-import com.fs.crm.domain.CrmCustomerLogs;
-import com.fs.crm.domain.CrmCustomerUser;
+import com.fs.crm.domain.*;
 import com.fs.crm.dto.CrmCustomerAssignUserDTO;
 import com.fs.crm.enums.CustomerLogEnum;
-import com.fs.crm.mapper.CrmCustomerLogsMapper;
-import com.fs.crm.mapper.CrmCustomerMapper;
-import com.fs.crm.mapper.CrmCustomerUserMapper;
+import com.fs.crm.mapper.*;
 import com.fs.crm.param.CrmCustomeAssignParam;
 import com.fs.crm.param.CrmCustomerAssistDeLParam;
 import com.fs.crm.param.CrmCustomerAssistOperationParam;
@@ -27,8 +23,6 @@ import com.fs.crm.vo.CrmCustomerAssistVo;
 import com.fs.jpush.service.JpushService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.fs.crm.mapper.CrmCustomerAssistMapper;
-import com.fs.crm.domain.CrmCustomerAssist;
 import com.fs.crm.service.ICrmCustomerAssistService;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -44,6 +38,8 @@ public class CrmCustomerAssistServiceImpl implements ICrmCustomerAssistService
     @Autowired
     private CrmCustomerAssistMapper crmCustomerAssistMapper;
     @Autowired
+    private CrmCustomerContactsMapper crmCustomerContactsMapper;
+    @Autowired
     private CompanyUserMapper companyUserMapper;
     @Autowired
     private CrmCustomerMapper crmCustomerMapper;
@@ -312,4 +308,9 @@ public class CrmCustomerAssistServiceImpl implements ICrmCustomerAssistService
         });
         return count.get();
     }
+    @Override
+    public List<CrmCustomerContacts> selectCrmCustomerContactsList(CrmCustomerContacts crmCustomerContacts)
+    {
+        return crmCustomerContactsMapper.selectCrmCustomerContactsList(crmCustomerContacts);
+    }
 }

+ 102 - 0
fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerLevelServiceImpl.java

@@ -0,0 +1,102 @@
+package com.fs.crm.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.bean.BeanUtils;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.mapper.CrmCustomerLevelMapper;
+import com.fs.crm.param.CrmCustomerLevelParm;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.service.ICrmCustomerLevelService;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Objects;
+
+@Service
+public class CrmCustomerLevelServiceImpl extends ServiceImpl<CrmCustomerLevelMapper, CrmCustomerLevel> implements ICrmCustomerLevelService {
+
+    /**
+     * 查询客户级别列表
+     * @param param 参数
+     * @return  list
+     */
+    @Override
+    public List<CrmCustomerLevelVO> selectCrmCustomerLevelVOList(CrmCustomerLevelQueryParam param) {
+        return baseMapper.selectCrmCustomerLevelVOList(param);
+    }
+
+    /**
+     * 新增客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    @Override
+    public int saveCustomerLevel(CrmCustomerLevelParm param) {
+        CrmCustomerLevel crmCustomerLevel = getCustomerLevelByName(param.getName());
+        if (Objects.nonNull(crmCustomerLevel)) {
+            throw new CustomException("级别名称已存在");
+        }
+
+        crmCustomerLevel = new CrmCustomerLevel();
+        BeanUtils.copyProperties(param, crmCustomerLevel, "id");
+        return baseMapper.insert(crmCustomerLevel);
+    }
+
+    /**
+     * 根据名称查询客户级别
+     * @param name 名称
+     * @return CrmCustomerLevel
+     */
+    private CrmCustomerLevel getCustomerLevelByName(String name) {
+        Wrapper<CrmCustomerLevel> queryWrapper = Wrappers.<CrmCustomerLevel>lambdaQuery()
+                .eq(CrmCustomerLevel::getName, name)
+                .last("limit 1");
+        return getOne(queryWrapper);
+    }
+
+    /**
+     * 修改客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    @Override
+    public int editCustomerLevel(CrmCustomerLevelParm param) {
+        if (Objects.isNull(param.getId())) {
+            throw new CustomException("ID不能为空");
+        }
+
+        CrmCustomerLevel customerLevel = getById(param.getId());
+        if (Objects.isNull(customerLevel)) {
+            throw new CustomException("记录不存在");
+        }
+
+        CrmCustomerLevel levelByName = getCustomerLevelByName(param.getName());
+        if (Objects.nonNull(levelByName) && !levelByName.getId().equals(customerLevel.getId())) {
+            throw new CustomException("级别名称已存在");
+        }
+
+        BeanUtils.copyProperties(param, customerLevel, "id");
+        return baseMapper.updateById(customerLevel);
+    }
+
+    /**
+     * 根据ID查询
+     * @param id id
+     * @return CrmCustomerLevelVO
+     */
+    @Override
+    public CrmCustomerLevelVO selectCrmCustomerLevelVOById(Long id) {
+        CrmCustomerLevel customerLevel = getById(id);
+        if (Objects.isNull(customerLevel)) {
+            throw new CustomException("记录不存在");
+        }
+
+        CrmCustomerLevelVO crmCustomerLevelVO = new CrmCustomerLevelVO();
+        BeanUtils.copyProperties(customerLevel, crmCustomerLevelVO);
+        return crmCustomerLevelVO;
+    }
+}

+ 72 - 0
fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerServiceImpl.java

@@ -911,4 +911,76 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
 
         return vos;
     }
+
+    /**
+     * 置顶切换
+     * @param customerId 客户ID
+     */
+    @Override
+    public void switchToTop(Long customerId) {
+        CrmCustomer crmCustomer = crmCustomerMapper.selectCrmCustomerById(customerId);
+        if (Objects.isNull(crmCustomer)){
+            throw new CustomException("客户不存在");
+        }
+
+        crmCustomer.setIsTop(crmCustomer.getIsTop() == 0 ? 1 : 0);
+        crmCustomerMapper.updateCrmCustomer(crmCustomer);
+    }
+
+    @Override
+    public CrmCustomer selectFscrmByMobile(String mobile){
+        return crmCustomerMapper.selectFscrmByMobile(mobile);
+    }
+
+    @Override
+    @Transactional
+    public R assistToUser(String opeUserName, Long opeUserId, CrmCustomeAssignParam param) {
+        Integer index=0;
+        for(CrmCustomerAssignUserDTO userDTO:param.getUsers()){
+            CompanyUser companyUser=companyUserMapper.selectCompanyUserById(userDTO.getCompanyUserId());
+            for(int i=0;i<userDTO.getCount();i++){
+                CrmCustomer customer=crmCustomerMapper.selectCrmCustomerById(param.getCustomerIds().get(index));
+                //不能选择客户拥有者本人
+                CrmCustomerUser crmCustomerUser = crmCustomerUserMapper.selectCrmCustomerUserById(customer.getCustomerUserId());
+                if (Objects.equals(crmCustomerUser.getCompanyUserId(), userDTO.getCompanyUserId())){
+                    return R.error("不能选择自己来协作!");
+                }
+                //查询协作客户
+                CrmCustomerAssist customerAssist=new CrmCustomerAssist();
+                customerAssist.setCustomerId(customer.getCustomerId());
+                customerAssist.setCompanyUserId(userDTO.getCompanyUserId());
+                List<CrmCustomerAssist> tempList = assistMapper.selectCrmCustomerAssistList(customerAssist);
+                if(tempList!=null && !tempList.isEmpty()){
+                    return R.error("销售:" + companyUser.getNickName() +"(" + userDTO.getCompanyUserId() + ")已拥有改该协作客户:" + customer.getCustomerName());
+                }
+                customerAssist.setCompanyId(param.getCompanyId());
+                customerAssist.setCompanyUserName(companyUser.getNickName());
+                customerAssist.setCreateTime(new Date());
+                assistMapper.insertCrmCustomerAssist(customerAssist);
+                //写日志
+                CrmCustomerLogs logs=new CrmCustomerLogs();
+                logs.setCustomerId(customer.getCustomerId());
+                logs.setCreateTime(new Date());
+                logs.setLogsType(CustomerLogEnum.ASSIST_USER.getValue());
+                logs.setTitle(CustomerLogEnum.ASSIST_USER.getDesc());
+                logs.setRemark(opeUserName+"为客户"+customer.getCustomerName()+"添加协作人:" + companyUser.getNickName());
+                logs.setCompanyUserId(userDTO.getCompanyUserId());
+                logsMapper.insertCrmCustomerLogs(logs);
+
+                if(StringUtils.isNotEmpty(companyUser.getJpushId())){
+                    Map<String, String> extrasMap=new HashMap<>();
+                    extrasMap.put("customerId",customer.getCustomerId().toString());
+                    extrasMap.put("type","1");
+                    try {
+                        jpushService.sendRegisterIdPush("客户消息","您收到 一个客户协作邀请",extrasMap,companyUser.getJpushId());
+                    } catch (APIConnectionException e) {
+                    } catch (APIRequestException e) {
+                    }
+                }
+                index++;
+            }
+        }
+        return R.ok();
+    }
+
 }

+ 23 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerLevelVO.java

@@ -0,0 +1,23 @@
+package com.fs.crm.vo;
+
+import lombok.Data;
+
+@Data
+public class CrmCustomerLevelVO {
+    /**
+     * 主键ID
+     */
+    private Long id;
+    /**
+     * 级别名称
+     */
+    private String name;
+    /**
+     * 状态 0显示 1停用
+     */
+    private Integer status;
+    /**
+     * 序号
+     */
+    private Integer sort;
+}

+ 5 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerListVO.java

@@ -127,4 +127,9 @@ public class CrmCustomerListVO implements Serializable
     @Excel(name = "进线客户提交日期" )
     private String registerSubmitTime;
 
+    /** 客户级别 */
+    private Long customerLevel;
+    /** 置顶状态 0未置顶 1置顶 */
+    private Integer isTop;
+
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmFullCustomerListQueryVO.java

@@ -101,4 +101,7 @@ public class CrmFullCustomerListQueryVO implements Serializable
     private String sourceCode;
     private String pushTime;
     private String pushCode;
+
+    /** 客户级别 */
+    private Long customerLevel;
 }

+ 4 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmLineCustomerListQueryVO.java

@@ -106,5 +106,9 @@ public class CrmLineCustomerListQueryVO implements Serializable
     /** 非重客户Id(重客户最早录入手机号码的客户id) */
     private Long dCustomerId;
 
+    /** 客户级别 */
+    private Long customerLevel;
+    /** 是否置顶 0未置顶 1置顶 */
+    private Integer isTop;
 
 }

+ 3 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmMyCustomerListQueryVO.java

@@ -123,4 +123,7 @@ public class CrmMyCustomerListQueryVO implements Serializable
     private List<String> assistUser;
     private Long companyUserId;
 
+    /** 客户级别 */
+    private Long customerLevel;
+
 }

+ 10 - 5
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreOrderMapper.java

@@ -1,5 +1,6 @@
 package com.fs.store.mapper;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -13,10 +14,7 @@ import com.fs.statis.domain.Report;
 import com.fs.statis.param.ReportParam;
 import com.fs.store.domain.FsStoreOrder;
 import com.fs.store.domain.FsStoreOrderItem;
-import com.fs.store.param.FsCustomerStoreOrderListQueryParam;
-import com.fs.store.param.FsMyStoreOrderQueryParam;
-import com.fs.store.param.FsStoreOrderParam;
-import com.fs.store.param.FsStoreStatisticsParam;
+import com.fs.store.param.*;
 import com.fs.store.vo.*;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -163,7 +161,9 @@ public interface FsStoreOrderMapper
             " AND date_format(o.delivery_send_time,'%y%m%d') &gt;= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d') " +
             " AND date_format(o.delivery_send_time,'%y%m%d') &lt;= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d') " +
             "</if>" +
-
+            "<if test = 'maps.paid != null    '> " +
+            "and o.paid =#{maps.paid} " +
+            "</if>" +
             "<if test = 'maps.payTimeList != null    '> " +
             " AND date_format(o.pay_time,'%y%m%d') &gt;= date_format(#{maps.payTimeList[0]},'%y%m%d') " +
             " AND date_format(o.pay_time,'%y%m%d') &lt;= date_format(#{maps.payTimeList[1]},'%y%m%d') " +
@@ -524,6 +524,7 @@ public interface FsStoreOrderMapper
             "where o.user_id=#{userId}  and o.status =#{status} " +
             "</script>"})
     int selectFsStoreOrderCount(@Param("userId")long userId,@Param("status")int status);
+
     @Select({"<script> " +
             "select * from fs_store_order o  " +
             "where o.delivery_id=#{deliveryId}  limit 1 " +
@@ -1044,4 +1045,8 @@ public interface FsStoreOrderMapper
     List<Long> selectFsStoreOrderNoCreateOmsAndReviewed();
 
     List<Report> selectOrderByCustomerIds(@Param("map") ReportParam param);
+
+    int selectFsStoreOrderCount(FsStoreOrderStatisticsParam param);
+
+    BigDecimal selectFsStoreOrderByPayPriceCount(FsStoreOrderStatisticsParam param);
 }

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/param/FsStoreOrderParam.java

@@ -82,4 +82,9 @@ public class FsStoreOrderParam extends BaseEntity implements Serializable
 
     private String orderVisit;
 
+    /**
+     * 支付状态 待支付 1已支付
+     */
+    private int paid;
+
 }

+ 26 - 0
fs-service-system/src/main/java/com/fs/store/param/FsStoreOrderStatisticsParam.java

@@ -0,0 +1,26 @@
+package com.fs.store.param;
+
+import lombok.Data;
+
+@Data
+public class FsStoreOrderStatisticsParam {
+
+    /**
+     * 开始时间
+     */
+    String startTime;
+    /**
+     * 结束时间
+     */
+    String endTime;
+
+    /**
+     * 是否已经支付
+     */
+    Integer paid;
+
+    /**
+     * 订单状态(-1 : 申请退款 -2 : 退货成功 1:待支付 2:待发货;3:待收货;4:待评价;5:已完成)
+     */
+    private Integer status;
+}

+ 15 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsStoreOrderService.java

@@ -125,6 +125,13 @@ public interface IFsStoreOrderService
 
     Integer selectFsStoreOrderCount(long userId, int status);
 
+    /**
+     * 根据时间查询订单总数
+     * @param param
+     * @return
+     */
+    Integer selectFsStoreOrderCount(FsStoreOrderStatisticsParam param);
+
     R computedPackageOrder(long userId, FsStoreComputedPackageIdOrderParam param);
 
     FsStoreOrder selectFsStoreOrderByDeliveryId(String logisticCode);
@@ -211,4 +218,12 @@ public interface IFsStoreOrderService
      * @return R
      */
     R finishStoreOrder(Long orderId);
+
+    /**
+     * 根据时间查询实际支付金额
+     *
+     * @param param
+     * @return
+     */
+    BigDecimal selectFsStoreOrderByPayPriceCount(FsStoreOrderStatisticsParam param);
 }

+ 10 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreOrderServiceImpl.java

@@ -1327,6 +1327,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
         }
     }
 
+    @Override
+    public BigDecimal selectFsStoreOrderByPayPriceCount(FsStoreOrderStatisticsParam param) {
+        return fsStoreOrderMapper.selectFsStoreOrderByPayPriceCount(param);
+    }
+
     @Override
     @Transactional
     //类型1支付回调 类型2货到付款
@@ -2174,6 +2179,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
         return fsStoreOrderMapper.selectFsStoreOrderCount(userId,status);
     }
 
+    @Override
+    public Integer selectFsStoreOrderCount(FsStoreOrderStatisticsParam param) {
+        return fsStoreOrderMapper.selectFsStoreOrderCount(param);
+    }
+
     @Override
     public R computedPackageOrder(long userId, FsStoreComputedPackageIdOrderParam param) {
         FsStoreProductPackage storeProductPackage=productPackageService.selectFsStoreProductPackageById(param.getPackageId());

+ 5 - 0
fs-service-system/src/main/resources/application-config-bly.yml

@@ -62,6 +62,11 @@ wx:
         token: Ncbnd7lJvkripVOpyTFAna6NAWCxCrvC
         aesKey: HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E
         msgDataFormat: JSON
+      - appid: wx301ab2fad04c658a   #倍力优看课小程序
+        secret: 35018f10929b84c8c4a225de253bbcc6
+        token: Ncbnd7lJvkripVOpyTFAna6NAWCxCrvC
+        aesKey: HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E
+        msgDataFormat: JSON
 
   pay:
     appId: wx11a2ce7c2bbc4521 #微信公众号或者小程序等的appid

+ 2 - 0
fs-service-system/src/main/resources/application-config-dev.yml

@@ -120,3 +120,5 @@ tencent_cloud_config:
   proxy: hylj
 cloud_host:
   company_name: 润天
+headerImg:
+  imgUrl: https://zkzh-2025.oss-cn-beijing.aliyuncs.com/fs/20250619/e31b5e051a474a7a9b4ad02575b46196.png

+ 2 - 0
fs-service-system/src/main/resources/application-dev.yml

@@ -1,5 +1,7 @@
 # 数据源配置
 spring:
+    profiles:
+        include: config-dev,common
     # redis 配置
     redis:
         # 地址

+ 14 - 0
fs-service-system/src/main/resources/db/upgrade/20250621客户分级.sql

@@ -0,0 +1,14 @@
+-- 客户级别表
+drop table if exists crm_customer_level;
+create table crm_customer_level (
+    `id`        bigint          not null auto_increment comment '主键ID',
+    `name`      varchar(255)    not null                comment '级别名称',
+    `status`    tinyint         default 0               comment '状态 0显示 1停用',
+    `sort`      int             default 0               comment '序号',
+    primary key (`id`) using btree
+) engine = InnoDB comment = '客户级别表';
+
+-- 客户表新增级别字段、置顶字段
+alter table crm_customer
+    add column `customer_level` bigint comment '客户级别' after `customer_type`,
+    add column `is_top` tinyint default 0 comment '是否置顶 0未置顶 1置顶';

+ 17 - 0
fs-service-system/src/main/resources/mapper/crm/CrmCustomerLevelMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.crm.mapper.CrmCustomerLevelMapper">
+
+    <select id="selectCrmCustomerLevelVOList" resultType="com.fs.crm.vo.CrmCustomerLevelVO">
+        select
+            ccl.*
+        from crm_customer_level ccl
+        <where>
+            <if test="name != null and name != ''">
+                and ccl.name like concat('%', #{name}, '%')
+            </if>
+        </where>
+    </select>
+</mapper>

+ 20 - 3
fs-service-system/src/main/resources/mapper/crm/CrmCustomerMapper.xml

@@ -51,12 +51,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="visitTime"    column="visit_time"    />
         <result property="trafficSource"   column="traffic_source"    />
         <result property="importType"    column="import_type"    />
+        <result property="volume"    column="volume"    />
         <result property="thirdAccount"    column="third_account"    />
         <result property="clueId"    column="clue_id"    />
+        <result property="customerLevel"    column="customer_level"    />
+        <result property="isTop"    column="is_top"    />
     </resultMap>
 
     <sql id="selectCrmCustomerVo">
-        select customer_id, customer_code, customer_name, mobile, sex, weixin, remark, user_id, create_user_id, receive_user_id, customer_user_id, address,city_ids, location, detail_address, lng, lat, create_time, update_time, status, is_receive, dept_id, is_del, customer_type, receive_time, pool_time, company_id, is_line, source, tags,ext_json,visit_status,register_date,register_link_url,register_desc,register_submit_time,is_pool,register_type,pay_money,buy_count,source_code,push_time,push_code,visit_time,traffic_source,import_type,third_account,clue_id from crm_customer
+        select customer_id, customer_code, customer_name, mobile, sex, weixin, remark, user_id, create_user_id, receive_user_id, customer_user_id, address,city_ids, location, detail_address, lng, lat, create_time, update_time, status, is_receive, dept_id, is_del, customer_type, receive_time, pool_time, company_id, is_line, source, tags,ext_json,visit_status,register_date,register_link_url,register_desc,register_submit_time,is_pool,register_type,pay_money,buy_count,source_code,push_time,push_code,visit_time,traffic_source,import_type,third_account,clue_id,customer_level,is_top from crm_customer
     </sql>
 
     <select id="selectCrmCustomerList" parameterType="CrmCustomer" resultMap="CrmCustomerResult">
@@ -92,6 +95,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null "> and import_type = #{importType}</if>
             <if test="thirdAccount != null "> and third_account = #{thirdAccount}</if>
             <if test="clueId != null "> and clue_id = #{clueId}</if>
+            <if test="customerLevel != null "> and customer_level = #{customerLevel}</if>
+            <if test="isTop != null "> and is_top = #{isTop}</if>
         </where>
         order by customer_id desc
     </select>
@@ -156,6 +161,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null">import_type,</if>
             <if test="thirdAccount != null">third_account,</if>
             <if test="clueId != null">clue_id,</if>
+            <if test="customerLevel != null">customer_level,</if>
+            <if test="isTop != null">is_top,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="customerCode != null">#{customerCode},</if>
@@ -205,6 +212,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null">#{importType},</if>
             <if test="thirdAccount != null">#{thirdAccount},</if>
             <if test="clueId != null">#{clueId},</if>
+            <if test="customerLevel != null">#{customerLevel},</if>
+            <if test="isTop != null">#{isTop},</if>
          </trim>
     </insert>
 
@@ -258,6 +267,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null">import_type = #{importType},</if>
             <if test="thirdAccount != null">third_account = #{thirdAccount},</if>
             <if test="clueId != null">clue_id = #{clueId},</if>
+            <if test="customerLevel != null">customer_level = #{customerLevel},</if>
+            <if test="isTop != null">is_top = #{isTop},</if>
         </trim>
         where customer_id = #{customerId}
     </update>
@@ -292,13 +303,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCrmMyCustomerListQuery" resultType="com.fs.crm.vo.CrmMyCustomerListQueryVO">
         select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time,
                c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source,
-               c.tags,c.receive_time
+               c.tags,c.receive_time,c.customer_level
         from crm_customer_user cu
             inner join crm_customer c on c.customer_user_id=cu.customer_user_id
         where cu.is_pool=0  and c.is_del = 0
         <if test="maps.companyId != null">
             and cu.company_id =#{maps.companyId}
         </if>
+        <if test="maps.customerLevel != null">
+            and c.customer_level =#{maps.customerLevel}
+        </if>
         <if test="maps.companyUserId != null">
             and cu.company_user_id =#{maps.companyUserId}
         </if>
@@ -358,7 +372,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCrmMyAssistListQuery" resultType="com.fs.crm.vo.CrmMyCustomerListQueryVO">
         select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time,
         c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source,
-        c.tags,c.receive_time
+        c.tags,c.receive_time, c.customer_level
         from crm_customer_assist ca
         LEFT JOIN  crm_customer c on c.customer_id=ca.customer_id
         LEFT JOIN crm_customer_user cu on c.customer_user_id=cu.customer_user_id
@@ -369,6 +383,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.companyUserId != null">
             and ca.company_user_id =#{maps.companyUserId}
         </if>
+        <if test="maps.customerLevel != null">
+            and c.customer_level =#{maps.customerLevel}
+        </if>
         <if test="maps.address != null and  maps.address != ''">
             and c.address like CONCAT('%',#{maps.address},'%')
         </if>

+ 6 - 10
fs-service-system/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml

@@ -278,14 +278,12 @@
             <if test="dataType == 1">
                 rpl.course_id as course_id,
             </if>
-            SUM(rpl.money) as rewardMoney
+            SUM(rpl.amount) as rewardMoney
         FROM
-            company_red_package_logs rpl
-        left join fs_course_watch_log log
-        on rpl.watch_log_id=log.log_id
+            fs_course_red_packet_log rpl
+            left join fs_course_watch_log log
+            on rpl.watch_log_id=log.log_id
         <where>
-            rpl.operate_type = 1
-            AND rpl.status = 1
             <if test="startTime != null">
                 AND rpl.create_time <![CDATA[>=]]> #{startTime}
             </if>
@@ -320,8 +318,8 @@
         <if test="type == 2 or type == 3 or type == 4">
             DATE_FORMAT(rpl.create_time, '%Y-%m-%d') AS start_date,
         </if>
-               SUM(rpl.money) as rewardMoney
-        from company_red_package_logs rpl
+            SUM(rpl.amount) as rewardMoney
+        from fs_course_red_packet_log rpl
         left join fs_course_watch_log log
         on rpl.watch_log_id=log.log_id
         <where>
@@ -337,8 +335,6 @@
             <if test="companyId != null">
                 and log.company_id = ${companyId}
             </if>
-            AND rpl.operate_type = 1
-            AND rpl.status = 1
         </where>
         group by start_date
     </select>

+ 23 - 0
fs-service-system/src/main/resources/mapper/store/FsStoreOrderMapper.xml

@@ -507,4 +507,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND pay_time &lt; DATE_ADD(STR_TO_DATE(#{map.payTime}, '%Y-%m-%d'), INTERVAL 1 DAY)
         </if>
     </select>
+
+
+    <select id="selectFsStoreOrderCount" resultType="int">
+        select  count(id) from fs_store_order
+        <where>
+            <if test="startTime != null and startTime != ''">AND date_format(create_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')</if>
+            <if test="endTime != null and endTime != ''">AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')</if>
+            <if test="status != null"> and status = #{status}</if>
+            <if test="paid != null and paid==1"> and pay_time is not null</if>
+            <if test="paid != null and paid==0"> and pay_time is null</if>
+        </where>
+
+    </select>
+
+    <select id="selectFsStoreOrderByPayPriceCount" resultType="java.math.BigDecimal">
+        select  sum(pay_price) from fs_store_order
+        <where>
+            <if test="paid != null"> and paid = #{paid}</if>
+            <if test="startTime != null and startTime != ''">AND date_format(create_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')</if>
+            <if test="endTime != null and endTime != ''">AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')</if>
+        </where>
+
+    </select>
 </mapper>