提交实物代码

dev-discount
袁野 2 years ago
parent c2babeab2f
commit 0ea3d02eb0
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 2
      hai-service/src/main/java/com/hai/service/HighActivityUserLotteryNumService.java
  3. 4
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  4. 6
      hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java
  5. 86
      v1/src/main/java/com/v1/controller/business/OrderRebateController.java

File diff suppressed because one or more lines are too long

@ -41,7 +41,7 @@ public interface HighActivityUserLotteryNumService {
/** /**
* *
* 获取抽奖次数 * 免费获取抽奖次数
* @param activityId 活动id * @param activityId 活动id
* @param userId 用户id * @param userId 用户id
* @return * @return

@ -843,7 +843,7 @@ public class CommonServiceImpl implements CommonService {
storeModel.setRotate(1); storeModel.setRotate(1);
storeModel.setWidth(20); storeModel.setWidth(20);
storeModel.setHeight(20); storeModel.setHeight(20);
storeModel.setAlpha(0.5); storeModel.setAlpha(1);
JSONObject callout = new JSONObject(); JSONObject callout = new JSONObject();
@ -898,7 +898,7 @@ public class CommonServiceImpl implements CommonService {
storeModel.setRotate(1); storeModel.setRotate(1);
storeModel.setWidth(20); storeModel.setWidth(20);
storeModel.setHeight(20); storeModel.setHeight(20);
storeModel.setAlpha(0.5); storeModel.setAlpha(1);
JSONObject callout = new JSONObject(); JSONObject callout = new JSONObject();
callout.put("content" , store.getStoreName()); callout.put("content" , store.getStoreName());

@ -146,11 +146,11 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo
if (secConfig != null) { if (secConfig != null) {
// 判断是否活动为空 // 判断是否活动为空
if (detail == null) { if (detail == null) {
addLotteryNum(activityId , userId , 3); addLotteryNum(activityId , userId , 1);
return 3; return 1;
} else { } else {
if (!DateUtil.isNow(detail.getUpdateTime())) { if (!DateUtil.isNow(detail.getUpdateTime())) {
detail.setLotteryNum(3); detail.setLotteryNum(1);
detail.setUpdateTime(new Date()); detail.setUpdateTime(new Date());
highActivityUserLotteryNumMapper.updateByPrimaryKey(detail); highActivityUserLotteryNumMapper.updateByPrimaryKey(detail);
} }

@ -7,6 +7,7 @@ import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.ApiMerchants; import com.hai.entity.ApiMerchants;
import com.hai.entity.HighGoldRec; import com.hai.entity.HighGoldRec;
import com.hai.entity.HighUser;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.*; import com.hai.service.*;
import com.hai.service.impl.OutRechargeOrderServiceImpl; import com.hai.service.impl.OutRechargeOrderServiceImpl;
@ -112,9 +113,90 @@ public class OrderRebateController {
} }
} }
@RequestMapping(value = "/recycleIntegralPre", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款回收积分预处理")
public ResponseData recycleIntegralPre(@RequestBody JSONObject object , HttpServletRequest request ) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
if (StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("merchId")) ||
StringUtils.isBlank(object.getString("orderNo")) ||
StringUtils.isBlank(object.getString("userId")) ||
StringUtils.isBlank(object.getString("sign"))
) {
log.error("getRechargeProduct error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "商户号错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
map.put("orderNo" , object.getString("orderNo"));
map.put("userId" , object.getString("userId"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
Map<String, Object> mapGold = new HashMap<>();
mapGold.put("goldType", 1);
mapGold.put("resType", object.getInteger("productType"));
mapGold.put("resId", object.getLong("orderId"));
List<HighGoldRec> goldRecs = highGoldRecService.getGoldRec(mapGold);
Integer integralNum = 0;
// 查询用户信息
HighUser user = highUserService.findByUserId(object.getLong("userId"));
for (HighGoldRec goldRec : goldRecs) {
integralNum += goldRec.getGold();
}
if (integralNum > user.getGold()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足");
}
String remark = "订单" + object.getString("orderNo") + "退款,退还积分:" + integralNum;
// 积分退款
highUserService.goldHandle(user.getId(), integralNum,2, object.getInteger("productType"), object.getLong("orderId") , remark);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/recycleIntegral", method = RequestMethod.POST) @RequestMapping(value = "/recycleIntegral", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "退款回收积分") @ApiOperation(value = "退款回收积分处理")
public ResponseData recycleIntegral(@RequestBody JSONObject object , HttpServletRequest request ) { public ResponseData recycleIntegral(@RequestBody JSONObject object , HttpServletRequest request ) {
try { try {
@ -173,7 +255,7 @@ public class OrderRebateController {
for (HighGoldRec goldRec : goldRecs) { for (HighGoldRec goldRec : goldRecs) {
String remark = "订单" + object.getString("orderNo") + "退款,退还积分:" + goldRec.getGold(); String remark = "订单" + object.getString("orderNo") + "退款,退还积分:" + goldRec.getGold();
// 积分退款 // 积分退款
highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(),1, object.getInteger("productType"), object.getLong("orderId") , remark); highUserService.goldHandle(goldRec.getUserId(), goldRec.getGold(),2, object.getInteger("productType"), object.getLong("orderId") , remark);
} }
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");

Loading…
Cancel
Save