修改话费接口

dev-discount
袁野 3 years ago
parent 0542360671
commit a46d1da807
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 142
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  4. 148
      hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java
  5. 10
      hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java
  6. 2
      hai-cweb/src/main/java/com/cweb/config/SysConfig.java
  7. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  8. 1224
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  9. 6
      hai-cweb/src/main/java/com/cweb/controller/SendSmsController.java
  10. 488
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  11. 42
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  12. 4
      hai-service/src/main/java/com/hai/entity/OutRechargePrice.java
  13. 30
      hai-service/src/main/java/com/hai/service/CommonService.java
  14. 5
      hai-service/src/main/java/com/hai/service/OutRechargePriceService.java
  15. 988
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  16. 4
      hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java
  17. 351
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  18. 85
      hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java
  19. 44
      hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java

@ -156,7 +156,7 @@ public class HighRefundAuditController {
if (highRefundAudit.getRefundSource() == 1) { if (highRefundAudit.getRefundSource() == 1) {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo());
outRechargeOrder.setStatus(2); // outRechargeOrder.setStatus(2);
outRechargeOrderService.updateOrder(outRechargeOrder); outRechargeOrderService.updateOrder(outRechargeOrder);
} else { } else {
HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo()); HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo());

File diff suppressed because one or more lines are too long

@ -98,12 +98,12 @@ public class OutRechargeOrderController {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId); OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId);
if (outRechargeOrder.getStatus() == 1) { // if (outRechargeOrder.getStatus() == 1) {
outRechargeOrderService.cancelOrder(orderId); // outRechargeOrderService.cancelOrder(orderId);
} else { // } else {
log.error("orderToPay error!"); // log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); // throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
} // }
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
@ -121,12 +121,12 @@ public class OutRechargeOrderController {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId); OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId);
if (outRechargeOrder.getStatus() == 2) { // if (outRechargeOrder.getStatus() == 2) {
outRechargeOrderService.finishOrder(orderId); // outRechargeOrderService.finishOrder(orderId);
} else { // } else {
log.error("orderToPay error!"); // log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); // throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
} // }
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
@ -301,10 +301,10 @@ public class OutRechargeOrderController {
} }
// 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中 // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中
if (order.getStatus() != 6) { // if (order.getStatus() != 6) {
log.error("orderToPay error!", "无法退款,订单不处于退款中状态"); // log.error("orderToPay error!", "无法退款,订单不处于退款中状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");
} // }
// 微信退款 // 微信退款
if (order.getPayType() == 1) { if (order.getPayType() == 1) {
@ -324,19 +324,19 @@ public class OutRechargeOrderController {
String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param)); String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param));
OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
if(orderRefundModel.getResult_code().equals("SUCCESS")) { // if(orderRefundModel.getResult_code().equals("SUCCESS")) {
order.setStatus(5); // order.setStatus(5);
order.setRefundTime(new Date()); // order.setRefundTime(new Date());
order.setOutRefundNo(orderRefundModel.getOut_refund_no()); // order.setOutRefundNo(orderRefundModel.getOut_refund_no());
order.setRefundId(orderRefundModel.getRefund_id()); // order.setRefundId(orderRefundModel.getRefund_id());
order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100"))); // order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100")));
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
highRefundAudit.setStatus(1); // highRefundAudit.setStatus(1);
highRefundAuditService.updateRefundAudit(highRefundAudit); // highRefundAuditService.updateRefundAudit(highRefundAudit);
} else { // } else {
log.error("orderToPay error!", "退款失败"); // log.error("orderToPay error!", "退款失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des()); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des());
} // }
} }
// 工会卡退款 // 工会卡退款
@ -350,21 +350,21 @@ public class OutRechargeOrderController {
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) { // if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) {
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() );
order.setRefundFee(order.getPayRealPrice()); // order.setRefundFee(order.getPayRealPrice());
order.setRefundId(dataObject.getString("orderId")); // order.setRefundId(dataObject.getString("orderId"));
//
highRefundAudit.setStatus(1); // highRefundAudit.setStatus(1);
highRefundAuditService.updateRefundAudit(highRefundAudit); // highRefundAuditService.updateRefundAudit(highRefundAudit);
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
//
} else { // } else {
log.error("orderToPay error!", dataObject.getString("message")); // log.error("orderToPay error!", dataObject.getString("message"));
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
} // }
} }
// 积分退款 // 积分退款
@ -374,7 +374,7 @@ public class OutRechargeOrderController {
}else { }else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); 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() );
order.setRefundFee(order.getPayRealPrice()); order.setRefundFee(order.getPayRealPrice());
@ -390,7 +390,7 @@ public class OutRechargeOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
} }
order.setStatus(5); // order.setStatus(5);
order.setRefundTime(new Date()); order.setRefundTime(new Date());
order.setOutRefundNo(refund.getString("oriwtorderid")); order.setOutRefundNo(refund.getString("oriwtorderid"));
order.setRefundFee(order.getPayRealPrice()); order.setRefundFee(order.getPayRealPrice());
@ -585,31 +585,31 @@ public class OutRechargeOrderController {
try { try {
OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderId(orderId); OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderId(orderId);
if (rechargeOrderRecord == null) { // if (rechargeOrderRecord == null) {
rechargeOrderRecord = new OutRechargeOrderRecord(); // rechargeOrderRecord = new OutRechargeOrderRecord();
// 查询订单 // // 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); // OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
if (order.getRechargeType() == 1) { // if (order.getRechargeType() == 1) {
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 , order.getRechargeType()); // 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"));
} // }
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
rechargeOrderRecord.setRechargeOrderId(order.getId()); // rechargeOrderRecord.setRechargeOrderId(order.getId());
rechargeOrderRecord.setRechargeOrderNo(orderNo); // rechargeOrderRecord.setRechargeOrderNo(orderNo);
rechargeOrderRecord.setCreateTime(new Date()); // rechargeOrderRecord.setCreateTime(new Date());
rechargeOrderRecord.setStatus(1); // rechargeOrderRecord.setStatus(1);
rechargeOrderRecordService.insertOrder(rechargeOrderRecord); // rechargeOrderRecordService.insertOrder(rechargeOrderRecord);
} // }
} else { // } else {
// 查询订单 // // 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId()); // OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId());
if (order.getStatus() == 2) { // if (order.getStatus() == 2) {
outRechargeOrderService.rechargeOrderToRefund(order.getId()); // outRechargeOrderService.rechargeOrderToRefund(order.getId());
} // }
} // }
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");

@ -1,5 +1,7 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
@ -9,8 +11,10 @@ import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.OutRechargePrice; import com.hai.entity.OutRechargePrice;
import com.hai.entity.SecDictionary;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.CommonService;
import com.hai.service.OutRechargePriceService; import com.hai.service.OutRechargePriceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -22,6 +26,8 @@ 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.RoundingMode;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -40,13 +46,18 @@ public class OutRechargePriceController {
@Resource @Resource
private OutRechargePriceService outRechargePriceService; private OutRechargePriceService outRechargePriceService;
@Resource
private CommonService commonService;
@RequestMapping(value = "/getListOutRechargePrice", method = RequestMethod.GET) @RequestMapping(value = "/getListOutRechargePrice", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询充值金额列表") @ApiOperation(value = "查询充值金额列表")
public ResponseData getListOutRechargePrice( public ResponseData getListOutRechargePrice(
@RequestParam(value = "type", required = false) Integer type , @RequestParam(value = "operatorType", required = false) Integer operatorType,
@RequestParam(value = "showType", required = false) Integer showType , @RequestParam(value = "rechargePlatform", required = false) Integer rechargePlatform,
@RequestParam(value = "rechargeType", required = false) Integer rechargeType , @RequestParam(value = "rechargeType", required = false) Integer rechargeType,
@RequestParam(value = "rechargeWay", required = false) Integer rechargeWay,
@RequestParam(value = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request
) { ) {
@ -55,27 +66,21 @@ public class OutRechargePriceController {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String, String> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (type != null ) {
map.put("type", String.valueOf(type));
}
if (showType != null ) {
map.put("showType", String.valueOf(showType));
}
if (rechargeType != null ) { map.put("operatorType", operatorType);
map.put("rechargeType", String.valueOf(rechargeType)); map.put("rechargePlatform", rechargePlatform);
} map.put("rechargeType", rechargeType);
map.put("rechargeWay", rechargeWay);
map.put("status", status);
map.put("companyId" , String.valueOf(userInfoModel.getBsCompany().getId())); map.put("companyId", String.valueOf(userInfoModel.getBsCompany().getId()));
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<OutRechargePrice> outRechargePrices = outRechargePriceService.getListRechargePrice(map); List<OutRechargePrice> outRechargePrices = outRechargePriceService.getListRechargePrice(map);
return ResponseMsgUtil.success(new PageInfo<>(outRechargePrices)); return ResponseMsgUtil.success(new PageInfo<>(outRechargePrices));
} catch (Exception e) { } catch (Exception e) {
log.error("OutRechargePriceController --> getListUser() error!", e); log.error("OutRechargePriceController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
@ -85,29 +90,32 @@ public class OutRechargePriceController {
@RequestMapping(value = "/insertPrice", method = RequestMethod.POST) @RequestMapping(value = "/insertPrice", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "新增金额") @ApiOperation(value = "新增金额")
public ResponseData insertAgent(@RequestBody OutRechargePrice outRechargePrice, HttpServletRequest request) { public ResponseData insertPrice(@RequestBody JSONObject object, HttpServletRequest request) {
try { try {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (outRechargePrice.getType() == null if (object == null ||
|| outRechargePrice.getPrice() == null object.getJSONArray("rechargePrices") == null ||
|| outRechargePrice.getRealPrice() == null object.getBigDecimal("discount") == null ||
|| outRechargePrice.getShowType() == null object.getString("operatorType") == null ||
|| outRechargePrice.getRechargeType() == null object.getJSONArray("rechargePlatform") == null ||
|| outRechargePrice.getSort() == null object.getJSONArray("productPlatform") == null ||
object.getInteger("rechargeType") == null ||
object.getJSONArray("payType") == null ||
object.getInteger("rechargeWay") == null ||
object.getBigDecimal("integralDiscount") == null
) { ) {
log.error("SecOrganizationController -> insertPrice() error!"); log.error("OutRechargePriceController -> insertPrice() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
object.put("operatorId", userInfoModel.getSecUser().getId());
object.put("operatorName", userInfoModel.getSecUser().getLoginName());
object.put("companyId", userInfoModel.getBsCompany().getId());
outRechargePrice.setCompanyId(userInfoModel.getBsCompany().getId()); outRechargePriceService.insertRechargePrice(object);
outRechargePrice.setCreateTime(new Date());
outRechargePrice.setStatus(0);
outRechargePriceService.insertRechargePrice(outRechargePrice);
return ResponseMsgUtil.success("新增成功"); return ResponseMsgUtil.success("新增成功");
@ -120,33 +128,60 @@ public class OutRechargePriceController {
@RequestMapping(value = "/updatePrice", method = RequestMethod.POST) @RequestMapping(value = "/updatePrice", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "修改金额") @ApiOperation(value = "修改金额")
public ResponseData updatePrice(@RequestBody OutRechargePrice outRechargePrice) { public ResponseData updatePrice(@RequestBody JSONObject object, HttpServletRequest request) {
try { try {
if (outRechargePrice.getType() == null
|| outRechargePrice.getId() == null SessionObject sessionObject = userCenter.getSessionObject(request);
|| outRechargePrice.getPrice() == null UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
|| outRechargePrice.getRealPrice() == null
|| outRechargePrice.getRechargeType() == null if (object == null ||
|| outRechargePrice.getShowType() == null object.getString("rechargePrices") == null ||
|| outRechargePrice.getSort() == null object.getLong("id") == null ||
object.getBigDecimal("discount") == null ||
object.getString("operatorType") == null ||
object.getString("rechargePlatform") == null ||
object.getInteger("rechargeType") == null ||
object.getString("payType") == null ||
object.getString("rechargeWay") == null ||
object.getString("platformType") == null ||
object.getBigDecimal("integralDiscount") == null
) { ) {
log.error("SecOrganizationController -> updatePrice() error!"); log.error("OutRechargePriceController -> insertPrice() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
OutRechargePrice outRechargePrice1 = outRechargePriceService.findById(outRechargePrice.getId()); OutRechargePrice outRechargePrice = outRechargePriceService.findById(object.getLong("id"));
if (outRechargePrice1 == null ) { if (outRechargePrice == null) {
log.error("SecOrganizationController -> updatePrice() error!"); log.error("OutRechargePriceController -> updatePrice() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UPDATE_DATA_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.UPDATE_DATA_ERROR, "");
} }
outRechargePrice.setCompanyId(outRechargePrice1.getCompanyId()); outRechargePrice.setPayPrice(outRechargePrice.getRechargePrice().multiply(object.getBigDecimal("discount").divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)));
outRechargePrice.setStatus(0); outRechargePrice.setRechargeType(object.getInteger("rechargeType"));
outRechargePrice.setCreateTime(outRechargePrice1.getCreateTime()); outRechargePrice.setOperatorType(object.getInteger("operatorType"));
outRechargePrice.setRechargePlatform(object.getString("rechargePlatform"));
outRechargePrice.setRechargeWay(object.getInteger("rechargeWay"));
outRechargePrice.setUpdateTime(new Date());
outRechargePrice.setStatus(3);
outRechargePriceService.updateRechargePrice(outRechargePrice); outRechargePriceService.updateRechargePrice(outRechargePrice);
JSONObject postObject = new JSONObject();
postObject.put("payType", object.getString("payType"));
postObject.put("integralDiscount", object.getBigDecimal("integralDiscount"));
postObject.put("productPlatform", object.getString("productPlatform"));
postObject.put("operatorId", userInfoModel.getSecUser().getId());
postObject.put("operatorName", userInfoModel.getSecUser().getLoginName());
postObject.put("sourceId", outRechargePrice.getId());
// 配置支付方式
commonService.configPayType(postObject);
// 配置积分折扣比例
commonService.configPayType(postObject);
// 配置展示平台
commonService.configPlatform(postObject);
return ResponseMsgUtil.success("修改成功"); return ResponseMsgUtil.success("修改成功");
} catch (Exception e) { } catch (Exception e) {
@ -165,7 +200,7 @@ public class OutRechargePriceController {
return ResponseMsgUtil.success(outRechargePrice); return ResponseMsgUtil.success(outRechargePrice);
} catch (Exception e) { } catch (Exception e) {
log.error("HighUserController --> findByUserId() error!", e); log.error("OutRechargePriceController --> findById() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@ -176,35 +211,30 @@ public class OutRechargePriceController {
public ResponseData deletePrice(@RequestParam(value = "id", required = true) Long id) { public ResponseData deletePrice(@RequestParam(value = "id", required = true) Long id) {
try { try {
outRechargePriceService.deletePrice(id); outRechargePriceService.deletePrice(id);
return ResponseMsgUtil.success("删除成功"); return ResponseMsgUtil.success("删除成功");
} catch (Exception e) { } catch (Exception e) {
log.error("HighUserController --> findByUserId() error!", e); log.error("OutRechargePriceController --> deletePrice() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@RequestMapping(value = "/onAndOffShelves", method = RequestMethod.GET) @RequestMapping(value = "/editPriceStatus", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "上下架") @ApiOperation(value = "修改价格状态")
public ResponseData onAndOffShelves(@RequestParam(value = "id", required = true) Long id) { public ResponseData editPriceStatus(@RequestParam(value = "id", required = true) Long id,
@RequestParam(value = "status", required = true) Integer status) {
try { try {
OutRechargePrice outRechargePrice = outRechargePriceService.findById(id); OutRechargePrice outRechargePrice = outRechargePriceService.findById(id);
outRechargePrice.setStatus(status);
if (outRechargePrice.getStatus() == 1) {
outRechargePrice.setStatus(0);
} else {
outRechargePrice.setStatus(1);
}
outRechargePriceService.updateRechargePrice(outRechargePrice); outRechargePriceService.updateRechargePrice(outRechargePrice);
return ResponseMsgUtil.success("修改成功"); return ResponseMsgUtil.success("修改成功");
} catch (Exception e) { } catch (Exception e) {
log.error("HighUserController --> findByUserId() error!", e); log.error("OutRechargePriceController --> editPriceStatus() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }

@ -40,11 +40,11 @@ public class ImportRechargeOrderListener extends AnalysisEventListener<ExportOut
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNo(data.getOrderNo()); OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNo(data.getOrderNo());
if (rechargeOrder.getStatus() != 2) { // if (rechargeOrder.getStatus() != 2) {
data.setErrorMessage("当前订单状态错误。"); // data.setErrorMessage("当前订单状态错误。");
errorData.add(data); // errorData.add(data);
return; // return;
} // }
if (Objects.equals(data.getStatusName(), "已完成")) { if (Objects.equals(data.getStatusName(), "已完成")) {
outRechargeOrderService.finishOrder(rechargeOrder.getId()); outRechargeOrderService.finishOrder(rechargeOrder.getId());

@ -30,7 +30,7 @@ public class SysConfig {
private String wxGzSubAppId; private String wxGzSubAppId;
private String wxGzSubMchId; private String wxGzSubMchId;
// 重庆惠兑电子商务有限公司 // 重庆电子商务有限公司
private String HDAppId; private String HDAppId;
public String getQzNotifyUrl() { public String getQzNotifyUrl() {

File diff suppressed because one or more lines are too long

@ -53,11 +53,7 @@ public class SendSmsController {
smsMsgId = MessageConfig.HWMSG_ID5; smsMsgId = MessageConfig.HWMSG_ID5;
break; break;
default : default :
smsMsgId = "错误"; throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂无当前模版");
}
if (HWMSG > 3) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂无当前模版");
} }
return ResponseMsgUtil.success(messageConfig.sendSmsCodeHw(phone , smsMsgId)); return ResponseMsgUtil.success(messageConfig.sendSmsCodeHw(phone , smsMsgId));

@ -76,248 +76,248 @@ public class CzOrderController {
@Resource @Resource
private OutRechargeOrderRecordService rechargeOrderRecordService; private OutRechargeOrderRecordService rechargeOrderRecordService;
@RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST) // @RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST)
@ApiOperation(value = "话费充值回调") // @ApiOperation(value = "话费充值回调")
@ResponseBody // @ResponseBody
public void rechargeCallback(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) { // public void rechargeCallback(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) {
try { // try {
//
//
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class); // JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class);
//
HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund(); // HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund();
highGasOrderRefund.setCreateTime(new Date()); // highGasOrderRefund.setCreateTime(new Date());
highGasOrderRefund.setReturnContent(String.valueOf(dataObject)); // highGasOrderRefund.setReturnContent(String.valueOf(dataObject));
//
highGasOrderRefundMapper.insert(highGasOrderRefund); // highGasOrderRefundMapper.insert(highGasOrderRefund);
//
if (dataObject.getInteger("status") == 3) { // if (dataObject.getInteger("status") == 3) {
OutRechargeOrder order; // OutRechargeOrder order;
OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderNo(dataObject.getString("out_order_id")); // OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderNo(dataObject.getString("out_order_id"));
if (rechargeOrderRecord == null) { // if (rechargeOrderRecord == null) {
// 查询订单 // // 查询订单
order = outRechargeOrderService.findByOrderNo(dataObject.getString("out_order_id")); // order = outRechargeOrderService.findByOrderNo(dataObject.getString("out_order_id"));
order.setStatus(3); // order.setStatus(3);
order.setFinishTime(new Date()); // order.setFinishTime(new Date());
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} else { // } else {
// 查询订单 // // 查询订单
order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId()); // order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId());
order.setStatus(3); // order.setStatus(3);
order.setFinishTime(new Date()); // order.setFinishTime(new Date());
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} // }
//
new Thread(() -> { // new Thread(() -> {
HighUser highUser = highUserService.findByUserId(order.getUserId()); // HighUser highUser = highUserService.findByUserId(order.getUserId());
WxMsgConfig.rechargedSuccess( // WxMsgConfig.rechargedSuccess(
order.getRechargeName() + "充值成功", // order.getRechargeName() + "充值成功",
String.valueOf(order.getPayRealPrice()), // String.valueOf(order.getPayRealPrice()),
order.getOrderNo(), // order.getOrderNo(),
order.getFinishTime(), // order.getFinishTime(),
RechargePayType.getNameByType(order.getPayType()), // RechargePayType.getNameByType(order.getPayType()),
highUser.getOpenId()); // highUser.getOpenId());
}).start(); // }).start();
//
} else { // } else {
OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderNo(dataObject.getString("out_order_id")); // OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderNo(dataObject.getString("out_order_id"));
if (rechargeOrderRecord == null) { // if (rechargeOrderRecord == null) {
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.getStatus() == 2) { // if (order.getStatus() == 2) {
if (order.getRechargeType() == 1) { // if (order.getRechargeType() == 1) {
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 , order.getRechargeType()); // 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"));
} // }
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
rechargeOrderRecord.setRechargeOrderId(order.getId()); // rechargeOrderRecord.setRechargeOrderId(order.getId());
rechargeOrderRecord.setRechargeOrderNo(orderNo); // rechargeOrderRecord.setRechargeOrderNo(orderNo);
rechargeOrderRecord.setCreateTime(new Date()); // rechargeOrderRecord.setCreateTime(new Date());
rechargeOrderRecord.setStatus(1); // rechargeOrderRecord.setStatus(1);
rechargeOrderRecordService.insertOrder(rechargeOrderRecord); // rechargeOrderRecordService.insertOrder(rechargeOrderRecord);
} // }
} // }
//
} else { // } else {
// 查询订单 // // 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId()); // OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId());
if (order.getStatus() == 2) { // if (order.getStatus() == 2) {
orderToRefund(order.getId()); // orderToRefund(order.getId());
order.setStatus(5); // order.setStatus(5);
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} // }
} // }
//
} // }
//
response.setCharacterEncoding("UTF-8"); // response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8"); // response.setContentType("text/html;charset=utf-8");
PrintWriter writer= response.getWriter(); // PrintWriter writer= response.getWriter();
writer.write("SUCCESS"); // writer.write("SUCCESS");
//
//
} catch (Exception e) { // } catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e); // log.error("WechatPayController --> wechatNotify() error!", e);
} // }
} // }
//
//
public Boolean orderToRefund(Long orderId) { // public Boolean orderToRefund(Long orderId) {
try { // try {
//
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); // OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
//
//
// 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中 // // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中
if (order.getStatus() != 2) { // if (order.getStatus() != 2) {
log.error("orderToPay error!", "无法退款,订单状态错误!"); // log.error("orderToPay error!", "无法退款,订单状态错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");
} // }
//
// 微信退款 // // 微信退款
if (order.getPayType() == 1) { // if (order.getPayType() == 1) {
Map<String,String> param = new HashMap<>(); // Map<String,String> param = new HashMap<>();
param.put("appid", "wx637bd6f7314daa46"); // param.put("appid", "wx637bd6f7314daa46");
param.put("mch_id", "1289663601"); // param.put("mch_id", "1289663601");
param.put("sub_mch_id" , "1614670195"); // param.put("sub_mch_id" , "1614670195");
param.put("nonce_str", WxUtils.makeNonStr()); // param.put("nonce_str", WxUtils.makeNonStr());
param.put("transaction_id", order.getPaySerialNo()); // param.put("transaction_id", order.getPaySerialNo());
param.put("out_refund_no", "HFR"+new Date().getTime()); // param.put("out_refund_no", "HFR"+new Date().getTime());
param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); // param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); // param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("sign_type", "HMAC-SHA256"); // param.put("sign_type", "HMAC-SHA256");
//
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); // String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
param.put("sign", signStr); // param.put("sign", signStr);
//
String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param)); // String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param));
OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); // OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
//
if(orderRefundModel.getResult_code().equals("SUCCESS")) { //// if(orderRefundModel.getResult_code().equals("SUCCESS")) {
order.setStatus(5); //// order.setStatus(5);
order.setRefundTime(new Date()); //// order.setRefundTime(new Date());
order.setOutRefundNo(orderRefundModel.getOut_refund_no()); //// order.setOutRefundNo(orderRefundModel.getOut_refund_no());
order.setRefundId(orderRefundModel.getRefund_id()); //// order.setRefundId(orderRefundModel.getRefund_id());
order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100"))); //// order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100")));
outRechargeOrderService.updateOrder(order); //// outRechargeOrderService.updateOrder(order);
} else { //// } else {
log.error("orderToPay error!", "退款失败"); //// log.error("orderToPay error!", "退款失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des()); //// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des());
} //// }
} // }
//
// 工会卡退款 // // 工会卡退款
if (order.getPayType() == 2) { // if (order.getPayType() == 2) {
JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); // JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo());
//
if (jsonObject == null) { // if (jsonObject == null) {
log.error("orderToPay error!", "请求超时"); // log.error("orderToPay error!", "请求超时");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击");
} // }
//
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); // JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
//
if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) { // if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) {
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() );
order.setRefundFee(order.getPayRealPrice()); // order.setRefundFee(order.getPayRealPrice());
order.setRefundId(dataObject.getString("orderId")); // order.setRefundId(dataObject.getString("orderId"));
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
//
} else { // } else {
log.error("orderToPay error!", dataObject.getString("message")); // log.error("orderToPay error!", dataObject.getString("message"));
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
} // }
} // }
//
// 积分退款 // // 积分退款
if (order.getPayType() == 3) { // if (order.getPayType() == 3) {
//
if (highUserService.findGoldRepeat(3 , order.getId())) { // if (highUserService.findGoldRepeat(3 , order.getId())) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId()); // highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
}else { // }else {
log.error("orderToPay error!", "已有退款记录"); // log.error("orderToPay error!", "已有退款记录");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录");
} // }
//
} // }
//
// 银联退款 // // 银联退款
if (order.getPayType() == 4) { // if (order.getPayType() == 4) {
// 订单退款 // // 订单退款
JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); // JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("W6")) { // if (!refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
} // }
//
order.setStatus(5); // order.setStatus(5);
order.setRefundTime(new Date()); // order.setRefundTime(new Date());
order.setOutRefundNo(refund.getString("oriwtorderid")); // order.setOutRefundNo(refund.getString("oriwtorderid"));
order.setRefundFee(order.getPayRealPrice()); // order.setRefundFee(order.getPayRealPrice());
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} // }
//
if (order.getMemDiscountId() != null) { // if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId()); // HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) { // if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 // rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(null); // rel.setUseTime(null);
highDiscountUserRelService.updateDiscountUserRel(rel); // highDiscountUserRelService.updateDiscountUserRel(rel);
//
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId()); // HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId());
code.setStatus(2); // code.setStatus(2);
highDiscountAgentCodeService.updateCode(code); // highDiscountAgentCodeService.updateCode(code);
} // }
} // }
//
new Thread(() -> { // new Thread(() -> {
HighUser highUser = highUserService.findByUserId(order.getUserId()); // HighUser highUser = highUserService.findByUserId(order.getUserId());
WxMsgConfig.rechargedFail( // WxMsgConfig.rechargedFail(
"订单号:" + order.getOrderNo() + "-" + order.getRechargeName(), // "订单号:" + order.getOrderNo() + "-" + order.getRechargeName(),
String.valueOf(order.getPayRealPrice()), // String.valueOf(order.getPayRealPrice()),
highUser.getOpenId()); // highUser.getOpenId());
}).start(); // }).start();
//
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e); // log.error("HighOrderController --> getUserOrderList() error!", e);
return false; // return false;
} // }
} // }
//
//
public String doRefundRequest(String mchId,String data) throws Exception { // public String doRefundRequest(String mchId,String data) throws Exception {
//
//小程序退款需要调用双向证书的认证 // //小程序退款需要调用双向证书的认证
CloseableHttpClient httpClient = goodsOrderService.readCertificate(mchId); // CloseableHttpClient httpClient = goodsOrderService.readCertificate(mchId);
try { // try {
HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund"); // 设置响应头信息 // HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund"); // 设置响应头信息
httpost.addHeader("Connection", "keep-alive"); // httpost.addHeader("Connection", "keep-alive");
httpost.addHeader("Accept", "*/*"); // httpost.addHeader("Accept", "*/*");
httpost.addHeader("Content-Type", "text/xml"); // httpost.addHeader("Content-Type", "text/xml");
httpost.addHeader("Host", "api.mch.weixin.qq.com"); // httpost.addHeader("Host", "api.mch.weixin.qq.com");
httpost.addHeader("X-Requested-With", "XMLHttpRequest"); // httpost.addHeader("X-Requested-With", "XMLHttpRequest");
httpost.addHeader("Cache-Control", "max-age=0"); // httpost.addHeader("Cache-Control", "max-age=0");
httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); // httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
httpost.setEntity(new StringEntity(data, "UTF-8")); // httpost.setEntity(new StringEntity(data, "UTF-8"));
CloseableHttpResponse response = httpClient.execute(httpost); // CloseableHttpResponse response = httpClient.execute(httpost);
try { // try {
HttpEntity entity = response.getEntity(); // HttpEntity entity = response.getEntity();
String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); // String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
EntityUtils.consume(entity); // EntityUtils.consume(entity);
return jsonStr; // return jsonStr;
} finally { // } finally {
response.close(); // response.close();
} // }
} catch (Exception e){ // } catch (Exception e){
throw new RuntimeException(e); // throw new RuntimeException(e);
} finally { // } finally {
httpClient.close(); // httpClient.close();
} // }
} // }
} }

@ -383,27 +383,27 @@ public class UnionPayController {
// 转换成JSON格式 // 转换成JSON格式
JSONObject body = JSONObject.parseObject(paramsStr.substring(0, paramsStr.length() - 1)); JSONObject body = JSONObject.parseObject(paramsStr.substring(0, paramsStr.length() - 1));
if (StringUtils.isNotBlank(body.getString("tradetrace"))) { // if (StringUtils.isNotBlank(body.getString("tradetrace"))) {
OutRechargeOrder order = outRechargeOrderService.findByOrderNo(body.getString("tradetrace")); // OutRechargeOrder order = outRechargeOrderService.findByOrderNo(body.getString("tradetrace"));
if (order == null) { // if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
} // }
//
order.setPaySerialNo(body.getString("wtorderid")); // 支付流水号 // order.setPaySerialNo(body.getString("wtorderid")); // 支付流水号
order.setPayRealPrice(order.getPayPrice()); // 实付金额 // order.setPayRealPrice(order.getPayPrice()); // 实付金额
//
order.setStatus(2); // order.setStatus(2);
order.setPayType(4); // order.setPayType(4);
order.setPayTime(new Date()); // 支付时间 // order.setPayTime(new Date()); // 支付时间
if (order.getRechargeType() == 1) { // if (order.getRechargeType() == 1) {
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo() , order.getRechargeType()); // 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"));
} // }
} // }
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} // }
} }
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());

@ -80,7 +80,7 @@ public class OutRechargePrice implements Serializable {
private Date updateTime; private Date updateTime;
/** /**
* 0删除 1上线 2已售空 * 0删除 1上线 2已售空 3:编辑中
*/ */
private Integer status; private Integer status;
@ -310,4 +310,4 @@ public class OutRechargePrice implements Serializable {
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
} }

@ -239,4 +239,34 @@ public interface CommonService {
*/ */
JSONObject findByLatAndLng( String lng , String lat) throws Exception; JSONObject findByLatAndLng( String lng , String lat) throws Exception;
/**
* @Author Sum1Dream
* @name configPayType.java
* @Description // 配置支付方式
* @Date 15:00 2022/5/12
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
void configPayType(JSONObject object);
/**
* @Author Sum1Dream
* @name configIntegralDiscount.java
* @Description // 配置积分折扣比例
* @Date 15:00 2022/5/12
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
void configIntegralDiscount(JSONObject object);
/**
* @Author Sum1Dream
* @name configPlatform.java
* @Description // 配置展示平台
* @Date 15:00 2022/5/12
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
void configPlatform(JSONObject object);
} }

@ -1,5 +1,6 @@
package com.hai.service; package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.OutRechargePrice; import com.hai.entity.OutRechargePrice;
import java.util.List; import java.util.List;
@ -14,7 +15,7 @@ public interface OutRechargePriceService {
* @Param [map] * @Param [map]
* @return java.util.List<com.hai.entity.OutRechargePrice> * @return java.util.List<com.hai.entity.OutRechargePrice>
**/ **/
List<OutRechargePrice> getListRechargePrice(Map<String , String> map); List<OutRechargePrice> getListRechargePrice(Map<String , Object> map);
/** /**
* @Author Sum1Dream * @Author Sum1Dream
@ -41,7 +42,7 @@ public interface OutRechargePriceService {
* @Param [outRechargePrice] * @Param [outRechargePrice]
* @return void * @return void
**/ **/
void insertRechargePrice(OutRechargePrice outRechargePrice); void insertRechargePrice(JSONObject object);
/** /**
* @Author Sum1Dream * @Author Sum1Dream

@ -92,11 +92,11 @@ public class HighRefundAuditServiceImpl implements HighRefundAuditService {
if (highRefundAudit.getRefundSource() == 1) { if (highRefundAudit.getRefundSource() == 1) {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo());
highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice()); // highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice());
highRefundAudit.setPayType(outRechargeOrder.getPayType()); highRefundAudit.setPayType(outRechargeOrder.getPayType());
highRefundAudit.setPayTime(outRechargeOrder.getPayTime()); highRefundAudit.setPayTime(outRechargeOrder.getPayTime());
highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId())); highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId()));
outRechargeOrder.setStatus(6); // outRechargeOrder.setStatus(6);
outRechargeOrderService.updateOrder(outRechargeOrder); outRechargeOrderService.updateOrder(outRechargeOrder);
} else { } else {
HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo()); HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo());

@ -78,25 +78,14 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
} }
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
if (MapUtils.getInteger(map, "payType") != null) { if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType")); criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
} }
if (MapUtils.getInteger(map, "code") != null) {
criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map, "code"));
}
if (MapUtils.getString(map, "orderNo") != null) { if (MapUtils.getString(map, "orderNo") != null) {
criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%");
} }
if (MapUtils.getString(map, "idCard") != null) {
criteria.andIdCardLike("%" + MapUtils.getString(map, "idCard") + "%");
}
if (MapUtils.getString(map, "userPhone") != null) { if (MapUtils.getString(map, "userPhone") != null) {
criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone")); criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone"));
} }
@ -104,17 +93,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (MapUtils.getString(map, "rechargeContent") != null) { if (MapUtils.getString(map, "rechargeContent") != null) {
criteria.andRechargeContentLike("%" + MapUtils.getString(map, "rechargeContent") + "%"); criteria.andRechargeContentLike("%" + MapUtils.getString(map, "rechargeContent") + "%");
} }
if (MapUtils.getString(map, "rechargeType") != null) {
criteria.andRechargeTypeEqualTo(MapUtils.getInteger(map, "rechargeType"));
}
if (MapUtils.getString(map, "phone") != null) { if (MapUtils.getString(map, "phone") != null) {
criteria.andUserPhoneEqualTo(MapUtils.getString(map, "phone")); criteria.andUserPhoneEqualTo(MapUtils.getString(map, "phone"));
} }
if (MapUtils.getString(map, "rechargeModel") != null) {
criteria.andRechargeModelEqualTo(Integer.valueOf(MapUtils.getString(map, "rechargeModel")));
}
if (StringUtils.isNotBlank(map.get("payTimeS")) && StringUtils.isNotBlank(map.get("payTimeE"))) { if (StringUtils.isNotBlank(map.get("payTimeS")) && StringUtils.isNotBlank(map.get("payTimeE"))) {
criteria.andPayTimeBetween( criteria.andPayTimeBetween(
@ -170,11 +153,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void updateOrderList(List<OutRechargeOrder> rechargeOrders) throws Exception { public void updateOrderList(List<OutRechargeOrder> rechargeOrders) throws Exception {
for (OutRechargeOrder list:rechargeOrders) { for (OutRechargeOrder list:rechargeOrders) {
if (list.getStatus() == 3) { // if (list.getStatus() == 3) {
outRechargeOrderMapper.updateByPrimaryKey(list); // outRechargeOrderMapper.updateByPrimaryKey(list);
} else if (list.getStatus() == 6) { // } else if (list.getStatus() == 6) {
rechargeOrderToRefund(list.getId()); // rechargeOrderToRefund(list.getId());
} // }
} }
} }
@ -183,25 +166,25 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void cancelOrder(Long orderId) { public void cancelOrder(Long orderId) {
OutRechargeOrder order = findByOrderId(orderId); OutRechargeOrder order = findByOrderId(orderId);
if (order != null && order.getStatus() == 1) { // if (order != null && order.getStatus() == 1) {
order.setStatus(4); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 // order.setStatus(4); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款
order.setCancelTime(new Date()); // order.setCancelTime(new Date());
//
if (order.getMemDiscountId() != null) { // if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId()); // HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) { // if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 // rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(null); // rel.setUseTime(null);
highDiscountUserRelService.updateDiscountUserRel(rel); // highDiscountUserRelService.updateDiscountUserRel(rel);
//
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId()); // HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId());
code.setStatus(2); // code.setStatus(2);
highDiscountAgentCodeService.updateCode(code); // highDiscountAgentCodeService.updateCode(code);
} // }
} // }
//
updateOrder(order); // updateOrder(order);
} // }
} }
@ -210,7 +193,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
public void finishOrder(Long orderId) { public void finishOrder(Long orderId) {
OutRechargeOrder order = findByOrderId(orderId); OutRechargeOrder order = findByOrderId(orderId);
if (order != null) { if (order != null) {
order.setStatus(3); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 // order.setStatus(3); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款
order.setFinishTime(new Date()); order.setFinishTime(new Date());
updateOrder(order); updateOrder(order);
} }
@ -242,7 +225,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Override @Override
public Long CountOrder() { public Long CountOrder() {
OutRechargeOrderExample example = new OutRechargeOrderExample(); OutRechargeOrderExample example = new OutRechargeOrderExample();
example.createCriteria().andStatusEqualTo(2); // example.createCriteria().andStatusEqualTo(2);
return outRechargeOrderMapper.countByExample(example); return outRechargeOrderMapper.countByExample(example);
} }
@ -336,51 +319,51 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
} }
String goodsDesc = "充值话费"; String goodsDesc = "充值话费";
String tranDesc = order.getRechargeContent() + "充值" + order.getPayPrice() +"元话费"; // String tranDesc = order.getRechargeContent() + "充值" + order.getPayPrice() +"元话费";
String instCode = "11101290"; String instCode = "11101290";
String businessType = "hisen_consume"; String businessType = "hisen_consume";
// 工会卡支付 // 工会卡支付
JSONObject consumption = HuiLianTongUnionCardConfig.consumption(order.getOrderNo(), userCard.getCardNo(), order.getPayPrice(), businessType, instCode, goodsDesc, tranDesc); // JSONObject consumption = HuiLianTongUnionCardConfig.consumption(order.getOrderNo(), userCard.getCardNo(), order.getPayPrice(), businessType, instCode, goodsDesc, tranDesc);
System.out.println("工会卡支付响应参数" + consumption.toJSONString()); // System.out.println("工会卡支付响应参数" + consumption.toJSONString());
Map<String,Object> dataMap = new HashMap<>(); Map<String,Object> dataMap = new HashMap<>();
dataMap.put("orderNo", order.getOrderNo()); dataMap.put("orderNo", order.getOrderNo());
dataMap.put("cardType", "ghk"); dataMap.put("cardType", "ghk");
dataMap.put("cardNo", userCard.getCardNo()); dataMap.put("cardNo", userCard.getCardNo());
dataMap.put("checkPassword", "N"); dataMap.put("checkPassword", "N");
dataMap.put("tranAmount", order.getPayPrice()); // dataMap.put("tranAmount", order.getPayPrice());
dataMap.put("tranChannel", "HiSen"); dataMap.put("tranChannel", "HiSen");
dataMap.put("businessType", businessType); dataMap.put("businessType", businessType);
dataMap.put("instCode", instCode); dataMap.put("instCode", instCode);
dataMap.put("goodsDesc", goodsDesc); dataMap.put("goodsDesc", goodsDesc);
dataMap.put("tranDesc", tranDesc); // dataMap.put("tranDesc", tranDesc);
HighGasOrderPush payPush = new HighGasOrderPush(); HighGasOrderPush payPush = new HighGasOrderPush();
payPush.setType(OrderPushType.type5.getType()); payPush.setType(OrderPushType.type5.getType());
payPush.setOrderNo(order.getOrderNo()); payPush.setOrderNo(order.getOrderNo());
payPush.setCreateTime(new Date()); payPush.setCreateTime(new Date());
payPush.setCode(consumption.getString("respCode")); // payPush.setCode(consumption.getString("respCode"));
payPush.setRequestContent(JSON.toJSONString(dataMap)); // payPush.setRequestContent(JSON.toJSONString(dataMap));
payPush.setReturnContent(consumption.toJSONString()); // payPush.setReturnContent(consumption.toJSONString());
highGasOrderPushMapper.insert(payPush); highGasOrderPushMapper.insert(payPush);
if(!consumption.getString("respCode").equals("0000")) { // if(!consumption.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage"));
} // }
JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); // JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data"));
if (!consumptionResult.getBoolean("success")) { // if (!consumptionResult.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message"));
} // }
order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号 // order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号
order.setPayRealPrice(order.getPayPrice()); // 实付金额 // order.setPayRealPrice(order.getPayPrice()); // 实付金额
if (order.getRechargeType() == 1) { // if (order.getRechargeType() == 1) {
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo() ,order.getRechargeType()); // 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"));
} // }
} // }
order.setStatus(2); // order.setStatus(2);
order.setPayType(2); order.setPayType(2);
order.setPayTime(new Date()); // 支付时间 order.setPayTime(new Date()); // 支付时间
updateOrder(order); updateOrder(order);
@ -389,21 +372,21 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void goldPayOrder(Long userId, Long orderId) throws Exception { public void goldPayOrder(Long userId, Long orderId) throws Exception {
OutRechargeOrder order = findByOrderId(orderId); // OutRechargeOrder order = findByOrderId(orderId);
if(order == null) { // if(order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); // throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
} // }
// 查询用户 // // 查询用户
HighUser highUser = highUserService.findByUserId(userId); // HighUser highUser = highUserService.findByUserId(userId);
//
// 金币 1:100 // // 金币 1:100
Integer goldNum = new BigDecimal(order.getPayPrice().toString()).multiply(new BigDecimal("100")).intValue(); // Integer goldNum = new BigDecimal(order.getPayPrice().toString()).multiply(new BigDecimal("100")).intValue();
highUserService.goldHandle(userId, goldNum, 2, 2, order.getId()); // highUserService.goldHandle(userId, goldNum, 2, 2, order.getId());
order.setPayRealPrice(order.getPayPrice()); // 实付金额 // order.setPayRealPrice(order.getPayPrice()); // 实付金额
order.setStatus(2); // order.setStatus(2);
order.setPayType(3); // order.setPayType(3);
order.setPayTime(new Date()); // 支付时间 // order.setPayTime(new Date()); // 支付时间
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} }
@Override @Override
@ -444,107 +427,107 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Override @Override
public void rechargeOrderToRefund(Long orderId) throws Exception { public void rechargeOrderToRefund(Long orderId) throws Exception {
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); // OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
//
// 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中 // // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中
if (order.getStatus() != 2) { // if (order.getStatus() != 2) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");
} // }
//
// 微信退款 // // 微信退款
if (order.getPayType() == 1) { // if (order.getPayType() == 1) {
Map<String,String> param = new HashMap<>(); // Map<String,String> param = new HashMap<>();
param.put("appid", "wx637bd6f7314daa46"); // param.put("appid", "wx637bd6f7314daa46");
param.put("mch_id", "1289663601"); // param.put("mch_id", "1289663601");
param.put("sub_mch_id" , "1614670195"); // param.put("sub_mch_id" , "1614670195");
param.put("nonce_str", WxUtils.makeNonStr()); // param.put("nonce_str", WxUtils.makeNonStr());
param.put("transaction_id", order.getPaySerialNo()); // param.put("transaction_id", order.getPaySerialNo());
param.put("out_refund_no", "HFR"+new Date().getTime()); // param.put("out_refund_no", "HFR"+new Date().getTime());
param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); // param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); // param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("sign_type", "HMAC-SHA256"); // param.put("sign_type", "HMAC-SHA256");
//
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); // String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
param.put("sign", signStr); // param.put("sign", signStr);
//
String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param)); // String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param));
OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); // OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
if(orderRefundModel.getResult_code().equals("SUCCESS")) { // if(orderRefundModel.getResult_code().equals("SUCCESS")) {
order.setStatus(5); // order.setStatus(5);
order.setRefundTime(new Date()); // order.setRefundTime(new Date());
order.setOutRefundNo(orderRefundModel.getOut_refund_no()); // order.setOutRefundNo(orderRefundModel.getOut_refund_no());
order.setRefundId(orderRefundModel.getRefund_id()); // order.setRefundId(orderRefundModel.getRefund_id());
order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100"))); // order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100")));
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} else { // } else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des()); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des());
} // }
} // }
//
// 工会卡退款 // // 工会卡退款
if (order.getPayType() == 2) { // if (order.getPayType() == 2) {
JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); // JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo());
//
if (jsonObject == null) { // if (jsonObject == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击"); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击");
} // }
//
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); // JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
//
if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) { // if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) {
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() );
order.setRefundFee(order.getPayRealPrice()); // order.setRefundFee(order.getPayRealPrice());
order.setRefundId(dataObject.getString("orderId")); // order.setRefundId(dataObject.getString("orderId"));
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
//
} else { // } else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
} // }
} // }
//
// 金币退款 // // 金币退款
if (order.getPayType() == 3) { // if (order.getPayType() == 3) {
if (highUserService.findGoldRepeat(3 , order.getId())) { // if (highUserService.findGoldRepeat(3 , order.getId())) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId()); // highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
}else { // }else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); // 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() );
order.setRefundFee(order.getPayRealPrice()); // order.setRefundFee(order.getPayRealPrice());
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} // }
//
// 银联退款 // // 银联退款
if (order.getPayType() == 4) { // if (order.getPayType() == 4) {
// 订单退款 // // 订单退款
JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); // JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("W6")) { // if (!refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); // throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
} // }
//
order.setStatus(5); // order.setStatus(5);
order.setRefundTime(new Date()); // order.setRefundTime(new Date());
order.setOutRefundNo(refund.getString("oriwtorderid")); // order.setOutRefundNo(refund.getString("oriwtorderid"));
order.setRefundFee(order.getPayRealPrice()); // order.setRefundFee(order.getPayRealPrice());
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
} // }
//
if (order.getMemDiscountId() != null) { // if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId()); // HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) { // if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 // rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(null); // rel.setUseTime(null);
highDiscountUserRelService.updateDiscountUserRel(rel); // highDiscountUserRelService.updateDiscountUserRel(rel);
//
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId()); // HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId());
code.setStatus(2); // code.setStatus(2);
highDiscountAgentCodeService.updateCode(code); // highDiscountAgentCodeService.updateCode(code);
} // }
} // }
} }

@ -1,13 +1,22 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.dao.OutRechargePriceMapper; import com.hai.dao.OutRechargePriceMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.service.CommonService;
import com.hai.service.OutRechargePriceService; import com.hai.service.OutRechargePriceService;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -17,26 +26,30 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
@Resource @Resource
private OutRechargePriceMapper outRechargePriceMapper; private OutRechargePriceMapper outRechargePriceMapper;
@Resource
private CommonService commonService;
@Override @Override
public List<OutRechargePrice> getListRechargePrice(Map<String , String> map) { public List<OutRechargePrice> getListRechargePrice(Map<String , Object> map) {
OutRechargePriceExample example = new OutRechargePriceExample(); OutRechargePriceExample example = new OutRechargePriceExample();
OutRechargePriceExample.Criteria criteria = example.createCriteria(); OutRechargePriceExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(map.get("type"))) { if (MapUtils.getLong(map , "companyId") != null) {
criteria.andTypeEqualTo(Integer.valueOf(map.get("type"))); criteria.andCompanyIdEqualTo(MapUtils.getLong(map , "companyId"));
} }
if (StringUtils.isNotBlank(map.get("showType"))) {
criteria.andShowTypeEqualTo(Integer.valueOf(map.get("showType"))); if (MapUtils.getLong(map , "rechargePlatform") != null) {
criteria.andRechargePlatformLike("%-" +MapUtils.getLong(map , "rechargePlatform") + "-%");
} }
if (StringUtils.isNotBlank(map.get("companyId"))) { if (MapUtils.getLong(map , "rechargeType") != null) {
criteria.andCompanyIdEqualTo(Long.valueOf(map.get("companyId"))); criteria.andRechargeTypeEqualTo(MapUtils.getInteger(map , "rechargeType"));
} }
if (StringUtils.isNotBlank(map.get("rechargeType"))) { if (MapUtils.getLong(map , "rechargeType") != null) {
criteria.andRechargeTypeEqualTo(Integer.valueOf(map.get("rechargeType"))); criteria.andRechargeTypeEqualTo(MapUtils.getInteger(map , "rechargeType"));
} }
example.setOrderByClause("type asc"); example.setOrderByClause("recharge_price asc");
return outRechargePriceMapper.selectByExample(example); return outRechargePriceMapper.selectByExample(example);
} }
@Override @Override
@ -46,12 +59,6 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
criteria.andStatusNotEqualTo(0); criteria.andStatusNotEqualTo(0);
if (StringUtils.isNotBlank(map.get("type"))) {
criteria.andTypeEqualTo(Integer.valueOf(map.get("type")));
}
if (StringUtils.isNotBlank(map.get("showType"))) {
criteria.andShowTypeEqualTo(Integer.valueOf(map.get("showType")));
}
if (StringUtils.isNotBlank(map.get("companyId"))) { if (StringUtils.isNotBlank(map.get("companyId"))) {
criteria.andCompanyIdEqualTo(Long.valueOf(map.get("companyId"))); criteria.andCompanyIdEqualTo(Long.valueOf(map.get("companyId")));
} }
@ -70,8 +77,50 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
} }
@Override @Override
public void insertRechargePrice(OutRechargePrice outRechargePrice) { @Transactional(propagation= Propagation.REQUIRES_NEW)
outRechargePriceMapper.insert(outRechargePrice); public void insertRechargePrice(JSONObject object) {
// 转换金额数组
JSONArray priceArray = object.getJSONArray("rechargePrices");
// 充值金额
OutRechargePrice outRechargePrice;
for (Object price : priceArray) {
SecDictionary dictionary = commonService.mappingSysCode("RECHARGE_AMOUNT", String.valueOf(price));
BigDecimal priceBd = new BigDecimal(dictionary.getCodeName());
outRechargePrice = new OutRechargePrice();
outRechargePrice.setRechargePrice(priceBd);
outRechargePrice.setPayPrice(priceBd.multiply(object.getBigDecimal("discount").divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)));
outRechargePrice.setDiscount(object.getBigDecimal("discount"));
outRechargePrice.setRechargeType(object.getInteger("rechargeType"));
outRechargePrice.setOperatorType(object.getInteger("operatorType"));
outRechargePrice.setRechargePlatform("-" + StringUtils.join(object.getJSONArray("rechargePlatform") , "-") + "-");
outRechargePrice.setRechargeWay(object.getInteger("rechargeWay"));
outRechargePrice.setCompanyId(object.getLong("companyId"));
outRechargePrice.setCreateTime(new Date());
outRechargePrice.setUpdateTime(new Date());
outRechargePrice.setStatus(3);
outRechargePrice.setSort(1);
outRechargePriceMapper.insert(outRechargePrice);
JSONObject postObject = new JSONObject();
postObject.put("payType", object.getJSONArray("payType"));
postObject.put("integralDiscount", object.getBigDecimal("integralDiscount"));
postObject.put("productPlatform", object.getJSONArray("productPlatform"));
postObject.put("operatorId", object.getLong("operatorId"));
postObject.put("operatorName", object.getString("operatorName"));
postObject.put("sourceId", outRechargePrice.getId());
// 配置支付方式
commonService.configPayType(postObject);
// 配置积分折扣比例
commonService.configIntegralDiscount(postObject);
// 配置展示平台
commonService.configPlatform(postObject);
}
} }
@Override @Override

@ -65,28 +65,28 @@ public class RechargeOrderServiceImpl implements PayService {
if (payType.equals("WechatPay")) { if (payType.equals("WechatPay")) {
// 查询订单信息 // 查询订单信息
OutRechargeOrder order = outRechargeOrderService.findByOrderNo(map.get("out_trade_no")); OutRechargeOrder order = outRechargeOrderService.findByOrderNo(map.get("out_trade_no"));
if (order != null && order.getStatus() == 1) { // if (order != null && order.getStatus() == 1) {
order.setPaySerialNo(map.get("transaction_id")); // 支付流水号 // order.setPaySerialNo(map.get("transaction_id")); // 支付流水号
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() == 1) { // if (order.getRechargeType() == 1) {
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo() , order.getRechargeType()); // 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"));
} // }
} // }
outRechargeOrderService.updateOrder(order); // outRechargeOrderService.updateOrder(order);
// 推送订单记录 // // 推送订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); // HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type2.getType()); // highGasOrderPush.setType(OrderPushType.type2.getType());
highGasOrderPush.setOrderNo(order.getOrderNo()); // highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date()); // highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent(order.getOrderNo()); // highGasOrderPush.setRequestContent(order.getOrderNo());
highGasOrderPush.setReturnContent(String.valueOf(map)); // highGasOrderPush.setReturnContent(String.valueOf(map));
highGasOrderPushMapper.insert(highGasOrderPush); // highGasOrderPushMapper.insert(highGasOrderPush);
} // }
} }
} }

Loading…
Cancel
Save