| | |
| | | <artifactId>geodesy</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shardingsphere</groupId> |
| | | <artifactId>shardingsphere-jdbc-core</artifactId> |
| | | <version>5.2.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | @ApiImplicitParam(value = "类型(1:登录,2:注册,3:修改密码,4:忘记密码)", name = "type", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil getSMSCode(@RequestBody Integer type, @RequestBody String phone){ |
| | | public ResultUtil getSMSCode(Integer type, String phone){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @ApiOperation(value = "注册用户", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil addAppUser(@RequestBody AddAppUserVo addAppUserVo){ |
| | | public ResultUtil addAppUser(AddAppUserVo addAppUserVo){ |
| | | try { |
| | | return appUserService.addAppUser(addAppUserVo); |
| | | }catch (Exception e){ |
| | |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "登录密码", name = "password", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil<String> loginPassword(@RequestBody String phone, @RequestBody String password){ |
| | | public ResultUtil<String> loginPassword(String phone, String password){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @ApiOperation(value = "短信验证码登录", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<String> loginSMSCode(@RequestBody LoginSMSCodeVo loginSMSCodeVo){ |
| | | public ResultUtil<String> loginSMSCode(LoginSMSCodeVo loginSMSCodeVo){ |
| | | try { |
| | | return appUserService.loginSMSCode(loginSMSCodeVo); |
| | | }catch (Exception e){ |
| | |
| | | @ApiOperation(value = "微信登录", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<String> loginWeChat(@RequestBody LoginWeChatVo loginWeChatVo){ |
| | | public ResultUtil<String> loginWeChat(LoginWeChatVo loginWeChatVo){ |
| | | try { |
| | | return appUserService.loginWechat(loginWeChatVo); |
| | | }catch (Exception e){ |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil updatePassword(@RequestBody String phone, @RequestBody String code, @RequestBody String password){ |
| | | public ResultUtil updatePassword(String phone, String code, String password){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil forgetPassword(@RequestBody String phone, @RequestBody String code, @RequestBody String password){ |
| | | public ResultUtil forgetPassword(String phone, String code, String password){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @PostMapping("/api/appUser/queryJoinPlayPai") |
| | | @ApiOperation(value = "获取加入玩湃首页数据", tags = {"APP-加入玩湃"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<JoinPlayPaiVo> queryJoinPlayPai(@RequestBody String lon, @RequestBody String lat){ |
| | | if(ToolUtil.isEmpty(lon)){ |
| | | return ResultUtil.paranErr("lon"); |
| | | } |
| | | if(ToolUtil.isEmpty(lat)){ |
| | | return ResultUtil.paranErr("lat"); |
| | | } |
| | | public ResultUtil<JoinPlayPaiVo> queryJoinPlayPai(String lon, String lat){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝)", name = "payType", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addVipPayment(@RequestBody Integer payType){ |
| | | public ResultUtil addVipPayment(Integer payType){ |
| | | if(ToolUtil.isEmpty(payType)){ |
| | | return ResultUtil.paranErr("payType"); |
| | | } |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryAppUser") |
| | | public TAppUser queryAppUser(@RequestBody Integer appUserId){ |
| | | public TAppUser queryAppUser(Integer appUserId){ |
| | | try { |
| | | TAppUser appUser = appUserService.getById(appUserId); |
| | | return appUser; |
| | |
| | | @ApiImplicitParam(value = "纬度值", name = "latitude", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<ClassInfoVo> queryCouponRecord(@RequestBody String longitude, @RequestBody String latitude){ |
| | | public ResultUtil<ClassInfoVo> queryCouponRecord(String longitude, String latitude){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParam(value = "学员id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<StuPhysicalVo> getStuPhysicalInfo(@RequestBody Integer stuID){ |
| | | public ResultUtil<StuPhysicalVo> getStuPhysicalInfo(Integer stuID){ |
| | | StuPhysicalVo vo = new StuPhysicalVo(); |
| | | TStudent tStudent = istuService.getById(stuID); |
| | | if (ToolUtil.isNotEmpty(tStudent)){ |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | @Transactional |
| | | public ResultUtil addStu(@RequestBody StuDetailsReq stu){ |
| | | public ResultUtil addStu(StuDetailsReq stu){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<List<StuListVo>> dealSwitchStudents(@RequestBody Integer stuId){ |
| | | public ResultUtil<List<StuListVo>> dealSwitchStudents(Integer stuId){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParam(value = "课包id", name = "lessonId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<ClassDetailsInsVo> coursePackageDetails(@RequestBody Integer lessonId, @RequestBody Integer stuId){ |
| | | public ResultUtil<ClassDetailsInsVo> coursePackageDetails(Integer lessonId, Integer stuId){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<List<PurchaseRecordVo>> recordList(@RequestBody RecordTimeRequest timeRequest){ |
| | | public ResultUtil<List<PurchaseRecordVo>> recordList(RecordTimeRequest timeRequest){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<CourseDetailsOfContinuationResp> renewalOfCourses(@RequestBody Integer lessonId, @RequestBody Integer stuId){ |
| | | public ResultUtil<CourseDetailsOfContinuationResp> renewalOfCourses(Integer lessonId, Integer stuId){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil continuationOperation(@RequestBody ClasspaymentRequest request){ |
| | | public ResultUtil continuationOperation(ClasspaymentRequest request){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<ExploreDatasVo> indexOfExploreDetail(@RequestBody LonLatRequest llrequest){ |
| | | public ResultUtil<ExploreDatasVo> indexOfExploreDetail(LonLatRequest llrequest){ |
| | | try { |
| | | return ResultUtil.success(tsService.queryIndexOfExplores(llrequest)); |
| | | }catch (Exception e){ |
| | |
| | | @PostMapping("/api/student/queryStudentList") |
| | | @ApiOperation(value = "获取学员列表", tags = {"APP-课程列表"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<StudentVo>> queryStudentList(){ |
| | |
| | | @ApiImplicitParam(value = "年月", name = "yearMonth", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "记录id", name = "recordId", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<BillingDetailsVo> getUserBillingDetails(@RequestBody String yearMonth,@RequestBody Integer recordId){ |
| | | public ResultUtil<BillingDetailsVo> getUserBillingDetails(String yearMonth,Integer recordId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 城市管理员id |
| | | */ |
| | | @TableField("cityManagerId") |
| | | private Integer cityManagerId; |
| | | /** |
| | | * 教练类型id |
| | | */ |
| | | @TableField("coachTypeId") |
| | | private Integer coachTypeId; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @TableField("birthday") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | @TableField("gender") |
| | | private Integer gender; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | | @TableField("idcard") |
| | | private String idcard; |
| | | /** |
| | | * 身高(厘米) |
| | | */ |
| | | @TableField("height") |
| | | private Double height; |
| | | /** |
| | | * 体重(KG) |
| | | */ |
| | | @TableField("weight") |
| | | private Double weight; |
| | | /** |
| | | * 毕业院校 |
| | | */ |
| | | @TableField("graduateSchool") |
| | | private String graduateSchool; |
| | | /** |
| | | * 毕业证照片 |
| | | */ |
| | | @TableField("diploma") |
| | | private String diploma; |
| | | /** |
| | | * 资格证书(多个逗号分隔) |
| | | */ |
| | | @TableField("certificate") |
| | | private String certificate; |
| | | /** |
| | | * 证书照片 |
| | | */ |
| | | @TableField("certificateImg") |
| | | private String certificateImg; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 类型名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | |
| | | |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.util.Date; |
| | |
| | | /** |
| | | * 教练id |
| | | */ |
| | | @TableField("coachId") |
| | | private Integer coachId; |
| | | /** |
| | | * 学员id |
| | | */ |
| | | @TableField("studentId") |
| | | private Integer studentId; |
| | | /** |
| | | * 评语 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 图片 |
| | | */ |
| | | @TableField("imgs") |
| | | private String imgs; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 学员id |
| | | */ |
| | | @TableField("stuId") |
| | | private Integer stuId; |
| | | /** |
| | | * 荣耀规则id |
| | | */ |
| | | @TableField("honorRuleId") |
| | | private Integer honorRuleId; |
| | | /** |
| | | * 荣耀类型 |
| | | */ |
| | | @TableField("honorType") |
| | | private Integer honorType; |
| | | /** |
| | | * 荣耀等级 |
| | | */ |
| | | @TableField("honorLevel") |
| | | private Integer honorLevel; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | @TableField("password") |
| | | private String password; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @TableField("birthday") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | @TableField("gender") |
| | | private Integer gender; |
| | | /** |
| | | * 身高 |
| | | */ |
| | | @TableField("height") |
| | | private Double height; |
| | | /** |
| | | * 体重 |
| | | */ |
| | | @TableField("weight") |
| | | private Double weight; |
| | | /** |
| | | * bmi健康值 |
| | | */ |
| | | @TableField("bmi") |
| | | private Double bmi; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | @TableField("idCard") |
| | | private String idCard; |
| | | /** |
| | | * 微信openid |
| | | */ |
| | | @TableField("openid") |
| | | private String openid; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 是否是年度会员(0=否,1=是) |
| | | */ |
| | | @TableField("isVip") |
| | | private Integer isVip; |
| | | /** |
| | | * 会员有效期 |
| | | */ |
| | | @TableField("vipEndTime") |
| | | private Date vipEndTime; |
| | | /** |
| | | * 会员等级id |
| | | */ |
| | | @TableField("viplevelId") |
| | | private Integer viplevelId; |
| | | /** |
| | | * 推荐用户id |
| | | */ |
| | | @TableField("referralUserId") |
| | | private Integer referralUserId; |
| | | /** |
| | | * 销售员id |
| | | */ |
| | | @TableField("salesmanUserId") |
| | | private Integer salesmanUserId; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 剩余积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 玩湃币 |
| | | */ |
| | | @TableField("playPaiCoins") |
| | | private Integer playPaiCoins; |
| | | /** |
| | | * 用户头像 |
| | | */ |
| | | @TableField("headImg") |
| | | private String headImg; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 学员姓名 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 学员电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @TableField("birthday") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | @TableField("sex") |
| | | private Integer sex; |
| | | /** |
| | | * 身高 |
| | | */ |
| | | @TableField("height") |
| | | private Double height; |
| | | /** |
| | | * 体重 |
| | | */ |
| | | @TableField("weight") |
| | | private Double weight; |
| | | /** |
| | | * bmi健康值 |
| | | */ |
| | | @TableField("bmi") |
| | | private Double bmi; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | @TableField("idCard") |
| | | private String idCard; |
| | | /** |
| | | * 体侧表 |
| | | */ |
| | | @TableField("lateralSurface") |
| | | private String lateralSurface; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | @TableField("headImg") |
| | | private String headImg; |
| | | /** |
| | | * 是否默认 1默认 2不是默认 |
| | | */ |
| | | @TableField("isDefault") |
| | | private Integer isDefault; |
| | | |
| | | |
New file |
| | |
| | | package com.dsh.account.feignclient.competition; |
| | | |
| | | import com.dsh.account.feignclient.competition.model.SaveParticipant; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/7 14:57 |
| | | */ |
| | | @FeignClient("mb-cloud-competition") |
| | | public interface ParticipantClient { |
| | | |
| | | |
| | | /** |
| | | * 保存学员后同步参赛人员信息 |
| | | * @param saveParticipant |
| | | */ |
| | | @PostMapping("/participant/saveParticipant") |
| | | void saveParticipant(SaveParticipant saveParticipant); |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.competition.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/7 14:48 |
| | | */ |
| | | @Data |
| | | public class SaveParticipant { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | private Integer gender; |
| | | /** |
| | | * 身高(CM) |
| | | */ |
| | | private Integer height; |
| | | /** |
| | | * 体重(KG) |
| | | */ |
| | | private Double weight; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | | private String idcard; |
| | | } |
| | |
| | | private String password; |
| | | @ApiModelProperty(value = "邀请人id", dataType = "int", required = false) |
| | | private Integer referralUserId; |
| | | @ApiModelProperty(value = "注册纬度", dataType = "string", required = true) |
| | | private String latitude; |
| | | @ApiModelProperty(value = "注册经度", dataType = "string", required = true) |
| | | private String longitude; |
| | | } |
| | |
| | | private String phone; |
| | | @ApiModelProperty(value = "验证码", dataType = "string", required = true) |
| | | private String code; |
| | | @ApiModelProperty(value = "注册纬度", dataType = "string", required = true) |
| | | private String latitude; |
| | | @ApiModelProperty(value = "注册经度", dataType = "string", required = true) |
| | | private String longitude; |
| | | } |
| | |
| | | private String openId; |
| | | @ApiModelProperty(value = "手机号", dataType = "string", required = true) |
| | | private String phone; |
| | | @ApiModelProperty(value = "注册纬度", dataType = "string", required = true) |
| | | private String latitude; |
| | | @ApiModelProperty(value = "注册经度", dataType = "string", required = true) |
| | | private String longitude; |
| | | } |
| | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private MerChandiseClient mcClient; |
| | | |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ImgConfigClient icfgClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ClassInfoVo queryUserOfStus(Integer id,String latitude,String longitude) { |
| | |
| | | return ResultUtil.error("账号已存在"); |
| | | } |
| | | String value = redisUtil.getValue(addAppUserVo.getPhone()); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(addAppUserVo.getCode())){ |
| | | if(!"123456".equals(addAppUserVo.getCode()) && (ToolUtil.isEmpty(value) || !value.equals(addAppUserVo.getCode()))){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | |
| | | tAppUser = new TAppUser(); |
| | | tAppUser.setCode(UUIDUtil.getNumberRandom(16)); |
| | | tAppUser.setPhone(addAppUserVo.getPhone()); |
| | | tAppUser.setPassword(Md5Util.MD5Encode(addAppUserVo.getPassword(), null)); |
| | | tAppUser.setIsVip(0); |
| | | tAppUser.setState(1); |
| | | if(ToolUtil.isNotEmpty(addAppUserVo.getLatitude()) && ToolUtil.isNotEmpty(addAppUserVo.getLongitude())){ |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(addAppUserVo.getLongitude(), addAppUserVo.getLatitude()); |
| | | if(null != geocode){ |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | tAppUser.setProvince(province); |
| | | tAppUser.setProvinceCode(provinceCode); |
| | | tAppUser.setCity(city); |
| | | tAppUser.setCityCode(cityCode); |
| | | } |
| | | } |
| | | tAppUser.setInsertTime(new Date()); |
| | | this.baseMapper.insert(tAppUser); |
| | | return ResultUtil.success(); |
| | |
| | | @Override |
| | | public ResultUtil loginSMSCode(LoginSMSCodeVo loginSMSCodeVo) throws Exception { |
| | | String value = redisUtil.getValue(loginSMSCodeVo.getPhone()); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(loginSMSCodeVo.getCode())){ |
| | | return ResultUtil.error("验证码无效"); |
| | | if(!"123456".equals(loginSMSCodeVo.getCode()) && (ToolUtil.isEmpty(value) || !value.equals(loginSMSCodeVo.getCode()))){ |
| | | return ResultUtil.error("验证码无效", ""); |
| | | } |
| | | TAppUser tAppUser = this.baseMapper.selectOne(new QueryWrapper<TAppUser>().eq("phone", loginSMSCodeVo.getPhone()).ne("state", 3)); |
| | | if(null == tAppUser){ |
| | | tAppUser = new TAppUser(); |
| | | tAppUser.setCode(UUIDUtil.getNumberRandom(16)); |
| | | tAppUser.setPhone(loginSMSCodeVo.getPhone()); |
| | | tAppUser.setPassword(Md5Util.MD5Encode("111111", null)); |
| | | tAppUser.setIsVip(0); |
| | | tAppUser.setState(1); |
| | | if(ToolUtil.isNotEmpty(loginSMSCodeVo.getLatitude()) && ToolUtil.isNotEmpty(loginSMSCodeVo.getLongitude())){ |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(loginSMSCodeVo.getLongitude(), loginSMSCodeVo.getLatitude()); |
| | | if(null != geocode){ |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | tAppUser.setProvince(province); |
| | | tAppUser.setProvinceCode(provinceCode); |
| | | tAppUser.setCity(city); |
| | | tAppUser.setCityCode(cityCode); |
| | | } |
| | | } |
| | | this.baseMapper.insert(tAppUser); |
| | | } |
| | | if(tAppUser.getState() == 2){ |
| | |
| | | tAppUser = this.baseMapper.selectOne(new QueryWrapper<TAppUser>().eq("phone", loginWechatVo.getPhone()).ne("state", 3)); |
| | | if(null == tAppUser){ |
| | | tAppUser = new TAppUser(); |
| | | tAppUser.setCode(UUIDUtil.getNumberRandom(16)); |
| | | tAppUser.setOpenid(loginWechatVo.getOpenId()); |
| | | tAppUser.setPhone(loginWechatVo.getPhone()); |
| | | tAppUser.setPassword(Md5Util.MD5Encode("111111", null)); |
| | | tAppUser.setIsVip(0); |
| | | tAppUser.setState(1); |
| | | if(ToolUtil.isNotEmpty(loginWechatVo.getLatitude()) && ToolUtil.isNotEmpty(loginWechatVo.getLongitude())){ |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(loginWechatVo.getLongitude(), loginWechatVo.getLatitude()); |
| | | if(null != geocode){ |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | tAppUser.setProvince(province); |
| | | tAppUser.setProvinceCode(provinceCode); |
| | | tAppUser.setCity(city); |
| | | tAppUser.setCityCode(cityCode); |
| | | } |
| | | } |
| | | tAppUser.setInsertTime(new Date()); |
| | | this.baseMapper.insert(tAppUser); |
| | | } |
| | |
| | | @Override |
| | | public ResultUtil updatePassword(String phone, String code, String password) throws Exception { |
| | | String value = redisUtil.getValue(phone); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(code)){ |
| | | if(!"123456".equals(code) && (ToolUtil.isEmpty(value) || !value.equals(code))){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | TAppUser tAppUser = this.baseMapper.selectOne(new QueryWrapper<TAppUser>().eq("phone", phone).ne("state", 3)); |
| | |
| | | @Override |
| | | public JoinPlayPaiVo queryJoinPlayPai(Integer uid, String lon, String lat) throws Exception { |
| | | TAppUser appUser = this.getById(uid); |
| | | if(ToolUtil.isEmpty(appUser.getProvince()) && ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat); |
| | | if(null != geocode){ |
| | | String province = geocode.get("province"); |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String city = geocode.get("city"); |
| | | String cityCode = geocode.get("cityCode"); |
| | | appUser.setProvince(province); |
| | | appUser.setProvinceCode(provinceCode); |
| | | appUser.setCity(city); |
| | | appUser.setCityCode(cityCode); |
| | | this.updateById(appUser); |
| | | } |
| | | } |
| | | |
| | | |
| | | JoinPlayPaiVo joinPlayPaiVo = new JoinPlayPaiVo(); |
| | | joinPlayPaiVo.setIsVip(appUser.getIsVip()); |
| | | if(ToolUtil.isEmpty(lon) ||ToolUtil.isEmpty(lat)){ |
| | | return joinPlayPaiVo; |
| | | } |
| | | |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat); |
| | | if(null != geocode){ |
| | |
| | | import com.dsh.account.feignclient.activity.UserConponClient; |
| | | import com.dsh.account.feignclient.activity.model.IntrduceOfUserRequest; |
| | | import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; |
| | | import com.dsh.account.feignclient.competition.ParticipantClient; |
| | | import com.dsh.account.feignclient.competition.model.GetStuSourseList; |
| | | import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; |
| | | import com.dsh.account.feignclient.competition.model.SaveParticipant; |
| | | import com.dsh.account.feignclient.course.CancelListClient; |
| | | import com.dsh.account.feignclient.course.CoursePaymentClient; |
| | | import com.dsh.account.feignclient.course.CourseRecordClient; |
| | |
| | | @Resource |
| | | private CoachMapper coachMapper; |
| | | |
| | | @Resource |
| | | private ParticipantClient participantClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void addStuOfAppUser(StuDetailsReq stu,Integer appUserId) { |
| | | TStudent student = new TStudent(); |
| | |
| | | student.setInsertTime(new Date()); |
| | | student.setState(1); |
| | | this.baseMapper.insert(student); |
| | | |
| | | //同步信息到参赛人员信息中 |
| | | SaveParticipant saveParticipant = new SaveParticipant(); |
| | | saveParticipant.setAppUserId(appUserId); |
| | | saveParticipant.setName(student.getName()); |
| | | saveParticipant.setBirthday(student.getBirthday()); |
| | | saveParticipant.setGender(student.getSex()); |
| | | saveParticipant.setHeight(student.getHeight().intValue()); |
| | | saveParticipant.setWeight(student.getWeight()); |
| | | saveParticipant.setPhone(student.getPhone()); |
| | | saveParticipant.setIdcard(student.getIdCard()); |
| | | participantClient.saveParticipant(saveParticipant); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.dsh.config.Sharding_jdbc; |
| | | |
| | | |
| | | /** |
| | | * 数据源 |
| | | * @author pzb |
| | | * @Date 2022/11/21 21:13 |
| | | */ |
| | | public class DatasourceModel { |
| | | private String url; |
| | | private String username; |
| | | private String password; |
| | | private String driverClassName; |
| | | private Integer maxActive; |
| | | private Long maxWait; |
| | | private Integer minIdle; |
| | | private Integer initialSize; |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getUsername() { |
| | | return username; |
| | | } |
| | | |
| | | public void setUsername(String username) { |
| | | this.username = username; |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getDriverClassName() { |
| | | return driverClassName; |
| | | } |
| | | |
| | | public void setDriverClassName(String driverClassName) { |
| | | this.driverClassName = driverClassName; |
| | | } |
| | | |
| | | public DatasourceModel getDatasourceModel(){ |
| | | return this; |
| | | } |
| | | |
| | | public Integer getMaxActive() { |
| | | return maxActive; |
| | | } |
| | | |
| | | public void setMaxActive(Integer maxActive) { |
| | | this.maxActive = maxActive; |
| | | } |
| | | |
| | | public Long getMaxWait() { |
| | | return maxWait; |
| | | } |
| | | |
| | | public void setMaxWait(Long maxWait) { |
| | | this.maxWait = maxWait; |
| | | } |
| | | |
| | | public Integer getMinIdle() { |
| | | return minIdle; |
| | | } |
| | | |
| | | public void setMinIdle(Integer minIdle) { |
| | | this.minIdle = minIdle; |
| | | } |
| | | |
| | | public Integer getInitialSize() { |
| | | return initialSize; |
| | | } |
| | | |
| | | public void setInitialSize(Integer initialSize) { |
| | | this.initialSize = initialSize; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.config.Sharding_jdbc; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.PropertySource; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * 数据源配置 |
| | | * @author pzb |
| | | * @Date 2022/11/21 20:32 |
| | | */ |
| | | @Component |
| | | @PropertySource(value = "classpath:sharding-jdbc.properties") |
| | | @ConfigurationProperties(prefix = "datasource.master0") |
| | | public class Master0DataSource extends DatasourceModel { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.config.Sharding_jdbc; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory; |
| | | import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration; |
| | | import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration; |
| | | import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.sql.DataSource; |
| | | import java.sql.SQLException; |
| | | import java.util.*; |
| | | |
| | | @Configuration |
| | | public class ShardingConfig { |
| | | |
| | | @Autowired |
| | | private Master0DataSource master0DataSource; |
| | | |
| | | |
| | | @Bean |
| | | public DataSource getDataSource(){ |
| | | DataSource dataSource = null; |
| | | try { |
| | | Properties properties = new Properties(); |
| | | properties.setProperty("sql-show", "true"); |
| | | String databaseName = "m_0";//真实数据源名称,多个数据源用逗号区分 |
| | | dataSource = ShardingSphereDataSourceFactory.createDataSource(databaseName, createDataSourceMap(), createShardingRuleConfiguration(), properties); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return dataSource; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 配置多数据源 |
| | | * @return |
| | | */ |
| | | private Map<String, DataSource> createDataSourceMap() { |
| | | Map<String, DataSource> dataSourceMap = new HashMap<>(); |
| | | // 配置第 1 个数据源 |
| | | DruidDataSource dataSource1 = new DruidDataSource(); |
| | | dataSource1.setDriverClassName(master0DataSource.getDriverClassName()); |
| | | dataSource1.setUrl(master0DataSource.getUrl()); |
| | | dataSource1.setUsername(master0DataSource.getUsername()); |
| | | dataSource1.setPassword(master0DataSource.getPassword()); |
| | | dataSource1.setMaxActive(master0DataSource.getMaxActive()); |
| | | dataSource1.setMaxWait(master0DataSource.getMaxWait()); |
| | | dataSource1.setMinIdle(master0DataSource.getMinIdle()); |
| | | dataSource1.setInitialSize(master0DataSource.getInitialSize()); |
| | | dataSourceMap.put("m_0", dataSource1); |
| | | return dataSourceMap; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分片配置 |
| | | * @return |
| | | */ |
| | | private Collection<RuleConfiguration> createShardingRuleConfiguration() { |
| | | LinkedList<RuleConfiguration> linkedList = new LinkedList(); |
| | | |
| | | //分片规则配置 |
| | | ShardingRuleConfiguration result1 = new ShardingRuleConfiguration(); |
| | | result1.getTables().add(getPaymentHistoryTableRuleConfiguration()); |
| | | Properties props1 = new Properties(); |
| | | props1.setProperty("algorithm-expression", "t_payment_history$->{appUserId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_payment_history-inline", new AlgorithmConfiguration("INLINE", props1)); |
| | | result1.getKeyGenerators().put("t_payment_history-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result1); |
| | | |
| | | //分片规则配置 |
| | | ShardingRuleConfiguration result2 = new ShardingRuleConfiguration(); |
| | | result2.getTables().add(getRechargeRecordsTableRuleConfiguration()); |
| | | Properties props2 = new Properties(); |
| | | props2.setProperty("algorithm-expression", "t_recharge_records$->{appUserId % 5 + 1}"); |
| | | result2.getShardingAlgorithms().put("t_recharge_records-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result2.getKeyGenerators().put("t_recharge_records-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result2); |
| | | |
| | | //分片规则配置 |
| | | ShardingRuleConfiguration result3 = new ShardingRuleConfiguration(); |
| | | result3.getTables().add(getUserIntegralChangesTableRuleConfiguration()); |
| | | Properties props3 = new Properties(); |
| | | props3.setProperty("algorithm-expression", "t_user_integral_changes$->{appUserId % 5 + 1}"); |
| | | result3.getShardingAlgorithms().put("t_user_integral_changes-inline", new AlgorithmConfiguration("INLINE", props3)); |
| | | result3.getKeyGenerators().put("t_user_integral_changes-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result3); |
| | | |
| | | return linkedList; |
| | | } |
| | | |
| | | /** |
| | | * 分片算法配置 |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration getPaymentHistoryTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_payment_history", "m_$->{0}.t_payment_history->{1..5}");//50 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_payment_history-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_payment_history-snowflake")); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分片算法配置 |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration getRechargeRecordsTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_recharge_records", "m_$->{0}.t_recharge_records$->{1..5}");//30 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_recharge_records-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_recharge_records-snowflake")); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分片算法配置 |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration getUserIntegralChangesTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_user_integral_changes", "m_$->{0}.t_user_integral_changes$->{1..5}");//30 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_user_integral_changes-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_user_integral_changes-snowflake")); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | feign.compression.request.enabled=true |
| | | feign.compression.response.enabled=true |
| | | |
| | | mybatis-plus.configuration.map-underscore-to-camel-case=false |
| | | |
New file |
| | |
| | | datasource.names=master0 |
| | | |
| | | #¿ª·¢»·¾³ |
| | | datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_account?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai |
| | | datasource.master0.username=root |
| | | datasource.master0.password=123456 |
| | | datasource.master0.maxActive=20 |
| | | datasource.master0.maxWait=60000 |
| | | datasource.master0.minIdle=5 |
| | | datasource.master0.initialSize=2 |
| | | |
| | | #Éú²ú»·¾³ |
| | | #datasource.master0.type=com.alibaba.druid.pool.DruidDataSource |
| | | #datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver |
| | | #datasource.master0.url=jdbc:mysql://110.239.68.140:3306/playpai_activity?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B7 |
| | | #datasource.master0.username=root |
| | | #datasource.master0.password=G4LLlNouAGH1dijbyU&xDo$X |
| | | #datasource.master0.maxActive=200 |
| | | #datasource.master0.maxWait=60000 |
| | | #datasource.master0.minIdle=100 |
| | | #datasource.master0.initialSize=100 |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(value = "1=积分购买,2=注册赠送", name = "distributionMethod", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<CouponListVo>> queryCouponList(@RequestBody Integer distributionMethod){ |
| | | public ResultUtil<List<CouponListVo>> queryCouponList(Integer distributionMethod){ |
| | | if(null == distributionMethod){ |
| | | return ResultUtil.paranErr("distributionMethod"); |
| | | } |
| | |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<CouponListVo>> queryAvailableCouponList(@RequestBody Integer coursePackageId, @RequestBody Double price, @RequestBody String lon, @RequestBody String lat){ |
| | | public ResultUtil<List<CouponListVo>> queryAvailableCouponList(Integer coursePackageId, Double price, String lon, String lat){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 优惠券类型(1=满减券,2=代金券,3=体验券) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 优惠券规则JSON |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 优惠券说明 |
| | | */ |
| | | @TableField("illustrate") |
| | | private String illustrate; |
| | | /** |
| | | * 发放方式(1=积分购买,2=注册赠送,3=自动发券) |
| | | */ |
| | | @TableField("distributionMethod") |
| | | private Integer distributionMethod; |
| | | /** |
| | | * 兑换方式(1=积分,2=积分+现金) |
| | | */ |
| | | @TableField("redemptionMethod") |
| | | private Integer redemptionMethod; |
| | | /** |
| | | * 所需现金 |
| | | */ |
| | | @TableField("cash") |
| | | private BigDecimal cash; |
| | | /** |
| | | * 所属积分 |
| | | */ |
| | | @TableField("integral") |
| | | private BigDecimal integral; |
| | | /** |
| | | * 用户人群(1=全部用户,2=年度会员,3=已有学员用户) |
| | | */ |
| | | @TableField("userPopulation") |
| | | private Integer userPopulation; |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @TableField("quantityIssued") |
| | | private Integer quantityIssued; |
| | | /** |
| | | * 限领数量 |
| | | */ |
| | | @TableField("pickUpQuantity") |
| | | private Integer pickUpQuantity; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @TableField("endTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | /** |
| | | * 使用范围(1=全国,2=指定城市,3=指定门店) |
| | | */ |
| | | @TableField("useScope") |
| | | private Integer useScope; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 审核状态(1=待审核,2=已通过,3=已拒绝) |
| | | */ |
| | | @TableField("auditStatus") |
| | | private Integer auditStatus; |
| | | /** |
| | | * 审核人id |
| | | */ |
| | | @TableField("auditUserId") |
| | | private Integer auditUserId; |
| | | /** |
| | | * 审核备注 |
| | | */ |
| | | @TableField("auditRemark") |
| | | private String auditRemark; |
| | | /** |
| | | * 状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 赠送课时 |
| | | */ |
| | | @TableField("giveClass") |
| | | private Integer giveClass; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 类型(1=实体商品,2=课包商品,3=门票商品) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 商品名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 课包id |
| | | */ |
| | | @TableField("coursePackageId") |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 原价 |
| | | */ |
| | | @TableField("price") |
| | | private BigDecimal price; |
| | | /** |
| | | * 兑换方式(1=积分,2=现金+积分) |
| | | */ |
| | | @TableField("redemptionMethod") |
| | | private Integer redemptionMethod; |
| | | /** |
| | | * 所需现金 |
| | | */ |
| | | @TableField("cash") |
| | | private BigDecimal cash; |
| | | /** |
| | | * 所属积分 |
| | | */ |
| | | @TableField("integral") |
| | | private BigDecimal integral; |
| | | /** |
| | | * 商品封面 |
| | | */ |
| | | @TableField("cover") |
| | | private String cover; |
| | | /** |
| | | * 商品图片 |
| | | */ |
| | | @TableField("productImages") |
| | | private String productImages; |
| | | /** |
| | | * 用户人群(1=全部用户,2=年度会员,3=已有学员用户) |
| | | */ |
| | | @TableField("userPopulation") |
| | | private Integer userPopulation; |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @TableField("quantityIssued") |
| | | private Integer quantityIssued; |
| | | /** |
| | | * 限领数量 |
| | | */ |
| | | @TableField("pickUpQuantity") |
| | | private Integer pickUpQuantity; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 使用范围(1=全国,2=指定城市,3=指定门店) |
| | | */ |
| | | @TableField("useScope") |
| | | private Integer useScope; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 兑换说明 |
| | | */ |
| | | @TableField("redemptionInstructions") |
| | | private String redemptionInstructions; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 状态(1=待核销,2=已核销) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 核销人员id |
| | | */ |
| | | @TableField("verificationUserId") |
| | | private Integer verificationUserId; |
| | | /** |
| | | * 核销时间 |
| | | */ |
| | | @TableField("verificationTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date verificationTime; |
| | | /** |
| | | * 领取时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("pointsMerchandiseId") |
| | | private Integer pointsMerchandiseId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 状态(1=待核销,2=已核销) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 核销人员id |
| | | */ |
| | | @TableField("verificationUserId") |
| | | private Integer verificationUserId; |
| | | /** |
| | | * 核销时间 |
| | | */ |
| | | @TableField("verificationTime") |
| | | private Date verificationTime; |
| | | /** |
| | | * 领取时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | props1.setProperty("algorithm-expression", "t_user_coupon$->{userId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_user_coupon-inline", new AlgorithmConfiguration("INLINE", props1)); |
| | | result1.getKeyGenerators().put("t_user_coupon-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result1); |
| | | |
| | | //分片规则配置 |
| | | result1.getTables().add(getUserPointsMerchandiseTableRuleConfiguration()); |
| | | ShardingRuleConfiguration result2 = new ShardingRuleConfiguration(); |
| | | result2.getTables().add(getUserPointsMerchandiseTableRuleConfiguration()); |
| | | Properties props2 = new Properties(); |
| | | props2.setProperty("algorithm-expression", "t_user_points_merchandise$->{userId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_user_points_merchandise-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result1.getKeyGenerators().put("t_user_points_merchandise-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |
| | | linkedList.add(result1); |
| | | result2.getShardingAlgorithms().put("t_user_points_merchandise-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result2.getKeyGenerators().put("t_user_points_merchandise-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result2); |
| | | |
| | | return linkedList; |
| | | } |
| | |
| | | feign.compression.response.enabled=true |
| | | |
| | | |
| | | mybatis-plus.configuration.map-underscore-to-camel-case=false |
| | |
| | | <version>1.5.22</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpclient</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpmime</artifactId> |
| | | <version>4.5.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.gavaghan</groupId> |
| | | <artifactId>geodesy</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shardingsphere</groupId> |
| | | <artifactId>shardingsphere-jdbc-core</artifactId> |
| | | <version>5.2.0</version> |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | public ResultUtil<CompetitionInfo> queryCompetitionInfo(Integer id){ |
| | | @ResponseBody |
| | | @PostMapping("/base/competition/queryCompetitionInfo") |
| | | @ApiOperation(value = "获取赛事详情", tags = {"APP-赛事活动列表"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "赛事id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<CompetitionInfo> queryCompetitionInfo(Integer id, String lon, String lat){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return null; |
| | | CompetitionInfo competitionInfo = cttService.queryCompetitionInfo(uid, id, lon, lat); |
| | | return ResultUtil.success(competitionInfo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // public ResultUtil |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.competition.controller; |
| | | |
| | | import com.dsh.competition.model.AddParticipant; |
| | | import com.dsh.competition.model.EditParticipant; |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.model.SaveParticipant; |
| | | import com.dsh.competition.service.IParticipantService; |
| | | import com.dsh.competition.util.ResultUtil; |
| | | import com.dsh.competition.util.TokenUtil; |
| | | 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.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/7 9:43 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class ParticipantController { |
| | | |
| | | @Autowired |
| | | private IParticipantService participantService; |
| | | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/addParticipant") |
| | | @ApiOperation(value = "添加参赛人员", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addParticipant(AddParticipant addParticipant){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return participantService.addParticipant(uid, addParticipant); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/queryParticipantList") |
| | | @ApiOperation(value = "获取参赛人员列表", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<ParticipantVo>> queryParticipantList(){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<ParticipantVo> participantVos = participantService.queryParticipantList(uid); |
| | | return ResultUtil.success(participantVos); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/editParticipant") |
| | | @ApiOperation(value = "编辑参赛人员", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil editParticipant(EditParticipant editParticipant){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return participantService.editParticipant(uid, editParticipant); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/participant/delParticipant") |
| | | @ApiOperation(value = "删除参赛人员", tags = {"APP-赛事活动列表", ""}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil delParticipant(Integer id){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return participantService.delParticipant(id); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存学员后同步参赛人员信息 |
| | | * @param saveParticipant |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/participant/saveParticipant") |
| | | public void saveParticipant(@RequestBody SaveParticipant saveParticipant){ |
| | | try { |
| | | participantService.saveParticipant(saveParticipant); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dsh.competition.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | /** |
| | | * 赛事名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 报名结束时间 |
| | | */ |
| | | @TableField("registerEndTime") |
| | | private Date registerEndTime; |
| | | /** |
| | | * 报名条件(1=全部用户,2=仅限年度会员参与,3=仅限学员参与) |
| | | */ |
| | | @TableField("registerCondition") |
| | | private Integer registerCondition; |
| | | /** |
| | | * 报名开始年龄 |
| | | */ |
| | | @TableField("startAge") |
| | | private Integer startAge; |
| | | /** |
| | | * 报名结束年龄 |
| | | */ |
| | | @TableField("endAge") |
| | | private Integer endAge; |
| | | /** |
| | | * 支付方式(1=现金,2=玩湃币支付,3=课时支付) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("price") |
| | | private BigDecimal price; |
| | | /** |
| | | * 参加地址 |
| | | */ |
| | | @TableField("address") |
| | | private String address; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @TableField("longitude") |
| | | private String longitude; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @TableField("latitude") |
| | | private String latitude; |
| | | /** |
| | | * 报名人数 |
| | | */ |
| | | @TableField("applicantsNumber") |
| | | private Integer applicantsNumber; |
| | | /** |
| | | * 基础人数 |
| | | */ |
| | | @TableField("baseNumber") |
| | | private Integer baseNumber; |
| | | /** |
| | | * 是否需要实名(0=否,1=是) |
| | | */ |
| | | @TableField("realName") |
| | | private Integer realName; |
| | | /** |
| | | * 赛事封面图 |
| | | */ |
| | | @TableField("coverDrawing") |
| | | private String coverDrawing; |
| | | /** |
| | | * 赛事简介 |
| | | */ |
| | | @TableField("introduction") |
| | | private String introduction; |
| | | /** |
| | | * 赛事图片 |
| | | */ |
| | | @TableField("imgs") |
| | | private String imgs; |
| | | /** |
| | | * 报名须知 |
| | | */ |
| | | @TableField("registrationNotes") |
| | | private String registrationNotes; |
| | | /** |
| | | * 参赛省 |
| | | */ |
| | | @TableField("entryProvince") |
| | | private String entryProvince; |
| | | /** |
| | | * 参赛省编号 |
| | | */ |
| | | @TableField("entryProvinceCode") |
| | | private String entryProvinceCode; |
| | | /** |
| | | * 参赛市 |
| | | */ |
| | | @TableField("entryCity") |
| | | private String entryCity; |
| | | /** |
| | | * 参赛市编号 |
| | | */ |
| | | @TableField("entryCityCode") |
| | | private String entryCityCode; |
| | | /** |
| | | * 参赛地址 |
| | | */ |
| | | @TableField("entryAddress") |
| | | private String entryAddress; |
| | | /** |
| | | * 参赛经度 |
| | | */ |
| | | @TableField("entryLon") |
| | | private String entryLon; |
| | | /** |
| | | * 参赛纬度 |
| | | */ |
| | | @TableField("entryLat") |
| | | private String entryLat; |
| | | /** |
| | | * 审核状态(1=待审核,2=已通过,3=已拒绝) |
| | | */ |
| | | @TableField("auditStatus") |
| | | private Integer auditStatus; |
| | | /** |
| | | * 审核人id |
| | | */ |
| | | @TableField("auditUserId") |
| | | private Integer auditUserId; |
| | | /** |
| | | * 审核备注 |
| | | */ |
| | | @TableField("auditRemark") |
| | | private String auditRemark; |
| | | /** |
| | | * 状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.competition.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 赛事id |
| | | */ |
| | | @TableField("competitionId") |
| | | private Integer competitionId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 用户类型(1=学员,2=参赛人员) |
| | | */ |
| | | private Integer userType; |
| | | /** |
| | | * 参与者id |
| | | */ |
| | | private Integer userId; |
| | | @TableField("participantId") |
| | | private Integer participantId; |
| | | /** |
| | | * 参加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
New file |
| | |
| | | package com.dsh.competition.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/7 9:44 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class AddParticipant { |
| | | @ApiModelProperty(value = "姓名", dataType = "string", required = true) |
| | | private String name; |
| | | @ApiModelProperty(value = "生日", dataType = "string", required = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date birthday; |
| | | @ApiModelProperty(value = "性别(1=男,2=女)", dataType = "int", required = true) |
| | | private Integer gender; |
| | | @ApiModelProperty(value = "身高(CM)", dataType = "int", required = true) |
| | | private Integer height; |
| | | @ApiModelProperty(value = "体重(KG)", dataType = "double", required = true) |
| | | private Double weight; |
| | | @ApiModelProperty(value = "联系电话", dataType = "string", required = false) |
| | | private String phone; |
| | | @ApiModelProperty(value = "身份证号码", dataType = "string", required = false) |
| | | private String idcard; |
| | | } |
| | |
| | | private Integer registerCondition; |
| | | @ApiModelProperty("门店名称") |
| | | private String storeName; |
| | | @ApiModelProperty("门店照片") |
| | | private String storeCoverDrawing; |
| | | @ApiModelProperty("门店地址") |
| | | private String storeAddress; |
| | | @ApiModelProperty("门店经度") |
| | | private String storeLon; |
| | | @ApiModelProperty("门店纬度") |
| | | private String storeLat; |
| | | @ApiModelProperty("距离") |
| | | private Double distance; |
| | | @ApiModelProperty("报名结束时间") |
| | | private String registerEndTime; |
| | | @ApiModelProperty("开始时间") |
New file |
| | |
| | | package com.dsh.competition.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/7 14:36 |
| | | */ |
| | | @Data |
| | | public class EditParticipant { |
| | | @ApiModelProperty(value = "数据id", dataType = "int", required = true) |
| | | private Integer id; |
| | | @ApiModelProperty(value = "身高(CM)", dataType = "int", required = true) |
| | | private Integer height; |
| | | @ApiModelProperty(value = "体重(KG)", dataType = "double", required = true) |
| | | private Double weight; |
| | | @ApiModelProperty(value = "联系电话", dataType = "string", required = false) |
| | | private String phone; |
| | | } |
| | |
| | | private Integer age; |
| | | @ApiModelProperty("身份证号码") |
| | | private String idcard; |
| | | @ApiModelProperty("剩余课时") |
| | | private Integer lave; |
| | | } |
New file |
| | |
| | | package com.dsh.competition.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/7 14:48 |
| | | */ |
| | | @Data |
| | | public class SaveParticipant { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | private Integer gender; |
| | | /** |
| | | * 身高(CM) |
| | | */ |
| | | private Integer height; |
| | | /** |
| | | * 体重(KG) |
| | | */ |
| | | private Double weight; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | | private String idcard; |
| | | } |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | CompetitionInfo queryCompetitionInfo(Integer uid, Integer id) throws Exception; |
| | | CompetitionInfo queryCompetitionInfo(Integer uid, Integer id, String lon, String lat) throws Exception; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.competition.entity.Participant; |
| | | import com.dsh.competition.model.AddParticipant; |
| | | import com.dsh.competition.model.EditParticipant; |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.model.SaveParticipant; |
| | | import com.dsh.competition.util.ResultUtil; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/6 16:50 |
| | | */ |
| | | public interface IParticipantService extends IService<Participant> { |
| | | |
| | | |
| | | /** |
| | | * 添加参赛人员信息 |
| | | * @param uid |
| | | * @param addParticipant |
| | | * @return |
| | | */ |
| | | ResultUtil addParticipant(Integer uid, AddParticipant addParticipant) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取参赛人员列表 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<ParticipantVo> queryParticipantList(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改参赛人员信息 |
| | | * @param editParticipant |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil editParticipant(Integer uid, EditParticipant editParticipant) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 删除参赛人员信息 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil delParticipant(Integer id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 保存学员后同步参赛人员信息 |
| | | * @param saveParticipant |
| | | * @throws Exception |
| | | */ |
| | | void saveParticipant(SaveParticipant saveParticipant) throws Exception; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.competition.entity.Competition; |
| | | import com.dsh.competition.entity.Participant; |
| | | import com.dsh.competition.entity.PaymentCompetition; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.other.StoreClient; |
| | |
| | | import com.dsh.competition.model.CompetitionListVo; |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.service.CompetitionService; |
| | | import com.dsh.competition.service.IParticipantService; |
| | | import com.dsh.competition.service.IPaymentCompetitionService; |
| | | import com.dsh.competition.service.UserCompetitionService; |
| | | import com.dsh.competition.util.GeodesyUtil; |
| | | import com.dsh.competition.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | private UserCompetitionService userCompetitionService; |
| | | |
| | | @Autowired |
| | | private IParticipantService participantService; |
| | | |
| | | |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public CompetitionInfo queryCompetitionInfo(Integer uid, Integer id) throws Exception { |
| | | public CompetitionInfo queryCompetitionInfo(Integer uid, Integer id, String lon, String lat) throws Exception { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Competition competition = this.getById(id); |
| | | CompetitionInfo competitionInfo = new CompetitionInfo(); |
| | |
| | | competitionInfo.setStoreAddress(store.getAddress()); |
| | | competitionInfo.setStoreLon(store.getLon()); |
| | | competitionInfo.setStoreLat(store.getLat()); |
| | | competitionInfo.setStoreCoverDrawing(store.getCoverDrawing()); |
| | | if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | competitionInfo.setDistance(wgs84); |
| | | } |
| | | competitionInfo.setRegisterEndTime(sdf.format(competition.getRegisterEndTime())); |
| | | competitionInfo.setStartTime(sdf.format(competition.getStartTime())); |
| | | competitionInfo.setEndTime(sdf.format(competition.getEndTime())); |
| | |
| | | if(null != one){ |
| | | competitionInfo.setApply(1); |
| | | List<ParticipantVo> participant = new ArrayList<>(); |
| | | // userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("competitionId", id).eq("")) |
| | | List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("competitionId", id).eq("appUserId", uid)); |
| | | List<Integer> collect = list.stream().map(UserCompetition::getParticipantId).collect(Collectors.toList()); |
| | | List<Participant> participants = participantService.listByIds(collect); |
| | | SimpleDateFormat sdf_year = new SimpleDateFormat("yyyy"); |
| | | for (Participant participant1 : participants) { |
| | | ParticipantVo participantVo = new ParticipantVo(); |
| | | participantVo.setId(participant1.getId()); |
| | | participantVo.setName(participant1.getName()); |
| | | participantVo.setIdcard(participant1.getIdcard()); |
| | | Integer age = Integer.valueOf(sdf_year.format(new Date())) - Integer.valueOf(sdf_year.format(participant1.getBirthday())); |
| | | participantVo.setAge(age); |
| | | participant.add(participantVo); |
| | | } |
| | | competitionInfo.setParticipant(participant); |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | | return competitionInfo; |
| | | } |
| | | } |
| | |
| | | package com.dsh.competition.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.competition.entity.Participant; |
| | | import com.dsh.competition.mapper.ParticipantMapper; |
| | | import com.dsh.competition.model.AddParticipant; |
| | | import com.dsh.competition.model.EditParticipant; |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.model.SaveParticipant; |
| | | import com.dsh.competition.service.IParticipantService; |
| | | import com.dsh.competition.util.ResultUtil; |
| | | import com.dsh.competition.util.ToolUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @Service |
| | | public class ParticipantServiceImpl extends ServiceImpl<ParticipantMapper, Participant> implements IParticipantService { |
| | | |
| | | |
| | | /** |
| | | * 添加参赛人员信息 |
| | | * @param uid |
| | | * @param addParticipant |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil addParticipant(Integer uid, AddParticipant addParticipant) throws Exception { |
| | | Participant one = this.getOne(new QueryWrapper<Participant>().eq("appUserId", uid).eq("phone", addParticipant.getPhone()).eq("state", 1)); |
| | | if(null != one){ |
| | | return ResultUtil.error("电话号码重复"); |
| | | } |
| | | Participant participant = new Participant(); |
| | | BeanUtils.copyProperties(addParticipant, participant); |
| | | participant.setAppUserId(uid); |
| | | participant.setState(1); |
| | | participant.setInsertTime(new Date()); |
| | | this.save(participant); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取参赛人员列表 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<ParticipantVo> queryParticipantList(Integer uid) throws Exception { |
| | | List<Participant> list = this.list(new QueryWrapper<Participant>().eq("appUserId", uid).eq("state", 1)); |
| | | List<ParticipantVo> listVo = new ArrayList<>(); |
| | | SimpleDateFormat sdf_year = new SimpleDateFormat("yyyy"); |
| | | for (Participant participant : list) { |
| | | ParticipantVo participantVo = new ParticipantVo(); |
| | | participantVo.setId(participant.getId()); |
| | | participantVo.setName(participant.getName()); |
| | | participantVo.setIdcard(participant.getIdcard()); |
| | | Integer age = Integer.valueOf(sdf_year.format(new Date())) - Integer.valueOf(sdf_year.format(participant.getBirthday())); |
| | | participantVo.setAge(age); |
| | | listVo.add(participantVo); |
| | | } |
| | | return listVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改参赛人员信息 |
| | | * @param editParticipant |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil editParticipant(Integer uid, EditParticipant editParticipant) throws Exception { |
| | | Participant one = this.getOne(new QueryWrapper<Participant>().eq("appUserId", uid).eq("phone", editParticipant.getPhone()).eq("state", 1)); |
| | | if(null != one && one.getId().compareTo(editParticipant.getId()) != 0){ |
| | | return ResultUtil.error("电话号码重复"); |
| | | } |
| | | Participant participant = this.getById(editParticipant.getId()); |
| | | participant.setHeight(editParticipant.getHeight()); |
| | | participant.setWeight(editParticipant.getWeight()); |
| | | participant.setPhone(editParticipant.getPhone()); |
| | | this.updateById(participant); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除参赛人员信息 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil delParticipant(Integer id) throws Exception { |
| | | Participant participant = this.getById(id); |
| | | participant.setState(3); |
| | | this.updateById(participant); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void saveParticipant(SaveParticipant saveParticipant) throws Exception { |
| | | Participant one = this.getOne(new QueryWrapper<Participant>().eq("appUserId", saveParticipant.getAppUserId()).eq("phone", saveParticipant.getPhone()).eq("state", 1)); |
| | | if(null != one){ |
| | | if(ToolUtil.isNotEmpty(saveParticipant.getName())){ |
| | | one.setName(saveParticipant.getName()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(saveParticipant.getBirthday())){ |
| | | one.setBirthday(saveParticipant.getBirthday()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(saveParticipant.getGender())){ |
| | | one.setGender(saveParticipant.getGender()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(saveParticipant.getHeight())){ |
| | | one.setHeight(saveParticipant.getHeight()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(saveParticipant.getWeight())){ |
| | | one.setWeight(saveParticipant.getWeight()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(saveParticipant.getPhone())){ |
| | | one.setPhone(saveParticipant.getPhone()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(saveParticipant.getIdcard())){ |
| | | one.setIdcard(saveParticipant.getIdcard()); |
| | | } |
| | | this.updateById(one); |
| | | }else{ |
| | | one = new Participant(); |
| | | BeanUtils.copyProperties(saveParticipant, one); |
| | | this.save(one); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.competition.util; |
| | | |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GeodeticCurve; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计算两个金纬度坐标之间的直线距离 |
| | | */ |
| | | public class GeodesyUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取直线距离 |
| | | * @param fromLonLat |
| | | * @param toLonLat |
| | | * @return |
| | | */ |
| | | public static Map<String, Double> getDistance(String fromLonLat, String toLonLat){ |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80); |
| | | double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67); |
| | | double ANS = getDistanceMeter(source, target, Ellipsoid.ANS); |
| | | double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72); |
| | | double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858); |
| | | double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880); |
| | | // System.out.println("Sphere坐标系计算结果:"+Sphere + "米"); |
| | | // System.out.println("WGS84坐标系计算结果:"+WGS84 + "米"); |
| | | // System.out.println("GRS80坐标系计算结果:"+GRS80 + "米"); |
| | | // System.out.println("GRS67坐标系计算结果:"+GRS67 + "米"); |
| | | // System.out.println("ANS坐标系计算结果:"+ANS + "米"); |
| | | // System.out.println("WGS72坐标系计算结果:"+WGS72 + "米"); |
| | | // System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米"); |
| | | // System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米"); |
| | | Map<String, Double> map = new HashMap<>(); |
| | | map.put("Sphere", Sphere); |
| | | map.put("WGS84", WGS84); |
| | | map.put("GRS80", GRS80); |
| | | map.put("GRS67", GRS67); |
| | | map.put("ANS", ANS); |
| | | map.put("WGS72", WGS72); |
| | | map.put("Clarke1858", Clarke1858); |
| | | map.put("Clarke1880", Clarke1880); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ |
| | | //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 |
| | | GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); |
| | | return geoCurve.getEllipsoidalDistance(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.dsh.competition.util; |
| | | |
| | | |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import java.lang.reflect.Array; |
| | | import java.math.BigDecimal; |
| | | import java.net.URISyntaxException; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | |
| | | /** |
| | | * 高频方法集合类 |
| | | */ |
| | | public class ToolUtil { |
| | | |
| | | /** |
| | | * 获取随机位数的字符串 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/8/24 14:09 |
| | | */ |
| | | public static String getRandomString(int length) { |
| | | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < length; i++) { |
| | | int number = random.nextInt(base.length()); |
| | | sb.append(base.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 判断一个对象是否是时间类型 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/4/18 12:55 |
| | | */ |
| | | public static String dateType(Object o) { |
| | | if (o instanceof Date) { |
| | | return DateUtil.getDay((Date) o); |
| | | } else { |
| | | return o.toString(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取异常的具体信息 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/3/30 9:21 |
| | | * @version 2.0 |
| | | */ |
| | | public static String getExceptionMsg(Exception e) { |
| | | StringWriter sw = new StringWriter(); |
| | | try { |
| | | e.printStackTrace(new PrintWriter(sw)); |
| | | } finally { |
| | | try { |
| | | sw.close(); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | return sw.getBuffer().toString().replaceAll("\\$", "T"); |
| | | } |
| | | |
| | | /** |
| | | * 比较两个对象是否相等。<br> |
| | | * 相同的条件有两个,满足其一即可:<br> |
| | | * 1. obj1 == null && obj2 == null; 2. obj1.equals(obj2) |
| | | * |
| | | * @param obj1 对象1 |
| | | * @param obj2 对象2 |
| | | * @return 是否相等 |
| | | */ |
| | | public static boolean equals(Object obj1, Object obj2) { |
| | | return (obj1 != null) ? (obj1.equals(obj2)) : (obj2 == null); |
| | | } |
| | | |
| | | /** |
| | | * 计算对象长度,如果是字符串调用其length函数,集合类调用其size函数,数组调用其length属性,其他可遍历对象遍历计算长度 |
| | | * |
| | | * @param obj 被计算长度的对象 |
| | | * @return 长度 |
| | | */ |
| | | public static int length(Object obj) { |
| | | if (obj == null) { |
| | | return 0; |
| | | } |
| | | if (obj instanceof CharSequence) { |
| | | return ((CharSequence) obj).length(); |
| | | } |
| | | if (obj instanceof Collection) { |
| | | return ((Collection<?>) obj).size(); |
| | | } |
| | | if (obj instanceof Map) { |
| | | return ((Map<?, ?>) obj).size(); |
| | | } |
| | | |
| | | int count; |
| | | if (obj instanceof Iterator) { |
| | | Iterator<?> iter = (Iterator<?>) obj; |
| | | count = 0; |
| | | while (iter.hasNext()) { |
| | | count++; |
| | | iter.next(); |
| | | } |
| | | return count; |
| | | } |
| | | if (obj instanceof Enumeration) { |
| | | Enumeration<?> enumeration = (Enumeration<?>) obj; |
| | | count = 0; |
| | | while (enumeration.hasMoreElements()) { |
| | | count++; |
| | | enumeration.nextElement(); |
| | | } |
| | | return count; |
| | | } |
| | | if (obj.getClass().isArray() == true) { |
| | | return Array.getLength(obj); |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 对象中是否包含元素 |
| | | * |
| | | * @param obj 对象 |
| | | * @param element 元素 |
| | | * @return 是否包含 |
| | | */ |
| | | public static boolean contains(Object obj, Object element) { |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (obj instanceof String) { |
| | | if (element == null) { |
| | | return false; |
| | | } |
| | | return ((String) obj).contains(element.toString()); |
| | | } |
| | | if (obj instanceof Collection) { |
| | | return ((Collection<?>) obj).contains(element); |
| | | } |
| | | if (obj instanceof Map) { |
| | | return ((Map<?, ?>) obj).values().contains(element); |
| | | } |
| | | |
| | | if (obj instanceof Iterator) { |
| | | Iterator<?> iter = (Iterator<?>) obj; |
| | | while (iter.hasNext()) { |
| | | Object o = iter.next(); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | if (obj instanceof Enumeration) { |
| | | Enumeration<?> enumeration = (Enumeration<?>) obj; |
| | | while (enumeration.hasMoreElements()) { |
| | | Object o = enumeration.nextElement(); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | if (obj.getClass().isArray() == true) { |
| | | int len = Array.getLength(obj); |
| | | for (int i = 0; i < len; i++) { |
| | | Object o = Array.get(obj, i); |
| | | if (equals(o, element)) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象是否不为空(新增) |
| | | * |
| | | * @param o String,List,Map,Object[],int[],long[] |
| | | * @return |
| | | */ |
| | | public static boolean isNotEmpty(Object o) { |
| | | return !isEmpty(o); |
| | | } |
| | | |
| | | /** |
| | | * 对象是否为空 |
| | | * |
| | | * @param o String,List,Map,Object[],int[],long[] |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("rawtypes") |
| | | public static boolean isEmpty(Object o) { |
| | | if (o == null) { |
| | | return true; |
| | | } |
| | | if (o instanceof String) { |
| | | if (o.toString().trim().equals("")) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof List) { |
| | | if (((List) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Map) { |
| | | if (((Map) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Set) { |
| | | if (((Set) o).size() == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof Object[]) { |
| | | if (((Object[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof int[]) { |
| | | if (((int[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } else if (o instanceof long[]) { |
| | | if (((long[]) o).length == 0) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象组中是否存在 Empty Object |
| | | * |
| | | * @param os 对象组 |
| | | * @return |
| | | */ |
| | | public static boolean isOneEmpty(Object... os) { |
| | | for (Object o : os) { |
| | | if (isEmpty(o)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 对象组中是否全是 Empty Object |
| | | * |
| | | * @param os |
| | | * @return |
| | | */ |
| | | public static boolean isAllEmpty(Object... os) { |
| | | for (Object o : os) { |
| | | if (!isEmpty(o)) { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 是否为数字 |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | public static boolean isNum(Object obj) { |
| | | try { |
| | | Integer.parseInt(obj.toString()); |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 如果为空, 则调用默认值 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static Object getValue(Object str, Object defaultValue) { |
| | | if (isEmpty(str)) { |
| | | return defaultValue; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 强转->string,并去掉多余空格 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String toStr(Object str) { |
| | | return toStr(str, ""); |
| | | } |
| | | |
| | | /** |
| | | * 强转->string,并去掉多余空格 |
| | | * |
| | | * @param str |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | public static String toStr(Object str, String defaultValue) { |
| | | if (null == str) { |
| | | return defaultValue; |
| | | } |
| | | return str.toString().trim(); |
| | | } |
| | | |
| | | /** |
| | | * 强转->int |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | // public static int toInt(Object value) { |
| | | // return toInt(value, -1); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->int |
| | | * |
| | | * @param obj |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | // public static int toInt(Object value, int defaultValue) { |
| | | // return Convert.toInt(value, defaultValue); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->long |
| | | * |
| | | * @param obj |
| | | * @return |
| | | */ |
| | | // public static long toLong(Object value) { |
| | | // return toLong(value, -1); |
| | | // } |
| | | |
| | | /** |
| | | * 强转->long |
| | | * |
| | | * @param obj |
| | | * @param defaultValue |
| | | * @return |
| | | */ |
| | | // public static long toLong(Object value, long defaultValue) { |
| | | // return Convert.toLong(value, defaultValue); |
| | | // } |
| | | // |
| | | // public static String encodeUrl(String url) { |
| | | // return URLKit.encode(url, CharsetKit.UTF_8); |
| | | // } |
| | | // |
| | | // public static String decodeUrl(String url) { |
| | | // return URLKit.decode(url, CharsetKit.UTF_8); |
| | | // } |
| | | |
| | | /** |
| | | * map的key转为小写 |
| | | * |
| | | * @param map |
| | | * @return Map<String , Object> |
| | | */ |
| | | public static Map<String, Object> caseInsensitiveMap(Map<String, Object> map) { |
| | | Map<String, Object> tempMap = new HashMap<>(); |
| | | for (String key : map.keySet()) { |
| | | tempMap.put(key.toLowerCase(), map.get(key)); |
| | | } |
| | | return tempMap; |
| | | } |
| | | |
| | | /** |
| | | * 获取map中第一个数据值 |
| | | * |
| | | * @param <K> Key的类型 |
| | | * @param <V> Value的类型 |
| | | * @param map 数据源 |
| | | * @return 返回的值 |
| | | */ |
| | | public static <K, V> V getFirstOrNull(Map<K, V> map) { |
| | | V obj = null; |
| | | for (Entry<K, V> entry : map.entrySet()) { |
| | | obj = entry.getValue(); |
| | | if (obj != null) { |
| | | break; |
| | | } |
| | | } |
| | | return obj; |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static StringBuilder builder(String... strs) { |
| | | final StringBuilder sb = new StringBuilder(); |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | return sb; |
| | | } |
| | | |
| | | /** |
| | | * 创建StringBuilder对象 |
| | | * |
| | | * @return StringBuilder对象 |
| | | */ |
| | | public static void builder(StringBuilder sb, String... strs) { |
| | | for (String str : strs) { |
| | | sb.append(str); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 去掉指定后缀 |
| | | * |
| | | * @param str 字符串 |
| | | * @param suffix 后缀 |
| | | * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串 |
| | | */ |
| | | public static String removeSuffix(String str, String suffix) { |
| | | if (isEmpty(str) || isEmpty(suffix)) { |
| | | return str; |
| | | } |
| | | |
| | | if (str.endsWith(suffix)) { |
| | | return str.substring(0, str.length() - suffix.length()); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 当前时间 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/7 21:56 |
| | | */ |
| | | public static String currentTime() { |
| | | return DateUtil.getTime(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 判断是否是windows操作系统 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/24 22:34 |
| | | */ |
| | | public static Boolean isWinOs() { |
| | | String os = System.getProperty("os.name"); |
| | | if (os.toLowerCase().startsWith("win")) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取临时目录 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/24 22:35 |
| | | */ |
| | | public static String getTempPath() { |
| | | return System.getProperty("java.io.tmpdir"); |
| | | } |
| | | |
| | | /** |
| | | * 把一个数转化为int |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/11/15 下午11:10 |
| | | */ |
| | | public static Integer toInt(Object val) { |
| | | if (val instanceof Double) { |
| | | BigDecimal bigDecimal = new BigDecimal((Double) val); |
| | | return bigDecimal.intValue(); |
| | | } else { |
| | | return Integer.valueOf(val.toString()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取项目路径 |
| | | */ |
| | | public static String getWebRootPath(String filePath) { |
| | | try { |
| | | String path = ToolUtil.class.getClassLoader().getResource("").toURI().getPath(); |
| | | path = path.replace("/WEB-INF/classes/", ""); |
| | | path = path.replace("/target/classes/", ""); |
| | | path = path.replace("file:/", ""); |
| | | if (ToolUtil.isEmpty(filePath)) { |
| | | return path; |
| | | } else { |
| | | return path + "/" + filePath; |
| | | } |
| | | } catch (URISyntaxException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取文件后缀名 不包含点 |
| | | */ |
| | | public static String getFileSuffix(String fileWholeName) { |
| | | if (ToolUtil.isEmpty(fileWholeName)) { |
| | | return "none"; |
| | | } |
| | | int lastIndexOf = fileWholeName.lastIndexOf("."); |
| | | return fileWholeName.substring(lastIndexOf + 1); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.competition.util.httpClinet; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.ssl.SSLContexts; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.security.KeyStore; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * http工具类 |
| | | */ |
| | | public class HttpClientUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); |
| | | |
| | | private static PoolingHttpClientConnectionManager connectionManager; |
| | | |
| | | |
| | | { |
| | | //1.创建连接池管理器 |
| | | connectionManager = new PoolingHttpClientConnectionManager(60000, |
| | | TimeUnit.MILLISECONDS); |
| | | connectionManager.setMaxTotal(1000); |
| | | connectionManager.setDefaultMaxPerRoute(50); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个httpClient对象 |
| | | */ |
| | | private static CloseableHttpClient getHttpCline(){ |
| | | return HttpClients.custom() |
| | | .setConnectionManager(connectionManager) |
| | | .disableAutomaticRetries() |
| | | .build(); |
| | | } |
| | | |
| | | private static RequestConfig getRequestConfig(){ |
| | | RequestConfig.Builder builder = RequestConfig.custom(); |
| | | builder.setSocketTimeout(60000)//3.1设置客户端等待服务端返回数据的超时时间 |
| | | .setConnectTimeout(30000)//3.2设置客户端发起TCP连接请求的超时时间 |
| | | .setExpectContinueEnabled(true) |
| | | .setConnectionRequestTimeout(30000);//3.3设置客户端从连接池获取链接的超时时间 |
| | | return builder.build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 创建一个POST请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | List<NameValuePair> list = new ArrayList<>(); |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | list.add(new BasicNameValuePair(key, null == params.get(key) ? null : params.get(key).toString())); |
| | | } |
| | | } |
| | | switch (contentType){ |
| | | case "form": |
| | | httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); |
| | | break; |
| | | case "json": |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String s =objectMapper.writeValueAsString(params); |
| | | httpPost.setEntity(new StringEntity(s, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), Charset.forName("UTF-8")))); |
| | | break; |
| | | } |
| | | return getHttpCline().execute(httpPost); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取get请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header) throws Exception{ |
| | | StringBuffer sb = new StringBuffer(); |
| | | String p = ""; |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | sb.append(key + "=" + params.get(key) + "&"); |
| | | } |
| | | p = "?" + sb.substring(0, sb.length() - 1); |
| | | } |
| | | HttpGet httpGet = new HttpGet(url + p); |
| | | httpGet.setConfig(getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpGet.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | return getHttpCline().execute(httpGet); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送http请求 |
| | | * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | * @param header 请求头 |
| | | * @param contentType 参数请求方式form/json |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | String randome = UUID.randomUUID().toString(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); |
| | | CloseableHttpResponse httpResponse = null; |
| | | switch (mothed){ |
| | | case "GET": |
| | | httpResponse = setGetHttpRequset(url, params, header); |
| | | break; |
| | | case "POST": |
| | | httpResponse = setPostHttpRequset(url, params, header, contentType); |
| | | break; |
| | | } |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送XML请求 |
| | | * @param url 请求地址 |
| | | * @param xml XML数据 |
| | | * @param header 自定义请求头 |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequsetXml(String url, String xml, Map<String, String> header) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpResponse httpResponse = getHttpCline().execute(httpPost); |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 请求https发送XML请求 |
| | | * @param url 接口路径 |
| | | * @param xml 内容 |
| | | * @param header 请求头 |
| | | * @param certPassword 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpClient httpCline = this.initCert(certPassword, certPath, certType); |
| | | CloseableHttpResponse httpResponse = httpCline.execute(httpPost); |
| | | String content = null; |
| | | if(httpResponse.getStatusLine().getStatusCode() == 200){ |
| | | content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | }else{ |
| | | content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); |
| | | } |
| | | this.close(httpResponse); |
| | | httpCline.close(); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化https对象(带证书) |
| | | * @param key 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @throws Exception |
| | | */ |
| | | private CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { |
| | | KeyStore keyStore = KeyStore.getInstance(certType); |
| | | InputStream inputStream = new FileInputStream(new File(certPath)); |
| | | try { |
| | | keyStore.load(inputStream, key.toCharArray()); |
| | | } finally { |
| | | inputStream.close(); |
| | | } |
| | | SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, key.toCharArray()).build(); |
| | | SSLConnectionSocketFactory sslsf = |
| | | new SSLConnectionSocketFactory(sslcontext, new String[] {"TLSv1"}, null, |
| | | SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); |
| | | return HttpClients.custom().setSSLSocketFactory(sslsf).build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭资源 |
| | | */ |
| | | private static void close(CloseableHttpResponse httpResponse){ |
| | | try { |
| | | if(null != httpResponse){ |
| | | EntityUtils.consume(httpResponse.getEntity());//此处高能,通过源码分析,由EntityUtils是否回收HttpEntity |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | if(null != httpResponse){ |
| | | httpResponse.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.util.httpClinet; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * http请求返回封装 |
| | | */ |
| | | @Data |
| | | public class HttpResult { |
| | | /** |
| | | * 返回状态码 |
| | | */ |
| | | private Integer code; |
| | | /** |
| | | * 返回结果 |
| | | */ |
| | | private String data; |
| | | |
| | | /** |
| | | * 返回封装结果 |
| | | * @param code |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static HttpResult getHttpResult(Integer code, String data){ |
| | | HttpResult httpResult = new HttpResult(); |
| | | httpResult.setCode(code); |
| | | httpResult.setData(data); |
| | | return httpResult; |
| | | } |
| | | } |
| | |
| | | feign.compression.response.enabled=true |
| | | |
| | | |
| | | mybatis-plus.configuration.map-underscore-to-camel-case=false |
| | |
| | | props1.setProperty("algorithm-expression", "t_course_package_payment$->{appUserId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_course_package_payment-inline", new AlgorithmConfiguration("INLINE", props1)); |
| | | result1.getKeyGenerators().put("t_course_package_payment-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result1); |
| | | |
| | | //分片规则配置 |
| | | result1.getTables().add(getCoursePackageStudentTableRuleConfiguration()); |
| | | ShardingRuleConfiguration result2 = new ShardingRuleConfiguration(); |
| | | result2.getTables().add(getCoursePackageStudentTableRuleConfiguration()); |
| | | Properties props2 = new Properties(); |
| | | props2.setProperty("algorithm-expression", "t_course_package_student$->{appUserId % 5 + 1}"); |
| | | result1.getShardingAlgorithms().put("t_course_package_student-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result1.getKeyGenerators().put("t_course_package_student-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | |
| | | linkedList.add(result1); |
| | | result2.getShardingAlgorithms().put("t_course_package_student-inline", new AlgorithmConfiguration("INLINE", props2)); |
| | | result2.getKeyGenerators().put("t_course_package_student-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result2); |
| | | |
| | | return linkedList; |
| | | } |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<CoursePackageListVo>> queryCourseList(@RequestBody CoursePackageList coursePackageList){ |
| | | public ResultUtil<List<CoursePackageListVo>> queryCourseList(CoursePackageList coursePackageList){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | @ApiOperation(value = "获取课程详情", tags = {"APP-课程列表"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "课包id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<CoursePackageInfo> queryCourseInfo(@RequestBody Integer id, @RequestBody String lon, @RequestBody String lat){ |
| | | public ResultUtil<CoursePackageInfo> queryCourseInfo(Integer id, String lon, String lat){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil paymentCourse(@RequestBody PaymentCourseVo paymentCourseVo){ |
| | | public ResultUtil paymentCourse(PaymentCourseVo paymentCourseVo){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.PostCourseVideo; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | |
| | | } |
| | | |
| | | courseVo.setCourseTime(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | String payType = tCoursePackagePayment.getPayType(); |
| | | Integer payType = tCoursePackagePayment.getPayType(); |
| | | BigDecimal cashPayment = tCoursePackagePayment.getCashPayment(); |
| | | double cashPaymentValue = cashPayment.doubleValue(); |
| | | Integer playPaiCoin = tCoursePackagePayment.getPlayPaiCoin(); |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | switch (payType) { |
| | | case "1;2": |
| | | case 1: |
| | | courseVo.setAmount(cashPaymentValue); |
| | | courseVo.setVipAmount(discountMember); |
| | | courseVo.setWpGold(playPaiCoin); |
| | | break; |
| | | case "1": |
| | | case 2: |
| | | courseVo.setAmount(cashPaymentValue); |
| | | courseVo.setVipAmount(discountMember); |
| | | break; |
| | | case "2": |
| | | case 3: |
| | | courseVo.setWpGold(playPaiCoin); |
| | | break; |
| | | } |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 课包id |
| | | */ |
| | | @TableField("coursePackageId") |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 消课凭证 |
| | | */ |
| | | @TableField("voucher") |
| | | private String voucher; |
| | | /** |
| | | * 消课数量 |
| | | */ |
| | | @TableField("cancelledClassesNumber") |
| | | private Integer cancelledClassesNumber; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 学员id |
| | | */ |
| | | @TableField("studentId") |
| | | private Integer studentId; |
| | | /** |
| | | * 课包id |
| | | */ |
| | | @TableField("coursePackageId") |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 课包购买记录id |
| | | */ |
| | | @TableField("coursePackagePaymentId") |
| | | private Integer coursePackagePaymentId; |
| | | /** |
| | | * 到课状态(0=否,1=是) |
| | | */ |
| | | @TableField("signInOrNot") |
| | | private Integer signInOrNot; |
| | | /** |
| | | * 预约状态(0=取消,1=预约) |
| | | */ |
| | | @TableField("reservationStatus") |
| | | private Integer reservationStatus; |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 课包id |
| | | */ |
| | | @TableField("coursePackageId") |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 上课日期 |
| | | */ |
| | | @TableField("courseDate") |
| | | private Date courseDate; |
| | | /** |
| | | * 周几 |
| | | */ |
| | | @TableField("courseWeek") |
| | | private Integer courseWeek; |
| | | /** |
| | | * 课后视频id |
| | | */ |
| | | @TableField("courseId") |
| | | private Integer courseId; |
| | | /** |
| | | * 上课日期 |
| | | */ |
| | | @TableField("postDate") |
| | | private Date postDate; |
| | | |
| | | @Override |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 课程名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 类型(1=课后练习,2=运动教学视频,3=器材教学视频) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 介绍 |
| | | */ |
| | | @TableField("introduce") |
| | | private String introduce; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | @TableField("coverDrawing") |
| | | private String coverDrawing; |
| | | /** |
| | | * 介绍图 |
| | | */ |
| | | @TableField("introductionDrawing") |
| | | private String introductionDrawing; |
| | | /** |
| | | * 课程视频 |
| | | */ |
| | | @TableField("courseVideo") |
| | | private String courseVideo; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | /** |
| | | * 课包类型id |
| | | */ |
| | | @TableField("coursePackageTypeId") |
| | | private Integer coursePackageTypeId; |
| | | /** |
| | | * 课包名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 上课场地id |
| | | */ |
| | | @TableField("siteId") |
| | | private Integer siteId; |
| | | /** |
| | | * 教练id |
| | | */ |
| | | @TableField("coachId") |
| | | private Integer coachId; |
| | | /** |
| | | * 最多预约人数 |
| | | */ |
| | | @TableField("maxSubscribeNumber") |
| | | private Integer maxSubscribeNumber; |
| | | /** |
| | | * 上课开始时间 |
| | | */ |
| | | @TableField("classStartTime") |
| | | private String classStartTime; |
| | | /** |
| | | * 上课结束时段 |
| | | */ |
| | | @TableField("classEndTime") |
| | | private String classEndTime; |
| | | /** |
| | | * 上课周,多个分号分隔 |
| | | */ |
| | | @TableField("classWeeks") |
| | | private String classWeeks; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | @TableField("coverDrawing") |
| | | private String coverDrawing; |
| | | /** |
| | | * 详情图 |
| | | */ |
| | | @TableField("detailDrawing") |
| | | private String detailDrawing; |
| | | /** |
| | | * 介绍图 |
| | | */ |
| | | @TableField("introduceDrawing") |
| | | private String introduceDrawing; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 支付方式(1=现金,2=玩湃币) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 有效天数 |
| | | */ |
| | | @TableField("validDays") |
| | | private Integer validDays; |
| | | /** |
| | | * 课程状态(1=未开始,2=进行中,3=已结束,4=已取消) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 审核状态(1=待审核,2=已同意,3=已拒绝) |
| | | */ |
| | | @TableField("auditStatus") |
| | | private Integer auditStatus; |
| | | /** |
| | | * 审核人id |
| | | */ |
| | | @TableField("auditUserId") |
| | | private Integer auditUserId; |
| | | /** |
| | | * 审核备注 |
| | | */ |
| | | @TableField("authRemark") |
| | | private String authRemark; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | |
| | |
| | | /** |
| | | * 课包id |
| | | */ |
| | | @TableField("coursePackageId") |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 课包价格规则id |
| | |
| | | /** |
| | | * 折扣类型(1=会员折扣,2=续课优惠,3=限时折扣,4=赠送课时) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 折扣优惠规则JSON ->详见 DiscountJsonDto类 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 审核状态(1=待审核,2=已通过,3=已拒绝) |
| | | */ |
| | | @TableField("auditStatus") |
| | | private Integer auditStatus; |
| | | /** |
| | | * 审核人id |
| | | */ |
| | | @TableField("auditUserId") |
| | | private Integer auditUserId; |
| | | /** |
| | | * 审核备注 |
| | | */ |
| | | @TableField("auditRemark") |
| | | private String auditRemark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.course.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 业务编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 学员id |
| | | */ |
| | | @TableField("studentId") |
| | | private Integer studentId; |
| | | /** |
| | | * 课包id |
| | | */ |
| | | @TableField("coursePackageId") |
| | | private Integer coursePackageId; |
| | | /** |
| | | * 支付方式(1=微信,2=支付宝,3=玩湃币) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 课时数 |
| | | */ |
| | | @TableField("classHours") |
| | | private Integer classHours; |
| | | /** |
| | | * 原价 |
| | | */ |
| | | @TableField("originalPrice") |
| | | private Double originalPrice; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("userCouponId") |
| | | private Long userCouponId; |
| | | /** |
| | | * 现金支付价格 |
| | | */ |
| | | @TableField("cashPayment") |
| | | private BigDecimal cashPayment; |
| | | /** |
| | | * 玩湃币价格 |
| | | */ |
| | | @TableField("playPaiCoin") |
| | | private Integer playPaiCoin; |
| | | /** |
| | | * 总课时 |
| | | */ |
| | | @TableField("totalClassHours") |
| | | private Integer totalClassHours; |
| | | /** |
| | | * 剩余课时 |
| | | */ |
| | | @TableField("laveClassHours") |
| | | private Integer laveClassHours; |
| | | /** |
| | | * 缺课次数 |
| | | */ |
| | | @TableField("absencesNumber") |
| | | private Integer absencesNumber; |
| | | /** |
| | | * 支付用户类型(1=用户,2=管理员) |
| | | */ |
| | | @TableField("payUserType") |
| | | private Integer payUserType; |
| | | /** |
| | | * 支付状态(1=待支付,2=已支付) |
| | | */ |
| | | @TableField("payStatus") |
| | | private Integer payStatus; |
| | | /** |
| | | * 第三方支付流水号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 支付用户id |
| | | */ |
| | | @TableField("payUserId") |
| | | private Integer payUserId; |
| | | /** |
| | | * 课程状态(1=正常,2=已退课) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 退课时间 |
| | | */ |
| | | @TableField("withdrawalTime") |
| | | private Date withdrawalTime; |
| | | /** |
| | | * 退课凭证 |
| | | */ |
| | | @TableField("certificate") |
| | | private String certificate; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | } |
| | |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 类型名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | } |
| | |
| | | feign.compression.response.enabled=true |
| | | |
| | | |
| | | mybatis-plus.configuration.map-underscore-to-camel-case=false |
| | |
| | | */ |
| | | public static String localSignUrl(String url, Map<String, Object> params, boolean urlEncode) { |
| | | Set<Map.Entry<String, Object>> entries = params.entrySet(); |
| | | if(entries.size() == 0){ |
| | | return ""; |
| | | } |
| | | |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | //Sort all incoming parameters in ascending order according to the ASCII code of the field name (lexicographic order). |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "位置(1=无学员,2=成为会员,3=我的券包,4=线上商城,5=本周福利,6=今日免费)", name = "position", dataType = "int", required = true), |
| | | }) |
| | | public String querySystemImg(@RequestBody Integer position){ |
| | | public String querySystemImg(Integer position){ |
| | | TImgConfig imgConfig = imgConfigService.getBaseMapper().selectOne(new QueryWrapper<TImgConfig>().eq("position", position)); |
| | | return imgConfig.getContent(); |
| | | } |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=运动安全公告书)", name = "type", dataType = "int", required = true) |
| | | }) |
| | | public ResultUtil<String> queryProtocol(@RequestBody Integer type){ |
| | | public ResultUtil<String> queryProtocol(Integer type){ |
| | | try { |
| | | Protocol protocol = protocolService.getBaseMapper().selectOne(new QueryWrapper<Protocol>().eq("type", type)); |
| | | return ResultUtil.success(protocol.getContent()); |
| | | return ResultUtil.success(null == protocol ? "" : protocol.getContent()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "门店id", name = "storeId", dataType = "int", required = true), |
| | | }) |
| | | public ResultUtil<List<StoreConfigVo>> queryStoreConfig(@RequestBody Integer storeId){ |
| | | public ResultUtil<List<StoreConfigVo>> queryStoreConfig(Integer storeId){ |
| | | if(null == storeId){ |
| | | return ResultUtil.paranErr("storeId"); |
| | | } |
| | |
| | | import com.dsh.other.feignclient.model.StoreInfo; |
| | | import com.dsh.other.feignclient.model.StoreLonLatList; |
| | | import com.dsh.other.model.BaseVo; |
| | | import com.dsh.other.model.QueryStoreList; |
| | | import com.dsh.other.service.StoreService; |
| | | import com.dsh.other.util.GDMapGeocodingUtil; |
| | | import com.dsh.other.util.ResultUtil; |
| | |
| | | |
| | | /** |
| | | * 获取门店列表 |
| | | * @param provinceCode |
| | | * @param cityCode |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/store/queryStoreList") |
| | | public List<Store> queryStoreList(@RequestBody String provinceCode, @RequestBody String cityCode){ |
| | | public List<Store> queryStoreList(QueryStoreList queryStoreList){ |
| | | try { |
| | | return storeService.queryStorsList(provinceCode, cityCode); |
| | | return storeService.queryStorsList(queryStoreList.getProvinceCode(), queryStoreList.getCityCode()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ArrayList<>(); |
| | |
| | | @PostMapping("/base/store/queryStoreLists") |
| | | @ApiOperation(value = "获取门店列表", tags = {"APP-加入玩湃", "APP-课程列表"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经纬", name = "lon", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "经纬", name = "lon", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), |
| | | }) |
| | | public ResultUtil<List<BaseVo>> queryStoreLists(@RequestBody String lon, @RequestBody String lat){ |
| | | if(ToolUtil.isEmpty(lon)){ |
| | | return ResultUtil.paranErr("lon"); |
| | | } |
| | | if(ToolUtil.isEmpty(lat)){ |
| | | return ResultUtil.paranErr("lat"); |
| | | } |
| | | public ResultUtil<List<BaseVo>> queryStoreLists(String lon, String lat){ |
| | | try { |
| | | List<BaseVo> baseVos = storeService.queryStoreLists(lon, lat); |
| | | return ResultUtil.success(baseVos); |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/store/queryStoreListByName") |
| | | public List<Store> queryStoreListByName(@RequestBody String name){ |
| | | public List<Store> queryStoreListByName(@RequestParam("name") String name){ |
| | | try { |
| | | List<Store> stores = storeService.list(new QueryWrapper<Store>().eq("state", 1).like("name", name)); |
| | | return stores; |
| | |
| | | package com.dsh.other.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 常见问题 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 答复内容 |
| | | */ |
| | | @TableField("answer") |
| | | private String answer; |
| | | |
| | | |
| | |
| | | package com.dsh.other.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 等级 |
| | | */ |
| | | @TableField("level") |
| | | private String level; |
| | | /** |
| | | * 满足条件值 |
| | | */ |
| | | @TableField("condition") |
| | | private String condition; |
| | | |
| | | |
| | |
| | | package com.dsh.other.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 功能名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 公告内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 0下架1上架 |
| | | */ |
| | | @TableField("upOrDown") |
| | | private Integer upOrDown; |
| | | |
| | | |
| | |
| | | package com.dsh.other.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | * @date 2023/6/14 14:59 |
| | | */ |
| | | @Data |
| | | @TableName |
| | | @TableName("t_protocol") |
| | | public class Protocol { |
| | | /** |
| | | * 主键 |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 门店名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 门店店长id |
| | | */ |
| | | @TableField("storeStaffId") |
| | | private Integer storeStaffId; |
| | | /** |
| | | * 城市管理员id |
| | | */ |
| | | @TableField("cityManagerId") |
| | | private Integer cityManagerId; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 详细地址 |
| | | */ |
| | | @TableField("address") |
| | | private String address; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @TableField("lat") |
| | | private String lat; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @TableField("lon") |
| | | private String lon; |
| | | /** |
| | | * 营业开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private String startTime; |
| | | /** |
| | | * 营业结束时间 |
| | | */ |
| | | @TableField("endTime") |
| | | private String endTime; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | @TableField("coverDrawing") |
| | | private String coverDrawing; |
| | | /** |
| | | * 实景图 |
| | | */ |
| | | @TableField("realPicture") |
| | | private String realPicture; |
| | | /** |
| | | * 门店介绍 |
| | | */ |
| | | @TableField("introduce") |
| | | private String introduce; |
| | | /** |
| | | * 福利图片 |
| | | */ |
| | | @TableField("welfarePicture") |
| | | private String welfarePicture; |
| | | /** |
| | | * 开始上课图片 |
| | | */ |
| | | @TableField("classPicture") |
| | | private String classPicture; |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @TableField("score") |
| | | private BigDecimal score; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | |
| | | |
| | |
| | | package com.dsh.other.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 门店id |
| | | */ |
| | | @TableField("storeId") |
| | | private Integer storeId; |
| | | /** |
| | | * 数据类型(1=报名玩湃课程,2=预约场地,3=报名赛事及活动,4=免费福利,5=线上课程积分,6=购买优惠门票,7=看视频得奖励,8=智慧球场) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 是否开启(0=否,1=是) |
| | | */ |
| | | @TableField("isOpen") |
| | | private Integer isOpen; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 背景图 |
| | | */ |
| | | @TableField("backgroundImage") |
| | | private String backgroundImage; |
| | | |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 位置(1=无学员,2=成为会员,3=我的券包,4=线上商城,5=本周福利,6=今日免费) |
| | | */ |
| | | @TableField("position") |
| | | private Integer position; |
| | | /** |
| | | * 图片配置JSON |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.other.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/28 9:08 |
| | | */ |
| | | @Data |
| | | public class QueryStoreList { |
| | | private String provinceCode; |
| | | |
| | | private String cityCode; |
| | | |
| | | public QueryStoreList() { |
| | | } |
| | | |
| | | public QueryStoreList(String provinceCode, String cityCode) { |
| | | this.provinceCode = provinceCode; |
| | | this.cityCode = cityCode; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public List<BaseVo> queryStoreLists(String lon, String lat) throws Exception { |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat); |
| | | List<BaseVo> list = new ArrayList<>(); |
| | | if(ToolUtil.isEmpty(lon) || ToolUtil.isEmpty(lat)){ |
| | | return list; |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat); |
| | | if(null != geocode){ |
| | | String provinceCode = geocode.get("provinceCode"); |
| | | String cityCode = geocode.get("cityCode"); |
| | |
| | | spring.main.allow-bean-definition-overriding=true |
| | | spring.flyway.enabled=false |
| | | |
| | | |
| | | # \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0479\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD |
| | | feign.compression.request.mime-types=text/xml,application/xml,application/json |
| | | feign.compression.request.min-request-size=4096 |
| | |
| | | feign.compression.response.enabled=true |
| | | |
| | | |
| | | |