|
|
@@ -663,39 +663,6 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
if (ObjectUtil.isNull(activityEntity)) {
|
|
|
return R.error("该活动已删除不可报名!");
|
|
|
}
|
|
|
- if (NumberUtil.equals(NumberUtil.toBigDecimal(activityEntity.getIsNeedVip()), BigDecimal.ONE)) {
|
|
|
- // if (!"1".equals(member.getCardtype()) && !"4".equals(member.getCardtype()) &&
|
|
|
- // !"5".equals(member.getCardtype())) {
|
|
|
- // return R.error(504, "会员级别权限不足!需缴费报名!");
|
|
|
- // }
|
|
|
-
|
|
|
- /*if ("5".equals(member.getCardtype())){
|
|
|
- //判断潮玩会员是否还有免费次数
|
|
|
- String actFree = member.getActFree();
|
|
|
- if ("0".equals(actFree)){
|
|
|
- return R.error(510,"当前用户免费次数已用完");
|
|
|
- } else {
|
|
|
- member.setActFree("0");
|
|
|
- memberInfoDao.updateById(member);
|
|
|
- }
|
|
|
- }*/
|
|
|
- // if (!member.getCardtype().equals("1")) {
|
|
|
- // return R.error("您没有开通会员!无法报名!");
|
|
|
- // }
|
|
|
- // if (StringUtils.isNotBlank(member.getEndtime())) {
|
|
|
- // try {
|
|
|
- // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- // Date date = sdf.parse(member.getEndtime());
|
|
|
- // if (date.getTime() < now.getTime()) {
|
|
|
- // return R.error(521, "会员已到期!无法报名!");
|
|
|
- // }
|
|
|
- // } catch (ParseException e) {
|
|
|
- // e.printStackTrace();
|
|
|
- // return R.error(521, "会员到期时间格式设置不正确!请联系管理员!");
|
|
|
- // }
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
R r = MemberUtils.isYF(member);
|
|
|
if ((Integer) r.get("code") != 0) {
|
|
|
return R.error(503, "请完善资料后进行报名操作");
|
|
|
@@ -717,30 +684,6 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /****************/
|
|
|
-
|
|
|
- // 当天
|
|
|
- /*Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(now);
|
|
|
- int now_year = calendar.get(Calendar.YEAR);
|
|
|
- int now_month = calendar.get(Calendar.MONTH) + 1;
|
|
|
- int now_day = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
- calendar.add(Calendar.DATE,1);
|
|
|
- int tom_year = calendar.get(Calendar.YEAR);
|
|
|
- int tom_month = calendar.get(Calendar.MONTH) + 1;
|
|
|
- int tom_day = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
- int c1 = activityStuDao.selectCount(
|
|
|
- new QueryWrapper<ActivityStuEntity>()
|
|
|
- .eq("is_delete", 0)
|
|
|
- .eq("status", "01")
|
|
|
- .eq("stu_id", stuId)
|
|
|
- .ge("create_time", now_year + "-" + (now_month < 10 ? "0" + now_month : now_month) + "-" + (now_day < 10 ? "0" + now_day : now_day) + " 00:00:00")
|
|
|
- .lt("create_time", tom_year + "-" + (tom_month < 10 ? "0" + tom_month : tom_month) + "-" + (tom_day < 10 ? "0" + tom_day : tom_day) + " 00:00:00")
|
|
|
- );
|
|
|
- if (c1>0){
|
|
|
- return R.error(510,"当天只可报名一个活动!");
|
|
|
- }*/
|
|
|
-
|
|
|
// 时间段
|
|
|
ActivityEntity activity = this.getById(actId);
|
|
|
if (activity == null) {
|
|
|
@@ -763,74 +706,6 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
if (one != null) {
|
|
|
return R.error(505, "请勿重复报名!");
|
|
|
}
|
|
|
- /****** if冻结 ******/
|
|
|
- /*if (StringUtils.isNotBlank(member.getFreezeTime())){
|
|
|
- //查询超时时间
|
|
|
- WgFillInfoEntity wgFill = wgFillInfoDao.selectById(1);
|
|
|
- int time = 0;
|
|
|
- if (wgFill.getFreezeTime() != null){
|
|
|
- time = wgFill.getFreezeTime();
|
|
|
- }
|
|
|
-
|
|
|
- long history;
|
|
|
- try {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- history = sdf.parse(member.getFreezeTime()).getTime();
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- history = now.getTime();
|
|
|
- }
|
|
|
- long sub = now.getTime()-history;
|
|
|
- if (sub < time*3600*1000){
|
|
|
- sub = time*3600*1000 - sub;
|
|
|
- long hour = sub/(60*60*1000);
|
|
|
- long minute = (sub - hour*60*60*1000)/(60*1000);
|
|
|
- long second = (sub - hour*60*60*1000 - minute*60*1000)/1000;
|
|
|
- return R.error(507,"您还有"+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+"才可再次报名当前活动!");
|
|
|
- } else {
|
|
|
- member.setFreezeTime("");
|
|
|
- memberInfoDao.updateById(member);
|
|
|
- }
|
|
|
- }*/
|
|
|
- /****** else冻结 ******/
|
|
|
- /*ActivityStuEntity two = activityStuDao.selectOne(
|
|
|
- new QueryWrapper<ActivityStuEntity>()
|
|
|
- .eq("activity_id", actId)
|
|
|
- .eq("stu_id", stuId)
|
|
|
- .eq("status","02")
|
|
|
- .eq("is_delete", 0)
|
|
|
- .orderByDesc("create_time")
|
|
|
- .last("limit 1")
|
|
|
- );
|
|
|
- if (two != null){
|
|
|
- //查询超时时间
|
|
|
- WgFillInfoEntity wgFill = wgFillInfoDao.selectById(1);
|
|
|
- int time = 0;
|
|
|
- if (wgFill.getFreezeTime() != null){
|
|
|
- time = wgFill.getFreezeTime();
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(two.getCancelTime())){
|
|
|
- return R.error(506,"数据传输错误-002");
|
|
|
- }
|
|
|
- long history;
|
|
|
- try {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- history = sdf.parse(two.getCancelTime()).getTime();
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- history = now.getTime();
|
|
|
- }
|
|
|
- long sub = now.getTime()-history;
|
|
|
- if (sub < time*3600*1000 && sub >10*60*1000){
|
|
|
- *//*sub = time*3600*1000 - sub;
|
|
|
- long hour = sub/(60*60*1000);
|
|
|
- long minute = (sub - hour*60*60*1000)/(60*1000);
|
|
|
- long second = (sub - hour*60*60*1000 - minute*60*1000)/1000;
|
|
|
- return R.error(507,"您还有"+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+"才可再次报名当前活动!");*//*
|
|
|
- return R.error(507,"账户处在冻结阶段,请在"+time+"小时后,再回到此页面报名活动");
|
|
|
- }
|
|
|
- }*/
|
|
|
- /****************/
|
|
|
// 检查人数
|
|
|
Integer count = activityStuDao.selectCount(
|
|
|
new QueryWrapper<ActivityStuEntity>().eq("activity_id", actId).eq("is_delete", 0).eq("status", "01"));
|
|
|
@@ -866,14 +741,6 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
activityService.updateById(activity);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // Date date = DateUtils.stringToDate(activity.getEndTime(), "yyyy-MM-dd HH:mm");
|
|
|
- // String expirationTime = String.valueOf(date.getTime() - System.currentTimeMillis());
|
|
|
- // rabbitTemplate.convertAndSend(QueueConstant.ACT_MS_QUEUE, activityStu.getId().toString(), message -> {
|
|
|
- // message.getMessageProperties().setExpiration(expirationTime);
|
|
|
- // return message;
|
|
|
- // });
|
|
|
-
|
|
|
//TODO 更新用户活动次数
|
|
|
memberInfoDao.updateActivityFrequency(activityStu.getStuId(), 1, true);
|
|
|
|
|
|
@@ -902,22 +769,6 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
&& !"5".equals(member.getCardtype())) {
|
|
|
return R.error(504, "会员级别权限接口调取错误!");
|
|
|
}
|
|
|
-
|
|
|
- // if ("5".equals(member.getCardtype())) {
|
|
|
- // //判断潮玩会员是否还有免费次数,有免费次数
|
|
|
- // String actFree = member.getActFree();
|
|
|
- // if ("1".equals(actFree)) {
|
|
|
- // //直接走免费报名接口
|
|
|
- // R register = register(params);
|
|
|
- // Integer code = (Integer) register.get("code");
|
|
|
- // if (0 == code) {
|
|
|
- // member.setActFree("0");
|
|
|
- // memberInfoDao.updateById(member);
|
|
|
- // }
|
|
|
- // return register;
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
if (StringUtils.isNotBlank(member.getEndtime())) {
|
|
|
try {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
@@ -950,31 +801,6 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
return R.error(507, "账户处在冻结阶段,请等待解冻后,再回到此页面报名");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /****************/
|
|
|
-
|
|
|
- // 当天
|
|
|
- /*Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(now);
|
|
|
- int now_year = calendar.get(Calendar.YEAR);
|
|
|
- int now_month = calendar.get(Calendar.MONTH) + 1;
|
|
|
- int now_day = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
- calendar.add(Calendar.DATE,1);
|
|
|
- int tom_year = calendar.get(Calendar.YEAR);
|
|
|
- int tom_month = calendar.get(Calendar.MONTH) + 1;
|
|
|
- int tom_day = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
- int c1 = activityStuDao.selectCount(
|
|
|
- new QueryWrapper<ActivityStuEntity>()
|
|
|
- .eq("is_delete", 0)
|
|
|
- .eq("status", "01")
|
|
|
- .eq("stu_id", stuId)
|
|
|
- .ge("create_time", now_year + "-" + (now_month < 10 ? "0" + now_month : now_month) + "-" + (now_day < 10 ? "0" + now_day : now_day) + " 00:00:00")
|
|
|
- .lt("create_time", tom_year + "-" + (tom_month < 10 ? "0" + tom_month : tom_month) + "-" + (tom_day < 10 ? "0" + tom_day : tom_day) + " 00:00:00")
|
|
|
- );
|
|
|
- if (c1>0){
|
|
|
- return R.error(510,"当天只可报名一个活动!");
|
|
|
- }*/
|
|
|
-
|
|
|
// 时间段
|
|
|
ActivityEntity activity = this.getById(actId);
|
|
|
if (activity == null) {
|
|
|
@@ -983,78 +809,31 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
if (StringUtils.isBlank(activity.getStartTime()) || StringUtils.isBlank(activity.getStartTime())) {
|
|
|
return R.error(512, "活动时间信息不全!无法报名!");
|
|
|
}
|
|
|
- /*Integer c2 = activityStuDao.checkActivityRegister(stuId,DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss"),activity.getStartTime(),activity.getEndTime());
|
|
|
- if (c2>0){
|
|
|
- return R.error(513,"当前时间段已参加其他活动!无法报名!");
|
|
|
- }*/
|
|
|
|
|
|
//TODO 学生在一个时间只能去做一个工作或活动
|
|
|
this.verifyExistRepeat(stuId, activity);
|
|
|
member.setWorkFrequency(null);
|
|
|
member.setActivityFrequency(null);
|
|
|
|
|
|
+ ActivityStuEntity one = activityStuDao.selectOne(new QueryWrapper<ActivityStuEntity>().eq("activity_id", actId)
|
|
|
+ .eq("stu_id", stuId).eq("`status`", "01").eq("is_delete", 0));
|
|
|
+ if (one != null) {
|
|
|
+ return R.error(505, "请勿重复报名!");
|
|
|
+ }
|
|
|
+ // 检查人数
|
|
|
+ Integer count = activityStuDao.selectCount(
|
|
|
+ new QueryWrapper<ActivityStuEntity>().eq("activity_id", actId).eq("is_delete", 0).eq("status", "01"));
|
|
|
+ if (count >= activity.getWillnum()) {
|
|
|
+ return R.error(508, "当前活动已报满!");
|
|
|
+ }
|
|
|
+
|
|
|
Integer isNeedVip = activity.getIsNeedVip();
|
|
|
BigDecimal money = activity.getMoney();
|
|
|
- //qyh_points_config
|
|
|
- PointsConfigEntity pointsConfig = pointsConfigService.getOne();
|
|
|
- if (pointsConfig == null){
|
|
|
- try {
|
|
|
- // 支付信息
|
|
|
- ActivityStuPayinfoEntity activityStuPayinfoEntity = new ActivityStuPayinfoEntity();
|
|
|
- activityStuPayinfoEntity.setActivityId(actId);
|
|
|
- activityStuPayinfoEntity.setStuId(stuId);
|
|
|
- activityStuPayinfoEntity.setCreateTime(DateFormatUtils.format(now, "yyyy-MM-dd HH:mm:ss"));
|
|
|
- activityStuPayinfoEntity.setPayStatus(0);
|
|
|
- activityStuPayinfoEntity.setPayMoney(money);
|
|
|
- activityStuPayinfoEntity.setPayNo(MD5Util.getUUID16());
|
|
|
- activityStuPayinfoService.save(activityStuPayinfoEntity);
|
|
|
+ BigDecimal points = activity.getPoints();
|
|
|
|
|
|
- // 允许报名 ,调起微信
|
|
|
- String notifyUrl = PropertiesParameter.PROP.getProperty("pay.notify.activity.url");
|
|
|
- String openid = member.getOpenid();
|
|
|
- OrderBusinessTypeEnum typeEnum = OrderBusinessTypeEnum.PURCHASE_ACTIVITY;
|
|
|
- PayForBO bo = new PayForBO();
|
|
|
- bo.setNotifyUrl(notifyUrl);
|
|
|
- bo.setOpenid(openid);
|
|
|
- bo.setMemberId(stuId);
|
|
|
- bo.setBusinessId(actId);
|
|
|
- bo.setBusinessType(typeEnum.value());
|
|
|
- bo.setBuyContent(activity.getTitle());
|
|
|
- bo.setPayTime(LocalDateTime.now());
|
|
|
- bo.setPrice(money);
|
|
|
- bo.setActuallyPaid(money);
|
|
|
- bo.setUsePoints(0);
|
|
|
- bo.setPointsDeduction(BigDecimal.ZERO);
|
|
|
- bo.setCode(TaskConfigEnum.ACTIVITY.code());
|
|
|
- return R.ok().put("map", orderService.payFor(bo));
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return R.error("微信支付异常!");
|
|
|
- }
|
|
|
- }
|
|
|
//获取会员总积分
|
|
|
Integer totalScore = scoreStuService.getTotalScore(stuId);
|
|
|
- Integer pointsDeduction = pointsConfig.getPointsDeduction();
|
|
|
- BigDecimal actualPayment = BigDecimal.ZERO;
|
|
|
- int usePoints = 0;
|
|
|
- // 当前价格所需要的积分
|
|
|
- Integer priceIntegral =
|
|
|
- NumberUtil.mul(money, NumberUtil.toBigDecimal(pointsDeduction)).intValue();
|
|
|
- if (NumberUtil.isGreater(NumberUtil.toBigDecimal(totalScore),
|
|
|
- NumberUtil.toBigDecimal(priceIntegral))) {
|
|
|
- usePoints = priceIntegral;
|
|
|
- //BigDecimal deductiblePrice =
|
|
|
- // NumberUtil.div(priceIntegral, pointsDeduction, 0, RoundingMode.FLOOR);
|
|
|
- //actualPayment = NumberUtil.sub(money, deductiblePrice);
|
|
|
- } else {
|
|
|
- BigDecimal deductiblePrice =
|
|
|
- NumberUtil.div(totalScore, pointsDeduction, 0, RoundingMode.FLOOR);
|
|
|
- usePoints = NumberUtil.mul(deductiblePrice, pointsDeduction).intValue();
|
|
|
- //actualPayment = NumberUtil.sub(money, deductiblePrice);
|
|
|
- }
|
|
|
- Integer isDeductiblePrice = MapUtil.getInt(params, "isDeductiblePrice");
|
|
|
- // params.put("usePoints", usePoints);
|
|
|
- if (NumberUtil.isLessOrEqual(money, BigDecimal.ZERO)) {
|
|
|
+ if (NumberUtil.isLessOrEqual(points, BigDecimal.ZERO)) {
|
|
|
// 直接走免费报名接口
|
|
|
R register = register(params);
|
|
|
Integer code = (Integer) register.get("code");
|
|
|
@@ -1078,14 +857,14 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
return register;
|
|
|
}
|
|
|
}
|
|
|
- //积分够扣且小于扣除上限走免费报名接口
|
|
|
- if (isDeductiblePrice == 1 && BigDecimal.valueOf(totalScore).compareTo(BigDecimal.valueOf(priceIntegral)) >= 0
|
|
|
- && BigDecimal.valueOf(priceIntegral).compareTo(BigDecimal.valueOf(pointsConfig.getDeductionLimit())) <= 0){
|
|
|
- // 直接走免费报名接口
|
|
|
- R register = register(params);
|
|
|
- //插入一条积分记录
|
|
|
- BigDecimal usePointsDecimal = BigDecimal.valueOf((usePoints));
|
|
|
- if (usePointsDecimal.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ try {
|
|
|
+ // 走积分
|
|
|
+ if (money.compareTo(BigDecimal.ZERO) == 0 && points.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ if (BigDecimal.valueOf(totalScore).compareTo(points) < 0) {
|
|
|
+ return R.error(522, "积分不够报名!");
|
|
|
+ }
|
|
|
+ // 直接走免费报名接口
|
|
|
+ R register = register(params);
|
|
|
ScoreStu add = new ScoreStu();
|
|
|
add.setDay(DateForStr.getInfoDateStr(new Date()));
|
|
|
add.setStuId(stuId);
|
|
|
@@ -1093,205 +872,45 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
add.setTaskId(TaskType.ACTIVITY_APPLY_DEDUCT.getCode());
|
|
|
add.setBusinessId(actId);
|
|
|
add.setScoreEvent(TaskType.ACTIVITY_APPLY_DEDUCT.getInfo());
|
|
|
- add.setScoreValue(NumberUtil.sub(BigDecimal.ZERO, usePoints).intValue());
|
|
|
+ add.setScoreValue(NumberUtil.sub(BigDecimal.ZERO, points).intValue());
|
|
|
add.setCreateTime(new Date());
|
|
|
- add.setSurplusScore(NumberUtil.sub(BigDecimal.ZERO, usePoints).intValue() + this.scoreStuService.getTotalScore(stuId));
|
|
|
+ add.setSurplusScore(NumberUtil.sub(BigDecimal.ZERO, points).intValue() + this.scoreStuService.getTotalScore(stuId));
|
|
|
scoreStuMapper.insert(add);
|
|
|
- }
|
|
|
- Integer code = (Integer) register.get("code");
|
|
|
- if (0 == code) {
|
|
|
- member.setActFree("0");
|
|
|
- memberInfoDao.updateById(member);
|
|
|
- }
|
|
|
- return register;
|
|
|
- }
|
|
|
-
|
|
|
- ActivityStuEntity one = activityStuDao.selectOne(new QueryWrapper<ActivityStuEntity>().eq("activity_id", actId)
|
|
|
- .eq("stu_id", stuId).eq("`status`", "01").eq("is_delete", 0));
|
|
|
- if (one != null) {
|
|
|
- return R.error(505, "请勿重复报名!");
|
|
|
- }
|
|
|
- /****** if冻结 ******/
|
|
|
- /*if (StringUtils.isNotBlank(member.getFreezeTime())){
|
|
|
- //查询超时时间
|
|
|
- WgFillInfoEntity wgFill = wgFillInfoDao.selectById(1);
|
|
|
- int time = 0;
|
|
|
- if (wgFill.getFreezeTime() != null){
|
|
|
- time = wgFill.getFreezeTime();
|
|
|
- }
|
|
|
-
|
|
|
- long history;
|
|
|
- try {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- history = sdf.parse(member.getFreezeTime()).getTime();
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- history = now.getTime();
|
|
|
- }
|
|
|
- long sub = now.getTime()-history;
|
|
|
- if (sub < time*3600*1000){
|
|
|
- sub = time*3600*1000 - sub;
|
|
|
- long hour = sub/(60*60*1000);
|
|
|
- long minute = (sub - hour*60*60*1000)/(60*1000);
|
|
|
- long second = (sub - hour*60*60*1000 - minute*60*1000)/1000;
|
|
|
- return R.error(507,"您还有"+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+"才可再次报名当前活动!");
|
|
|
- } else {
|
|
|
- member.setFreezeTime("");
|
|
|
- memberInfoDao.updateById(member);
|
|
|
- }
|
|
|
- }*/
|
|
|
- /****** else冻结 ******/
|
|
|
- /*ActivityStuEntity two = activityStuDao.selectOne(
|
|
|
- new QueryWrapper<ActivityStuEntity>()
|
|
|
- .eq("activity_id", actId)
|
|
|
- .eq("stu_id", stuId)
|
|
|
- .eq("status","02")
|
|
|
- .eq("is_delete", 0)
|
|
|
- .orderByDesc("create_time")
|
|
|
- .last("limit 1")
|
|
|
- );
|
|
|
- if (two != null){
|
|
|
- //查询超时时间
|
|
|
- WgFillInfoEntity wgFill = wgFillInfoDao.selectById(1);
|
|
|
- int time = 0;
|
|
|
- if (wgFill.getFreezeTime() != null){
|
|
|
- time = wgFill.getFreezeTime();
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(two.getCancelTime())){
|
|
|
- return R.error(506,"数据传输错误-002");
|
|
|
- }
|
|
|
- long history;
|
|
|
- try {
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- history = sdf.parse(two.getCancelTime()).getTime();
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- history = now.getTime();
|
|
|
- }
|
|
|
- long sub = now.getTime()-history;
|
|
|
- if (sub < time*3600*1000 && sub >10*60*1000){
|
|
|
- *//*sub = time*3600*1000 - sub;
|
|
|
- long hour = sub/(60*60*1000);
|
|
|
- long minute = (sub - hour*60*60*1000)/(60*1000);
|
|
|
- long second = (sub - hour*60*60*1000 - minute*60*1000)/1000;
|
|
|
- return R.error(507,"您还有"+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+"才可再次报名当前活动!");*//*
|
|
|
- return R.error(507,"账户处在冻结阶段,请在"+time+"小时后,再回到此页面报名活动");
|
|
|
- }
|
|
|
- }*/
|
|
|
- /****************/
|
|
|
- // 检查人数
|
|
|
- Integer count = activityStuDao.selectCount(
|
|
|
- new QueryWrapper<ActivityStuEntity>().eq("activity_id", actId).eq("is_delete", 0).eq("status", "01"));
|
|
|
- if (count >= activity.getWillnum()) {
|
|
|
- return R.error(508, "当前活动已报满!");
|
|
|
- }
|
|
|
-
|
|
|
- //BigDecimal actualPayment = BigDecimal.ZERO;
|
|
|
- //int usePoints = 0;
|
|
|
- Long id = member.getId();
|
|
|
- Integer totalPoints = scoreStuMapper.getTotalPointsByMemberId(id);
|
|
|
- if (ObjectUtil.isNotNull(totalPoints)
|
|
|
- && NumberUtil.isGreater(NumberUtil.toBigDecimal(totalPoints), BigDecimal.ZERO)) {
|
|
|
- if (ObjectUtil.isNotNull(isDeductiblePrice)) {
|
|
|
- PointsConfigEntity info = pointsConfigService.info();
|
|
|
- Integer pointsConfigStatus = info.getStatus();
|
|
|
- if (NumberUtil.equals(pointsConfigStatus, YnEnum.YES.value())) {
|
|
|
- if (NumberUtil.equals(isDeductiblePrice, YnEnum.YES.value())) {
|
|
|
- Integer deductionLimit = info.getDeductionLimit();
|
|
|
- if (NumberUtil.isGreater(NumberUtil.toBigDecimal(totalPoints),
|
|
|
- NumberUtil.toBigDecimal(deductionLimit))) {
|
|
|
- totalPoints = deductionLimit;
|
|
|
- }
|
|
|
- //Integer pointsDeduction = info.getPointsDeduction();
|
|
|
- //// 当前价格所需要的积分
|
|
|
- //Integer priceIntegral =
|
|
|
- // NumberUtil.mul(money, NumberUtil.toBigDecimal(pointsDeduction)).intValue();
|
|
|
- if (NumberUtil.isGreater(NumberUtil.toBigDecimal(totalPoints),
|
|
|
- NumberUtil.toBigDecimal(priceIntegral))) {
|
|
|
- usePoints = priceIntegral;
|
|
|
- BigDecimal deductiblePrice =
|
|
|
- NumberUtil.div(priceIntegral, pointsDeduction, 0, RoundingMode.FLOOR);
|
|
|
- actualPayment = NumberUtil.sub(money, deductiblePrice);
|
|
|
- } else {
|
|
|
- BigDecimal deductiblePrice =
|
|
|
- NumberUtil.div(totalPoints, pointsDeduction, 0, RoundingMode.FLOOR);
|
|
|
- usePoints = NumberUtil.mul(deductiblePrice, pointsDeduction).intValue();
|
|
|
- actualPayment = NumberUtil.sub(money, deductiblePrice);
|
|
|
- }
|
|
|
- if (NumberUtil.equals(actualPayment, BigDecimal.ZERO)) {
|
|
|
- // 新增积分数据
|
|
|
- //PointsRecordDTO dto = new PointsRecordDTO();
|
|
|
- //dto.setMemberId(stuId);
|
|
|
- //dto.setBusinessId(actId);
|
|
|
- //dto.setScoreValue(NumberUtil.sub(BigDecimal.ZERO, usePoints).intValue());
|
|
|
- //dto.setActualPrice(actualPayment);
|
|
|
- //dto.setIsLowerLevel(YnEnum.NO.value());
|
|
|
- //dto.setTaskId(Constant.ACTIVITY_APPLY_DEDUCT);
|
|
|
- //dto.setTaskName("活动报名抵扣的积分");
|
|
|
- //pointsRecordService.savePointsRecord(dto);
|
|
|
- //插入一条积分记录
|
|
|
- // ScoreStu add = new ScoreStu();
|
|
|
- // add.setDay(DateForStr.getInfoDateStr(new Date()));
|
|
|
- // add.setStuId(stuId);
|
|
|
- // add.setScoreType(ScoreType.STORE_SCORE.getCode());
|
|
|
- // add.setTaskId(TaskType.ACTIVITY_APPLY_DEDUCT.getCode());
|
|
|
- // add.setBusinessId(TaskType.ACTIVITY_APPLY_DEDUCT.getCode());
|
|
|
- // add.setScoreEvent(TaskType.ACTIVITY_APPLY_DEDUCT.getInfo());
|
|
|
- // add.setScoreValue(NumberUtil.sub(BigDecimal.ZERO, usePoints).intValue());
|
|
|
- // add.setCreateTime(new Date());
|
|
|
- // add.setSurplusScore(NumberUtil.sub(BigDecimal.ZERO, usePoints).intValue() + this.scoreStuService.getTotalScore(stuId));
|
|
|
- // scoreStuMapper.insert(add);
|
|
|
- // 直接走免费报名接口
|
|
|
- R register = register(params);
|
|
|
- Integer code = (Integer) register.get("code");
|
|
|
- if (0 == code) {
|
|
|
- member.setActFree("0");
|
|
|
- memberInfoDao.updateById(member);
|
|
|
- }
|
|
|
- return register;
|
|
|
- }
|
|
|
- } else {
|
|
|
- actualPayment = money;
|
|
|
- }
|
|
|
- } else {
|
|
|
- actualPayment = money;
|
|
|
+ Integer code = (Integer) register.get("code");
|
|
|
+ if (0 == code) {
|
|
|
+ member.setActFree("0");
|
|
|
+ memberInfoDao.updateById(member);
|
|
|
}
|
|
|
+ return register;
|
|
|
} else {
|
|
|
- actualPayment = money;
|
|
|
- }
|
|
|
- } else {
|
|
|
- actualPayment = money;
|
|
|
- }
|
|
|
+ // 支付信息
|
|
|
+ ActivityStuPayinfoEntity activityStuPayinfoEntity = new ActivityStuPayinfoEntity();
|
|
|
+ activityStuPayinfoEntity.setActivityId(actId);
|
|
|
+ activityStuPayinfoEntity.setStuId(stuId);
|
|
|
+ activityStuPayinfoEntity.setCreateTime(DateFormatUtils.format(now, "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ activityStuPayinfoEntity.setPayStatus(0);
|
|
|
+ activityStuPayinfoEntity.setPayMoney(money);
|
|
|
+ activityStuPayinfoEntity.setPayNo(MD5Util.getUUID16());
|
|
|
+ activityStuPayinfoService.save(activityStuPayinfoEntity);
|
|
|
|
|
|
- try {
|
|
|
- // 支付信息
|
|
|
- ActivityStuPayinfoEntity activityStuPayinfoEntity = new ActivityStuPayinfoEntity();
|
|
|
- activityStuPayinfoEntity.setActivityId(actId);
|
|
|
- activityStuPayinfoEntity.setStuId(stuId);
|
|
|
- activityStuPayinfoEntity.setCreateTime(DateFormatUtils.format(now, "yyyy-MM-dd HH:mm:ss"));
|
|
|
- activityStuPayinfoEntity.setPayStatus(0);
|
|
|
- activityStuPayinfoEntity.setPayMoney(actualPayment);
|
|
|
- activityStuPayinfoEntity.setPayNo(MD5Util.getUUID16());
|
|
|
- activityStuPayinfoService.save(activityStuPayinfoEntity);
|
|
|
-
|
|
|
- // 允许报名 ,调起微信
|
|
|
- String notifyUrl = PropertiesParameter.PROP.getProperty("pay.notify.activity.url");
|
|
|
- String openid = member.getOpenid();
|
|
|
- OrderBusinessTypeEnum typeEnum = OrderBusinessTypeEnum.PURCHASE_ACTIVITY;
|
|
|
- PayForBO bo = new PayForBO();
|
|
|
- bo.setNotifyUrl(notifyUrl);
|
|
|
- bo.setOpenid(openid);
|
|
|
- bo.setMemberId(id);
|
|
|
- bo.setBusinessId(actId);
|
|
|
- bo.setBusinessType(typeEnum.value());
|
|
|
- bo.setBuyContent(activity.getTitle());
|
|
|
- bo.setPayTime(LocalDateTime.now());
|
|
|
- bo.setPrice(money);
|
|
|
- bo.setActuallyPaid(actualPayment);
|
|
|
- bo.setUsePoints(usePoints);
|
|
|
- bo.setPointsDeduction(BigDecimal.ZERO);
|
|
|
- bo.setCode(TaskConfigEnum.ACTIVITY.code());
|
|
|
- return R.ok().put("map", orderService.payFor(bo));
|
|
|
+ // 允许报名 ,调起微信
|
|
|
+ String notifyUrl = PropertiesParameter.PROP.getProperty("pay.notify.activity.url");
|
|
|
+ String openid = member.getOpenid();
|
|
|
+ OrderBusinessTypeEnum typeEnum = OrderBusinessTypeEnum.PURCHASE_ACTIVITY;
|
|
|
+ PayForBO bo = new PayForBO();
|
|
|
+ bo.setNotifyUrl(notifyUrl);
|
|
|
+ bo.setOpenid(openid);
|
|
|
+ bo.setMemberId(stuId);
|
|
|
+ bo.setBusinessId(actId);
|
|
|
+ bo.setBusinessType(typeEnum.value());
|
|
|
+ bo.setBuyContent(activity.getTitle());
|
|
|
+ bo.setPayTime(LocalDateTime.now());
|
|
|
+ bo.setPrice(money);
|
|
|
+ bo.setActuallyPaid(money);
|
|
|
+ bo.setPointsDeduction(BigDecimal.ZERO);
|
|
|
+ bo.setCode(TaskConfigEnum.ACTIVITY.code());
|
|
|
+ return R.ok().put("map", orderService.payFor(bo));
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return R.error("微信支付异常!");
|
|
|
@@ -1699,62 +1318,14 @@ public class ActivityServiceImpl extends ServiceImpl<ActivityDao, ActivityEntity
|
|
|
MemberInfoEntity memberInfoEntity = loginVerificationService.verificationMemberId(id);
|
|
|
Integer totalPoints = memberInfoEntity.getTotalPoints();
|
|
|
ActivityEntity activityEntity = this.loadById(activityId, true);
|
|
|
- PointsConfigEntity info = pointsConfigService.info();
|
|
|
- Integer status = info.getStatus();
|
|
|
|
|
|
EventRegistrationPayPriceVO eventRegistrationPayPriceVO = new EventRegistrationPayPriceVO();
|
|
|
- Integer pointsDeduction = info.getPointsDeduction();
|
|
|
- if (NumberUtil.equals(NumberUtil.toBigDecimal(pointsDeduction), BigDecimal.ZERO)) {
|
|
|
- eventRegistrationPayPriceVO.setIsDeductiblePrice(YnEnum.NO.value());
|
|
|
- eventRegistrationPayPriceVO.setDeductiblePrice(BigDecimal.ZERO);
|
|
|
- return eventRegistrationPayPriceVO;
|
|
|
- }
|
|
|
-
|
|
|
eventRegistrationPayPriceVO.setBusinessId(id);
|
|
|
eventRegistrationPayPriceVO.setRemainingPoints(ObjectUtil.isNull(totalPoints) ? 0 : totalPoints);
|
|
|
BigDecimal money = activityEntity.getMoney();
|
|
|
- if (NumberUtil.isLessOrEqual(money, BigDecimal.ZERO)) {
|
|
|
- eventRegistrationPayPriceVO.setActualPrice(ObjectUtil.isNull(money) ? BigDecimal.ZERO : money);
|
|
|
- eventRegistrationPayPriceVO.setIsDeductiblePrice(YnEnum.NO.value());
|
|
|
- eventRegistrationPayPriceVO.setDeductiblePrice(BigDecimal.ZERO);
|
|
|
- } else {
|
|
|
- eventRegistrationPayPriceVO.setMoney(money);
|
|
|
- if (NumberUtil.equals(status, YnEnum.NO.value())) {
|
|
|
- eventRegistrationPayPriceVO.setActualPrice(money);
|
|
|
- eventRegistrationPayPriceVO.setIsDeductiblePrice(YnEnum.NO.value());
|
|
|
- eventRegistrationPayPriceVO.setDeductiblePrice(BigDecimal.ZERO);
|
|
|
- } else {
|
|
|
- eventRegistrationPayPriceVO.setIsDeductiblePrice(YnEnum.YES.value());
|
|
|
- Integer deductionLimit = info.getDeductionLimit();
|
|
|
- if (NumberUtil.isGreater(NumberUtil.toBigDecimal(totalPoints),
|
|
|
- NumberUtil.toBigDecimal(deductionLimit))) {
|
|
|
- totalPoints = deductionLimit;
|
|
|
- }
|
|
|
-
|
|
|
- // 当前价格所需要的积分
|
|
|
- Integer priceIntegral = NumberUtil.mul(money, NumberUtil.toBigDecimal(pointsDeduction)).intValue();
|
|
|
- if (NumberUtil.isGreater(NumberUtil.toBigDecimal(totalPoints),
|
|
|
- NumberUtil.toBigDecimal(priceIntegral))) {
|
|
|
- eventRegistrationPayPriceVO.setUsePoints(priceIntegral);
|
|
|
- BigDecimal deductiblePrice = NumberUtil.div(priceIntegral, pointsDeduction, 0, RoundingMode.FLOOR);
|
|
|
- eventRegistrationPayPriceVO.setDeductiblePrice(deductiblePrice);
|
|
|
- eventRegistrationPayPriceVO.setActualPrice(NumberUtil.sub(money, deductiblePrice));
|
|
|
- } else {
|
|
|
- if (!NumberUtil.equals(NumberUtil.toBigDecimal(totalPoints), BigDecimal.ZERO)) {
|
|
|
- BigDecimal deductiblePrice =
|
|
|
- NumberUtil.div(totalPoints, pointsDeduction, 0, RoundingMode.FLOOR);
|
|
|
- int usePoints = NumberUtil.mul(deductiblePrice, pointsDeduction).intValue();
|
|
|
- eventRegistrationPayPriceVO.setUsePoints(usePoints);
|
|
|
- eventRegistrationPayPriceVO.setDeductiblePrice(deductiblePrice);
|
|
|
- eventRegistrationPayPriceVO.setActualPrice(NumberUtil.sub(money, deductiblePrice));
|
|
|
- } else {
|
|
|
- eventRegistrationPayPriceVO.setUsePoints(0);
|
|
|
- eventRegistrationPayPriceVO.setDeductiblePrice(BigDecimal.ZERO);
|
|
|
- eventRegistrationPayPriceVO.setActualPrice(money);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ eventRegistrationPayPriceVO.setMoney(money);
|
|
|
+ eventRegistrationPayPriceVO.setActualPrice(money);
|
|
|
+ eventRegistrationPayPriceVO.setActualPoints(activityEntity.getPoints());
|
|
|
return eventRegistrationPayPriceVO;
|
|
|
}
|
|
|
|