Selaa lähdekoodia

* 小程序变更

chen.cheng 10 kuukautta sitten
vanhempi
commit
0201ad01e7

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/cp/CpsMeetingUsrController.java

@@ -72,8 +72,9 @@ public class CpsMeetingUsrController extends BaseController {
         wxUser.setOpenid(openId);
         wxUser.setSessionKey(sessionKey);
         CpsMeetingUsr weChatUser = cpsMeetingUsrService.getWeChatUser(wxUser);
+        wxUser.setUserId(weChatUser.getId());
         UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(wxUser.getOpenid(), wxUser.getSessionKey());
-        authenticationToken.setDetails(wxUser);
+        authenticationToken.setDetails(weChatUser);
         SecurityContextHolder.getContext().setAuthentication(authenticationToken);
         String token = tokenService.createToken(wxUser);
         // 生成token

+ 20 - 14
ruoyi-admin/src/main/java/com/ruoyi/web/controller/cp/CpsUsrApplyController.java

@@ -1,27 +1,26 @@
 package com.ruoyi.web.controller.cp;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.DateUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.domain.CpsUsrApply;
+import com.ruoyi.system.service.ICpsUsrApplyService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.system.domain.CpsUsrApply;
-import com.ruoyi.system.service.ICpsUsrApplyService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * cps_usr_apply与会申请Controller
@@ -89,6 +88,13 @@ public class CpsUsrApplyController extends BaseController
         return toAjax(cpsUsrApplyService.updateCpsUsrApply(cpsUsrApply));
     }
 
+
+    @Log(title = "cps_usr_apply与会申请", businessType = BusinessType.UPDATE)
+    @PutMapping("/reject")
+    public AjaxResult reject(@RequestBody CpsUsrApply cpsUsrApply) {
+        return toAjax(cpsUsrApplyService.rejectCpsUsrApply(cpsUsrApply));
+    }
+
     /**
      * 删除cps_usr_apply与会申请
      */

+ 10 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/WeChatUser.java

@@ -37,6 +37,8 @@ public class WeChatUser extends LoginUser {
 
     private String code;
 
+    private Long weChatId;
+
     public String getCode() {
         return code;
     }
@@ -110,4 +112,12 @@ public class WeChatUser extends LoginUser {
     public String getPassword() {
         return this.sessionKey;
     }
+
+    public Long getWeChatId() {
+        return weChatId;
+    }
+
+    public void setWeChatId(Long weChatId) {
+        this.weChatId = weChatId;
+    }
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/CpsUsrApply.java

@@ -58,7 +58,7 @@ public class CpsUsrApply extends BaseEntity
     private String reviewState;
 
     /** 审核不通过原因 */
-    @Excel(name = "审核不通过原因")
+    @Excel(name = "备注")
     private String reviewMsg;
 
     /** 微信用户主键 */

+ 10 - 8
ruoyi-system/src/main/java/com/ruoyi/system/service/ICpsUsrApplyService.java

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

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CpsMeetingUsrServiceImpl.java

@@ -190,13 +190,17 @@ public class CpsMeetingUsrServiceImpl implements ICpsMeetingUsrService {
         user.setUsrWechatId(loginUser.getUserId());
         if (SysYesNo.YES.getCode().equals(user.getConferenceFlag())) {
             user.setApplyType(MeetingType.CONFERENCE.getCode());
+            user.setConferenceFlag(SysYesNo.NO.getCode());
             cpsUsrApplyMapper.insertCpsUsrApplyOrUpdate(user);
+            user.setConferenceFlag(SysYesNo.YES.getCode());
             user.setApplyType(MeetingType.MEETING.getCode());
             user.setConferenceRel(user.getId());
             cpsUsrApplyMapper.insertCpsUsrApplyOrUpdate(user);
             return;
         }
         user.setApplyType(MeetingType.MEETING.getCode());
+        user.setConferenceRel(null);
+        user.setReviewMsg("");
         cpsUsrApplyMapper.insertCpsUsrApplyOrUpdate(user);
     }
 

+ 37 - 25
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CpsUsrApplyServiceImpl.java

@@ -1,96 +1,108 @@
 package com.ruoyi.system.service.impl;
 
-import java.util.List;
+import com.ruoyi.common.enums.ReviewStatus;
+import com.ruoyi.common.enums.SysYesNo;
 import com.ruoyi.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.system.mapper.CpsUsrApplyMapper;
 import com.ruoyi.system.domain.CpsUsrApply;
+import com.ruoyi.system.mapper.CpsUsrApplyMapper;
 import com.ruoyi.system.service.ICpsUsrApplyService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
 
 /**
  * cps_usr_apply与会申请Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-09-03
  */
 @Service
-public class CpsUsrApplyServiceImpl implements ICpsUsrApplyService 
-{
+public class CpsUsrApplyServiceImpl implements ICpsUsrApplyService {
     @Autowired
     private CpsUsrApplyMapper cpsUsrApplyMapper;
 
     /**
      * 查询cps_usr_apply与会申请
-     * 
+     *
      * @param id cps_usr_apply与会申请主键
      * @return cps_usr_apply与会申请
      */
     @Override
-    public CpsUsrApply selectCpsUsrApplyById(Long id)
-    {
+    public CpsUsrApply selectCpsUsrApplyById(Long id) {
         return cpsUsrApplyMapper.selectCpsUsrApplyById(id);
     }
 
     /**
      * 查询cps_usr_apply与会申请列表
-     * 
+     *
      * @param cpsUsrApply cps_usr_apply与会申请
      * @return cps_usr_apply与会申请
      */
     @Override
-    public List<CpsUsrApply> selectCpsUsrApplyList(CpsUsrApply cpsUsrApply)
-    {
+    public List<CpsUsrApply> selectCpsUsrApplyList(CpsUsrApply cpsUsrApply) {
         return cpsUsrApplyMapper.selectCpsUsrApplyList(cpsUsrApply);
     }
 
     /**
      * 新增cps_usr_apply与会申请
-     * 
+     *
      * @param cpsUsrApply cps_usr_apply与会申请
      * @return 结果
      */
     @Override
-    public int insertCpsUsrApply(CpsUsrApply cpsUsrApply)
-    {
+    public int insertCpsUsrApply(CpsUsrApply cpsUsrApply) {
         cpsUsrApply.setCreateTime(DateUtils.getNowDate());
         return cpsUsrApplyMapper.insertCpsUsrApply(cpsUsrApply);
     }
 
     /**
      * 修改cps_usr_apply与会申请
-     * 
+     *
      * @param cpsUsrApply cps_usr_apply与会申请
      * @return 结果
      */
     @Override
-    public int updateCpsUsrApply(CpsUsrApply cpsUsrApply)
-    {
+    public int updateCpsUsrApply(CpsUsrApply cpsUsrApply) {
+        cpsUsrApply.setUpdateTime(DateUtils.getNowDate());
+        return cpsUsrApplyMapper.updateCpsUsrApply(cpsUsrApply);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int rejectCpsUsrApply(CpsUsrApply cpsUsrApply) {
         cpsUsrApply.setUpdateTime(DateUtils.getNowDate());
+        CpsUsrApply applyInfo = cpsUsrApplyMapper.selectCpsUsrApplyById(cpsUsrApply.getId());
+        if (SysYesNo.YES.getCode().equals(applyInfo.getConferenceFlag())) {
+            cpsUsrApplyMapper.updateCpsUsrApply(new CpsUsrApply() {{
+                setId(applyInfo.getConferenceRel());
+                setReviewMsg(cpsUsrApply.getReviewMsg());
+                setReviewState(ReviewStatus.NO_PASS.getCode());
+            }});
+        }
         return cpsUsrApplyMapper.updateCpsUsrApply(cpsUsrApply);
     }
 
     /**
      * 批量删除cps_usr_apply与会申请
-     * 
+     *
      * @param ids 需要删除的cps_usr_apply与会申请主键
      * @return 结果
      */
     @Override
-    public int deleteCpsUsrApplyByIds(Long[] ids)
-    {
+    public int deleteCpsUsrApplyByIds(Long[] ids) {
         return cpsUsrApplyMapper.deleteCpsUsrApplyByIds(ids);
     }
 
     /**
      * 删除cps_usr_apply与会申请信息
-     * 
+     *
      * @param id cps_usr_apply与会申请主键
      * @return 结果
      */
     @Override
-    public int deleteCpsUsrApplyById(Long id)
-    {
+    public int deleteCpsUsrApplyById(Long id) {
         return cpsUsrApplyMapper.deleteCpsUsrApplyById(id);
     }
 }

+ 10 - 9
ruoyi-system/src/main/resources/mapper/cp/CpsUsrApplyMapper.xml

@@ -100,16 +100,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <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>
+            conference_rel,
             <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>
+            update_time,
+            create_time
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="usrName != null">#{usrName},</if>
@@ -119,16 +119,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="email != null">#{email},</if>
             <if test="usrType != null">#{usrType},</if>
             <if test="conferenceFlag != null">#{conferenceFlag},</if>
-            <if test="conferenceRel != null">#{conferenceRel},</if>
+            #{conferenceRel},
             <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>
+            now(),
+            now()
         </trim>
         ON DUPLICATE KEY UPDATE
         <trim suffixOverrides=",">
@@ -139,13 +139,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <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="reviewState != null">review_state = VALUES(review_state),</if>
+            <if test="reviewMsg != null">review_msg = VALUES(review_msg),</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>
+            conference_rel = VALUES(conference_rel),
+            update_time = now()
         </trim>
     </insert>
 

+ 8 - 0
ruoyi-ui/src/api/cp/usrApply.js

@@ -34,6 +34,14 @@ export function updateUsrApply(data) {
     data: data
   })
 }
+export function rejectUsrApply(data) {
+  return request({
+    url: '/cp/usrApply/reject',
+    method: 'put',
+    data: data
+  })
+}
+
 
 // 删除cps_usr_apply与会申请
 export function delUsrApply(id) {

+ 8 - 8
ruoyi-ui/src/views/cp/usrApply/index.vue

@@ -153,7 +153,7 @@
           <dict-tag :options="dict.type.review_state" :value="scope.row.reviewState" />
         </template>
       </el-table-column>
-      <el-table-column label="审核不通过原因" align="center" prop="reviewMsg" />
+      <el-table-column label="备注" align="center" prop="reviewMsg" />
       <el-table-column label="与会内容" align="center" prop="contentId" />
       <el-table-column label="创建时间" align="center" prop="updateTime" width="180">
         <template slot-scope="scope">
@@ -260,8 +260,8 @@
             </el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="审核不通过原因" prop="reviewMsg">
-          <el-input v-model="form.reviewMsg" type="textarea" rows="3" placeholder="请输入审核不通过原因" />
+        <el-form-item label="备注" prop="reviewMsg">
+          <el-input v-model="form.reviewMsg" type="textarea" rows="3" placeholder="请输入备注" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -281,8 +281,8 @@
             </el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="审核不通过原因" prop="reviewMsg">
-          <el-input v-model="form.reviewMsg" type="textarea" rows="3" placeholder="请输入审核不通过原因" />
+        <el-form-item label="备注" prop="reviewMsg">
+          <el-input v-model="form.reviewMsg" type="textarea" rows="3" placeholder="请输入备注" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -294,7 +294,7 @@
 </template>
 
 <script>
-import { addUsrApply, delUsrApply, getUsrApply, listUsrApply, updateUsrApply } from '@/api/cp/usrApply';
+import { addUsrApply, delUsrApply, getUsrApply, listUsrApply, rejectUsrApply, updateUsrApply } from '@/api/cp/usrApply';
 
 export default {
   name: 'UsrApply',
@@ -358,7 +358,7 @@ export default {
     rejectSubmitForm() {
       this.$refs.rejectForm.validate(valid => {
         if (valid) {
-          updateUsrApply(this.form).then(response => {
+          rejectUsrApply(this.form).then(response => {
             this.$modal.msgSuccess('审核完成');
             this.openReject = false;
             this.getList();
@@ -375,7 +375,7 @@ export default {
       updateUsrApply({
         id: row.id,
         reviewState: '0',
-        reviewMsg: '通过'
+        reviewMsg: '通过',
       }).then(response => {
         this.$modal.msgSuccess('审核完成');
         this.openReject = false;