提价修改代码

dev-discount
袁野 2 years ago
parent 018938e80c
commit a8c626e445
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 29
      hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java
  3. 69
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  4. 2
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  5. 10
      hai-service/src/main/java/com/hai/service/impl/BsRechargeCodeServiceImpl.java
  6. 3
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  7. 26
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  8. 36
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

File diff suppressed because one or more lines are too long

@ -263,9 +263,34 @@ public class OutRechargePriceController {
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
OutRechargePrice outRechargePrice = outRechargePriceService.findById(object.getLong("id") , null);
if (object.getInteger("status") == 1 && outRechargePrice.getRechargePlatform().contains("-2-") && outRechargePrice.getGoodsId() == null) {
if (object.getInteger("status") == 1) {
Map<String, Object> map = new HashMap<>();
map.put("type" , 1);
map.put("sourceId" , outRechargePrice.getId());
List<BsRechargeCode> rechargeCodes = bsRechargeCodeService.getListRechargeCode(map);
if (outRechargePrice.getRechargePlatform().contains("-2-3-") && rechargeCodes.size() == 0) {
log.error("OutRechargePriceController -> editPriceStatus() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇平台需要输入商品编码!");
}
for (BsRechargeCode rechargeCode : rechargeCodes) {
if ((rechargeCode.getRechargePlatform() == 2 || rechargeCode.getRechargePlatform() == 3) ){
if (rechargeCode.getGoodsId() == null) {
log.error("OutRechargePriceController -> editPriceStatus() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅平台需要输入商品编码!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇平台需要输入商品编码!");
}
if (rechargeCode.getGoodsId().length() == 0) {
log.error("OutRechargePriceController -> editPriceStatus() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇平台需要输入商品编码!");
}
}
}
}
outRechargePrice.setStatus(object.getInteger("status"));

@ -280,6 +280,75 @@ public class CzOrderController {
}
}
@RequestMapping(value = "/rechargeCallbackByCy", method = RequestMethod.POST)
@ApiOperation(value = "城宇充值回调")
@ResponseBody
public void rechargeCallbackByCy(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) {
try {
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class);
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type2.getType());
highGasOrderPush.setOrderNo(dataObject.getString("out_order_id"));
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(dataObject.getString("status"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(dataObject));
highGasOrderPush.setReturnContent(dataObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
//
//
// // 1 尖椒 2 龙阅
// dataObject.put("orderNo" , dataObject.getString("out_order_id"));
//
// OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(dataObject.getString("out_order_id"));
//
// OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId());
//
// BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo());
//
// bsRequestRecord.setReturnContent(String.valueOf(dataObject));
// bsRequestRecord.setUpdateTime(new Date());
// bsRequestRecordService.updateRequestRecord(bsRequestRecord);
//
// // 判断是否充值成功
// if (dataObject.getInteger("status") == 3) {
// new Thread(() -> {
// HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId());
// WxMsgConfig.rechargedSuccess(
// rechargeOrder.getRechargeContent() + "充值成功",
// String.valueOf(rechargeOrder.getPayRealPrice()),
// rechargeOrder.getOrderNo(),
// rechargeOrder.getFinishTime(),
// RechargePayType.getNameByType(rechargeOrder.getPayType()),
// highUser.getOpenId());
// }).start();
// childOrder.setStatus(101);
// rechargeOrder.setRechargeStatus(202);
// rechargeOrder.setPayStatus(100);
//
// outRechargeOrderService.updateOrder(rechargeOrder);
// outRechargeChildOrderService.updateOrder(childOrder);
// if (rechargeOrder.getPayType() == 6) {
// apiOrderRecord(rechargeOrder);
// }
//
// } else {
// callbackResult(childOrder , rechargeOrder);
// }
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer= response.getWriter();
writer.write("SUCCESS");
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
// 回调结果处理
private void callbackResult(OutRechargeChildOrder childOrder , OutRechargeOrder rechargeOrder) throws Exception {

@ -93,7 +93,7 @@ public class HighOrderSchedule {
* @Date 14:18 2022/5/31
* @Param []
*/
@Scheduled(cron = "0 0/5 * * * ?") //每5分钟执行一次
@Scheduled(cron = "0 0/1 * * * ?") //每5分钟执行一次
public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>();
map.put("payStatus", String.valueOf(102));

@ -34,6 +34,16 @@ public class BsRechargeCodeServiceImpl implements BsRechargeCodeService {
BsRechargeCodeExample example = new BsRechargeCodeExample();
BsRechargeCodeExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getString(map, "sourceId") != null) {
criteria.andSourceIdEqualTo(MapUtils.getString(map, "sourceId"));
}
if (MapUtils.getInteger(map, "rechargePlatform") != null) {
criteria.andRechargePlatformEqualTo(MapUtils.getInteger(map, "rechargePlatform"));
}
return rechargeCodeMapper.selectByExample(example);
}

@ -554,7 +554,9 @@ public class CommonServiceImpl implements CommonService {
// 配置支付方式
JSONArray payTypeArray = object.getJSONArray("payType");
for (Object payType : payTypeArray) {
SecDictionary dictionary = mappingSysCode("PAY_TYPE", String.valueOf(payType));
if (dictionary != null) {
productPayType = new BsProductPayType();
productPayType.setCreateTime(new Date());
productPayType.setUpdateTime(new Date());
@ -568,6 +570,7 @@ public class CommonServiceImpl implements CommonService {
bsProductPayTypeMapper.insert(productPayType);
}
}
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)

@ -1921,12 +1921,15 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setGoodsImg(childObject.getString("imgUrl"));
childOrder.setSaleCount(childObject.getInteger("quantity"));
childOrder.setGoodsPrice(childObject.getBigDecimal("marketPrice"));
if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("marketPrice"));
} else {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("unitPrice"));
}
// 计算利润
BigDecimal profitPrice = childObject.getBigDecimal("unitPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
// 计算子订单支付金额
BigDecimal childPrice = childObject.getBigDecimal("unitPrice").add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
if (childPrice.compareTo(childObject.getBigDecimal("marketPrice")) > 0) {
childPrice = childObject.getBigDecimal("marketPrice");
}
@ -1986,13 +1989,17 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setGoodsImg(childObject.getString("imageUrl"));
childOrder.setSaleCount(childObject.getInteger("quantity"));
childOrder.setGoodsPrice(childObject.getBigDecimal("originPrice"));
if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("originPrice"));
} else {
childOrder.setGoodsActualPrice(childObject.getBigDecimal("price"));
}
// 计算利润
BigDecimal profitPrice = childObject.getBigDecimal("price").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
BigDecimal profitPrice = childOrder.getGoodsActualPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
// 计算子订单支付金额
BigDecimal childPrice = childObject.getBigDecimal("price").add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
BigDecimal childPrice = childOrder.getGoodsActualPrice().add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
if (childPrice.compareTo(childObject.getBigDecimal("originPrice")) > 0) {
childPrice = childObject.getBigDecimal("originPrice");
}
@ -2041,9 +2048,13 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setGoodsName(memberProduct.getName());
childOrder.setSaleCount(1);
childOrder.setGoodsPrice(marketPrice);
if (object.getLong("memDiscountId") != null) {
childOrder.setGoodsActualPrice(marketPrice);
childOrder.setTotalPrice(marketPrice);
} else {
childOrder.setGoodsActualPrice(orderPayPrice);
childOrder.setTotalPrice(orderPayPrice);
}
highChildOrderMapper.insert(childOrder);
@ -2053,6 +2064,7 @@ public class HighOrderServiceImpl implements HighOrderService {
HighDiscountUserRel highDiscountUserRel = null;
// 判断是否有优惠券
if (object.getLong("memDiscountId") != null) {
orderPayPrice = marketPrice;
// 优惠券信息
highDiscountUserRel = highDiscountUserRelService.getRelById(object.getLong("memDiscountId"));
highOrder.setMemDiscountId(object.getLong("memDiscountId"));
@ -2067,7 +2079,6 @@ public class HighOrderServiceImpl implements HighOrderService {
}
}
// 使用优惠券
// 优惠券抵扣
if (highDiscountUserRel != null) {
highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName());
@ -2097,7 +2108,6 @@ public class HighOrderServiceImpl implements HighOrderService {
// 使用优惠券
if (highOrder.getMemDiscountId() != null) {
orderPayPrice = marketPrice;
HighDiscountUserRel discountUserRel = highDiscountUserRelService.getRelById(highOrder.getMemDiscountId());
discountUserRel.setUseTime(new Date()); // 使用时间
discountUserRel.setStatus(2); //状态 0:已过期 1:未使用 2:已使用

@ -104,6 +104,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Resource
private ApiOrderRecordService apiOrderRecordService;
@Resource
private BsRechargeCodeService rechargeCodeService;
@Override
public List<OutRechargeOrder> getListRechargeOrder(Map<String, Object> map) {
@ -181,7 +183,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
HighUser user = highUserService.findByUserId(object.getLong("userId"));
// 产品id
Long goodsId = object.getLong("goodsId");
@ -830,7 +831,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
}
if (type == 2) {
if (type == 3) {
type = 1;
} else {
type++;
@ -848,6 +849,10 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
type = Integer.parseInt(string);
}
// 定义查询充值产品编码
Map<String, Object> map = new HashMap<>();
map.put("type" , 1);
for (String s : rechargePlatform) {
// 尖椒充值
System.out.println("话费定时任务 -> 需要重新充值:尖椒开始");
@ -871,9 +876,13 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
// 龙阅充值
if (s.equals("2") && type == 2) {
map.put("sourceId" , outRechargePrice.getId());
map.put("rechargePlatform" , type);
BsRechargeCode rechargeCode = rechargeCodeService.findByMap(map);
System.out.println("话费定时任务 -> 需要重新充值:龙阅开始");
object.put("out_trade_num", orderNo);
object.put("product_id", outRechargePrice.getGoodsId());
object.put("product_id", rechargeCode.getGoodsId());
object.put("mobile", outRechargeOrder.getRechargeContent());
object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl());
JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object);
@ -886,6 +895,27 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
rechargePlatformType = 2;
break;
}
// 城宇充值
if (s.equals("3") && type == 3) {
map.put("sourceId" , outRechargePrice.getId());
map.put("rechargePlatform" , type);
BsRechargeCode rechargeCode = rechargeCodeService.findByMap(map);
System.out.println("话费定时任务 -> 需要重新充值:龙阅开始");
object.put("agentOrderId", orderNo);
object.put("productId", rechargeCode.getGoodsId());
object.put("mobile", outRechargeOrder.getRechargeContent());
JSONObject returnObject = RechargeConfig.rechargeOrderByCy(object);
object.put("return_content", returnObject);
if (returnObject != null && returnObject.getBoolean("success")) {
childOrder.setStatus(102);
} else {
childOrder.setStatus(103);
}
rechargePlatformType = 3;
break;
}
}
childOrder.setOrderNo(orderNo);

Loading…
Cancel
Save