瀏覽代碼

支付商户管理

FengChaoYu 1 月之前
父節點
當前提交
c3d8c354b4
共有 49 個文件被更改,包括 761 次插入4543 次删除
  1. 12 0
      src/main/java/com/gree/mall/manager/bean/admin/AdminCompanyPayConfigBean.java
  2. 57 0
      src/main/java/com/gree/mall/manager/bean/admin/AdminCompanyPayConfigVO.java
  3. 19 0
      src/main/java/com/gree/mall/manager/bean/admin/AdminCompanyVO.java
  4. 0 36
      src/main/java/com/gree/mall/manager/bean/admin/respDto/AdminCompanyWechatRespPageBean.java
  5. 0 13
      src/main/java/com/gree/mall/manager/commonmapper/AdminMapper.java
  6. 17 0
      src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java
  7. 15 53
      src/main/java/com/gree/mall/manager/config/wx/WxConfiguration.java
  8. 93 0
      src/main/java/com/gree/mall/manager/controller/admin/AdminCompanyPayConfigController.java
  9. 0 61
      src/main/java/com/gree/mall/manager/controller/admin/AdminCompanyWechatTemplateController.java
  10. 1 42
      src/main/java/com/gree/mall/manager/controller/admin/AdminUserController.java
  11. 0 66
      src/main/java/com/gree/mall/manager/controller/admin/ew/EnterpriseWechatWithUserController.java
  12. 0 161
      src/main/java/com/gree/mall/manager/controller/admin/ew/EnterpriseWechatWorkerController.java
  13. 0 26
      src/main/java/com/gree/mall/manager/controller/common/CommonController.java
  14. 0 36
      src/main/java/com/gree/mall/manager/controller/manual/ManualWorkController.java
  15. 0 70
      src/main/java/com/gree/mall/manager/controller/marketing/DynamicMaterialsController.java
  16. 0 129
      src/main/java/com/gree/mall/manager/controller/marketing/MarketingMaterialsController.java
  17. 0 62
      src/main/java/com/gree/mall/manager/controller/marketing/MarketingMaterialsGroupController.java
  18. 0 8
      src/main/java/com/gree/mall/manager/controller/member/MemberController.java
  19. 277 277
      src/main/java/com/gree/mall/manager/controller/sop/SopRuleController.java
  20. 0 55
      src/main/java/com/gree/mall/manager/controller/tag/TagController.java
  21. 0 92
      src/main/java/com/gree/mall/manager/controller/tag/TagGroupController.java
  22. 93 93
      src/main/java/com/gree/mall/manager/controller/wxCustomer/WeCallBackController.java
  23. 28 0
      src/main/java/com/gree/mall/manager/enums/StatusEnum.java
  24. 85 0
      src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyPayConfigLogic.java
  25. 0 91
      src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyWechatLogic.java
  26. 0 125
      src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyWechatTemplateLogic.java
  27. 0 11
      src/main/java/com/gree/mall/manager/logic/admin/AdminWebsitLogic.java
  28. 0 486
      src/main/java/com/gree/mall/manager/logic/admin/ew/EnterpriseWechatWorkerLogic.java
  29. 23 30
      src/main/java/com/gree/mall/manager/logic/common/UMSLogic.java
  30. 0 235
      src/main/java/com/gree/mall/manager/logic/common/WorkWechatLogic.java
  31. 0 9
      src/main/java/com/gree/mall/manager/logic/goods/GoodsLogic.java
  32. 0 106
      src/main/java/com/gree/mall/manager/logic/manual/ManualWorkLogic.java
  33. 0 19
      src/main/java/com/gree/mall/manager/logic/marketing/DynamicMaterialsLogic.java
  34. 0 448
      src/main/java/com/gree/mall/manager/logic/marketing/MarketingMaterialsLogic.java
  35. 2 28
      src/main/java/com/gree/mall/manager/logic/order/OrderLogic.java
  36. 0 1
      src/main/java/com/gree/mall/manager/logic/order/OrderRefundLogic.java
  37. 0 538
      src/main/java/com/gree/mall/manager/logic/sop/SopRuleLogic.java
  38. 0 257
      src/main/java/com/gree/mall/manager/logic/tag/AsyncWxTagLogic.java
  39. 0 116
      src/main/java/com/gree/mall/manager/logic/tag/DepartmentSyncLogic.java
  40. 0 217
      src/main/java/com/gree/mall/manager/logic/tag/TagGroupLogic.java
  41. 0 116
      src/main/java/com/gree/mall/manager/logic/tag/TagLogic.java
  42. 0 86
      src/main/java/com/gree/mall/manager/logic/user/UserLogic.java
  43. 8 172
      src/main/java/com/gree/mall/manager/schedule/CarryJobScheduled.java
  44. 0 39
      src/main/java/com/gree/mall/manager/schedule/MarketingMaterialsSyncQyWx.java
  45. 3 14
      src/main/java/com/gree/mall/manager/schedule/OverOrderSchedule.java
  46. 0 32
      src/main/java/com/gree/mall/manager/utils/WXPushUtils.java
  47. 0 41
      src/main/resources/bootstrap-prd.properties
  48. 0 46
      src/main/resources/mapper/AdminMapper.xml
  49. 28 0
      src/main/resources/mapper/CommonMapper.xml

+ 12 - 0
src/main/java/com/gree/mall/manager/bean/admin/AdminCompanyPayConfigBean.java

@@ -0,0 +1,12 @@
+package com.gree.mall.manager.bean.admin;
+
+import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class AdminCompanyPayConfigBean extends AdminCompanyWechat {
+}

+ 57 - 0
src/main/java/com/gree/mall/manager/bean/admin/AdminCompanyPayConfigVO.java

@@ -0,0 +1,57 @@
+package com.gree.mall.manager.bean.admin;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.enums.StatusEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@ApiModel
+@Data
+@ZfireField(tbName = "a")
+public class AdminCompanyPayConfigVO {
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "商户id")
+    private String companyWechatId;
+
+    @ApiModelProperty(value = "电子商户名称")
+    private String companyName;
+
+    @ApiModelProperty(value = "appid")
+    private String appId;
+
+    @ApiModelProperty(value = "子商户应用appid")
+    private String subAppId;
+
+    @ApiModelProperty(value = "mchid")
+    private String mchId;
+
+    @ApiModelProperty(value = "子商户mchid")
+    private String subMchId;
+
+    @ApiModelProperty(value = "key")
+    private String mchKey;
+
+    @ApiModelProperty(value = "状态")
+    private StatusEnum status;
+
+    @ApiModelProperty(value = "支付说明")
+    private String remark;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+
+
+}

+ 19 - 0
src/main/java/com/gree/mall/manager/bean/admin/AdminCompanyVO.java

@@ -0,0 +1,19 @@
+package com.gree.mall.manager.bean.admin;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel
+@Data
+@ZfireField(tbName = "a")
+public class AdminCompanyVO {
+
+    @ApiModelProperty(value = "商户id")
+    private String adminCompanyId;
+
+    @ApiModelProperty(value = "商户名称")
+    private String adminCompanyName;
+
+}

+ 0 - 36
src/main/java/com/gree/mall/manager/bean/admin/respDto/AdminCompanyWechatRespPageBean.java

@@ -1,36 +0,0 @@
-package com.gree.mall.manager.bean.admin.respDto;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.entity.AdminUser;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@ApiModel(description = "商戶列表响应bean")
-@Data
-public class AdminCompanyWechatRespPageBean extends AdminCompanyWechat {
-
-    private AdminUser adminUser;
-
-    @TableId(value = "admin_user_id", type = IdType.ID_WORKER_STR)
-    private String adminUserId;
-    @ApiModelProperty(value = "用户名")
-    private String nickName;
-    @ApiModelProperty(value = "帐号")
-    private String userName;
-    @ApiModelProperty(value = "负责人")
-    private String linkName;
-    @ApiModelProperty(value = "角色名")
-    private String roleName;
-    @ApiModelProperty(value = "联系人电话")
-    private String linkPhone;
-    @ApiModelProperty(value = "邮箱")
-    private String email;
-    @ApiModelProperty(value = "地址")
-    private String address;
-    @ApiModelProperty(value = "状态: true=正常  false=冻结")
-    private Boolean status;
-
-}

+ 0 - 13
src/main/java/com/gree/mall/manager/commonmapper/AdminMapper.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminDeptWebsitVO;
 import com.gree.mall.manager.bean.admin.AdminWebsitVO;
-import com.gree.mall.manager.bean.admin.respDto.AdminCompanyWechatRespPageBean;
 import com.gree.mall.manager.bean.common.SysDictCompanyVO;
 import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
 import com.gree.mall.manager.plus.entity.AdminUser;
@@ -45,18 +44,6 @@ public interface AdminMapper {
                                   @Param("roleId") String roleId, @Param("status")Boolean status,
                                   @Param("userName")String userName, @Param("companyWechatIds")List<String> companyWechatIds);
 
-
-    /**
-     * 商户列表2
-     */
-    @SqlParser(filter = true)
-    IPage<AdminCompanyWechatRespPageBean> pageCompanyWechat(IPage page,
-                                                         @Param("userName") String userName,
-                                                         @Param("nickName") String nickName,
-                                                         @Param("linkPhone") String linkPhone,
-                                                         @Param("email") String email,
-                                                         @Param("status") Boolean status);
-
     @SqlParser(filter = true)
     IPage<AdminDeptWebsitVO> list(Page page, @Param("ex") ZfireParamBean zfireParam);
 

+ 17 - 0
src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -0,0 +1,17 @@
+package com.gree.mall.manager.commonmapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO;
+import com.gree.mall.manager.bean.admin.AdminCompanyVO;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface CommonMapper {
+
+    IPage<AdminCompanyPayConfigVO> adminCompanyPayConfigPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
+
+    IPage<AdminCompanyVO> adminCompanyPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
+}

+ 15 - 53
src/main/java/com/gree/mall/manager/config/wx/WxConfiguration.java

@@ -3,8 +3,6 @@ package com.gree.mall.manager.config.wx;
 import cn.binarywang.wx.miniapp.api.WxMaService;
 import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
 import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
-import cn.binarywang.wx.miniapp.config.impl.WxMaRedisConfigImpl;
-import cn.binarywang.wx.miniapp.config.impl.WxMaRedisConnectionConfigImpl;
 import com.aliyuncs.utils.StringUtils;
 import com.github.binarywang.wxpay.config.WxPayConfig;
 import com.github.binarywang.wxpay.service.WxPayService;
@@ -13,19 +11,12 @@ import com.google.common.collect.Maps;
 import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
 import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
 import com.gree.mall.manager.utils.RedisUtil;
-import lombok.AllArgsConstructor;
-import lombok.val;
-import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
-import me.chanjar.weixin.cp.bean.WxCpUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 
 import javax.annotation.PostConstruct;
-import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -33,18 +24,16 @@ import java.util.Map;
 public class WxConfiguration {
 
     //企业微信  key=agentId
-    public static Map<String,Map<Integer, WxCpService>> cpServices =Maps.newConcurrentMap();
+    public static Map<String, Map<Integer, WxCpService>> cpServices = Maps.newConcurrentMap();
     //微信小程序API key = companyWechatId
-    public static Map<String,WxMaService> wxMaService = Maps.newConcurrentMap();
+    public static Map<String, WxMaService> wxMaService = Maps.newConcurrentMap();
     //微信支付服务 key = companyWechatId
-    public static Map<String,WxPayService> wxPayServices = Maps.newConcurrentMap();
+    public static Map<String, WxPayService> wxPayServices = Maps.newConcurrentMap();
     //发货模板  key = companyWechatId
-    public static Map<String,String> temFhNotice = Maps.newConcurrentMap();
+    public static Map<String, String> temFhNotice = Maps.newConcurrentMap();
 
     @Value("${wechat.payment.notifyUrl}")
     private String notifyUrl;
-//    @Value("${wechat.payment.refundNotifyUrl}")
-//    private String refundNotifyUrl;
     @Value("${wechat.keyPath}")
     private String keyPath;
     @Autowired
@@ -57,58 +46,32 @@ public class WxConfiguration {
     public void initWxServices() {
         //查询企业微信配置
         List<AdminCompanyWechat> list = AdminCompanyWechatService.list();
-        reloadWxConfig(list,redisUtil,keyPath,notifyUrl);
+        reloadWxConfig(list, redisUtil, keyPath, notifyUrl);
     }
 
-    public static void reloadWxConfig(List<AdminCompanyWechat> list,RedisUtil redisUtil,String keyPath,String notifyUrl){
+    public static void reloadWxConfig(List<AdminCompanyWechat> list, RedisUtil redisUtil, String keyPath, String notifyUrl) {
 
         cpServices.clear();
         wxMaService.clear();
         wxPayServices.clear();
 
-        for(AdminCompanyWechat companyWechat : list){
-            if(StringUtils.isEmpty(companyWechat.getMchId())||StringUtils.isEmpty(companyWechat.getSubAppId())||StringUtils.isEmpty(companyWechat.getSubSecret())){
+        for (AdminCompanyWechat companyWechat : list) {
+            if (StringUtils.isEmpty(companyWechat.getMchId()) || StringUtils.isEmpty(companyWechat.getSubAppId()) || StringUtils.isEmpty(companyWechat.getSubSecret())) {
                 continue;
             }
-            //初始化企业微信服务
-            initCpService(companyWechat,redisUtil);
             //初始化微信支付服务
-            initWxPayService(companyWechat,keyPath,notifyUrl);
+            initWxPayService(companyWechat, keyPath, notifyUrl);
             //初始化微信小程序服务
-            initWxMaService(companyWechat,redisUtil);
+            initWxMaService(companyWechat, redisUtil);
         }
     }
 
     /**
-     * 初始化企业微信服务
-     */
-    private static void initCpService(AdminCompanyWechat companyWechat,RedisUtil redisUtil){
-        Map<Integer,String> secretMap = new HashMap<>();
-        secretMap.put(companyWechat.getAgentId1(),companyWechat.getSecret1());
-        secretMap.put(companyWechat.getAgentId2(),companyWechat.getSecret2());
-        secretMap.put(companyWechat.getAgentId3(),companyWechat.getSecret3());
-
-        Map<Integer, WxCpService> agentMap = new HashMap<>();
-        for (Integer agentId : secretMap.keySet()) {
-            //初始化企业微信服务
-            val configStorage = new WxCpLettuceRedisConfig(redisUtil);
-            configStorage.setCorpId(companyWechat.getCorpId());
-            configStorage.setAgentId(agentId);
-            configStorage.setCorpSecret(secretMap.get(agentId));
-
-            WxCpService wxCpService = new WxCpServiceImpl();
-            wxCpService.setWxCpConfigStorage(configStorage);
-
-            agentMap.put(agentId, wxCpService);
-        }
-        cpServices.put(companyWechat.getCompanyWechatId(), agentMap);
-    }
-
-    /**
      * 初始化微信支付服务
+     *
      * @param companyWechat
      */
-    private static void initWxPayService(AdminCompanyWechat companyWechat,String keyPath,String notifyUrl){
+    private static void initWxPayService(AdminCompanyWechat companyWechat, String keyPath, String notifyUrl) {
 
         String path = keyPath.toLowerCase();
         WxPayConfig wxPayConfig = new WxPayConfig();
@@ -121,21 +84,20 @@ public class WxConfiguration {
         wxPayConfig.setKeyPath(path);
         WxPayService wxPayService = new WxPayServiceImpl();
         wxPayService.setConfig(wxPayConfig);
-        wxPayServices.put(companyWechat.getCompanyWechatId(),wxPayService);
+        wxPayServices.put(companyWechat.getCompanyWechatId(), wxPayService);
     }
 
     /**
      * 初始化小程序服务
      */
-    private static void initWxMaService(AdminCompanyWechat companyWechat,RedisUtil redisUtil){
+    private static void initWxMaService(AdminCompanyWechat companyWechat, RedisUtil redisUtil) {
         WxMaDefaultConfigImpl config = new WxMaLettuceRedisConfig(redisUtil);
         // 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常
         config.setAppid(companyWechat.getSubAppId());
         config.setSecret(companyWechat.getSubSecret());
         WxMaService service = new WxMaServiceImpl();
         service.setWxMaConfig(config);
-        wxMaService.put(companyWechat.getCompanyWechatId(),service);
-        temFhNotice.put(companyWechat.getCompanyWechatId(),companyWechat.getTemplate());
+        wxMaService.put(companyWechat.getCompanyWechatId(), service);
     }
 
 

+ 93 - 0
src/main/java/com/gree/mall/manager/controller/admin/AdminCompanyPayConfigController.java

@@ -0,0 +1,93 @@
+package com.gree.mall.manager.controller.admin;
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gree.mall.manager.annotation.ZfireList;
+import com.gree.mall.manager.bean.admin.AdminCompanyPayConfigBean;
+import com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO;
+import com.gree.mall.manager.bean.admin.AdminCompanyVO;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.admin.AdminCompanyPayConfigLogic;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Slf4j
+@RestController
+@Api(value = "商户管理", tags = {"商户管理API"})
+@RequestMapping(value = "/admin/company", produces = "application/json; charset=utf-8")
+public class AdminCompanyPayConfigController {
+
+    @Resource
+    AdminCompanyPayConfigLogic adminCompanyPayConfigLogic;
+
+    @ZfireList
+    @PostMapping("/mch/list")
+    @ApiOperation(value = "支付商户-列表")
+    public ResponseHelper<IPage<AdminCompanyPayConfigVO>> page(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) {
+        IPage<AdminCompanyPayConfigVO> page = adminCompanyPayConfigLogic.page(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<AdminCompanyPayConfigVO>() {});
+    }
+
+    @PostMapping("/list/export")
+    @ApiOperation("支付商户-导出")
+    public void listExport(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //2.查询要导出的内容
+        IPage<AdminCompanyPayConfigVO> baseVOIPage = adminCompanyPayConfigLogic.page(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(baseVOIPage.getRecords(), zfireParamBean.getExportFields(), request, response);
+    }
+
+    @PostMapping("/detail")
+    @ApiOperation(value = "支付商户-详情")
+    public ResponseHelper<AdminCompanyPayConfigBean> detail(
+            @ApiParam(value = "id", required = true) @RequestParam String id
+    ) throws RemoteServiceException {
+        AdminCompanyPayConfigBean bean = adminCompanyPayConfigLogic.detail(id);
+        return ResponseHelper.success(bean);
+    }
+
+    @PostMapping("/add")
+    @ApiOperation(value = "支付商户-添加")
+    public ResponseHelper add(
+            @RequestBody AdminCompanyPayConfigBean bean
+    ) throws Exception {
+        adminCompanyPayConfigLogic.add(bean);
+
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/edit")
+    @ApiOperation(value = "支付商户-编辑")
+    public ResponseHelper edit(
+            @RequestBody AdminCompanyPayConfigBean bean
+    ) throws Exception {
+        adminCompanyPayConfigLogic.edit(bean);
+        return ResponseHelper.success();
+    }
+
+    @ZfireList
+    @PostMapping("/list")
+    @ApiOperation(value = "商户列表")
+    public ResponseHelper<IPage<AdminCompanyVO>> adminCompanyPage(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) {
+        IPage<AdminCompanyVO> page = adminCompanyPayConfigLogic.adminCompanyPage(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<AdminCompanyVO>() {});
+    }
+}

+ 0 - 61
src/main/java/com/gree/mall/manager/controller/admin/AdminCompanyWechatTemplateController.java

@@ -1,61 +0,0 @@
-package com.gree.mall.manager.controller.admin;
-
-import com.gree.mall.manager.bean.admin.reqDto.AdminCompanyWechatTemplateUpdateReqDto;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.admin.AdminCompanyWechatTemplateLogic;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechatTemplate;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.omg.CORBA.PUBLIC_MEMBER;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-@RestController
-@Api(value = "小程序模板", tags ={"小程序模板"} )
-@RequestMapping(value = "/admin/company/template", produces = "application/json; charset=utf-8")
-public class AdminCompanyWechatTemplateController {
-
-    @Autowired
-    private AdminCompanyWechatTemplateLogic adminCompanyWechatTemplateLogic;
-
-
-
-    @GetMapping("/detail")
-    @ApiOperation("获取企业下模板")
-    public ResponseHelper<List<AdminCompanyWechatTemplate>> getTemplate( @ApiParam(value = "企业id",required = true) @RequestParam String companyId) {
-
-
-        return ResponseHelper.success(adminCompanyWechatTemplateLogic.getTemplate(companyId));
-    }
-
-
-    @PostMapping("/updateTemplate")
-    @ApiOperation("更改模板信息")
-    public ResponseHelper updateTemplate(HttpServletRequest request,@RequestBody AdminCompanyWechatTemplate adminCompanyWechatTemplate) {
-        adminCompanyWechatTemplateLogic.updateTemplate(request, adminCompanyWechatTemplate);
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/updateCompanyWithTemplate")
-    @ApiOperation("更改企业信息和模板信息")
-    public ResponseHelper updateCompanyWithTemplate(@RequestBody AdminCompanyWechatTemplateUpdateReqDto reqDto) {
-        adminCompanyWechatTemplateLogic.updateCompanyWithTemplate(reqDto);
-        return ResponseHelper.success();
-    }
-
-
-    @PostMapping("/initCompanyWechatTemplate")
-    @ApiOperation("初始化企业微信模板")
-    public ResponseHelper initCompanyWechatTemplate(
-            @ApiParam(required = true,value = "企业微信id")@RequestParam String companyWechatId,
-            @ApiParam(required = true,value = "企业名称")@RequestParam String companyName
-    ) {
-
-        adminCompanyWechatTemplateLogic.initCompanyWechatTemplate(companyWechatId, companyName);
-        return ResponseHelper.success();
-    }
-}

+ 1 - 42
src/main/java/com/gree/mall/manager/controller/admin/AdminUserController.java

@@ -2,19 +2,13 @@ package com.gree.mall.manager.controller.admin;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gree.mall.manager.annotation.ApiNotAuth;
-import com.gree.mall.manager.bean.ExcelData;
 import com.gree.mall.manager.bean.SVerification;
 import com.gree.mall.manager.bean.admin.*;
-import com.gree.mall.manager.bean.admin.reqDto.AdminCompanyWechatReqBean;
 import com.gree.mall.manager.bean.admin.reqDto.AdminUserAddReqBean;
-import com.gree.mall.manager.bean.admin.respDto.AdminCompanyWechatRespPageBean;
-import com.gree.mall.manager.logic.admin.AdminCompanyWechatLogic;
-import com.gree.mall.manager.logic.admin.AdminUserLogic;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
+import com.gree.mall.manager.logic.admin.AdminUserLogic;
 import com.gree.mall.manager.plus.entity.AdminUser;
-import com.gree.mall.manager.utils.excel.ExcelUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -23,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 @Slf4j
@@ -34,8 +27,6 @@ public class AdminUserController {
 
     @Autowired
     AdminUserLogic adminUserLogic;
-    @Autowired
-    AdminCompanyWechatLogic adminCompanyWechatLogic;
 
     @ApiNotAuth
     @PostMapping("/login")
@@ -108,38 +99,6 @@ public class AdminUserController {
         return ResponseHelper.success(page);
     }
 
-    @GetMapping("/mch/list")
-    @ApiOperation(value = "商户列表")
-    public ResponseHelper<IPage<AdminCompanyWechatRespPageBean>> list(
-            @ApiParam(value = "会员帐号", required = false) @RequestParam(required = false) String userName,
-            @ApiParam(value = "用户昵称", required = false) @RequestParam(required = false) String nickName,
-            @ApiParam(value = "联系电话", required = false) @RequestParam(required = false) String linkPhone,
-            @ApiParam(value = "电子邮箱", required = false) @RequestParam(required = false) String email,
-            @ApiParam(value = "状态 true:正常 false:冻结", required = false) @RequestParam(required = false) Boolean status,
-            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
-            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize
-    ) throws RemoteServiceException {
-        IPage<AdminCompanyWechatRespPageBean> page = adminCompanyWechatLogic.list(userName, nickName, linkPhone, email, status, pageNum, pageSize);
-        return ResponseHelper.success(page);
-    }
-
-    @GetMapping("/mch/export")
-    @ApiOperation(value = "商户列表导出")
-    public void exportMch(
-            @ApiParam(value = "会员帐号", required = false) @RequestParam(required = false) String userName,
-            @ApiParam(value = "用户昵称", required = false) @RequestParam(required = false) String nickName,
-            @ApiParam(value = "联系电话", required = false) @RequestParam(required = false) String linkPhone,
-            @ApiParam(value = "电子邮箱", required = false) @RequestParam(required = false) String email,
-            @ApiParam(value = "状态 true:正常 false:冻结", required = false) @RequestParam(required = false) Boolean status,
-            HttpServletRequest request,
-            HttpServletResponse response
-    ) throws Exception {
-        IPage<AdminUser> page = adminUserLogic.list(userName, nickName, linkPhone, email, status, 1, -1);
-        ExcelData excelData = adminUserLogic.exportMch(page.getRecords());
-        ExcelUtils.exportExcel(request, response, "mch.xlsx", excelData);
-    }
-
-
     @GetMapping("/module/list")
     @ApiOperation(value = "功能菜单权限列表")
     public ResponseHelper<List<AdminModuleTree>> moduleList(

+ 0 - 66
src/main/java/com/gree/mall/manager/controller/admin/ew/EnterpriseWechatWithUserController.java

@@ -1,66 +0,0 @@
-//package com.gree.mall.manager.controller.admin.ew;
-//
-//import com.gree.mall.manager.config.aop.annotation.IsAdmin;
-//import com.gree.mall.manager.helper.ResponseHelper;
-//import com.gree.mall.manager.logic.admin.EnterpriseWechatWithUserLogic;
-//import com.gree.mall.manager.plus.entity.AdminUser;
-//import com.gree.mall.manager.plus.entity.AdminWebsit;
-//import com.gree.mall.manager.plus.entity.EnterpriseWechat;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//import io.swagger.annotations.ApiParam;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.web.bind.annotation.*;
-//
-//import java.util.List;
-//
-//@Api("企业微信用户管理api")
-//@RestController
-//@RequestMapping("/wechat/adminUser")
-//public class EnterpriseWechatWithUserController {
-//
-//
-//    @Autowired
-//    EnterpriseWechatWithUserLogic enterpriseWechatWithUserLogic;
-//
-//    @IsAdmin
-//    @ApiOperation("获取所有企业微信")
-//    @GetMapping("/getAllEnterpriseWechat")
-//    public ResponseHelper<List<EnterpriseWechat>> getAllEnterpriseWechat(
-//            @ApiParam(value = "企业微信id",required = false)@RequestParam(required = false) String enterpriseWechatId,
-//            @ApiParam(value = "企业微信名称",required = false)@RequestParam(required = false) String enterpriseWechatName
-//    ){
-//
-//        return ResponseHelper.success(enterpriseWechatWithUserLogic.getAllEnterpriseWechat(enterpriseWechatId,enterpriseWechatName));
-//    }
-//
-//    @IsAdmin
-//    @ApiOperation("查询所有用户")
-//    @GetMapping("/getAllAdminUser")
-//    public ResponseHelper<List<AdminUser>> getAllAdminUser(
-//            @ApiParam(value = "用户id",required = false)@RequestParam(required = false) String userId,
-//            @ApiParam(value = "账号",required = false)@RequestParam(required = false) String username){
-//
-//        return ResponseHelper.success(enterpriseWechatWithUserLogic.getAllAdminUser(userId,username));
-//    }
-//
-//    @IsAdmin
-//    @ApiOperation("通过用户id查寻其绑定的企业微信")
-//    @GetMapping("/getWebsitIdsByAdminUserId")
-//    public ResponseHelper<List<AdminWebsit>> getWebsitIdsByAdminUserId(
-//            @ApiParam(value = "用户id",required = true)@RequestParam(required = true)String adminUserId){
-//
-//        return ResponseHelper.success(enterpriseWechatWithUserLogic.getEnterpriseWechatIdsByAdminUserId(adminUserId));
-//    }
-//
-//    @IsAdmin
-//    @ApiOperation("变更用户与企业绑定关系")
-//    @PostMapping("/updateAdminUserWebsit")
-//    public ResponseHelper<Void> updateAdminUserWebsit(
-//            @ApiParam(value = "用户id",required = true)@RequestParam(required = true)String adminUserId,
-//            @ApiParam(value = "新的企业id 格式 enterpriseWechat1,格式enterpriseWechat2  固定清除旧的关联 添加新的关联",required = false)
-//            @RequestParam(required = false) String newEnterpriseWechats){
-//        enterpriseWechatWithUserLogic.updateEnterpriseWechatWithUser(adminUserId,newEnterpriseWechats);
-//        return ResponseHelper.success();
-//    }
-//}

+ 0 - 161
src/main/java/com/gree/mall/manager/controller/admin/ew/EnterpriseWechatWorkerController.java

@@ -1,161 +0,0 @@
-package com.gree.mall.manager.controller.admin.ew;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gree.mall.manager.bean.ExcelData;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.admin.ew.EnterpriseWechatWorkerLogic;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.plus.entity.EnterpriseWechatWorker;
-import com.gree.mall.manager.utils.CommonUtils;
-import com.gree.mall.manager.utils.excel.ExcelUtils;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.io.IOException;
-import java.util.List;
-
-@Slf4j
-@RestController
-@Api(value = "企业微信成员管理API", tags ={"企业微信成员管理API"} )
-@RequestMapping(value = "/wechat/enterprise", produces = "application/json; charset=utf-8")
-public class EnterpriseWechatWorkerController {
-
-    @Autowired
-    EnterpriseWechatWorkerLogic enterpriseWechatWorkerLogic;
-    @Autowired
-    CommonLogic commonLogic;
-
-    @GetMapping("/list")
-    @ApiOperation("成员列表")
-    public ResponseHelper<IPage<EnterpriseWechatWorker>> list(
-           @ApiParam(value = "keyword",required = false) @RequestParam(required = false) String keyword,
-           @ApiParam(value = "网点主键",required = false) @RequestParam(required = false) String adminWebsitId,
-           @ApiParam(value = "网点id",required = false) @RequestParam(required = false) String websitId,
-           @ApiParam(value = "页号",required = true) @RequestParam(required = true) Integer pageNo,
-           @ApiParam(value = "页大小",required = true) @RequestParam(required = true) Integer pageSize,
-           HttpServletRequest request
-    ){
-        IPage<EnterpriseWechatWorker> list = enterpriseWechatWorkerLogic.list(keyword, adminWebsitId,websitId, pageNo, pageSize,request);
-        return ResponseHelper.success(list);
-    }
-
-    //String name,String wechatUserId,String position,String mobile,Integer gender,Long mainDepartmentId,String email
-    @PostMapping("/add")
-    @ApiOperation("新增")
-    public ResponseHelper add(
-            @ApiParam(value = "名称", required = true) @RequestParam(required = true) String name,
-            @ApiParam(value = "帐号", required = true) @RequestParam(required = true) String wechatUserId,
-            @ApiParam(value = "职位", required = true) @RequestParam(required = true) String position,
-            @ApiParam(value = "手机号", required = true) @RequestParam(required = true) String mobile,
-            @ApiParam(value = "性别(1=男 2=女 0=未知)", required = true) @RequestParam(required = true) Integer gender,
-            @ApiParam(value = "部门id", required = true) @RequestParam(required = true) Long mainDepartmentId,
-            @ApiParam(value = "邮箱", required = true) @RequestParam(required = true) String email,
-            HttpServletRequest request
-    ) throws RemoteServiceException, WxErrorException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        enterpriseWechatWorkerLogic.add(name, wechatUserId, position, mobile, gender, mainDepartmentId, email, adminUser.getAdminCompanyWechat());
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/update")
-    @ApiOperation("修改")
-    public ResponseHelper update(
-            @ApiParam(value = "id",required = true) @RequestParam(required = true) Integer id,
-            @ApiParam(value = "名称",required = false) @RequestParam(required = false) String name,
-            @ApiParam(value = "帐号",required = false) @RequestParam(required = false) String wechatUserId,
-            @ApiParam(value = "职位",required = false) @RequestParam(required = false) String position,
-            @ApiParam(value = "手机号",required = false) @RequestParam(required = false) String mobile,
-            @ApiParam(value = "性别(1=男 2=女 0=未知)",required = true) @RequestParam(required = false) Integer gender,
-            @ApiParam(value = "部门id",required = false) @RequestParam(required = false) Long mainDepartmentId,
-            @ApiParam(value = "邮箱",required = false) @RequestParam(required = false) String email,
-            HttpServletRequest request
-    ) throws RemoteServiceException, WxErrorException {
-        enterpriseWechatWorkerLogic.update(id,name,wechatUserId,position,mobile,gender,mainDepartmentId,email,request);
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/delete")
-    @ApiOperation("删除")
-    public ResponseHelper delete(
-            @RequestParam List<Integer> id,
-            HttpServletRequest request
-    ) throws WxErrorException {
-        enterpriseWechatWorkerLogic.delete(id,request);
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/excelDelete")
-    @ApiOperation("/导入删除")
-    public ResponseHelper<Void> loadDelete(
-            @RequestParam("file")MultipartFile file,
-            HttpServletRequest request
-    ) throws IOException, WxErrorException {
-
-        enterpriseWechatWorkerLogic.loadDelete(file,request);
-        return ResponseHelper.success();
-    }
-
-    @GetMapping("/downloadDeleteExcel")
-    @ApiOperation("下载导入删除模板")
-    public void downloadDeleteExcel(
-            HttpServletResponse response
-    ) throws Exception {
-        CommonUtils.downloadFile("/template/down_load_delete.xlsx",response);
-    }
-
-
-    @GetMapping("/detail")
-    @ApiOperation("详情")
-    public ResponseHelper<EnterpriseWechatWorker> detail(@RequestParam Integer id) throws WxErrorException {
-        EnterpriseWechatWorker detail = enterpriseWechatWorkerLogic.detail(id);
-        return ResponseHelper.success(detail);
-    }
-
-    @GetMapping("/export")
-    @ApiOperation("导出")
-    public void exportData(
-            @ApiParam(value = "keyword",required = false) @RequestParam(required = false) String keyword,
-            @ApiParam(value = "网点主键",required = false) @RequestParam(required = false) String adminWebsitId,
-            @ApiParam(value = "网点id",required = false) @RequestParam(required = false) String websitId,
-            HttpServletRequest request,
-            HttpServletResponse response
-    ) throws Exception {
-        ExcelData excelData = enterpriseWechatWorkerLogic.exportData(request, keyword, adminWebsitId,websitId);
-        ExcelUtils.exportExcel(request,response,"成员.xlsx",excelData);
-    }
-
-
-    @PostMapping("/import")
-    @ApiOperation("导入")
-    public ResponseHelper importData(
-            @ApiParam(value = "附件",required = true) @RequestParam(required = true) MultipartFile file,
-            @ApiParam(value = "部门id",required = true) @RequestParam(required = true) Long mainDepartmentId,
-            HttpServletRequest request
-    ) throws Exception {
-        List<Object> datas = ExcelUtils.importExcel(file);
-        String s = enterpriseWechatWorkerLogic.importData(datas, mainDepartmentId,request);
-        return ResponseHelper.success(s);
-    }
-
-    @GetMapping("/download")
-    @ApiOperation("下载模板")
-    public void download(
-            HttpServletResponse response
-    ) throws Exception {
-        CommonUtils.downloadFile("/template/wechat_user.xlsx",response);
-    }
-
-}

+ 0 - 26
src/main/java/com/gree/mall/manager/controller/common/CommonController.java

@@ -1,21 +1,15 @@
 package com.gree.mall.manager.controller.common;
 
 import com.gree.mall.manager.annotation.ApiNotAuth;
-import com.gree.mall.manager.config.NumericIdGeneratorConfig;
-import com.gree.mall.manager.constant.Constant;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.logic.ExpressLogic;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.logic.common.GongdanLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
 import com.gree.mall.manager.logic.common.kuaidi100.response.SubscribeResp;
-import com.gree.mall.manager.logic.tag.AsyncWxTagLogic;
 import com.gree.mall.manager.plus.entity.*;
-import com.gree.mall.manager.plus.service.EnterpriseWechatWorkerService;
 import com.gree.mall.manager.plus.service.OrderDetailService;
 import com.gree.mall.manager.plus.service.OrderInfoService;
-import com.gree.mall.manager.utils.RedisUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -28,11 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
 
 
 @Slf4j
@@ -48,10 +38,6 @@ public class CommonController {
     @Autowired
     GongdanLogic gongdanLogic;
     @Autowired
-    WorkWechatLogic workWechatLogic;
-    @Autowired
-    AsyncWxTagLogic asyncWxTagLogic;
-    @Autowired
     OrderInfoService orderInfoService;
     @Autowired
     OrderDetailService orderDetailService;
@@ -133,18 +119,6 @@ public class CommonController {
     }
 
     @ApiNotAuth
-    @GetMapping("/external/last")
-    @ApiOperation(value = "获取最新的客户信息")
-    public ResponseHelper<Map<String,Object>> sync(
-            @ApiParam(required = true, value = "企微成员手机号") @RequestParam(required = true) String mobile,
-            @ApiParam(required = false, value = "外部联系人id") @RequestParam(required = false) String externalUserId
-    ) throws WxErrorException {
-        Map<String, Object> lastExternalUser = asyncWxTagLogic.getLastExternalUser(mobile,externalUserId);
-        return ResponseHelper.success(lastExternalUser);
-    }
-
-
-    @ApiNotAuth
     @ApiOperation("获取获取前往小程序链接")
     @GetMapping("/getUrlScheme")
     public ResponseHelper<String> getUrlScheme(

+ 0 - 36
src/main/java/com/gree/mall/manager/controller/manual/ManualWorkController.java

@@ -1,36 +0,0 @@
-package com.gree.mall.manager.controller.manual;
-
-
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.manual.ManualWorkLogic;
-import com.gree.mall.manager.plus.entity.User;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-@Slf4j
-@RestController
-@Api(value = "人工指定业务员", tags = {"人工指定业务员"})
-@RequestMapping(value = "/manual", produces = "application/json; charset=utf-8")
-public class ManualWorkController {
-    @Autowired
-    private ManualWorkLogic manualWorkLogic;
-    @PostMapping("/assign/worker")
-    @ApiOperation(value = "指定业务员")
-    public ResponseHelper assignWorker(
-            HttpServletRequest request,
-            @ApiParam(value = "个人微信的手机号", required = true) @RequestParam String personalPhone,
-            @ApiParam(value = "企业微信的手机号", required = true) @RequestParam String workPhone
-    ) throws RemoteServiceException {
-        return ResponseHelper.success(manualWorkLogic.assignWorker(request, personalPhone, workPhone));
-    }
-
-}

+ 0 - 70
src/main/java/com/gree/mall/manager/controller/marketing/DynamicMaterialsController.java

@@ -1,70 +0,0 @@
-package com.gree.mall.manager.controller.marketing;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gree.mall.manager.bean.marketing.DynamicMaterialsDetailsBean;
-import com.gree.mall.manager.bean.marketing.DynamicMaterialsPageBean;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.marketing.DynamicMaterialsLogic;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@Api(value = "动态素材", tags = {"动态素材"})
-@RestController
-@RequestMapping(value = "/dynamic/materials", produces = "application/json; charset=utf-8")
-public class DynamicMaterialsController {
-
-
-    @Autowired
-    private DynamicMaterialsLogic dynamicMaterialsLogic;
-
-    @ApiOperation("分页查询动态素材")
-    @GetMapping("/page")
-    public ResponseHelper<IPage<DynamicMaterialsPageBean>> page(
-            HttpServletRequest request,
-            @ApiParam(value = "名称", required = false) @RequestParam(required = false) String name,
-            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
-            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize
-    ) {
-
-        IPage<DynamicMaterialsPageBean> page = dynamicMaterialsLogic.page(request, name, pageNum, pageSize);
-
-        return ResponseHelper.success(page);
-    }
-
-    @ApiOperation("动态素材详情")
-    @GetMapping("/details")
-    public ResponseHelper<DynamicMaterialsDetailsBean> details(
-            HttpServletRequest request,
-            @ApiParam(value = "素材id", required = true) @RequestParam(required = true) String materialsId,
-            @ApiParam(value = "客户名称", required = false) @RequestParam(required = false) String name,
-            @ApiParam(value = "开始时间", required = false) @RequestParam(required = false) String beginTime,
-            @ApiParam(value = "结束时间", required = false) @RequestParam(required = false) String endTime
-    ) {
-
-        DynamicMaterialsDetailsBean details = dynamicMaterialsLogic.details(request, materialsId, name, beginTime, endTime);
-
-        return ResponseHelper.success(details);
-    }
-
-
-    @ApiOperation("批量发消息到企业微信用户")
-    @GetMapping("/sendToEnterpriseWechatWorker")
-    public ResponseHelper<Void> sendToEnterpriseWechatWorker(
-            HttpServletRequest request,
-            @ApiParam(value = "企业微信userid((多个接收者wechatUserId用‘|’分隔,最多支持1000个 指定为'@all',则向该企业应用的全部成员发送))", required = true)
-            @RequestParam(required = true)String wechatUserId,
-            @ApiParam(value = "消息内容 示例:11\n22<a href=\"http://work.weixin.qq.com\">33</a>,44。", required = true)
-            @RequestParam(required = true)String content
-    )  {
-        dynamicMaterialsLogic.sendToEnterpriseWechatWorker(request, wechatUserId, content);
-        return ResponseHelper.success();
-    }
-}

+ 0 - 129
src/main/java/com/gree/mall/manager/controller/marketing/MarketingMaterialsController.java

@@ -1,129 +0,0 @@
-package com.gree.mall.manager.controller.marketing;
-
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.bean.marketing.MarketingMaterialsAddReqBean;
-import com.gree.mall.manager.bean.marketing.MarketingMaterialsUpdateReqBean;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.marketing.MarketingMaterialsLogic;
-import com.gree.mall.manager.plus.entity.MarketingMaterials;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import me.chanjar.weixin.common.error.WxErrorException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-
-@Api(value = "营销素材", tags = {"营销素材"})
-@RestController
-@RequestMapping(value = "/marketing/materials", produces = "application/json; charset=utf-8")
-public class MarketingMaterialsController {
-
-    @Autowired
-    private MarketingMaterialsLogic marketingMaterialsLogic;
-
-
-    @ApiOperation("分页获取营销素材")
-    @GetMapping("/page")
-    public ResponseHelper<IPage<MarketingMaterials>> page(
-            HttpServletRequest request,
-            @ApiParam(value = "标题", required = false) @RequestParam(required = false) String title,
-            @ApiParam(value = "分组id", required = false) @RequestParam(required = false) String groupId,
-            @ApiParam(value = "素材类型: 1:文本  2.图片  3.视屏 4.网页 5.小程序 6.文件", required = true) @RequestParam(required = true) String type,
-            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
-            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize
-    ) throws IOException {
-
-        IPage<MarketingMaterials> page = marketingMaterialsLogic.page(request, title, groupId, type, pageNum, pageSize);
-
-        return ResponseHelper.success(page);
-    }
-
-
-    @ApiOperation("移组")
-    @PostMapping("/moveGroup")
-    public ResponseHelper<Void> moveGroup(
-            HttpServletRequest request,
-            @ApiParam(value = "营销素材id 格式:id1,id2", required = true) @RequestParam(required = true) String marketingMaterialsId,
-            @ApiParam(value = "新营销组id", required = true) @RequestParam(required = true) String newGroupId
-    ) {
-
-        marketingMaterialsLogic.moveGroup(request, marketingMaterialsId, newGroupId);
-
-        return ResponseHelper.success();
-    }
-
-
-    @ApiOperation("重置")
-    @PostMapping("/reset")
-    public ResponseHelper<Void> reset(
-            @ApiParam(value = "营销组id", required = true) @RequestParam(required = true) String groupId,
-            @ApiParam(value = "素材类型: 1:文本  2.图片  3.视屏 4.网页 5.小程序 6.文件", required = true)
-            @RequestParam(required = true) String type
-    ) {
-
-        marketingMaterialsLogic.reset(groupId, type);
-
-        return ResponseHelper.success();
-    }
-
-    @ApiOperation("新增素材")
-    @PostMapping("/add")
-    public ResponseHelper<String> add(
-            HttpServletRequest request, @RequestBody MarketingMaterialsAddReqBean marketingMaterialsAddReqBean
-    ) throws IOException {
-
-        String  id = marketingMaterialsLogic.add(request, marketingMaterialsAddReqBean);
-
-        return ResponseHelper.success(id);
-    }
-
-    @ApiOperation("移除素材")
-    @PostMapping("/deleteById")
-    public ResponseHelper<Void> deleteById(
-            @ApiParam(value = "营销素材id", required = true) @RequestParam(required = true) String marketingMaterialsId
-    ) {
-        marketingMaterialsLogic.deleteById(marketingMaterialsId);
-        return ResponseHelper.success();
-    }
-
-    @ApiOperation("編輯素材")
-    @PostMapping("/update")
-    public ResponseHelper<Void> update(
-            HttpServletRequest request, @RequestBody MarketingMaterialsUpdateReqBean updateReqBean
-    ) throws IOException {
-
-        marketingMaterialsLogic.update(request, updateReqBean);
-
-        return ResponseHelper.success();
-    }
-
-    @ApiOperation("通过id查询編輯详情")
-    @GetMapping("/getUpdateDetailById")
-    public ResponseHelper<MarketingMaterialsUpdateReqBean> getUpdateDetailById(
-            @ApiParam(value = "营销素材id", required = true) @RequestParam(required = true) String marketingMaterialsId
-    ) throws IOException {
-        MarketingMaterialsUpdateReqBean byId = marketingMaterialsLogic.getById(marketingMaterialsId);
-
-        return ResponseHelper.success(byId);
-    }
-
-    @ApiOperation("上传素材至企业微信")
-    @PostMapping("/loadToQyWx")
-    public ResponseHelper<String> loadToQyWx(
-            HttpServletRequest request,
-            @ApiParam(value = "文件url", required = true) @RequestParam(required = true) String fileUrl,
-            @ApiParam(value = "文件类型 图片(image):10MB,支持JPG,PNG格式\n" +
-                    "语音(voice) :2MB,播放长度不超过60s,仅支持AMR格式\n" +
-                    "视频(video) :10MB,支持MP4格式\n" +
-                    "普通文件(file):20MB", required = true) @RequestParam(required = true) String fileType
-    ) throws IOException, WxErrorException {
-        String s = marketingMaterialsLogic.loadToQyWx(request, fileUrl, fileType);
-        return ResponseHelper.success(s);
-    }
-
-}

+ 0 - 62
src/main/java/com/gree/mall/manager/controller/marketing/MarketingMaterialsGroupController.java

@@ -1,62 +0,0 @@
-package com.gree.mall.manager.controller.marketing;
-
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.marketing.MarketingMaterialsGroupLogic;
-import com.gree.mall.manager.plus.entity.MarketingMaterialsGroup;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-
-@Api(value = "营销素材组", tags = {"营销素材组"})
-@RestController
-@RequestMapping(value = "/marketing/group", produces = "application/json; charset=utf-8")
-public class MarketingMaterialsGroupController {
-
-    @Autowired
-    private MarketingMaterialsGroupLogic marketingMaterialsGroupLogic;
-
-
-    @ApiOperation("获取所有分组")
-    @GetMapping("/list")
-    public ResponseHelper<List<MarketingMaterialsGroup>> list(
-            HttpServletRequest request,
-            @ApiParam(value = "分组名称", required = false) @RequestParam(required = false) String groupName
-    ) {
-        return ResponseHelper.success(marketingMaterialsGroupLogic.list(request, groupName));
-    }
-
-
-    @ApiOperation("添加分组")
-    @PostMapping("/add")
-    public ResponseHelper<MarketingMaterialsGroup> add(
-            HttpServletRequest request,
-            @ApiParam(value = "分组名称", required = true) @RequestParam(required = true) String groupName
-    ) {
-        MarketingMaterialsGroup add = marketingMaterialsGroupLogic.add(request, groupName);
-        return ResponseHelper.success(add);
-    }
-
-    @ApiOperation("修改分组名称")
-    @PostMapping("/update")
-    public ResponseHelper<Void> update(@ApiParam(value = "分组id", required = true) @RequestParam(required = true) String groupId,
-                                       @ApiParam(value = "分组名称", required = true) @RequestParam(required = true) String groupName) {
-        marketingMaterialsGroupLogic.update(groupId, groupName);
-        return ResponseHelper.success();
-    }
-
-
-    @ApiOperation("删除分组")
-    @PostMapping("/delete")
-    public ResponseHelper<Void> delete(@ApiParam(value = "分组id", required = true) @RequestParam(required = true) String groupId) {
-
-        marketingMaterialsGroupLogic.delete(groupId);
-        return ResponseHelper.success();
-    }
-
-}

+ 0 - 8
src/main/java/com/gree/mall/manager/controller/member/MemberController.java

@@ -224,14 +224,6 @@ public class MemberController {
         return ResponseHelper.success(userCouponIPage);
     }
 
-    @GetMapping("/wx/list")
-    @ApiOperation(value = "客户列表")
-    public ResponseHelper wxCustomerList(HttpServletRequest request,
-            @ApiParam(required = true, value = "用户id") @RequestParam(required = true) String userId) throws WxErrorException {
-
-        return ResponseHelper.success(userLogic.wxCustomerList(request,userId));
-    }
-
     @PostMapping("/examine/apply")
     @ApiOperation(value = "审核申请业务员")
     public ResponseHelper examineApply(

+ 277 - 277
src/main/java/com/gree/mall/manager/controller/sop/SopRuleController.java

@@ -1,277 +1,277 @@
-package com.gree.mall.manager.controller.sop;
-
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gree.mall.manager.bean.sop.SopPushTaskData;
-import com.gree.mall.manager.bean.sop.SopRuleAdd;
-import com.gree.mall.manager.bean.sop.SopRuleData;
-import com.gree.mall.manager.bean.sop.SopWorkerPushCount;
-import com.gree.mall.manager.constant.Constant;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.sop.SopRuleLogic;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.entity.SopPushTask;
-import com.gree.mall.manager.plus.entity.SopWorkerPush;
-import com.gree.mall.manager.plus.entity.Tag;
-import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.models.auth.In;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.integration.redis.util.RedisLockRegistry;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-
-/**
- * <p>
- * 个人sop 前端控制器
- * </p>
- *
- * @author change
- * @since 2022-04-25
- */
-@Slf4j
-@RestController
-@Api(value = "个人sop", tags = {"个人sop"})
-@RequestMapping(value = "/sopRule", produces = "application/json; charset=utf-8")
-public class SopRuleController {
-
-
-    @Autowired
-    private SopRuleLogic sopRuleLogic;
-
-    @Autowired
-    RedisLockRegistry redisLockRegistry;
-
-    @Autowired
-    AdminCompanyWechatService adminCompanyWechatService;
-
-    @ApiOperation("个人sop-list")
-    @GetMapping("/list")
-    public ResponseHelper<IPage<SopRuleData>> list(
-            HttpServletRequest request,
-            @ApiParam(value = "规则名称", required = false) @RequestParam(required = false) String ruleName,
-            @ApiParam(value = "状态 1启用 0停用", required = false) @RequestParam(required = false) Integer status,
-            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
-            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize
-    ) throws IOException {
-
-        IPage<SopRuleData> list = sopRuleLogic.list(ruleName, status, request, pageNum, pageSize);
-        return ResponseHelper.success(list);
-    }
-
-    @ApiOperation("个人sop-详情")
-    @GetMapping("/detail")
-    public ResponseHelper<SopRuleData> detail(
-            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
-    ) throws IOException {
-
-        SopRuleData sopRuleData = sopRuleLogic.detail(id);
-        return ResponseHelper.success(sopRuleData);
-    }
-
-
-    @PostMapping("/add")
-    @ApiOperation("个人sop-新增规则")
-    public ResponseHelper add(
-            @ApiParam(value = "客服ID,任务,多个", required = true) @RequestBody SopRuleAdd sopRuleAdd,
-            HttpServletRequest request
-    ) throws RemoteServiceException, InterruptedException {
-
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.add(sopRuleAdd, request);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/addKeFu")
-    @ApiOperation("个人sop-新增客服")
-    public ResponseHelper addKeFu(
-            @ApiParam(value = "客服ID,任务,多个", required = true) @RequestBody SopRuleAdd sopRuleAdd,
-            HttpServletRequest request
-    ) throws RemoteServiceException, InterruptedException {
-
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.addKeFu(sopRuleAdd, request);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/edit")
-    @ApiOperation("个人sop-修改规则")
-    public ResponseHelper edit(
-            @ApiParam(value = "客服ID,任务,多个", required = true) @RequestBody SopRuleAdd sopRuleAdd,
-            HttpServletRequest request
-    ) throws RemoteServiceException, InterruptedException {
-
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.edit(sopRuleAdd, request);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/delete")
-    @ApiOperation("个人sop-删除规则")
-    public ResponseHelper delete(
-            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
-    ) throws RemoteServiceException, InterruptedException {
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC+id);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.delete(id);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/addPushTask")
-    @ApiOperation("个人sop-新增任务")
-    public ResponseHelper addPushTask(
-            @ApiParam(value = "规则ID", required = true) @RequestParam(required = true) String id,
-            @RequestBody SopPushTaskData sopPushTaskData,
-            HttpServletRequest request
-    ) throws RemoteServiceException, InterruptedException {
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.addPushTask(sopPushTaskData,id,request);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/editPushTask")
-    @ApiOperation("个人sop-修改任务")
-    public ResponseHelper editPushTask(
-            @RequestBody SopPushTaskData sopPushTaskData,
-            HttpServletRequest request
-    ) throws RemoteServiceException, InterruptedException {
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.editPushTask(sopPushTaskData);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @PostMapping("/deleteTask")
-    @ApiOperation("个人sop-删除任务")
-    public ResponseHelper deleteTask(
-            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
-    ) throws RemoteServiceException, InterruptedException {
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.deleteTask(id);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @ApiOperation("个人sop-任务详情")
-    @GetMapping("/detailTask")
-    public ResponseHelper<SopPushTaskData> detailTask(
-            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
-    ) throws IOException {
-        SopPushTaskData sopPushTaskData = sopRuleLogic.detailTask(id);
-        return ResponseHelper.success(sopPushTaskData);
-    }
-
-    @ApiOperation("个人sop-客户列表")
-    @GetMapping("/taskList")
-    public ResponseHelper<IPage<SopWorkerPush>> taskList(
-            @ApiParam(value = "任务ID", required = true) @RequestParam(required = true) String taskId,
-            @ApiParam(value = "规则ID", required = true) @RequestParam(required = true) String ruleId,
-            @ApiParam(value = "客户信息", required = false) @RequestParam(required = false) String externalName,
-            @ApiParam(value = "推送开始时间", required = false) @RequestParam(required = false) String startTime,
-            @ApiParam(value = "推送结束时间", required = false) @RequestParam(required = false) String endTime,
-            @ApiParam(value = "员工执行状态 1执行 0未执行", required = false) @RequestParam(required = false)  Integer workerStatus,
-            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
-            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize,
-            HttpServletRequest request
-    ) throws IOException {
-        IPage<SopWorkerPush> sopWorkerPush = sopRuleLogic.taskList(taskId,ruleId,externalName,startTime,endTime,workerStatus,request,pageNum,pageSize);
-        return ResponseHelper.success(sopWorkerPush);
-    }
-
-    @ApiOperation("个人sop-任务统计")
-    @GetMapping("/taskCount")
-    public ResponseHelper<SopWorkerPushCount> taskCount(
-            @ApiParam(value = "任务ID", required = true) @RequestParam(required = true) String taskId,
-            @ApiParam(value = "规则ID", required = true) @RequestParam(required = true) String ruleId,
-            HttpServletRequest request
-    ) throws IOException {
-        SopWorkerPushCount sopWorkerPushCount = sopRuleLogic.taskCount(taskId,ruleId,request);
-        return ResponseHelper.success(sopWorkerPushCount);
-    }
-
-
-    @PostMapping("/addCompanyToken")
-    @ApiOperation("企业配置token-变更")
-    public ResponseHelper addCompanyToken(
-            @ApiParam(value = "token微信事件回调", required = true) @RequestParam(required = true) String token,
-            @ApiParam(value = "encodingAES_key微信事件回调", required = true) @RequestParam(required = true) String encodingAES_key,
-            HttpServletRequest request
-    ) throws RemoteServiceException, InterruptedException {
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC+token);
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            sopRuleLogic.addCompanyToken(token,encodingAES_key,request);
-        } finally {
-            obtain.unlock();
-        }
-        return ResponseHelper.success();
-    }
-
-    @ApiOperation("企业配置的token-详情")
-    @GetMapping("/detailCompany")
-    public ResponseHelper<SopPushTaskData> detailCompany(
-            HttpServletRequest request
-    ) throws IOException {
-        AdminCompanyWechat adminCompanyWechat = sopRuleLogic.detailCompany(request);
-        return ResponseHelper.success(adminCompanyWechat);
-    }
-}
-
+//package com.gree.mall.manager.controller.sop;
+//
+//
+//import com.baomidou.mybatisplus.core.metadata.IPage;
+//import com.gree.mall.manager.bean.sop.SopPushTaskData;
+//import com.gree.mall.manager.bean.sop.SopRuleAdd;
+//import com.gree.mall.manager.bean.sop.SopRuleData;
+//import com.gree.mall.manager.bean.sop.SopWorkerPushCount;
+//import com.gree.mall.manager.constant.Constant;
+//import com.gree.mall.manager.exception.RemoteServiceException;
+//import com.gree.mall.manager.helper.ResponseHelper;
+//import com.gree.mall.manager.logic.sop.SopRuleLogic;
+//import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
+//import com.gree.mall.manager.plus.entity.SopPushTask;
+//import com.gree.mall.manager.plus.entity.SopWorkerPush;
+//import com.gree.mall.manager.plus.entity.Tag;
+//import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
+//import io.swagger.annotations.Api;
+//import io.swagger.annotations.ApiOperation;
+//import io.swagger.annotations.ApiParam;
+//import io.swagger.models.auth.In;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.integration.redis.util.RedisLockRegistry;
+//import org.springframework.web.bind.annotation.*;
+//
+//import javax.servlet.http.HttpServletRequest;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.util.List;
+//import java.util.concurrent.TimeUnit;
+//import java.util.concurrent.locks.Lock;
+//
+///**
+// * <p>
+// * 个人sop 前端控制器
+// * </p>
+// *
+// * @author change
+// * @since 2022-04-25
+// */
+//@Slf4j
+//@RestController
+//@Api(value = "个人sop", tags = {"个人sop"})
+//@RequestMapping(value = "/sopRule", produces = "application/json; charset=utf-8")
+//public class SopRuleController {
+//
+//
+//    @Autowired
+//    private SopRuleLogic sopRuleLogic;
+//
+//    @Autowired
+//    RedisLockRegistry redisLockRegistry;
+//
+//    @Autowired
+//    AdminCompanyWechatService adminCompanyWechatService;
+//
+//    @ApiOperation("个人sop-list")
+//    @GetMapping("/list")
+//    public ResponseHelper<IPage<SopRuleData>> list(
+//            HttpServletRequest request,
+//            @ApiParam(value = "规则名称", required = false) @RequestParam(required = false) String ruleName,
+//            @ApiParam(value = "状态 1启用 0停用", required = false) @RequestParam(required = false) Integer status,
+//            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
+//            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize
+//    ) throws IOException {
+//
+//        IPage<SopRuleData> list = sopRuleLogic.list(ruleName, status, request, pageNum, pageSize);
+//        return ResponseHelper.success(list);
+//    }
+//
+//    @ApiOperation("个人sop-详情")
+//    @GetMapping("/detail")
+//    public ResponseHelper<SopRuleData> detail(
+//            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
+//    ) throws IOException {
+//
+//        SopRuleData sopRuleData = sopRuleLogic.detail(id);
+//        return ResponseHelper.success(sopRuleData);
+//    }
+//
+//
+//    @PostMapping("/add")
+//    @ApiOperation("个人sop-新增规则")
+//    public ResponseHelper add(
+//            @ApiParam(value = "客服ID,任务,多个", required = true) @RequestBody SopRuleAdd sopRuleAdd,
+//            HttpServletRequest request
+//    ) throws RemoteServiceException, InterruptedException {
+//
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.add(sopRuleAdd, request);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @PostMapping("/addKeFu")
+//    @ApiOperation("个人sop-新增客服")
+//    public ResponseHelper addKeFu(
+//            @ApiParam(value = "客服ID,任务,多个", required = true) @RequestBody SopRuleAdd sopRuleAdd,
+//            HttpServletRequest request
+//    ) throws RemoteServiceException, InterruptedException {
+//
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.addKeFu(sopRuleAdd, request);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @PostMapping("/edit")
+//    @ApiOperation("个人sop-修改规则")
+//    public ResponseHelper edit(
+//            @ApiParam(value = "客服ID,任务,多个", required = true) @RequestBody SopRuleAdd sopRuleAdd,
+//            HttpServletRequest request
+//    ) throws RemoteServiceException, InterruptedException {
+//
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.edit(sopRuleAdd, request);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @PostMapping("/delete")
+//    @ApiOperation("个人sop-删除规则")
+//    public ResponseHelper delete(
+//            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
+//    ) throws RemoteServiceException, InterruptedException {
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC+id);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.delete(id);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @PostMapping("/addPushTask")
+//    @ApiOperation("个人sop-新增任务")
+//    public ResponseHelper addPushTask(
+//            @ApiParam(value = "规则ID", required = true) @RequestParam(required = true) String id,
+//            @RequestBody SopPushTaskData sopPushTaskData,
+//            HttpServletRequest request
+//    ) throws RemoteServiceException, InterruptedException {
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.addPushTask(sopPushTaskData,id,request);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @PostMapping("/editPushTask")
+//    @ApiOperation("个人sop-修改任务")
+//    public ResponseHelper editPushTask(
+//            @RequestBody SopPushTaskData sopPushTaskData,
+//            HttpServletRequest request
+//    ) throws RemoteServiceException, InterruptedException {
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.editPushTask(sopPushTaskData);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @PostMapping("/deleteTask")
+//    @ApiOperation("个人sop-删除任务")
+//    public ResponseHelper deleteTask(
+//            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
+//    ) throws RemoteServiceException, InterruptedException {
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.deleteTask(id);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @ApiOperation("个人sop-任务详情")
+//    @GetMapping("/detailTask")
+//    public ResponseHelper<SopPushTaskData> detailTask(
+//            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
+//    ) throws IOException {
+//        SopPushTaskData sopPushTaskData = sopRuleLogic.detailTask(id);
+//        return ResponseHelper.success(sopPushTaskData);
+//    }
+//
+//    @ApiOperation("个人sop-客户列表")
+//    @GetMapping("/taskList")
+//    public ResponseHelper<IPage<SopWorkerPush>> taskList(
+//            @ApiParam(value = "任务ID", required = true) @RequestParam(required = true) String taskId,
+//            @ApiParam(value = "规则ID", required = true) @RequestParam(required = true) String ruleId,
+//            @ApiParam(value = "客户信息", required = false) @RequestParam(required = false) String externalName,
+//            @ApiParam(value = "推送开始时间", required = false) @RequestParam(required = false) String startTime,
+//            @ApiParam(value = "推送结束时间", required = false) @RequestParam(required = false) String endTime,
+//            @ApiParam(value = "员工执行状态 1执行 0未执行", required = false) @RequestParam(required = false)  Integer workerStatus,
+//            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
+//            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize,
+//            HttpServletRequest request
+//    ) throws IOException {
+//        IPage<SopWorkerPush> sopWorkerPush = sopRuleLogic.taskList(taskId,ruleId,externalName,startTime,endTime,workerStatus,request,pageNum,pageSize);
+//        return ResponseHelper.success(sopWorkerPush);
+//    }
+//
+//    @ApiOperation("个人sop-任务统计")
+//    @GetMapping("/taskCount")
+//    public ResponseHelper<SopWorkerPushCount> taskCount(
+//            @ApiParam(value = "任务ID", required = true) @RequestParam(required = true) String taskId,
+//            @ApiParam(value = "规则ID", required = true) @RequestParam(required = true) String ruleId,
+//            HttpServletRequest request
+//    ) throws IOException {
+//        SopWorkerPushCount sopWorkerPushCount = sopRuleLogic.taskCount(taskId,ruleId,request);
+//        return ResponseHelper.success(sopWorkerPushCount);
+//    }
+//
+//
+//    @PostMapping("/addCompanyToken")
+//    @ApiOperation("企业配置token-变更")
+//    public ResponseHelper addCompanyToken(
+//            @ApiParam(value = "token微信事件回调", required = true) @RequestParam(required = true) String token,
+//            @ApiParam(value = "encodingAES_key微信事件回调", required = true) @RequestParam(required = true) String encodingAES_key,
+//            HttpServletRequest request
+//    ) throws RemoteServiceException, InterruptedException {
+//        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC+token);
+//        try {
+//            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+//                throw new RemoteServiceException("系统繁忙,请稍后再试");
+//            }
+//            sopRuleLogic.addCompanyToken(token,encodingAES_key,request);
+//        } finally {
+//            obtain.unlock();
+//        }
+//        return ResponseHelper.success();
+//    }
+//
+//    @ApiOperation("企业配置的token-详情")
+//    @GetMapping("/detailCompany")
+//    public ResponseHelper<SopPushTaskData> detailCompany(
+//            HttpServletRequest request
+//    ) throws IOException {
+//        AdminCompanyWechat adminCompanyWechat = sopRuleLogic.detailCompany(request);
+//        return ResponseHelper.success(adminCompanyWechat);
+//    }
+//}
+//

+ 0 - 55
src/main/java/com/gree/mall/manager/controller/tag/TagController.java

@@ -1,55 +0,0 @@
-package com.gree.mall.manager.controller.tag;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gree.mall.manager.bean.goods.GoodsTypeCount;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.tag.TagLogic;
-import com.gree.mall.manager.plus.entity.Tag;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@Slf4j
-@RestController
-@Api(value = "标签管理", tags ={"标签管理"} )
-@RequestMapping(value = "/tag", produces = "application/json; charset=utf-8")
-public class TagController {
-
-    @Autowired
-    TagLogic tagLogic;
-
-
-    @GetMapping("/list")
-    @ApiOperation("微信标签列表")
-    public ResponseHelper<IPage<Tag>> list(
-            HttpServletRequest request,
-            @ApiParam(value = "页号",required = true) @RequestParam Integer pageNum,
-            @ApiParam(value = "页大小",required = true) @RequestParam Integer pageSize
-    ){
-        IPage<Tag> list = tagLogic.list(request, pageNum, pageSize);
-        return ResponseHelper.success(list);
-    }
-
-    @GetMapping("/sync")
-    @ApiOperation("同步最新的企业微信标签")
-    public ResponseHelper sync(HttpServletRequest request) throws WxErrorException {
-        tagLogic.sync(request);
-        return ResponseHelper.success();
-    }
-
-
-
-
-
-
-}

+ 0 - 92
src/main/java/com/gree/mall/manager/controller/tag/TagGroupController.java

@@ -1,92 +0,0 @@
-package com.gree.mall.manager.controller.tag;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.gree.mall.manager.annotation.ApiNotAuth;
-import com.gree.mall.manager.bean.tag.TagGroupBean;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.logic.tag.TagGroupLogic;
-import com.gree.mall.manager.plus.entity.Tag;
-import com.gree.mall.manager.plus.entity.TagGroup;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.rmi.RemoteException;
-import java.util.List;
-
-@Slf4j
-@RestController
-@Api(value = "标签组管理", tags ={"标签组管理"} )
-@RequestMapping(value = "/tag/group", produces = "application/json; charset=utf-8")
-public class TagGroupController {
-
-    @Autowired
-    private TagGroupLogic tagGroupLogic;
-
-
-    @ApiNotAuth
-    @GetMapping("/list")
-    @ApiOperation("获取标签组列表")
-    public ResponseHelper list(HttpServletRequest request){
-        return ResponseHelper.success(tagGroupLogic.list(request));
-    }
-
-    @GetMapping("/tag/list")
-    @ApiOperation("根据标签组id获取标签列表")
-    public ResponseHelper<List<Tag>> listTag(@ApiParam(value = "标签组id",required = true) @RequestParam String tagGroupId){
-
-        return ResponseHelper.success(tagGroupLogic.listTag(tagGroupId));
-    }
-
-    @PostMapping("/add")
-    @ApiOperation("添加标签组")
-    public ResponseHelper<TagGroup> add(
-            @ApiParam(value = "标签组名称",required = true) @RequestParam String groupName,
-            HttpServletRequest request
-    ) throws RemoteServiceException {
-        return ResponseHelper.success(tagGroupLogic.add(groupName,request));
-
-    }
-
-    @PostMapping("/tag/add")
-    @ApiOperation("添加标签")
-    public ResponseHelper<Tag> addTag(
-            @ApiParam(value = "标签组id",required = true) @RequestParam String tagGroupId,
-            @ApiParam(value = "标签名称",required = true) @RequestParam String tagName,
-            HttpServletRequest request
-    ) throws RemoteServiceException {
-        return ResponseHelper.success(tagGroupLogic.addTag(tagGroupId,tagName,request));
-    }
-
-    @PostMapping("/del")
-    @ApiOperation("删除标签组")
-    public ResponseHelper del(
-            @ApiParam(value = "标签组id",required = true) @RequestParam String tagGroupId,
-            HttpServletRequest request
-    ) throws RemoteServiceException {
-        tagGroupLogic.del(tagGroupId,request);
-        return ResponseHelper.success();
-    }
-
-
-    @PostMapping("/update")
-    @ApiOperation("编辑标签,仅修改标签名称")
-    public ResponseHelper update(
-            @ApiParam(value = "object",required = true) @RequestBody TagGroupBean tagGroupBean,
-            HttpServletRequest request
-    ) throws RemoteServiceException {
-        tagGroupLogic.update(tagGroupBean,request);
-        return ResponseHelper.success();
-    }
-
-
-
-}

+ 93 - 93
src/main/java/com/gree/mall/manager/controller/wxCustomer/WeCallBackController.java

@@ -1,93 +1,93 @@
-package com.gree.mall.manager.controller.wxCustomer;
-
-
-import cn.hutool.http.HttpUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.gree.mall.manager.annotation.ApiNotAuth;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.logic.sop.SopRuleLogic;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
-import com.gree.mall.manager.utils.wecom.WxCryptUtil;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModelProperty;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
-import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage;
-import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author danmo
- * @description 企微回调通知接口
- * @date 2020/11/6 17:31
- **/
-@Api(tags = "企微回调通知")
-@Slf4j
-@RestController
-@RequestMapping("/wx/callback")
-public class WeCallBackController {
-
-    @Autowired
-    private SopRuleLogic sopRuleLogic;
-
-    @Autowired
-    private AdminCompanyWechatService adminCompanyWechatService;
-
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
-
-    @ApiModelProperty("post数据接收")
-    @PostMapping(value = "/recive/{corpId}")
-    @ApiNotAuth
-    public String recive(@RequestBody String msg, @RequestParam(name = "msg_signature") String signature,
-                         String timestamp, String nonce,@PathVariable("corpId") String corpId) {
-        AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getOne(Wrappers.<AdminCompanyWechat>lambdaQuery().eq(AdminCompanyWechat::getCorpId, corpId).last("limit 1"));
-        WxCryptUtil wxCryptUtil = new WxCryptUtil(adminCompanyWechat.getToken(), adminCompanyWechat.getEncodingaesKey(), corpId);
-        try {
-            String decrypt = wxCryptUtil.decrypt(signature, timestamp, nonce, msg);
-            sopRuleLogic.pushTaskWorker(decrypt,corpId);
-            return decrypt;
-        } catch (Exception e) {
-            e.printStackTrace();;
-            String sRespData = WxCryptUtil.getTextRespData("success");
-            return wxCryptUtil.encrypt(sRespData);
-        }
-    }
-
-    @ApiModelProperty("get数据校验")
-    @GetMapping(value = "/recive/{corpId}")
-    @ApiNotAuth
-    public String recive(HttpServletRequest request,@PathVariable("corpId") String corpId) {
-        // 微信加密签名
-        String sVerifyMsgSig = request.getParameter("msg_signature");
-        // 时间戳
-        String sVerifyTimeStamp = request.getParameter("timestamp");
-        // 随机数
-        String sVerifyNonce = request.getParameter("nonce");
-        // 随机字符串
-        String sVerifyEchoStr = request.getParameter("echostr");
-
-        AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getOne(Wrappers.<AdminCompanyWechat>lambdaQuery().eq(AdminCompanyWechat::getCorpId, corpId).last("limit 1"));
-        WxCryptUtil wxCryptUtil = new WxCryptUtil(adminCompanyWechat.getToken(), adminCompanyWechat.getEncodingaesKey(), corpId);
-        try {
-            String s = wxCryptUtil.verifyURL(sVerifyMsgSig, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr);
-            return s;
-        } catch (Exception e) {
-            return "error";
-        }
-    }
-
-}
+//package com.gree.mall.manager.controller.wxCustomer;
+//
+//
+//import cn.hutool.http.HttpUtil;
+//import com.alibaba.fastjson.JSON;
+//import com.alibaba.fastjson.JSONObject;
+//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+//import com.gree.mall.manager.annotation.ApiNotAuth;
+//import com.gree.mall.manager.logic.common.WorkWechatLogic;
+//import com.gree.mall.manager.logic.sop.SopRuleLogic;
+//import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
+//import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
+//import com.gree.mall.manager.utils.wecom.WxCryptUtil;
+//import io.swagger.annotations.Api;
+//import io.swagger.annotations.ApiModelProperty;
+//import io.swagger.annotations.ApiOperation;
+//import lombok.extern.slf4j.Slf4j;
+//import me.chanjar.weixin.cp.api.WxCpService;
+//import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage;
+//import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage;
+//import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.http.MediaType;
+//import org.springframework.web.bind.annotation.*;
+//import org.springframework.web.context.request.RequestContextHolder;
+//import org.springframework.web.context.request.ServletRequestAttributes;
+//
+//import javax.servlet.http.HttpServletRequest;
+//import java.util.HashMap;
+//import java.util.Map;
+//
+///**
+// * @author danmo
+// * @description 企微回调通知接口
+// * @date 2020/11/6 17:31
+// **/
+//@Api(tags = "企微回调通知")
+//@Slf4j
+//@RestController
+//@RequestMapping("/wx/callback")
+//public class WeCallBackController {
+//
+//    @Autowired
+//    private SopRuleLogic sopRuleLogic;
+//
+//    @Autowired
+//    private AdminCompanyWechatService adminCompanyWechatService;
+//
+//    @Autowired
+//    private WorkWechatLogic workWechatLogic;
+//
+//    @ApiModelProperty("post数据接收")
+//    @PostMapping(value = "/recive/{corpId}")
+//    @ApiNotAuth
+//    public String recive(@RequestBody String msg, @RequestParam(name = "msg_signature") String signature,
+//                         String timestamp, String nonce,@PathVariable("corpId") String corpId) {
+//        AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getOne(Wrappers.<AdminCompanyWechat>lambdaQuery().eq(AdminCompanyWechat::getCorpId, corpId).last("limit 1"));
+//        WxCryptUtil wxCryptUtil = new WxCryptUtil(adminCompanyWechat.getToken(), adminCompanyWechat.getEncodingaesKey(), corpId);
+//        try {
+//            String decrypt = wxCryptUtil.decrypt(signature, timestamp, nonce, msg);
+//            sopRuleLogic.pushTaskWorker(decrypt,corpId);
+//            return decrypt;
+//        } catch (Exception e) {
+//            e.printStackTrace();;
+//            String sRespData = WxCryptUtil.getTextRespData("success");
+//            return wxCryptUtil.encrypt(sRespData);
+//        }
+//    }
+//
+//    @ApiModelProperty("get数据校验")
+//    @GetMapping(value = "/recive/{corpId}")
+//    @ApiNotAuth
+//    public String recive(HttpServletRequest request,@PathVariable("corpId") String corpId) {
+//        // 微信加密签名
+//        String sVerifyMsgSig = request.getParameter("msg_signature");
+//        // 时间戳
+//        String sVerifyTimeStamp = request.getParameter("timestamp");
+//        // 随机数
+//        String sVerifyNonce = request.getParameter("nonce");
+//        // 随机字符串
+//        String sVerifyEchoStr = request.getParameter("echostr");
+//
+//        AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getOne(Wrappers.<AdminCompanyWechat>lambdaQuery().eq(AdminCompanyWechat::getCorpId, corpId).last("limit 1"));
+//        WxCryptUtil wxCryptUtil = new WxCryptUtil(adminCompanyWechat.getToken(), adminCompanyWechat.getEncodingaesKey(), corpId);
+//        try {
+//            String s = wxCryptUtil.verifyURL(sVerifyMsgSig, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr);
+//            return s;
+//        } catch (Exception e) {
+//            return "error";
+//        }
+//    }
+//
+//}

+ 28 - 0
src/main/java/com/gree/mall/manager/enums/StatusEnum.java

@@ -0,0 +1,28 @@
+package com.gree.mall.manager.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.baomidou.mybatisplus.annotation.IEnum;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.gree.mall.manager.enums.base.BaseEnum;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@Getter
+@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
+public enum StatusEnum implements BaseEnum, IEnum<Boolean> {
+    ONE("true", "启用"),
+    TWO("false", "禁用"),
+    ;
+
+    @EnumValue
+    @JsonValue
+    private final String key;
+    private final String remark;
+
+
+    @Override
+    public Boolean getValue() {
+        return Boolean.parseBoolean(key);
+    }
+}

+ 85 - 0
src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyPayConfigLogic.java

@@ -0,0 +1,85 @@
+package com.gree.mall.manager.logic.admin;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminCompanyPayConfigBean;
+import com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO;
+import com.gree.mall.manager.bean.admin.AdminCompanyVO;
+import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.commonmapper.CommonMapper;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
+import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class AdminCompanyPayConfigLogic {
+
+
+    private final CommonMapper commonMapper;
+    private final CommonLogic commonLogic;
+    private final AdminCompanyWechatService adminCompanyWechatService;
+
+
+    public IPage<AdminCompanyPayConfigVO> page(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        FieldUtils.supplyParam(zfireParamBean, AdminCompanyPayConfigVO.class, adminUser);
+        return commonMapper.adminCompanyPayConfigPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+    }
+
+    public AdminCompanyPayConfigBean detail(String id) {
+        final AdminCompanyWechat companyWechat = adminCompanyWechatService.getById(id);
+        AdminCompanyPayConfigBean bean = new AdminCompanyPayConfigBean();
+        BeanUtils.copyProperties(companyWechat, bean);
+        return bean;
+    }
+
+    public void add(AdminCompanyPayConfigBean bean) {
+        this.checkParams(bean);
+        bean.insert();
+    }
+
+    public void checkParams(AdminCompanyPayConfigBean bean) {
+        if (StringUtils.isBlank(bean.getCompanyName())) {
+            throw new RemoteServiceException("电子商户名称不能为空");
+        }
+        if (StringUtils.isBlank(bean.getAppId())) {
+            throw new RemoteServiceException("appid不能为空");
+        }
+        if (StringUtils.isBlank(bean.getSubAppId())) {
+            throw new RemoteServiceException("子商户appid不能为空");
+        }
+        if (StringUtils.isBlank(bean.getMchId())) {
+            throw new RemoteServiceException("mchid不能为空");
+        }
+        if (StringUtils.isBlank(bean.getSubMchId())) {
+            throw new RemoteServiceException("子商户mchid不能为空");
+        }
+        if (StringUtils.isBlank(bean.getMchKey())) {
+            throw new RemoteServiceException("key不能为空");
+        }
+        if (StringUtils.isBlank(bean.getSubSecret())) {
+            throw new RemoteServiceException("子商户密钥不能为空");
+        }
+    }
+
+    public void edit(AdminCompanyPayConfigBean bean) {
+        this.checkParams(bean);
+        bean.updateById();
+    }
+
+    public IPage<AdminCompanyVO> adminCompanyPage(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        FieldUtils.supplyParam(zfireParamBean, AdminCompanyPayConfigVO.class, adminUser);
+        return commonMapper.adminCompanyPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+    }
+}

+ 0 - 91
src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyWechatLogic.java

@@ -1,91 +0,0 @@
-package com.gree.mall.manager.logic.admin;
-
-import com.aliyuncs.utils.StringUtils;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gree.mall.manager.bean.admin.reqDto.AdminCompanyWechatReqBean;
-import com.gree.mall.manager.bean.admin.reqDto.AdminUserAddReqBean;
-import com.gree.mall.manager.bean.admin.respDto.AdminCompanyWechatRespPageBean;
-import com.gree.mall.manager.commonmapper.AdminMapper;
-import com.gree.mall.manager.enums.RoleTypeEnum;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.entity.AdminRole;
-import com.gree.mall.manager.plus.entity.AdminUser;
-import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
-import com.gree.mall.manager.plus.service.AdminRoleService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.servlet.http.HttpServletRequest;
-
-@Slf4j
-@Service
-public class AdminCompanyWechatLogic {
-
-    @Autowired
-    AdminRoleService adminRoleService;
-    @Autowired
-    private AdminCompanyWechatService adminCompanyWechatService;
-    @Autowired
-    private AdminMapper adminMapper;
-    @Autowired
-    private AdminUserLogic adminUserLogic;
-    @Autowired
-    AdminCompanyWechatTemplateLogic adminCompanyWechatTemplateLogic;
-    @Autowired
-    AdminCompanyWechatOtherLogic adminCompanyWechatOtherLogic;
-
-    /**
-     * 商户列表
-     */
-    public IPage<AdminCompanyWechatRespPageBean> list(String userName, String nickName, String linkPhone, String email, Boolean status, Integer pageNum, Integer pageSize) {
-
-        return adminMapper.pageCompanyWechat(new Page(pageNum, pageSize), userName, nickName, linkPhone, email, status);
-    }
-
-
-    /**
-     * 新增商户
-     */
-    @Transactional
-    public void addCompanyWechat(AdminCompanyWechatReqBean adminCompanyWechat, HttpServletRequest request) {
-        adminCompanyWechat.insert();
-
-        AdminUser adminUser = new AdminUser();
-        adminUser.setNickName(adminCompanyWechat.getNickName());
-        adminUser.setType(RoleTypeEnum.COMPANY.getCode() - 1);
-        adminUser.setUserName(adminCompanyWechat.getUserName());
-        adminUser.setPassword(adminCompanyWechat.getPassword());
-        adminUser.setLinkName(adminCompanyWechat.getLinkName());
-        adminUser.setLinkPhone(adminCompanyWechat.getLinkPhone());
-        adminUser.setCompanyWechatId(adminCompanyWechat.getCompanyWechatId());
-        adminUser.setCompanyName(adminCompanyWechat.getCompanyName());
-
-        AdminRole adminRole = adminRoleService.lambdaQuery().eq(AdminRole::getName, "企业负责人").one();
-
-        AdminUserAddReqBean adminUserAddReqBean = new AdminUserAddReqBean();
-        BeanUtils.copyProperties(adminUser, adminUserAddReqBean);
-        adminUserAddReqBean.setRoleId(adminRole.getAdminRoleId());
-        //添加企业用户
-        adminUserLogic.save(adminUserAddReqBean, request);
-
-        //初始化模板
-        adminCompanyWechatTemplateLogic.initCompanyWechatTemplate(adminCompanyWechat.getCompanyWechatId(), adminCompanyWechat.getCompanyName());
-        //初始化其他配置
-        adminCompanyWechatOtherLogic.init(adminCompanyWechat.getCompanyWechatId(), adminCompanyWechat.getCompanyName());
-    }
-
-    /**
-     * 编辑商户
-     */
-    public void updateCompanyWechat(AdminCompanyWechat adminCompanyWechat) {
-        if (StringUtils.isEmpty(adminCompanyWechat.getCompanyWechatId())) {
-            throw new RemoteServiceException("商户配置id不能为null");
-        }
-        adminCompanyWechat.updateById();
-    }
-}

+ 0 - 125
src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyWechatTemplateLogic.java

@@ -1,125 +0,0 @@
-package com.gree.mall.manager.logic.admin;
-
-import com.aliyuncs.utils.StringUtils;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.gree.mall.manager.bean.admin.reqDto.AdminCompanyWechatTemplateUpdateReqDto;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechatTemplate;
-import com.gree.mall.manager.plus.service.AdminCompanyWechatTemplateService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.List;
-
-@Slf4j
-@Service
-public class AdminCompanyWechatTemplateLogic {
-
-
-    @Autowired
-    private AdminCompanyWechatTemplateService adminCompanyWechatTemplateService;
-
-    /**
-     * 获取企业下模板
-     */
-    public List<AdminCompanyWechatTemplate> getTemplate(String companyId) {
-        return adminCompanyWechatTemplateService.lambdaQuery()
-                .eq(AdminCompanyWechatTemplate::getCompanyWechatId, companyId)
-                .list();
-    }
-
-
-    /**
-     * 更改模板信息
-     */
-    public void updateTemplate(HttpServletRequest request, AdminCompanyWechatTemplate adminCompanyWechatTemplate) {
-
-        if (StringUtils.isEmpty(adminCompanyWechatTemplate.getCompanyWechatTemplateId())) {
-            throw new RemoteServiceException("模板id不能为null");
-        }
-        adminCompanyWechatTemplate.setTemplateType(null);
-        adminCompanyWechatTemplateService.updateById(adminCompanyWechatTemplate);
-
-    }
-
-    /**
-     * 更改企业信息和模板信息
-     */
-    public void updateCompanyWithTemplate(AdminCompanyWechatTemplateUpdateReqDto reqDto){
-
-        if(StringUtils.isEmpty(reqDto.getCompanyWechatId())){
-            throw new RemoteServiceException("企业微信id不能为null");
-        }
-
-        AdminCompanyWechat adminCompanyWechat = new AdminCompanyWechat();
-        adminCompanyWechat.setCompanyWechatId(reqDto.getCompanyWechatId());
-        adminCompanyWechat.setUseTemplate(reqDto.getUseTemplate());
-        adminCompanyWechat.setMinLogo1(reqDto.getMainLog());
-        adminCompanyWechat.setMinLogo2(reqDto.getCommonLog());
-        adminCompanyWechat.setMinLogo3(reqDto.getMinLogo());
-        adminCompanyWechat.updateById();
-
-        List<AdminCompanyWechatTemplate> templateList = reqDto.getCompanyWechatTemplatesList();
-        if(CollectionUtils.isNotEmpty(templateList)){
-            for (AdminCompanyWechatTemplate template:templateList
-                 ) {
-                if(StringUtils.isEmpty(template.getCompanyWechatTemplateId())){
-                    throw new RemoteServiceException("小程序模板id不能为null");
-                }
-                template.setTemplateType(null);
-            }
-            adminCompanyWechatTemplateService.updateBatchById(templateList);
-        }
-
-    }
-
-
-    /**
-     * 添加商户时 初始化企业微信模板 添加新模板后需要手动跟新
-     */
-    public void initCompanyWechatTemplate(String companyWechatId, String companyName) {
-
-        //清除旧模板
-        adminCompanyWechatTemplateService.lambdaUpdate()
-                .eq(AdminCompanyWechatTemplate::getCompanyWechatId, companyWechatId)
-                .remove();
-
-        List<AdminCompanyWechatTemplate> templateList = new ArrayList<>();
-
-        for (int i = 1; i <= 2; i++) {
-
-            AdminCompanyWechatTemplate data = new AdminCompanyWechatTemplate();
-            templateList.add(data);
-
-            data.setCompanyWechatId(companyWechatId);
-            data.setCompanyName(companyName);
-            data.setTemplateType(i);
-
-            if(i==1){
-                data.setCategoryStatus(true);
-                data.setCarouseStatus(true);
-                data.setKillStatus(true);
-                data.setOkStatus(true);
-            }
-            if(i==2){
-                data.setPopupStatus(true);
-                data.setCarouseStatus(true);
-                data.setActive1Status(true);
-                data.setCategoryStatus(true);
-                data.setKillStatus(true);
-                data.setCouponStatus(true);
-                data.setNewsStatus(true);
-            }
-
-        }
-
-        adminCompanyWechatTemplateService.saveBatch(templateList);
-
-    }
-
-}

+ 0 - 11
src/main/java/com/gree/mall/manager/logic/admin/AdminWebsitLogic.java

@@ -3,16 +3,12 @@ package com.gree.mall.manager.logic.admin;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gree.mall.manager.bean.admin.AdminDeptWebsitVO;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.admin.AdminWebsitTree;
 import com.gree.mall.manager.bean.admin.AdminWebsitVO;
 import com.gree.mall.manager.commonmapper.AdminMapper;
 import com.gree.mall.manager.exception.RemoteServiceException;
-
-import com.gree.mall.manager.logic.admin.ew.EnterpriseWechatWorkerLogic;
 import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
 import com.gree.mall.manager.plus.entity.AdminWebsit;
 import com.gree.mall.manager.plus.entity.AdminZone;
 import com.gree.mall.manager.plus.service.AdminWebsitService;
@@ -36,15 +32,11 @@ import java.util.stream.Collectors;
 public class AdminWebsitLogic {
 
     @Autowired
-    WorkWechatLogic workWechatLogic;
-    @Autowired
     AdminWebsitService adminWebsitService;
     @Autowired
     AdminZoneService adminZoneService;
     @Autowired
     CommonLogic commonLogic;
-    @Autowired
-    EnterpriseWechatWorkerLogic enterpriseWechatWorkerLogic;
 
     @Autowired
     AdminMapper adminMapper;
@@ -132,9 +124,6 @@ public class AdminWebsitLogic {
         adminWebsit.updateById();
         //workWechatLogic.updateOrganization(adminWebsit.getWebsitId(),adminWebsit.getName(),adminWebsit.getParentId(),adminUser.getAdminCompanyWechat());
 
-        //刷新成员部门名称
-        enterpriseWechatWorkerLogic.reloadEnterpriseWechatName(adminWebsit,request);
-
     }
 
     /**

+ 0 - 486
src/main/java/com/gree/mall/manager/logic/admin/ew/EnterpriseWechatWorkerLogic.java

@@ -1,486 +0,0 @@
-package com.gree.mall.manager.logic.admin.ew;
-
-import com.aliyuncs.utils.StringUtils;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gree.mall.manager.bean.ExcelData;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.bean.admin.EnterpriseWechatWorkerImportList;
-import com.gree.mall.manager.commonmapper.EnterpriseWechatWorkerLogicMapper;
-import com.gree.mall.manager.constant.Constant;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.logic.admin.AdminWebsitLogic;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.logic.user.UserLogic;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.entity.AdminWebsit;
-import com.gree.mall.manager.plus.entity.EnterpriseWechatWorker;
-import com.gree.mall.manager.plus.service.AdminWebsitService;
-import com.gree.mall.manager.plus.service.EnterpriseWechatWorkerService;
-import com.gree.mall.manager.utils.CommonUtils;
-import com.gree.mall.manager.utils.DateUtils;
-import com.gree.mall.manager.utils.excel.ExcelUtils;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.api.WxCpUserService;
-import me.chanjar.weixin.cp.bean.WxCpUser;
-import me.chanjar.weixin.cp.bean.external.WxCpContactWayInfo;
-import me.chanjar.weixin.cp.bean.external.WxCpContactWayResult;
-import org.apache.commons.collections.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.util.*;
-import java.util.stream.Collectors;
-
-@Service
-public class EnterpriseWechatWorkerLogic {
-
-    @Autowired
-    EnterpriseWechatWorkerService enterpriseWechatWorkerService;
-    @Autowired
-    AdminWebsitLogic adminWebsitLogic;
-    @Autowired
-    WorkWechatLogic workWechatLogic;
-    @Autowired
-    UserLogic userLogic;
-    @Autowired
-    CommonLogic commonLogic;
-    @Autowired
-    EnterpriseWechatWorkerLogicMapper enterpriseWechatWorkerLogicMapper;
-//    @Autowired
-//    AdminWebsitService adminWebsitService;
-
-    /**
-     * 企业成员列表
-     */
-    public IPage<EnterpriseWechatWorker> list(String keyword, String adminWebsitId, String websitId, Integer pageNo, Integer pageSize, HttpServletRequest request) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        List<String> ids = new ArrayList<>();
-        List<AdminWebsit> list = new ArrayList<>();
-
-        String corpId = null;
-        if (StringUtils.isNotEmpty(adminWebsitId) && websitId != null) {
-            list.addAll(adminWebsitLogic.queryAllChild(list, websitId));
-            ids.add(websitId);
-
-//            corpId = adminWebsitLogic.detail(adminWebsitId).getCorpId();
-        }
-        ids.addAll(list.stream().map(AdminWebsit::getWebsitId).collect(Collectors.toList()));
-
-        IPage<EnterpriseWechatWorker> page = enterpriseWechatWorkerService.lambdaQuery()
-                .in(ids.size() > 0, EnterpriseWechatWorker::getMainDepartment, ids)
-                .and(StringUtils.isNotEmpty(keyword), v -> v.like(EnterpriseWechatWorker::getName, keyword)
-                        .or().like(EnterpriseWechatWorker::getWechatUserId, keyword)
-                        .or().like(EnterpriseWechatWorker::getMobile, keyword))
-//                .in(CollectionUtils.isNotEmpty(adminUser.getCorpIds()), EnterpriseWechatWorker::getCorpId, adminUser.getCorpIds())
-                .eq(corpId != null, EnterpriseWechatWorker::getCorpId, corpId)
-                .orderByDesc(EnterpriseWechatWorker::getCreateTime, EnterpriseWechatWorker::getId)
-                .page(new Page<>(pageNo, pageSize));
-        return page;
-    }
-
-    /**
-     * 获取成员列表
-     */
-    public List<EnterpriseWechatWorker> list(String corpId) {
-        List<EnterpriseWechatWorker> list = enterpriseWechatWorkerService.lambdaQuery()
-                .eq(StringUtils.isNotEmpty(corpId), EnterpriseWechatWorker::getCorpId, corpId).list();
-        return list;
-    }
-
-    /**
-     * 根据手机号获取成员
-     */
-    public EnterpriseWechatWorker getByMobile(String mobile, String corpId) throws WxErrorException {
-        EnterpriseWechatWorker one = enterpriseWechatWorkerService.lambdaQuery()
-                .eq(EnterpriseWechatWorker::getMobile, mobile)
-                .eq(EnterpriseWechatWorker::getCorpId, corpId)
-                .one();
-        if(one != null) {
-            AdminCompanyWechat adminCompanyWechat = commonLogic.getAdminCompanyWechat(Constant.GD_COMPANY_WECHAT_ID);
-            WxCpUserService userService = workWechatLogic.miniApp(adminCompanyWechat).getUserService();
-
-            WxCpUser wxCpUser = userService.getById(one.getWechatUserId());
-            one.setQrCode(wxCpUser.getQrCode());
-
-            WxCpContactWayResult customerQrCode = this.getCustomerQrCode(one.getWechatUserId(), one.getConfigId(), adminCompanyWechat);
-            one.setQrCode2(customerQrCode.getQrCode());
-            one.setConfigId(customerQrCode.getConfigId());
-            one.updateById();
-        }
-        return one;
-    }
-
-
-    /**
-     * 添加成员
-     *
-     * @param name
-     * @param wechatUserId
-     * @param position
-     * @param mobile
-     * @param gender
-     * @param mainDepartmentId adminWebsit的id
-     * @param email
-     * @throws RemoteServiceException
-     */
-    @Transactional
-    public void add(String name, String wechatUserId, String position, String mobile, Integer gender, Long mainDepartmentId,
-                    String email, AdminCompanyWechat adminCompanyWechat) throws RemoteServiceException, WxErrorException {
-        Integer count = enterpriseWechatWorkerService.lambdaQuery()
-                .eq(EnterpriseWechatWorker::getCorpId, adminCompanyWechat.getCorpId())
-                .eq(EnterpriseWechatWorker::getWechatUserId, wechatUserId)
-                .count();
-        if (count > 0) {
-            throw new RemoteServiceException("操作失败,帐号已存在");
-        }
-        Integer count2 = enterpriseWechatWorkerService.lambdaQuery()
-                .eq(EnterpriseWechatWorker::getCorpId, adminCompanyWechat.getCorpId())
-                .eq(EnterpriseWechatWorker::getMobile, mobile)
-                .count();
-        if (count2 > 0) {
-            throw new RemoteServiceException("操作失败,手机号已存在");
-        }
-        //同步到企业微信
-        //workWechatLogic.addWorkUser(wechatUserId, name, mobile, gender, email, mainDepartmentId, position, adminCompanyWechat);
-        //WxCpUser wxCpUser = workWechatLogic.getUser(wechatUserId, adminCompanyWechat);
-        AdminWebsit adminWebsit = adminWebsitLogic.detail(mainDepartmentId, adminCompanyWechat.getCorpId());
-
-        EnterpriseWechatWorker enterpriseWechatWorker = new EnterpriseWechatWorker();
-        enterpriseWechatWorker.setName(name);
-        enterpriseWechatWorker.setWechatUserId(wechatUserId);
-        enterpriseWechatWorker.setPosition(position);
-        enterpriseWechatWorker.setMobile(mobile);
-        enterpriseWechatWorker.setGender(gender);
-        enterpriseWechatWorker.setMainDepartment(mainDepartmentId.toString());
-        enterpriseWechatWorker.setDepartmentName(adminWebsit.getName());
-        if (StringUtils.isNotEmpty(email)) {
-            enterpriseWechatWorker.setEmail(email);
-        }
-//        if(wxCpUser != null){
-//            enterpriseWechatWorker.setQrCode(wxCpUser.getQrCode());
-//        }
-//        enterpriseWechatWorker.setCorpId(adminWebsit.getCorpId());
-        enterpriseWechatWorker.setCreateTime(new Date());
-        enterpriseWechatWorker.insert();
-
-        //用户升级
-        userLogic.userLevelUp(Collections.singletonList(wechatUserId));
-    }
-
-    /**
-     * 修改成员
-     *
-     * @param name
-     * @param wechatUserId
-     * @param position
-     * @param mobile
-     * @param gender
-     * @param mainDepartmentId adminWebsit的id
-     * @param email
-     * @throws RemoteServiceException
-     */
-    @Transactional
-    public void update(Integer id, String name, String wechatUserId,
-                       String position, String mobile, Integer gender, Long mainDepartmentId,
-                       String email, HttpServletRequest request) throws RemoteServiceException, WxErrorException {
-
-        EnterpriseWechatWorker enterpriseWechatWorker = enterpriseWechatWorkerService.getById(id);
-
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        Integer count = enterpriseWechatWorkerService.lambdaQuery()
-                .ne(EnterpriseWechatWorker::getId, id)
-                .eq(EnterpriseWechatWorker::getWechatUserId, wechatUserId)
-                .eq(EnterpriseWechatWorker::getCorpId, enterpriseWechatWorker.getCorpId())
-                .count();
-        if (count > 0) {
-            throw new RemoteServiceException("操作失败,帐号已存在");
-        }
-        Integer count2 = enterpriseWechatWorkerService.lambdaQuery()
-                .ne(EnterpriseWechatWorker::getId, id)
-                .eq(EnterpriseWechatWorker::getMobile, mobile)
-                .eq(EnterpriseWechatWorker::getCorpId, enterpriseWechatWorker.getCorpId())
-                .count();
-        if (count2 > 0) {
-            throw new RemoteServiceException("操作失败,手机号已存在");
-        }
-        AdminWebsit adminWebsit = adminWebsitLogic.detail(mainDepartmentId, adminUser.getAdminCompanyWechat().getCorpId());
-
-        //同步到企业微信
-        //workWechatLogic.updateWorkUser(wechatUserId, name, mobile, gender, email, adminWebsit.getWebsitId(), position, adminUser.getAdminCompanyWechat());
-
-
-        enterpriseWechatWorker.setId(id);
-        enterpriseWechatWorker.setName(name);
-        enterpriseWechatWorker.setWechatUserId(wechatUserId);
-        enterpriseWechatWorker.setPosition(position);
-        enterpriseWechatWorker.setMobile(mobile);
-        enterpriseWechatWorker.setGender(gender);
-        enterpriseWechatWorker.setMainDepartment(mainDepartmentId.toString());
-        enterpriseWechatWorker.setDepartmentName(adminWebsit.getName());
-        if (StringUtils.isNotEmpty(email)) {
-            enterpriseWechatWorker.setEmail(email);
-        }
-        enterpriseWechatWorker.setCreateTime(new Date());
-        enterpriseWechatWorker.updateById();
-
-    }
-
-
-    /**
-     * 成员详情
-     */
-    public EnterpriseWechatWorker detail(Integer id) {
-        return enterpriseWechatWorkerService.getById(id);
-    }
-
-    /**
-     * 删除成员
-     */
-    @Transactional
-    public void delete(List<Integer> ids, HttpServletRequest request) throws WxErrorException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-
-        List<EnterpriseWechatWorker> list = enterpriseWechatWorkerService.lambdaQuery().in(EnterpriseWechatWorker::getId, ids).list();
-//        for (EnterpriseWechatWorker bean : list) {
-//            //同步到企业微信
-//            workWechatLogic.deleteWorkUser(bean.getWechatUserId(), adminUser.getAdminCompanyWechat());
-//        }
-        enterpriseWechatWorkerService.lambdaUpdate().in(EnterpriseWechatWorker::getId, ids).remove();
-
-        //将这些成员对应的业务员用户设为普通用户
-        List<String> workUserIds = list.stream().map(EnterpriseWechatWorker::getWechatUserId).collect(Collectors.toList());
-        if (workUserIds.size() > 0) {
-            //用户降级
-            userLogic.demotion(workUserIds);
-        }
-    }
-
-    @Transactional
-    public void loadDelete(MultipartFile multipartFile, HttpServletRequest request) throws WxErrorException, IOException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-
-        List<Object> objects = ExcelUtils.importExcel(multipartFile);
-        List<String> phoneList = new ArrayList<>();
-        for (int i = 0; i < objects.size(); i++) {
-            phoneList.add(((List<String>) objects.get(i)).get(0));
-        }
-        //----------
-        List<EnterpriseWechatWorker> list = enterpriseWechatWorkerService.lambdaQuery()
-                .in(EnterpriseWechatWorker::getMobile, phoneList)
-//                .eq(EnterpriseWechatWorker::getCorpId, adminUser.getCorpIds().get(0))
-                .list();
-        if (list.size() == 0) {
-            throw new RemoteServiceException("无符合删除条件的数据");
-        }
-        List<Integer> ids = list.stream().map(EnterpriseWechatWorker::getId).collect(Collectors.toList());
-//        for (EnterpriseWechatWorker bean : list) {
-//            //同步到企业微信
-//            workWechatLogic.deleteWorkUser(bean.getWechatUserId(), adminUser.getAdminCompanyWechat());
-//        }
-        enterpriseWechatWorkerService.removeByIds(ids);
-
-        //将这些成员对应的业务员用户设为普通用户
-        List<String> workUserIds = list.stream().map(EnterpriseWechatWorker::getWechatUserId).collect(Collectors.toList());
-        if (workUserIds.size() > 0) {
-            //用户降级
-            userLogic.demotion(workUserIds);
-        }
-    }
-
-
-    /**
-     * 刷新成员部门名称
-     */
-    public void reloadEnterpriseWechatName(AdminWebsit adminWebsit,HttpServletRequest request){
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-
-        enterpriseWechatWorkerService.lambdaUpdate()
-                .set(EnterpriseWechatWorker::getDepartmentName,adminWebsit.getName())
-//                .eq(EnterpriseWechatWorker::getCorpId,adminUser.getCorpId())
-                .eq(EnterpriseWechatWorker::getMainDepartment,adminWebsit.getWebsitId())
-                .update();
-    }
-
-
-    /**
-     * 导入成员
-     */
-    @Transactional
-    public String importData(List<Object> datas, Long mainDepartmentId, HttpServletRequest request) throws WxErrorException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        List<EnterpriseWechatWorker> enterpriseWechatWorkers = new ArrayList<>();
-
-        List<EnterpriseWechatWorker> syncWechat = new ArrayList<>();
-
-        //所有成员
-        List<EnterpriseWechatWorker> enterpriseWechatWorkerList = enterpriseWechatWorkerService.lambdaQuery()
-//                .eq(EnterpriseWechatWorker::getCorpId, adminUser.getCorpId())
-                .list();
-        Map<String,EnterpriseWechatWorker> workers = enterpriseWechatWorkerList.stream().collect(Collectors.toMap(EnterpriseWechatWorker::getMobile, v -> v));
-        //所有部门
-//        List<AdminWebsit> adminWebsits = adminWebsitService.lambdaQuery().eq(AdminWebsit::getCorpId, adminUser.getCorpId()).list();
-//        Map<String, AdminWebsit> adminWebsitMap = adminWebsits.stream().collect(Collectors.toMap(AdminWebsit::getName, v -> v));
-
-//        AdminWebsit detail = adminWebsitLogic.detail(mainDepartmentId, adminUser.getCorpId());
-        for (Object o : datas) {
-            List<String> row = (List<String>) o;
-            CommonUtils.initList(row, 10);
-            String name = row.get(0);
-            String gender = row.get(1);
-            String wechatUserId = row.get(2);
-            String postion = row.get(3);
-            String mobile = row.get(4);
-            String email = row.get(5);
-            String sync = row.get(6);
-            String websitName = row.get(7);
-
-            if (StringUtils.isEmpty(name) || StringUtils.isEmpty(gender) || StringUtils.isEmpty(wechatUserId) || StringUtils.isEmpty(mobile)) {
-                throw new RemoteServiceException("名称/性别/帐号/手机号都为必填项");
-            }
-//            if(StringUtils.isEmpty(websitName)){
-//                throw new RemoteServiceException("部门名称必填");
-//            }
-//            AdminWebsit adminWebsit = adminWebsitMap.get(websitName);
-//            if(adminWebsit == null){
-//                throw new RemoteServiceException("部门名称【"+websitName+"】不存在");
-//            }
-
-            //手机号存在则更新该信息
-            EnterpriseWechatWorker worker = workers.get(mobile);
-            if (worker != null) {
-                worker.setName(name);
-                worker.setPosition(postion);
-                worker.setEmail(email);
-                worker.setMainDepartment(mainDepartmentId.toString());
-//                worker.setDepartmentName(detail.getName());
-                worker.updateById();
-                continue;
-            }
-
-            Integer count = enterpriseWechatWorkerService.lambdaQuery()
-                    .eq(EnterpriseWechatWorker::getWechatUserId, wechatUserId)
-//                    .eq(EnterpriseWechatWorker::getCorpId,adminUser.getCorpId())
-                    .count();
-            if (count > 0) {
-                throw new RemoteServiceException("导入失败,帐号:" + wechatUserId + "已存在,无法导入");
-                //sb.append("帐号:"+wechatUserId+"已存在;");
-            }
-            //WxCpUser wxCpUser = workWechatLogic.getUser(wechatUserId, adminUser.getAdminCompanyWechat());
-
-            EnterpriseWechatWorker enterpriseWechatWorker = new EnterpriseWechatWorker();
-            enterpriseWechatWorker.setName(name);
-            enterpriseWechatWorker.setGender(Integer.parseInt(gender));
-            enterpriseWechatWorker.setWechatUserId(wechatUserId);
-            enterpriseWechatWorker.setPosition(postion);
-            enterpriseWechatWorker.setMobile(mobile);
-            enterpriseWechatWorker.setEmail(email);
-//            if (detail != null) {
-//                enterpriseWechatWorker.setMainDepartment(mainDepartmentId.toString());
-//                enterpriseWechatWorker.setDepartmentName(detail.getName());
-//                enterpriseWechatWorker.setCorpId(detail.getCorpId());
-//            }
-//            if(wxCpUser != null){
-//                enterpriseWechatWorker.setQrCode(wxCpUser.getQrCode());
-//            }
-            enterpriseWechatWorker.setCreateTime(new Date());
-            enterpriseWechatWorkers.add(enterpriseWechatWorker);
-
-            if(StringUtils.isNotEmpty(sync) && sync.equals("是")){
-                syncWechat.add(enterpriseWechatWorker);
-            }
-        }
-        enterpriseWechatWorkerService.saveBatch(enterpriseWechatWorkers);
-//        for (EnterpriseWechatWorker enterpriseWechatWorker : syncWechat) {
-//            workWechatLogic.addWorkUser(enterpriseWechatWorker.getWechatUserId(), enterpriseWechatWorker.getName(), enterpriseWechatWorker.getMobile(),
-//                    enterpriseWechatWorker.getGender(), enterpriseWechatWorker.getEmail(), Long.parseLong(enterpriseWechatWorker.getMainDepartment()),
-//                    enterpriseWechatWorker.getPosition(), adminUser.getAdminCompanyWechat());
-//        }
-        return "导入成功" + enterpriseWechatWorkers.size() + "条。";
-    }
-
-    /**
-     * 导出成员
-     */
-    public ExcelData exportData(HttpServletRequest request, String keyword, String adminWebsitId, String websitId) {
-        String[] titles = new String[]{"姓名", "性别", "帐号", "部门编号", "部门", "职务", "手机号码", "邮箱", "创建时间"};
-
-
-//        List<String> corpIds = commonLogic.getAdminUser(request).getCorpIds();
-        List<String> ids = new ArrayList<>();
-        List<AdminWebsit> list = new ArrayList<>();
-
-        String corpId = null;
-        if (StringUtils.isNotEmpty(adminWebsitId) && websitId != null) {
-            list.addAll(adminWebsitLogic.queryAllChild(list, websitId));
-            ids.add(websitId);
-
-            corpId = adminWebsitLogic.detail(adminWebsitId).getCorpId();
-        }
-        ids.addAll(list.stream().map(AdminWebsit::getWebsitId).collect(Collectors.toList()));
-
-        List<EnterpriseWechatWorkerImportList> importList = enterpriseWechatWorkerLogicMapper.list(ids, keyword, null, corpId);
-
-        List<List<Object>> rows = new ArrayList<>();
-        for (EnterpriseWechatWorkerImportList worker : importList) {
-            List<Object> row = new ArrayList<>();
-            String genderName = "未知";
-            if (worker.getGender() == 1) {
-                genderName = "男";
-            } else if (worker.getGender() == 2) {
-                genderName = "女";
-            }
-            row.add(worker.getName());
-            row.add(genderName);
-            row.add(worker.getWechatUserId());
-            row.add(worker.getWebsitNum());
-            row.add(worker.getDepartmentName());
-            row.add(worker.getPosition());
-            row.add(worker.getMobile());
-            row.add(worker.getEmail());
-            row.add(DateUtils.formatDate(worker.getCreateTime()));
-            rows.add(row);
-        }
-        ExcelData excelData = new ExcelData();
-        excelData.setTitles(Arrays.asList(titles));
-        excelData.setRows(rows);
-        return excelData;
-    }
-
-
-
-    public WxCpContactWayResult getCustomerQrCode(String userId,String configId,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        try {
-            WxCpService wxCpService = workWechatLogic.tongxunluApp(adminCompanyWechat);
-            //先删,后获取
-            try{
-                wxCpService.getExternalContactService().deleteContactWay(configId);
-            }catch(Exception e){
-
-            }
-
-            WxCpContactWayInfo wxCpContactWayInfo = new WxCpContactWayInfo();
-            WxCpContactWayInfo.ContactWay contactWay = new WxCpContactWayInfo.ContactWay();
-            contactWay.setScene(WxCpContactWayInfo.SCENE.QRCODE);
-            contactWay.setType(WxCpContactWayInfo.TYPE.SINGLE);
-            contactWay.setUsers(Arrays.asList(userId));
-            wxCpContactWayInfo.setContactWay(contactWay);
-
-            WxCpContactWayResult wxCpContactWayResult = wxCpService.getExternalContactService().addContactWay(wxCpContactWayInfo);
-            return wxCpContactWayResult;
-        }catch(Exception e){
-            WxCpContactWayResult wxCpContactWayResult = new WxCpContactWayResult();
-            wxCpContactWayResult.setQrCode("");
-            wxCpContactWayResult.setConfigId("");
-            return wxCpContactWayResult;
-        }
-    }
-
-
-}

+ 23 - 30
src/main/java/com/gree/mall/manager/logic/common/UMSLogic.java

@@ -1,18 +1,12 @@
 package com.gree.mall.manager.logic.common;
 
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.entity.OrderDetail;
 import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
-import com.gree.mall.manager.utils.ArithUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang.RandomStringUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
@@ -28,12 +22,10 @@ import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
-import java.math.BigDecimal;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.Objects;
 import java.util.UUID;
 
 @Service
@@ -52,28 +44,29 @@ public class UMSLogic {
     public void refund(String orderId, double totalFee, double refundFee, String companyWechatId) throws Exception {
         final AdminCompanyWechat company = adminCompanyWechatService.getById(companyWechatId);
         JSONObject json = new JSONObject();
-
-        json.put("requestTimestamp", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));    // 报文请求时间
-        json.put("mid", company.getUmsMid()); // 商户号
-        json.put("tid", company.getUmsTid());    // 终端号
-        json.put("merOrderId", company.getUmsSysCode() + orderId); // 商户订单号
-        json.put("refundAmount", (int) ArithUtils.mul(refundFee, 100));    // 退货的金额
-        json.put("refundOrderId", getMerchantOrderId(company.getUmsSysCode())); // 退款订单号
-
-        //OPEN-BODY-SIG 方式
-        String authorization = getOpenBodySig(company.getUmsAppid(), company.getUmsAppKey(), json.toString());
-//        String authorization = AppletOrders.getOpenBodySig(company.getUmsAppid(), company.getUmsAppKey(), json.toString());
-        String send = "";
-        try {
-            send = send(url + "/v1/netpay/refund", json.toString(), authorization);
-
-        } catch (Exception e) {
-            throw new RemoteServiceException("发送请求云闪付失败, 错误信息: " + e.getMessage());
-        }
-
-        if (!send.contains("成功")) {
-            throw new RemoteServiceException("请求云闪付失败, 平台错误信息: " + send);
-        }
+        // TODO 改云闪付退款
+//
+//        json.put("requestTimestamp", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));    // 报文请求时间
+//        json.put("mid", company.getUmsMid()); // 商户号
+//        json.put("tid", company.getUmsTid());    // 终端号
+//        json.put("merOrderId", company.getUmsSysCode() + orderId); // 商户订单号
+//        json.put("refundAmount", (int) ArithUtils.mul(refundFee, 100));    // 退货的金额
+//        json.put("refundOrderId", getMerchantOrderId(company.getUmsSysCode())); // 退款订单号
+//
+//        //OPEN-BODY-SIG 方式
+//        String authorization = getOpenBodySig(company.getUmsAppid(), company.getUmsAppKey(), json.toString());
+////        String authorization = AppletOrders.getOpenBodySig(company.getUmsAppid(), company.getUmsAppKey(), json.toString());
+//        String send = "";
+//        try {
+//            send = send(url + "/v1/netpay/refund", json.toString(), authorization);
+//
+//        } catch (Exception e) {
+//            throw new RemoteServiceException("发送请求云闪付失败, 错误信息: " + e.getMessage());
+//        }
+//
+//        if (!send.contains("成功")) {
+//            throw new RemoteServiceException("请求云闪付失败, 平台错误信息: " + send);
+//        }
     }
 
     /**

+ 0 - 235
src/main/java/com/gree/mall/manager/logic/common/WorkWechatLogic.java

@@ -1,235 +0,0 @@
-package com.gree.mall.manager.logic.common;
-
-import com.aliyuncs.utils.StringUtils;
-import com.gree.mall.manager.config.wx.WxConfiguration;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.bean.Gender;
-import me.chanjar.weixin.cp.bean.WxCpDepart;
-import me.chanjar.weixin.cp.bean.WxCpMaJsCode2SessionResult;
-import me.chanjar.weixin.cp.bean.WxCpUser;
-import me.chanjar.weixin.cp.bean.external.WxCpUserExternalTagGroupList;
-import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactBatchInfo;
-import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- *  企业微信api
- *  2021-09-17
- *  lijh
- */
-@Component
-@Slf4j
-public class WorkWechatLogic {
-
-
-    /**
-     * 小程序应用
-     */
-    public WxCpService miniApp(AdminCompanyWechat adminCompanyWechat){
-        WxCpService wxCpService = WxConfiguration.cpServices.get(adminCompanyWechat.getCompanyWechatId()).get(adminCompanyWechat.getAgentId1());
-        return wxCpService;
-    }
-
-
-    /**
-     * 客户联系密钥
-     */
-    public WxCpService miniTagApp(AdminCompanyWechat adminCompanyWechat){
-        WxCpService cpService = WxConfiguration.cpServices.get(adminCompanyWechat.getCompanyWechatId()).get(adminCompanyWechat.getAgentId2());
-        return cpService;
-    }
-
-    /**
-     * 通讯录同步
-     */
-    public WxCpService tongxunluApp(AdminCompanyWechat adminCompanyWechat){
-        WxCpService cpService = WxConfiguration.cpServices.get(adminCompanyWechat.getCompanyWechatId()).get(adminCompanyWechat.getAgentId3());
-        return cpService;
-    }
-
-    /**
-     * 验证登录身份
-     * @param code
-     * @return
-     * @throws WxErrorException
-     */
-    public WxCpMaJsCode2SessionResult jsCode2Session(String code,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        WxCpMaJsCode2SessionResult wxCpMaJsCode2SessionResult = this.miniApp(adminCompanyWechat).jsCode2Session(code);
-        return wxCpMaJsCode2SessionResult;
-    }
-
-    /**
-     * 获取企业微信成员
-     * @param userId
-     * @return
-     * @throws WxErrorException
-     */
-    public WxCpUser getUser(String userId,AdminCompanyWechat adminCompanyWechat) {
-        try {
-            WxCpUser wxCpUser = this.miniApp(adminCompanyWechat).getUserService().getById(userId);
-            return wxCpUser;
-        }catch(Exception e){
-            log.error("获取企业微信成员失败",e);
-            return null;
-        }
-    }
-
-
-    /**
-     * 获取企业标签
-     * @return
-     * @throws WxErrorException
-     */
-    public  List<WxCpUserExternalTagGroupList.TagGroup> getTag(AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        WxCpUserExternalTagGroupList corpTagList = this.miniTagApp(adminCompanyWechat).getExternalContactService().getCorpTagList(null);
-        List<WxCpUserExternalTagGroupList.TagGroup> tagGroupList = corpTagList.getTagGroupList();
-        return tagGroupList;
-    }
-
-    /**
-     * 获取客户列表用户id
-     * @param workUserId
-     * @return
-     * @throws WxErrorException
-     */
-    public List<String> getExternalUserIdByWorkUserId(String workUserId,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        List<String> strings = this.miniTagApp(adminCompanyWechat).getExternalContactService().listExternalContacts(workUserId);
-        return strings;
-    }
-
-    /**
-     * 获取客户详情
-     */
-    public WxCpExternalContactInfo getCustomerDetail(String externalUserId,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        WxCpExternalContactInfo contactDetail = this.miniTagApp(adminCompanyWechat).getExternalContactService().getContactDetail(externalUserId);
-        return contactDetail;
-    }
-
-    /**
-     * 批量获取客户详情
-     * @param workUserIds 成员ids
-     * @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
-     * @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取最大值
-     */
-    public List<WxCpExternalContactBatchInfo.ExternalContactInfo> getCustomerByExternalUserId(String workUserIds, String cursor, Integer limit,AdminCompanyWechat adminCompanyWechat) {
-        try {
-            List<WxCpExternalContactBatchInfo.ExternalContactInfo> contactDetailBatch = this.miniTagApp(adminCompanyWechat).getExternalContactService()
-                    .getContactDetailBatch(workUserIds, cursor, limit).getExternalContactList();
-            return contactDetailBatch;
-        }catch(Exception e){
-            log.error("获取客户详情失败",e);
-        }
-        return null;
-    }
-
-
-    /**
-     * 新增部门
-     */
-    public Long addOrganization(String name,Long parentId,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        WxCpDepart wxCpDepart = new WxCpDepart();
-        //wxCpDepart.setId(id);
-        wxCpDepart.setName(name);
-        wxCpDepart.setParentId(parentId);
-        Long aLong = this.tongxunluApp(adminCompanyWechat).getDepartmentService().create(wxCpDepart);
-        return aLong;
-    }
-
-    /**
-     * 修改部门
-     */
-    public void updateOrganization(Long id,String name,Long parentId,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-
-        WxCpDepart wxCpDepart = new WxCpDepart();
-        wxCpDepart.setId(id);
-        wxCpDepart.setName(name);
-        wxCpDepart.setParentId(parentId);
-        this.tongxunluApp(adminCompanyWechat).getDepartmentService().update(wxCpDepart);
-
-    }
-
-    /**
-     * 删除部门
-     */
-    public void deleteOrganization(Long id,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        try {
-            this.tongxunluApp(adminCompanyWechat).getDepartmentService().delete(id);
-        }catch (Exception e){
-            log.error("删除部门失败"+e.getMessage());
-        }
-    }
-
-
-    /**
-     * 新增成员
-     */
-    public void addWorkUser(String userId,String name,String mobile,Integer gender,String email,Long department,String position,AdminCompanyWechat adminCompanyWechat) {
-
-        WxCpUser wxCpUser = new WxCpUser();
-        wxCpUser.setUserId(userId);
-        wxCpUser.setName(name);
-        wxCpUser.setMobile(mobile);
-        wxCpUser.setPosition(position);
-        wxCpUser.setDepartIds(new Long[]{department});
-        wxCpUser.setMainDepartment(department.toString());
-        if(gender == 0) {
-            wxCpUser.setGender(Gender.UNDEFINED);
-        }else if(gender == 1){
-            wxCpUser.setGender(Gender.MALE);
-        }else{
-            wxCpUser.setGender(Gender.FEMALE);
-        }
-        if(StringUtils.isNotEmpty(email)){
-            wxCpUser.setEmail(email);
-        }
-        try {
-            //this.tongxunluApp(adminCompanyWechat).getUserService().create(wxCpUser);
-        }catch(Exception e){
-            log.error("同步企业微信成员失败:{}",userId);
-        }
-    }
-
-    /**
-     * 修改成员
-     */
-    public void updateWorkUser(String userId,String name,String mobile,Integer gender,String email,Long department,String position,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        WxCpUser wxCpUser = new WxCpUser();
-        wxCpUser.setUserId(userId);
-        wxCpUser.setName(name);
-        wxCpUser.setMobile(mobile);
-        wxCpUser.setDepartIds(new Long[]{department});
-        wxCpUser.setMainDepartment(department.toString());
-        wxCpUser.setPosition(position);
-        if(gender == 0) {
-            wxCpUser.setGender(Gender.UNDEFINED);
-        }else if(gender == 1){
-            wxCpUser.setGender(Gender.MALE);
-        }else{
-            wxCpUser.setGender(Gender.FEMALE);
-        }
-        if(StringUtils.isNotEmpty(email)){
-            wxCpUser.setEmail(email);
-        }
-        //this.tongxunluApp(adminCompanyWechat).getUserService().update(wxCpUser);
-    }
-
-    /**
-     * 删除成员
-     */
-    public void deleteWorkUser(String userId,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        try {
-            //this.tongxunluApp(adminCompanyWechat).getUserService().delete(userId);
-        }catch(Exception e){
-            log.error("删除企业微信成员失败"+e.getMessage());
-        }
-    }
-
-
-
-}

+ 0 - 9
src/main/java/com/gree/mall/manager/logic/goods/GoodsLogic.java

@@ -469,10 +469,6 @@ public class GoodsLogic {
             goodsTemplateService.save(goodsTemplate);
         }
 
-        //查询物料信息
-        if (Objects.nonNull(companyWechat) && StringUtils.isNotBlank(companyWechat.getJindCustomerNumber())) {
-            fucaiLogic.getWuliao(goodsSpecList);
-        }
         //批量保存商品规格
         if(CollectionUtils.isNotEmpty(goodsSpecList))
             goodsSpecService.saveBatch(goodsSpecList);
@@ -598,11 +594,6 @@ public class GoodsLogic {
             List<GoodsSpec> goodsSpecList = goodsBean.getGoodsSpecs();
             Collections.sort(goodsSpecList, (o1, o2) -> o1.getPrice().compareTo(o2.getPrice()));
 
-            //查询物料信息
-            if (Objects.nonNull(companyWechat) && StringUtils.isNotBlank(companyWechat.getJindCustomerNumber())) {
-                fucaiLogic.getWuliao(goodsSpecList);
-            }
-
             goodsBean.setGoodsPrice(goodsSpecList.get(0).getPrice());
         }
         goodsBean.setUpdateTime(new Date());

+ 0 - 106
src/main/java/com/gree/mall/manager/logic/manual/ManualWorkLogic.java

@@ -1,106 +0,0 @@
-package com.gree.mall.manager.logic.manual;
-
-import cn.hutool.core.collection.CollectionUtil;
-import com.alibaba.fastjson.JSON;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.enums.UserTypeEnum;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.plus.entity.EnterpriseWechatWorker;
-import com.gree.mall.manager.plus.entity.User;
-import com.gree.mall.manager.plus.service.EnterpriseWechatWorkerService;
-import com.gree.mall.manager.plus.service.UserService;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-@Service
-@Slf4j
-public class ManualWorkLogic {
-    @Autowired
-    private UserService userService;
-    @Autowired
-    private EnterpriseWechatWorkerService enterpriseWechatWorkerService;
-    @Autowired
-    private CommonLogic commonLogic;
-
-    @Transactional
-    public String assignWorker(HttpServletRequest request, String personalPhone, String workPhone) throws RemoteServiceException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-
-        //判断该手机号是否为业务员
-        List<EnterpriseWechatWorker> list = enterpriseWechatWorkerService.lambdaQuery()
-                .eq(EnterpriseWechatWorker::getMobile, workPhone)
-                .eq(EnterpriseWechatWorker::getCorpId, adminUser.getAdminCompanyWechat().getCorpId())
-                .list();
-        if (CollectionUtil.isEmpty(list)) {
-            throw new RemoteServiceException("不是企业微信成员");
-        }
-
-        List<User> workUserList = userService.lambdaQuery()
-                .eq(User::getCompanyWechatId, adminUser.getLoginCompanyWechatId())
-                .eq(User::getWorkUserId, list.get(0).getWechatUserId())
-                .list();
-        List<User> personalUserList = userService.lambdaQuery()
-                .eq(User::getCompanyWechatId, adminUser.getLoginCompanyWechatId())
-                .eq(User::getMobile, personalPhone)
-                .list();
-
-        if (!CollectionUtil.isEmpty(workUserList)) {
-            throw new RemoteServiceException("已经是业务员了");
-        }
-        if (workUserList == null || workUserList.size() > 1) {
-            throw new RemoteServiceException("用户异常.");
-        }
-        if (personalUserList == null || personalUserList.size() > 1) {
-            throw new RemoteServiceException("用户异常...");
-        }
-
-        //根据手机号查询是否存在企业微信用户
-        User workUser = workUserList.size() > 0 ? workUserList.get(0) : null;
-        User personalUser = personalUserList.size() > 0 ? personalUserList.get(0) : null;
-//        if (workUser != null && StringUtils.isNotEmpty(workUser.getOpenId())) {
-//            throw new RemoteServiceException("已经是业务员了,操作失败");
-//        }
-
-        if (workUser != null && personalUser != null && workUser.getUserId().equals(personalUser.getUserId())) {
-            throw new RemoteServiceException("已经是业务员了,操作失败");
-        }
-        if (workUser == null && personalUser == null) {
-            throw new RemoteServiceException("用户不存在");
-        }
-
-        if (personalUser != null) {
-            personalUser.setWorkPhone(workPhone);
-            personalUser.setType(UserTypeEnum.SERVICE.toString());
-            personalUser.setWorkName(list.get(0).getName());
-            personalUser.setWorkPhone(list.get(0).getMobile());
-            personalUser.setWorkQrcode(list.get(0).getQrCode());
-            String workUserId = list.get(0).getWechatUserId();
-            personalUser.setWorkUserId(workUserId);
-//            personalUser.setWebsitNumber("");
-            personalUser.setPosition(list.get(0).getPosition());
-            userService.updateById(personalUser);
-        }
-
-        if (workUser != null && personalUser == null) {
-            workUser.setMobile(personalPhone);
-            workUser.setType(UserTypeEnum.SERVICE.toString());
-            userService.updateById(workUser);
-        }
-
-        if (workUser != null && personalUser != null && !workUser.getUserId().equals(personalUser.getUserId())) {
-            log.info("降级的用户数据{}", JSON.toJSON(workUser));
-            userService.removeById(workUser);
-        }
-        return personalUser.getUserId();
-    }
-}

+ 0 - 19
src/main/java/com/gree/mall/manager/logic/marketing/DynamicMaterialsLogic.java

@@ -11,17 +11,12 @@ import com.gree.mall.manager.commonmapper.MarketingMaterialsVisitCustomMapper;
 import com.gree.mall.manager.enums.MarketingMaterialsTypeEnum;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
 import com.gree.mall.manager.plus.entity.MarketingMaterials;
 import com.gree.mall.manager.plus.entity.MarketingMaterialsVisit;
 import com.gree.mall.manager.plus.entity.Tag;
 import com.gree.mall.manager.plus.service.MarketingMaterialsService;
 import com.gree.mall.manager.plus.service.MarketingMaterialsVisitService;
-import com.gree.mall.manager.utils.WXPushUtils;
 import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.bean.message.WxCpMessage;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,8 +43,6 @@ public class DynamicMaterialsLogic {
     private MarketingMaterialsVisitCustomMapper marketingMaterialsVisitCustomMapper;
     @Autowired
     private MarketingMaterialsVisitService marketingMaterialsVisitService;
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
 
     /**
      * 分页查询动态素材
@@ -137,16 +130,4 @@ public class DynamicMaterialsLogic {
         return respBean;
     }
 
-    public void sendToEnterpriseWechatWorker(HttpServletRequest request, String wechatUserId, String content) {
-        AdminCompanyWechat adminCompanyWechat = commonLogic.getAdminUser(request).getAdminCompanyWechat();
-        WxCpMessage wxCpMessage = new WxCpMessage();
-        wxCpMessage.setToUser(wechatUserId);
-        wxCpMessage.setMsgType("text");
-        wxCpMessage.setContent(content);
-        wxCpMessage.setAgentId(adminCompanyWechat.getAgentId1());
-        WxCpService wxCpService = workWechatLogic.miniApp(adminCompanyWechat);
-        WXPushUtils.sendToEnterpriseWechatWorker(wxCpService,wxCpMessage);
-    }
-
-
 }

+ 0 - 448
src/main/java/com/gree/mall/manager/logic/marketing/MarketingMaterialsLogic.java

@@ -1,448 +0,0 @@
-package com.gree.mall.manager.logic.marketing;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.bean.marketing.MarketingMaterialsAddReqBean;
-import com.gree.mall.manager.bean.marketing.MarketingMaterialsUpdateReqBean;
-import com.gree.mall.manager.commonmapper.MarketingMaterialsVisitCustomMapper;
-import com.gree.mall.manager.enums.MarketingMaterialsTypeEnum;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.plus.entity.*;
-import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
-import com.gree.mall.manager.plus.service.CommonFileService;
-import com.gree.mall.manager.plus.service.MarketingMaterialsService;
-import com.gree.mall.manager.plus.service.MarketingMaterialsTagService;
-import com.gree.mall.manager.utils.CommonUtils;
-import com.gree.mall.manager.utils.oss.OSSUtil;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpService;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import sun.net.www.content.text.PlainTextInputStream;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.util.*;
-
-/**
- * 营销素材
- */
-@Slf4j
-@Service
-public class MarketingMaterialsLogic {
-
-    @Autowired
-    private MarketingMaterialsService marketingMaterialsService;
-    @Autowired
-    private CommonLogic commonLogic;
-    @Autowired
-    private CommonFileService commonFileService;
-    @Autowired
-    private MarketingMaterialsTagService marketingMaterialsTagService;
-    @Autowired
-    private AdminCompanyWechatService adminCompanyWechatService;
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
-    @Autowired
-    private MarketingMaterialsVisitCustomMapper marketingMaterialsVisitCustomMapper;
-
-    /**
-     * 通过id获取
-     */
-    public MarketingMaterialsUpdateReqBean getById(String marketingMaterialsId) throws IOException {
-        MarketingMaterials byId = marketingMaterialsService.getById(marketingMaterialsId);
-        if (byId == null) {
-            throw new RemoteServiceException("该营销素材不存在");
-        }
-        MarketingMaterialsUpdateReqBean respBean=new MarketingMaterialsUpdateReqBean();
-        BeanUtils.copyProperties(byId,respBean);
-
-
-        //查询标签
-        List<Tag> materialsTag = marketingMaterialsVisitCustomMapper.getMaterialsTag(marketingMaterialsId);
-        respBean.setTag(materialsTag);
-
-        return respBean;
-
-    }
-
-    /**
-     * 素材文本类型url转string
-     */
-    public String urlToStr(String url) throws IOException {
-        return Txt.getTxtFile(url);
-    }
-
-
-    /**
-     * 分页获取营销素材
-     */
-    public IPage<MarketingMaterials> page(HttpServletRequest request, String title, String groupId, String type, Integer pageNum, Integer pageSize) throws IOException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        List<String> companyWechatIds = adminUser.getAdminCompanyIds();
-
-        return marketingMaterialsService.lambdaQuery()
-                .like(StringUtils.isNotEmpty(title), MarketingMaterials::getTitle, title)
-                .eq(StringUtils.isNotEmpty(groupId), MarketingMaterials::getMarketingGroupId, groupId)
-                .eq(MarketingMaterials::getType, type.trim())
-                .in(CollectionUtils.isNotEmpty(companyWechatIds), MarketingMaterials::getCompanyWechatId, companyWechatIds)
-                .orderByDesc(MarketingMaterials::getCreateTime)
-                .page(new Page<>(pageNum, pageSize));
-
-    }
-
-
-    /**
-     * 移组
-     */
-    public void moveGroup(HttpServletRequest request, String marketingMaterialsIds, String newGroupId) {
-        String userId = CommonUtils.getUserId(request);
-        String[] split = marketingMaterialsIds.split(",");
-        if (split.length == 0) {
-            return;
-        }
-
-        marketingMaterialsService.lambdaUpdate()
-                .set(MarketingMaterials::getMarketingGroupId, newGroupId)
-                .set(MarketingMaterials::getCreateTime, new Date())
-                .set(MarketingMaterials::getCreateBy, userId)
-                .in(MarketingMaterials::getMarketingMaterialsId, Arrays.asList(split))
-                .update();
-
-    }
-
-    /**
-     * 重置
-     */
-    public void reset(String groupId, String type) {
-
-        marketingMaterialsService.lambdaUpdate()
-                .eq(MarketingMaterials::getMarketingGroupId, groupId)
-                .eq(MarketingMaterials::getType, type.trim())
-                .remove();
-
-    }
-
-    /**
-     * 新增营销素材
-     */
-    @Transactional
-    public String add(HttpServletRequest request, MarketingMaterialsAddReqBean marketingMaterialsAddReqBean) throws IOException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        String loginCompanyWechatId = adminUser.getLoginCompanyWechatId();
-        if (StringUtils.isEmpty(loginCompanyWechatId)) {
-            throw new RemoteServiceException("运营账号暂无权限操作");
-        }
-        //校验请求数据
-        checkMarketingMaterialsAddReqBean(marketingMaterialsAddReqBean);
-
-        //新增数据
-        MarketingMaterials marketingMaterials = new MarketingMaterials();
-        BeanUtils.copyProperties(marketingMaterialsAddReqBean, marketingMaterials);
-
-        marketingMaterials.setCompanyWechatId(loginCompanyWechatId);
-        marketingMaterials.setCompanyName(adminUser.getLoginCompanyName());
-        marketingMaterials.setCreateTime(new Date());
-        marketingMaterials.setCreateBy(adminUser.getAdminUserId());
-        marketingMaterials.setCreateName(adminUser.getNickName());
-
-        String type = marketingMaterials.getType();
-        //type !=文本 ,type !=小程序
-        if (!type.equals(MarketingMaterialsTypeEnum.TEXT.getCode()) && !type.equals(MarketingMaterialsTypeEnum.SMALL.getCode())) {
-
-            String fileType = type.equals(MarketingMaterialsTypeEnum.FILE.getCode()) ? "file" : (
-                    type.equals(MarketingMaterialsTypeEnum.VIDEO.getCode()) ? "video" : "image"
-            );
-
-            // 添加企微素材零时文件
-            try {
-                String mediaId = loadToQyWx(adminUser, marketingMaterialsAddReqBean.getFileUrl(), fileType);
-                marketingMaterials.setMediaId(mediaId);
-                marketingMaterials.setMediaIdLastUpdateTime(new Date());
-            } catch (WxErrorException e) {
-                throw new RemoteServiceException("上传素材至企业微信失败,请更换文件格式");
-            }
-        }
-        //添加营销素材
-        marketingMaterialsService.save(marketingMaterials);
-
-        //营销素材绑定标签
-        if (CollectionUtils.isNotEmpty(marketingMaterialsAddReqBean.getTag()) && marketingMaterials.getDynamicTitle() != null
-                && marketingMaterials.getDynamicTitle()) {
-
-            List<MarketingMaterialsTag> mmTagList = new ArrayList<>();
-            for (Tag tag : marketingMaterialsAddReqBean.getTag()
-            ) {
-                MarketingMaterialsTag mmTag = new MarketingMaterialsTag();
-                mmTag.setMarketingMaterialsId(marketingMaterials.getMarketingMaterialsId());
-                mmTag.setTagId(tag.getTagId());
-                mmTag.setName(tag.getName());
-                mmTag.setCreateTime(new Date());
-                mmTag.setCompanyWechatId(loginCompanyWechatId);
-                mmTag.setCompanyName(adminUser.getLoginCompanyName());
-                mmTagList.add(mmTag);
-            }
-            //批量新增素材标签
-            marketingMaterialsTagService.saveBatch(mmTagList);
-
-        }
-
-        return marketingMaterials.getMarketingMaterialsId();
-    }
-
-    //校验请求数据
-    public void checkMarketingMaterialsAddReqBean(MarketingMaterials marketingMaterials) {
-
-        //  校验请求数据
-        String type = marketingMaterials.getType();
-        if (StringUtils.isEmpty(type)) {
-            throw new RemoteServiceException("素材类型不能为null");
-        }
-        marketingMaterials.setType(type.trim());
-
-        if (StringUtils.isEmpty(marketingMaterials.getTitle())) {
-            throw new RemoteServiceException("标题不能为null");
-        }
-
-        if (StringUtils.isEmpty(marketingMaterials.getMarketingGroupId())) {
-            throw new RemoteServiceException("营销分组id不能为null");
-        }
-
-    }
-
-    private static class Txt {
-
-        //传入txt数据  返回url
-        public static String addTxtFile(String value) throws IOException {
-            String filePath = OSSUtil.OSS_TYPE_PIC + System.currentTimeMillis() + UUID.randomUUID().toString() + ".txt";
-            if (!OSSUtil.uploadFile(filePath, value.getBytes())) {
-                throw new RemoteServiceException("文件同步oss失败");
-            }
-            return OSSUtil.accessUrl + filePath;
-        }
-
-        //传入url和数据 跟新url中txt数据
-        public static String updateTxtFile(String url, String value) throws IOException {
-            String filePath = url.substring(OSSUtil.accessUrl.length());
-            if (!OSSUtil.uploadFile(filePath, value.getBytes())) {
-                throw new RemoteServiceException("文件同步oss失败");
-            }
-            return OSSUtil.accessUrl + filePath;
-        }
-
-        //传入txt数据  返回url
-        public static String getTxtFile(String url) throws IOException {
-            StringBuffer sb = new StringBuffer("");
-            URL urll = new URL(url);
-            PlainTextInputStream plainTextInputStream = (PlainTextInputStream) urll.getContent();
-            byte[] bt = new byte[1024];
-            int len = -1;
-            while ((len = plainTextInputStream.read(bt)) != -1) {
-                sb.append(new String(bt, 0, len));
-            }
-            return sb.toString();
-        }
-
-    }
-
-    /**
-     * 通过id删除营销素材
-     */
-    public void deleteById(String marketingMaterialsId) {
-        //删除营销素材
-        marketingMaterialsService.removeById(marketingMaterialsId);
-
-        //删除素材绑定的标签
-        marketingMaterialsTagService.lambdaUpdate()
-                .eq(MarketingMaterialsTag::getMarketingMaterialsId,marketingMaterialsId)
-                .remove();
-    }
-
-    /**
-     * 編輯
-     */
-    @Transactional
-    public void update(HttpServletRequest request, MarketingMaterialsUpdateReqBean updateReqBean) throws IOException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        String loginCompanyWechatId = adminUser.getLoginCompanyWechatId();
-        if (StringUtils.isEmpty(loginCompanyWechatId)) {
-            throw new RemoteServiceException("运营账号暂无权限操作");
-        }
-
-        String marketingMaterialsId = updateReqBean.getMarketingMaterialsId();
-        MarketingMaterials byId = null;
-        if (StringUtils.isEmpty(marketingMaterialsId) || (byId = marketingMaterialsService.getById(marketingMaterialsId)) == null) {
-            throw new RemoteServiceException("营销素材id不能为null");
-        }
-
-        //校验
-        checkMarketingMaterialsAddReqBean(updateReqBean);
-
-        String type = updateReqBean.getType();
-
-        MarketingMaterials marketingMaterials = new MarketingMaterials();
-        BeanUtils.copyProperties(updateReqBean, marketingMaterials);
-
-        //type !=文本 && type!=小程序
-        if (!type.equals(MarketingMaterialsTypeEnum.TEXT.getCode()) && !type.equals(MarketingMaterialsTypeEnum.SMALL.getCode())) {
-            //非文本
-
-            try {
-                String fileType = type.equals(MarketingMaterialsTypeEnum.FILE.getCode()) ? "file" : (
-                        type.equals(MarketingMaterialsTypeEnum.VIDEO.getCode()) ? "video" : "image"
-                );
-                String mediaId = loadToQyWx(adminUser, updateReqBean.getFileUrl(), fileType);
-
-                marketingMaterials.setMediaId(mediaId);
-                marketingMaterials.setMediaIdLastUpdateTime(new Date());
-            } catch (WxErrorException e) {
-                throw new RemoteServiceException("上传素材至企业微信失败,请更换文件格式");
-            }
-        }
-
-        //修改营销素材
-        marketingMaterialsService.updateById(marketingMaterials);
-
-        //营销素材绑定标签
-        if (CollectionUtils.isNotEmpty(updateReqBean.getTag()) && marketingMaterials.getDynamicTitle() != null
-                && marketingMaterials.getDynamicTitle()) {
-            //清除旧素材标签
-            marketingMaterialsTagService.lambdaUpdate()
-                    .eq(MarketingMaterialsTag::getMarketingMaterialsId, marketingMaterials.getMarketingMaterialsId())
-                    .remove();
-
-            List<MarketingMaterialsTag> mmTagList = new ArrayList<>();
-            for (Tag tag : updateReqBean.getTag()
-            ) {
-                MarketingMaterialsTag mmTag = new MarketingMaterialsTag();
-                mmTag.setMarketingMaterialsId(marketingMaterials.getMarketingMaterialsId());
-                mmTag.setTagId(tag.getTagId());
-                mmTag.setName(tag.getName());
-                mmTag.setCreateTime(new Date());
-                mmTag.setCompanyWechatId(loginCompanyWechatId);
-                mmTag.setCompanyName(adminUser.getLoginCompanyName());
-                mmTagList.add(mmTag);
-            }
-            //批量新增素材标签
-            marketingMaterialsTagService.saveBatch(mmTagList);
-
-        }
-
-    }
-
-    /**
-     * 上传营销素材到企业微信
-     */
-    public String loadToQyWx(HttpServletRequest request, String fileUrl, String fileType) throws IOException, WxErrorException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        if (adminUser == null) {
-            throw new RemoteException("暂无授权,请联系管理员");
-        }
-        return loadToQyWx(adminUser, fileUrl, fileType);
-    }
-
-    /**
-     * 图片(image):10MB,支持JPG,PNG格式
-     * 语音(voice) :2MB,播放长度不超过60s,仅支持AMR格式
-     * 视频(video) :10MB,支持MP4格式
-     * 普通文件(file):20MB
-     * 上传营销素材到企业微信
-     */
-    public String loadToQyWx(AdminUserCom adminUserCom, String fileUrl, String fileType) throws IOException, WxErrorException {
-        AdminCompanyWechat adminCompanyWechat = adminUserCom.getAdminCompanyWechat();
-        return loadToQyWx(adminCompanyWechat, fileUrl, fileType);
-    }
-
-    public String loadToQyWx(AdminCompanyWechat adminCompanyWechat, String fileUrl, String fileType) throws IOException, WxErrorException {
-        WxCpService wxCpService = workWechatLogic.miniApp(adminCompanyWechat);
-
-        int i = fileUrl.lastIndexOf(".");
-        File file = new File("./logs/" + UUID.randomUUID().toString() + System.currentTimeMillis() + fileUrl.substring(i));
-        try {
-            URL url = new URL(fileUrl);
-            InputStream inputStream = url.openStream();
-            FileUtils.copyInputStreamToFile(inputStream, file);
-            WxMediaUploadResult upload = wxCpService.getMediaService().upload(fileType, file);
-            log.info("上传素材至企业微信成功:[返回mediaId:"+upload.getMediaId()+"]");
-            return upload.getMediaId();
-        } finally {
-            file.delete();
-        }
-    }
-
-
-    /**
-     * 更新营销素材MediaId
-     *
-     * @param day   跟新距离现在多少天的
-     * @param count 一次更新多少条
-     */
-    public IPage<MarketingMaterials> updateMaterialsMediaId(int day, int count) {
-        //所有企业微信
-        Map<String, AdminCompanyWechat> adminCompanyWechatMap = new HashMap<>();
-        for (AdminCompanyWechat adminCompanyWechat : adminCompanyWechatService.list()
-        ) {
-            adminCompanyWechatMap.put(adminCompanyWechat.getCompanyWechatId(), adminCompanyWechat);
-        }
-
-        //过期时间
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(new Date());
-        calendar.add(Calendar.DAY_OF_MONTH, -day);
-        Date time = calendar.getTime();
-
-        //需跟新的素材
-        IPage<MarketingMaterials> page = marketingMaterialsService.lambdaQuery()
-                .le(MarketingMaterials::getMediaIdLastUpdateTime, time)
-                .ne(MarketingMaterials::getType, MarketingMaterialsTypeEnum.TEXT.getCode())
-                .ne(MarketingMaterials::getType, MarketingMaterialsTypeEnum.SMALL.getCode())
-                .page(new Page<>(1, count));
-
-        List<MarketingMaterials> data = page.getRecords();
-        if(CollectionUtils.isEmpty(data)){
-            return page;
-        }
-
-        for (MarketingMaterials mm : data
-        ) {
-
-            AdminCompanyWechat adminCompanyWechat = adminCompanyWechatMap.get(mm.getCompanyWechatId());
-            String type = mm.getType();
-
-
-            //type 不为text时候
-            if (!type.equals(MarketingMaterialsTypeEnum.TEXT.getCode()) && !type.equals(MarketingMaterialsTypeEnum.SMALL.getCode())) {
-
-                try {
-                    String fileType = type.equals(MarketingMaterialsTypeEnum.FILE.getCode()) ? "file" : (
-                            type.equals(MarketingMaterialsTypeEnum.VIDEO.getCode()) ? "video" : "image"
-                    );
-                    String mediaId = loadToQyWx(adminCompanyWechat, mm.getFileUrl(), fileType);
-
-                    mm.setMediaId(mediaId);
-                } catch (WxErrorException | IOException e) {
-                    log.info("新增营销素材:调用企业微信失败返回:" + e.getMessage());
-                } finally {
-                    mm.setMediaIdLastUpdateTime(new Date());
-                }
-            }
-        }
-        marketingMaterialsService.updateBatchById(data);
-        return page;
-    }
-
-}

+ 2 - 28
src/main/java/com/gree/mall/manager/logic/order/OrderLogic.java

@@ -324,8 +324,6 @@ public class OrderLogic {
      */
     @Transactional
     public BigDecimal refund(String orderDetailId, int num, String refundPassword) throws Exception {
-        // 检查退款密码
-        this.checkRefundPassword(refundPassword);
         if (num < 1) {
             throw new RemoteServiceException("退款数量不能小于1");
         }
@@ -416,18 +414,6 @@ public class OrderLogic {
         return refundAmount;
     }
 
-    public void checkRefundPassword(String refundPassword) {
-        AdminUserCom adminUserCom = commonLogic.getAdminUser();
-        if (StringUtils.isNotBlank(adminUserCom.getLoginCompanyWechatId())) {
-            AdminCompanyWechat companyWechat = adminCompanyWechatService.getById(adminUserCom.getLoginCompanyWechatId());
-            if (StringUtils.isNotBlank(companyWechat.getRefundPassword())
-                    && !companyWechat.getRefundPassword().equals(refundPassword)) {
-                throw new RemoteServiceException("退款密码不正确,请联系管理者");
-            }
-        }
-    }
-
-
     /**
      * 理赔列表
      */
@@ -443,8 +429,7 @@ public class OrderLogic {
     @Transactional
     public BigDecimal refundCliaims(String orderDetailId, int num, BigDecimal refundAmount, String adminUserId,
                                     String remark, String refundPassword) throws Exception {
-        // 检查退款密码
-        this.checkRefundPassword(refundPassword);
+
 //        if (num < 1) {
 //            throw new RemoteServiceException("数量错误");
 //        }
@@ -618,10 +603,7 @@ public class OrderLogic {
         orderInfo.updateById();
 
         orderShareLogic.updateOrderStatus(orderId, OrderStatusEnum.YFH.toString());
-        //对接工单清洗服务
-        if (Objects.nonNull(companyWechat) && StringUtils.isNotBlank(companyWechat.getJindCustomerNumber())) {
-            this.orderToPhp(orderInfo, WorkOrderTypeEnum.REPAIR.toString());
-        }
+
         //订阅物流
         expressLogic.subscribeExpress(logisticsNo, companyCode,orderInfo.getRecePhone());
         //发货通知
@@ -742,10 +724,6 @@ public class OrderLogic {
 
         orderShareLogic.updateOrderStatus(orderId, OrderStatusEnum.YFH.toString());
 
-        //对接工单清洗服务
-        if (Objects.nonNull(companyWechat) && StringUtils.isNotBlank(companyWechat.getJindCustomerNumber())) {
-            this.orderToPhp(orderInfo, WorkOrderTypeEnum.REPAIR.toString());
-        }
         expressLogic.subscribeExpress(deliverGoodsBean.getLogisticsNo(), company.getCode(),orderInfo.getRecePhone());
         if (orderInfo != null) {
             User user = userLogic.getById(orderInfo.getUserId());
@@ -1064,10 +1042,6 @@ public class OrderLogic {
                     .set(OrderShare::getOrderFinishTime, new Date())
                     .update();
 
-            //生成工单到工单系统
-            if (Objects.nonNull(companyWechat) && StringUtils.isNotBlank(companyWechat.getJindCustomerNumber())) {
-                this.orderToPhp(orderInfo, WorkOrderTypeEnum.INSTALL.toString());
-            }
         }
     }
 

+ 0 - 1
src/main/java/com/gree/mall/manager/logic/order/OrderRefundLogic.java

@@ -141,7 +141,6 @@ public class OrderRefundLogic {
      */
     @Transactional
     public void examine(String orderRefundId, String examineStatus,String refundMessage, String refundPassword) throws Exception {
-        orderLogic.checkRefundPassword(refundPassword);
         OrderRefund orderRefund = orderRefundService.getById(orderRefundId);
         OrderInfo orderInfo = orderInfoService.getById(orderRefund.getOrderId());
         if (examineStatus.equals(OrderExamineEnum.FAIL.toString())) {

+ 0 - 538
src/main/java/com/gree/mall/manager/logic/sop/SopRuleLogic.java

@@ -1,538 +0,0 @@
-package com.gree.mall.manager.logic.sop;
-
-
-import cn.hutool.core.convert.Convert;
-import cn.hutool.core.date.DateUnit;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.json.JSONUtil;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.bean.delay.Job;
-import com.gree.mall.manager.bean.sop.SopPushTaskData;
-import com.gree.mall.manager.bean.sop.SopRuleAdd;
-import com.gree.mall.manager.bean.sop.SopRuleData;
-import com.gree.mall.manager.bean.sop.SopWorkerPushCount;
-import com.gree.mall.manager.commonmapper.SopRulePushMapper;
-import com.gree.mall.manager.constant.DelayConfig;
-import com.gree.mall.manager.constant.JobStatus;
-import com.gree.mall.manager.enums.JobTopic;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.plus.entity.*;
-import com.gree.mall.manager.plus.service.*;
-import com.gree.mall.manager.utils.DateUtils;
-import com.gree.mall.manager.utils.StringUtil;
-import cn.hutool.core.util.XmlUtil;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.bean.external.contact.FollowedUser;
-import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.text.ParseException;
-import java.util.*;
-
-/**
- * @author change
- */
-@Slf4j
-@Service
-public class SopRuleLogic {
-
-    @Autowired
-    private SopRulePushMapper sopRuleTaskMapper;
-
-    @Autowired
-    private CommonLogic commonLogic;
-
-    @Autowired
-    private SopRuleService sopRuleService;
-
-    @Autowired
-    private SopRuleTaskService sopRuleTaskService;
-
-    @Autowired
-    private SopRuleWorkerService sopRuleWorkerService;
-
-    @Autowired
-    private SopPushTaskService sopPushTaskService;
-
-    @Autowired
-    private SopPushTaskTagService sopPushTaskTagService;
-
-    @Autowired
-    private SopWorkerPushService sopWorkerPushService;
-
-    @Autowired
-    private ExternalUserService externalUserService;
-
-    @Autowired
-    private AdminCompanyWechatService adminCompanyWechatService;
-
-    @Autowired
-    private EnterpriseWechatWorkerService enterpriseWechatWorkerService;
-
-    @Autowired
-    private MarketingMaterialsService marketingMaterialsService;
-
-
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
-
-    @Autowired
-    private UserTagService userTagService;
-
-
-    @Autowired
-    private JobLogic jobLogic;
-
-    public IPage<SopRuleData> list(String ruleName, Integer status, HttpServletRequest request, Integer pageNum, Integer pageSize) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        IPage<SopRuleData> list = sopRuleTaskMapper.list(new Page(pageNum, pageSize), ruleName, status, adminUser.getAdminCompanyIds(), null);
-        List<SopRuleData> records = list.getRecords();
-        for (SopRuleData record : records) {
-            List<SopPushTaskData> sopPushTask = sopRuleTaskMapper.getTaskPush(record.getId());
-            record.setSopPushTask(sopPushTask);
-        }
-        list.setRecords(records);
-        return list;
-    }
-
-
-    @Transactional(rollbackFor = Exception.class)
-    public void add(SopRuleAdd sopRuleAdd, HttpServletRequest request) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        if (sopRuleService.lambdaQuery().eq(SopRule::getRuleName, sopRuleAdd.getRuleName()).count() > 0) {
-            throw new RemoteServiceException("规则名重复");
-        }
-        //添加规则
-        SopRule sopRule = new SopRule();
-        sopRule.setRuleName(sopRuleAdd.getRuleName());
-        sopRule.setCompanyWechatId(adminUser.getCompanyWechatId());
-        sopRule.setCompanyName(adminUser.getCompanyName());
-        sopRule.setCreateTime(new Date());
-        sopRule.setUpdateTime(new Date());
-        sopRule.setCreateBy(adminUser.getNickName());
-        sopRule.setStatus(1);
-        boolean save = sopRuleService.save(sopRule);
-        //添加规则id
-        for (SopPushTaskData sopPushTaskDatum : sopRuleAdd.getSopPushTaskData()) {
-            sopPushTaskDatum.setCreateTime(new Date());
-            sopPushTaskDatum.setUpdateTime(new Date());
-            sopPushTaskDatum.setCompanyWechatId(adminUser.getCompanyWechatId());
-            sopPushTaskDatum.setCompanyName(adminUser.getCompanyName());
-            sopPushTaskService.save(sopPushTaskDatum);
-            if (!CollectionUtils.isEmpty(sopPushTaskDatum.getTags())) {
-                for (Tag tag : sopPushTaskDatum.getTags()) {
-                    SopPushTaskTag sopPushTaskTag = new SopPushTaskTag();
-                    sopPushTaskTag.setTaskId(sopPushTaskDatum.getId());
-                    sopPushTaskTag.setGroupId(tag.getGroupId());
-                    sopPushTaskTag.setTagId(tag.getTagId());
-                    sopPushTaskTagService.save(sopPushTaskTag);
-                }
-
-            }
-            SopRuleTask sopRuleTask = new SopRuleTask();
-            sopRuleTask.setTaskId(sopPushTaskDatum.getId());
-            sopRuleTask.setRuleId(sopRule.getId());
-            sopRuleTaskService.save(sopRuleTask);
-        }
-
-        //添加员工
-        List<SopRuleWorker> sopRuleTaskList = new ArrayList<>();
-        for (String worker : sopRuleAdd.getWorkerIds()) {
-            EnterpriseWechatWorker byId = enterpriseWechatWorkerService.getById(worker);
-            SopRuleWorker sopRuleWorker = new SopRuleWorker();
-            sopRuleWorker.setWechatUserId(byId.getWechatUserId());
-//            sopRuleWorker.setCorpId(adminUser.getCorpId());
-            sopRuleWorker.setRuleId(sopRule.getId());
-            sopRuleTaskList.add(sopRuleWorker);
-        }
-        sopRuleWorkerService.saveBatch(sopRuleTaskList);
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void edit(SopRuleAdd sopRuleAdd, HttpServletRequest request) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        //添加规则
-        SopRule sopRule = new SopRule();
-        sopRule.setRuleName(sopRuleAdd.getRuleName());
-        sopRule.setId(sopRuleAdd.getId());
-        sopRule.setUpdateTime(new Date());
-        sopRule.setStatus(sopRuleAdd.getStatus());
-        boolean b = sopRuleService.updateById(sopRule);
-        //删除员工,添加员工
-        sopRuleWorkerService.lambdaUpdate().eq(SopRuleWorker::getRuleId, sopRule.getId()).remove();
-        List<SopRuleWorker> sopRuleTaskList = new ArrayList<>();
-        for (String worker : sopRuleAdd.getWorkerIds()) {
-            EnterpriseWechatWorker byId = enterpriseWechatWorkerService.getById(worker);
-            SopRuleWorker sopRuleWorker = new SopRuleWorker();
-            sopRuleWorker.setWechatUserId(byId.getWechatUserId());
-//            sopRuleWorker.setCorpId(adminUser.getCorpId());
-            sopRuleWorker.setRuleId(sopRule.getId());
-            sopRuleTaskList.add(sopRuleWorker);
-        }
-
-        //添加规则id
-        sopRuleTaskService.lambdaUpdate().eq(SopRuleTask::getRuleId, sopRule.getId()).remove();
-        for (SopPushTaskData sopPushTaskDatum : sopRuleAdd.getSopPushTaskData()) {
-            sopPushTaskDatum.setCreateTime(new Date());
-            sopPushTaskDatum.setUpdateTime(new Date());
-            sopPushTaskDatum.setCompanyWechatId(adminUser.getCompanyWechatId());
-            sopPushTaskDatum.setCompanyName(adminUser.getCompanyName());
-            sopPushTaskDatum.setId(null);
-            sopPushTaskService.save(sopPushTaskDatum);
-            if (!CollectionUtils.isEmpty(sopPushTaskDatum.getTags())) {
-                for (Tag tag : sopPushTaskDatum.getTags()) {
-                    SopPushTaskTag sopPushTaskTag = new SopPushTaskTag();
-                    sopPushTaskTag.setTaskId(sopPushTaskDatum.getId());
-                    sopPushTaskTag.setGroupId(tag.getGroupId());
-                    sopPushTaskTag.setTagId(tag.getTagId());
-                    sopPushTaskTagService.save(sopPushTaskTag);
-                }
-
-            }
-            SopRuleTask sopRuleTask = new SopRuleTask();
-            sopRuleTask.setTaskId(sopPushTaskDatum.getId());
-            sopRuleTask.setRuleId(sopRule.getId());
-            sopRuleTaskService.save(sopRuleTask);
-        }
-        sopRuleWorkerService.saveBatch(sopRuleTaskList);
-    }
-
-    public SopRuleData detail(String id) {
-        SopRuleData sopRuleData = sopRuleTaskMapper.list(new Page(1, 1), null, null, null, id).getRecords().get(0);
-        List<SopPushTaskData> sopPushTask = sopRuleTaskMapper.getTaskPush(sopRuleData.getId());
-        sopRuleData.setSopPushTask(sopPushTask);
-        return sopRuleData;
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void editPushTask(SopPushTaskData sopPushTaskData) {
-        sopPushTaskData.setUpdateTime(new Date());
-        sopPushTaskService.updateById(sopPushTaskData);
-        if (!CollectionUtils.isEmpty(sopPushTaskData.getTags())) {
-            sopPushTaskTagService.lambdaUpdate().eq(SopPushTaskTag::getTaskId, sopPushTaskData.getId()).remove();
-            for (Tag tag : sopPushTaskData.getTags()) {
-                SopPushTaskTag sopPushTaskTag = new SopPushTaskTag();
-                sopPushTaskTag.setTaskId(sopPushTaskData.getId());
-                sopPushTaskTag.setGroupId(tag.getGroupId());
-                sopPushTaskTag.setTagId(tag.getTagId());
-                sopPushTaskTagService.save(sopPushTaskTag);
-            }
-
-        }
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void deleteTask(String id) {
-        sopRuleTaskService.lambdaUpdate().eq(SopRuleTask::getTaskId, id).remove();
-        sopPushTaskService.removeById(id);
-    }
-
-    public SopPushTaskData detailTask(String id) {
-        return sopRuleTaskMapper.detailTask(id);
-    }
-
-
-    public IPage<SopWorkerPush> taskList(String taskId, String ruleId, String externalName, String startTime, String endTime, Integer workerStatus, HttpServletRequest request, Integer pageNum, Integer pageSize) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        return sopWorkerPushService.lambdaQuery()
-                .in(!CollectionUtils.isEmpty(adminUser.getAdminCompanyIds()), SopWorkerPush::getCompanyWechatId, adminUser.getAdminCompanyIds())
-                .eq(SopWorkerPush::getTaskId, taskId)
-                .eq(SopWorkerPush::getRuleId, ruleId)
-                .eq(!StringUtil.isEmpty(externalName), SopWorkerPush::getExternalName, externalName)
-                .eq(!StringUtil.isEmpty(externalName), SopWorkerPush::getExternalName, externalName)
-                .between(!StringUtil.isEmpty(startTime) && !StringUtil.isEmpty(endTime), SopWorkerPush::getTaskTime, startTime, endTime)
-                .orderByDesc(SopWorkerPush::getCreateTime)
-                .page(new Page<>(pageNum, pageSize));
-    }
-
-    public SopWorkerPushCount taskCount(String taskId, String ruleId, HttpServletRequest request) {
-        SopWorkerPushCount sopWorkerPushCount = new SopWorkerPushCount();
-        sopWorkerPushCount.setAllCount(sopWorkerPushService.lambdaQuery().eq(SopWorkerPush::getTaskId, taskId)
-                .eq(SopWorkerPush::getRuleId, ruleId).count());
-        sopWorkerPushCount.setWorkerCount(sopWorkerPushService.lambdaQuery().eq(SopWorkerPush::getTaskId, taskId)
-                .eq(SopWorkerPush::getRuleId, ruleId).eq(SopWorkerPush::getWorkerStatus, 1).count());
-        sopWorkerPushCount.setDayCount(sopWorkerPushService.lambdaQuery().eq(SopWorkerPush::getTaskId, taskId)
-                .eq(SopWorkerPush::getRuleId, ruleId).between(SopWorkerPush::getTaskTime, DateUtils.getStartTime(), DateUtils.getEndTime()).count());
-        sopWorkerPushCount.setDayWorkerCount(sopWorkerPushService.lambdaQuery().eq(SopWorkerPush::getTaskId, taskId)
-                .eq(SopWorkerPush::getRuleId, ruleId).between(SopWorkerPush::getTaskTime, DateUtils.getStartTime(), DateUtils.getEndTime()).eq(SopWorkerPush::getWorkerStatus, 1).count());
-        return sopWorkerPushCount;
-    }
-
-
-    public void addPushTask(SopPushTaskData sopPushTaskData, String id, HttpServletRequest request) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        sopPushTaskData.setCreateTime(new Date());
-        sopPushTaskData.setUpdateTime(new Date());
-        sopPushTaskData.setCompanyWechatId(adminUser.getCompanyWechatId());
-        sopPushTaskData.setCompanyName(adminUser.getCompanyName());
-        sopPushTaskService.save(sopPushTaskData);
-        if (!CollectionUtils.isEmpty(sopPushTaskData.getTags())) {
-            for (Tag tag : sopPushTaskData.getTags()) {
-                SopPushTaskTag sopPushTaskTag = new SopPushTaskTag();
-                sopPushTaskTag.setTaskId(sopPushTaskData.getId());
-                sopPushTaskTag.setGroupId(tag.getGroupId());
-                sopPushTaskTag.setTagId(tag.getTagId());
-                sopPushTaskTagService.save(sopPushTaskTag);
-            }
-
-        }
-        SopRuleTask sopRuleTask = new SopRuleTask();
-        sopRuleTask.setTaskId(sopPushTaskData.getId());
-        sopRuleTask.setRuleId(id);
-        sopRuleTaskService.save(sopRuleTask);
-
-    }
-
-    public void pushTaskWorker(String decrypt, String corpId) {
-        Map<String, Object> map = XmlUtil.xmlToMap(decrypt);
-        System.out.println(map);
-        if (map.get("ChangeType").equals("edit_external_contact"))
-            sendTag(map);
-
-        if (map.get("ChangeType").equals("add_external_contact") || map.get("ChangeType").equals("add_half_external_contact")) {
-
-            //查询用户是否关联了规则
-            if (sopRuleWorkerService.lambdaQuery().eq(SopRuleWorker::getWechatUserId, map.get("UserID")).eq(SopRuleWorker::getCorpId, corpId).count() < 1)
-                return;
-            //查询用户得规则得任务
-            AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getOne(Wrappers.<AdminCompanyWechat>lambdaQuery().eq(AdminCompanyWechat::getCorpId, map.get("ToUserName")).last("limit 1"));
-            List<SopRuleWorker> sopRuleWorkers = sopRuleWorkerService.lambdaQuery().eq(SopRuleWorker::getWechatUserId, map.get("UserID")).eq(SopRuleWorker::getCorpId, corpId).list();
-            sopRuleWorkers.stream().forEach(item -> {
-                List<SopRuleTask> list = sopRuleTaskService.lambdaQuery().eq(SopRuleTask::getRuleId, item.getRuleId()).list();
-                List<SopRule> sopRules = sopRuleService.lambdaQuery().eq(SopRule::getId, item.getRuleId()).eq(SopRule::getStatus, 1).list();
-
-                for (SopRuleTask sopRuleTask : list) {
-                    if (CollectionUtils.isEmpty(sopRules))
-                        break;
-                    SopPushTask one = sopPushTaskService.getOne(Wrappers.<SopPushTask>lambdaQuery().eq(SopPushTask::getId, sopRuleTask.getTaskId()).eq(SopPushTask::getStatus, 1).last("limit 1"));
-                    if (!one.getType().equals(1))
-                        continue;
-
-                    Job job = new Job();
-                    job.setId(UUID.randomUUID().toString());
-                    if (one.getPushType().equals(2)) {
-                        try {
-                            job.setDelayTime(delayTime(one.getPushDay(), (one.getPushDayMin()) + 10) * 1000);
-                        } catch (ParseException e) {
-                            e.printStackTrace();
-                            log.error("添加客户时间计算错误");
-                        }
-                    } else {
-                        job.setDelayTime(((one.getPushMin() * 60) + 10) * 1000);
-                    }
-
-                    Map<String, Object> taskMap = new HashMap<>();
-                    taskMap.put("id", one.getId());
-                    taskMap.put("toUser", map.get("UserID"));
-                    taskMap.put("externalUserID", map.get("ExternalUserID"));
-                    taskMap.put("companyName", adminCompanyWechat.getCompanyName());
-                    taskMap.put("companyWechatId", adminCompanyWechat.getCompanyWechatId());
-                    taskMap.put("agentId1", adminCompanyWechat.getAgentId1());
-
-
-                    job.setTtrTime(DelayConfig.PROCESS_TIME);
-                    job.setTopic(JobTopic.TOPIC_SOP.getTopic());
-                    job.setStatus(JobStatus.DELAY);
-                    job.setRetryCount(DelayConfig.RETRY_COUNT);
-
-                    SopWorkerPush sopWorkerPush = new SopWorkerPush();
-                    List<ExternalUser> externalUserID = externalUserService.lambdaQuery().eq(ExternalUser::getExternalUserId, Convert.toStr(map.get("ExternalUserID"))).list();
-                    if (!CollectionUtils.isEmpty(externalUserID)) {
-                        sopWorkerPush.setExternalName(externalUserID.get(0).getName());
-                    }
-                    sopWorkerPush.setExternalUserId(Convert.toStr(map.get("ExternalUserID")));
-                    sopWorkerPush.setWechatUserId(Convert.toStr(map.get("UserID")));
-                    List<EnterpriseWechatWorker> userID = enterpriseWechatWorkerService.lambdaQuery().eq(EnterpriseWechatWorker::getWechatUserId, Convert.toStr(map.get("UserID")))
-                            .eq(EnterpriseWechatWorker::getCorpId, adminCompanyWechat.getCorpId()).list();
-                    if (!CollectionUtils.isEmpty(externalUserID)) {
-                        sopWorkerPush.setWechatName(userID.get(0).getName());
-                    }
-                    sopWorkerPush.setWechatName(Convert.toStr(map.get("UserID")));
-                    sopWorkerPush.setCorpId(adminCompanyWechat.getCorpId());
-                    sopWorkerPush.setTaskTime(DateUtil.date(System.currentTimeMillis() + job.getDelayTime()));
-                    sopWorkerPush.setWorkerStatus(0);
-                    sopWorkerPush.setCreateTime(new Date());
-                    sopWorkerPush.setUpdateTime(new Date());
-                    sopWorkerPush.setTaskId(sopRuleTask.getTaskId());
-                    sopWorkerPush.setRuleId(sopRuleTask.getRuleId());
-                    sopWorkerPush.setCompanyWechatId(adminCompanyWechat.getCompanyWechatId());
-                    sopWorkerPush.setCompanyName(adminCompanyWechat.getCompanyName());
-                    sopWorkerPushService.save(sopWorkerPush);
-
-                    taskMap.put("pushWorkerId", sopWorkerPush.getId());
-                    job.setMessage(JSONUtil.toJsonStr(taskMap));
-                    jobLogic.addDefJob(job);
-
-                }
-
-            });
-        }
-    }
-
-    public void sendTag(Map<String, Object> map) {
-        //查询用户是否关联了规则
-        AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getOne(Wrappers.<AdminCompanyWechat>lambdaQuery().eq(AdminCompanyWechat::getCorpId, map.get("ToUserName")).last("limit 1"));
-        if (sopRuleWorkerService.lambdaQuery().eq(SopRuleWorker::getWechatUserId, map.get("UserID")).eq(SopRuleWorker::getCorpId, adminCompanyWechat.getCorpId()).count() < 1)
-            return;
-        List<SopRuleWorker> sopRuleWorkers = sopRuleWorkerService.lambdaQuery().eq(SopRuleWorker::getWechatUserId, map.get("UserID")).eq(SopRuleWorker::getCorpId, adminCompanyWechat.getCorpId()).list();
-        sopRuleWorkers.stream().forEach(item -> {
-            List<SopRule> sopRules = sopRuleService.lambdaQuery().eq(SopRule::getId, item.getRuleId()).eq(SopRule::getStatus, 1).list();
-            List<SopRuleTask> list = sopRuleTaskService.lambdaQuery().eq(SopRuleTask::getRuleId, item.getRuleId()).list();
-            for (SopRuleTask sopRuleTask : list) {
-                if (CollectionUtils.isEmpty(sopRules))
-                    break;
-                SopPushTask one = sopPushTaskService.getOne(Wrappers.<SopPushTask>lambdaQuery().eq(SopPushTask::getId, sopRuleTask.getTaskId()).eq(SopPushTask::getStatus, 1).last("limit 1"));
-                if (!one.getType().equals(2))
-                    continue;
-                //查关联标签的,对比是否客户添加了此标签
-                List<SopPushTaskTag> list1 = sopPushTaskTagService.lambdaQuery().eq(SopPushTaskTag::getTaskId, sopRuleTask.getTaskId()).list();
-                Integer count = 0;
-                for (SopPushTaskTag sopPushTaskTag : list1) {
-                    try {
-                        WxCpExternalContactInfo wxCpExternalContactInfo = workWechatLogic.getCustomerDetail(Convert.toStr(map.get("ExternalUserID")), adminCompanyWechat);
-
-                        if (count > 0)
-                            break;
-                        for (FollowedUser followedUser : wxCpExternalContactInfo.getFollowedUsers()) {
-                            if (!followedUser.getUserId().equals(map.get("UserID")))
-                                continue;
-                            //用户拥有的标签
-                            FollowedUser.Tag[] tags = followedUser.getTags();
-
-                            for (FollowedUser.Tag tagId : tags) {
-                                //判断标签是否一致
-                                if (!sopPushTaskTag.getTagId().equals(tagId.getTagId()))
-                                    continue;
-
-                                //找不到用户的此标签发送消息
-                                List<UserTag> list2 = userTagService.lambdaQuery().eq(UserTag::getUserid, map.get("UserID")).eq(UserTag::getExternalUserId, map.get("ExternalUserID")).eq(UserTag::getTagId, tagId.getTagId()).list();
-                                if (!CollectionUtils.isEmpty(list2))
-                                    continue;
-
-                                if (count > 0)
-                                    continue;
-
-                                Job job = new Job();
-                                job.setId(UUID.randomUUID().toString());
-                                if (one.getPushType().equals(2)) {
-                                    try {
-                                        job.setDelayTime(delayTime(one.getPushDay(), (one.getPushDayMin()) + 10) * 1000);
-                                    } catch (ParseException e) {
-                                        e.printStackTrace();
-                                        log.error("添加客户时间计算错误");
-                                    }
-                                } else {
-                                    job.setDelayTime(((one.getPushMin() * 60) + 10) * 1000);
-                                }
-
-                                Map<String, Object> taskMap = new HashMap<>();
-                                taskMap.put("id", one.getId());
-                                taskMap.put("toUser", map.get("UserID"));
-                                taskMap.put("externalUserID", map.get("ExternalUserID"));
-                                taskMap.put("companyName", adminCompanyWechat.getCompanyName());
-                                taskMap.put("companyWechatId", adminCompanyWechat.getCompanyWechatId());
-                                taskMap.put("agentId1", adminCompanyWechat.getAgentId1());
-
-
-                                job.setTtrTime(DelayConfig.PROCESS_TIME);
-                                job.setTopic(JobTopic.TOPIC_SOP.getTopic());
-                                job.setStatus(JobStatus.DELAY);
-                                job.setRetryCount(DelayConfig.RETRY_COUNT);
-
-                                SopWorkerPush sopWorkerPush = new SopWorkerPush();
-                                List<ExternalUser> externalUserID = externalUserService.lambdaQuery().eq(ExternalUser::getExternalUserId, Convert.toStr(map.get("ExternalUserID"))).list();
-                                if (!CollectionUtils.isEmpty(externalUserID)) {
-                                    sopWorkerPush.setExternalName(externalUserID.get(0).getName());
-                                }
-                                sopWorkerPush.setExternalUserId(Convert.toStr(map.get("ExternalUserID")));
-                                sopWorkerPush.setWechatUserId(Convert.toStr(map.get("UserID")));
-                                List<EnterpriseWechatWorker> userID = enterpriseWechatWorkerService.lambdaQuery().eq(EnterpriseWechatWorker::getWechatUserId, Convert.toStr(map.get("UserID")))
-                                        .eq(EnterpriseWechatWorker::getCorpId, adminCompanyWechat.getCorpId()).list();
-                                if (!CollectionUtils.isEmpty(externalUserID)) {
-                                    sopWorkerPush.setWechatName(userID.get(0).getName());
-                                }
-                                sopWorkerPush.setWechatName(Convert.toStr(map.get("UserID")));
-                                sopWorkerPush.setCorpId(adminCompanyWechat.getCorpId());
-                                sopWorkerPush.setTaskTime(DateUtil.date(System.currentTimeMillis() + job.getDelayTime()));
-                                sopWorkerPush.setWorkerStatus(0);
-                                sopWorkerPush.setCreateTime(new Date());
-                                sopWorkerPush.setUpdateTime(new Date());
-                                sopWorkerPush.setTaskId(sopRuleTask.getTaskId());
-                                sopWorkerPush.setRuleId(sopRuleTask.getRuleId());
-                                sopWorkerPush.setCompanyWechatId(adminCompanyWechat.getCompanyWechatId());
-                                sopWorkerPush.setCompanyName(adminCompanyWechat.getCompanyName());
-                                sopWorkerPushService.save(sopWorkerPush);
-
-                                taskMap.put("pushWorkerId", sopWorkerPush.getId());
-                                job.setMessage(JSONUtil.toJsonStr(taskMap));
-                                jobLogic.addDefJob(job);
-                                count ++ ;
-
-                            }
-                        }
-                    } catch (WxErrorException e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-        });
-    }
-
-    public Long delayTime(Integer pushDay, String pushDayMin) throws ParseException {
-        Date date = DateUtils.getTimeByDay(pushDay);
-        String s1 = DateUtils.formatDate1(date);
-        String s2 = s1 + " " + pushDayMin;
-        ;
-        Date date1 = DateUtils.parseDate(s2);
-        Long gs = DateUtil.between(new Date(), date1, DateUnit.SECOND);
-        return gs;
-    }
-
-    public void addCompanyToken(String token, String encodingAES_key, HttpServletRequest request) {
-
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        AdminCompanyWechat adminCompanyWechat = new AdminCompanyWechat();
-        adminCompanyWechat.setCompanyWechatId(adminUser.getCompanyWechatId());
-        adminCompanyWechat.setToken(token);
-        adminCompanyWechat.setEncodingaesKey(encodingAES_key);
-        adminCompanyWechatService.updateById(adminCompanyWechat);
-    }
-
-    public AdminCompanyWechat detailCompany(HttpServletRequest request) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        return adminCompanyWechatService.getById(adminUser.getCompanyWechatId());
-    }
-
-    public void delete(String id) {
-        sopRuleService.removeById(id);
-    }
-
-    public void addKeFu(SopRuleAdd sopRuleAdd, HttpServletRequest request) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        //添加员工
-        List<SopRuleWorker> sopRuleTaskList = new ArrayList<>();
-        for (String worker : sopRuleAdd.getWorkerIds()) {
-            EnterpriseWechatWorker byId = enterpriseWechatWorkerService.getById(worker);
-            List<SopRuleWorker> list = sopRuleWorkerService.lambdaQuery().eq(SopRuleWorker::getRuleId, sopRuleAdd.getId()).eq(SopRuleWorker::getWechatUserId, byId.getWechatUserId()).list();
-            if (!CollectionUtils.isEmpty(list)) {
-                continue;
-            }
-            SopRuleWorker sopRuleWorker = new SopRuleWorker();
-            sopRuleWorker.setWechatUserId(byId.getWechatUserId());
-//            sopRuleWorker.setCorpId(adminUser.getCorpId());
-            sopRuleWorker.setRuleId(sopRuleAdd.getId());
-            sopRuleTaskList.add(sopRuleWorker);
-        }
-        sopRuleWorkerService.saveBatch(sopRuleTaskList);
-    }
-}

+ 0 - 257
src/main/java/com/gree/mall/manager/logic/tag/AsyncWxTagLogic.java

@@ -1,257 +0,0 @@
-package com.gree.mall.manager.logic.tag;
-
-import com.alibaba.fastjson.JSONObject;
-import com.aliyuncs.utils.StringUtils;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.gree.mall.manager.constant.Constant;
-import com.gree.mall.manager.logic.admin.ew.EnterpriseWechatWorkerLogic;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.plus.entity.*;
-import com.gree.mall.manager.plus.service.EnterpriseWechatWorkerService;
-import com.gree.mall.manager.plus.service.ExternalUserService;
-import com.gree.mall.manager.plus.service.FollowUserService;
-import com.gree.mall.manager.plus.service.UserTagService;
-import com.gree.mall.manager.utils.DateUtils;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.common.error.WxRuntimeException;
-import me.chanjar.weixin.cp.bean.external.contact.ExternalContact;
-import me.chanjar.weixin.cp.bean.external.contact.FollowedUser;
-import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.stream.Collectors;
-
-@Slf4j
-@Service
-public class AsyncWxTagLogic {
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
-    @Autowired
-    CommonLogic commonLogic;
-    @Autowired
-    EnterpriseWechatWorkerLogic enterpriseWechatWorkerLogic;
-    @Autowired
-    private ExternalUserService externalUserService;
-    @Autowired
-    private UserTagService userTagService;
-    @Autowired
-    private FollowUserService followUserService;
-
-
-    public void syncWxUserData(String corpId,AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-        List<EnterpriseWechatWorker> userList = enterpriseWechatWorkerLogic.list(corpId);
-        if(CollectionUtils.isEmpty(userList)){
-            return;
-        }
-        this.requstCustomerData(userList,adminCompanyWechat);
-    }
-
-
-    private void requstCustomerData(List<EnterpriseWechatWorker> userList,AdminCompanyWechat adminCompanyWechat) throws WxErrorException, WxRuntimeException {
-
-        //外部联系人
-        List<ExternalUser> curExternalUserList = externalUserService.lambdaQuery()
-                .eq(ExternalUser::getAddType, true).list();
-        List<String> curExternalUnionidList = new ArrayList<>();
-        for(ExternalUser eu : curExternalUserList){
-            curExternalUnionidList.add(eu.getUserId() + eu.getExternalUserId());
-        }
-        //用户标签
-        List<UserTag> userTagList = userTagService.lambdaQuery()
-                .eq(UserTag::getAddType, true)
-                .list();
-        List<String> curUserTagIdList = userTagList.stream().map(o -> (o.getExternalUserId() + "_" + o.getTagId())).collect(Collectors.toList());
-        List<FollowUser> currFollowUsers = followUserService.list();
-        List<String> currFollowUserIds = currFollowUsers.stream().map(o -> (o.getExternalUserId() + "_" + o.getUserId())).collect(Collectors.toList());
-        for (EnterpriseWechatWorker wechatWorker : userList) {
-            String workUserId = wechatWorker.getWechatUserId();
-
-            //获取外部联系人id(获取客户列表)
-            List<String> externalUserIds  = workWechatLogic.getExternalUserIdByWorkUserId(workUserId,adminCompanyWechat);
-            if (CollectionUtils.isEmpty(externalUserIds)) {
-                continue;
-            }
-            for (String externalUserId : externalUserIds) {
-                //获取客户详情
-                WxCpExternalContactInfo wxCpExternalContactInfo =  workWechatLogic.getCustomerDetail(externalUserId,adminCompanyWechat);
-                if (wxCpExternalContactInfo == null) {
-                    continue;
-                }
-                //保存外部联系人
-                this.saveExternalUser(wxCpExternalContactInfo,curExternalUnionidList,workUserId,adminCompanyWechat.getCorpId());
-                //保存标签和添加了此客户的其他成员
-                this.saveCustomerData(wxCpExternalContactInfo, curUserTagIdList, currFollowUserIds,adminCompanyWechat);
-            }
-        }
-    }
-
-    /**
-     * 获取最新的外部联系人
-     */
-    public Map<String,Object> getLastExternalUser(String mobile,String lastExternalUserId) throws WxErrorException {
-
-        //广州售后服务的师傅
-        AdminCompanyWechat adminCompanyWechat = commonLogic.getAdminCompanyWechat(Constant.GD_COMPANY_WECHAT_ID);
-
-        EnterpriseWechatWorker one = enterpriseWechatWorkerLogic.getByMobile(mobile,adminCompanyWechat.getCorpId());
-        if(one == null){
-            return null;
-        }
-        String workUserId = one.getWechatUserId();
-        //查询外部联系人
-        List<ExternalUser> externalUsers = externalUserService.lambdaQuery()
-                .eq(ExternalUser::getExternalUserId, lastExternalUserId).list();
-        if(externalUsers.size() > 0){
-            ExternalUser externalUser = externalUsers.get(0);
-            Map<String,Object> map = new HashMap<>();
-            map.put("externalUserId",externalUser.getExternalUserId());
-            map.put("workUserId",workUserId);
-            map.put("avatar",externalUser.getAvatar());
-            map.put("name",externalUser.getName());
-            return map;
-        }
-
-        //所有外部联系人
-        List<String> externalUserIds  = workWechatLogic.miniApp(adminCompanyWechat).getExternalContactService().listExternalContacts(workUserId);
-        if(externalUserIds.size() == 0){
-            return null;
-        }
-        //查询当前所有外部联系人
-        List<ExternalUser> list = externalUserService.lambdaQuery().eq(ExternalUser::getUserId, workUserId)
-                .orderByDesc(ExternalUser::getCreateTime).list();
-        List<String> localUserIds = list.stream().map(ExternalUser::getExternalUserId).collect(Collectors.toList());
-        //最新的外部联系人
-        String lastUserId = "";
-        //过滤出最新的外部联系人
-        for(String externalUserId : externalUserIds){
-            if(localUserIds.contains(externalUserId)){
-                continue;
-            }
-            lastUserId = externalUserId;
-            break;
-        }
-        //没过滤出新的外部联系人,就拿最近5分钟最新的1个人
-        if(StringUtils.isEmpty(lastUserId) && localUserIds.size() > 0){
-            if(list.get(0).getCreateTime().getTime() > DateUtils.getTimeByDay(new Date(),-5).getTime()) {
-                lastUserId = localUserIds.get(0);
-            }
-        }
-        if(StringUtils.isEmpty(lastUserId)){
-            return null;
-        }
-        WxCpExternalContactInfo wxCpExternalContactInfo = workWechatLogic.getCustomerDetail(lastUserId,adminCompanyWechat);
-
-        //保存外部联系人
-        this.saveExternalUser(wxCpExternalContactInfo,null,workUserId,adminCompanyWechat.getCorpId());
-        //保存标签和添加了此客户的其他成员(交给定时器处理)
-//            this.saveCustomerData(wxCpExternalContactInfo, curUserTagIdList, currFollowUserIds);
-        
-        ExternalContact externalContact = wxCpExternalContactInfo.getExternalContact();
-        Map<String,Object> map = new HashMap<>();
-        map.put("externalUserId",externalContact.getExternalUserId());
-        map.put("workUserId",workUserId);
-        map.put("avatar",externalContact.getAvatar());
-        map.put("name",externalContact.getName());
-        return map;
-
-    }
-
-
-    /**
-     * 保存外部联系人所有信息(包含表钱)
-     * @param wxCpExternalContactInfo 外部联系人详情
-    //     * @param curExternalUnionidList 当前已同步到数据库的外部联系人id集合
-     * @param curUserTagIdList      当前已同步到数据库的标签id集合
-     * @param currFollowUserIds     添加了此外部联系员的成员id集合
-    //     * @param workUserId       当前成员id
-     */
-    private void saveCustomerData(WxCpExternalContactInfo wxCpExternalContactInfo,
-                                  List<String> curUserTagIdList, List<String> currFollowUserIds,
-                                  AdminCompanyWechat adminCompanyWechat) {
-
-        ExternalContact externalContact = wxCpExternalContactInfo.getExternalContact();
-
-        if (wxCpExternalContactInfo.getFollowedUsers() != null) {
-            List<UserTag> userTagList = new ArrayList<>();
-            List<FollowUser> followUserList = new ArrayList<>();
-
-
-            for (FollowedUser followedUser : wxCpExternalContactInfo.getFollowedUsers()) {
-                if(CollectionUtils.isNotEmpty(currFollowUserIds)
-                        && currFollowUserIds.contains(externalContact.getExternalUserId() + "_" + followedUser.getUserId())){
-                    continue;
-                }
-                FollowUser followUser = new FollowUser();
-                followUser.setCreateTime(new Date(followedUser.getCreateTime()*1000));
-                followUser.setUserId(followedUser.getUserId());
-                followUser.setExternalUserId(externalContact.getExternalUserId());
-                followUser.setDescription(followedUser.getDescription());
-                followUser.setRemark(followedUser.getRemark());
-                followUser.setRemarkMobiles(JSONObject.toJSONString(followedUser.getRemarkMobiles()));
-                followUser.setRemarkCorpName(followedUser.getRemarkCorpName());
-                followUser.setAddWay(followedUser.getAddWay());
-                followUser.setOperUserid(followedUser.getOperatorUserId());
-                followUser.setState(followedUser.getState());
-                currFollowUserIds.add(externalContact.getExternalUserId() + "_" + followedUser.getUserId());
-                followUserList.add(followUser);
-
-                //添加用户的标签
-                for (me.chanjar.weixin.cp.bean.external.contact.FollowedUser.Tag tag : followedUser.getTags()) {
-                    if(CollectionUtils.isNotEmpty(curUserTagIdList)
-                            && curUserTagIdList.contains(externalContact.getExternalUserId() + "_" + tag.getTagId())){
-                        continue;
-                    }
-                    UserTag userTag = new UserTag();
-                    userTag.setAddType(true);
-                    userTag.setCreateTime(new Date());
-                    userTag.setUnionId(externalContact.getUnionId());
-                    userTag.setExternalUserId(externalContact.getExternalUserId());
-                    userTag.setTagId(tag.getTagId());
-                    userTag.setUserid(followedUser.getUserId());
-                    userTag.setTagName(tag.getTagName());
-                    userTag.setTagType(tag.getType());
-                    userTag.setCompanyWechatId(adminCompanyWechat.getCompanyWechatId());
-                    userTag.setCompanyName(adminCompanyWechat.getCompanyName());
-                    curUserTagIdList.add(externalContact.getExternalUserId() + "_" + tag.getTagId());
-                    userTagList.add(userTag);
-                }
-            }
-
-            userTagService.saveBatch(userTagList);
-            followUserService.saveBatch(followUserList);
-        }
-
-    }
-
-
-
-    /**
-     * 保存外部联系人
-     * @param wxCpExternalContactInfo
-     * @param workUserId
-     */
-    private void saveExternalUser(WxCpExternalContactInfo wxCpExternalContactInfo,List<String> curExternalUnionidList,String workUserId,String corpId){
-        ExternalContact externalContact = wxCpExternalContactInfo.getExternalContact();
-        if(curExternalUnionidList == null){
-            curExternalUnionidList = new ArrayList<>();
-        }
-        if (CollectionUtils.isEmpty(curExternalUnionidList) || !curExternalUnionidList.contains(workUserId + externalContact.getExternalUserId())) {
-            curExternalUnionidList.add(workUserId + externalContact.getExternalUserId());
-            ExternalUser externalUser = new ExternalUser();
-            BeanUtils.copyProperties(externalContact, externalUser, "externalProfile");
-            externalUser.setExternalProfile(JSONObject.toJSONString(externalContact.getExternalProfile()));
-            externalUser.setCreateTime(new Date());
-            externalUser.setAddType(true);
-            externalUser.setCorpId(corpId);
-            externalUser.setUserId(workUserId);
-            externalUserService.save(externalUser);
-        }
-    }
-}

+ 0 - 116
src/main/java/com/gree/mall/manager/logic/tag/DepartmentSyncLogic.java

@@ -1,116 +0,0 @@
-package com.gree.mall.manager.logic.tag;
-
-import com.gree.mall.manager.logic.admin.AdminWebsitLogic;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import com.gree.mall.manager.plus.entity.AdminWebsit;
-import com.gree.mall.manager.plus.entity.EnterpriseWechatWorker;
-import com.gree.mall.manager.plus.service.AdminWebsitService;
-import com.gree.mall.manager.plus.service.EnterpriseWechatWorkerService;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.bean.WxCpDepart;
-import me.chanjar.weixin.cp.bean.WxCpUser;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-@Service
-@Slf4j
-public class DepartmentSyncLogic {
-    @Autowired
-    private EnterpriseWechatWorkerService enterpriseWechatWorkerService;
-    @Autowired
-    private AdminWebsitService adminWebsitService;
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
-    @Autowired
-    CommonLogic commonLogic;
-    @Autowired
-    AdminWebsitLogic adminWebsitLogic;
-
-
-    public void syncDepartmentData(AdminCompanyWechat adminCompanyWechat) throws WxErrorException {
-
-        //先删除手机号为空的
-        //enterpriseWechatWorkerService.lambdaUpdate().ne(EnterpriseWechatWorker::getMobile, "").remove();
-        int count = enterpriseWechatWorkerService.lambdaQuery()
-                .eq(EnterpriseWechatWorker::getCorpId,adminCompanyWechat.getCorpId()).count();
-        if(count > 0){
-            return;
-        }
-        //企微所有成员
-        List<WxCpUser> wxCpUsers = workWechatLogic.miniApp(adminCompanyWechat).getUserService().listByDepartment(1L, true, 0);
-        List<EnterpriseWechatWorker> list = new ArrayList<>();
-        for (WxCpUser wxCpUser : wxCpUsers) {
-            EnterpriseWechatWorker bean = new EnterpriseWechatWorker();
-            if (StringUtils.isEmpty(wxCpUser.getMobile())) {
-                continue;
-            }
-            if(wxCpUser.getMainDepartment() != null) {
-                AdminWebsit adminWebsit = adminWebsitLogic.detail(Long.parseLong(wxCpUser.getMainDepartment()), adminCompanyWechat.getCorpId());
-                if(adminWebsit != null){
-                    bean.setDepartmentName(adminWebsit.getName());
-                }
-            }
-
-            bean.setWechatUserId(wxCpUser.getUserId());
-//            bean.setName(wxCpUser.getName());
-//            bean.setEmail(wxCpUser.getEmail());
-//            bean.setMainDepartment(wxCpUser.getMainDepartment());
-//            Long[] departmentIds = wxCpUser.getDepartIds();
-//            Arrays.sort(departmentIds);
-//            String departIdS = StringUtils.join(departmentIds, ",");
-//            bean.setDepartmentIds(departIdS);
-//            bean.setMobile(wxCpUser.getMobile());
-//            bean.setQrCode(wxCpUser.getQrCode());
-//            bean.setPosition(wxCpUser.getPosition());
-//            bean.setCorpId(adminCompanyWechat.getCorpId());
-//            bean.setCreateTime(new Date());
-            list.add(bean);
-        }
-        //新增新的成员
-        if (list.size() > 0) {
-            enterpriseWechatWorkerService.updateBatchById(list);
-        }
-
-    }
-
-
-    public void pullDepartmentList(AdminCompanyWechat adminCompanyWechat) {
-        try {
-            int count = adminWebsitService.lambdaQuery().eq(AdminWebsit::getCorpId,adminCompanyWechat.getCorpId()).count();
-            if(count > 0){
-                return;
-            }
-
-            List<WxCpDepart> wxCpDeparts = workWechatLogic.miniApp(adminCompanyWechat).getDepartmentService().list(null);
-            if (wxCpDeparts != null && wxCpDeparts.size() > 0) {
-                List<AdminWebsit> currDeparts = adminWebsitService.lambdaQuery().select(AdminWebsit::getWebsitId).list();
-                List<String> currDepartIds = currDeparts.stream().map(AdminWebsit::getWebsitId).collect(Collectors.toList());
-
-                List<AdminWebsit> adminWebsits = new ArrayList<>();
-                for (WxCpDepart wxCpDepart : wxCpDeparts) {
-                    if (currDepartIds.contains(wxCpDepart.getId())) {
-                        continue;
-                    }
-                    AdminWebsit adminWebsit = new AdminWebsit();
-                    BeanUtils.copyProperties(wxCpDepart, adminWebsit);
-                    adminWebsit.setWebsitId(String.valueOf(wxCpDepart.getId()));
-                    adminWebsit.setSortNum(wxCpDepart.getOrder());
-                    adminWebsit.setCorpId(adminCompanyWechat.getCorpId());
-                    adminWebsits.add(adminWebsit);
-
-                }
-                adminWebsitService.saveBatch(adminWebsits);
-            }
-        } catch (WxErrorException e) {
-            log.error("获取部门结构错误", e);
-        }
-    }
-}

+ 0 - 217
src/main/java/com/gree/mall/manager/logic/tag/TagGroupLogic.java

@@ -1,217 +0,0 @@
-package com.gree.mall.manager.logic.tag;
-
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.bean.tag.CustomTagGroup;
-import com.gree.mall.manager.bean.tag.TagGroupBean;
-import com.gree.mall.manager.commonmapper.CustomTagGroupMapper;
-import com.gree.mall.manager.constant.Constant;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.plus.entity.Tag;
-import com.gree.mall.manager.plus.entity.TagGroup;
-import com.gree.mall.manager.plus.service.TagGroupService;
-import com.gree.mall.manager.plus.service.TagService;
-import com.gree.mall.manager.utils.CommonUtils;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.bean.WxCpBaseResp;
-import me.chanjar.weixin.cp.bean.external.WxCpUserExternalTagGroupInfo;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Slf4j
-@Service
-public class TagGroupLogic {
-
-    @Autowired
-    private TagService tagService;
-    @Autowired
-    private TagGroupService tagGroupService;
-    @Autowired
-    private CustomTagGroupMapper tagGroupMapper;
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
-    @Autowired
-    CommonLogic commonLogic;
-
-
-    public List<CustomTagGroup> list(HttpServletRequest request) {
-        String userId = CommonUtils.getUserId(request);
-        List<String> companyWechatIds = new ArrayList<>();
-        if(StringUtils.isEmpty(userId)){
-            companyWechatIds.add(Constant.GD_COMPANY_WECHAT_ID);
-        }else {
-            AdminUserCom adminUser = commonLogic.getAdminUser(request);
-            if(CollectionUtils.isNotEmpty(adminUser.getAdminCompanyIds())) {
-                companyWechatIds.addAll(adminUser.getAdminCompanyIds());
-            }
-        }
-        return tagGroupMapper.queryTagList(companyWechatIds);
-    }
-
-    public List<Tag> listTag(String tagGroupId) {
-        return tagService.lambdaQuery()
-                .eq(Tag::getGroupId, tagGroupId)
-                .list();
-    }
-
-
-    public TagGroup add(String groupName, HttpServletRequest request) throws RemoteServiceException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-
-        WxCpUserExternalTagGroupInfo wxTagInfo = new WxCpUserExternalTagGroupInfo();
-        WxCpUserExternalTagGroupInfo.TagGroup wxTagGroup = new WxCpUserExternalTagGroupInfo.TagGroup();
-        wxTagGroup.setGroupName(groupName);
-        wxTagGroup.setTag(defaultTag());
-        wxTagInfo.setTagGroup(wxTagGroup);
-        TagGroup tagGroup = new TagGroup();
-        try {
-            WxCpUserExternalTagGroupInfo wxCpUserExternalTagGroupInfo = workWechatLogic.miniTagApp(adminUser.getAdminCompanyWechat()).getExternalContactService().addCorpTag(wxTagInfo);
-            if (wxCpUserExternalTagGroupInfo.success()) {
-                tagGroup.setTagGroupId(wxCpUserExternalTagGroupInfo.getTagGroup().getGroupId());
-                tagGroup.setTagGroupName(groupName);
-                tagGroup.setSortNum(wxCpUserExternalTagGroupInfo.getTagGroup().getOrder());
-                tagGroup.setDeleted(wxCpUserExternalTagGroupInfo.getTagGroup().getDeleted());
-                tagGroup.setCreateTime(new Date());
-                tagGroup.setCompanyWechatId(adminUser.getLoginCompanyWechatId());
-                tagGroup.setCompanyName(adminUser.getLoginCompanyName());
-                tagGroupService.save(tagGroup);
-            }
-        } catch (WxErrorException e) {
-            e.printStackTrace();
-            throw new RemoteServiceException("添加失败");
-        }
-
-        return tagGroup;
-    }
-
-    public Tag addTag(String tagGroupId, String tagName, HttpServletRequest request) throws RemoteServiceException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        WxCpUserExternalTagGroupInfo wxTagInfo = new WxCpUserExternalTagGroupInfo();
-        WxCpUserExternalTagGroupInfo.TagGroup wxTagGroup = new WxCpUserExternalTagGroupInfo.TagGroup();
-        List<WxCpUserExternalTagGroupInfo.Tag> tagList = new ArrayList<>();
-        WxCpUserExternalTagGroupInfo.Tag tag = new WxCpUserExternalTagGroupInfo.Tag();
-        wxTagGroup.setGroupId(tagGroupId);
-        tag.setName(tagName);
-        tagList.add(tag);
-        wxTagGroup.setTag(tagList);
-        wxTagInfo.setTagGroup(wxTagGroup);
-        Tag tagResp = new Tag();
-        try {
-            WxCpUserExternalTagGroupInfo wxCpUserExternalTagGroupInfo = workWechatLogic.miniTagApp(adminUser.getAdminCompanyWechat()).getExternalContactService().addCorpTag(wxTagInfo);
-            if (wxCpUserExternalTagGroupInfo.success()) {
-                List<WxCpUserExternalTagGroupInfo.Tag> respTags = wxCpUserExternalTagGroupInfo.getTagGroup().getTag();
-                for (WxCpUserExternalTagGroupInfo.Tag wxTag : respTags) {
-                    TagGroup tagGroup = tagGroupService.getById(tagGroupId);
-                    tagResp.setTagId(wxTag.getId());
-                    tagResp.setGroupId(tagGroupId);
-                    tagResp.setGroupName(tagGroup.getTagGroupName());
-                    tagResp.setName(tagName);
-                    tagResp.setCreateTime(new Date());
-                    tagResp.setSortNum(wxTag.getOrder());
-                    tagResp.setDeleted(false);
-                    tagResp.setCompanyWechatId(adminUser.getLoginCompanyWechatId());
-                    tagResp.setCompanyName(adminUser.getLoginCompanyName());
-                    tagService.save(tagResp);
-                }
-            }
-        } catch (WxErrorException e) {
-            e.printStackTrace();
-            throw new RemoteServiceException("添加失败");
-        }
-        return tagResp;
-
-    }
-
-    /**
-     * 删除所有标签组和用户关系
-     *
-     * @param tagGroupId
-     */
-    @Transactional
-    public void del(String tagGroupId,HttpServletRequest request) throws RemoteServiceException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        List<Tag> tagList = tagService.lambdaQuery()
-                .eq(Tag::getGroupId, tagGroupId)
-                .list();
-        List<String> tagIds = new ArrayList<>();
-        if (tagList != null) {
-            tagIds = tagList.stream().map(Tag::getTagId).collect(Collectors.toList());
-        }
-        try {
-            WxCpBaseResp wxCpBaseResp = workWechatLogic.miniTagApp(adminUser.getAdminCompanyWechat()).getExternalContactService().delCorpTag(tagIds.toArray(new String[0]), new String[]{tagGroupId});
-            if (wxCpBaseResp.success()) {
-                tagService.lambdaUpdate()
-                        .eq(Tag::getGroupId, tagGroupId)
-                        .remove();
-                tagGroupService.removeById(tagGroupId);
-            }
-        } catch (WxErrorException e) {
-            e.printStackTrace();
-            throw new RemoteServiceException("删除失败");
-        }
-
-    }
-
-    @Transactional
-    public void update(TagGroupBean tagGroupBean,HttpServletRequest request) throws RemoteServiceException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        String tagGroupName = null;
-        if (StringUtils.isNotEmpty(tagGroupBean.getTagGroupId()) && StringUtils.isNotEmpty(tagGroupBean.getGroupName())) {
-            try {
-                WxCpBaseResp wxCpBaseGroupResp = workWechatLogic.miniTagApp(adminUser.getAdminCompanyWechat()).getExternalContactService().editCorpTag(tagGroupBean.getTagGroupId(), tagGroupBean.getGroupName(), null);
-                if (wxCpBaseGroupResp.success()) {
-                    TagGroup tagGroup = new TagGroup();
-                    tagGroupName = tagGroupBean.getGroupName();
-                    tagGroup.setTagGroupId(tagGroupBean.getTagGroupId());
-                    tagGroup.setTagGroupName(tagGroupBean.getGroupName());
-                    tagGroupService.updateById(tagGroup);
-                }
-            } catch (WxErrorException e) {
-                log.error("编辑标签组失败", e);
-                throw new RemoteServiceException("编辑标签组失败");
-            }
-        }
-        if (tagGroupBean.getTags() != null && tagGroupBean.getTags().size() > 0) {
-            for (Tag tag : tagGroupBean.getTags()) {
-                if (StringUtils.isEmpty(tag.getTagId()) || StringUtils.isEmpty(tag.getName())) {
-                    continue;
-                }
-                try {
-                    WxCpBaseResp wxCpBaseResp = workWechatLogic.miniTagApp(adminUser.getAdminCompanyWechat()).getExternalContactService().editCorpTag(tag.getTagId(), tag.getName(), null);
-                    if (wxCpBaseResp.success()) {
-                        Tag saveTag = new Tag();
-                        saveTag.setTagId(tag.getTagId());
-                        saveTag.setName(tag.getName());
-                        tagService.updateById(tag);
-                    }
-                } catch (WxErrorException e) {
-                    log.error("编辑标签失败", e);
-                    throw new RemoteServiceException("编辑标签失败");
-                }
-            }
-        }
-
-
-
-    }
-
-    private List<WxCpUserExternalTagGroupInfo.Tag> defaultTag() {
-        List<WxCpUserExternalTagGroupInfo.Tag> tagList = new ArrayList<>();
-        WxCpUserExternalTagGroupInfo.Tag tag = new WxCpUserExternalTagGroupInfo.Tag();
-        tag.setName("默认分组");
-        tagList.add(tag);
-        return tagList;
-    }
-
-}

+ 0 - 116
src/main/java/com/gree/mall/manager/logic/tag/TagLogic.java

@@ -1,116 +0,0 @@
-package com.gree.mall.manager.logic.tag;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.exception.RemoteServiceException;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-
-import com.gree.mall.manager.plus.entity.Tag;
-import com.gree.mall.manager.plus.entity.TagGroup;
-import com.gree.mall.manager.plus.service.TagGroupService;
-import com.gree.mall.manager.plus.service.TagService;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.bean.external.WxCpUserExternalTagGroupList;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-@Service
-public class TagLogic {
-    @Autowired
-    WorkWechatLogic workWechatLogic;
-    @Autowired
-    CommonLogic commonLogic;
-    @Autowired
-    TagService tagService;
-    @Autowired
-    private TagGroupService tagGroupService;
-
-    /**
-     * 标签列表
-     *
-     * @param pageNum
-     * @param pageSize
-     * @return
-     */
-    public IPage<Tag> list(HttpServletRequest request, Integer pageNum, Integer pageSize) {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        List<String> companyWechatIds = adminUser.getAdminCompanyIds();
-
-        return tagService.lambdaQuery()
-                .in(CollectionUtils.isNotEmpty(companyWechatIds), Tag::getCompanyWechatId, companyWechatIds)
-                .orderByDesc(Tag::getGroupId)
-                .page(new Page<>(pageNum, pageSize));
-    }
-
-    /**
-     * 同步企业标签
-     *
-     * @return
-     * @throws WxErrorException
-     */
-    public void sync(HttpServletRequest request) throws WxErrorException {
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        String loginCompanyWechatId = adminUser.getLoginCompanyWechatId();
-        if(StringUtils.isNotEmpty(loginCompanyWechatId)){
-            throw new RemoteServiceException("运营账号暂无权限操作");
-        }
-
-        List<WxCpUserExternalTagGroupList.TagGroup> tags = workWechatLogic.getTag(adminUser.getAdminCompanyWechat());
-        if (tags == null || tags.size() < 1) {
-            return;
-        }
-        tagGroupService.lambdaUpdate()
-                .isNotNull(TagGroup::getTagGroupId)
-                .eq(TagGroup::getCompanyWechatId, loginCompanyWechatId)
-                .remove();
-        tagService.lambdaUpdate()
-                .isNotNull(Tag::getTagId)
-                .eq(Tag::getCompanyWechatId, loginCompanyWechatId)
-                .remove();
-
-        List<TagGroup> saveTagGroup = new ArrayList<>();
-        List<Tag> list = new ArrayList<>();
-        for (WxCpUserExternalTagGroupList.TagGroup tag : tags) {
-            String groupName = tag.getGroupName();
-            String groupId = tag.getGroupId();
-            TagGroup tagGroup = new TagGroup();
-            tagGroup.setTagGroupName(groupName);
-            tagGroup.setTagGroupId(groupId);
-            tagGroup.setDeleted(tag.getDeleted());
-            tagGroup.setSortNum(tag.getOrder());
-            tagGroup.setCompanyWechatId(adminUser.getLoginCompanyWechatId());
-            tagGroup.setCompanyName(adminUser.getLoginCompanyName());
-            tagGroup.setCreateTime(new Date());
-            saveTagGroup.add(tagGroup);
-
-            tag.getTag().forEach(t -> {
-                Tag bean = new Tag();
-                bean.setCreateTime(new Date());
-                bean.setGroupId(groupId);
-                bean.setGroupName(groupName);
-                bean.setTagId(t.getId());
-                bean.setName(t.getName());
-                bean.setDeleted(t.getDeleted());
-                bean.setSortNum(t.getOrder());
-                bean.setCompanyWechatId(adminUser.getLoginCompanyWechatId());
-                bean.setCompanyName(adminUser.getLoginCompanyName());
-                list.add(bean);
-            });
-        }
-
-        tagService.saveBatch(list);
-        tagGroupService.saveBatch(saveTagGroup);
-    }
-
-
-
-}

+ 0 - 86
src/main/java/com/gree/mall/manager/logic/user/UserLogic.java

@@ -14,7 +14,6 @@ import com.gree.mall.manager.bean.member.MemberBean;
 import com.gree.mall.manager.bean.member.MemberSortBean;
 import com.gree.mall.manager.bean.user.UserApplyBean;
 import com.gree.mall.manager.bean.user.UserWxBean;
-import com.gree.mall.manager.bean.user.UserWxCustomerBean;
 import com.gree.mall.manager.commonmapper.CustomGoodsMapper;
 import com.gree.mall.manager.commonmapper.CustomMemberMapper;
 import com.gree.mall.manager.commonmapper.CustomWebsitMapper;
@@ -24,7 +23,6 @@ import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.activity.PromotionGroupLogic;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.logic.common.WechatLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
 import com.gree.mall.manager.logic.coupon.CouponLogic;
 import com.gree.mall.manager.logic.order.OrderShareLogic;
 import com.gree.mall.manager.plus.entity.*;
@@ -33,10 +31,6 @@ import com.gree.mall.manager.utils.CommonUtils;
 import com.gree.mall.manager.utils.RedisUtil;
 import com.gree.mall.manager.utils.excel.ExcelUtils;
 import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.bean.external.contact.ExternalContact;
-import me.chanjar.weixin.cp.bean.external.contact.FollowedUser;
-import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactBatchInfo;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -81,8 +75,6 @@ public class UserLogic {
     private CustomWebsitMapper customWebsitMapper;
 
     @Autowired
-    private WorkWechatLogic workWechatLogic;
-    @Autowired
     CouponLogic couponLogic;
     @Autowired
     OrderShareLogic orderShareLogic;
@@ -489,7 +481,6 @@ public class UserLogic {
         if (user.getType().equals(UserTypeEnum.SERVICE.toString())) {
             EnterpriseWechatWorker worker = enterpriseWechatWorkerService.lambdaQuery()
                     .eq(EnterpriseWechatWorker::getWechatUserId, userWxBean.getWorkUserId())
-                    .eq(EnterpriseWechatWorker::getCorpId,adminCompanyWechat.getCorpId())
                     .one();
             if (worker != null) {
                 userWxBean.setPosition(worker.getPosition());
@@ -550,83 +541,6 @@ public class UserLogic {
         return couponLogic.userCouponList(userId, pageNo, pageSize);
     }
 
-    /**
-     * 我的客户
-     */
-    public List<UserWxCustomerBean> wxCustomerList(HttpServletRequest request, String userId) throws WxErrorException {
-
-        User user = userService.lambdaQuery()
-                .eq(User::getUserId, userId)
-                .one();
-        if (user == null || StringUtils.isEmpty(user.getWorkUserId())) {
-            return null;
-        }
-
-        AdminCompanyWechat adminCompanyWechat = commonLogic.getAdminCompanyWechat(user.getCompanyWechatId());
-        if (adminCompanyWechat == null) {
-            throw new RemoteServiceException("无效企业微信id:" + user.getCompanyWechatId());
-        }
-        List<UserWxCustomerBean> respList = new ArrayList<>();
-
-        List<WxCpExternalContactBatchInfo.ExternalContactInfo> externalContactList = workWechatLogic.
-                getCustomerByExternalUserId(user.getWorkUserId(), null, 100,adminCompanyWechat);
-        for (WxCpExternalContactBatchInfo.ExternalContactInfo data:externalContactList) {
-            UserWxCustomerBean respMsg = new UserWxCustomerBean();
-            respList.add(respMsg);
-
-            //企业微信联系人信息
-            FollowedUser followInfo = data.getFollowInfo();
-            ExternalContact externalContact = data.getExternalContact();
-
-            respMsg.setMobile(Arrays.toString(followInfo.getRemarkMobiles()));
-            respMsg.setNickName(followInfo.getRemark());
-            respMsg.setCreateTime(new Date(followInfo.getCreateTime()*1000));
-            respMsg.setUserTagId(Arrays.toString(followInfo.getTagIds()));
-            respMsg.setUnionId(externalContact.getUnionId());
-        }
-
-        return respList;
-    }
-
-    /**
-     * 用户降级
-     */
-    public void demotion(List<String> workUserIds) {
-        List<User> list = userService.lambdaQuery().in(User::getWorkUserId, workUserIds).list();
-        if (list.size() == 0) {
-            return;
-        }
-        List<String> userIds = list.stream().map(User::getUserId).collect(Collectors.toList());
-        //1.将用户设为普通用户
-        userService.lambdaUpdate()
-                .set(User::getType, UserTypeEnum.GENERAL.toString())
-                .in(User::getWorkUserId, workUserIds).update();
-
-        //2.禁止用户分享优惠券
-        couponLogic.updateUserCouponTransfer(userIds, false);
-    }
-
-
-    /**
-     * 用户升级
-     */
-    public void userLevelUp(List<String> workUserIds) {
-        List<User> list = userService.lambdaQuery().in(User::getWorkUserId, workUserIds).list();
-        if (list.size() == 0) {
-            return;
-        }
-        List<String> userIds = list.stream().map(User::getUserId).collect(Collectors.toList());
-        //1.将用户设为普通用户
-        userService.lambdaUpdate()
-                .set(User::getType, UserTypeEnum.SERVICE.toString())
-                .in(User::getWorkUserId, workUserIds)
-                .update();
-
-        //2.禁止用户分享优惠券
-        couponLogic.updateUserCouponTransfer(userIds, true);
-    }
-
-
     public User getById(String userId) {
         return userService.getById(userId);
     }

+ 8 - 172
src/main/java/com/gree/mall/manager/schedule/CarryJobScheduled.java

@@ -1,57 +1,26 @@
 package com.gree.mall.manager.schedule;
 
-import cn.hutool.core.convert.Convert;
-import cn.hutool.core.date.DateUnit;
-import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.resource.ResourceUtil;
 import cn.hutool.http.HttpRequest;
-import cn.hutool.http.HttpUtil;
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.gree.mall.manager.bean.delay.Job;
-import com.gree.mall.manager.bean.sop.*;
-import com.gree.mall.manager.bean.sop.File;
-import com.gree.mall.manager.commonmapper.SopRulePushMapper;
-import com.gree.mall.manager.config.wx.WxConfiguration;
 import com.gree.mall.manager.constant.Constant;
-import com.gree.mall.manager.constant.DelayConfig;
-import com.gree.mall.manager.constant.JobStatus;
-import com.gree.mall.manager.enums.JobTopic;
-import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
 import com.gree.mall.manager.logic.sop.JobLogic;
 import com.gree.mall.manager.logic.wxCustomer.SingleChatMessageLogic;
-import com.gree.mall.manager.plus.entity.*;
-import com.gree.mall.manager.plus.entity.MarketingMaterials;
-import com.gree.mall.manager.plus.entity.SopPushTask;
-import com.gree.mall.manager.plus.service.*;
-import com.gree.mall.manager.utils.CommonUtils;
-import com.gree.mall.manager.utils.DateUtils;
-import com.gree.mall.manager.utils.WXPushUtils;
+import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
+import com.gree.mall.manager.plus.service.MarketingMaterialsService;
+import com.gree.mall.manager.plus.service.SopPushTaskService;
+import com.gree.mall.manager.plus.service.SopWorkerPushService;
 import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.bean.article.MpnewsArticle;
-import me.chanjar.weixin.cp.bean.article.NewArticle;
-import me.chanjar.weixin.cp.bean.external.contact.FollowedUser;
-import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
-import me.chanjar.weixin.cp.bean.message.WxCpMessage;
-import org.omg.CORBA.OBJ_ADAPTER;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.integration.redis.util.RedisLockRegistry;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
 
-import java.io.*;
-import java.text.ParseException;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 推送redis延迟消息定时任务
@@ -118,128 +87,6 @@ public class CarryJobScheduled {
         return osName.toUpperCase().contains("WIN");
     }
 
-    /**
-     * 启动定时开启搬运JOB信息
-     */
-    //@Scheduled(cron = "*/1 * * * * *")
-    @Scheduled(fixedDelay = 10000)
-    public void carryJobToQueue() {
-        Job processJob = jobLogic.getProcessJob(JobTopic.TOPIC_SOP.getTopic());
-        if (processJob == null || processJob.getId() == null)
-            return;
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_SOP_SYNC + processJob.getId());
-        try {
-            if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
-                throw new RemoteServiceException("系统繁忙,请稍后再试");
-            }
-            Map<String, String> map = (Map) JSONUtil.parseObj(processJob.getMessage());
-            jobLogic.finishJob(processJob.getId());
-            SopPushTask sopPushTask = sopPushTaskService.getById(map.get("id"));
-            MarketingMaterials marketingMaterials = marketingMaterialsService.getById(sopPushTask.getMarketingMaterialsId());
-            WxCpMessage wxCpMessage = new WxCpMessage();
-            wxCpMessage.setToUser(map.get("toUser"));
-            SopWorkerPush sopWorkerPush = new SopWorkerPush();
-            sopWorkerPush.setId(map.get("pushWorkerId"));
-            sopWorkerPush.setWorkerStatus(1);
-            sopWorkerPush.setTaskTime(new Date());
-            sopWorkerPush.setWorkerTime(new Date());
-            sopWorkerPushService.updateById(sopWorkerPush);
-
-            Map<String, Object> mapTO = new HashMap<>();
-            //发送内容
-            if (sopPushTask.getSendType().equals(1)) {
-                wxCpMessage.setMsgType("text");
-                wxCpMessage.setContent(sopPushTask.getSendText());
-                Text text = new Text();
-                text.setContent(sopPushTask.getSendText());
-                mapTO.put("text", text);
-            }
-            if (sopPushTask.getSendType().equals(2)) {
-                wxCpMessage.setMsgType("image");
-                wxCpMessage.setMediaId(marketingMaterials.getMediaId());
-                List<SopPushAdd> sopPushAd = new ArrayList<>();
-                SopPushAdd sopPushAdd = new SopPushAdd();
-                sopPushAdd.setMsgtype("image");
-                Image image = new Image();
-                image.setMedia_id(marketingMaterials.getMediaId());
-                sopPushAdd.setImage(image);
-                sopPushAd.add(sopPushAdd);
-                mapTO.put("attachments", sopPushAd);
-            }
-            if (sopPushTask.getSendType().equals(3)) {
-                wxCpMessage.setMsgType("video");
-                wxCpMessage.setMediaId(marketingMaterials.getMediaId());
-                wxCpMessage.setTitle("视频消息");
-                wxCpMessage.setDescription(sopPushTask.getSendText());
-
-                List<SopPushAdd> sopPushAd = new ArrayList<>();
-                SopPushAdd sopPushAdd = new SopPushAdd();
-                sopPushAdd.setMsgtype("video");
-                Video video = new Video();
-                video.setMedia_id(marketingMaterials.getMediaId());
-                sopPushAdd.setVideo(video);
-                sopPushAd.add(sopPushAdd);
-                mapTO.put("attachments", sopPushAd);
-            }
-
-            if (sopPushTask.getSendType().equals(4)) {
-                wxCpMessage.setMsgType("mpnews");
-                List<MpnewsArticle> articles = new ArrayList<>();
-                MpnewsArticle newArticle = new MpnewsArticle();
-                newArticle.setTitle("网页消息:" + sopPushTask.getSendUrlName());
-                newArticle.setThumbMediaId(marketingMaterials.getMediaId());
-                newArticle.setContent(sopPushTask.getSendText() + ",<a href=\"" + marketingMaterials.getUrl() + "\">点击网页</a>");
-                articles.add(newArticle);
-                wxCpMessage.setMpnewsArticles(articles);
-
-                List<SopPushAdd> sopPushAd = new ArrayList<>();
-                SopPushAdd sopPushAdd = new SopPushAdd();
-                sopPushAdd.setMsgtype("link");
-                Link link = new Link();
-                link.setTitle(sopPushTask.getSendUrlName());
-                link.setUrl(marketingMaterials.getUrl());
-                sopPushAdd.setLink(link);
-                sopPushAd.add(sopPushAdd);
-                mapTO.put("attachments", sopPushAd);
-
-            }
-
-            if (sopPushTask.getSendType().equals(5)) {
-                wxCpMessage.setMsgType("text");
-                wxCpMessage.setContent(sopPushTask.getSendText() + "小程序链接:" + commonLogic.getUrlScheme(null, map.get("companyWechatId")));
-
-                Text text = new Text();
-                text.setContent(sopPushTask.getSendText() + "小程序链接:" + commonLogic.getUrlScheme(null, map.get("companyWechatId")));
-                mapTO.put("text", text);
-
-            }
-
-            if (sopPushTask.getSendType().equals(6)) {
-                wxCpMessage.setMsgType("file");
-                wxCpMessage.setMediaId(marketingMaterials.getMediaId());
-
-                List<SopPushAdd> sopPushAd = new ArrayList<>();
-                SopPushAdd sopPushAdd = new SopPushAdd();
-                sopPushAdd.setMsgtype("file");
-                File file = new File();
-                file.setMedia_id(marketingMaterials.getMediaId());
-                sopPushAdd.setFile(file);
-                sopPushAd.add(sopPushAdd);
-                mapTO.put("attachments", sopPushAd);
-            }
-
-            wxCpMessage.setAgentId(Convert.toInt(map.get("agentId1")));
-            WxCpService wxCpService = WxConfiguration.cpServices.get(map.get("companyWechatId")).get(map.get("agentId1"));
-            String accessToken = wxCpService.getAccessToken();
-            push(map, accessToken, mapTO);
-            WXPushUtils.sendToEnterpriseWechatWorker(wxCpService, wxCpMessage);
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            obtain.unlock();
-        }
-    }
-
     public void push(Map<String, String> map, String accessToken, Map<String, Object> mapTO) {
         List<String> externalUserid = new ArrayList<>();
         externalUserid.add(map.get("externalUserID"));
@@ -253,16 +100,5 @@ public class CarryJobScheduled {
         log.info("=====================" + post);
     }
 
-    @Scheduled(fixedDelay = 1000 * 60 * 5)
-    public synchronized void finance() throws InterruptedException {
-        List<AdminCompanyWechat> list = adminCompanyWechatService.lambdaQuery().eq(AdminCompanyWechat::getTurnOn, 1).list();
-        if (CollectionUtils.isEmpty(list))
-            return;
-        for (AdminCompanyWechat adminCompanyWechat : list) {
-            singleChatMessageLogic.syncChatMessage(null, adminCompanyWechat.getSignSecret(), adminCompanyWechat.getPrivateKey(), adminCompanyWechat.getCorpId());
-        }
-
-    }
-
 
 }

+ 0 - 39
src/main/java/com/gree/mall/manager/schedule/MarketingMaterialsSyncQyWx.java

@@ -1,39 +0,0 @@
-package com.gree.mall.manager.schedule;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gree.mall.manager.logic.marketing.MarketingMaterialsLogic;
-import com.gree.mall.manager.plus.entity.MarketingMaterials;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-
-@ConditionalOnProperty(name = "schedule.enable", havingValue = "true", matchIfMissing = true)
-@Slf4j
-@Component
-public class MarketingMaterialsSyncQyWx {
-
-    @Autowired
-    private MarketingMaterialsLogic marketingMaterialsLogic;
-
-    @PostConstruct
-    public void init(){
-        syncMM();
-    }
-
-    /**
-     * 同步企业微信营销素材
-     */
-    @Scheduled(fixedDelay = 1000 * 60 * 60 * 12)
-    public void syncMM(){
-        IPage<MarketingMaterials> marketingMaterialsIPage = marketingMaterialsLogic.updateMaterialsMediaId(2, 50);
-        if(marketingMaterialsIPage.getPages() > 1){
-            syncMM();
-        }
-
-    }
-
-}

+ 3 - 14
src/main/java/com/gree/mall/manager/schedule/OverOrderSchedule.java

@@ -5,11 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.enums.OrderShareStatusEnum;
 import com.gree.mall.manager.enums.OrderStatusEnum;
 import com.gree.mall.manager.enums.WXShareStatusEnum;
-import com.gree.mall.manager.enums.WorkOrderTypeEnum;
-import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.order.OrderLogic;
 import com.gree.mall.manager.logic.order.OrderShareLogic;
-import com.gree.mall.manager.plus.entity.*;
+import com.gree.mall.manager.plus.entity.OrderInfo;
+import com.gree.mall.manager.plus.entity.OrderRefund;
+import com.gree.mall.manager.plus.entity.OrderShare;
 import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
 import com.gree.mall.manager.plus.service.OrderInfoService;
 import com.gree.mall.manager.plus.service.OrderRefundService;
@@ -17,17 +17,14 @@ import com.gree.mall.manager.plus.service.OrderShareService;
 import com.gree.mall.manager.utils.DateUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
-import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -71,14 +68,6 @@ public class OverOrderSchedule {
                 .set(OrderInfo::getOrderStatus, OrderStatusEnum.OVER.toString())
                 .in(OrderInfo::getOrderId, orderIds).update();
 
-        //2.将订单推送到php
-        for(OrderInfo orderInfo : list) {
-            final AdminCompanyWechat companyWechat = adminCompanyWechatService.getById(orderInfo.getCompanyWechatId());
-            if (Objects.nonNull(companyWechat) && StringUtils.isNotBlank(companyWechat.getJindCustomerNumber())) {
-                orderLogic.orderToPhp(orderInfo, WorkOrderTypeEnum.INSTALL.toString());
-            }
-        }
-
         //3.将结算数据记录订单完成时间
         orderShareService.lambdaUpdate()
                 .set(OrderShare::getOrderStatus,OrderStatusEnum.OVER.toString())

+ 0 - 32
src/main/java/com/gree/mall/manager/utils/WXPushUtils.java

@@ -1,32 +0,0 @@
-package com.gree.mall.manager.utils;
-
-import com.gree.mall.manager.logic.common.WorkWechatLogic;
-import com.gree.mall.manager.plus.entity.AdminCompanyWechat;
-import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.bean.message.WxCpMessage;
-import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author change
- */
-@Slf4j
-public class WXPushUtils {
-
-
-    @Autowired
-    private WorkWechatLogic workWechatLogic;
-    /**
-     * 发消息到企业微信用户 (多个接收者wechatUserId用‘|’分隔,最多支持1000个 指定为"@all",则向该企业应用的全部成员发送)
-     */
-    public static void sendToEnterpriseWechatWorker(WxCpService wxCpService, WxCpMessage wxCpMessage) {
-        try {
-            WxCpMessageSendResult send = wxCpService.getMessageService().send(wxCpMessage);
-            log.info("掉用企业微信接口返回code:[" + send.getErrCode() + "],返回msg:[" + send.getErrMsg() + "]");
-        } catch (WxErrorException e) {
-            log.info("掉用企业微信接口失败:["+ wxCpMessage.getToUser()+"],返回msg:[" + e.getMessage() + "]");
-        }
-    }
-}

+ 0 - 41
src/main/resources/bootstrap-prd.properties

@@ -98,28 +98,6 @@ ali.accessKeySecret=LYe8uf7Lg9WxJ1xejk45qnPFqxXLzN
 #延迟消息线程数量
 thread.size = 1
 
-
-#微信订阅模板
-wechat.notice.fahuo=TNBTiovTxrmx7etJqHagEtn_jrvmI7GbO2PHkelgG6M
-
-#企业微信id
-wechat.cp.corpId=ww45c857d993f173ad
-#企业微信小程序应用
-wechat.cp.appConfigs[0].agentId=1000002
-wechat.cp.appConfigs[0].secret=j7Wt6iWfG2Qyg164TBdrK22Z2rPtUPrB-PO2xCQiM0o
-wechat.cp.appConfigs[0].token=0
-wechat.cp.appConfigs[0].aesKey=0
-#标签(客户标签,企业标签)
-wechat.cp.appConfigs[1].agentId=0
-wechat.cp.appConfigs[1].secret=4EkulXcH6sSSmjJJOsmWaui9DdgKmIPbLRCL2VHIIMs
-wechat.cp.appConfigs[1].token=0
-wechat.cp.appConfigs[1].aesKey=0
-#通讯录同步(成员,客户,组织架构)
-wechat.cp.appConfigs[2].agentId=1
-wechat.cp.appConfigs[2].secret=M6nwXixN_WjeNAvpl4YIHkf1KYHQsfPYk9Mz08hthoM
-wechat.cp.appConfigs[2].token=0
-wechat.cp.appConfigs[2].aesKey=0
-
 wechat.appId=wxaddd13c267e81e70
 wechat.mchId=1602811075
 wechat.mchKey=ZfiretopAdmin20210309GreeAdminSe
@@ -138,24 +116,5 @@ tax.invoice.title.url=${gjmall.url}/interface/invoice/title
 #物流回调
 express.callback=${gjmall.url}/api/common/express/callback
 
-#工单API
-gongdan.url=https://pgxtadm.greeapps.com
-gongdan.client_name=gs-java
-gongdan.key=6aw4gwGqwQRR4-22
-gongdan.password=au9uGG88ewj23544++4444
-gongdan.token.get.url=${gongdan.url}/services/token/getToken
-gongdan.install.create.url=${gongdan.url}/services/order/install/mallCreateInstall
-gongdan.repair.create.url=${gongdan.url}/services/order/repair/mallCreateRepair
-gongdan.install.detail.url=${gongdan.url}/services/order/install/getDetailList
-gongdan.repair.detail.url=${gongdan.url}/services/order/repair/getDetailList
-gongdan.marketing.url=${gongdan.url}/services/marketing_activity/getSelectList
-gongdan.smalltype.url=${gongdan.url}/services/product/product_type/getProductSmallType
-#对接辅材
-fucai.url=https://fc.zfire.top/java_fucai
-fucai.wuliao.url=${fucai.url}/k3/basics/material/info
-
-#前端首页
-front.top.url=
-
 #云闪付
 ums.url=https://api-mop.chinaums.com

+ 0 - 46
src/main/resources/mapper/AdminMapper.xml

@@ -63,38 +63,6 @@
         b.password,b.link_name,b.link_phone,b.email,b.address,b.never_exprise,b.del as del2,b.create_time as create_time2,
         b.type,b.company_wechat_id as company_wechat_id2,b.company_name as company_name2
     </sql>
-    <select id="pageCompanyWechat" resultMap="pageCompanyWechatResultMap">
-        select * from(
-        SELECT DISTINCT
-        a.*,
-        <include refid="adminUserAllCol"/>,
-        a.del as del1,
-        a.company_wechat_id as company_wechat_id1,
-        a.company_name as company_name1,
-        a.create_time as create_time1
-        FROM admin_user_company_rela aucr
-        RIGHT JOIN admin_company_wechat a on a.company_wechat_id=aucr.company_wechat_id
-        LEFT JOIN admin_user b on b.admin_user_id = aucr.admin_user_id
-        <where>
-            <if test="userName != null and userName !=''">b.user_name like concat('%',#{userName},'%')
-            </if>
-                <if test="nickName != null and nickName !=''">
-                    b.nick_name like concat('%',#{nickName},'%')
-                </if>
-                <if test="linkPhone != null and linkPhone !=''">
-                    b.link_phone like concat('%',#{linkPhone},'%')
-                </if>
-                <if test="email != null and email !=''">
-                    b.email like concat('%',#{email},'%')
-                </if>
-                <if test="status != null">
-                    b.status = #{status}
-                </if>
-            </where>
-            ORDER BY b.create_time
-        )a
-        GROUP BY a.company_wechat_id
-    </select>
 
     <select id="list" resultType="com.gree.mall.manager.bean.admin.AdminDeptWebsitVO">
         SELECT
@@ -137,18 +105,4 @@
 
     </select>
 
-    <resultMap id="pageCompanyWechatResultMap" autoMapping="true" type="com.gree.mall.manager.bean.admin.respDto.AdminCompanyWechatRespPageBean">
-
-        <id column="company_wechat_id1" property="companyWechatId"/>
-        <result column="del1" property="del"/>
-        <result column="company_name1" property="companyName"/>
-        <result column="create_time1" property="createTime"/>
-
-        <association property="adminUser"  autoMapping="true" javaType="com.gree.mall.manager.plus.entity.AdminUser">
-            <result column="del2" property="del"/>
-            <result column="company_wechat_id2" property="companyWechatId"/>
-            <result column="company_name2" property="companyName"/>
-            <result column="create_time2" property="createTime"/>
-        </association>
-    </resultMap>
 </mapper>

+ 28 - 0
src/main/resources/mapper/CommonMapper.xml

@@ -0,0 +1,28 @@
+<?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.gree.mall.manager.commonmapper.CommonMapper">
+    <select id="adminCompanyPayConfigPage"
+            resultType="com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO">
+        SELECT
+            ${ex.selected}
+        FROM
+            admin_company_wechat a
+        ${ex.query}
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
+    <select id="adminCompanyPage" resultType="com.gree.mall.manager.bean.admin.AdminCompanyVO">
+        SELECT
+            ${ex.selected}
+        FROM
+            admin_company a
+        ${ex.query}
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+</mapper>