Explorar el Código

* 小程序变更

chen.cheng hace 10 meses
padre
commit
16ab0ae214

+ 6 - 0
pom.xml

@@ -32,6 +32,7 @@
         <velocity.version>2.3</velocity.version>
         <jwt.version>0.9.1</jwt.version>
         <forest.version>1.5.9</forest.version>
+        <cffu.version>1.0.0-Alpha19</cffu.version>
     </properties>
 
     <!-- 依赖声明 -->
@@ -188,6 +189,11 @@
                 <artifactId>forest-spring-boot-starter</artifactId>
                 <version>${forest.version}</version>
             </dependency>
+            <dependency>
+                <groupId>io.foldright</groupId>
+                <artifactId>cffu</artifactId>
+                <version>${cffu.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 

+ 10 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/cp/CpsMeetingUsrController.java

@@ -7,10 +7,12 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.WeChatUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.MeetingType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.domain.CpsContentInfo;
 import com.ruoyi.system.domain.CpsMeetingUsr;
+import com.ruoyi.system.domain.CpsUsrApply;
 import com.ruoyi.system.rest.WechatService;
 import com.ruoyi.system.service.ICpsMeetingUsrService;
 import com.ruoyi.web.core.config.WeChatCfg;
@@ -32,6 +34,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ExecutionException;
 
 /**
  * cps_usr_wechat微信用户Controller
@@ -119,9 +122,13 @@ public class CpsMeetingUsrController extends BaseController {
     }
 
     @Log(title = "与会人员报名", businessType = BusinessType.INSERT)
-    @PostMapping(value = "/regist")
-    public AjaxResult usrRegist(@RequestBody CpsMeetingUsr cpsMeetingUsr) {
-        cpsMeetingUsrService.usrRegister(cpsMeetingUsr);
+    @PostMapping(value = "/regist/{src}")
+    public AjaxResult usrRegist(@RequestBody CpsUsrApply cpsUsrApply, @PathVariable("src") String src) throws ExecutionException, InterruptedException {
+        if (MeetingType.MEETING.getCode().equals(src)) {
+            cpsMeetingUsrService.usrMeetingRegister(cpsUsrApply);
+            return AjaxResult.success();
+        }
+        cpsMeetingUsrService.usrThemeConferenceRegister(cpsUsrApply);
         return AjaxResult.success();
     }
 

+ 72 - 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/MeetingType.java

@@ -0,0 +1,72 @@
+package com.ruoyi.common.enums;
+
+/**
+ * The enum Meeting type.
+ *
+ * @author chen.cheng
+ */
+public enum MeetingType {
+    /**
+     * Meeting meeting type.
+     *
+     * @author chen.cheng
+     */
+    MEETING("1", "大会报名"),
+    /**
+     * Conference meeting type.
+     *
+     * @author chen.cheng
+     */
+    CONFERENCE("2", "会场报名"),
+    /**
+     * Theme meeting type.
+     *
+     * @author chen.cheng
+     */
+    THEME("3", "主题报名");
+
+    /**
+     * The Code.
+     *
+     * @author chen.cheng
+     */
+    private final String code;
+    /**
+     * The Info.
+     *
+     * @author chen.cheng
+     */
+    private final String info;
+
+    /**
+     * Instantiates a new Meeting type.
+     *
+     * @param code the code
+     * @param info the info
+     * @author chen.cheng
+     */
+    MeetingType(String code, String info) {
+        this.code = code;
+        this.info = info;
+    }
+
+    /**
+     * Gets code.
+     *
+     * @return the code
+     * @author chen.cheng
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * Gets info.
+     *
+     * @return the info
+     * @author chen.cheng
+     */
+    public String getInfo() {
+        return info;
+    }
+}

+ 72 - 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/ReviewStatus.java

@@ -0,0 +1,72 @@
+package com.ruoyi.common.enums;
+
+/**
+ * The enum Review status.
+ *
+ * @author chen.cheng
+ */
+public enum ReviewStatus {
+    /**
+     * Pass review status.
+     *
+     * @author chen.cheng
+     */
+    PASS("0", "审核通过"),
+    /**
+     * No pass review status.
+     *
+     * @author chen.cheng
+     */
+    NO_PASS("1", "审核不通过"),
+    /**
+     * Wait review status.
+     *
+     * @author chen.cheng
+     */
+    WAIT("2", "待审核");
+
+    /**
+     * The Code.
+     *
+     * @author chen.cheng
+     */
+    private final String code;
+    /**
+     * The Info.
+     *
+     * @author chen.cheng
+     */
+    private final String info;
+
+    /**
+     * Instantiates a new Review status.
+     *
+     * @param code the code
+     * @param info the info
+     * @author chen.cheng
+     */
+    ReviewStatus(String code, String info) {
+        this.code = code;
+        this.info = info;
+    }
+
+    /**
+     * Gets code.
+     *
+     * @return the code
+     * @author chen.cheng
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * Gets info.
+     *
+     * @return the info
+     * @author chen.cheng
+     */
+    public String getInfo() {
+        return info;
+    }
+}

+ 259 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/StreamUtils.java

@@ -0,0 +1,259 @@
+package com.ruoyi.common.utils;
+
+import org.apache.commons.collections4.MapUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * stream 流工具类
+ */
+
+public class StreamUtils {
+
+    /**
+     * 将collection过滤
+     *
+     * @param collection 需要转化的集合
+     * @param function 过滤方法
+     * @return 过滤后的list
+     */
+    public static <E> List<E> filter(Collection<E> collection, Predicate<E> function) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return new ArrayList<>();
+        }
+        return collection.stream().filter(function).collect(Collectors.toList());
+    }
+
+    /**
+     * 将collection拼接
+     *
+     * @param collection 需要转化的集合
+     * @param function 拼接方法
+     * @return 拼接后的list
+     */
+    public static <E> String join(Collection<E> collection, Function<E, String> function) {
+        return join(collection, function, StringUtils.SPACE);
+    }
+
+    /**
+     * 将collection拼接
+     *
+     * @param collection 需要转化的集合
+     * @param function 拼接方法
+     * @param delimiter 拼接符
+     * @return 拼接后的list
+     */
+    public static <E> String join(Collection<E> collection, Function<E, String> function, CharSequence delimiter) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return StringUtils.EMPTY;
+        }
+        return collection.stream().map(function).filter(Objects::nonNull).collect(Collectors.joining(delimiter));
+    }
+
+    /**
+     * 将collection排序
+     *
+     * @param collection 需要转化的集合
+     * @param comparing 排序方法
+     * @return 排序后的list
+     */
+    public static <E> List<E> sorted(Collection<E> collection, Comparator<E> comparing) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return new ArrayList<>();
+        }
+        return collection.stream().sorted(comparing).collect(Collectors.toList());
+    }
+
+    /**
+     * 将collection转化为类型不变的map<br>
+     * <B>{@code Collection<V>  ---->  Map<K,V>}</B>
+     *
+     * @param collection 需要转化的集合
+     * @param key V类型转化为K类型的lambda方法
+     * @param <V> collection中的泛型
+     * @param <K> map中的key类型
+     * @return 转化后的map
+     */
+    public static <V, K> Map<K, V> toIdentityMap(Collection<V> collection, Function<V, K> key) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return new HashMap<>();
+        }
+        return collection.stream().collect(Collectors.toMap(key, Function.identity(), (l, r) -> l));
+    }
+
+    /**
+     * 将Collection转化为map(value类型与collection的泛型不同)<br>
+     * <B>{@code Collection<E> -----> Map<K,V>  }</B>
+     *
+     * @param collection 需要转化的集合
+     * @param key E类型转化为K类型的lambda方法
+     * @param value E类型转化为V类型的lambda方法
+     * @param <E> collection中的泛型
+     * @param <K> map中的key类型
+     * @param <V> map中的value类型
+     * @return 转化后的map
+     */
+    public static <E, K, V> Map<K, V> toMap(Collection<E> collection, Function<E, K> key, Function<E, V> value) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return new HashMap<>();
+        }
+        return collection.stream().collect(Collectors.toMap(key, value, (l, r) -> l));
+    }
+
+    /**
+     * 将collection按照规则(比如有相同的班级id)分类成map<br>
+     * <B>{@code Collection<E> -------> Map<K,List<E>> } </B>
+     *
+     * @param collection 需要分类的集合
+     * @param key 分类的规则
+     * @param <E> collection中的泛型
+     * @param <K> map中的key类型
+     * @return 分类后的map
+     */
+    public static <E, K> Map<K, List<E>> groupByKey(Collection<E> collection, Function<E, K> key) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return new HashMap<>();
+        }
+        return collection.stream().collect(Collectors.groupingBy(key, LinkedHashMap::new, Collectors.toList()));
+    }
+
+    /**
+     * 将collection按照两个规则(比如有相同的年级id,班级id)分类成双层map<br>
+     * <B>{@code Collection<E>  --->  Map<T,Map<U,List<E>>> } </B>
+     *
+     * @param collection 需要分类的集合
+     * @param key1 第一个分类的规则
+     * @param key2 第二个分类的规则
+     * @param <E> 集合元素类型
+     * @param <K> 第一个map中的key类型
+     * @param <U> 第二个map中的key类型
+     * @return 分类后的map
+     */
+    public static <E, K, U> Map<K, Map<U, List<E>>> groupBy2Key(Collection<E> collection, Function<E, K> key1,
+        Function<E, U> key2) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return new HashMap<>();
+        }
+        return collection.stream().collect(Collectors.groupingBy(key1, LinkedHashMap::new,
+            Collectors.groupingBy(key2, LinkedHashMap::new, Collectors.toList())));
+    }
+
+    /**
+     * 将collection按照两个规则(比如有相同的年级id,班级id)分类成双层map<br>
+     * <B>{@code Collection<E>  --->  Map<T,Map<U,E>> } </B>
+     *
+     * @param collection 需要分类的集合
+     * @param key1 第一个分类的规则
+     * @param key2 第二个分类的规则
+     * @param <T> 第一个map中的key类型
+     * @param <U> 第二个map中的key类型
+     * @param <E> collection中的泛型
+     * @return 分类后的map
+     */
+    public static <E, T, U> Map<T, Map<U, E>> group2Map(Collection<E> collection, Function<E, T> key1,
+        Function<E, U> key2) {
+        if (CollectionUtils.isEmpty(collection) || key1 == null || key2 == null) {
+            return new HashMap<>();
+        }
+        return collection.stream().collect(
+            Collectors.groupingBy(key1, LinkedHashMap::new, Collectors.toMap(key2, Function.identity(), (l, r) -> l)));
+    }
+
+    /**
+     * 将collection转化为List集合,但是两者的泛型不同<br>
+     * <B>{@code Collection<E>  ------>  List<T> } </B>
+     *
+     * @param collection 需要转化的集合
+     * @param function collection中的泛型转化为list泛型的lambda表达式
+     * @param <E> collection中的泛型
+     * @param <T> List中的泛型
+     * @return 转化后的list
+     */
+    public static <E, T> List<T> toList(Collection<E> collection, Function<E, T> function) {
+        if (CollectionUtils.isEmpty(collection)) {
+            return new ArrayList<>();
+        }
+        return collection.stream().map(function).filter(Objects::nonNull).collect(Collectors.toList());
+    }
+
+    /**
+     * 将collection转化为Set集合,但是两者的泛型不同<br>
+     * <B>{@code Collection<E>  ------>  Set<T> } </B>
+     *
+     * @param collection 需要转化的集合
+     * @param function collection中的泛型转化为set泛型的lambda表达式
+     * @param <E> collection中的泛型
+     * @param <T> Set中的泛型
+     * @return 转化后的Set
+     */
+    public static <E, T> Set<T> toSet(Collection<E> collection, Function<E, T> function) {
+        if (CollectionUtils.isEmpty(collection) || function == null) {
+            return new HashSet<>();
+        }
+        return collection.stream().map(function).filter(Objects::nonNull).collect(Collectors.toSet());
+    }
+
+    /**
+     * 合并两个相同key类型的map
+     *
+     * @param map1 第一个需要合并的 map
+     * @param map2 第二个需要合并的 map
+     * @param merge 合并的lambda,将key value1 value2合并成最终的类型,注意value可能为空的情况
+     * @param <K> map中的key类型
+     * @param <X> 第一个 map的value类型
+     * @param <Y> 第二个 map的value类型
+     * @param <V> 最终map的value类型
+     * @return 合并后的map
+     */
+    public static <K, X, Y, V> Map<K, V> merge(Map<K, X> map1, Map<K, Y> map2, BiFunction<X, Y, V> merge) {
+        if (MapUtils.isEmpty(map1) && MapUtils.isEmpty(map2)) {
+            return new HashMap<>();
+        }
+        else if (MapUtils.isEmpty(map1)) {
+            map1 = new HashMap<>();
+        }
+        else if (MapUtils.isEmpty(map2)) {
+            map2 = new HashMap<>();
+        }
+        Set<K> key = new HashSet<>();
+        key.addAll(map1.keySet());
+        key.addAll(map2.keySet());
+        Map<K, V> map = new HashMap<>();
+        for (K t : key) {
+            X x = map1.get(t);
+            Y y = map2.get(t);
+            V z = merge.apply(x, y);
+            if (z != null) {
+                map.put(t, z);
+            }
+        }
+        return map;
+    }
+    /**
+     * 将 Set 切分成多个子集
+     * @param originalSet 原始 Set
+     * @param chunkSize 每个子集的大小
+     * @return 切分后的子集列表
+     */
+    public static List<List<String>> splitSet(Set<String> originalSet, int chunkSize) {
+        List<String> list = new ArrayList<>(originalSet);
+        return IntStream.range(0, (int) Math.ceil((double) list.size() / chunkSize))
+                .mapToObj(i -> list.subList(i * chunkSize, Math.min((i + 1) * chunkSize, list.size())))
+                .collect(Collectors.toList());
+    }
+}

+ 4 - 1
ruoyi-system/pom.xml

@@ -26,7 +26,10 @@
             <groupId>com.dtflys.forest</groupId>
             <artifactId>forest-spring-boot-starter</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>io.foldright</groupId>
+            <artifactId>cffu</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 10 - 8
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CpsUsrApplyMapper.java

@@ -5,15 +5,15 @@ import com.ruoyi.system.domain.CpsUsrApply;
 
 /**
  * cps_usr_apply与会申请Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2024-09-03
  */
-public interface CpsUsrApplyMapper 
+public interface CpsUsrApplyMapper
 {
     /**
      * 查询cps_usr_apply与会申请
-     * 
+     *
      * @param id cps_usr_apply与会申请主键
      * @return cps_usr_apply与会申请
      */
@@ -21,7 +21,7 @@ public interface CpsUsrApplyMapper
 
     /**
      * 查询cps_usr_apply与会申请列表
-     * 
+     *
      * @param cpsUsrApply cps_usr_apply与会申请
      * @return cps_usr_apply与会申请集合
      */
@@ -29,15 +29,17 @@ public interface CpsUsrApplyMapper
 
     /**
      * 新增cps_usr_apply与会申请
-     * 
+     *
      * @param cpsUsrApply cps_usr_apply与会申请
      * @return 结果
      */
     public int insertCpsUsrApply(CpsUsrApply cpsUsrApply);
 
+    int insertCpsUsrApplyOrUpdate(CpsUsrApply cpsUsrApply);
+
     /**
      * 修改cps_usr_apply与会申请
-     * 
+     *
      * @param cpsUsrApply cps_usr_apply与会申请
      * @return 结果
      */
@@ -45,7 +47,7 @@ public interface CpsUsrApplyMapper
 
     /**
      * 删除cps_usr_apply与会申请
-     * 
+     *
      * @param id cps_usr_apply与会申请主键
      * @return 结果
      */
@@ -53,7 +55,7 @@ public interface CpsUsrApplyMapper
 
     /**
      * 批量删除cps_usr_apply与会申请
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 5 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/ICpsMeetingUsrService.java

@@ -4,8 +4,10 @@ import com.ruoyi.common.core.domain.model.WeChatUser;
 import com.ruoyi.system.domain.CpsContentInfo;
 import com.ruoyi.system.domain.CpsMeetingEnterpriseTripInfo;
 import com.ruoyi.system.domain.CpsMeetingUsr;
+import com.ruoyi.system.domain.CpsUsrApply;
 
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 
 /**
  * cps_usr_wechat微信用户Service接口
@@ -66,7 +68,9 @@ public interface ICpsMeetingUsrService {
 
     CpsMeetingUsr getWeChatUser(WeChatUser user);
 
-    void usrRegister(CpsMeetingUsr user);
+    void usrThemeConferenceRegister(CpsUsrApply user);
+
+    void usrMeetingRegister(CpsUsrApply user) throws ExecutionException, InterruptedException;
 
     List<CpsContentInfo> qryUsrCollectContent(String openId, String keyword);
 

+ 77 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CpsMeetingUsrServiceImpl.java

@@ -1,18 +1,35 @@
 package com.ruoyi.system.service.impl;
 
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.core.domain.model.WeChatUser;
+import com.ruoyi.common.enums.MeetingType;
+import com.ruoyi.common.enums.ReviewStatus;
+import com.ruoyi.common.enums.SysYesNo;
+import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StreamUtils;
 import com.ruoyi.system.domain.CpsContentInfo;
 import com.ruoyi.system.domain.CpsMeetingEnterpriseTripInfo;
 import com.ruoyi.system.domain.CpsMeetingUsr;
+import com.ruoyi.system.domain.CpsUsrApply;
 import com.ruoyi.system.mapper.CpsMeetingEnterpriseTripInfoMapper;
 import com.ruoyi.system.mapper.CpsMeetingUsrMapper;
+import com.ruoyi.system.mapper.CpsUsrApplyMapper;
 import com.ruoyi.system.service.ICpsMeetingUsrService;
+import io.foldright.cffu.CompletableFutureUtils;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ScheduledExecutorService;
 
 /**
  * cps_usr_wechat微信用户Service业务层处理
@@ -28,6 +45,12 @@ public class CpsMeetingUsrServiceImpl implements ICpsMeetingUsrService {
     @Autowired
     private CpsMeetingEnterpriseTripInfoMapper cpsMeetingTripService;
 
+    @Autowired
+    private CpsUsrApplyMapper cpsUsrApplyMapper;
+
+    @Autowired
+    private ScheduledExecutorService executor;
+
     /**
      * 查询cps_usr_wechat微信用户
      *
@@ -119,13 +142,62 @@ public class CpsMeetingUsrServiceImpl implements ICpsMeetingUsrService {
     }
 
     @Override
-    public void usrRegister(CpsMeetingUsr user) {
-        CpsMeetingUsr cpsMeetingUsr = cpsMeetingUsrMapper.qryUsrByTel(user.getTel());
-        if (ObjectUtils.isNotEmpty(cpsMeetingUsr)) {
-            cpsMeetingUsrMapper.updateCpsMeetingUsrByTel(user);
+    public void usrThemeConferenceRegister(CpsUsrApply user) {
+        List<CpsUsrApply> cpsUsrApplies = cpsUsrApplyMapper.selectCpsUsrApplyList(new CpsUsrApply() {{
+            setTel(user.getTel());
+            setApplyType(user.getApplyType());
+            setReviewState(ReviewStatus.PASS.getCode());
+        }});
+        if (CollectionUtils.isNotEmpty(cpsUsrApplies)) {
+            throw new ServiceException("该手机号已经报名,请勿反复报名");
+        }
+        user.setReviewState(ReviewStatus.WAIT.getCode());
+        user.setReviewMsg("");
+        SysUser user1 = SecurityUtils.getLoginUser().getUser();
+        user.setUpdateBy(user1.getUserName());
+        cpsUsrApplyMapper.insertCpsUsrApplyOrUpdate(user);
+    }
+
+    @Override
+    public void usrMeetingRegister(CpsUsrApply user) throws ExecutionException, InterruptedException {
+        CompletableFuture<List<List<CpsUsrApply>>> registersFetures = CompletableFutureUtils.allResultsOf(CompletableFuture.supplyAsync(() -> cpsUsrApplyMapper.selectCpsUsrApplyList(new CpsUsrApply() {{
+            setTel(user.getTel());
+            setApplyType(MeetingType.MEETING.getCode());
+            setReviewState(ReviewStatus.PASS.getCode());
+        }}), executor), CompletableFuture.supplyAsync(() -> cpsUsrApplyMapper.selectCpsUsrApplyList(new CpsUsrApply() {{
+            setTel(user.getTel());
+            setApplyType(MeetingType.CONFERENCE.getCode());
+            setReviewState(ReviewStatus.PASS.getCode());
+        }}), executor));
+
+        List<List<CpsUsrApply>> registers = registersFetures.get();
+        List<CpsUsrApply> allRegisters = new ArrayList<>();
+        for (List<CpsUsrApply> register : registers) {
+            if (CollectionUtils.isNotEmpty(register)) {
+                allRegisters.addAll(register);
+            }
+        }
+        Map<String, List<CpsUsrApply>> stringListMap = StreamUtils.groupByKey(allRegisters, CpsUsrApply::getApplyType);
+        if (CollectionUtils.isNotEmpty(stringListMap.get(MeetingType.MEETING.getCode()))) {
+            throw new ServiceException("该手机号已经报名,请勿反复报名");
+        }
+        if (MeetingType.CONFERENCE.getCode().equals(user.getApplyType()) && CollectionUtils.isNotEmpty(stringListMap.get(MeetingType.CONFERENCE.getCode()))) {
+            throw new ServiceException("该手机号已经参与会场调研,请勿反复报名");
+        }
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        user.setUpdateBy(loginUser.getUsername());
+        user.setReviewState(ReviewStatus.WAIT.getCode());
+        user.setUsrWechatId(loginUser.getUserId());
+        if (SysYesNo.YES.getCode().equals(user.getConferenceFlag())) {
+            user.setApplyType(MeetingType.CONFERENCE.getCode());
+            cpsUsrApplyMapper.insertCpsUsrApplyOrUpdate(user);
+            user.setApplyType(MeetingType.MEETING.getCode());
+            user.setConferenceRel(user.getId());
+            cpsUsrApplyMapper.insertCpsUsrApplyOrUpdate(user);
             return;
         }
-        insertCpsMeetingUsr(user);
+        user.setApplyType(MeetingType.MEETING.getCode());
+        cpsUsrApplyMapper.insertCpsUsrApplyOrUpdate(user);
     }
 
     @Override

+ 59 - 0
ruoyi-system/src/main/resources/mapper/cp/CpsUsrApplyMapper.xml

@@ -90,6 +90,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
     </insert>
 
+    <insert id="insertCpsUsrApplyOrUpdate" parameterType="com.ruoyi.system.domain.CpsUsrApply" useGeneratedKeys="true" keyProperty="id">
+        insert into cps_usr_apply
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="usrName != null">usr_name,</if>
+            <if test="tel != null">tel,</if>
+            <if test="orgUnitName != null">org_unit_name,</if>
+            <if test="uniLevel != null">uni_level,</if>
+            <if test="email != null">email,</if>
+            <if test="usrType != null">usr_type,</if>
+            <if test="conferenceFlag != null">conference_flag,</if>
+            <if test="conferenceRel != null">conference_rel,</if>
+            <if test="applyType != null">apply_type,</if>
+            <if test="reviewState != null">review_state,</if>
+            <if test="reviewMsg != null">review_msg,</if>
+            <if test="usrWechatId != null">usr_wechat_id,</if>
+            <if test="contentId != null">content_id,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="usrName != null">#{usrName},</if>
+            <if test="tel != null">#{tel},</if>
+            <if test="orgUnitName != null">#{orgUnitName},</if>
+            <if test="uniLevel != null">#{uniLevel},</if>
+            <if test="email != null">#{email},</if>
+            <if test="usrType != null">#{usrType},</if>
+            <if test="conferenceFlag != null">#{conferenceFlag},</if>
+            <if test="conferenceRel != null">#{conferenceRel},</if>
+            <if test="applyType != null">#{applyType},</if>
+            <if test="reviewState != null">#{reviewState},</if>
+            <if test="reviewMsg != null">#{reviewMsg},</if>
+            <if test="usrWechatId != null">#{usrWechatId},</if>
+            <if test="contentId != null">#{contentId},</if>
+            <if test="updateTime != null">now(),</if>
+            <if test="createTime != null">now(),</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+        </trim>
+        ON DUPLICATE KEY UPDATE
+        <trim suffixOverrides=",">
+            <if test="usrName != null">usr_name = VALUES(usr_name),</if>
+            <if test="tel != null">tel = VALUES(tel),</if>
+            <if test="orgUnitName != null">org_unit_name = VALUES(org_unit_name),</if>
+            <if test="uniLevel != null">uni_level = VALUES(uni_level),</if>
+            <if test="email != null">email = VALUES(email),</if>
+            <if test="usrType != null">usr_type = VALUES(usr_type),</if>
+            <if test="conferenceFlag != null">conference_flag = VALUES(conference_flag),</if>
+            <if test="conferenceRel != null">conference_rel = VALUES(conference_rel),</if>
+            <if test="applyType != null">apply_type = VALUES(apply_type),</if>
+            <if test="usrWechatId != null">usr_wechat_id = VALUES(usr_wechat_id),</if>
+            <if test="contentId != null">content_id = VALUES(content_id),</if>
+            <if test="updateTime != null">update_time = now(),</if>
+            <if test="createTime != null">create_time = now(),</if>
+            <if test="updateBy != null">update_by = VALUES(update_by),</if>
+        </trim>
+    </insert>
+
     <update id="updateCpsUsrApply" parameterType="com.ruoyi.system.domain.CpsUsrApply">
         update cps_usr_apply
         <trim prefix="SET" suffixOverrides=",">