| | |
| | | @ApiImplicitParam(name = "code", value = "扫码结果", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Map<String, String>> getDeviceInformation(@RequestBody String code){ |
| | | public ResultUtil<Map<String, String>> getDeviceInformation(String code){ |
| | | /** |
| | | * { |
| | | * "scan_type": 0, // 扫码类型:1000:游戏,1001:课程,1002:场地 |
| | |
| | | @ApiImplicitParam(name = "lat", value = "纬度", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<WorldCupInfo> getWorldCupInfo(@RequestBody Integer id, @RequestBody String lon, @RequestBody String lat){ |
| | | public ResultUtil<WorldCupInfo> getWorldCupInfo(Integer id,String lon, String lat){ |
| | | WorldCupInfo worldCupInfo = worldCupService.getWorldCupInfo(id, lon, lat); |
| | | return ResultUtil.success(worldCupInfo); |
| | | } |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<EntrantRankVo> getEntrantRank(EntrantRank entrantRank){ |
| | | EntrantRankVo entrantRank1 = worldCupCompetitorService.getEntrantRank(entrantRank); |
| | | return ResultUtil.success(entrantRank1); |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.success(); |
| | | } |
| | | entrantRank.setAppUserId(uid); |
| | | EntrantRankVo entrantRank1 = worldCupCompetitorService.getEntrantRank(entrantRank); |
| | | return ResultUtil.success(entrantRank1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | @ApiOperation(value = "获取已报名世界杯详情【2.0】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "lon", value = "经度", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "lat", value = "纬度", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<MyWorldCupInfo> getMyWorldCupInfo(String id){ |
| | | MyWorldCupInfo myWorldCupInfo = worldCupPaymentParticipantService.getMyWorldCupInfo(id); |
| | | public ResultUtil<MyWorldCupInfo> getMyWorldCupInfo(String id, String lon, String lat){ |
| | | MyWorldCupInfo myWorldCupInfo = worldCupPaymentParticipantService.getMyWorldCupInfo(id, lon, lat); |
| | | return ResultUtil.success(myWorldCupInfo); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/worldCup/editWorldCup") |
| | | public Integer editWorldCup(@RequestBody WorldCup worldCup){ |
| | | worldCupService.save(worldCup); |
| | | worldCupService.updateById(worldCup); |
| | | return worldCup.getId(); |
| | | } |
| | | |
| | |
| | | @TableField("winIntegral") |
| | | private Integer winIntegral; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 参赛地址 |
| | | */ |
| | | @TableField("address") |
| | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 参赛编号 |
| | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 支付流水号 |
| | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 世界杯id |
| | |
| | | */ |
| | | @TableField("participantId") |
| | | private Integer participantId; |
| | | /** |
| | | * 是否已参赛(0=否,1=是) |
| | | */ |
| | | @TableField("alreadyEntered") |
| | | private Integer alreadyEntered; |
| | | } |
| | |
| | | * @param cityCode 城市code |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/appUser/getAppUserIds") |
| | | @PostMapping("/appUser/getAppUserIds") |
| | | List<Integer> getAppUserIds(String cityCode); |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | private String age; |
| | | @ApiModelProperty("报名性别(0=全部,1=男,2=女)") |
| | | private Integer gender; |
| | | @ApiModelProperty("省") |
| | | private String province; |
| | | @ApiModelProperty("市") |
| | | private String city; |
| | | @ApiModelProperty("参赛地址") |
| | | private String address; |
| | | @ApiModelProperty("参与赛点") |
| | | private String stores; |
| | | @ApiModelProperty("参赛人员列表") |
| | | private List<ParticipantVo> participants; |
| | | @ApiModelProperty("支付方式(0=免费,1=微信,2=支付宝,3=玩湃币,4=课时)") |
| | | private Integer payType; |
| | | @ApiModelProperty("比赛费用单价") |
| | | private Double unitPrice; |
| | | @ApiModelProperty("支付费用") |
| | |
| | | private Integer status; |
| | | @ApiModelProperty("是否可取消(0=否,1=是)") |
| | | private Integer revocable; |
| | | @ApiModelProperty("门店信息") |
| | | private List<Map<String, Object>> storeInfos; |
| | | } |
| | |
| | | private String age; |
| | | @ApiModelProperty("报名性别(0=全部,1=男,2=女)") |
| | | private Integer gender; |
| | | @ApiModelProperty("省") |
| | | private String province; |
| | | @ApiModelProperty("市") |
| | | private String city; |
| | | @ApiModelProperty("参赛地址") |
| | | private String address; |
| | | @ApiModelProperty("参与赛点") |
| | |
| | | public class WorldCupListVo { |
| | | @ApiModelProperty("世界杯id") |
| | | private String id; |
| | | private Integer worldCupId; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("报名截止时间") |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | MyWorldCupInfo getMyWorldCupInfo(String id); |
| | | MyWorldCupInfo getMyWorldCupInfo(String id, String lon, String lat); |
| | | |
| | | |
| | | /** |
| | |
| | | import com.dsh.communityWorldCup.entity.WorldCup; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPayment; |
| | | import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant; |
| | | import com.dsh.communityWorldCup.entity.WorldCupStore; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | | import com.dsh.communityWorldCup.feignclient.other.StoreClient; |
| | | import com.dsh.communityWorldCup.feignclient.other.model.Store; |
| | | import com.dsh.communityWorldCup.mapper.WorldCupPaymentParticipantMapper; |
| | | import com.dsh.communityWorldCup.model.MyWorldCupInfo; |
| | | import com.dsh.communityWorldCup.model.MyWorldCupList; |
| | |
| | | import com.dsh.communityWorldCup.service.IWorldCupPaymentParticipantService; |
| | | import com.dsh.communityWorldCup.service.IWorldCupPaymentService; |
| | | import com.dsh.communityWorldCup.service.IWorldCupService; |
| | | import com.dsh.communityWorldCup.service.IWorldCupStoreService; |
| | | import com.dsh.communityWorldCup.util.GeodesyUtil; |
| | | import com.dsh.communityWorldCup.util.ToolUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | 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.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Autowired |
| | | private IWorldCupService worldCupService; |
| | | |
| | | @Autowired |
| | | private IWorldCupPaymentParticipantService worldCupPaymentParticipantService; |
| | | |
| | | @Autowired |
| | | private IWorldCupStoreService worldCupStoreService; |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | |
| | | |
| | |
| | | int pageNo = (myWorldCupList.getPageNo() - 1) * myWorldCupList.getPageSize(); |
| | | myWorldCupList.setPageNo(pageNo); |
| | | myWorldCupList.setIsStudent(myWorldCupList.getIsStudent() == 0 ? 2 : 1); |
| | | return this.baseMapper.getMyWorldCupList(myWorldCupList); |
| | | List<WorldCupListVo> myWorldCupList1 = this.baseMapper.getMyWorldCupList(myWorldCupList); |
| | | for (WorldCupListVo worldCupListVo : myWorldCupList1) { |
| | | Integer worldCupId = worldCupListVo.getWorldCupId(); |
| | | List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCupId).eq("payStatus", 2).eq("state", 1)); |
| | | List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); |
| | | Integer heat = worldCupListVo.getHeat(); |
| | | if(collect.size() > 0){ |
| | | int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect)); |
| | | heat += count; |
| | | } |
| | | worldCupListVo.setHeat(heat); |
| | | } |
| | | return myWorldCupList1; |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MyWorldCupInfo getMyWorldCupInfo(String id) { |
| | | public MyWorldCupInfo getMyWorldCupInfo(String id, String lon, String lat) { |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = this.getById(id); |
| | | Integer worldCupId = worldCupPaymentParticipant.getWorldCupId(); |
| | | WorldCupPayment worldCupPayment = worldCupPaymentService.getById(worldCupPaymentParticipant.getWorldCupPaymentId()); |
| | |
| | | myWorldCupInfo.setExpense(worldCupPayment.getAmount().doubleValue()); |
| | | myWorldCupInfo.setStatus(worldCup.getStatus()); |
| | | myWorldCupInfo.setRevocable(1); |
| | | myWorldCupInfo.setProvince(worldCup.getProvince()); |
| | | myWorldCupInfo.setCity(worldCup.getCity()); |
| | | myWorldCupInfo.setPayType(worldCupPayment.getPayType()); |
| | | //开始前一天不能取消 |
| | | if(worldCup.getStartTime().getTime() < System.currentTimeMillis() + 86400000L){ |
| | | myWorldCupInfo.setRevocable(0); |
| | |
| | | } |
| | | |
| | | myWorldCupInfo.setParticipants(datas); |
| | | List<WorldCupStore> worldCupStores = worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("worldCupId", id)); |
| | | ArrayList<Map<String, Object>> objects = new ArrayList<>(); |
| | | for (WorldCupStore worldCupStore : worldCupStores) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | Store store = storeClient.queryStoreById(worldCupStore.getStoreId()); |
| | | map.put("name", store.getName()); |
| | | |
| | | |
| | | String str = store.getAddress(); |
| | | str = str.substring(str.indexOf("省") + 1); |
| | | |
| | | // 去掉第一个“市”及之前的字符串 |
| | | str = str.substring(str.indexOf("市") + 1); |
| | | |
| | | // 去掉第一个“区”及之前的字符串 |
| | | str = str.substring(str.indexOf("区") + 1); |
| | | |
| | | map.put("address", str); |
| | | map.put("storeLon", store.getLon()); |
| | | map.put("storeLat", store.getLat()); |
| | | map.put("storeCoverDrawing", 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(); |
| | | map.put("distance", wgs84); |
| | | } |
| | | objects.add(map); |
| | | } |
| | | worldCupInfo.setStoreInfos(objects); |
| | | return myWorldCupInfo; |
| | | } |
| | | |
| | |
| | | if(null == worldCup){ |
| | | return ResultUtil.error("报名数据异常"); |
| | | } |
| | | if(System.currentTimeMillis() > worldCup.getRegistrationClosingTime().getTime()){ |
| | | if(null != worldCup.getRegistrationClosingTime() && System.currentTimeMillis() > worldCup.getRegistrationClosingTime().getTime()){ |
| | | return ResultUtil.error("报名时间已结束,无法完成报名"); |
| | | } |
| | | if(System.currentTimeMillis() > worldCup.getEndTime().getTime()){ |
| | |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | if(isStudent == 1){ |
| | | TStudent tStudent = studentClient.queryById(id); |
| | | if(worldCup.getStartAge() > Integer.valueOf(sdf.format(tStudent.getBirthday()))){ |
| | | if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())))){ |
| | | return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求"); |
| | | } |
| | | if(worldCup.getEndAge() < Integer.valueOf(sdf.format(tStudent.getBirthday()))){ |
| | | if(worldCup.getEndAge() < (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())))){ |
| | | return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求"); |
| | | } |
| | | }else{ |
| | | Participant participant = participantClient.getParticipant(id); |
| | | if(worldCup.getStartAge() > Integer.valueOf(sdf.format(participant.getBirthday()))){ |
| | | if(worldCup.getStartAge() > (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())))){ |
| | | return ResultUtil.error("【" + participant.getName() + "】年龄不符合要求"); |
| | | } |
| | | if(worldCup.getEndAge() < Integer.valueOf(sdf.format(participant.getBirthday()))){ |
| | | if(worldCup.getEndAge() < (Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())))){ |
| | | return ResultUtil.error("【" + participant.getName() + "】年龄不符合要求"); |
| | | } |
| | | } |
| | |
| | | worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | return ResultUtil.success(); |
| | |
| | | worldCupPayment.setPayStatus(2); |
| | | worldCupPayment.setPayTime(new Date()); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | |
| | | //添加报名明细 |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | //是否是学员(0=否,1=是) |
| | | Integer isStudent = jsonObject.getInteger("isStudent"); |
| | | |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = new WorldCupPaymentParticipant(); |
| | | worldCupPaymentParticipant.setWorldCupId(paymentWorldCup.getId()); |
| | | worldCupPaymentParticipant.setWorldCupPaymentId(worldCupPayment.getId()); |
| | | worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | }else{ |
| | |
| | | worldCupPaymentParticipant.setAppUserId(paymentWorldCup.getUid()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | return ResultUtil.success(); |
| | |
| | | worldCupPaymentParticipant.setAppUserId(worldCupPayment.getAppUserId()); |
| | | worldCupPaymentParticipant.setParticipantType(isStudent == 0 ? 2 : 1); |
| | | worldCupPaymentParticipant.setParticipantId(id); |
| | | worldCupPaymentParticipant.setAlreadyEntered(0); |
| | | worldCupPaymentParticipantService.save(worldCupPaymentParticipant); |
| | | } |
| | | return ResultUtil.success(); |
| | |
| | | DATE_FORMAT(a.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | CONCAT(a.startAge, '-', a.endAge) as age, |
| | | a.gender, |
| | | a.province, |
| | | a.city, |
| | | a.address, |
| | | a.cash, |
| | | a.paiCoin, |
| | |
| | | <select id="getMyWorldCupList" resultType="com.dsh.communityWorldCup.model.WorldCupListVo"> |
| | | select |
| | | a.id, |
| | | b.worldCupId, |
| | | c.name, |
| | | DATE_FORMATc.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | DATE_FORMAT(c.registrationClosingTime, '%Y-%m-%d %H:%i') as registrationClosingTime, |
| | | CONCAT(c.startAge, '-', c.endAge) as age, |
| | | c.coverImg, |
| | | c.intro as content, |
| | | c.lon, |
| | | c.lat, |
| | | ifnull(d.num, 0) + c.basePeople as heat |
| | | c.basePeople as heat |
| | | from t_world_cup_payment_participant a |
| | | left join t_world_cup_payment b on (a.worldCupPaymentId = b.id) |
| | | left join t_world_cup c on (b.worldCupId = c.id) |
| | | left join (select worldCupId, count(*) as num from t_world_cup_payment_participant where worldCupPaymentId in (select id from t_world_cup_payment where payStatus = 2 and refundTime is null and state = 1) group by worldCupId) d on (c.id = d.worldCupId) |
| | | where a.participantType = #{item.isStudent} and a.participantId = #{item.id} and b.payStatus = 2 and b.refundTime is null and b.state = 1 |
| | | <if test="null != item.state"> |
| | | and c.status = #{item.state} |
| | |
| | | if (null != student) { |
| | | Integer integer = coursePackagePaymentClient.queryResidueClassHour(student.getId()); |
| | | participantVo.setResidueClassHour(integer); |
| | | participantVo.setIsStudent(1); |
| | | |
| | | } else { |
| | | participantVo.setResidueClassHour(0); |
| | |
| | | continue; |
| | | } |
| | | linkedHashMap.put(participant.getIdcard(), participantVo); |
| | | // listVo.add(participantVo); |
| | | |
| | | } |
| | | |