updates 抖音新增体育小程序

This commit is contained in:
zhouwentao 2024-07-16 15:55:38 +08:00
parent d68d6fa8d5
commit f387d6a558
18 changed files with 781 additions and 48 deletions

View File

@ -130,9 +130,8 @@ public class LoginUser {
private String openId;
/**是否是vip*/
@ApiModelProperty(value = "是否是vip")
private boolean vipFlag=false;
/**所属程序*/
private String programType;
/**是否显示历年分差*/
private String showLinediff;

View File

@ -90,18 +90,25 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/web/user/register","anon");//前台页面注册
filterChainDefinitionMap.put("/mini/user/v1/phoneLogin","anon");//小程序手机号登录
filterChainDefinitionMap.put("/mini/user/v1/login","anon");//小程序登录
filterChainDefinitionMap.put("/mini/user/v1/dyLogin","anon");//抖音小程序登录
filterChainDefinitionMap.put("/mini/user/phoneLogin","anon");//小程序手机号登录
filterChainDefinitionMap.put("/mini/user/login","anon");//小程序登录
filterChainDefinitionMap.put("/mini/article/**","anon");//小程序-文章
filterChainDefinitionMap.put("/mini/user/dy/login","anon");//抖音小程序登录
filterChainDefinitionMap.put("/mini/article/**","anon");//小程序-文章
filterChainDefinitionMap.put("/wx/pay/v1/payNotify","anon");//订单支付回调校验
filterChainDefinitionMap.put("/mini/pay/v1/dy/payNotify","anon");
filterChainDefinitionMap.put("/mini/pay/v1/payNotify","anon");//订单支付回调校验
filterChainDefinitionMap.put("/mini/pay/v1/dy/payNotify","anon");//
filterChainDefinitionMap.put("/mini/pay/v1/dy/refundNotify","anon");// 抖音退款回调
filterChainDefinitionMap.put("/mini/pay/v1/dy/tiyu/payNotify","anon");//抖音体育小程序订单支付回调校验
filterChainDefinitionMap.put("/mini/pay/v1/dy/tiyu/refundNotify","anon");// 抖音退款回调
filterChainDefinitionMap.put("/art/major/majorInfo","anon");//前台-专业页面详情
filterChainDefinitionMap.put("/art/volunteer/preview","anon");//前台-导出志愿表pdf
//filterChainDefinitionMap.put("/art/recommendMajor/testCultural","anon");//文化分测算
//学校
filterChainDefinitionMap.put("/web/school/hotList","anon");//前台-热门学校

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.api.controller;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -24,6 +25,7 @@ public class StaticDataController {
@RequestMapping(value = "/getJson",method = RequestMethod.POST)
public Result<?> getJson(@RequestBody JSONObject params, HttpServletRequest request){
String key = params.getStr("key");
String programType = params.getStr("programType");
if (StringUtils.isNotBlank(key)) {
JSONObject responseData = new JSONObject();
switch (key){
@ -41,7 +43,14 @@ public class StaticDataController {
responseData.set("webViewUrl","/");
responseData.set("message","目前不支持小程序打印。已自动复制网址,请在手机浏览器里粘贴该网址进行打印。");
return Result.OK(responseData);
case "professionalCategoryList":
if (StringUtils.isBlank(programType) || "艺体志愿宝".equals(programType)) {
String json = "[{\"value\":\"美术与设计类\",\"label\":\"美术与设计类\",\"scoreMax\":300},{\"value\":\"音乐类\",\"label\":\"音乐类\",\"scoreMax\":300,\"children\":[{\"label\":\"音乐表演声乐\",\"value\":\"音乐表演声乐\",\"exclude\":\"音乐表演器乐\"},{\"label\":\"音乐表演器乐\",\"value\":\"音乐表演器乐\",\"exclude\":\"音乐表演声乐\"},{\"label\":\"音乐教育\",\"value\":\"音乐教育\"}]},{\"value\":\"舞蹈类\",\"label\":\"舞蹈类\",\"scoreMax\":300},{\"value\":\"播音与主持类\",\"label\":\"播音与主持类\",\"scoreMax\":300},{\"value\":\"表演类\",\"label\":\"表演类\",\"scoreMax\":300,\"children\":[{\"label\":\"服装表演\",\"value\":\"服装表演\"},{\"label\":\"戏剧影视导演\",\"value\":\"戏剧影视导演\"},{\"label\":\"戏剧影视表演\",\"value\":\"戏剧影视表演\"}]},{\"value\":\"书法类\",\"label\":\"书法类\",\"scoreMax\":300},{\"value\":\"体育类\",\"label\":\"体育类\",\"scoreMax\":150}]";
return Result.OK(JSONArray.parseArray(json));
}else{
String json = "[{\"value\":\"体育类\",\"label\":\"体育类\",\"scoreMax\":150}]";
return Result.OK(JSONArray.parseArray(json));
}
}
if ("reloadMajorModalMessage".equals(key)) {

View File

@ -29,6 +29,7 @@ import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.modules.mini.douyin.config.DouYinConfig;
import org.jeecg.modules.mini.douyin.config.DouYinTiyuConfig;
import org.jeecg.modules.mini.douyin.model.DouYinOrderSyncModel;
import org.jeecg.modules.mini.douyin.model.ItemStruct;
import org.jeecg.modules.mini.douyin.util.DouWayPaymentMethod;
@ -81,15 +82,21 @@ public class MiniPayApiController {
@Resource
private DouYinConfig douYinConfig;
@Resource
private DouYinTiyuConfig douYinTiyuConfig;
@Resource
private WeXinConfig weXinConfig;
/**
* 小程序支付
* https://blog.fasterinfo.top/13871.html
*/
@RequestMapping("/jsApiPay")
@RequestMapping("/v1/jsApiPay")
@ResponseBody
public Result<?> jsApiPay(@RequestBody JSONObject requestBody) {
String programType = requestBody.getString("programType");
if (StringUtils.isBlank(programType)) {
programType = "艺体志愿宝";
}
String provider = requestBody.getString("provider");//供应商
String skuCode = requestBody.getString("skuCode");
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@ -131,11 +138,16 @@ public class MiniPayApiController {
yxOrder.setPaymentUserId(user.getId());//付款人
yxOrder.setOrderStatus("1");
yxOrder.setProvider(provider);
yxOrder.setPaymentType(programType);
//判断是抖音平台 还是 微信平台 小程序操作
if ("toutiao".equals(provider)) {
//抖音
String douyinSign = DouYinUtil.main(douYinConfig.getAppId(), douYinConfig.getToken(),douYinConfig.getNotifyUrl(), douYinConfig.getSalt(), orderCode, totalAmount.intValue(),yxVipSku.getSkuName(), description);
yxOrder.setOrderSign(douyinSign);
if("体育志愿宝".equals(programType)){
String douyinSign = DouYinUtil.main(douYinTiyuConfig.getAppId(), douYinTiyuConfig.getToken(),douYinTiyuConfig.getNotifyUrl(), douYinTiyuConfig.getSalt(), orderCode, totalAmount.intValue(),yxVipSku.getSkuName(), description);
yxOrder.setOrderSign(douyinSign);
}else{
String douyinSign = DouYinUtil.main(douYinConfig.getAppId(), douYinConfig.getToken(),douYinConfig.getNotifyUrl(), douYinConfig.getSalt(), orderCode, totalAmount.intValue(),yxVipSku.getSkuName(), description);
yxOrder.setOrderSign(douyinSign);
}
}
else {
String timeExpire = DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis() + 1000 * 60 * 3);
@ -187,13 +199,14 @@ public class MiniPayApiController {
return Result.error("唤起失败");
}
/**
* 抖音支付回调
* 支付回调
*
* @param request
* @param response
*/
@RequestMapping(value = "/payNotify", method = {RequestMethod.POST, RequestMethod.GET})
@RequestMapping(value = "/v1/payNotify", method = {RequestMethod.POST, RequestMethod.GET})
public void payNotify(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> map = new HashMap<>(12);
String result = HttpKit.readData(request);
@ -309,15 +322,14 @@ public class MiniPayApiController {
}
}
/**
* 抖音支付回调
* 抖音退款回调
*
* @param request
* @param response
*/
@RequestMapping(value = "/dy/payNotify", method = {RequestMethod.POST, RequestMethod.GET})
public void dyPayNotify(HttpServletRequest request, HttpServletResponse response) {
@RequestMapping(value = "/v1/dy/refundNotify", method = {RequestMethod.POST, RequestMethod.GET})
public void dyRefundNotify(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> map = new HashMap<>(12);
System.out.println("/dy/payNotify:");
String result = HttpKit.readData(request);
@ -376,6 +388,160 @@ public class MiniPayApiController {
}
}
/**
* 支付回调
*
* @param request
* @param response
*/
@RequestMapping(value = "/v1/dy/tiyu/payNotify", method = {RequestMethod.POST, RequestMethod.GET})
public void dyTiyuPayNotify(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> map = new HashMap<>(12);
String result = HttpKit.readData(request);
try {
String timestamp = request.getHeader("Wechatpay-Timestamp");
YxOrder yxOrder = null;
SysUser sysUser = null;
//抖音小程序
System.out.println("===================result:" + result);
JSONObject requestJson = JSONObject.parseObject(result);
//生成本地签名
List<String> sortedString = new ArrayList<>();
//token
sortedString.add(douYinTiyuConfig.getToken());
//时间戳
sortedString.add(requestJson.getString("timestamp"));
//随机数
sortedString.add(requestJson.getString("nonce"));
//msg
sortedString.add(requestJson.getString("msg"));
Collections.sort(sortedString);
StringBuilder sb = new StringBuilder();
sortedString.forEach(sb::append);
String sign = Sign.callbackSign(sortedString);
timestamp = requestJson.getString("timestamp");//Unix 时间戳字符串类型
String nonce = requestJson.getString("nonce");//随机数
String msgSignature = requestJson.getString("msg_signature");//签名
String type = requestJson.getString("type");//回调类型标记支付成功回调为"payment"
String msg = requestJson.getString("msg");
JSONObject msgJson = JSONObject.parseObject(msg);//订单信息的 json 字符串
String way = msgJson.getString("way");//way 字段中标识了支付渠道 1-微信支付2-支付宝支付10-抖音支付
String cpOrderno = msgJson.getString("cp_orderno");//订单号
String channelNo = msgJson.getString("channel_no");//支付渠道侧单号(抖音平台请求下游渠道微信或支付宝时传入的单号)
String paymentOrderNo = msgJson.getString("payment_order_no");//支付渠道侧PC单号支付页面可见(微信支付宝侧的订单号)
Integer totalAmount = msgJson.getInteger("total_amount");//支付金额单位为分
String status = msgJson.getString("status");//固定SUCCESS
Long paidAt = msgJson.getLong("paid_at");//支付时间Unix 时间戳10 整型数
if ("SUCCESS".equals(status) && sign.equals(msgSignature)) {
//支付成功修改订单信息
Date date = new Date();
date.setTime(paidAt*YxConstant.bigDecimal1000);
yxOrderService.paymentOrderOver(cpOrderno, DouWayPaymentMethod.getByWay(way), "2", date);
yxOrder = yxOrderService.getByOrderCode(cpOrderno);
sysUser = sysUserService.getById(yxOrder.getPaymentUserId());
long createTimeLong = yxOrder.getCreateTime().getTime() / YxConstant.bigDecimal1000;
//同步抖音订单
DouYinOrderSyncModel douYinOrderSyncModel = new DouYinOrderSyncModel();
douYinOrderSyncModel.setOrder_id(cpOrderno);
douYinOrderSyncModel.setCreate_time(createTimeLong);
douYinOrderSyncModel.setStatus("已支付");
douYinOrderSyncModel.setAmount(1);//订单总数
douYinOrderSyncModel.setTotal_price(yxOrder.getTotalAmount().longValue());
douYinOrderSyncModel.setDetail_url("pages/zyb/order/detail?orderCode="+cpOrderno);
List<ItemStruct> itemList=new ArrayList<>();
String img="https://mp-7a4eecb1-2a04-4d36-b050-1c4a78cc31a4.cdn.bspapp.com/images/vip.png";
if ("1001".equals(yxOrder.getSkuCode())) {
img="https://mp-7a4eecb1-2a04-4d36-b050-1c4a78cc31a4.cdn.bspapp.com/images/tiyanka.png";
}
itemList.add(new ItemStruct(yxOrder.getSkuCode(),img,"艺体志愿宝-"+yxOrder.getSkuName(),null,1,yxOrder.getTotalAmount().longValue()));
douYinOrderSyncModel.setItem_list(itemList);
DouYinUtil.orderSync(douYinOrderSyncModel,douYinTiyuConfig.getAppId(),douYinTiyuConfig.getAppSecret(),sysUser.getDyOpenId());
response.setStatus(200);
map.put("code", "SUCCESS");
map.put("message", "SUCCESS");
} else {
response.setStatus(500);
map.put("code", "ERROR");
map.put("message", "签名错误");
}
response.setHeader("Content-type", ContentType.JSON.toString());
response.getOutputStream().write(JSONUtil.toJsonStr(map).getBytes(StandardCharsets.UTF_8));
response.flushBuffer();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 抖音退款回调_体育类
*
* @param request
* @param response
*/
@RequestMapping(value = "/v1/dy/tiyu/refundNotify", method = {RequestMethod.POST, RequestMethod.GET})
public void dyTiyuRefundNotify(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> map = new HashMap<>(12);
System.out.println("/dy/payNotify:");
String result = HttpKit.readData(request);
cn.hutool.json.JSONObject requestJson = new cn.hutool.json.JSONObject(result);
String type = requestJson.getStr("type");
try {
// 退款
if ("refund".equals(type)) {
// 验证签名一致性
List<String> sortedString = new ArrayList<>();
//token
sortedString.add(douYinTiyuConfig.getToken());
//时间戳
sortedString.add(requestJson.getStr("timestamp"));
//随机数
sortedString.add(requestJson.getStr("nonce"));
//msg
sortedString.add(requestJson.getStr("msg"));
Collections.sort(sortedString);
StringBuilder sb = new StringBuilder();
sortedString.forEach(sb::append);
String sign = Sign.callbackSign(sortedString);
String msgSignature = requestJson.getStr("msg_signature");//签名
String msg = requestJson.getStr("msg");
JSONObject msgJson = JSONObject.parseObject(msg);
if (sign.equals(msgSignature)) {
//签名一致更改订单状态为退款
String orderCode = msgJson.getString("order_id");
String cpRefundNo = msgJson.getString("cp_refundno");
String refundNo = msgJson.getString("refund_no");
BigDecimal refundAmount = msgJson.getBigDecimal("refund_amount");
// 执行更改订单状态
YxOrder yxOrder = yxOrderService.updateRefund(orderCode, cpRefundNo, refundNo, refundAmount);
// 更改当前用户的状态
if(yxOrder!=null &&StringUtils.isNotBlank(yxOrder.getPaymentUserId())){
miniUserService.logoutUser(yxOrder.getPaymentUserId());
}
response.setStatus(200);
map.put("code", "SUCCESS");
map.put("message", "SUCCESS");
} else {
response.setStatus(500);
map.put("code", "ERROR");
map.put("message", "签名错误");
}
}
response.setHeader("Content-type", ContentType.JSON.toString());
response.getOutputStream().write(JSONUtil.toJsonStr(map).getBytes(StandardCharsets.UTF_8));
response.flushBuffer();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e){
log.error("接收退款请求时出错,",e);
//e.printStackTrace();
}
}
private String getSerialNumber() {
// 获取证书序列号
X509Certificate certificate = PayKit.getCertificate(weXinConfig.getCertPath());

View File

@ -3,26 +3,33 @@ package org.jeecg.modules.mini.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.mini.service.MiniSchoolService;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.entity.YxHistoryMajorEnroll;
import org.jeecg.modules.yx.entity.YxHistoryScoreControlLine;
import org.jeecg.modules.yx.entity.YxSchoolDoubleFirstPlan;
import org.jeecg.modules.yx.entity.YxSubjectEvaluation;
import org.jeecg.modules.yx.service.IYxSchoolDoubleFirstPlanService;
import org.jeecg.modules.yx.service.IYxSchoolService;
import org.jeecg.modules.yx.service.IYxSubjectEvaluationService;
import org.jeecg.modules.yx.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -44,6 +51,10 @@ public class MiniSchoolController {
@Autowired
private IYxSubjectEvaluationService yxSubjectEvaluationService;
@Resource
private IYxHistoryMajorEnrollService yxHistoryMajorEnrollService;
@Resource
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
@Resource
private RedisUtil redisUtil;
@ApiOperation(value = "学校详情")
@GetMapping("/schoolInfo")

View File

@ -16,6 +16,8 @@ import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.*;
import org.jeecg.modules.mini.douyin.config.DouYinConfig;
import org.jeecg.modules.mini.douyin.config.DouYinTiyuConfig;
import org.jeecg.modules.mini.douyin.vo.DyLoginVo;
import org.jeecg.modules.mini.dto.VipDTO;
import org.jeecg.modules.mini.service.MiniUserService;
@ -32,6 +34,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.IvParameterSpec;
@ -51,6 +54,11 @@ import java.util.*;
@Api(tags = "小程序用户接口")
@Slf4j
public class MiniUserController {
@Resource
private DouYinTiyuConfig douYinTiyuConfig;
@Resource
private DouYinConfig douYinConfig;
@Value("${dy.appId}")
private String dyAppId;
@Value("${dy.appSecret}")
@ -70,6 +78,7 @@ public class MiniUserController {
public static final String AES = "AES";
public static final String AES_CBC_PADDING = "AES/CBC/PKCS7Padding";
@PostMapping(value = "/editUserInfo")
@ApiOperation(value = "编辑用户信息")
public Result<?> editUserInfo(@RequestBody SysUser sysUser) {
@ -87,6 +96,318 @@ public class MiniUserController {
return Result.OK("保存成功");
}
@ApiOperation("v1登录接口")
@RequestMapping(value = "/v1/login", method = RequestMethod.POST)
public Result<JSONObject> v1Login(@RequestBody SysLoginModel sysLoginModel) {
Result<JSONObject> result;
String programType = sysLoginModel.getProgramType();
String username = sysLoginModel.getUsername();
String password = sysLoginModel.getPassword();
AssertUtils.notEmpty(programType,"平台参数错误");
AssertUtils.notEmpty(username,"请输入必填参数");
AssertUtils.notEmpty(password,"请输入必填参数");
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysUser::getPhone, username);
queryWrapper.eq(SysUser::getProgramType,programType);
SysUser sysUser = sysUserService.getOne(queryWrapper);
result = sysUserService.checkUserIsEffective(sysUser);
if (!result.isSuccess()) {
return result;
}
//2. 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(sysUser.getUsername(), password, sysUser.getSalt());
String syspassword = sysUser.getPassword();
if (!syspassword.equals(userpassword)) {
result.error500("用户名或密码错误");
return result;
}
//仅保留一端登录
miniUserService.oneUserLogin(sysUser);
//用户登录信息
//1.生成token
String token = JwtUtil.sign(sysUser.getUsername(), syspassword);
JSONObject obj = new JSONObject();
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(sysUser, loginUser);
Integer perfixUserToeknTime = CommonConstant.PERFIX_USER_TOKEN_TIME;
//获取vip信息
VipDTO vipDTO = miniUserService.getUserVip(sysUser.getId());
if (vipDTO != null) {
if (vipDTO.getValidTime()!=null) {
if ((vipDTO.getValidTime().getTime()-new Date().getTime())<perfixUserToeknTime) {
// 如果VIP到期时间是今天时间不足8小时redis登录状态设置到期时间及现在的间隔
perfixUserToeknTime = Math.toIntExact(vipDTO.getValidTime().getTime() - new Date().getTime());
}
}
obj.put("vipInfo", vipDTO);
} else {
obj.put("vipInfo", null);
}
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, perfixUserToeknTime);
obj.put("token", token);
obj.put("openId", "openId");
obj.put("sessionKey", "sessionKey");
obj.put("userInfo", loginUser);
return Result.OK(obj);
}
@ApiOperation("v1注册")
@RequestMapping(value = "/v1/register",method = RequestMethod.POST)
public Result<JSONObject> v1Register(@RequestBody SysLoginModel sysLoginModel) {
Result<JSONObject> result = new Result<JSONObject>();
String programType = sysLoginModel.getProgramType();
String username = sysLoginModel.getUsername();
String password = sysLoginModel.getPassword();
AssertUtils.notEmpty(programType,"平台参数错误");
AssertUtils.notEmpty(username,"请输入必填参数");
AssertUtils.notEmpty(password,"请输入必填参数");
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysUser::getPhone, username);
queryWrapper.eq(SysUser::getProgramType,programType);
SysUser sysUser = sysUserService.getOne(queryWrapper);
if (sysUser != null) {
result.error500("手机号已被注册");
return result;
}
//2. 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(sysUser.getUsername(), password, sysUser.getSalt());
String syspassword = sysUser.getPassword();
if (!syspassword.equals(userpassword)) {
result.error500("用户名或密码错误");
return result;
}
//用户登录信息
//1.生成token
String token = JwtUtil.sign(sysUser.getUsername(), syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, CommonConstant.PERFIX_USER_TOKEN_TIME);
JSONObject obj = new JSONObject();
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(sysUser, loginUser);
//获取vip信息
VipDTO vipDTO = miniUserService.getUserVip(sysUser.getId());
if (vipDTO != null) {
obj.put("vipInfo", vipDTO);
} else {
obj.put("vipInfo", null);
}
obj.put("token", token);
obj.put("openId", "openId");
obj.put("sessionKey", "sessionKey");
obj.put("userInfo", loginUser);
return Result.OK(obj);
}
@ApiOperation(value = "v1微信手机登录")
@PostMapping("/v1/wechatLogin")
public Result<?> v1WechatLogin(@NotNull @RequestBody WxModel wxModel) {
String programType = wxModel.getProgramType();
AssertUtils.notEmpty(programType,"平台参数错误");
SysUser user = null;
String url = "https://api.weixin.qq.com/sns/jscode2session" +
"?appid=" + wxAppId +
"&secret=" + wxAppSecret +
"&grant_type=authorization_code" +
"&js_code=" + wxModel.code;
String s = HttpUtil.get(url);
JSONObject jsonObject = JSONObject.parseObject(s);
AssertUtils.notNull(jsonObject, "登录失败");
String wxOpenId = jsonObject.getString("openid");
String sessionKey = jsonObject.getString("session_key");
user = sysUserService.getByWxOpenId(wxOpenId);
if (user == null) {
//判断 用户的手机号有没有注册
String phone = phoneDecrypt(wxModel.getEncryptedData(), sessionKey, wxModel.getIv());
user = sysUserService.getUserByPhone(phone);
if (user == null) {
//如果手机号也没有那就说明这个是新用户
String salt = oConvertUtils.randomGen(8);
//新用户
user = new SysUser();
user.setWxOpenId(wxOpenId);
user.setUsername(salt);
user.setRealname("用户+" + salt);
user.setSalt(salt);
String encryptPassword = PasswordUtil.encrypt(salt, "123456", salt);
user.setPassword(encryptPassword);
user.setStatus(1);
//解密手机号
user.setPhone(phone);
user.setUserIdentity(CommonConstant.USER_IDENTITY_1);
user.setDelFlag(CommonConstant.DEL_FLAG_0);
user.setOrgCode(null);
user.setProgramType(programType);
sysUserService.saveUser(user, null, null, null);
}else{
//该手机号已经注册直接覆盖微信openId
user.setWxOpenId(wxOpenId);
sysUserService.updateById(user);
}
}
//仅保留一端登录
miniUserService.oneUserLogin(user);
String username = user.getUsername();
String syspassword = user.getPassword();
//1.生成token
String token = JwtUtil.sign(username, syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, CommonConstant.PERFIX_USER_TOKEN_TIME);
JSONObject obj = new JSONObject();
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(user, loginUser);
//获取vip信息
VipDTO vipDTO = miniUserService.getUserVip(user.getId());
if (vipDTO != null) {
obj.put("vipInfo", vipDTO);
} else {
obj.put("vipInfo", null);
}
obj.put("token", token);
obj.put("openId", "openId");
obj.put("sessionKey", "sessionKey");
obj.put("userInfo", loginUser);
obj.put("loginState", "not");
//判断是不是 二维码登录
if (StringUtils.isNotBlank(wxModel.getUuid())) {
//更改二维码登录状态 通过,180s
redisUtil.set(WeiXinConstant.QR_CODE_KEY + wxModel.getUuid(),WeiXinConstant.WX_QRCODE_SUCCESS_STATUS+"-"+user.getId()+"-"+token,180);
}
return Result.OK(obj);
}
@ApiOperation("v1抖音-登录接口")
@PostMapping("/v1/dyLogin")
public Result<?> v1dyLogin(@RequestBody DyLoginVo vo) {
String programType = vo.getProgramType();
AssertUtils.notEmpty(programType,"平台参数错误");
if (StringUtils.isEmpty(vo.getCode())) {
return Result.error("code 不能为空");
}
String dyAppId = getDyAppId(programType);
String dyAppSecret = getDyAppSecret(programType);
//获取用户基本信息
JSONObject jsonObject = new JSONObject();
jsonObject.put("appid", dyAppId);
jsonObject.put("secret", dyAppSecret);
jsonObject.put("code", vo.getCode());
jsonObject.put("anonymous_code", "");
JSONObject baseDataObject = RestUtil.post("https://developer.toutiao.com/api/apps/v2/jscode2session", jsonObject);
String jsonString = JSONObject.toJSONString(jsonObject);
String baseDataStr = JSONObject.toJSONString(baseDataObject);
long redisTokenTime = CommonConstant.PERFIX_USER_TOKEN_TIME;
if (baseDataObject.get("data") == null) {
log.error("获取字节用户基本信息异常 req => {} , res => {}", jsonString, baseDataStr);
return Result.error("获取用户信息失败");
}
JSONObject baseData = baseDataObject.getJSONObject("data");
if (StringUtils.isBlank(baseData.getString("openid"))) {
log.error("获取字节用户基本信息异常 req => {} , res => {}", jsonString, baseDataStr);
return Result.error("获取用户信息失败");
}
String openId = baseData.get("openid").toString();
SysUser user = sysUserService.getByDyOpenId(openId);
if (user == null) {
redisTokenTime = 3600;
String salt = oConvertUtils.randomGen(8);
//新用户
user = new SysUser();
user.setDyOpenId(openId);
user.setUsername(salt);
user.setRealname("用户-" + salt);
user.setSalt(salt);
String encryptPassword = PasswordUtil.encrypt(salt, "123456", salt);
user.setPassword(encryptPassword);
user.setStatus(1);
user.setUserIdentity(CommonConstant.USER_IDENTITY_1);
user.setDelFlag(CommonConstant.DEL_FLAG_0);
user.setOrgCode(null);
user.setProgramType(programType);
sysUserService.saveUser(user, null, null, null);
}
//仅保留一端登录
miniUserService.oneUserLogin(user);
String username = user.getUsername();
String syspassword = user.getPassword();
//1.生成token
String token = JwtUtil.sign(username, syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, redisTokenTime);
JSONObject obj = new JSONObject();
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(user, loginUser);
//获取vip信息
VipDTO vipDTO = miniUserService.getUserVip(user.getId());
if (vipDTO != null) {
obj.put("vipInfo", vipDTO);
} else {
obj.put("vipInfo", null);
}
obj.put("token", token);
obj.put("openId", "openId");
obj.put("sessionKey", "sessionKey");
obj.put("userInfo", loginUser);
obj.put("loginState", "not");
return Result.OK(obj);
}
@ApiOperation(value = "v1抖音-判断手机号的绑定情况")
@RequestMapping(value = "/v1/dyCheckBindPhone",method = RequestMethod.POST)
public Result<?> v1DyCheckBindPhone(@RequestBody Map<String,String> params) {
String programType = params.get("programType");
String phone = params.get("phone");
AssertUtils.notEmpty(programType,"请求参数有误");
AssertUtils.notEmpty(phone,"请求参数有误");
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysUserLambdaQueryWrapper.eq(SysUser::getProgramType,programType);
sysUserLambdaQueryWrapper.eq(SysUser::getPhone,phone);
SysUser sysUser = sysUserService.getOne(sysUserLambdaQueryWrapper);
Map<String, Object> data = new HashMap<>();
if (sysUser == null) {
//未绑定
data.put("status", 0);
} else if (StringUtils.isNotBlank(sysUser.getDyOpenId())) {
//已绑定抖音openId不可绑定
data.put("status", 1);
} else if (StringUtils.isNotBlank(sysUser.getWxOpenId())) {
//已绑定微信openId
data.put("status", 2);
}
return Result.OK(data);
}
@PostMapping(value = "/v1/dyBindPhone")
@ApiOperation(value = "抖音-绑定手机号")
public Result<?> v1DyBindPhone(@RequestBody SysUser sysUser) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String id = loginUser.getId();
String phone = sysUser.getPhone();
String programType = loginUser.getProgramType();
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysUserLambdaQueryWrapper.eq(SysUser::getProgramType,programType);
sysUserLambdaQueryWrapper.eq(SysUser::getPhone,phone);
SysUser newSysUser = sysUserService.getOne(sysUserLambdaQueryWrapper);
if (newSysUser == null) {
//绑定手机号
LambdaUpdateWrapper<SysUser> sysUserLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
sysUserLambdaUpdateWrapper.eq(SysUser::getId, id);
sysUserLambdaUpdateWrapper.set(SysUser::getPhone, phone);
sysUserService.update(sysUserLambdaUpdateWrapper);
return Result.OK(1);
}
//对应手机号的数据转移到当前账号下
miniUserService.transferDataUser(id, newSysUser.getId());
return Result.OK(2);
}
@ApiOperation("注册接口")
@RequestMapping(value = "/register", method = RequestMethod.POST)
public Result<JSONObject> register(@RequestBody SysLoginModel sysLoginModel) {
@ -132,6 +453,7 @@ public class MiniUserController {
return Result.OK(obj);
}
@ApiOperation("登录接口")
@RequestMapping(value = "/login", method = RequestMethod.POST)
public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel) {
@ -420,4 +742,21 @@ public class MiniUserController {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
KeyGenerator.getInstance(AES).init(128);
}
public String getDyAppId(String programType){
if ("体育志愿宝".equals(programType)) {
return douYinTiyuConfig.getAppId();
}else{
return douYinConfig.getAppId();
}
}
public String getDyAppSecret(String programType){
if ("体育志愿宝".equals(programType)) {
return douYinTiyuConfig.getAppSecret();
}else{
return douYinConfig.getAppSecret();
}
}
}

View File

@ -56,8 +56,22 @@ public class MiniVipController {
@Resource
private RedisUtil redisUtil;
@GetMapping(value = "/getVipInfo")
@ApiOperation(value = "获取全部商品信息")
@RequestMapping(value = "/v1/sku/all",method = RequestMethod.POST)
public Result<?> v1SkuAll(@RequestBody Map<String,Object> params) {
String programType = (String) params.get("programType");
AssertUtils.notEmpty(programType,"请求参数有误");
LambdaQueryWrapper<YxVipSku> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(YxVipSku::getSaleable, "1");
queryWrapper.ne(YxVipSku::getSkuName, "测试体验卡");
queryWrapper.eq(YxVipSku::getProgramType,programType);
queryWrapper.orderByAsc(YxVipSku::getCreateTime);
List<YxVipSku> list = yxVipSkuService.list(queryWrapper);
return Result.OK(list);
}
@ApiOperation(value = "获取vip信息")
@GetMapping(value = "/getVipInfo")
public Result<?> vipInfo() {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
AssertUtils.notNull(loginUser, "未获取到登录信息");
@ -65,29 +79,26 @@ public class MiniVipController {
return Result.OK(userVip);
}
@GetMapping(value = "/sku/all")
@ApiOperation(value = "获取全部商品信息")
public Result<?> skuAll(@RequestParam(defaultValue = "") String provider) {
/*if (StringUtils.isNotBlank(provider) && "toutiao".equals(provider)) {
LambdaQueryWrapper<YxVipSku> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(YxVipSku::getSkuName,"测试体验卡");
queryWrapper.orderByDesc(YxVipSku::getSkuPrice);
List<YxVipSku> list = yxVipSkuService.list(queryWrapper);
return Result.OK(list);
}else{*/
@GetMapping(value = "/sku/all")
public Result<?> skuAll() {
LambdaQueryWrapper<YxVipSku> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(YxVipSku::getSaleable, "1");
queryWrapper.ne(YxVipSku::getSkuName, "测试体验卡");
queryWrapper.eq(YxVipSku::getProgramType,"艺体志愿宝");
queryWrapper.orderByAsc(YxVipSku::getCreateTime);
List<YxVipSku> list = yxVipSkuService.list(queryWrapper);
return Result.OK(list);
// }
}
@PostMapping(value = "/card/activation")
@ApiOperation(value = "卡密激活")
public Result<?> cardActivation(@RequestBody JSONObject jsonObject, HttpServletRequest request) {
String key =YxConstant.VIP_CARD_KEY + "_" + IpUtils.getIpAddr(request);
@RequestMapping(value = {"/card/activation","/v1/card/activation"},method = RequestMethod.POST)
public Result<?> cardActivation(@RequestBody JSONObject params, HttpServletRequest request) {
String programType = (String) params.get("programType");
if (StringUtils.isBlank(programType)) {
programType = "艺体志愿宝";
}
String key =YxConstant.VIP_CARD_KEY + "_" + programType + "_" + IpUtils.getIpAddr(request);
Integer ipAddrCardCount = (Integer) redisUtil.get(key);
if (ipAddrCardCount!=null) {
AssertUtils.notTrue(ipAddrCardCount>=5,"当前操作过快,稍后重试");
@ -96,12 +107,13 @@ public class MiniVipController {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
SysUser user = sysUserService.getById(sysUser.getId());
AssertUtils.notNull(user, "获取用户信息失败,请联系管理员");
String card = jsonObject.getString("card");
String card = params.getString("card");
AssertUtils.notNull(card, "请输入卡密");
//检查card是否有效
boolean cardValid = yxVipCardService.cardIsValid(card);
AssertUtils.isTrue(cardValid, "当前卡密无效或已被使用");
YxVipCard yxVipCard = yxVipCardService.getOne(new LambdaQueryWrapper<YxVipCard>().eq(YxVipCard::getCardNum, card));
YxVipCard yxVipCard = yxVipCardService.getOne(new LambdaQueryWrapper<YxVipCard>().eq(YxVipCard::getProgramType,programType).eq(YxVipCard::getCardNum, card));
AssertUtils.notNull(yxVipCard, "当前卡密无效或已被使用");
VipDTO userVip = miniUserService.getUserVip(user.getId());
if (userVip != null && userVip.getVipLevel() != 0) {
AssertUtils.notTrue(yxVipSkuService.convertVipLevel(yxVipCard.getSkuCode()) <= userVip.getVipLevel(), "该权益您已激活!不可重复兑换");
@ -115,12 +127,11 @@ public class MiniVipController {
// 记录兑换次数
throw new JeecgBootException(e.getMessage());
}
return Result.OK("激活成功");
}
@GetMapping(value = "/orderDetail")
@ApiOperation(value = "获取订单详情")
@GetMapping(value = "/orderDetail")
public Result<?> buy(@RequestParam(value = "orderCode") String orderCode) {
AssertUtils.notNull(orderCode, "订单编号为空!");
YxOrder yxOrder = yxOrderService.getOne(new LambdaQueryWrapper<YxOrder>().eq(YxOrder::getOrderCode, orderCode));

View File

@ -0,0 +1,23 @@
package org.jeecg.modules.mini.douyin.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.io.Serializable;
/**
* @author ZhouWenTao
* @create 2024-06-26-13:03
*/
@Data
@Component
@ConfigurationProperties(prefix = "dytiyu")
public class DouYinTiyuConfig implements Serializable {
private String appId;
private String appSecret;
private String token;
private String notifyUrl;// 支付回调地址
private String refundNotifyUrl;// 退款回调地址
private String salt;
}

View File

@ -13,9 +13,12 @@ public class DyLoginVo {
private String btyeDanceType = "dy";
// 加密手机号
private String encryptedMobile;
private String anonymousCode;
//昵称
private String nickName;
//头像
private String avatarUrl;
private String programType;
}

View File

@ -13,8 +13,7 @@ public class WxModel implements Serializable {
public String sessionKey;
public String encryptedData;
public String iv;
public String openId;
private String uuid;
private String programType;
}

View File

@ -227,4 +227,9 @@ public class SysUser implements Serializable {
* 是否显示历年线差
*/
private String showLinediff;
/**
* 所属程序
*/
private String programType;
}

View File

@ -26,4 +26,7 @@ public class SysLoginModel {
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "所属程序")
private String programType;
}

View File

@ -7,19 +7,17 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.mini.service.MiniSchoolService;
import org.jeecg.modules.web.dto.CardImportTest;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.entity.YxSchoolDoubleFirstPlan;
import org.jeecg.modules.yx.entity.YxSubjectEvaluation;
import org.jeecg.modules.yx.entity.YxVipCard;
import org.jeecg.modules.yx.service.IYxSchoolDoubleFirstPlanService;
import org.jeecg.modules.yx.service.IYxSchoolService;
import org.jeecg.modules.yx.service.IYxSubjectEvaluationService;
import org.jeecg.modules.yx.service.IYxVipCardService;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.entity.*;
import org.jeecg.modules.yx.service.*;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
@ -29,7 +27,11 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.File;
import java.math.BigDecimal;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -54,6 +56,10 @@ public class WebSchoolController {
private IYxVipCardService vipCardService;
@Resource
private RedisUtil redisUtil;
@Resource
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
@Resource
private IYxHistoryMajorEnrollService yxHistoryMajorEnrollService;
@ApiOperation(value = "学校详情")
@GetMapping("/schoolInfo")
public Result<?> schoolInfo(QueryRecommendMajorVO queryRecommendMajorVO){
@ -94,9 +100,136 @@ public class WebSchoolController {
@ApiOperation(value = "搜索学校")
@GetMapping("/search")
public Result<?> search(QueryRecommendMajorVO queryRecommendMajorVO){
int index =0;
try {
if(false){
LambdaQueryWrapper<YxHistoryScoreControlLine> yxHistoryScoreControlLineLambdaQueryWrapper = new LambdaQueryWrapper<>();
yxHistoryScoreControlLineLambdaQueryWrapper.in(YxHistoryScoreControlLine::getYear,"2023","2022","2021","2020");
yxHistoryScoreControlLineLambdaQueryWrapper.eq(YxHistoryScoreControlLine::getBatch,"本科B段");
yxHistoryScoreControlLineLambdaQueryWrapper.ne(YxHistoryScoreControlLine::getProfessionalCategory,"体育类");
List<YxHistoryScoreControlLine> historyScoreControlLineList = yxHistoryScoreControlLineService.list(yxHistoryScoreControlLineLambdaQueryWrapper);
Map<String,YxHistoryScoreControlLine> maps= new LinkedHashMap<>();
String key = null;
for (YxHistoryScoreControlLine yxHistoryScoreControlLine : historyScoreControlLineList) {
key = yxHistoryScoreControlLine.getYear()+"_"+yxHistoryScoreControlLine.getCategory()+"_"+yxHistoryScoreControlLine.getProfessionalCategory();
maps.put(key,yxHistoryScoreControlLine);
}
LambdaQueryWrapper<YxHistoryMajorEnroll> yxHistoryMajorEnrollLambdaQueryWrapper = new LambdaQueryWrapper<>();
yxHistoryMajorEnrollLambdaQueryWrapper.in(YxHistoryMajorEnroll::getBatch,"本科A段","提前批");
yxHistoryMajorEnrollLambdaQueryWrapper.ne(YxHistoryMajorEnroll::getMajorType,"体育类");
List<YxHistoryMajorEnroll> list = yxHistoryMajorEnrollService.list(yxHistoryMajorEnrollLambdaQueryWrapper);
String majorType = null;
String majorTypeChild = null;
String mainSubjects = null;
String year = null;
String mt = null;
YxHistoryScoreControlLine historyScoreControlLine = null;
BigDecimal culturalScore = null;
BigDecimal specialScore = null;
BigDecimal wenhuaBili = null;
BigDecimal zhuanyeBili = null;
String probabilityOperator = null;
String rulesEnrollProbability = null;
String[] operators = null;
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : list) {
index++;
majorType = yxHistoryMajorEnroll.getMajorType();
majorTypeChild = yxHistoryMajorEnroll.getMajorTypeChild();
mainSubjects = yxHistoryMajorEnroll.getMainSubjects();
year = yxHistoryMajorEnroll.getYear();
rulesEnrollProbability = yxHistoryMajorEnroll.getRulesEnrollProbability();
probabilityOperator = yxHistoryMajorEnroll.getProbabilityOperator();
if (index ==6850) {
System.out.println("111");
}
if ("舞蹈类".equals(majorType)) {
if (majorTypeChild.contains("国际") || mainSubjects.contains("国际")) {
mt = "国际标准舞类";
}else if(majorTypeChild.contains("艺术") || mainSubjects.contains("艺术")){
mt = "艺术舞蹈类";
}else{
throw new JeecgBootException("未获取到majorTypeChild");
}
key = year+"_"+yxHistoryMajorEnroll.getCategory()+"_"+mt;
}else{
key = year+"_"+yxHistoryMajorEnroll.getCategory()+"_"+yxHistoryMajorEnroll.getMajorType();
}
historyScoreControlLine = maps.get(key);
AssertUtils.notNull(historyScoreControlLine, String.format("行[%s],未在系统中找到省控线", index));
culturalScore = historyScoreControlLine.getCulturalScore();
specialScore = historyScoreControlLine.getSpecialScore();
//换算分数
if (StringUtils.isBlank(rulesEnrollProbability) && StringUtils.isBlank(probabilityOperator) ) {
continue;
}
if (StringUtils.isBlank(probabilityOperator) && StringUtils.isNotBlank(rulesEnrollProbability)) {
if ("文过专排".equals(rulesEnrollProbability)) {
zhuanyeBili = new BigDecimal(1);
wenhuaBili = new BigDecimal(0);
}else if ("专过文排".equals(rulesEnrollProbability)|| "文过专排主科".equals(rulesEnrollProbability)) {
wenhuaBili = new BigDecimal(1);
zhuanyeBili = new BigDecimal(0);
}else{
zhuanyeBili = null;
wenhuaBili = null;
}
}else{
operators = probabilityOperator.split("\\+");
for (String operator : operators) {
if (operator.contains("")) {
wenhuaBili = new BigDecimal(operator.split("\\*")[1]);
}
if (operator.contains("")) {
zhuanyeBili = new BigDecimal(operator.split("\\*")[1]);
}
}
}
if ("文过专排".equals(rulesEnrollProbability) || "文过专排主科".equals(rulesEnrollProbability)) {
BigDecimal multiply = specialScore.multiply(zhuanyeBili);
yxHistoryMajorEnroll.setControlLine(multiply);
yxHistoryMajorEnroll.setRulesEnrollProbability("文过专排");
} else if ("专过文排".equals(rulesEnrollProbability)) {
BigDecimal multiply = culturalScore.multiply(wenhuaBili);
yxHistoryMajorEnroll.setControlLine(multiply);
yxHistoryMajorEnroll.setRulesEnrollProbability("专过文排");
} else if ("其他计算办法".equals(rulesEnrollProbability)) {
yxHistoryMajorEnroll.setRulesEnrollProbability("其他计算办法");
} else {
if (wenhuaBili == null || zhuanyeBili == null) {
wenhuaBili = YxConstant.bigDecimal100;
zhuanyeBili = YxConstant.bigDecimal100;
}
yxHistoryMajorEnroll.setControlLine((culturalScore.multiply(wenhuaBili)).add((specialScore.multiply(zhuanyeBili))));
yxHistoryMajorEnroll.setRulesEnrollProbability(probabilityOperator);
}
}
index = 1;
LambdaUpdateWrapper<YxHistoryMajorEnroll> yxHistoryMajorEnrollLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
Date date = new Date();
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : list) {
if (StringUtils.isBlank(yxHistoryMajorEnroll.getRulesEnrollProbability()) && StringUtils.isBlank(yxHistoryMajorEnroll.getProbabilityOperator()) ) {
continue;
}
yxHistoryMajorEnrollLambdaUpdateWrapper.clear();
yxHistoryMajorEnrollLambdaUpdateWrapper.eq(YxHistoryMajorEnroll::getId,yxHistoryMajorEnroll.getId());
yxHistoryMajorEnrollLambdaUpdateWrapper.set(YxHistoryMajorEnroll::getControlLine,yxHistoryMajorEnroll.getControlLine());
yxHistoryMajorEnrollLambdaUpdateWrapper.set(YxHistoryMajorEnroll::getUpdateTime,date);
yxHistoryMajorEnrollService.update(yxHistoryMajorEnrollLambdaUpdateWrapper);
}
System.out.println("已处理");
}
}catch (Exception e){
return Result.error(""+index+"报错:"+e.getMessage());
}
return Result.OK(yxSchoolService.miniSchoolSearch(queryRecommendMajorVO));
}
@ApiOperation(value = "热门院校")
@GetMapping(value = "/hotList")
public Result<?> hotList(){

View File

@ -79,4 +79,7 @@ public class YxFeedback implements Serializable {
@Excel(name = "联系电话", width = 15)
@ApiModelProperty(value = "联系电话")
private java.lang.String contactPersonPhone;
/**所属程序*/
@ApiModelProperty(value = "所属程序")
private String programType;
}

View File

@ -111,6 +111,9 @@ public class YxOrder implements Serializable {
@ApiModelProperty(value = "退款原因")
private String refundReason;
@ApiModelProperty(value = "所属程序")
private String programType;
//==================
@TableField(exist = false)
private String skuName;

View File

@ -85,4 +85,9 @@ public class YxVipCard implements Serializable {
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**所属程序*/
@ApiModelProperty(value = "所属程序")
private java.lang.String programType;
}

View File

@ -83,5 +83,8 @@ public class YxVipSku implements Serializable {
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
/**所属程序*/
@ApiModelProperty(value = "所属程序")
private String programType;
}

View File

@ -32,5 +32,16 @@ dy:
token: a1b2c3
#支付 回调接口地址
notifyUrl: https://yitisheng.vip/jbt/mini/pay/v1/payNotify
refundNotifyUrl: https://yitisheng.vip/jbt/mini/pay/v1/dy/payNotify
refundNotifyUrl: https://yitisheng.vip/jbt/mini/pay/v1/dy/refundNotify
salt: wODf6Bg5BXndJ3IELXNb1w5CDMRjatXAmZVP2DQ7
# 抖音体育小程序
dytiyu:
appId: tt9a2bec96051c14c001
appSecret: c6a5360b7053488c632b2a30017e55a54a57cccc
token: hnszksssxgqz20240715
#支付 回调接口地址
notifyUrl: https://yitisheng.vip/jbt/mini/pay/v1/dy/tiyu/payNotify
# 退款回调
refundNotifyUrl: https://yitisheng.vip/jbt/mini/pay/v1/dy/tiyu/refundNotify
salt: 9GZi8LvC5cjvE6PC3mrqoTTBcuCQGNIocMOE8rfH