|
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
import com.aliyun.oss.OSS; |
|
|
import com.aliyun.oss.OSS; |
|
|
import com.aliyun.oss.OSSClientBuilder; |
|
|
import com.aliyun.oss.OSSClientBuilder; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import com.google.gson.Gson; |
|
|
import com.google.gson.Gson; |
|
|
@ -55,6 +56,8 @@ import org.jeecg.modules.cityComment.entity.CityComment; |
|
|
import org.jeecg.modules.cityComment.service.ICityCommentService; |
|
|
import org.jeecg.modules.cityComment.service.ICityCommentService; |
|
|
import org.jeecg.modules.cityConf.entity.CityConf; |
|
|
import org.jeecg.modules.cityConf.entity.CityConf; |
|
|
import org.jeecg.modules.cityConf.service.ICityConfService; |
|
|
import org.jeecg.modules.cityConf.service.ICityConfService; |
|
|
|
|
|
import org.jeecg.modules.cityGift.entity.CityGift; |
|
|
|
|
|
import org.jeecg.modules.cityGift.service.ICityGiftService; |
|
|
import org.jeecg.modules.cityHome.entity.CityHome; |
|
|
import org.jeecg.modules.cityHome.entity.CityHome; |
|
|
import org.jeecg.modules.cityHome.service.ICityHomeService; |
|
|
import org.jeecg.modules.cityHome.service.ICityHomeService; |
|
|
import org.jeecg.modules.cityIcon.entity.CityIcon; |
|
|
import org.jeecg.modules.cityIcon.entity.CityIcon; |
|
|
@ -84,6 +87,7 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.http.HttpMethod; |
|
|
import org.springframework.http.HttpMethod; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|
|
import org.springframework.util.LinkedMultiValueMap; |
|
|
import org.springframework.util.LinkedMultiValueMap; |
|
|
import org.springframework.util.MultiValueMap; |
|
|
import org.springframework.util.MultiValueMap; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
@ -91,6 +95,7 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import javax.transaction.Transactional; |
|
|
import java.io.*; |
|
|
import java.io.*; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.net.HttpURLConnection; |
|
|
import java.net.HttpURLConnection; |
|
|
@ -177,6 +182,8 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
private ICitySignLogService citySignLogService; |
|
|
private ICitySignLogService citySignLogService; |
|
|
@Resource |
|
|
@Resource |
|
|
private ICityMoneyLogService cityMoneyLogService; |
|
|
private ICityMoneyLogService cityMoneyLogService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private ICityGiftService cityGiftService; |
|
|
|
|
|
|
|
|
//流水记录 |
|
|
//流水记录 |
|
|
@Resource |
|
|
@Resource |
|
|
@ -197,7 +204,8 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
private static final String APP_ID = "wxa4d29e67e8a58d38"; |
|
|
private static final String APP_ID = "wxa4d29e67e8a58d38"; |
|
|
private static final String APP_SECRET = "866e4ba72bd86a4c79403b6b1341461b"; |
|
|
private static final String APP_SECRET = "866e4ba72bd86a4c79403b6b1341461b"; |
|
|
private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + APP_ID + "&secret=" + APP_SECRET; |
|
|
private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + APP_ID + "&secret=" + APP_SECRET; |
|
|
private static final String TEMPLATE_MESSAGE_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="; |
|
|
|
|
|
|
|
|
private static final String TEMPLATE_MESSAGE_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="; |
|
|
|
|
|
// String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=%s"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//缓存 |
|
|
//缓存 |
|
|
@ -1319,8 +1327,9 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
try { |
|
|
try { |
|
|
String accessToken = getAccessToken2(); |
|
|
String accessToken = getAccessToken2(); |
|
|
if (accessToken != null && !accessToken.isEmpty()) { |
|
|
if (accessToken != null && !accessToken.isEmpty()) { |
|
|
this.sendTemplateMessage2(accessToken, openid, templateId, createTemplateData()); |
|
|
|
|
|
return Result.OK("发送成功"); |
|
|
|
|
|
|
|
|
Map<String, Object> templateData = createTemplateData(); |
|
|
|
|
|
this.sendTemplateMessage2(accessToken, openid, templateId,templateData ); |
|
|
|
|
|
return Result.OK("发送成功", templateData); |
|
|
} else { |
|
|
} else { |
|
|
return Result.error("无法获取Access Token"); |
|
|
return Result.error("无法获取Access Token"); |
|
|
} |
|
|
} |
|
|
@ -1333,20 +1342,20 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
|
|
|
|
|
|
private Map<String, Object> createTemplateData() { |
|
|
private Map<String, Object> createTemplateData() { |
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
data.put("first", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "Hello, this is a test message!"); |
|
|
|
|
|
|
|
|
data.put("thing1", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "收到评论通知"); |
|
|
put("color", "#173177"); |
|
|
put("color", "#173177"); |
|
|
}}); |
|
|
}}); |
|
|
data.put("keyword1", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "Keyword1 Value"); |
|
|
|
|
|
|
|
|
data.put("thing2", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "评论人"); |
|
|
put("color", "#173177"); |
|
|
put("color", "#173177"); |
|
|
}}); |
|
|
}}); |
|
|
data.put("keyword2", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "Keyword2 Value"); |
|
|
|
|
|
|
|
|
data.put("thing3", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "评论内容"); |
|
|
put("color", "#173177"); |
|
|
put("color", "#173177"); |
|
|
}}); |
|
|
}}); |
|
|
data.put("remark", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "This is a remark."); |
|
|
|
|
|
|
|
|
data.put("time4", new HashMap<String, String>() {{ |
|
|
|
|
|
put("value", "2020-06-08 11:20:05"); |
|
|
put("color", "#173177"); |
|
|
put("color", "#173177"); |
|
|
}}); |
|
|
}}); |
|
|
return data; |
|
|
return data; |
|
|
@ -1374,6 +1383,14 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
requestBody.put("template_id", templateId); |
|
|
requestBody.put("template_id", templateId); |
|
|
requestBody.put("data", data); |
|
|
requestBody.put("data", data); |
|
|
|
|
|
|
|
|
|
|
|
requestBody.put("miniprogram", new HashMap<String, String>() {{ |
|
|
|
|
|
put("appid", appid); |
|
|
|
|
|
put("page", "pages/index/index"); |
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
//输出请求体 |
|
|
|
|
|
System.out.println("Request Body: " + JSON.toJSONString(requestBody)); |
|
|
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
String jsonRequest = objectMapper.writeValueAsString(requestBody); |
|
|
String jsonRequest = objectMapper.writeValueAsString(requestBody); |
|
|
|
|
|
|
|
|
@ -1413,7 +1430,9 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
//创建一个新的集合 |
|
|
//创建一个新的集合 |
|
|
List<CityShopping> newRecords = new ArrayList<>(); |
|
|
List<CityShopping> newRecords = new ArrayList<>(); |
|
|
for (CityShopping record : records) { |
|
|
for (CityShopping record : records) { |
|
|
record.setShopId(cityShopService.getById(record.getShopId()).getTitle()); |
|
|
|
|
|
|
|
|
CityShop byId = cityShopService.getById(record.getShopId()); |
|
|
|
|
|
record.setShopId(byId.getTitle()); |
|
|
|
|
|
record.setShop(byId); |
|
|
newRecords.add(record); |
|
|
newRecords.add(record); |
|
|
} |
|
|
} |
|
|
page1.setRecords(newRecords); |
|
|
page1.setRecords(newRecords); |
|
|
@ -1485,14 +1504,14 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
|
|
Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
|
|
Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
|
|
Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
|
|
|
|
|
|
|
|
CitySignLog one = citySignLogService.lambdaQuery() |
|
|
|
|
|
|
|
|
List<CitySignLog> list = citySignLogService.lambdaQuery() |
|
|
.eq(CitySignLog::getUserId, hanHaiMember.getId()) |
|
|
.eq(CitySignLog::getUserId, hanHaiMember.getId()) |
|
|
.between(CitySignLog::getCreateTime, startDate, endDate) |
|
|
.between(CitySignLog::getCreateTime, startDate, endDate) |
|
|
.one(); |
|
|
|
|
|
if(one==null){ |
|
|
|
|
|
return Result.OK(true); |
|
|
|
|
|
|
|
|
.list(); |
|
|
|
|
|
if(list.size()>0){ |
|
|
|
|
|
return Result.OK(false); |
|
|
} |
|
|
} |
|
|
return Result.OK(false); |
|
|
|
|
|
|
|
|
return Result.OK(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//点击签到 |
|
|
//点击签到 |
|
|
@ -1651,7 +1670,7 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
Page<CityShopping> page1 = cityShoppingService.lambdaQuery() |
|
|
Page<CityShopping> page1 = cityShoppingService.lambdaQuery() |
|
|
.eq(CityShopping::getShopId, shopId) |
|
|
.eq(CityShopping::getShopId, shopId) |
|
|
.eq(CityShopping::getIsOpen, "Y") |
|
|
.eq(CityShopping::getIsOpen, "Y") |
|
|
.eq(CityShopping::getClassName, 0) |
|
|
|
|
|
|
|
|
// .eq(CityShopping::getClassName, 0) |
|
|
.orderByDesc(CityShopping::getCreateTime) |
|
|
.orderByDesc(CityShopping::getCreateTime) |
|
|
.page(page); |
|
|
.page(page); |
|
|
return Result.OK(page1); |
|
|
return Result.OK(page1); |
|
|
@ -1686,4 +1705,209 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { |
|
|
cityShoppingService.saveOrUpdate(goods); |
|
|
cityShoppingService.saveOrUpdate(goods); |
|
|
return Result.OK("修改成功"); |
|
|
return Result.OK("修改成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//我的租房 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> getMyRent(String token,PageBean pageBean){ |
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
Page<CityHome> page = new Page<CityHome>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
|
|
Page<CityHome> page1 = cityHomeService |
|
|
|
|
|
.lambdaQuery() |
|
|
|
|
|
.eq(CityHome::getUserId, hanHaiMember.getId()) |
|
|
|
|
|
.orderByDesc(CityHome::getCreateTime) |
|
|
|
|
|
.page(page); |
|
|
|
|
|
return Result.OK(page1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//编辑我的租房 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> editMyRent(String token, CityHome bean){ |
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
CityHome cityHome = cityHomeService.getById(bean.getId()); |
|
|
|
|
|
if(null==cityHome){ |
|
|
|
|
|
return Result.error("租房不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
cityHomeService.saveOrUpdate(bean); |
|
|
|
|
|
return Result.OK("修改成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//删除我的租房 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> deleteMyRent(String token, String id){ |
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
CityHome cityHome = cityHomeService.getById(id); |
|
|
|
|
|
if(null==cityHome){ |
|
|
|
|
|
return Result.error("租房不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
cityHomeService.removeById(id); |
|
|
|
|
|
return Result.OK("删除成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//我的招聘 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> getMyJob(String token,PageBean pageBean){ |
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
Page<CityJob> page = new Page<CityJob>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
|
|
Page<CityJob> page1 = cityJobService |
|
|
|
|
|
.lambdaQuery() |
|
|
|
|
|
.eq(CityJob::getUserId, hanHaiMember.getId()) |
|
|
|
|
|
.orderByDesc(CityJob::getCreateTime) |
|
|
|
|
|
.page(page); |
|
|
|
|
|
return Result.OK(page1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//编辑我的招聘 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> editMyJob(String token, CityJob bean){ |
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
CityJob cityJob = cityJobService.getById(bean.getId()); |
|
|
|
|
|
if(null==cityJob){ |
|
|
|
|
|
return Result.error("招聘不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
cityJobService.saveOrUpdate(bean); |
|
|
|
|
|
return Result.OK("修改成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//删除我的招聘 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> deleteMyJob(String token, String id){ |
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
CityJob cityJob = cityJobService.getById(id); |
|
|
|
|
|
if(null==cityJob){ |
|
|
|
|
|
return Result.error("招聘不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
cityJobService.removeById(id); |
|
|
|
|
|
return Result.OK("删除成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//新-获取我的客服信息列表 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> getMyService(PageBean pageBean){ |
|
|
|
|
|
List<HanHaiMember> y = hanHaiMemberService.lambdaQuery() |
|
|
|
|
|
.eq(HanHaiMember::getIsFu, "Y") |
|
|
|
|
|
.list(); |
|
|
|
|
|
return Result.OK("客服列表查询成功", y); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//新-获取大转盘抽奖列表 |
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<?> getLuckDrawList(){ |
|
|
|
|
|
List<CityGift> list = cityGiftService.list(); |
|
|
|
|
|
return Result.OK("大转盘信息查询成功",list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public Result<?> luckDraw(String token) { |
|
|
|
|
|
// 1. 验证用户token有效性 |
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
|
|
if (hanHaiMember == null) { |
|
|
|
|
|
return Result.error("用户未登录或token已过期"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 2. 检查用户积分 |
|
|
|
|
|
BigDecimal integral = hanHaiMember.getIntegerPrice(); |
|
|
|
|
|
if (integral == null || integral.compareTo(new BigDecimal(1)) < 0) { |
|
|
|
|
|
return Result.error("积分不足,需要1积分才能抽奖"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
// 3. 获取所有有效礼品(可以添加状态过滤) |
|
|
|
|
|
List<CityGift> gifts = cityGiftService.list(); |
|
|
|
|
|
|
|
|
|
|
|
if (gifts == null || gifts.isEmpty()) { |
|
|
|
|
|
return Result.error("暂无可用奖品"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 4. 计算总概率值 |
|
|
|
|
|
BigDecimal totalProbability = gifts.stream() |
|
|
|
|
|
.map(CityGift::getNum) |
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
|
|
|
|
// 5. 生成随机数 |
|
|
|
|
|
BigDecimal random = new BigDecimal(Math.random()).multiply(totalProbability); |
|
|
|
|
|
BigDecimal accumulated = BigDecimal.ZERO; |
|
|
|
|
|
|
|
|
|
|
|
// 6. 根据概率抽奖 |
|
|
|
|
|
CityGift winningGift = null; |
|
|
|
|
|
for (CityGift gift : gifts) { |
|
|
|
|
|
accumulated = accumulated.add(gift.getNum()); |
|
|
|
|
|
if (random.compareTo(accumulated) < 0) { |
|
|
|
|
|
winningGift = gift; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 7. 如果没有抽中任何奖品(理论上不应该发生) |
|
|
|
|
|
if (winningGift == null) { |
|
|
|
|
|
winningGift = gifts.get(0); // 默认返回第一个奖品 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 8. 扣除用户积分 |
|
|
|
|
|
//增加流水记录 |
|
|
|
|
|
CityIntgerWater intgerWater = new CityIntgerWater(); |
|
|
|
|
|
intgerWater.setCreateTime(new Date()); |
|
|
|
|
|
intgerWater.setIntger(new BigDecimal(5)); |
|
|
|
|
|
intgerWater.setType(0); |
|
|
|
|
|
intgerWater.setUserId(hanHaiMember.getId()); |
|
|
|
|
|
intgerWater.setTitle("大转盘抽奖消耗积分"); |
|
|
|
|
|
cityIntgerWaterService.save(intgerWater); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hanHaiMember.setIntegerPrice(integral.subtract(new BigDecimal(5))); |
|
|
|
|
|
boolean updateSuccess = hanHaiMemberService.updateById(hanHaiMember); |
|
|
|
|
|
if (!updateSuccess) { |
|
|
|
|
|
throw new RuntimeException("积分扣除失败"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 9. 记录中奖信息(如果需要) |
|
|
|
|
|
if (winningGift.getType() == 0) { |
|
|
|
|
|
//创建现金红包流水 |
|
|
|
|
|
CityMoneyLog cityMoneyLog = new CityMoneyLog(); |
|
|
|
|
|
cityMoneyLog.setCreateTime(new Date()); |
|
|
|
|
|
cityMoneyLog.setPrice(winningGift.getPrice()); |
|
|
|
|
|
cityMoneyLog.setState(1); |
|
|
|
|
|
cityMoneyLog.setType(1); |
|
|
|
|
|
cityMoneyLog.setUserId(hanHaiMember.getId()); |
|
|
|
|
|
cityMoneyLog.setTitle("大转盘抽奖获得奖励"); |
|
|
|
|
|
cityMoneyLogService.save(cityMoneyLog); |
|
|
|
|
|
|
|
|
|
|
|
//增加奖金 |
|
|
|
|
|
BigDecimal price = hanHaiMember.getPrice().add(winningGift.getPrice()); |
|
|
|
|
|
hanHaiMember.setPrice(price); |
|
|
|
|
|
hanHaiMemberService.updateById(hanHaiMember); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果是实物奖品,可能需要处理发货逻辑 |
|
|
|
|
|
if (winningGift.getType() == 2) { // 假设2表示实物奖品 |
|
|
|
|
|
// 调用发货逻辑... |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 10. 返回结果 |
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
result.put("gift", winningGift); |
|
|
|
|
|
result.put("remainingIntegral", integral.subtract(new BigDecimal(1))); |
|
|
|
|
|
|
|
|
|
|
|
return Result.OK(result); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
// 记录错误日志 |
|
|
|
|
|
// log.error("抽奖失败: {}", e.getMessage(), e); |
|
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|
|
|
|
|
return Result.error("抽奖失败,请稍后再试"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |