Browse Source

数据字典

FengChaoYu 1 month ago
parent
commit
81fa41268c
21 changed files with 928 additions and 92 deletions
  1. 7 19
      pom.xml
  2. 44 0
      src/main/java/com/gree/mall/manager/bean/common/SysDictCompanyVO.java
  3. 5 0
      src/main/java/com/gree/mall/manager/commonmapper/AdminMapper.java
  4. 76 53
      src/main/java/com/gree/mall/manager/config/MyBatisPlusConfig.java
  5. 3 3
      src/main/java/com/gree/mall/manager/config/aop/OnlyReadAspect.java
  6. 20 0
      src/main/java/com/gree/mall/manager/constant/SysDictConstant.java
  7. 151 0
      src/main/java/com/gree/mall/manager/controller/common/SysDictCompanyController.java
  8. 28 0
      src/main/java/com/gree/mall/manager/enums/StateEnum.java
  9. 222 0
      src/main/java/com/gree/mall/manager/enums/base/BaseEnum.java
  10. 45 0
      src/main/java/com/gree/mall/manager/enums/base/BaseEnumDeserializer.java
  11. 1 1
      src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyWechatOtherLogic.java
  12. 0 1
      src/main/java/com/gree/mall/manager/logic/common/CommonLogic.java
  13. 298 0
      src/main/java/com/gree/mall/manager/logic/common/SysDictCompanyLogic.java
  14. 1 1
      src/main/java/com/gree/mall/manager/logic/goods/GoodsTagLogic.java
  15. 1 1
      src/main/java/com/gree/mall/manager/logic/marketing/DynamicMaterialsLogic.java
  16. 1 1
      src/main/java/com/gree/mall/manager/logic/marketing/MarketingMaterialsGroupLogic.java
  17. 1 7
      src/main/java/com/gree/mall/manager/logic/marketing/MarketingMaterialsLogic.java
  18. 3 3
      src/main/java/com/gree/mall/manager/logic/member/UserCouponLogic.java
  19. 1 1
      src/main/java/com/gree/mall/manager/logic/tag/TagLogic.java
  20. 1 1
      src/main/java/com/gree/mall/manager/utils/HttpUtils.java
  21. 19 0
      src/main/resources/mapper/AdminMapper.xml

+ 7 - 19
pom.xml

@@ -65,33 +65,21 @@
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.8.1</version>
         </dependency>
-        <!-- 分页 -->
-        <!--<dependency>-->
-        <!--<groupId>com.github.pagehelper</groupId>-->
-        <!--<artifactId>pagehelper-spring-boot-starter</artifactId>-->
-        <!--<version>1.2.13</version>-->
-        <!--<exclusions>-->
-        <!--<exclusion>-->
-        <!--<artifactId>mybatis-spring-boot-starter</artifactId>-->
-        <!--<groupId>org.mybatis.spring.boot</groupId>-->
-        <!--</exclusion>-->
-        <!--</exclusions>-->
-        <!--</dependency>-->
-        <!--mybatis-->
         <dependency>
             <groupId>org.mybatis.spring.boot</groupId>
             <artifactId>mybatis-spring-boot-starter</artifactId>
             <version>2.1.0</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>mybatis</artifactId>
+                    <groupId>org.mybatis</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.1.2</version>
-        </dependency>
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-generator</artifactId>
-            <version>3.1.2</version>
+            <version>3.4.2</version>
         </dependency>
         <dependency>
             <groupId>org.apache.velocity</groupId>

+ 44 - 0
src/main/java/com/gree/mall/manager/bean/common/SysDictCompanyVO.java

@@ -0,0 +1,44 @@
+package com.gree.mall.manager.bean.common;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.constant.SysDictConstant;
+import com.gree.mall.manager.enums.StateEnum;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ZfireField(tbName = "a")
+public class SysDictCompanyVO {
+
+    @ApiModelProperty("id")
+    @ZfireField(hide = true)
+    private String sysDictId;
+
+    @ZfireField(type="select",frontCode = SysDictConstant.SYS_DICT_TYPE,colName = "dict_type", hide = true)
+    @ApiModelProperty("字典类型")
+    private String dictTypeName;
+
+    @ZfireField(type="select")
+    @ApiModelProperty("状态")
+    private StateEnum status;
+
+    @ApiModelProperty("字典编号")
+    private String dictCode;
+
+    @ApiModelProperty("字典值")
+    private String dictValue;
+
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+    @ApiModelProperty("排序")
+    private Integer sortNum;
+
+//    @ApiModelProperty("所属商户")
+//    private String  companyName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty("所属商户id")
+    private String  companyWechatId;
+}

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

@@ -5,6 +5,7 @@ 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.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;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
@@ -64,4 +65,8 @@ public interface AdminMapper {
     })
     @Options(statementType = StatementType.CALLABLE)
     void batchUpdateCompanyWechatName(String companyWechatId, String companyWechatName);
+
+    IPage<SysDictCompanyVO> sysDictCompanyList(Page page,
+                                               @Param("ex") ZfireParamBean zfireParam,
+                                               @Param("companyWechatIds") List<String> companyWechatIds);
 }

+ 76 - 53
src/main/java/com/gree/mall/manager/config/MyBatisPlusConfig.java

@@ -1,72 +1,95 @@
 package com.gree.mall.manager.config;
 
-import com.baomidou.mybatisplus.core.injector.ISqlInjector;
-import com.baomidou.mybatisplus.core.parser.ISqlParser;
-import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
-import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser;
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import com.gree.mall.manager.constant.Constant;
+import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
-import java.util.ArrayList;
-import java.util.List;
-
 
 @Configuration
+@Slf4j
 public class MyBatisPlusConfig {
-    private final static Logger logger = LoggerFactory.getLogger(MyBatisPlusConfig.class);
-
-    /**
-     * @description: 配置分页插件
-     *
-     * @author: gradual
-     * @date: 2019/1/15 10:17
-     * @param: []
-     * @return: com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
-     */
-    @Bean
-    public PaginationInterceptor paginationInterceptor() {
-        logger.debug("注册分页插件");
-        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
-
-
-        // 攻击 SQL 阻断解析器、加入解析链,阻止恶意的全表更新删除
-        List<ISqlParser> sqlParserList = new ArrayList<>();
-        sqlParserList.add(new BlockAttackSqlParser());
-        paginationInterceptor.setSqlParserList(sqlParserList);
-
-        return paginationInterceptor;
-    }
 
-
-    /**
-     * @description: SQL执行效率插件
-     *
-     * @author: gradual
-     * @date: 19-1-24 下午4:59
-     * @param: []
-     * @return: com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor
-     */
+//    /**
+//     * @description: 配置分页插件
+//     *
+//     * @author: gradual
+//     * @date: 2019/1/15 10:17
+//     * @param: []
+//     * @return: com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
+//     */
+//    @Bean
+//    public PaginationInterceptor paginationInterceptor() {
+//        logger.debug("注册分页插件");
+//        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
+//
+//
+//        // 攻击 SQL 阻断解析器、加入解析链,阻止恶意的全表更新删除
+//        List<ISqlParser> sqlParserList = new ArrayList<>();
+//        sqlParserList.add(new BlockAttackSqlParser());
+//        paginationInterceptor.setSqlParserList(sqlParserList);
+//
+//        return paginationInterceptor;
+//    }
+//
+//
+//    /**
+//     * @description: SQL执行效率插件
+//     *
+//     * @author: gradual
+//     * @date: 19-1-24 下午4:59
+//     * @param: []
+//     * @return: com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor
+//     */
+////    @Bean
+////    @Profile({"dev","test"})// 设置 dev test 环境开启
+////    public PerformanceInterceptor performanceInterceptor() {
+////        PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
+////        performanceInterceptor.setFormat(true);
+////        performanceInterceptor.setMaxTime(5000);
+////        return performanceInterceptor;
+////    }
+//
+//    /**
+//     * 逻辑删除用,3.1.1之后的版本可不需要配置该bean,但项目这里用的是3.1.0的
+//     *
+//     * @author David Hong
+//     *
+//     * @return com.baomidou.mybatisplus.core.injector.ISqlInjector
+//     */
 //    @Bean
-//    @Profile({"dev","test"})// 设置 dev test 环境开启
-//    public PerformanceInterceptor performanceInterceptor() {
-//        PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
-//        performanceInterceptor.setFormat(true);
-//        performanceInterceptor.setMaxTime(5000);
-//        return performanceInterceptor;
+//    public ISqlInjector sqlInjector() {
+//        return new LogicSqlInjector();
 //    }
 
+    @Bean
+    public PaginationInnerInterceptor paginationInnerInterceptor() {
+        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
+        paginationInnerInterceptor.setMaxLimit(Long.valueOf(Constant.PAGE_SIZE));
+        paginationInnerInterceptor.setDbType(DbType.MYSQL);
+        return paginationInnerInterceptor;
+    }
+
     /**
-     * 逻辑删除用,3.1.1之后的版本可不需要配置该bean,但项目这里用的是3.1.0的
-     *
-     * @author David Hong
-     *
-     * @return com.baomidou.mybatisplus.core.injector.ISqlInjector
+     * 添加分页插件
      */
     @Bean
-    public ISqlInjector sqlInjector() {
-        return new LogicSqlInjector();
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+        interceptor.addInnerInterceptor(paginationInnerInterceptor());
+        // 添加非法SQL拦截器
+//        interceptor.addInnerInterceptor(new IllegalSQLInnerInterceptor());
+        // 阻止全表更新删除
+        interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
+        // 自定义权限拦截器
+//        interceptor.addInnerInterceptor(new DataScopeInnerInterceptor());
+        // 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
+        return interceptor;
     }
 }

+ 3 - 3
src/main/java/com/gree/mall/manager/config/aop/OnlyReadAspect.java

@@ -49,9 +49,9 @@ public class OnlyReadAspect {
             return;
         }
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        if((adminUser.getOnlyRead() || adminUser.getType() == 2)){
-            throw new RemoteServiceException("运营账号暂无权限操作");
-        }
+//        if((adminUser.getOnlyRead() || adminUser.getType() == 2)){
+//            throw new RemoteServiceException("运营账号暂无权限操作");
+//        }
     }
 
 }

+ 20 - 0
src/main/java/com/gree/mall/manager/constant/SysDictConstant.java

@@ -0,0 +1,20 @@
+package com.gree.mall.manager.constant;
+
+public class SysDictConstant {
+
+
+    //字典类型
+    public final static String SYS_DICT_TYPE="SYS_DICT_TYPE";
+    //结算主体品牌
+    public final static String BRAND="BRAND";
+    //工单渠道
+    public final static String ORDER_CHANNEL = "ORDER_CHANNEL";
+    public final static String SALES_TYPE = "SALES_TYPE";
+
+    //工单来源
+    public final static String ORDER_SOURCE = "WORKER_ORDER_SOURCE";
+
+
+    // 维修日结
+    public final static String REPAIR_DAILY = "REPAIR_DAILY";
+}

+ 151 - 0
src/main/java/com/gree/mall/manager/controller/common/SysDictCompanyController.java

@@ -0,0 +1,151 @@
+package com.gree.mall.manager.controller.common;
+
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gree.mall.manager.annotation.ApiNotAuth;
+import com.gree.mall.manager.annotation.ZfireList;
+import com.gree.mall.manager.bean.common.SysDictCompanyVO;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.common.SysDictCompanyLogic;
+import com.gree.mall.manager.plus.entity.SysDictCompany;
+import com.gree.mall.manager.plus.entity.SysDictTypeCompany;
+import com.gree.mall.manager.utils.excel.ExcelUtils;
+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.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+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.Valid;
+import javax.validation.constraints.NotBlank;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.List;
+
+
+@Validated
+@RequiredArgsConstructor
+@RestController
+@Api(value = "字典业务配置", tags ={"字典业务配置"} )
+@RequestMapping("/dictCompany")
+public class SysDictCompanyController {
+
+    private final SysDictCompanyLogic sysDictCompanyLogic;
+
+    @ZfireList
+    @PostMapping("page")
+    @ApiOperation(value ="字典-分页")
+    public ResponseHelper<IPage<SysDictCompanyVO>> sysDictList(@RequestBody ZfireParamBean zfireParamBean) {
+        IPage<SysDictCompanyVO> sysDictIPage = sysDictCompanyLogic.sysDictIPage(zfireParamBean);
+        return ResponseHelper.success(sysDictIPage, new TypeReference<SysDictCompanyVO>() {
+        });
+    }
+
+    @PostMapping("/pageExport")
+    @ApiOperation(value = "字典-分页导出")
+    public void listExport(@RequestBody ZfireParamBean zfireParamBean, HttpServletRequest request, HttpServletResponse response) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<SysDictCompanyVO> sysDictIPage = sysDictCompanyLogic.sysDictIPage(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(sysDictIPage.getRecords(), zfireParam.getExportFields(), request, response);
+    }
+
+
+    @ApiNotAuth
+    @PostMapping("listDict")
+    @ApiOperation(value = "下拉框查询")
+    public ResponseHelper<List<SysDictCompany>> sysDictBeanList(
+            @ApiParam(value = "类型", required = true) @RequestParam(required = true) String dictType,
+            @ApiParam(value = "父字典类型", required = false) @RequestParam(required = false) String parentDictType,
+            @ApiParam(value ="父code", required = false) @RequestParam(required = false) String parentDictCode,
+            @ApiParam(value = "家用/商用", required = false) @RequestParam(required = false) String flag,
+            @ApiParam(value = "服务单来源", required = false) @RequestParam(required = false) String source
+    ) {
+
+        List<SysDictCompany> sysDicts = sysDictCompanyLogic.getSysDictList(dictType);
+        return ResponseHelper.success(sysDicts);
+    }
+    @ApiNotAuth
+    @PostMapping("type/list")
+    @ApiOperation(value = "字典类型")
+    public ResponseHelper<List<SysDictTypeCompany>> typeListAll() {
+        return ResponseHelper.success(sysDictCompanyLogic.typeList(null));
+    }
+
+
+    @PostMapping("delType")
+    @ApiOperation(value = "字典类型-删除")
+    public ResponseHelper delType(
+            @ApiParam(value  = "字典值id")
+            @NotBlank(message = "字典值id不能为空")
+            @RequestParam String id) {
+        sysDictCompanyLogic.delType(id, true);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("detailType")
+    @ApiOperation(value = "字典类型-详情")
+    public ResponseHelper<SysDictTypeCompany> detailType(
+            @ApiParam(value = "字典值id")
+            @NotBlank(message = "字典值id不能为空")
+            @RequestParam String id) {
+        SysDictTypeCompany sysDict = sysDictCompanyLogic.detailType(id);
+        return ResponseHelper.success(sysDict);
+    }
+
+    @PostMapping("add")
+     @ApiOperation(value = "字典-添加")
+    public ResponseHelper add(@Valid @RequestBody SysDictCompany param) {
+        sysDictCompanyLogic.saveOpenDict(param);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("update")
+     @ApiOperation(value = "字典-修改")
+    public ResponseHelper update(@Valid @RequestBody SysDictCompany param) {
+        sysDictCompanyLogic.updateOpenDict(param);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("del")
+     @ApiOperation(value = "字典-删除")
+    public ResponseHelper del(
+            @ApiParam(value  = "字典值id")
+            @NotBlank(message = "字典值id不能为空")
+            @RequestParam String id) {
+        sysDictCompanyLogic.delete(id, true);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("detail")
+     @ApiOperation(value = "字典-详情")
+    public ResponseHelper<SysDictCompany> detail(
+            @ApiParam(value = "字典值id")
+            @NotBlank(message = "字典值id不能为空")
+            @RequestParam String id) {
+        SysDictCompany sysDict = sysDictCompanyLogic.detail(id);
+        return ResponseHelper.success(sysDict);
+    }
+
+    @PostMapping("/importExcel")
+    @ApiOperation(value = "导入")
+    public ResponseHelper importExcel(
+            @ApiParam(required = true, value = "附件") @RequestPart("file") MultipartFile file,
+            HttpServletRequest request
+    ) throws RemoteServiceException, IOException, ParseException {
+        List<Object> objects = ExcelUtils.importExcel(file);
+        sysDictCompanyLogic.importExcel(objects,request);
+        return ResponseHelper.success();
+    }
+
+}

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

@@ -0,0 +1,28 @@
+package com.gree.mall.manager.enums;
+
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.fasterxml.jackson.annotation.JsonCreator;
+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 StateEnum implements BaseEnum {
+    ON("ON","有效"),
+    OFF("OFF","无效");
+
+    @EnumValue
+    @JsonValue
+    private final String key;
+
+    private final String remark;
+
+    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
+    public static StateEnum create(String key) {
+        return BaseEnum.keyToEnum(StateEnum.class, key);
+    }
+}

+ 222 - 0
src/main/java/com/gree/mall/manager/enums/base/BaseEnum.java

@@ -0,0 +1,222 @@
+package com.gree.mall.manager.enums.base;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.mapstruct.Named;
+import org.mapstruct.TargetType;
+
+import java.util.Arrays;
+import java.util.Optional;
+
+/**
+ * @description: 枚举基类
+ * @author: qinrongjun
+ * @date: 2023/3/10 15:34
+ **/
+@JsonDeserialize(using = BaseEnumDeserializer.class)
+public interface BaseEnum {
+
+    @ApiModelProperty(value = "标识")
+    String getKey();
+
+    @ApiModelProperty(value = "标识中文")
+    String getRemark();
+
+
+    @JsonIgnore
+    default Integer getIntKey() {
+        return Optional.ofNullable(getKey())
+                .filter(NumberUtils::isCreatable)
+                .map(Integer::valueOf)
+                .orElse(null);
+    }
+
+    /**
+     * key转换为枚举,不存在抛出异常
+     *
+     * @param clazz 枚举类型
+     * @param key   枚举的key字段值
+     * @return
+     */
+    @Named("keyToEnumNotNull")
+    static <T extends BaseEnum> T keyToEnumNotNull(@TargetType Class<T> clazz, String key) {
+        return keyToEnumOpt(clazz, key)
+                .orElseThrow(() -> new RemoteServiceException(String.format("枚举值[%s]不存在", key)));
+    }
+
+    /**
+     * int类型key转换为枚举,不存在抛出异常
+     *
+     * @param clazz
+     * @param key
+     * @param <T>
+     * @return
+     */
+    @Named("intKeyToEnumNotNull")
+    static <T extends BaseEnum> T intKeyToEnumNotNull(@TargetType Class<T> clazz, Integer key) {
+        return intKeyToEnumOpt(clazz, key)
+                .orElseThrow(() -> new RemoteServiceException(String.format("枚举值[%s]不存在", key)));
+
+    }
+
+
+    /**
+     * 通用转换对应的枚举实例
+     *
+     * @param clazz 枚举类型
+     * @param key   枚举的key字段值
+     * @return
+     */
+    @Named("keyToEnum")
+    static <T extends BaseEnum> T keyToEnum(@TargetType Class<T> clazz, String key) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return null;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getKey().equals(key))
+                .findAny()
+                .orElse(null);
+
+    }
+
+    @Named("intKeyToEnum")
+    static <T extends BaseEnum> T intKeyToEnum(@TargetType Class<T> clazz, Integer key) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return null;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getIntKey().equals(key))
+                .findAny()
+                .orElse(null);
+
+    }
+
+    @Named("intKeyToEnumOpt")
+    static <T extends BaseEnum> Optional<T> intKeyToEnumOpt(@TargetType Class<T> clazz, Integer key) {
+        return Optional.ofNullable(intKeyToEnum(clazz, key));
+    }
+
+    @Named("intKeyToValue")
+    static String intKeyToValue(@TargetType Class<? extends BaseEnum> clazz, Integer key) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return null;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getIntKey().equals(key))
+                .findAny()
+                .map(BaseEnum::getRemark)
+                .orElse(null);
+
+    }
+
+    @Named("intKeyToValueOpt")
+    static Optional<String> intKeyToValueOpt(@TargetType Class<? extends BaseEnum> clazz, Integer key) {
+        return Optional.ofNullable(intKeyToValue(clazz, key));
+
+    }
+
+    @Named("keyToValue")
+    static String keyToValue(@TargetType Class<? extends BaseEnum> clazz, String key) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return null;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getKey().equals(key))
+                .findAny()
+                .map(BaseEnum::getRemark)
+                .orElse(null);
+
+    }
+
+    @Named("keyToValueOpt")
+    static Optional<String> keyToValueOpt(@TargetType Class<? extends BaseEnum> clazz, String key) {
+        return Optional.ofNullable(keyToValue(clazz, key));
+
+    }
+
+    @Named("keyToEnumOpt")
+    static <T extends BaseEnum> Optional<T> keyToEnumOpt(@TargetType Class<T> clazz, String key) {
+        return Optional.ofNullable(keyToEnum(clazz, key));
+    }
+
+    @Named("enumToKey")
+    static String enumToKey(BaseEnum baseEnum) {
+        if (baseEnum == null) {
+            return null;
+        }
+        return baseEnum.getKey();
+    }
+
+    @Named("enumToValue")
+    static String enumToValue(BaseEnum baseEnum) {
+        if (baseEnum == null) {
+            return null;
+        }
+        return baseEnum.getRemark();
+    }
+
+    @Named("enumToIntKey")
+    static Integer enumToIntKey(BaseEnum baseEnum) {
+        if (baseEnum == null) {
+            return null;
+        }
+        return baseEnum.getIntKey();
+    }
+
+    @Named("valueToEnum")
+    static <T extends BaseEnum> T valueToEnum(@TargetType Class<T> clazz, String value) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return null;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getRemark().equals(value))
+                .findAny()
+                .orElse(null);
+
+    }
+
+    @Named("valueToEnum")
+    static <T extends BaseEnum> T valueToEnumDefault(@TargetType Class<T> clazz, String value, BaseEnum defaultEnum) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return (T) defaultEnum;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getRemark().equals(value))
+                .findAny()
+                .orElse((T) defaultEnum);
+
+    }
+
+    @Named("valueToKey")
+    static String valueToKey(@TargetType Class<? extends BaseEnum> clazz, String value) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return null;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getRemark().equals(value))
+                .findAny()
+                .map(BaseEnum::getKey)
+                .orElse(null);
+
+    }
+
+    @Named("valueToIntKey")
+    static Integer valueToIntKey(@TargetType Class<? extends BaseEnum> clazz, String value) {
+        if (!clazz.isEnum() | !BaseEnum.class.isAssignableFrom(clazz)) {
+            return null;
+        }
+        return Arrays.stream(clazz.getEnumConstants())
+                .filter(item -> item.getRemark().equals(value))
+                .findAny()
+                .map(BaseEnum::getIntKey)
+                .orElse(null);
+
+    }
+
+    static <T extends BaseEnum> Optional<T> valueToEnumOpt(@TargetType Class<T> clazz, String value) {
+        return Optional.ofNullable(valueToEnum(clazz, value));
+    }
+}

+ 45 - 0
src/main/java/com/gree/mall/manager/enums/base/BaseEnumDeserializer.java

@@ -0,0 +1,45 @@
+package com.gree.mall.manager.enums.base;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.BeanProperty;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.deser.ContextualDeserializer;
+
+import java.io.IOException;
+
+/**
+ * @author qinrongjun
+ * @description
+ * @date 2023/8/31 15:08 星期四
+ */
+public class BaseEnumDeserializer extends JsonDeserializer<BaseEnum> implements ContextualDeserializer {
+
+    // 记录枚举字段的类,用于获取其定义的所有枚举值
+    private Class<? extends BaseEnum> propertyClass;
+
+    public BaseEnumDeserializer() {
+    }
+
+    public BaseEnumDeserializer(Class<? extends BaseEnum> propertyClass) {
+        this.propertyClass = propertyClass;
+    }
+
+    @Override
+    public BaseEnum deserialize(JsonParser p, DeserializationContext ctx) throws IOException {
+        String key = p.getValueAsString();
+        return BaseEnum.keyToEnum(propertyClass, key);
+    }
+
+    @Override
+    public JsonDeserializer<?> createContextual(DeserializationContext ctx, BeanProperty property) {
+        if (property == null) {
+            return new BaseEnumDeserializer((Class<? extends BaseEnum>) ctx.getContextualType().getRawClass());
+        }
+        if (property.getType().isCollectionLikeType()) {
+            return new BaseEnumDeserializer((Class<? extends BaseEnum>) property.getType().containedType(0).getRawClass());
+        }
+        return new BaseEnumDeserializer((Class<? extends BaseEnum>) property.getType().getRawClass());
+    }
+
+}

+ 1 - 1
src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyWechatOtherLogic.java

@@ -1,12 +1,12 @@
 package com.gree.mall.manager.logic.admin;
 
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 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.plus.entity.AdminCompanyWechatOther;
 import com.gree.mall.manager.plus.service.AdminCompanyWechatOtherService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

+ 0 - 1
src/main/java/com/gree/mall/manager/logic/common/CommonLogic.java

@@ -93,7 +93,6 @@ public class CommonLogic {
             AdminUser admin = adminUserService.lambdaQuery().eq(AdminUser::getUserName, "admin").one();
             AdminUserCom adminUserCom = new AdminUserCom();
             BeanUtils.copyProperties(admin,adminUserCom);
-            adminUserCom.setLoginCompanyWechatId("1");
             return adminUserCom;
         }
         AdminUser adminUser = adminUserService.getById(userId);

+ 298 - 0
src/main/java/com/gree/mall/manager/logic/common/SysDictCompanyLogic.java

@@ -0,0 +1,298 @@
+package com.gree.mall.manager.logic.common;
+
+import cn.hutool.core.convert.Convert;
+import com.alibaba.excel.util.StringUtils;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.common.SysDictCompanyVO;
+import com.gree.mall.manager.commonmapper.AdminMapper;
+import com.gree.mall.manager.constant.SysDictConstant;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.plus.entity.SysDictCompany;
+import com.gree.mall.manager.plus.entity.SysDictTypeCompany;
+import com.gree.mall.manager.plus.service.SysDictCompanyService;
+import com.gree.mall.manager.plus.service.SysDictTypeCompanyService;
+import com.gree.mall.manager.utils.RedisUtil;
+import com.gree.mall.manager.utils.StringUtil;
+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.BooleanUtils;
+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.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class SysDictCompanyLogic {
+
+    private final CommonLogic commonLogic;
+    private final SysDictCompanyService sysDictCompanyService;
+    private final SysDictTypeCompanyService sysDictTypeCompanyService;
+    private final AdminMapper adminMapper;
+
+    /**
+     * 字典类型
+     *
+     * @param open 是否开放业务人配置 , 为空不限制
+     * @return
+     */
+    public List<SysDictTypeCompany> typeList(Boolean open) {
+        List<SysDictTypeCompany> list = sysDictTypeCompanyService
+                .lambdaQuery()
+                .eq(Objects.nonNull(open), SysDictTypeCompany::getOpen, open)
+                .list();
+        return list;
+    }
+
+
+    /**
+     * 字典列表
+     */
+    public IPage<SysDictCompanyVO> sysDictIPage(ZfireParamBean zfireParamBean) {
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        List<String> companyWechatIds = adminUser.getCompanyWechatIds();
+
+        IPage<SysDictCompanyVO> sysDictIPage = adminMapper.sysDictCompanyList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParam
+                , companyWechatIds);
+        return sysDictIPage;
+    }
+
+
+    /**
+     * 删除字典
+     *
+     * @param id
+     * @param open 是否开放业务, 为空或者false不限制
+     */
+    public void delete(String id, Boolean open) {
+        if (BooleanUtils.isTrue(open)) {
+            String dictType = sysDictCompanyService.lambdaQuery()
+                    .select(SysDictCompany::getDictType)
+                    .eq(SysDictCompany::getSysDictId, id)
+                    .oneOpt()
+                    .map(SysDictCompany::getDictType)
+                    .orElseThrow(() -> new RemoteServiceException("字典值不存在"));
+            sysDictTypeCompanyService.lambdaQuery()
+                    .select(SysDictTypeCompany::getOpen)
+                    .eq(SysDictTypeCompany::getDictType, dictType)
+                    .oneOpt()
+                    .map(SysDictTypeCompany::getOpen)
+                    .filter(item -> item)
+                    .orElseThrow(() -> new RemoteServiceException("该字典类型暂不开放配置"));
+        }
+
+        sysDictCompanyService.removeById(id);
+
+    }
+
+    /**
+     * 字典详情
+     */
+    public SysDictCompany detail(String id) {
+        return sysDictCompanyService.getById(id);
+    }
+
+
+    /**
+     * 字典查询,key = dictCode  value = dictObject
+     * @param type
+     * @return
+     */
+    public Map<String, SysDictCompany> dictByTypeOfCode(String type,String companyWechatId){
+        List<SysDictCompany> sysDicts = this.dictByType(type,true,companyWechatId);
+        Map<String, SysDictCompany> sysDictMap = sysDicts.stream().collect(Collectors.toMap(v -> v.getDictCode(), Function.identity()));
+        return sysDictMap;
+    }
+    public SysDictCompany dictByTypeOfCode(String type,String dictCode,String companyWechatId){
+        List<SysDictCompany> sysDicts = this.dictByType(type,true,companyWechatId);
+        Map<String, SysDictCompany> sysDictMap = sysDicts.stream().collect(Collectors.toMap(v -> v.getDictCode(), Function.identity()));
+        return sysDictMap.get(dictCode);
+    }
+
+    /**
+     * 字典查询,key = dictValue value = dictObject
+     * @param type
+     * @return
+     */
+    public Map<String, SysDictCompany> dictByTypeOfValue(String type,String companyWechatId){
+        List<SysDictCompany> sysDicts = this.dictByType(type,true,companyWechatId);
+        Map<String, SysDictCompany> sysDictMap = sysDicts.stream().collect(Collectors.toMap(v -> v.getDictValue(), Function.identity()));
+        return sysDictMap;
+    }
+    public SysDictCompany dictByTypeOfValue(String type,String dictValue,String companyWechatId){
+        List<SysDictCompany> sysDicts = this.dictByType(type,true,companyWechatId);
+        Map<String, SysDictCompany> sysDictMap = sysDicts.stream().collect(Collectors.toMap(v -> v.getDictValue(), Function.identity()));
+        return sysDictMap.get(dictValue);
+    }
+
+
+    /**
+     * 字典值查询
+     *
+     * @param type
+     * @param open 是否开放业务, 为空查询所有
+     * @return
+     */
+    public List<SysDictCompany> dictByType(String type, Boolean open,String companyWechatId) {
+        SysDictTypeCompany dictType = sysDictTypeCompanyService.lambdaQuery()
+                .eq(SysDictTypeCompany::getDictType, type)
+                .eq(Objects.nonNull(open), SysDictTypeCompany::getOpen, open)
+                .one();
+        if (dictType == null) {
+            return Collections.emptyList();
+        }
+        List<SysDictCompany> dictList = sysDictCompanyService.lambdaQuery()
+                .eq(SysDictCompany::getDictType, type)
+                .eq(SysDictCompany::getCompanyWechatId,companyWechatId)
+                .orderByDesc(SysDictCompany::getSortNum)
+                .list();
+
+        return dictList;
+    }
+
+    public void saveOpenDict(SysDictCompany param) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        sysDictTypeCompanyService.lambdaQuery()
+                .select(SysDictTypeCompany::getDictType)
+                .eq(SysDictTypeCompany::getDictType, param.getDictType())
+                .eq(SysDictTypeCompany::getOpen, true)
+                .oneOpt()
+                .orElseThrow(() -> new RemoteServiceException("暂不开放该字典类型配置"));
+        if (StringUtil.isEmpty(param.getDictCode())) {
+            param.setDictCode(IdWorker.getIdStr());
+        }
+
+        checkRepeatDictCode(param.getDictType(), param.getDictValue(), param.getCompanyWechatId(),param.getDictCode());
+        sysDictCompanyService.save(param);
+    }
+
+    public void updateOpenDict(SysDictCompany param) {
+        String dictType = sysDictCompanyService.lambdaQuery()
+                .select(SysDictCompany::getDictType)
+                .eq(SysDictCompany::getSysDictId, param.getSysDictId())
+                .oneOpt()
+                .map(SysDictCompany::getDictType)
+                .orElseThrow(() -> new RemoteServiceException("字典类型错误,修改失败"));
+        sysDictTypeCompanyService.lambdaQuery()
+                .select(SysDictTypeCompany::getDictType)
+                .eq(SysDictTypeCompany::getDictType, dictType)
+                .eq(SysDictTypeCompany::getOpen, true)
+                .oneOpt()
+                .orElseThrow(() -> new RemoteServiceException("暂不开放该字典类型配置"));
+        
+        SysDictCompany sysDictCompany = sysDictCompanyService.getById(param.getSysDictId());
+
+        Integer count = sysDictCompanyService.lambdaQuery()
+                .eq(SysDictCompany::getDictType, dictType)
+                .eq(SysDictCompany::getDictValue, param.getDictValue())
+                .eq(SysDictCompany::getDictCode, param.getDictCode())
+//                .eq(SysDictCompany::getCompanyWechatId, sysDictCompany.getCompanyWechatId())
+                .ne(SysDictCompany::getSysDictId,param.getSysDictId())
+                .count();
+        if (count > 0) {
+            throw new RemoteServiceException(param.getDictValue() + "重复存在");
+        }
+
+        if (sysDictCompanyService.lambdaQuery()
+                .eq(SysDictCompany::getDictType, dictType)
+                .eq(SysDictCompany::getDictCode, param.getDictCode())
+//                .eq(SysDictCompany::getCompanyWechatId, sysDictCompany.getCompanyWechatId())
+                .ne(SysDictCompany::getSysDictId,param.getSysDictId())
+                .count() > 0) {
+            throw new RemoteServiceException(param.getDictCode() + "重复存在");
+        }
+        sysDictCompanyService.updateById(param);
+    }
+
+    private void checkRepeatDictCode(String dictType, String value, String companyWechatId,String code) {
+        Integer count = sysDictCompanyService.lambdaQuery()
+                .eq(SysDictCompany::getDictType, dictType)
+                .eq(SysDictCompany::getDictValue, value)
+                .eq(!StringUtil.isEmpty(code),SysDictCompany::getDictCode, code)
+//                .eq(SysDictCompany::getCompanyWechatId, companyWechatId)
+                .count();
+        if (count > 0) {
+            throw new RemoteServiceException(value + "重复存在");
+        }
+
+        if (sysDictCompanyService.lambdaQuery()
+                .eq(SysDictCompany::getDictType, dictType)
+                .eq(SysDictCompany::getDictCode, code)
+//                .eq(SysDictCompany::getCompanyWechatId, companyWechatId)
+                .count() > 0) {
+            throw new RemoteServiceException(code + "重复存在");
+        }
+    }
+
+    public void delType(String id, boolean b) {
+        sysDictTypeCompanyService.removeById(id);
+    }
+
+    public SysDictTypeCompany detailType(String id) {
+        return sysDictTypeCompanyService.getById(id);
+    }
+
+    public List<SysDictCompany> getSysDictList(String dictType) {
+        List<SysDictCompany> list = sysDictCompanyService.lambdaQuery().eq(SysDictCompany::getDictType, dictType).list();
+        return list;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void importExcel(List<Object> objects, HttpServletRequest request) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        List<SysDictCompany> sysDictCompanyList = new ArrayList<>();
+
+        List<SysDictTypeCompany> list = sysDictTypeCompanyService.lambdaQuery().list();
+
+        for (Object o : objects) {
+            List<Object> row = (List<Object>) o;
+
+            SysDictCompany sysDictCompany = new SysDictCompany();
+
+            List<SysDictTypeCompany> sysDictTypeCompanies = list.stream()
+                    .filter(item -> item.getRemark().equals(Convert.toStr(row.get(0)))).collect(Collectors.toList());
+
+            if (!CollectionUtils.isEmpty(sysDictTypeCompanies)) {
+                sysDictCompany.setDictType(sysDictTypeCompanies.get(0).getDictType());
+            } else {
+                throw new RemoteServiceException("没有这个类型" + sysDictCompany.getDictType());
+            }
+
+            if (row.get(2).equals("开启"))
+                sysDictCompany.setStatus("ON");
+            else
+                sysDictCompany.setStatus("OFF");
+
+            sysDictCompany.setDictValue(Convert.toStr(row.get(1)));
+            if (row.size() > 4) {
+                sysDictCompany.setRemark(Convert.toStr(row.get(3)));
+                sysDictCompany.setSortNum(Convert.toInt(row.get(4)));
+            }
+
+//            sysDictCompany.setCompanyName(adminUser.getCompanyName());
+//            sysDictCompany.setCompanyWechatId(adminUser.getCompanyWechatId());
+            sysDictCompany.setDictCode(IdWorker.getIdStr());
+
+            checkRepeatDictCode(sysDictCompany.getDictType(), sysDictCompany.getDictValue(), sysDictCompany.getCompanyWechatId(),sysDictCompany.getDictCode());
+
+            sysDictCompanyList.add(sysDictCompany);
+        }
+
+
+        sysDictCompanyService.saveBatch(sysDictCompanyList);
+    }
+}

+ 1 - 1
src/main/java/com/gree/mall/manager/logic/goods/GoodsTagLogic.java

@@ -2,7 +2,6 @@ package com.gree.mall.manager.logic.goods;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.exception.RemoteServiceException;
@@ -10,6 +9,7 @@ import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.GoodsTag;
 import com.gree.mall.manager.plus.service.GoodsTagService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

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

@@ -2,7 +2,6 @@ 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.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
@@ -28,6 +27,7 @@ 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.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

+ 1 - 1
src/main/java/com/gree/mall/manager/logic/marketing/MarketingMaterialsGroupLogic.java

@@ -2,7 +2,6 @@ package com.gree.mall.manager.logic.marketing;
 
 
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
@@ -12,6 +11,7 @@ import com.gree.mall.manager.plus.entity.MarketingMaterialsTag;
 import com.gree.mall.manager.plus.service.MarketingMaterialsGroupService;
 import com.gree.mall.manager.plus.service.MarketingMaterialsService;
 import com.gree.mall.manager.plus.service.MarketingMaterialsTagService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;

+ 1 - 7
src/main/java/com/gree/mall/manager/logic/marketing/MarketingMaterialsLogic.java

@@ -2,19 +2,15 @@ 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.core.toolkit.StringUtils;
 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.config.wx.WxConfiguration;
-import com.gree.mall.manager.constant.Constant;
 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.logic.wxCustomer.WxCustomerLogic;
 import com.gree.mall.manager.plus.entity.*;
 import com.gree.mall.manager.plus.service.AdminCompanyWechatService;
 import com.gree.mall.manager.plus.service.CommonFileService;
@@ -25,9 +21,9 @@ 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.WxCpMediaService;
 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;
@@ -38,10 +34,8 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.rmi.RemoteException;
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**

+ 3 - 3
src/main/java/com/gree/mall/manager/logic/member/UserCouponLogic.java

@@ -38,10 +38,10 @@ public class UserCouponLogic {
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
         List<String> companyWechatIds = adminUser.getCompanyWechatIds();
 
-        LambdaQueryChainWrapper<UserCoupon> wrapper = userCouponService.lambdaQuery()
+        return userCouponService.lambdaQuery()
                 .in(CollectionUtils.isNotEmpty(companyWechatIds), UserCoupon::getCompanyWechatId , companyWechatIds)
                 .like(StringUtils.isNotBlank(couponName), UserCoupon::getCouponName, couponName)
-                .eq(StringUtils.isNotBlank(couponName), UserCoupon::getCouponType, couponType);
-        return userCouponService.page(new Page<>(pageNum, pageSize), wrapper);
+                .eq(StringUtils.isNotBlank(couponName), UserCoupon::getCouponType, couponType)
+                .page(new Page<>(pageNum, pageSize));
     }
 }

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

@@ -2,7 +2,6 @@ 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.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.constant.Constant;
@@ -17,6 +16,7 @@ import com.gree.mall.manager.plus.service.TagService;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.cp.bean.external.WxCpUserExternalTagGroupList;
 import me.chanjar.weixin.cp.bean.message.WxCpMessage;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.integration.redis.util.RedisLockRegistry;
 import org.springframework.stereotype.Service;

+ 1 - 1
src/main/java/com/gree/mall/manager/utils/HttpUtils.java

@@ -1,9 +1,9 @@
 package com.gree.mall.manager.utils;
 
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import okhttp3.*;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;

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

@@ -106,6 +106,25 @@
         </if>
         ${ex.orderBy}
     </select>
+    <select id="sysDictCompanyList" resultType="com.gree.mall.manager.bean.common.SysDictCompanyVO">
+        select
+        a.*,
+        b.remark as 'dictTypeName'
+        from sys_dict_company a
+        left join sys_dict_type_company b on a.dict_type=b.dict_type
+        ${ex.query}
+        and a.del=0
+        <if test="companyWechatIds != null and companyWechatIds.size > 0">
+            AND a.company_wechat_id IN
+            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            order by a.sort_num,a.create_time desc
+        </if>
+        ${ex.orderBy}
+    </select>
 
     <resultMap id="pageCompanyWechatResultMap" autoMapping="true" type="com.gree.mall.manager.bean.admin.respDto.AdminCompanyWechatRespPageBean">