|
|
@@ -16,6 +16,7 @@ import com.google.common.collect.Lists;
|
|
|
import com.yingyangfly.common.dto.ResultResponse;
|
|
|
import com.yingyangfly.common.exception.ServiceException;
|
|
|
import com.yingyangfly.common.utils.DateUtils;
|
|
|
+import com.yingyangfly.common.utils.ids.IdUtils;
|
|
|
import com.yingyangfly.core.api.ImApi;
|
|
|
import com.yingyangfly.core.domain.*;
|
|
|
import com.yingyangfly.core.dto.*;
|
|
|
@@ -400,18 +401,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
appUser.setDoctorName(sysUser.getUserName());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //将套餐信息置空
|
|
|
-// appUser.setPadNo("");
|
|
|
-// appUser.setPackageId(null);
|
|
|
-// appUser.setPackageName("");
|
|
|
-// appUser.setEquipmentPledge(null);
|
|
|
-// appUser.setOrderStartTime("");
|
|
|
-// appUser.setOrderEndTime("");
|
|
|
-
|
|
|
if (appUser.getId() == null) {
|
|
|
appUser.setStatus("0");
|
|
|
- appUser.setTestFlag("1");
|
|
|
+ appUser.setTestFlag("0");
|
|
|
appUser.setCreateTime(new Date());
|
|
|
appUser.setUpdateTime(new Date());
|
|
|
//新增用户脑力值是0分
|
|
|
@@ -422,6 +414,13 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
if (ObjectUtils.isNotNull(user)){
|
|
|
return ResultResponse.fail("手机号已经存在");
|
|
|
}
|
|
|
+ if (ObjectUtils.isNull(appUser.getDoctorId())) {
|
|
|
+ appUser.setDoctorId(currentUser.getUserId());
|
|
|
+ appUser.setDoctorName(currentUser.getUsername());
|
|
|
+ }
|
|
|
+ SysUser sysUser = sysUserMapper.selectById(appUser.getDoctorId());
|
|
|
+ appUser.setOrgCode(sysUser.getOrgCode());
|
|
|
+ appUser.setOrgName(sysUser.getOrgName());
|
|
|
|
|
|
String pwd = "Wllt"+ "+" + appUser.getIdCard().substring(14, 18);
|
|
|
appUser.setPwd(bCryptPasswordEncoder.encode(pwd));
|
|
|
@@ -495,7 +494,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
Page<AppUser> rowPage = new Page(appUser.getPage(), appUser.getLimit());
|
|
|
QueryWrapper<AppUser> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.orderByDesc("create_time");
|
|
|
- queryWrapper.eq("org_code", tokenUtil.getCurrentUser().getOrgCode());
|
|
|
+
|
|
|
if(!StringUtils.isEmpty(appUser.getName())){
|
|
|
queryWrapper.like("name", "%"+appUser.getName()+"%");
|
|
|
}
|
|
|
@@ -505,6 +504,25 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
if(!StringUtils.isEmpty(appUser.getStatus())){
|
|
|
queryWrapper.in("status",appUser.getStatus().split(","));
|
|
|
}
|
|
|
+ queryWrapper.eq("org_code", tokenUtil.getCurrentUser().getOrgCode());
|
|
|
+ SysUser sysUser = sysUserMapper.selectById(tokenUtil.getCurrentUser().getUserId());
|
|
|
+ if ("doctor".equals(sysUser.getRoleCodes())){
|
|
|
+ if (sysUser.getTitle().equals("4")){
|
|
|
+ if (StringUtils.isNotBlank(sysUser.getDepartmentName())){
|
|
|
+ LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(SysUser::getDepartmentName,sysUser.getDepartmentName());
|
|
|
+ List<SysUser> sysUsers = sysUserMapper.selectList(lambdaQueryWrapper);
|
|
|
+ List<Long> ids = sysUsers.stream()
|
|
|
+ .map(SysUser::getId)
|
|
|
+ .filter(id -> id != null) // 显式过滤 null(可选)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ queryWrapper.in("doctor_id",ids);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ queryWrapper.eq("doctor_id",tokenUtil.getCurrentUser().getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Page<AppUser> appUserPage = appUserMapper.selectPage(rowPage, queryWrapper);
|
|
|
List<AppUser> records = appUserPage.getRecords();
|
|
|
QueryWrapper<LearningPackage> queryPackageWrapper = new QueryWrapper<>();
|
|
|
@@ -700,7 +718,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
return ResultResponse.success(token);
|
|
|
}
|
|
|
|
|
|
- public ResultResponse getCheckCode(String mobile) {
|
|
|
+ public ResultResponse getCheckCode(String mobile,String appType) {
|
|
|
String redisKey = "hcp:sms:mobile:" + mobile;
|
|
|
String checkCodeRedis = redisClient.get(redisKey, "");
|
|
|
if (!StringUtils.isEmpty(checkCodeRedis)) {
|
|
|
@@ -711,19 +729,28 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
if (appUser == null) {
|
|
|
return ResultResponse.fail("患者不存在");
|
|
|
}
|
|
|
- if (ObjectUtils.isNull(appUser.getOrderEndTime())){
|
|
|
- return ResultResponse.success(false);
|
|
|
- }
|
|
|
- if (LocalDate.parse(appUser.getOrderEndTime()).isBefore(LocalDate.now())){
|
|
|
- return ResultResponse.success(false);
|
|
|
+ if ("app".equals(appType)){
|
|
|
+ if (ObjectUtils.isNull(appUser.getOrderEndTime())){
|
|
|
+ return ResultResponse.success(false);
|
|
|
+ }
|
|
|
+ if (LocalDate.parse(appUser.getOrderEndTime()).isBefore(LocalDate.now())){
|
|
|
+ return ResultResponse.success(false);
|
|
|
+ }
|
|
|
}
|
|
|
Random rand = new Random();
|
|
|
int randomNumber = rand.nextInt(1000000);
|
|
|
-// String random = String.format("%06d", randomNumber);
|
|
|
- //6位随机数
|
|
|
-// Boolean isSuccess = SmgUtil.sendCheckCode(mobile, MsgTemplateEnums.GET_CHECK_CODE.getTempalteCode(), random);
|
|
|
- String random = "123456";
|
|
|
+ String random = "";
|
|
|
Boolean isSuccess = true;
|
|
|
+ if (active.equals("dev")){
|
|
|
+ random = "123456";
|
|
|
+ isSuccess = true;
|
|
|
+ }else {
|
|
|
+ random = String.format("%06d", randomNumber);
|
|
|
+ //6位随机数
|
|
|
+ isSuccess = SmgUtil.sendCheckCode(mobile, MsgTemplateEnums.GET_CHECK_CODE.getTempalteCode(), random);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (isSuccess) {
|
|
|
// 防机器
|
|
|
redisClient.set("hcp:sms:mobile:"+mobile,random,120);
|
|
|
@@ -756,10 +783,16 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
}
|
|
|
Random rand = new Random();
|
|
|
int randomNumber = rand.nextInt(1000000);
|
|
|
-// String random = String.format("%06d", randomNumber);
|
|
|
-// Boolean isSuccess = SmgUtil.sendCheckCode(mobile, MsgTemplateEnums.CHANGE_PASSWORD_CODE.getTempalteCode(), random);
|
|
|
- String random = "123456";
|
|
|
+ String random = "";
|
|
|
Boolean isSuccess = true;
|
|
|
+ if (active.equals("dev")){
|
|
|
+ random = "123456";
|
|
|
+ isSuccess = true;
|
|
|
+ }else {
|
|
|
+ random = String.format("%06d", randomNumber);
|
|
|
+ //6位随机数
|
|
|
+ isSuccess = SmgUtil.sendCheckCode(mobile, MsgTemplateEnums.GET_CHECK_CODE.getTempalteCode(), random);
|
|
|
+ }
|
|
|
if (isSuccess) {
|
|
|
// 防机器
|
|
|
redisClient.set("hcp:sms:changePass:mobile:"+mobile,random,120);
|
|
|
@@ -978,33 +1011,33 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
appUserPackageHisService.saveAppUserPackageHis(appUserPackageHis);
|
|
|
appUser.setOrderEndTime(packageEndDate);
|
|
|
appUser.setPackageRelationId(appUserPackageHis.getId());
|
|
|
- if ("1".equals(appUser.getTestFlag())){
|
|
|
- // 删除未完成的测评任务
|
|
|
- log.info("<<<<<<<<<<<<删除未完成的测评任务用户信息:{}>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
- List<ReviewTask> reviewTaskList = reviewTaskService.selectUnDoneReviewTaskByUserId(appUser.getId());
|
|
|
- List<Long> ids = reviewTaskList.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
- log.info("<<<<<<<<<<<<<删除未完成的测评任务ids:{}>>>>>>>>>>>>>",JSON.toJSONString(ids));
|
|
|
- reviewTaskService.removeBatchByIds(ids);
|
|
|
- ReviewTask reviewTask = new ReviewTask();
|
|
|
- reviewTask.setUserId(appUser.getId());
|
|
|
- reviewTask.setCreateBy(appUser.getCreateBy());
|
|
|
- List<String> scaleNameList = new ArrayList<>();
|
|
|
- scaleNameList.add("MMSE");
|
|
|
- scaleNameList.add("MOCA");
|
|
|
- reviewTask.setScaleNameList(scaleNameList);
|
|
|
- //生成测评任务
|
|
|
- reviewTaskService.saveReviewTask(reviewTask);
|
|
|
- // 记录测评任务消息
|
|
|
- log.info("<<<<<<<<<<<<<发送测评任务>>用户信息:{}>>>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
- msgWarnService.save(buildMsgWarn(appUser.getId(),"B","在线测评任务", "MOCA测评任务和MMSE测评任务已生成",appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
- log.info("<<<<<<<<<<<<续费IM>>用户信息:{}>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
- String msgDesn = String.format("尊敬的%s,您好,您购买的%s,已经生效,截止日期为%s",appUser.getName(),learningPackage.getPackageName(),appUser.getOrderEndTime());
|
|
|
- msgWarnService.save(buildMsgWarn(appUser.getId(),"A","缴费通知",msgDesn,appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
- }else {
|
|
|
+// if ("1".equals(appUser.getTestFlag())){
|
|
|
+// // 删除未完成的测评任务
|
|
|
+// log.info("<<<<<<<<<<<<删除未完成的测评任务用户信息:{}>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
+// List<ReviewTask> reviewTaskList = reviewTaskService.selectUnDoneReviewTaskByUserId(appUser.getId());
|
|
|
+// List<Long> ids = reviewTaskList.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
+// log.info("<<<<<<<<<<<<<删除未完成的测评任务ids:{}>>>>>>>>>>>>>",JSON.toJSONString(ids));
|
|
|
+// reviewTaskService.removeBatchByIds(ids);
|
|
|
+// ReviewTask reviewTask = new ReviewTask();
|
|
|
+// reviewTask.setUserId(appUser.getId());
|
|
|
+// reviewTask.setCreateBy(appUser.getCreateBy());
|
|
|
+// List<String> scaleNameList = new ArrayList<>();
|
|
|
+// scaleNameList.add("MMSE");
|
|
|
+// scaleNameList.add("MOCA");
|
|
|
+// reviewTask.setScaleNameList(scaleNameList);
|
|
|
+// //生成测评任务
|
|
|
+// reviewTaskService.saveReviewTask(reviewTask);
|
|
|
+// // 记录测评任务消息
|
|
|
+// log.info("<<<<<<<<<<<<<发送测评任务>>用户信息:{}>>>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
+// msgWarnService.save(buildMsgWarn(appUser.getId(),"B","在线测评任务", "MOCA测评任务和MMSE测评任务已生成",appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
+// log.info("<<<<<<<<<<<<续费IM>>用户信息:{}>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
+// String msgDesn = String.format("尊敬的%s,您好,您购买的%s,已经生效,截止日期为%s",appUser.getName(),learningPackage.getPackageName(),appUser.getOrderEndTime());
|
|
|
+// msgWarnService.save(buildMsgWarn(appUser.getId(),"A","缴费通知",msgDesn,appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
+// }else {
|
|
|
log.info("<<<<<<<<<<<<<<im续费>>用户信息:{}>>>>>>>>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
String msgDesn = String.format("尊敬的%s,您好,您购买的%s,已经生效,截止日期为%s",appUser.getName(),learningPackage.getPackageName(),appUser.getOrderEndTime());
|
|
|
msgWarnService.save(buildMsgWarn(appUser.getId(),"A","缴费通知",msgDesn,appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
- }
|
|
|
+// }
|
|
|
appUserMapper.updateById(appUser);
|
|
|
}
|
|
|
|
|
|
@@ -1020,38 +1053,66 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
redisClient.del(String.format("%s%s", "token:app:", Sm4Util.decrypt(appUser.getMobile())));
|
|
|
}
|
|
|
}
|
|
|
+ @Value("${spring.profiles.active}")
|
|
|
+ private String active;
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public WxPayJsApiPreVO wXTencentSave(WxTencentDto wxTencentDto) throws Exception {
|
|
|
- // 第一步新增患者
|
|
|
- AppUser appUser = EntityConverter.convertToTarget(wxTencentDto, AppUser.class);
|
|
|
- if(StringUtils.isEmpty(appUser.getAvatar()) && !StringUtils.isEmpty(appUser.getGender())){
|
|
|
- String avatar = appUserHeadService.randomGetOneHeadByGender2(appUser.getGender(),"system");
|
|
|
- appUser.setAvatar(avatar);
|
|
|
+
|
|
|
+ AppUser user = selectByMobile(Sm4Util.encrypt(wxTencentDto.getMobile()), null);
|
|
|
+ if (active.equals("dev")){
|
|
|
+ wxTencentDto.setEquipmentPledge("1");
|
|
|
+ }else {
|
|
|
+ wxTencentDto.setEquipmentPledge("120000");
|
|
|
}
|
|
|
- appUser.setStatus("0");
|
|
|
- appUser.setTestFlag("1");
|
|
|
- appUser.setCreateTime(new Date());
|
|
|
- appUser.setUpdateTime(new Date());
|
|
|
+ AppUser appUser = EntityConverter.convertToTarget(wxTencentDto, AppUser.class);
|
|
|
+ appUser.setPackageId(null);
|
|
|
+ if (ObjectUtils.isNull(user)){
|
|
|
+ // 第一步新增患者
|
|
|
+ if(StringUtils.isEmpty(appUser.getAvatar()) && !StringUtils.isEmpty(appUser.getGender())){
|
|
|
+ String avatar = appUserHeadService.randomGetOneHeadByGender2(appUser.getGender(),"system");
|
|
|
+ appUser.setAvatar(avatar);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(wxTencentDto.getDoctorId()!=null){
|
|
|
+ SysUser sysUser = sysUserMapper.selectById(wxTencentDto.getDoctorId());
|
|
|
+ if(sysUser != null){
|
|
|
+ appUser.setDoctorName(sysUser.getUserName());
|
|
|
+ appUser.setDoctorId(sysUser.getId());
|
|
|
+ appUser.setOrgCode(sysUser.getOrgCode());
|
|
|
+ appUser.setOrgName(sysUser.getOrgName());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ appUser.setOrgCode("onlineUser");
|
|
|
+ appUser.setOrgName("线上用户");
|
|
|
+ }
|
|
|
+ appUser.setStatus("0");
|
|
|
+ appUser.setTestFlag("0");
|
|
|
+ appUser.setCreateTime(new Date());
|
|
|
+ appUser.setUpdateTime(new Date());
|
|
|
+ appUser.setPatientSource("1");
|
|
|
+
|
|
|
+ String pwd = "Wllt"+ "+" + appUser.getIdCard().substring(14, 18);
|
|
|
+ appUser.setPwd(bCryptPasswordEncoder.encode(pwd));
|
|
|
+ //新增用户脑力值是0分
|
|
|
+ appUser.setMentalEnergy(0);
|
|
|
+ appUser.setCreateBy("微信公众号");
|
|
|
|
|
|
- String pwd = "Wllt"+ "+" + appUser.getIdCard().substring(14, 18);
|
|
|
- appUser.setPwd(bCryptPasswordEncoder.encode(pwd));
|
|
|
- //新增用户脑力值是0分
|
|
|
- appUser.setMentalEnergy(0);
|
|
|
- appUser.setCreateBy("微信公众号");
|
|
|
- appUser.setOrgCode("onlineUser");
|
|
|
- appUser.setOrgName("线上用户");
|
|
|
- appUser.setCreateTime(new Date());
|
|
|
- appUserMapper.insert(appUser);
|
|
|
- //首次登陆欢迎语
|
|
|
- log.info("<<<<<<<<<<<<发送首次登陆欢迎语IM>>用户信息:{}>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
- String msgDesn = String.format("欢迎%s使用未来蓝豚康复平台!为您提供专业的认知康复支持和训练。帮助您提升认知能力,重建自信。小豚期待与您一同启程!",appUser.getName());
|
|
|
- msgWarnService.save(buildMsgWarn(appUser.getId(),"B","欢迎加入未来蓝豚",msgDesn,appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
- // 游戏推荐
|
|
|
- log.info("<<<<<<<<<<<<<<<<患者推送蓝豚和 首页 游戏>>>>>>>>>>>>>>>>");
|
|
|
- recommendFacade.recommendGameUserJobByAppUser(appUser.getId());
|
|
|
|
|
|
+ appUser.setCreateTime(new Date());
|
|
|
+ appUserMapper.insert(appUser);
|
|
|
+ //首次登陆欢迎语
|
|
|
+ log.info("<<<<<<<<<<<<发送首次登陆欢迎语IM>>用户信息:{}>>>>>>>>>>",JSON.toJSONString(appUser));
|
|
|
+ String msgDesn = String.format("欢迎%s使用未来蓝豚康复平台!为您提供专业的认知康复支持和训练。帮助您提升认知能力,重建自信。小豚期待与您一同启程!",appUser.getName());
|
|
|
+ msgWarnService.save(buildMsgWarn(appUser.getId(),"B","欢迎加入未来蓝豚",msgDesn,appUser.getOrgCode(),appUser.getOrgName()));
|
|
|
+ // 游戏推荐
|
|
|
+ log.info("<<<<<<<<<<<<<<<<患者推送蓝豚和 首页 游戏>>>>>>>>>>>>>>>>");
|
|
|
+ recommendFacade.recommendGameUserJobByAppUser(appUser.getId());
|
|
|
+ }else {
|
|
|
+ appUser.setId(user.getId());
|
|
|
+ appUserMapper.updateById(appUser);
|
|
|
+ }
|
|
|
LearningPackage learningPackage = learnPackageMapper.selectById(wxTencentDto.getPackageId());
|
|
|
|
|
|
BigDecimal price = BigDecimal.valueOf(learningPackage.getPrice());
|
|
|
@@ -1063,10 +1124,10 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
payOrder.setDescription("您的训练套餐是:" + learningPackage.getPackageName() + ",总金额是:" + AmountUtils.F2Y4STR(Long.valueOf(totalAmount.toString())) + "元,其中押金:" + AmountUtils.F2Y4STR(Long.valueOf(wxTencentDto.getEquipmentPledge())) + "元");
|
|
|
payOrder.setEquipmentPledge(wxTencentDto.getEquipmentPledge());
|
|
|
payOrder.setOrderType("A,B");
|
|
|
- payOrder.setOrgCode("onlineUser");
|
|
|
- payOrder.setOrgName("线上用户");
|
|
|
+ payOrder.setOrgCode(appUser.getOrgCode());
|
|
|
+ payOrder.setOrgName(appUser.getOrgName());
|
|
|
payOrder.setState(wxTencentDto.getState());
|
|
|
- payOrder.setRelationId(wxTencentDto.getPackageId());
|
|
|
+ payOrder.setRelationId(Long.valueOf(wxTencentDto.getPackageId()));
|
|
|
payOrder.setPadNo("00000001");
|
|
|
payOrder.setPayMethod("1");
|
|
|
payOrder.setPayMoney(Long.valueOf(totalAmount.toString()));
|
|
|
@@ -1076,4 +1137,51 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
payOrder.setCreateTime(new Date());
|
|
|
return payService.createJSAPIOrder(payOrder,wxTencentDto.getCode());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private WxApplicationBlankService wxApplicationBlankService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private WXPayUtil wxPayUtil;
|
|
|
+
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public WxPayJsApiPreVO wxSavePhone(WxTencentDto wxTencentDto) throws Exception {
|
|
|
+ if (active.equals("dev")){
|
|
|
+ wxTencentDto.setEquipmentPledge("1");
|
|
|
+ }else {
|
|
|
+ wxTencentDto.setEquipmentPledge("120000");
|
|
|
+ }
|
|
|
+ LearningPackage learningPackage = learnPackageMapper.selectById(Long.valueOf(wxTencentDto.getPackageId()));
|
|
|
+
|
|
|
+ BigDecimal price = BigDecimal.valueOf(learningPackage.getPrice());
|
|
|
+ BigDecimal pledge = new BigDecimal(wxTencentDto.getEquipmentPledge().trim());
|
|
|
+ BigDecimal totalAmount = price.add(pledge);
|
|
|
+
|
|
|
+ WxApplicationBlank wxApplicationBlank = new WxApplicationBlank();
|
|
|
+
|
|
|
+ wxApplicationBlank.setMobile(wxTencentDto.getMobile());
|
|
|
+ wxApplicationBlank.setDoctorId(Long.valueOf(wxTencentDto.getDoctorId()));
|
|
|
+ SysUser sysUser = sysUserMapper.selectById(wxApplicationBlank.getDoctorId());
|
|
|
+ wxApplicationBlank.setOrgName(sysUser.getOrgName());
|
|
|
+ wxApplicationBlank.setPackageId(Long.valueOf(wxTencentDto.getPackageId()));
|
|
|
+ // 商家系统生成订单号 唯一且不可重复,即使关闭订单后相同订单号也无法再次创建订单
|
|
|
+ String orderNo = "LT_" + IdUtils.getNextId();
|
|
|
+
|
|
|
+ wxApplicationBlank.setPayOrderId(orderNo);
|
|
|
+ wxApplicationBlank.setSendPayTime(DateUtils.getTime());
|
|
|
+ //支付状态1.支付中 2.支付成功 3.支付失败,4退款中,5已退款,6已关闭 0 完成
|
|
|
+ wxApplicationBlank.setPayStatus("1");
|
|
|
+ wxApplicationBlank.setPayMoney(Long.valueOf(totalAmount.toString()));
|
|
|
+ wxApplicationBlank.setDescription("您的训练套餐是:" + learningPackage.getPackageName() + ",总金额是:" + AmountUtils.F2Y4STR(Long.valueOf(totalAmount.toString())) + "元,其中押金:" + AmountUtils.F2Y4STR(Long.valueOf(wxTencentDto.getEquipmentPledge())) + "元");
|
|
|
+ wxApplicationBlank.setEquipmentPledge(Long.valueOf(wxTencentDto.getEquipmentPledge()));
|
|
|
+ wxApplicationBlank.setState(wxTencentDto.getState());
|
|
|
+ wxApplicationBlank.setCreateTime(new Date());
|
|
|
+ wxApplicationBlank.setUpdateTime(new Date());
|
|
|
+ wxApplicationBlankService.save(wxApplicationBlank);
|
|
|
+
|
|
|
+ String prepayId = wxPayUtil.onLineWXJSAPIPay(wxApplicationBlank, wxTencentDto.getCode());
|
|
|
+ return wxPayUtil.convertWxPayJsApiPreInfo(prepayId);
|
|
|
+ }
|
|
|
}
|