dev-discount
胡锐 3 years ago
commit 28768a62fd
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  3. 6
      hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java
  4. 4
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  5. 13
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  6. 4
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  7. 11
      hai-service/src/main/java/com/hai/service/HighUserService.java
  8. 2
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  9. 12
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  10. 18
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  11. 4
      hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java

File diff suppressed because one or more lines are too long

@ -579,7 +579,7 @@ public class OutRechargeOrderController {
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5); String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5);
JSONObject object = outRechargeOrderService.getMobile(outRechargeOrder.getRechargeContent(),outRechargeOrder.getOrderPrice().intValue(),orderNo); JSONObject object = outRechargeOrderService.getMobile(outRechargeOrder.getRechargeContent(),outRechargeOrder.getOrderPrice().intValue(),orderNo , outRechargeOrder.getRechargeType());
if (object.getInteger("code") != 200) { if (object.getInteger("code") != 200) {
log.error("getMobileRechargeByOrderId error!", "充值失败"); log.error("getMobileRechargeByOrderId error!", "充值失败");

@ -46,12 +46,6 @@ public class ImportRechargeOrderListener extends AnalysisEventListener<ExportOut
return; return;
} }
if (rechargeOrder.getRechargeType() != 2) {
data.setErrorMessage("当前话费订单充值类型为快充。");
errorData.add(data);
return;
}
if (Objects.equals(data.getStatusName(), "已完成")) { if (Objects.equals(data.getStatusName(), "已完成")) {
outRechargeOrderService.finishOrder(rechargeOrder.getId()); outRechargeOrderService.finishOrder(rechargeOrder.getId());
} else if (Objects.equals(data.getStatusName(), "失败")){ } else if (Objects.equals(data.getStatusName(), "失败")){

@ -474,8 +474,8 @@ public class OutRechargeOrderController {
outRechargeOrderService.goldPayOrder(userInfoModel.getHighUser().getId(), order.getId()); outRechargeOrderService.goldPayOrder(userInfoModel.getHighUser().getId(), order.getId());
if (order.getRechargeType() != null && order.getRechargeType() == 1) { if (order.getRechargeType() != null) {
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo() , order.getRechargeType());
if (object.getInteger("code") != 200) { if (object.getInteger("code") != 200) {
order.setRechargeStatus(1); order.setRechargeStatus(1);
order.setStatus(2); order.setStatus(2);

@ -120,9 +120,9 @@ public class CzOrderController {
rechargeOrderRecord = new OutRechargeOrderRecord(); rechargeOrderRecord = new OutRechargeOrderRecord();
// 查询订单 // 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderNo(dataObject.getString("out_order_id")); OutRechargeOrder order = outRechargeOrderService.findByOrderNo(dataObject.getString("out_order_id"));
if (order.getRechargeType() != null && order.getRechargeType() == 1) { if (order.getRechargeType() != null) {
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5); String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5);
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , orderNo); JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , orderNo , order.getRechargeType());
if (object.getInteger("code") != 200) { if (object.getInteger("code") != 200) {
order.setRechargeStatus(1); order.setRechargeStatus(1);
order.setAbnormalMsg(object.getString("message")); order.setAbnormalMsg(object.getString("message"));
@ -228,7 +228,14 @@ public class CzOrderController {
// 积分退款 // 积分退款
if (order.getPayType() == 3) { if (order.getPayType() == 3) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
if (!highUserService.findGoldRepeat(3 , order.getId())) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
}else {
log.error("orderToPay error!", "已有退款记录");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录");
}
} }
// 银联退款 // 银联退款

@ -395,8 +395,8 @@ public class UnionPayController {
order.setStatus(2); order.setStatus(2);
order.setPayType(4); order.setPayType(4);
order.setPayTime(new Date()); // 支付时间 order.setPayTime(new Date()); // 支付时间
if (order.getRechargeType() != null && order.getRechargeType() == 1) { if (order.getRechargeType() != null) {
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo() , order.getRechargeType());
if (object.getInteger("code") != 200) { if (object.getInteger("code") != 200) {
order.setRechargeStatus(1); order.setRechargeStatus(1);
order.setAbnormalMsg(object.getString("message")); order.setAbnormalMsg(object.getString("message"));

@ -108,6 +108,17 @@ public interface HighUserService {
**/ **/
void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId); void goldHandle(Long userId, Integer goldNum, Integer goldType, Integer resType, Long resId);
/**
* @Author Sum1Dream
* @name findGoldRepeat.java
* @Description // 查询用户是否有重复记录
* @Date 3:55 下午 2022/2/16
* @Param [java.lang.Integer, java.lang.Long]
* @return java.lang.Boolean
*/
Boolean findGoldRepeat(Integer resType , Long resId);
Long countUser(); Long countUser();
} }

@ -154,7 +154,7 @@ public interface OutRechargeOrderService {
* @Param [java.lang.String] * @Param [java.lang.String]
* @return com.alibaba.fastjson.JSONObject * @return com.alibaba.fastjson.JSONObject
*/ */
JSONObject getMobile(String phone , Integer amount , String orderNo) throws Exception; JSONObject getMobile(String phone , Integer amount , String orderNo , Integer isFast) throws Exception;
/** /**
* @Author Sum1Dream * @Author Sum1Dream

@ -6,8 +6,10 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.dao.HighGoldRecMapper;
import com.hai.dao.HighUserMapper; import com.hai.dao.HighUserMapper;
import com.hai.entity.HighGoldRec; import com.hai.entity.HighGoldRec;
import com.hai.entity.HighGoldRecExample;
import com.hai.entity.HighUser; import com.hai.entity.HighUser;
import com.hai.entity.HighUserExample; import com.hai.entity.HighUserExample;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
@ -50,6 +52,9 @@ public class HighUserServiceImpl implements HighUserService {
@Resource @Resource
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private HighGoldRecMapper highGoldRecMapper;
@Override @Override
public List<HighUser> getListUser(Map<String, String> map) { public List<HighUser> getListUser(Map<String, String> map) {
@ -224,4 +229,11 @@ public class HighUserServiceImpl implements HighUserService {
HighUserExample example = new HighUserExample(); HighUserExample example = new HighUserExample();
return highUserMapper.countByExample(example); return highUserMapper.countByExample(example);
} }
@Override
public Boolean findGoldRepeat(Integer resType, Long resId) {
HighGoldRecExample example = new HighGoldRecExample();
example.createCriteria().andResIdEqualTo(resId).andResTypeEqualTo(resType);
return highGoldRecMapper.selectByExample(example) != null;
}
} }

@ -343,8 +343,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
} }
order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号 order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号
order.setPayRealPrice(order.getPayPrice()); // 实付金额 order.setPayRealPrice(order.getPayPrice()); // 实付金额
if (order.getRechargeType() != null && order.getRechargeType() == 1) { if (order.getRechargeType() != null) {
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo() ,order.getRechargeType());
if (object.getInteger("code") != 200) { if (object.getInteger("code") != 200) {
order.setRechargeStatus(1); order.setRechargeStatus(1);
order.setAbnormalMsg(object.getString("message")); order.setAbnormalMsg(object.getString("message"));
@ -387,7 +387,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
} }
@Override @Override
public JSONObject getMobile(String phone , Integer amount , String orderNo) throws Exception { public JSONObject getMobile(String phone , Integer amount , String orderNo , Integer isFast) throws Exception {
if (isFast == 2) {
isFast = 0;
}
String timestamp = String.valueOf(System.currentTimeMillis()); String timestamp = String.valueOf(System.currentTimeMillis());
@ -397,7 +401,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
map.put("out_order_id" , orderNo); map.put("out_order_id" , orderNo);
map.put("app_key" , CommonSysConst.getSysConfig().getCzAppKey()); map.put("app_key" , CommonSysConst.getSysConfig().getCzAppKey());
map.put("timestamp" , timestamp.substring(0,timestamp.length()-3)); map.put("timestamp" , timestamp.substring(0,timestamp.length()-3));
map.put("is_fast" , "1"); map.put("is_fast" , isFast);
map.put("notify_url" , CommonSysConst.getSysConfig().getCzNotifyUrl()); map.put("notify_url" , CommonSysConst.getSysConfig().getCzNotifyUrl());
String signStr = WxUtils.generateSignatureAppSecret(map, CommonSysConst.getSysConfig().getCzAppSecret() , WXPayConstants.SignType.MD5); String signStr = WxUtils.generateSignatureAppSecret(map, CommonSysConst.getSysConfig().getCzAppSecret() , WXPayConstants.SignType.MD5);
@ -472,7 +476,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 金币退款 // 金币退款
if (order.getPayType() == 3) { if (order.getPayType() == 3) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().intValue() * 100, 1, 3, order.getId()); if (!highUserService.findGoldRepeat(3 , order.getId())) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
}else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录");
}
order.setStatus(5); order.setStatus(5);
order.setRefundTime(new Date()); order.setRefundTime(new Date());
order.setOutRefundNo("HFR"+new Date().getTime() ); order.setOutRefundNo("HFR"+new Date().getTime() );

@ -70,8 +70,8 @@ public class RechargeOrderServiceImpl implements PayService {
order.setPayRealPrice(new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100"))); // 实付金额 order.setPayRealPrice(new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100"))); // 实付金额
order.setPayTime(new Date()); // 支付时间 order.setPayTime(new Date()); // 支付时间
order.setStatus(2); // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 order.setStatus(2); // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款
if (order.getRechargeType() != null && order.getRechargeType() == 1) { if (order.getRechargeType() != null) {
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo() , order.getRechargeType());
if (object.getInteger("code") != 200) { if (object.getInteger("code") != 200) {
order.setRechargeStatus(1); order.setRechargeStatus(1);
order.setAbnormalMsg(object.getString("message")); order.setAbnormalMsg(object.getString("message"));

Loading…
Cancel
Save