Преглед изворни кода

老师风采接口,微信支付获取openid

weifanli пре 3 година
родитељ
комит
fa0b8824ea
16 измењених фајлова са 363 додато и 47 уклоњено
  1. 5 4
      cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/UserController.java
  2. 6 0
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/constant/CommonConstants.java
  3. 24 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherStyleVideoDao.java
  4. 27 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/TeacherDto.java
  5. 18 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TeacherStyleVideo.java
  6. 28 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/props/HuifuProperties.java
  7. 36 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/sdk/PaymentSdk.java
  8. 17 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherService.java
  9. 17 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherStyleVideoService.java
  10. 34 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java
  11. 10 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherStyleVideoServiceImpl.java
  12. 2 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserWithdrawalServiceImpl.java
  13. 77 24
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherHomeVo.java
  14. 22 8
      cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherStyleVideoMapper.xml
  15. 9 0
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/PaymentController.java
  16. 31 3
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherController.java

+ 5 - 4
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/UserController.java

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.auth.web.controller;
 import com.yonge.cooleshow.auth.api.dto.RealnameAuthReq;
 import com.yonge.cooleshow.auth.api.dto.UpdatePasswordDto;
 import com.yonge.cooleshow.auth.api.dto.UserSetReq;
+import com.yonge.cooleshow.auth.api.entity.SysRole;
 import com.yonge.cooleshow.auth.api.vo.UserSetVo;
 import com.yonge.cooleshow.common.constant.CommonConstants;
 import com.yonge.toolset.thirdparty.user.realname.RealnameAuthenticationPlugin;
@@ -15,6 +16,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 
 import java.util.Date;
+import java.util.List;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -371,7 +373,7 @@ public class UserController extends BaseController {
     @ApiOperation(value = "获取用户角色列表")
     @GetMapping("/getRole")
     @PreAuthorize("@pcs.hasPermissions('user/getRole')")
-    public Object getRole() {
+    public HttpResponseResult<List<SysRole>> getRole() {
         AuthUser user = SecurityUtils.getUser();
         if (user != null) {
             SysUser sysUser = sysUserService.get(user.getUserId());
@@ -390,12 +392,11 @@ public class UserController extends BaseController {
             @ApiImplicitParam(name = "roleIds", value = "角色id,逗号分隔", required = true, dataType = "String")})
     @PostMapping(value = "/addRole", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
     @PreAuthorize("@pcs.hasPermissions('user/addRole')")
-    public Object getRole(String userId, String roleIds) {
+    public HttpResponseResult<Boolean> getRole(String userId, String roleIds) {
         if (StringUtils.isEmpty(userId) || StringUtils.isEmpty(roleIds)) {
             return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
         }
-        sysUserRoleService.batchInsert(Long.parseLong(userId), roleIds);
-        return succeed();
+        return status(sysUserRoleService.batchInsert(Long.parseLong(userId), roleIds));
     }
 
     @ApiOperation(value = "用户角色删除")

+ 6 - 0
cooleshow-common/src/main/java/com/yonge/cooleshow/common/constant/CommonConstants.java

@@ -46,4 +46,10 @@ public interface CommonConstants {
 	 * @updateTime 2022/3/28 16:29
 	 */
 	String REDIS_SPLIT = ":";
+	/***
+	 * 微信授权类型
+	 * @author liweifan
+	 * @updateTime 2022/4/8 15:48
+	 */
+	String WECHAT_GRANT_TYPE = "authorization_code";
 }

+ 24 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherStyleVideoDao.java

@@ -8,7 +8,29 @@ import com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo;
 import org.apache.ibatis.annotations.Param;
 
 public interface TeacherStyleVideoDao extends BaseMapper<TeacherStyleVideo>{
-
+    /***
+     * 查询老师风采视频
+     * @author liweifan
+     * @param: userId
+     * @updateTime 2022/4/8 15:09
+     * @return: java.util.List<com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo>
+     */
     List<TeacherStyleVideo> selectListByUserId(@Param("userId") Long userId);
-
+    /***
+     * 删除老师风采视频,留下oldIds
+     * @author liweifan
+     * @param: userId
+     * @param: oldIds
+     * @updateTime 2022/4/8 15:09
+     * @return: java.lang.Integer
+     */
+    Integer removeByUserIdAndOldIds(@Param("userId")Long userId,@Param("oldIds") List<Long> oldIds);
+    /***
+     * 批量新增
+     * @author liweifan
+     * @param: createList
+     * @updateTime 2022/4/8 15:19
+     * @return: java.lang.Integer
+     */
+    Integer batchAddStyleVideo(@Param("createList") List<TeacherStyleVideo> createList);
 }

+ 27 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/TeacherDto.java

@@ -0,0 +1,27 @@
+package com.yonge.cooleshow.biz.dal.dto;
+
+import com.yonge.cooleshow.biz.dal.entity.Teacher;
+import com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/22 10:10
+ */
+@ApiModel(value = "TeacherVo对象", description = "教师详情")
+public class TeacherDto extends Teacher {
+    private static final long serialVersionUID = 1L;
+    @ApiModelProperty(value = "老师风采视频")
+    private List<TeacherStyleVideo> styleVideo;
+
+    public List<TeacherStyleVideo> getStyleVideo() {
+        return styleVideo;
+    }
+
+    public void setStyleVideo(List<TeacherStyleVideo> styleVideo) {
+        this.styleVideo = styleVideo;
+    }
+}

+ 18 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TeacherStyleVideo.java

@@ -16,11 +16,17 @@ import org.springframework.format.annotation.DateTimeFormat;
 @ApiModel(value = "TeacherStyleVideo对象", description = "教师风采视频表")
 public class TeacherStyleVideo implements Serializable {
 	private static final long serialVersionUID = 1L;
-    /** 
+    /**
+     * 视频id
+     */
+    @ApiModelProperty("视频id ")
+    @TableId(value = "id_", type = IdType.AUTO)
+    private Long id;
+    /**
     * 对应user表用户编号 
     */
     @ApiModelProperty("对应user表用户编号 ")
-    @TableId(value = "user_id_", type = IdType.AUTO)
+    @TableId(value = "user_id_")
     private Long userId;
     /** 
     * 视频地址 
@@ -49,6 +55,14 @@ public class TeacherStyleVideo implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date updateTime;
 
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
     public Long getUserId() {
         return userId;
     }
@@ -97,6 +111,8 @@ public class TeacherStyleVideo implements Serializable {
         this.updateTime = updateTime;
     }
 
+
+
     @Override
     public String toString() {
         return "TeacherStyleVideo{" +

+ 28 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/props/HuifuProperties.java

@@ -33,6 +33,18 @@ public class HuifuProperties {
      * @updateTime 2022/3/31 11:24
      */
     private String rsaPrivateKey;
+    /***
+     * 微信appid
+     * @author liweifan
+     * @updateTime 2022/3/31 11:24
+     */
+    private String wxAppid;
+    /***
+     * 微信secret
+     * @author liweifan
+     * @updateTime 2022/3/31 11:24
+     */
+    private String wxSecret;
 
     public String getApiKey() {
         return apiKey;
@@ -65,4 +77,20 @@ public class HuifuProperties {
     public void setAppId(String appId) {
         this.appId = appId;
     }
+
+    public String getWxAppid() {
+        return wxAppid;
+    }
+
+    public void setWxAppid(String wxAppid) {
+        this.wxAppid = wxAppid;
+    }
+
+    public String getWxSecret() {
+        return wxSecret;
+    }
+
+    public void setWxSecret(String wxSecret) {
+        this.wxSecret = wxSecret;
+    }
 }

+ 36 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/sdk/PaymentSdk.java

@@ -8,8 +8,11 @@ import com.huifu.adapay.model.PaymentConfirm;
 import com.yonge.cooleshow.biz.dal.config.HuifuConfiguration;
 import com.yonge.cooleshow.biz.dal.sdk.req.PaymentReq;
 import com.yonge.cooleshow.biz.dal.service.impl.ImGroupMemberServiceImpl;
+import com.yonge.cooleshow.common.constant.CommonConstants;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.thirdparty.exception.ThirdpartyException;
 import com.yonge.toolset.utils.collection.MapUtil;
+import com.yonge.toolset.utils.http.HttpUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -128,6 +131,39 @@ public class PaymentSdk {
         System.out.println("=======query payment end=======");
         return payment;
     }
+    /***
+     * 获取openId
+     * @author liweifan
+     * @param: js_code
+     * @updateTime 2022/4/8 15:49
+     * @return: java.lang.Object
+     */
+    public HttpResponseResult<Map<String, Object>> getOpenId(String js_code) {
+        Map<String, Object> param = new HashMap<>();
+        param.put("appid", HuifuConfiguration.getHuifuProperties().getWxAppid());
+        param.put("secret", HuifuConfiguration.getHuifuProperties().getWxSecret());
+        param.put("js_code", js_code);
+        param.put("grant_type", CommonConstants.WECHAT_GRANT_TYPE);
+
+        try {
+            String res = HttpUtil.get("https://api.weixin.qq.com/sns/jscode2session", param);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+
+            String errcode = jsonObject.getString("errcode");
+            if("0".equals(errcode)){
+                Map<String, Object> resMap = new HashMap<>();
+                resMap.put("openid", jsonObject.getString("openid"));
+                resMap.put("session_key", jsonObject.getString("session_key"));
+                resMap.put("unionid", jsonObject.getString("unionid"));
+                return HttpResponseResult.succeed(resMap);
+            }else{
+                return HttpResponseResult.failed(jsonObject.getString("errmsg"));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return HttpResponseResult.failed("请求失败");
+        }
+    }
 
 /*
     public static Map<String, Object> queryList(Integer pageIndex, Long createdGte, Long createdLte) throws Exception {

+ 17 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherService.java

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.biz.dal.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.TeacherDto;
 import com.yonge.cooleshow.biz.dal.dto.req.UserSetReq;
 import com.yonge.cooleshow.biz.dal.dto.req.TeacherSubmitReq;
 import com.yonge.cooleshow.biz.dal.dto.search.TeacherSearch;
@@ -95,4 +96,20 @@ public interface TeacherService extends IService<Teacher>  {
      * @return: java.lang.Integer
      */
     Integer setSubject(Long id, String subjectIds);
+    /***
+     * 查询老师个人风采
+     * @author liweifan
+     * @param: id
+     * @updateTime 2022/4/8 14:11
+     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<com.yonge.cooleshow.biz.dal.vo.TeacherVo>
+     */
+    HttpResponseResult<TeacherVo> queryTeacherStyle(Long id);
+    /***
+     * 保存老师风采信息
+     * @author liweifan
+     * @param: teacherDto
+     * @updateTime 2022/4/8 14:21
+     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<com.yonge.cooleshow.biz.dal.vo.TeacherVo>
+     */
+    HttpResponseResult<TeacherVo> saveTeacherStyle(TeacherDto teacherDto);
 }

+ 17 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherStyleVideoService.java

@@ -21,5 +21,21 @@ public interface TeacherStyleVideoService extends IService<TeacherStyleVideo>  {
      * @return: com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo
      */
     List<TeacherStyleVideo> selectListByUserId(Long userId);
-
+    /***
+     * 删除老师风采视频,留下oldIds
+     * @author liweifan
+     * @param: userId
+     * @param: oldIds
+     * @updateTime 2022/4/8 15:08
+     * @return: java.lang.Integer
+     */
+    Integer removeByUserIdAndOldIds(Long userId, List<Long> oldIds);
+    /***
+     * 批量新增老师风采视频
+     * @author liweifan
+     * @param: createList
+     * @updateTime 2022/4/8 15:18
+     * @return: java.lang.Integer
+     */
+    boolean batchAddStyleVideo(List<TeacherStyleVideo> createList);
 }

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

@@ -11,6 +11,7 @@ import com.yonge.cooleshow.biz.dal.constant.SysConfigConstant;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
 import com.yonge.cooleshow.biz.dal.dao.EmployeeDao;
 import com.yonge.cooleshow.biz.dal.dao.StudentStarDao;
+import com.yonge.cooleshow.biz.dal.dto.TeacherDto;
 import com.yonge.cooleshow.biz.dal.dto.req.TeacherSubmitReq;
 import com.yonge.cooleshow.biz.dal.dto.search.TeacherSearch;
 import com.yonge.cooleshow.biz.dal.entity.*;
@@ -28,6 +29,7 @@ import com.yonge.cooleshow.common.enums.UserGenderEnum;
 import com.yonge.cooleshow.common.exception.BizException;
 import com.yonge.toolset.utils.idcard.IdcardInfoExtractor;
 import com.yonge.toolset.utils.string.StringUtil;
+import com.yonge.toolset.utils.string.ValueUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.poi.ss.formula.functions.T;
 import org.redisson.api.RedissonClient;
@@ -110,6 +112,10 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
         } catch (Exception e) {
             e.printStackTrace();
         }
+        //身份证号、手机号脱敏
+        teacherHomeVo.setIdCardNo(ValueUtil.fuzzyIdCard(teacherHomeVo.getIdCardNo()));
+        teacherHomeVo.setPhone(ValueUtil.fuzzyMobile(teacherHomeVo.getPhone()));
+
         String avatar = user.getAvatar();
         if (StringUtil.isEmpty(avatar)) {
             avatar = sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD_TEACHER);
@@ -158,7 +164,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
             teacher.setLiveFlag(YesOrNoEnum.YES);
             baseMapper.updateById(teacher);
             return HttpResponseResult.status(true);
-        }else{
+        } else {
             return HttpResponseResult.failed("不满足开通条件");
         }
     }
@@ -304,7 +310,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
         teacher.setEntryAuthDate(null);
         teacher.setMusicianFlag(YesOrNoEnum.NO);
         teacher.setMusicianDate(null);
-        if(StringUtil.isEmpty(teacherSubmitReq.getTeacherType())){
+        if (StringUtil.isEmpty(teacherSubmitReq.getTeacherType())) {
             return teacher;
         }
         String[] teacherTypes = teacherSubmitReq.getTeacherType().split(",");
@@ -323,6 +329,31 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
 
     @Override
     public Integer setSubject(Long id, String subjectIds) {
-        return baseMapper.setSubject(id,subjectIds);
+        return baseMapper.setSubject(id, subjectIds);
+    }
+
+    @Override
+    public HttpResponseResult<TeacherVo> queryTeacherStyle(Long id) {
+        return HttpResponseResult.succeed(detail(id));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public HttpResponseResult<TeacherVo> saveTeacherStyle(TeacherDto teacherDto) {
+        //修改老师信息
+        int i = baseMapper.updateById(teacherDto);
+        List<TeacherStyleVideo> styleVideo = teacherDto.getStyleVideo();
+        List<TeacherStyleVideo> createList = styleVideo.stream().filter(o -> o.getId() == null)
+                .collect(Collectors.toList());
+
+        createList.forEach(o -> o.setUserId(teacherDto.getUserId()));
+
+        List<Long> oldIds = styleVideo.stream().filter(o -> o.getId() != null)
+                .map(TeacherStyleVideo::getId).collect(Collectors.toList());
+        //删除旧视频
+        teacherStyleVideoService.removeByUserIdAndOldIds(teacherDto.getUserId(), oldIds);
+        //保存新视频
+        teacherStyleVideoService.batchAddStyleVideo(createList);
+        return HttpResponseResult.succeed(detail(teacherDto.getUserId()));
     }
 }

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

@@ -17,4 +17,14 @@ public class TeacherStyleVideoServiceImpl extends ServiceImpl<TeacherStyleVideoD
     public List<TeacherStyleVideo> selectListByUserId(Long userId) {
         return baseMapper.selectListByUserId(userId);
     }
+
+    @Override
+    public Integer removeByUserIdAndOldIds(Long userId, List<Long> oldIds) {
+        return baseMapper.removeByUserIdAndOldIds(userId, oldIds);
+    }
+
+    @Override
+    public boolean batchAddStyleVideo(List<TeacherStyleVideo> createList) {
+        return saveBatch(createList);
+    }
 }

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

@@ -18,6 +18,7 @@ import com.yonge.cooleshow.biz.dal.vo.UserBankCardVo;
 import com.yonge.cooleshow.biz.dal.vo.res.WithdrawalInfoRes;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.exception.BizException;
+import com.yonge.toolset.utils.string.ValueUtil;
 import org.redisson.api.RedissonClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -64,6 +65,7 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
         if (null == defaultBank) {
             return HttpResponseResult.failed("用户未绑定银行卡");
         }
+        defaultBank.setBankCard(ValueUtil.fuzzyBankCard(defaultBank.getBankCard()));
         withdrawalInfoRes.setUserBankCard(defaultBank);
         //获取平台提现手续费
         BigDecimal withdrawalServiceFee = getWithdrawalServiceFee();

+ 77 - 24
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherHomeVo.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
+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;
@@ -17,11 +18,8 @@ import java.util.Date;
  * @Data: 2022/3/21 18:37
  */
 @ApiModel(value = "TeacherHomeVo对象", description = "老师主页基本信息返回")
-public class TeacherHomeVo implements Serializable {
+public class TeacherHomeVo extends Teacher implements Serializable {
     private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty("对应user表用户编号")
-    private Long userId;
     @ApiModelProperty("头像地址")
     private String heardUrl;
     @ApiModelProperty("老师昵称")
@@ -34,24 +32,31 @@ public class TeacherHomeVo implements Serializable {
     private Integer expTime;
     @ApiModelProperty("未上课时")
     private Integer unExpTime;
+    @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 = "出生日期")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date birthdate;
+
     @ApiModelProperty("老师入驻状态 0、未申请  UNPAALY、未申请 DOING、审核中 PASS、通过 UNPASS、不通过")
     private AuthStatusEnum entryStatus;
     @ApiModelProperty("音乐人审核状态  0、未申请 UNPAALY、未申请 DOING、审核中 PASS、通过 UNPASS、不通过")
     private AuthStatusEnum musicianAuthStatus;
     @ApiModelProperty("是否有直播权限 0 否 1 是")
     private YesOrNoEnum liveFlag;
-    @ApiModelProperty(value = "声部id(支持多个,用逗号分隔) ")
-    private String subjectId;
-    @ApiModelProperty(value = "声部名称(支持多个,用逗号分隔) ")
-    private String subjectName;
-
-    public Long getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Long userId) {
-        this.userId = userId;
-    }
+    @ApiModelProperty(value = "是否实名 0否 1是")
+    private YesOrNoEnum isReal;
+    @ApiModelProperty(value = "是否绑卡 0否 1是")
+    private YesOrNoEnum isBank;
 
     public String getHeardUrl() {
         return heardUrl;
@@ -125,14 +130,6 @@ public class TeacherHomeVo implements Serializable {
         this.liveFlag = liveFlag;
     }
 
-    public String getSubjectId() {
-        return subjectId;
-    }
-
-    public void setSubjectId(String subjectId) {
-        this.subjectId = subjectId;
-    }
-
     public String getSubjectName() {
         return subjectName;
     }
@@ -140,4 +137,60 @@ public class TeacherHomeVo implements Serializable {
     public void setSubjectName(String subjectName) {
         this.subjectName = subjectName;
     }
+
+    public YesOrNoEnum getIsReal() {
+        return isReal;
+    }
+
+    public void setIsReal(YesOrNoEnum isReal) {
+        this.isReal = isReal;
+    }
+
+    public YesOrNoEnum getIsBank() {
+        return isBank;
+    }
+
+    public void setIsBank(YesOrNoEnum isBank) {
+        this.isBank = isBank;
+    }
+
+    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 Date getBirthdate() {
+        return birthdate;
+    }
+
+    public void setBirthdate(Date birthdate) {
+        this.birthdate = birthdate;
+    }
 }

+ 22 - 8
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherStyleVideoMapper.xml

@@ -2,29 +2,43 @@
 <!DOCTYPE  mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.yonge.cooleshow.biz.dal.dao.TeacherStyleVideoDao">
 	<resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo">
-            <result column="user_id_" property="userId" />
+			<result column="id_" property="id" />
+			<result column="user_id_" property="userId" />
 	        <result column="video_url_" property="videoUrl" />
 	        <result column="describe_" property="describe" />
 	        <result column="browse_" property="browse" />
 	        <result column="create_time_" property="createTime" />
 	        <result column="update_time_" property="updateTime" />
-		</resultMap>  
-    
+		</resultMap>
+
     <!-- 表字段 -->
     <sql id="baseColumns">
-         t.user_id_ as "userId"
+         t.id_ as "id"
+        , t.user_id_ as "userId"
         , t.video_url_ as "videoUrl"
         , t.describe_ as "describe"
         , t.browse_ as "browse"
         , t.create_time_ as "createTime"
         , t.update_time_ as "updateTime"
-        </sql> 
-    
-    <!-- 根据老师id查询 -->
+        </sql>
+
+	<!-- 根据老师id查询 -->
     <select id="selectListByUserId" resultMap="BaseResultMap">
-		SELECT         
+		SELECT
         	<include refid="baseColumns" />
 		FROM teacher_style_video t
 		WHERE t.user_id_ = #{userId}
 	</select>
+
+	<delete id="removeByUserIdAndOldIds">
+		DELETE FROM teacher_style_video t
+		WHERE t.user_id_ = #{userId}
+		<if test="oldIds!=null and oldIds.size()>0">
+			AND t.id_ NOT IN
+			<foreach collection="oldIds" item="oldId" open="(" close=")" separator=",">
+				#{oldId}
+			</foreach>
+		</if>
+	</delete>
+
 </mapper>

+ 9 - 0
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/PaymentController.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.student.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.huifu.adapay.core.AdapayCore;
 import com.huifu.adapay.core.util.AdapaySign;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
@@ -9,6 +10,7 @@ import com.yonge.cooleshow.biz.dal.sdk.PaymentSdk;
 import com.yonge.cooleshow.biz.dal.sdk.req.PaymentReq;
 import com.yonge.cooleshow.biz.dal.support.DistributedLock;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.utils.http.HttpUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -44,6 +47,12 @@ public class PaymentController {
         return HttpResponseResult.succeed(paymentSdk.queryPayment(paymentId));
     }
 
+    @ApiOperation(value = "微信支付获取openid")
+    @GetMapping("/getOpenId")
+    public HttpResponseResult<Map<String, Object>> getOpenId(String js_code) {
+        return paymentSdk.getOpenId(js_code);
+    }
+
     /***
      * 汇付回调
      * 问题:1、成功失败需要回执什么信息 2、回调url地址是否需要加入白名单

+ 31 - 3
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherController.java

@@ -2,9 +2,12 @@ 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.TeacherDto;
 import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.service.TeacherService;
 import com.yonge.cooleshow.biz.dal.vo.TeacherHomeVo;
+import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.utils.string.StringUtil;
@@ -13,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -38,17 +42,17 @@ public class TeacherController extends BaseController {
 
     @ApiOperation(value = "开通直播")
     @GetMapping("/openLive")
-    public HttpResponseResult<Boolean> openLive(){
+    public HttpResponseResult<Boolean> openLive() {
         SysUser user = sysUserFeignService.queryUserInfo();
         if (user == null || null == user.getId()) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        return  teacherService.openLive(user.getId());
+        return teacherService.openLive(user.getId());
     }
 
     @ApiOperation(value = "获取老师可授课声部列表")
     @PostMapping("/querySubject")
-    public HttpResponseResult<List<Subject>> querySubject(){
+    public HttpResponseResult<List<Subject>> querySubject() {
         SysUser user = sysUserFeignService.queryUserInfo();
         if (user == null || null == user.getId()) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
@@ -68,4 +72,28 @@ public class TeacherController extends BaseController {
         }
         return status(teacherService.setSubject(user.getId(), subjectIds) > 0);
     }
+
+    @ApiOperation(value = "我的-个人风采")
+    @GetMapping("/queryTeacherStyle")
+    public HttpResponseResult<TeacherVo> queryTeacherStyle() {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return teacherService.queryTeacherStyle(user.getId());
+    }
+
+    @ApiOperation(value = "我的-个人风采保存")
+    @PostMapping("/saveTeacherStyle")
+    public HttpResponseResult<TeacherVo> saveTeacherStyle(@RequestBody TeacherDto teacherDto) {
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || null == user.getId()) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        if (StringUtil.isEmpty(teacherDto.getSubjectId())) {
+            return failed("参数异常");
+        }
+        teacherDto.setUserId(user.getId());
+        return teacherService.saveTeacherStyle(teacherDto);
+    }
 }