Browse Source

fix 机构审核

haonan 1 year ago
parent
commit
856cadb11b

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/mapper/TenantApplyRecordMapper.java

@@ -33,4 +33,12 @@ public interface TenantApplyRecordMapper extends BaseMapper<TenantApplyRecord> {
 	Boolean updateStatusById(@Param("id") Long id);
 
 	Boolean updateUnpassStatusById(@Param("id") Long id);
+
+	TenantApplyRecordWrapper.LastRecord queryLast(@Param("id") Long id);
+
+	TenantApplyRecordWrapper.LastRecord selectEntry(@Param("id") Long id);
+
+	TenantApplyRecordWrapper.TenantApplyRecord selectLastEntry(@Param("id") Long id);
+
+	TenantApplyRecordWrapper.LastRecord selectSecondEntry(@Param("id") Long id);
 }

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/mapper/TenantEntryRecordMapper.java

@@ -23,5 +23,6 @@ public interface TenantEntryRecordMapper extends BaseMapper<TenantEntryRecord> {
 	 * @return List<TenantEntryRecordWrapper.TenantEntryRecord>
 	 */
 	List<TenantEntryRecord> selectPage(@Param("page") IPage<TenantEntryRecord> page, @Param("param") TenantEntryRecordWrapper.TenantEntryRecordQuery param);
-	
+
+    String selectName(@Param("verifyUserId") Long verifyUserId);
 }

+ 67 - 33
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantApplyRecordServiceImpl.java

@@ -8,6 +8,7 @@ import com.yonge.cooleshow.biz.dal.entity.*;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
+import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
 import com.yonge.cooleshow.biz.dal.mapper.TenantEntryRecordMapper;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
@@ -57,6 +58,9 @@ public class TenantApplyRecordServiceImpl extends ServiceImpl<TenantApplyRecordM
     @Autowired
     private SysConfigService sysConfigService;
 
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
     /**
      * 查询详情
      * @param id 详情ID
@@ -177,35 +181,58 @@ public class TenantApplyRecordServiceImpl extends ServiceImpl<TenantApplyRecordM
             next.setCityName(codeNameMap.getOrDefault(next.getCityCode(), ""));
             next.setRegionName(codeNameMap.getOrDefault(next.getRegionCode(), ""));
         }
-
+        tenantInfos.stream().forEach(item->{
+            String name = tenantEntryRecordMapper.selectName(item.getVerifyUserId());
+            item.setVerifyUserName(name);
+        });
         return page.setRecords(tenantInfos);
     }
 
     @Override
     public TenantApplyRecordWrapper.TenantApplyRecord queryNow(TenantApplyRecordWrapper.TenantApplyRecordQuery query) {
+        Long id = query.getId();
         //查询本次提交记录
         TenantApplyRecordWrapper.TenantApplyRecord info = baseMapper.queryNow(query);
-        Set<Integer> codes = new HashSet<>();
-        codes.add(info.getCityCode());
-        codes.add(info.getProvinceCode());
-        codes.add(info.getRegionCode());
 
-        //将地区码转化为对应的地名
-        List<Integer> areaCodeList = new ArrayList<>();
-        areaCodeList.addAll(codes);
+        //查询当前申请数据的状态
+        AuthStatusEnum status = info.getStatus();
 
-        Map<Integer, String> codeNameMap = new HashMap<>();
+        if (status.equals(AuthStatusEnum.DOING)){
+            //如果是审核中 申请表取一条数据  审核表取一条数据
+            Set<Integer> codes = new HashSet<>();
+            codes.add(info.getCityCode());
+            codes.add(info.getProvinceCode());
+            codes.add(info.getRegionCode());
 
-        if (!CollectionUtils.isEmpty(areaCodeList)) {
-            List<SysArea> sysAreaList = sysAreaService.queryByCodes(areaCodeList);
-            codeNameMap = sysAreaList.stream().collect(Collectors.toMap(SysArea::getCode,
-                    SysArea::getName));
+            //将地区码转化为对应的地名
+            List<Integer> areaCodeList = new ArrayList<>();
+            areaCodeList.addAll(codes);
+
+            Map<Integer, String> codeNameMap = new HashMap<>();
+
+            if (!CollectionUtils.isEmpty(areaCodeList)) {
+                List<SysArea> sysAreaList = sysAreaService.queryByCodes(areaCodeList);
+                codeNameMap = sysAreaList.stream().collect(Collectors.toMap(SysArea::getCode,
+                        SysArea::getName));
+            }
+            info.setProvinceName(codeNameMap.get(info.getProvinceCode()));
+            info.setCityName(codeNameMap.get(info.getCityCode()));
+            info.setRegionName(codeNameMap.get(info.getRegionCode()));
+
+
+            //审核表取一条最新数据
+            TenantApplyRecordWrapper.LastRecord lastRecordEntry = baseMapper.selectEntry(id);
+            info.setLastApplyRecord(lastRecordEntry);
+            return info;
+        } else {
+            //如果是通过或者失败  审核表取前两条数据
+            TenantApplyRecordWrapper.TenantApplyRecord tenantApplyRecord = baseMapper.selectLastEntry(id);
+            TenantApplyRecordWrapper.LastRecord lastRecord = baseMapper.selectSecondEntry(id);
+            tenantApplyRecord.setLastApplyRecord(lastRecord);
+            return tenantApplyRecord;
         }
 
-        info.setProvinceName(codeNameMap.get(info.getProvinceCode()));
-        info.setCityName(codeNameMap.get(info.getCityCode()));
-        info.setRegionName(codeNameMap.get(info.getRegionCode()));
-        return info;
+
     }
 
 
@@ -214,20 +241,20 @@ public class TenantApplyRecordServiceImpl extends ServiceImpl<TenantApplyRecordM
         Boolean ifPass = entry.getIfPass();
         Long id = entry.getId();
         TenantApplyRecord applyRecord = tenantApplyRecordMapper.selectById(id);
-        TenantEntryRecord entryRecord = new TenantEntryRecord();
-
-        entryRecord.setTenantApplyRecordId(applyRecord.getId());
-        entryRecord.setName(applyRecord.getName());
-        entryRecord.setLogo(applyRecord.getLogo());
-        entryRecord.setProvinceCode(applyRecord.getProvinceCode());
-        entryRecord.setCityCode(applyRecord.getCityCode());
-        entryRecord.setRegionCode(applyRecord.getRegionCode());
-        entryRecord.setUsername(applyRecord.getUsername());
-        entryRecord.setPhone(applyRecord.getPhone());
-        entryRecord.setVerifyUserId(verifyUserId);
-        entryRecord.setReason(entry.getReason());
+        TenantApplyRecordWrapper.TenantApplyRecord tenantApplyRecord= new TenantApplyRecordWrapper.TenantApplyRecord();
+
+        tenantApplyRecord.setTenantApplyRecordId(applyRecord.getId());
+        tenantApplyRecord.setName(applyRecord.getName());
+        tenantApplyRecord.setLogo(applyRecord.getLogo());
+        tenantApplyRecord.setProvinceCode(applyRecord.getProvinceCode());
+        tenantApplyRecord.setCityCode(applyRecord.getCityCode());
+        tenantApplyRecord.setRegionCode(applyRecord.getRegionCode());
+        tenantApplyRecord.setUsername(applyRecord.getUsername());
+        tenantApplyRecord.setPhone(applyRecord.getPhone());
+        tenantApplyRecord.setVerifyUserId(verifyUserId);
+        tenantApplyRecord.setReason(entry.getReason());
         if (ifPass == true){
-            entryRecord.setStatus("PASS");
+            tenantApplyRecord.setStatus(AuthStatusEnum.PASS);
             //更改当前记录的审核状态
             tenantApplyRecordMapper.updateStatusById(id);
 
@@ -243,12 +270,19 @@ public class TenantApplyRecordServiceImpl extends ServiceImpl<TenantApplyRecordM
             tenantInfo.setEnableFlag(true);
             tenantInfoService.add(tenantInfo);
         } else {
-            entryRecord.setStatus("UNPASS");
+            tenantApplyRecord.setStatus(AuthStatusEnum.UNPASS);
             tenantApplyRecordMapper.updateUnpassStatusById(id);
         }
-        tenantEntryRecordMapper.insert(entryRecord);
+
+        String name = tenantEntryRecordMapper.selectName(verifyUserId);
+        tenantApplyRecord.setVerifyUserName(name);
+
+        TenantEntryRecord tenantEntryRecord = JSON.parseObject(JSON.toJSONString(tenantApplyRecord), TenantEntryRecord.class);
+         tenantEntryRecordMapper.insert(tenantEntryRecord);
+
+
         CompletableFuture.runAsync(() -> {
-            sendMessage(entry, ifPass, entryRecord);
+            sendMessage(entry, ifPass, tenantEntryRecord);
         });
         return true;
     }

+ 103 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantApplyRecordWrapper.java

@@ -3,9 +3,12 @@ package com.yonge.cooleshow.biz.dal.wrapper;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupLog;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
 import java.util.Optional;
 
 import io.swagger.models.auth.In;
@@ -31,7 +34,7 @@ public class TenantApplyRecordWrapper {
     @ApiModel(" TenantApplyRecordQuery-机构入驻申请记录")
     public static class TenantApplyRecordQuery implements QueryInfo {
         @ApiModelProperty("id")
-        private Integer Id;
+        private Long Id;
     
     	@ApiModelProperty("当前页")
         private Integer page;
@@ -73,6 +76,9 @@ public class TenantApplyRecordWrapper {
         @ApiModelProperty("id")
         private Long id;
 
+        @ApiModelProperty("机构申请记录id")
+        private Long tenantApplyRecordId;
+
         @ApiModelProperty("名称")
         private String name;
 
@@ -110,10 +116,28 @@ public class TenantApplyRecordWrapper {
         @ApiModelProperty("审核理由")
         private String reason;
 
+        @ApiModelProperty("更新时间")
+        private Date updateTime;
+
+        @ApiModelProperty("创建时间")
+        private Date createTime;
 
         @ApiModelProperty("简介")
         private String briefIntroduction;
 
+        @ApiModelProperty("上一次的修改记录")
+        private LastRecord lastApplyRecord;
+
+        @ApiModelProperty("认证人Id")
+        private Long verifyUserId;
+
+        @ApiModelProperty("认证人姓名")
+        private String verifyUserName;
+
+        @ApiModelProperty("验证码")
+        @NotNull(message = "验证码不能为空")
+        private String code;
+
         public String jsonString() {
             return JSON.toJSONString(this);
         }
@@ -127,13 +151,80 @@ public class TenantApplyRecordWrapper {
     @Builder
     @NoArgsConstructor
     @AllArgsConstructor
+    @ApiModel(" TenantApply-上一次的修改记录")
+    public static class LastRecord {
+        @ApiModelProperty("id")
+        private Long id;
+
+        @ApiModelProperty("名称")
+        private String name;
+
+        @ApiModelProperty("logo")
+        private String logo;
+
+        @ApiModelProperty("省份编码")
+        private Integer provinceCode;
+
+        @ApiModelProperty("城市编码")
+        private Integer cityCode;
+
+        @ApiModelProperty("地区/街道")
+        private Integer regionCode;
+
+        @ApiModelProperty("联系人")
+        private String username;
+
+        @ApiModelProperty("手机号")
+        @NotNull(message = "手机号不能为空")
+        private String phone;
+
+        @ApiModelProperty("省份名称")
+        private String provinceName;
+
+        @ApiModelProperty("城市名称")
+        private String cityName;
+
+        @ApiModelProperty("地区街道名称")
+        private String regionName;
+
+        @ApiModelProperty("审核状态 DOING、审核中 PASS、通过 UNPASS、不通过")
+        private AuthStatusEnum status;
+
+        @ApiModelProperty("审核理由")
+        private String reason;
+
+        @ApiModelProperty("更新时间")
+        private Date updateTime;
+
+        @ApiModelProperty("创建时间")
+        private Date createTime;
+
+        @ApiModelProperty("简介")
+        private String briefIntroduction;
+
+        @ApiModelProperty("审核人Id")
+        private Long verifyUserId;
+
+        @ApiModelProperty("审核表申请Id")
+        private Long tenantApplyRecordId;
+
+
+    }
+
+
+
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
     @ApiModel(" TenantApply-机构历史审核记录")
     public static class TenantApply {
         @ApiModelProperty("id")
         private Long id;
 
         @ApiModelProperty("机构申请记录id")
-        private Integer tenantApplyRecordId;
+        private Long tenantApplyRecordId;
 
         @ApiModelProperty("名称")
         private String name;
@@ -161,7 +252,7 @@ public class TenantApplyRecordWrapper {
         private AuthStatusEnum status;
 
         @ApiModelProperty("认证人Id")
-        private Integer verifyUserId;
+        private Long verifyUserId;
 
         @ApiModelProperty("审核理由")
         private String reason;
@@ -179,6 +270,15 @@ public class TenantApplyRecordWrapper {
         @NotNull(message = "验证码不能为空")
         private String code;
 
+        @ApiModelProperty("更新时间")
+        private Date updateTime;
+
+        @ApiModelProperty("创建时间")
+        private Date createTime;
+
+        @ApiModelProperty("认证人姓名")
+        private String verifyUserName;
+
         @ApiModelProperty("群简介")
         private String briefIntroduction;
 

+ 119 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantApplyRecordMapper.xml

@@ -73,7 +73,8 @@
         verify_user_id_ AS verifyUserId,
         reason_ AS reason,
         update_time_ AS updateTime,
-        create_time_ AS createTime
+        create_time_ AS createTime,
+        brief_Introduction_ AS briefIntroduction
         FROM
         tenant_entry_record
         WHERE
@@ -98,7 +99,8 @@
         verify_user_id_ AS verifyUserId,
         reason_ AS reason,
         update_time_ AS updateTime,
-        create_time_ AS createTime
+        create_time_ AS createTime,
+        brief_Introduction_ AS briefIntroduction
         from
         tenant_apply_record
         where
@@ -108,5 +110,120 @@
             id_ = #{param.id}
         </if>
     </select>
+    <select id="queryLast"
+            resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper$LastRecord">
+        select
+        id_ AS id,
+        name_ AS name,
+        logo_ as logo,
+        province_code_ AS provinceCode,
+        city_code_ AS cityCode,
+        region_code_ AS regionCode,
+        username_ AS username,
+        phone_ AS phone,
+        status_ AS status,
+        verify_user_id_ AS verifyUserId,
+        reason_ AS reason,
+        update_time_ AS updateTime,
+        create_time_ AS createTime,
+        brief_Introduction_ AS briefIntroduction
+        from
+        tenant_apply_record
+        where
+        1=1
+        <if test="param.id != null">
+            and
+            id_ = #{param.id}
+        </if>
+        ORDER BY update_time_ desc
+        limit 1,1
+    </select>
+    <select id="selectEntry"
+            resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper$LastRecord">
+        select
+        id_ AS id,
+        tenant_apply_record_id_ AS tenantApplyRecordId,
+        name_ AS name,
+        logo_ as logo,
+        province_code_ AS provinceCode,
+        city_code_ AS cityCode,
+        region_code_ AS regionCode,
+        username_ AS username,
+        phone_ AS phone,
+        status_ AS status,
+        verify_user_id_ AS verifyUserId,
+        reason_ AS reason,
+        update_time_ AS updateTime,
+        create_time_ AS createTime,
+        brief_Introduction_ AS briefIntroduction
+        from
+        tenant_entry_record
+        where
+        1=1
+        <if test="id != null">
+            and
+            tenant_apply_record_id_ = #{id}
+        </if>
+        ORDER BY update_time_ desc
+        limit 1
+    </select>
+    <select id="selectLastEntry"
+            resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper$TenantApplyRecord">
+        select
+        id_ AS id,
+        tenant_apply_record_id_ AS tenantApplyRecordId,
+        name_ AS name,
+        logo_ as logo,
+        province_code_ AS provinceCode,
+        city_code_ AS cityCode,
+        region_code_ AS regionCode,
+        username_ AS username,
+        phone_ AS phone,
+        status_ AS status,
+        verify_user_id_ AS verifyUserId,
+        reason_ AS reason,
+        update_time_ AS updateTime,
+        create_time_ AS createTime,
+        brief_Introduction_ AS briefIntroduction
+        from
+        tenant_entry_record
+        where
+        1=1
+        <if test="id != null">
+            and
+            tenant_apply_record_id_ = #{id}
+        </if>
+        ORDER BY update_time_ desc
+        limit 1
+    </select>
+    <select id="selectSecondEntry"
+            resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantApplyRecordWrapper$LastRecord">
+        select
+        id_ AS id,
+        tenant_apply_record_id_ AS tenantApplyRecordId,
+        name_ AS name,
+        logo_ as logo,
+        province_code_ AS provinceCode,
+        city_code_ AS cityCode,
+        region_code_ AS regionCode,
+        username_ AS username,
+        phone_ AS phone,
+        status_ AS status,
+        verify_user_id_ AS verifyUserId,
+        reason_ AS reason,
+        update_time_ AS updateTime,
+        create_time_ AS createTime,
+        brief_Introduction_ AS briefIntroduction
+        from
+        tenant_entry_record
+        where
+        1=1
+        <if test="id != null">
+            and
+            tenant_apply_record_id_ = #{id}
+        </if>
+        ORDER BY update_time_ desc
+        limit 1,1
+    </select>
 
 </mapper>

+ 6 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantEntryRecordMapper.xml

@@ -27,5 +27,10 @@
         	<include refid="baseColumns" />
 		FROM tenant_entry_record t
 	</select>
-    
+    <select id="selectName" resultType="java.lang.String">
+        select username_
+        from sys_user
+        where id_ = #{verifyUserId}
+    </select>
+
 </mapper>