|
|
@ -10,10 +10,7 @@ import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.utils.RedisUtil; |
|
|
|
import com.hai.common.utils.RedisUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.HuiLianTongUnionCardConfig; |
|
|
|
import com.hai.config.HuiLianTongUnionCardConfig; |
|
|
|
import com.hai.entity.HighFleetOilCard; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.entity.HighOilCard; |
|
|
|
|
|
|
|
import com.hai.entity.HighUser; |
|
|
|
|
|
|
|
import com.hai.entity.HighUserCard; |
|
|
|
|
|
|
|
import com.hai.enum_type.UserCardType; |
|
|
|
import com.hai.enum_type.UserCardType; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.HighUserModel; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
@ -30,6 +27,7 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@Controller |
|
|
@ -60,6 +58,49 @@ public class HighUserCardController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighOilCardService oilCardService; |
|
|
|
private HighOilCardService oilCardService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private SecConfigService secConfigService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/calculateRecharge", method = RequestMethod.POST) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "计算充值金额") |
|
|
|
|
|
|
|
public ResponseData calculateRecharge(@RequestBody JSONObject body, HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (body == null || body.getBigDecimal("rechargeAmount") == null) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 充值赠送比例
|
|
|
|
|
|
|
|
SecConfig rechargeRatio = secConfigService.findByCodeType("OIL_CARD_RECHARGE_RATIO"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 充值金额
|
|
|
|
|
|
|
|
BigDecimal rechargeAmount = body.getBigDecimal("rechargeAmount"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 赠送比例
|
|
|
|
|
|
|
|
BigDecimal ratio = new BigDecimal("0"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 赠送金额
|
|
|
|
|
|
|
|
BigDecimal givePrice = new BigDecimal("0"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rechargeRatio != null) { |
|
|
|
|
|
|
|
ratio = new BigDecimal(rechargeRatio.getCodeValue()).divide(new BigDecimal("100")); |
|
|
|
|
|
|
|
givePrice = body.getBigDecimal("rechargeAmount").multiply(ratio).setScale(2, RoundingMode.DOWN); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
|
|
|
param.put("rechargeAmount", rechargeAmount); |
|
|
|
|
|
|
|
param.put("rechargeRatio", ratio.multiply(new BigDecimal("100"))); |
|
|
|
|
|
|
|
param.put("givePrice", givePrice); |
|
|
|
|
|
|
|
param.put("rechargeAmountTotal", rechargeAmount.add(givePrice)); |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(param); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighUserCardController --> calculateRecharge() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/bindCard", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/bindCard", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "绑卡") |
|
|
|
@ApiOperation(value = "绑卡") |
|
|
|