|
|
@@ -31,6 +31,7 @@ import com.yingyangfly.core.vo.WxPayJsApiPreVO;
|
|
|
import com.yingyangfly.redis.client.RedisClient;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.assertj.core.util.Sets;
|
|
|
+import org.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -110,6 +111,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
@Resource
|
|
|
private ReviewTaskService reviewTaskService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AppTimeFluctuationRecordService appTimeFluctuationRecordService;
|
|
|
+
|
|
|
@Resource
|
|
|
private PayService payService;
|
|
|
|
|
|
@@ -987,6 +991,45 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
return appUserMapper.updateById(upAppUser) > 0;
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void openPhysiotherapyTime(AppTimeFluctuationRecord appTimeFluctuationRecord)throws ParseException{
|
|
|
+ // 获取患者信息
|
|
|
+ AppUser appUser = appUserMapper.selectById(appTimeFluctuationRecord.getUserId());
|
|
|
+ AppUser appUserUpdate = new AppUser();
|
|
|
+ if(StringUtils.isEmpty(appUser.getOrderStartTime())){
|
|
|
+ appUserUpdate.setOrderStartTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date()));
|
|
|
+ }
|
|
|
+ Date endDate = null;
|
|
|
+ if (StringUtils.isEmpty(appUser.getOrderEndTime())){
|
|
|
+ endDate = DateUtils.addDays(new Date(),appTimeFluctuationRecord.getNumberDays());
|
|
|
+ appTimeFluctuationRecord.setStartTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date()));
|
|
|
+ }else {
|
|
|
+ appTimeFluctuationRecord.setStartTime(appUser.getOrderEndTime());
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ if (new Date().compareTo(dateFormat.parse(appUser.getOrderEndTime())) <= 0){
|
|
|
+ //套餐有效内
|
|
|
+ endDate = DateUtils.addDays(DateUtils.parseDate(appUser.getOrderEndTime()),appTimeFluctuationRecord.getNumberDays());
|
|
|
+ }else {
|
|
|
+ //套餐有效期外
|
|
|
+ endDate = DateUtils.addDays(new Date(),appTimeFluctuationRecord.getNumberDays());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ appUserUpdate.setId(appUser.getId());
|
|
|
+ appUserUpdate.setOrderEndTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,endDate));
|
|
|
+ log.info("<<<<<<<<<<<<<<<<套餐结束时间:{}>>>>>>>>>>>>>",appUserUpdate.getOrderEndTime());
|
|
|
+ log.info("<<<<<<<<<<<<<<记录开通>>>>>>>>>>>>>>>");
|
|
|
+ CurrentLoginUser currentUser = tokenUtil.getCurrentUser();
|
|
|
+ appTimeFluctuationRecord.setEndTime(appUserUpdate.getOrderEndTime());
|
|
|
+ appTimeFluctuationRecord.setCreateBy(currentUser.getUsername());
|
|
|
+ appTimeFluctuationRecord.setCreateTime(new Date());
|
|
|
+ appUserMapper.updateById(appUserUpdate);
|
|
|
+ appTimeFluctuationRecordService.save(appTimeFluctuationRecord);
|
|
|
+ log.info("<<<<<<<<<<<<<<im续费>>用户信息:{}>>>>>>>>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
+ String msgDesn = String.format("尊敬的%s,您好,您购买了%s天训练时间,已经生效,截止日期为%s",appUser.getName(),appTimeFluctuationRecord.getNumberDays(),appUserUpdate.getOrderEndTime());
|
|
|
+ msgWarnService.save(buildMsgWarn(appUser.getId(),"A","缴费通知",msgDesn,appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 按钮开通 患者套餐
|
|
|
*/
|