Browse Source

查询最近一次入驻申请,查询学习详情

weifanli 2 years ago
parent
commit
46368e3333

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherAuthEntryRecordDao.java

@@ -33,4 +33,5 @@ public interface TeacherAuthEntryRecordDao extends BaseMapper<TeacherAuthEntryRe
 	 * @return: com.yonge.cooleshow.biz.dal.entity.TeacherAuthEntryRecord
 	 */
 	TeacherAuthEntryRecordVo getLastRecordByUserId(@Param("userId") Long userId);
+
 }

+ 5 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java

@@ -12,6 +12,7 @@ import com.yonge.cooleshow.biz.dal.enums.CacheNameEnum;
 import com.yonge.cooleshow.biz.dal.service.SysConfigService;
 import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.toolset.utils.date.DateUtil;
+import com.yonge.toolset.utils.string.ValueUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,9 +51,11 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
         } catch (Exception e) {
             e.printStackTrace();
         }
+        //身份证号、手机号脱敏
+        studentHomeVo.setIdCardNo(ValueUtil.fuzzyIdCard(studentHomeVo.getIdCardNo()));
+        studentHomeVo.setPhone(ValueUtil.fuzzyMobile(studentHomeVo.getPhone()));
         studentHomeVo.setHeardUrl(user.getAvatar());
-        studentHomeVo.setUsername(user.getUsername());
-        studentHomeVo.setBirthdate(user.getBirthdate());
+
         int num = DateUtil.daysBetween(new Date(), detail.getMembershipEndTime());
         studentHomeVo.setMembershipDays(num < 0 ? 0 : num);
         StudentTotal total = (StudentTotal) redissonClient.getBucket(CacheNameEnum.STUDENT_TOTAL.getRedisKey(user.getId()))

+ 7 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherAuthEntryRecordServiceImpl.java

@@ -14,6 +14,7 @@ import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.utils.string.StringUtil;
+import com.yonge.toolset.utils.string.ValueUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -93,7 +94,12 @@ public class TeacherAuthEntryRecordServiceImpl extends ServiceImpl<TeacherAuthEn
 
     @Override
     public TeacherAuthEntryRecordVo getLastRecordByUserId(Long userId) {
-        return baseMapper.getLastRecordByUserId(userId);
+        TeacherAuthEntryRecordVo authEntryRecordVo = baseMapper.getLastRecordByUserId(userId);
+        if(null != authEntryRecordVo){
+            authEntryRecordVo.setIdCardNo(ValueUtil.fuzzyIdCard(authEntryRecordVo.getIdCardNo()));
+            authEntryRecordVo.setPhone(ValueUtil.fuzzyMobile(authEntryRecordVo.getPhone()));
+        }
+        return authEntryRecordVo;
     }
 
     /***

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java

@@ -155,7 +155,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
         //开通直播需要已完成课时数
         Integer overClass = Integer.parseInt(sysConfigService.findByParamName(SysConfigConstant.OPEN_LIVE_OVER_CLASS).getParamValue());
         //根据老师规则,判断老师直播权限
-        if (totalVo.getFansNum() > fansNum && totalVo.getExpTime() > overClass) {
+        if (totalVo.getFansNum() >= fansNum && totalVo.getExpTime() >= overClass) {
             Teacher teacher = new Teacher();
             teacher.setUserId(id);
             teacher.setLiveFlag(YesOrNoEnum.YES);

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java

@@ -77,14 +77,17 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
 
         BigDecimal practiceAmount = BigDecimal.ZERO;
         BigDecimal liveAmount = BigDecimal.ZERO;
+        BigDecimal videoAmount = BigDecimal.ZERO;
         BigDecimal musicAmount = BigDecimal.ZERO;
         for (AccountTotal info : infoList) {
             info.setPracticeAmount(null == info.getPracticeAmount() ? BigDecimal.ZERO : info.getPracticeAmount());
             info.setLiveAmount(null == info.getLiveAmount() ? BigDecimal.ZERO : info.getLiveAmount());
+            info.setVideoAmount(null == info.getVideoAmount() ? BigDecimal.ZERO : info.getVideoAmount());
             info.setMusicAmount(null == info.getMusicAmount() ? BigDecimal.ZERO : info.getMusicAmount());
 
             practiceAmount = practiceAmount.add(info.getPracticeAmount());
             liveAmount = liveAmount.add(info.getLiveAmount());
+            videoAmount = videoAmount.add(info.getVideoAmount());
             musicAmount = musicAmount.add(info.getMusicAmount());
         }
         AccountTotal total = new AccountTotal();
@@ -101,6 +104,11 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
                     .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
             total.setLiveRate(liveRate);
 
+            total.setVideoAmount(videoAmount);
+            BigDecimal videoRate = total.getVideoAmount()
+                    .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
+            total.setVideoRate(videoRate);
+
             total.setMusicAmount(musicAmount);
             BigDecimal musicRate = total.getMusicAmount()
                     .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));

+ 54 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentHomeVo.java

@@ -1,6 +1,8 @@
 package com.yonge.cooleshow.biz.dal.vo;
 
 import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.enums.GenderEnum;
+import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.models.auth.In;
@@ -18,8 +20,6 @@ public class StudentHomeVo extends Student {
     private String heardUrl;
     @ApiModelProperty("学员昵称")
     private String username;
-    @ApiModelProperty(value = "生日")
-    private Date birthdate;
     @ApiModelProperty("会员剩余有效期天数")
     private Integer membershipDays;
     @ApiModelProperty("累计练习天数")
@@ -36,6 +36,18 @@ public class StudentHomeVo extends Student {
     private Integer starTeacherNum;
     @ApiModelProperty(value = "声部名称(支持多个,用逗号分隔) ")
     private String subjectName;
+    @ApiModelProperty(value = "性别 0女 1男")
+    private GenderEnum gender;
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+    @ApiModelProperty(value = "真实姓名")
+    private String realName;
+    @ApiModelProperty(value = "身份证号码")
+    private String idCardNo;
+    @ApiModelProperty(value = "生日")
+    private Date birthdate;
+    @ApiModelProperty(value = "是否实名 0否 1是")
+    private YesOrNoEnum isReal;
 
     public String getHeardUrl() {
         return heardUrl;
@@ -124,4 +136,44 @@ public class StudentHomeVo extends Student {
     public void setSubjectName(String subjectName) {
         this.subjectName = subjectName;
     }
+
+    public GenderEnum getGender() {
+        return gender;
+    }
+
+    public void setGender(GenderEnum gender) {
+        this.gender = gender;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getIdCardNo() {
+        return idCardNo;
+    }
+
+    public void setIdCardNo(String idCardNo) {
+        this.idCardNo = idCardNo;
+    }
+
+    public YesOrNoEnum getIsReal() {
+        return isReal;
+    }
+
+    public void setIsReal(YesOrNoEnum isReal) {
+        this.isReal = isReal;
+    }
 }

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

@@ -40,7 +40,7 @@
             u.birthdate_ as birthdate,
             TIMESTAMPDIFF(YEAR, u.birthdate_, CURDATE()) as age,
             u.phone_ as phone,
-            !isnull(birthdate_) as isReal,
+            (case when isnull(u.id_card_no_) then 0 else 1 end) as isReal,
             (!isnull(membership_end_time_) and membership_end_time_ > now()) as isVip,
             (
             SELECT GROUP_CONCAT(name_) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)

+ 14 - 13
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserOrderMapper.xml

@@ -141,25 +141,26 @@
     </select>
     <select id="getPendingOrder" resultType="com.yonge.cooleshow.biz.dal.vo.UserOrderVo">
         SELECT
-        <include refid="baseColumns"/>,
-        p.trans_no_ as transNo,
-        p.pay_channel_ as payChannel
+            <include refid="baseColumns"/>,
+            p.trans_no_ as transNo,
+            p.pay_channel_ as payChannel
         FROM user_order t
         left join user_order_payment p on t.order_no_ = p.order_no_
         where t.status_ in ('WAIT_PAY','PAYING')
         and t.user_id_ = #{param.userId}
         and exists (
-        select 1 from user_order_detail d where t.order_no_ = d.order_no_
-        and d.good_type_ = #{param.goodType}
-        <choose>
-            <when test="param.goodType != null and param.goodType == 'PRACTICE'">
-                and d.merch_id_ = #{param.bizId}
-            </when>
-            <otherwise>
-                and d.biz_id_ = #{param.bizId}
-            </otherwise>
-        </choose>
+            select 1 from user_order_detail d where t.order_no_ = d.order_no_
+            and d.good_type_ = #{param.goodType}
+            <choose>
+                <when test="param.goodType != null and param.goodType == 'PRACTICE'">
+                    and d.merch_id_ = #{param.bizId}
+                </when>
+                <otherwise>
+                    and d.biz_id_ = #{param.bizId}
+                </otherwise>
+            </choose>
         )
+        order by t.create_time_ desc limit 1
     </select>
 
     <select id="selectUnRecordTimeOrder" resultType="com.yonge.cooleshow.biz.dal.entity.UserOrder">

+ 15 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherAuthEntryRecordController.java

@@ -3,12 +3,16 @@ package com.yonge.cooleshow.teacher.controller;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.req.TeacherApplyDetailReq;
+import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import com.yonge.cooleshow.biz.dal.service.TeacherAuthEntryRecordService;
@@ -24,6 +28,17 @@ public class TeacherAuthEntryRecordController extends BaseController {
     @Autowired
     private SysUserFeignService sysUserFeignService;
 
+    @GetMapping("/getLastRecordByUserId")
+    @ApiOperation(value = "获取最近一次提交的申请内容")
+    public HttpResponseResult<TeacherAuthEntryRecordVo> getLastRecordByUserId() {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        TeacherAuthEntryRecordVo detail = teacherAuthEntryRecordService.getLastRecordByUserId(user.getId());
+        return succeed(detail);
+    }
+
     @PostMapping("/doApply")
     @ApiOperation(value = "提交申请", notes = "传入teacherAuthEntryRecord")
     public HttpResponseResult<Boolean> doApply(@Valid @RequestBody TeacherApplyDetailReq teacherApplyDetailDto) throws Exception {

+ 5 - 1
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserBankCardController.java

@@ -92,7 +92,11 @@ public class UserBankCardController extends BaseController {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
 		bankCard.setUserId(user.getId());
-		return userBankCardService.unBind(bankCard);
+		try {
+			return userBankCardService.unBind(bankCard);
+		}catch (Exception e){
+			return HttpResponseResult.failed("姓名与身份证号不一致");
+		}
 	}
 
 }

+ 1 - 1
toolset/thirdparty-component/src/main/java/com/yonge/toolset/thirdparty/user/realname/RealnameAuthenticationPlugin.java

@@ -14,5 +14,5 @@ public interface RealnameAuthenticationPlugin extends InitializingBean, Disposab
 	 * @param idcardNo 身份证号码
 	 * @return true,匹配成功;否则,匹配失败
 	 */
-	public boolean verify(String realname, String idcardNo);
+	boolean verify(String realname, String idcardNo);
 }

+ 100 - 94
toolset/thirdparty-component/src/main/java/com/yonge/toolset/thirdparty/user/realname/provider/LinkfaceRealnameAuthenticationPlugin.java

@@ -4,6 +4,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -15,100 +17,104 @@ import com.yonge.toolset.utils.http.HttpUtil;
 @Service
 public class LinkfaceRealnameAuthenticationPlugin implements RealnameAuthenticationPlugin {
 
-	@Value("${realnameAuthentication.linkface.projectid:2cd4937c8dbd4f6a9c70c6d3122df5f4}")
-	public String appId;
-
-	@Value("${realnameAuthentication.linkface.projectSecret:3f809f3800654780beff1ce09b780297}")
-	public String appSecret;
-
-	@Value("${realnameAuthentication.linkface.apisUrl:https://cloudapi.linkface.cn/data/verify_id_name}")
-	public String apisUrl;
-
-	private Map<String, String> reason = new HashMap<String, String>() {
-		/**
-		 * 
-		 */
-		private static final long serialVersionUID = -5123335186604042998L;
-
-		{
-			// 定义错误原因
-			put("ENCODING_ERROR", "参数非 UTF-8 编码");
-			put("INVALID_ARGUMENT", "姓名或者身份证号填写错误");
-			put("UNAUTHORIZED", "账号或密钥错误");
-			put("KEY_EXPIRED", "账号过期");
-			put("RATE_LIMIT_EXCEEDED", "调用频率过高");
-			put("OUT_OF_QUOTA", "调用次数超出限额");
-			put("NO_PERMISSION", "无调用权限");
-			put("NOT_FOUND", "请求路径错误");
-			put("DATA_SERVER_ERROR", "数据服务异常");
-			put("INTERNAL_ERROR", "内部服务异常");
-		}
-	};
-
-	public static String getName() {
-		return "linkface";
-	}
-
-	@Override
-	public void destroy() throws Exception {
-
-	}
-
-	@Override
-	public void afterPropertiesSet() throws Exception {
-		if (StringUtils.isBlank(appId) || StringUtils.isBlank(appSecret) || StringUtils.isBlank(apisUrl)) {
-			throw new ThirdpartyException("实名认证插件 - Linkface 系统参数缺失,请检查");
-		}
-
-	}
-
-	@Override
-	public boolean verify(String realname, String idcardNo) {
-		String respJson = "";
-		HashMap<String, Object> params = new HashMap<String, Object>();
-		params.put("api_id", appId);
-		params.put("api_secret", appSecret);
-		params.put("name", realname);
-		params.put("id_number", idcardNo);
-		try {
-			respJson = HttpUtil.postForHttps(this.apisUrl, params);
-		} catch (Exception e) {
-			throw new ThirdpartyException("HttpUtil Connection Exception", e);
-		}
-		JSONObject json = JSONObject.parseObject(respJson);
-
-		String status = json.get("status").toString();
-		Integer result = json.get("result") == null ? null : Integer.parseInt(json.get("result").toString());
-
-		// 获取返回码
-		if (StringUtils.equals("OK", status) && (result != null && result == 1)) {
-			return true;
-		} else {
-			String msg = "";
-			if (result != null) {
-				if (result == 2) {
-					msg = "身份证号和姓名不一致";
-				} else if (result == 3) {
-					msg = "查无此身份证号";
-				}
-			} else {
-				msg = reason.get(status);
-			}
-			throw new ThirdpartyException("实名认证失败,原因:{}", msg);
-		}
-	}
-
-	public void setAppId(String appId) {
-		this.appId = appId;
-	}
-
-	public void setAppSecret(String appSecret) {
-		this.appSecret = appSecret;
-	}
-
-	public void setApisUrl(String apisUrl) {
-		this.apisUrl = apisUrl;
-	}
+    private final static Logger log = LoggerFactory.getLogger(LinkfaceRealnameAuthenticationPlugin.class);
+
+    @Value("${realnameAuthentication.linkface.projectid:2cd4937c8dbd4f6a9c70c6d3122df5f4}")
+    public String appId;
+
+    @Value("${realnameAuthentication.linkface.projectSecret:3f809f3800654780beff1ce09b780297}")
+    public String appSecret;
+
+    @Value("${realnameAuthentication.linkface.apisUrl:https://cloudapi.linkface.cn/data/verify_id_name}")
+    public String apisUrl;
+
+    private Map<String, String> reason = new HashMap<String, String>() {
+        /**
+         *
+         */
+        private static final long serialVersionUID = -5123335186604042998L;
+
+        {
+            // 定义错误原因
+            put("ENCODING_ERROR", "参数非 UTF-8 编码");
+            put("INVALID_ARGUMENT", "姓名或者身份证号填写错误");
+            put("UNAUTHORIZED", "账号或密钥错误");
+            put("KEY_EXPIRED", "账号过期");
+            put("RATE_LIMIT_EXCEEDED", "调用频率过高");
+            put("OUT_OF_QUOTA", "调用次数超出限额");
+            put("NO_PERMISSION", "无调用权限");
+            put("NOT_FOUND", "请求路径错误");
+            put("DATA_SERVER_ERROR", "数据服务异常");
+            put("INTERNAL_ERROR", "内部服务异常");
+        }
+    };
+
+    public static String getName() {
+        return "linkface";
+    }
+
+    @Override
+    public void destroy() throws Exception {
+
+    }
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        if (StringUtils.isBlank(appId) || StringUtils.isBlank(appSecret) || StringUtils.isBlank(apisUrl)) {
+            throw new ThirdpartyException("实名认证插件 - Linkface 系统参数缺失,请检查");
+        }
+
+    }
+
+    @Override
+    public boolean verify(String realname, String idcardNo) {
+        String respJson = "";
+        HashMap<String, Object> params = new HashMap<String, Object>();
+        params.put("api_id", appId);
+        params.put("api_secret", appSecret);
+        params.put("name", realname);
+        params.put("id_number", idcardNo);
+        try {
+            respJson = HttpUtil.postForHttps(this.apisUrl, params);
+        } catch (Exception e) {
+            log.error("实名认证接口请求失败,参数:{},异常信息:{}", JSONObject.toJSONString(params), e.getMessage());
+            e.printStackTrace();
+            throw new ThirdpartyException("实名认证请求失败");
+        }
+        JSONObject json = JSONObject.parseObject(respJson);
+
+        String status = json.get("status").toString();
+        Integer result = json.get("result") == null ? null : Integer.parseInt(json.get("result").toString());
+
+        // 获取返回码
+        if (StringUtils.equals("OK", status) && (result != null && result == 1)) {
+            return true;
+        } else {
+            String msg = "";
+            if (result != null) {
+                if (result == 2) {
+                    msg = "身份证号和姓名不一致";
+                } else if (result == 3) {
+                    msg = "查无此身份证号";
+                }
+            } else {
+                msg = reason.get(status);
+            }
+            throw new ThirdpartyException("实名认证失败,原因:{}", msg);
+        }
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+    public void setApisUrl(String apisUrl) {
+        this.apisUrl = apisUrl;
+    }
 
 	/*public static void main(String[] args) {
 		LinkfaceRealnameAuthenticationPlugin plugin = new LinkfaceRealnameAuthenticationPlugin();