diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java index d463e784..8a90610d 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ -package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HltUnionCardVipService hltUnionCardVipService; @Resource private HighTestService highTestService; @RequestMapping(value = "/getBackendToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取访问令牌backendToken") public ResponseData getBackendToken() { try { return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/GetMembershipLevel", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求会员体系") public ResponseData GetMembershipLevel(@RequestParam(name = "phone", required = true) String phone , @RequestParam(name = "regionId", required = true) String regionId ) { try { return ResponseMsgUtil.success(hltUnionCardVipService.GetMembershipLevel(phone , regionId)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/submitSms", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求短信") public ResponseData submitSms(@RequestParam(name = "phone", required = true) String phone , @RequestParam(name = "sms", required = true) String sms ) { try { return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.submitSms(phone , sms)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/getReadFile",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "存入用户信息") public ResponseData getReadFile() { try { highTestService.getReadFile(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/getUserDiscount",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "赠送优惠券") public ResponseData getUserDiscount(@RequestParam(name = "id", required = true) Long id) { try { highTestService.getUserDiscount(id); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HltUnionCardVipService hltUnionCardVipService; @Resource private HighTestService highTestService; @Resource private OutRechargeOrderService outRechargeOrderService; @RequestMapping(value = "/getBackendToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取访问令牌backendToken") public ResponseData getBackendToken() { try { return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/GetMembershipLevel", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求会员体系") public ResponseData GetMembershipLevel(@RequestParam(name = "phone", required = true) String phone , @RequestParam(name = "regionId", required = true) String regionId ) { try { return ResponseMsgUtil.success(hltUnionCardVipService.GetMembershipLevel(phone , regionId)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/submitSms", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求短信") public ResponseData submitSms(@RequestParam(name = "phone", required = true) String phone , @RequestParam(name = "sms", required = true) String sms ) { try { return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.submitSms(phone , sms)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/getReadFile",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "存入用户信息") public ResponseData getReadFile() { try { highTestService.getReadFile(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/getUserDiscount",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "赠送优惠券") public ResponseData getUserDiscount(@RequestParam(name = "id", required = true) Long id) { try { highTestService.getUserDiscount(id); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/queryAmount",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询余额") public ResponseData queryAmount() { try { // outRechargeOrderService.queryAmount(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getMobile", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费充值") public ResponseData getMobile( @RequestParam(name = "orderNo", required = true) String orderNo, @RequestParam(name = "amount", required = true) Integer amount, @RequestParam(name = "phone", required = true) String phone) { try { JSONObject object = outRechargeOrderService.getMobile(phone,amount,orderNo); return ResponseMsgUtil.success(object.getInteger("code")); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java b/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java index 14a478e9..d178f8e4 100644 --- a/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java +++ b/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java @@ -53,10 +53,16 @@ public class ImportRechargeOrderListener extends AnalysisEventListener 0) { try { - outRechargeOrderService.updateOrderList(successData); +// outRechargeOrderService.updateOrderList(successData); } catch (Exception e) { e.printStackTrace(); } diff --git a/hai-bweb/src/main/java/com/bweb/model/ExportOutRechargeOrder.java b/hai-bweb/src/main/java/com/bweb/model/ExportOutRechargeOrder.java index 179803a7..38091c5d 100644 --- a/hai-bweb/src/main/java/com/bweb/model/ExportOutRechargeOrder.java +++ b/hai-bweb/src/main/java/com/bweb/model/ExportOutRechargeOrder.java @@ -37,7 +37,7 @@ public class ExportOutRechargeOrder { @ExcelProperty("应付金额") private BigDecimal payPrice; - @ExcelProperty("充值类型") + @ExcelProperty("充值方式") private String rechargeTypeName; @ExcelProperty("实付金额") diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index a5eb2d74..e4b8b1f4 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -116,24 +116,21 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/highUser/delCacheParam") .excludePathPatterns("/order/orderToH5Pay") .excludePathPatterns("/order/orderToPay") - .excludePathPatterns("/test/*") .excludePathPatterns("/cmsContent/*") .excludePathPatterns("/highGas/*") - .excludePathPatterns("/outRechargeOrder/*") .excludePathPatterns("/wechat/*") .excludePathPatterns("/tuanyou/*") .excludePathPatterns("/unionPay/*") .excludePathPatterns("/highGas/*") .excludePathPatterns("/common/*") .excludePathPatterns("/order/qzOrderToPay") - .excludePathPatterns("/czOrder/orderRefundNotify") .excludePathPatterns("/cmsContent/*") .excludePathPatterns("/highBrand/*") .excludePathPatterns("/highGoodsType/*") .excludePathPatterns("/sendSms/*") .excludePathPatterns("/sms/*") - .excludePathPatterns("/outRechargePrice/*") .excludePathPatterns("/czOrder/*") + .excludePathPatterns("/outRechargeOrder/*") ; } diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index f02d2a72..dc6a0a4b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -1 +1 @@ -package com.cweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private UnionUserConfig unionUserConfig; @Resource private OutRechargeOrderService outRechargeOrderService; @RequestMapping(value = "/getHuiLianTongCardInfo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡详情") public ResponseData getHuiLianTongCardInfo(@RequestParam(name = "cardNo", required = true) String cardNo, HttpServletRequest request) { try { // 用户 // JSONObject cardInfo = HuiLianTongUnionCardConfig.queryCardInfo(cardNo); if (StringUtils.isBlank(cardInfo.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data"))); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getMobile", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费充值") public ResponseData getMobile( @RequestParam(name = "orderNo", required = true) String orderNo, @RequestParam(name = "amount", required = true) Integer amount, @RequestParam(name = "phone", required = true) String phone, HttpServletRequest request) { try { return ResponseMsgUtil.success(outRechargeOrderService.getMobile(phone,amount,orderNo)); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "初始化加油站") public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue();i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("初始化完成"); } @RequestMapping(value = "/pushTuanYouOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "推送团油订单") public ResponseData pushTuanYouOrder() { try { HighOrder order = highOrderService.getOrderByOrderNo("HF2021102112141171406"); for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", highChildOrder.getGasOilNo()); paramMap.put("gunNo", highChildOrder.getGasGunNo()); BigDecimal priceGun = highChildOrder.getGasPriceGun(); BigDecimal priceVip = highChildOrder.getGasPriceVip(); paramMap.put("priceGun", priceGun); // 枪单价 paramMap.put("priceVip", priceVip); // 优惠价 paramMap.put("driverPhone", order.getMemPhone()); // paramMap.put("driverPhone", "17726395120"); paramMap.put("thirdSerialNo", order.getOrderNo()); paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); // 油品类型 1:汽油:2:柴油;3:天然气 if (highChildOrder.getGasOilType() == 1) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); } else if (highChildOrder.getGasOilType() == 2) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); // 推送团油订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCode(orderPushObject.getString("code")); highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } highOrderService.updateOrder(order); } return ResponseMsgUtil.success(order); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryCompanyAccountInfo2JD", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyAccountInfo2JD() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/couJointDist", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "派发贵州卡券") public ResponseData couJointDist(@RequestParam(name = "token", required = true) String token) { try { return ResponseMsgUtil.success(HuiLianTongConfig.couJointDist(token,"HF"+System.currentTimeMillis(),"20JY000251",2,"17726395120", "oArhO6XxKSvjI9wLP3cTK-iSG8yY")); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联支付") public ResponseData unionPay() { try { return ResponseMsgUtil.success(unionPayConfig.upPreOrder("HF"+System.currentTimeMillis(), new BigDecimal("1"), "test",CommonSysConst.getSysConfig().getUnionPayNotifyUrl())); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取贵州中石化token") public ResponseData getToken() { try { return ResponseMsgUtil.success(huiLianTongConfig.getToken()); } catch (Exception e) { log.error("HighOrderController --> getToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionTradeQuery", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联交易查询") public ResponseData unionTradeQuery(@RequestParam(name = "paySerialNo", required = true) String paySerialNo) { try { return ResponseMsgUtil.success(UnionPayConfig.tradeQuery(paySerialNo)); } catch (Exception e) { log.error("HighOrderController --> unionTradeQuery() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getBackendToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取访问令牌backendToken") public ResponseData getBackendToken() { try { return ResponseMsgUtil.success(unionUserConfig.getBackendToken()); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxSplitAccount", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "微信分账") public ResponseData wxSplitAccount() { try { HighOrder orderNo = highOrderService.getOrderByOrderNo("HF2021101812025050304"); wxProfitsharing(orderNo.getOrderNo(),orderNo.getPaySerialNo(),orderNo.getPayRealPrice()); return ResponseMsgUtil.success("分账成功"); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionStagingPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联分期支付") public ResponseData unionStagingPay() { try { /* String orderNo = DateUtil.format(new Date(), DateUtil.YMDHMS); orderNo += IDGenerator.nextId(28 - orderNo.length());*/ String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.advancePay( orgTrace, orgTrace, new BigDecimal("1"), "62285", "c8BHfKVs6l68BBP9KD9jz4QLJCd/IKW/D+EsM0BLKzb/E7l8k4+aO/Y/h5j89s1X", CommonSysConst.getSysConfig().getUnionStagingPayNotifyUrl())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryStaging", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期查询") public ResponseData queryStaging(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.queryStaging(orgTrace,oriOrgTrace ,"", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/query", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单查询") public ResponseData query(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.query(orgTrace,oriOrgTrace ,"", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mposrefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期退款") public ResponseData mposrefund(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.standardRefund(orgTrace,oriOrgTrace ,new BigDecimal("1"), "", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mposfindrefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期退款查询") public ResponseData mposfindrefund(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.mposfindrefund(orgTrace,oriOrgTrace ,"", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } public void wxProfitsharing(String transaction_id,String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); param.put("sub_mch_id" , "1609882817"); // 个体户黎杨珍 param.put("transaction_id" , transaction_id); param.put("out_order_no" , out_order_no); param.put("nonce_str" , WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers" , JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); param.put("sign" , signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"),null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); if (!resultProfitSharing.getResult_code().equals("FAIL")) { HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(resultProfitSharing.getOut_order_no()); sharingRecord.setTransactionId(resultProfitSharing.getTransaction_id()); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } public CloseableHttpClient readCertificate(String mchId) throws Exception{ /** * 注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的 */ KeyStore keyStore = KeyStore.getInstance("PKCS12"); //P12文件目录 证书路径,这里需要你自己修改,linux下还是windows下的根路径 FileInputStream instream = new FileInputStream("/home/project/wx_cert/1289663601_apiclient_cert.p12"); // FileInputStream instream = new FileInputStream("G:\\hurui-project/hai-parent/hai-service/src/main/java/privatekey/1289663601_apiclient_cert.p12"); try { keyStore.load(instream, "1289663601".toCharArray());//这里写密码..默认是你的MCHID } finally { instream.close(); } SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "1289663601".toCharArray()).build();//这里也是写密码的 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); // Allow TLSv1 protocol only return HttpClients.custom().setSSLSocketFactory(sslsf).build(); } public String doRefundRequest(String mchId, String url, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = readCertificate(mchId); try { HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund"); // 设置响应头信息 httpost.addHeader("Connection", "keep-alive"); httpost.addHeader("Accept", "*/*"); httpost.addHeader("Content-Type", "text/xml"); httpost.addHeader("Host", "api.mch.weixin.qq.com"); httpost.addHeader("X-Requested-With", "XMLHttpRequest"); httpost.addHeader("Cache-Control", "max-age=0"); httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); httpost.setEntity(new StringEntity(data, "UTF-8")); CloseableHttpResponse response = httpClient.execute(httpost); try { HttpEntity entity = response.getEntity(); String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); EntityUtils.consume(entity); return jsonStr; } finally { response.close(); } } catch (Exception e){ throw new RuntimeException(e); } finally { httpClient.close(); } } } \ No newline at end of file +package com.cweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.FileInputStream; import java.math.BigDecimal; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private UnionUserConfig unionUserConfig; @Resource private OutRechargeOrderService outRechargeOrderService; @RequestMapping(value = "/getHuiLianTongCardInfo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡详情") public ResponseData getHuiLianTongCardInfo(@RequestParam(name = "cardNo", required = true) String cardNo, HttpServletRequest request) { try { // 用户 // JSONObject cardInfo = HuiLianTongUnionCardConfig.queryCardInfo(cardNo); if (StringUtils.isBlank(cardInfo.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data"))); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } // // @RequestMapping(value = "/getMobile", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "话费充值") // public ResponseData getMobile( // @RequestParam(name = "orderNo", required = true) String orderNo, // @RequestParam(name = "amount", required = true) Integer amount, // @RequestParam(name = "phone", required = true) String phone, // HttpServletRequest request) { // try { // return ResponseMsgUtil.success(outRechargeOrderService.getMobile(phone,amount,orderNo)); // // } catch (Exception e) { // log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "初始化加油站") public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue();i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("初始化完成"); } @RequestMapping(value = "/pushTuanYouOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "推送团油订单") public ResponseData pushTuanYouOrder() { try { HighOrder order = highOrderService.getOrderByOrderNo("HF2021102112141171406"); for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", highChildOrder.getGasOilNo()); paramMap.put("gunNo", highChildOrder.getGasGunNo()); BigDecimal priceGun = highChildOrder.getGasPriceGun(); BigDecimal priceVip = highChildOrder.getGasPriceVip(); paramMap.put("priceGun", priceGun); // 枪单价 paramMap.put("priceVip", priceVip); // 优惠价 paramMap.put("driverPhone", order.getMemPhone()); // paramMap.put("driverPhone", "17726395120"); paramMap.put("thirdSerialNo", order.getOrderNo()); paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); // 油品类型 1:汽油:2:柴油;3:天然气 if (highChildOrder.getGasOilType() == 1) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); } else if (highChildOrder.getGasOilType() == 2) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); // 推送团油订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCode(orderPushObject.getString("code")); highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } highOrderService.updateOrder(order); } return ResponseMsgUtil.success(order); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryCompanyAccountInfo2JD", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyAccountInfo2JD() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } // @RequestMapping(value = "/couJointDist", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "派发贵州卡券") // public ResponseData couJointDist(@RequestParam(name = "token", required = true) String token) { // try { // return ResponseMsgUtil.success(HuiLianTongConfig.couJointDist(token,"HF"+System.currentTimeMillis(),"20JY000251",2,"17726395120", "oArhO6XxKSvjI9wLP3cTK-iSG8yY")); // } catch (Exception e) { // log.error("HighOrderController --> getOrderById() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/unionPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联支付") public ResponseData unionPay() { try { return ResponseMsgUtil.success(unionPayConfig.upPreOrder("HF"+System.currentTimeMillis(), new BigDecimal("1"), "test",CommonSysConst.getSysConfig().getUnionPayNotifyUrl())); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取贵州中石化token") public ResponseData getToken() { try { return ResponseMsgUtil.success(huiLianTongConfig.getToken()); } catch (Exception e) { log.error("HighOrderController --> getToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionTradeQuery", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联交易查询") public ResponseData unionTradeQuery(@RequestParam(name = "paySerialNo", required = true) String paySerialNo) { try { return ResponseMsgUtil.success(UnionPayConfig.tradeQuery(paySerialNo)); } catch (Exception e) { log.error("HighOrderController --> unionTradeQuery() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getBackendToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取访问令牌backendToken") public ResponseData getBackendToken() { try { return ResponseMsgUtil.success(unionUserConfig.getBackendToken()); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxSplitAccount", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "微信分账") public ResponseData wxSplitAccount() { try { HighOrder orderNo = highOrderService.getOrderByOrderNo("HF2021101812025050304"); wxProfitsharing(orderNo.getOrderNo(),orderNo.getPaySerialNo(),orderNo.getPayRealPrice()); return ResponseMsgUtil.success("分账成功"); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionStagingPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联分期支付") public ResponseData unionStagingPay() { try { /* String orderNo = DateUtil.format(new Date(), DateUtil.YMDHMS); orderNo += IDGenerator.nextId(28 - orderNo.length());*/ String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.advancePay( orgTrace, orgTrace, new BigDecimal("1"), "62285", "c8BHfKVs6l68BBP9KD9jz4QLJCd/IKW/D+EsM0BLKzb/E7l8k4+aO/Y/h5j89s1X", CommonSysConst.getSysConfig().getUnionStagingPayNotifyUrl())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryStaging", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期查询") public ResponseData queryStaging(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.queryStaging(orgTrace,oriOrgTrace ,"", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/query", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单查询") public ResponseData query(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.query(orgTrace,oriOrgTrace ,"", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mposrefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期退款") public ResponseData mposrefund(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.standardRefund(orgTrace,oriOrgTrace ,new BigDecimal("1"), "", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mposfindrefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期退款查询") public ResponseData mposfindrefund(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4) +CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) +DateUtil.format(new Date(), DateUtil.YMDHMS) +IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.mposfindrefund(orgTrace,oriOrgTrace ,"", new Date())); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } public void wxProfitsharing(String transaction_id,String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); param.put("sub_mch_id" , "1609882817"); // 个体户黎杨珍 param.put("transaction_id" , transaction_id); param.put("out_order_no" , out_order_no); param.put("nonce_str" , WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers" , JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); param.put("sign" , signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"),null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); if (!resultProfitSharing.getResult_code().equals("FAIL")) { HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(resultProfitSharing.getOut_order_no()); sharingRecord.setTransactionId(resultProfitSharing.getTransaction_id()); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } public CloseableHttpClient readCertificate(String mchId) throws Exception{ /** * 注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的 */ KeyStore keyStore = KeyStore.getInstance("PKCS12"); //P12文件目录 证书路径,这里需要你自己修改,linux下还是windows下的根路径 FileInputStream instream = new FileInputStream("/home/project/wx_cert/1289663601_apiclient_cert.p12"); // FileInputStream instream = new FileInputStream("G:\\hurui-project/hai-parent/hai-service/src/main/java/privatekey/1289663601_apiclient_cert.p12"); try { keyStore.load(instream, "1289663601".toCharArray());//这里写密码..默认是你的MCHID } finally { instream.close(); } SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "1289663601".toCharArray()).build();//这里也是写密码的 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); // Allow TLSv1 protocol only return HttpClients.custom().setSSLSocketFactory(sslsf).build(); } public String doRefundRequest(String mchId, String url, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = readCertificate(mchId); try { HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/refund"); // 设置响应头信息 httpost.addHeader("Connection", "keep-alive"); httpost.addHeader("Accept", "*/*"); httpost.addHeader("Content-Type", "text/xml"); httpost.addHeader("Host", "api.mch.weixin.qq.com"); httpost.addHeader("X-Requested-With", "XMLHttpRequest"); httpost.addHeader("Cache-Control", "max-age=0"); httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); httpost.setEntity(new StringEntity(data, "UTF-8")); CloseableHttpResponse response = httpClient.execute(httpost); try { HttpEntity entity = response.getEntity(); String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); EntityUtils.consume(entity); return jsonStr; } finally { response.close(); } } catch (Exception e){ throw new RuntimeException(e); } finally { httpClient.close(); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java index ae99191d..45a56b6c 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java @@ -475,10 +475,18 @@ public class OutRechargeOrderController { outRechargeOrderService.goldPayOrder(userInfoModel.getHighUser().getId(), order.getId()); if (order.getRechargeType() != null && order.getRechargeType() == 1) { - outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); - } - - return ResponseMsgUtil.success("支付成功"); + JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); + if (object.getInteger("code") != 200) { + order.setRechargeStatus(1); + order.setStatus(2); + order.setPayType(3); + order.setPayTime(new Date()); // 支付时间 + order.setAbnormalMsg(object.getString("message")); + outRechargeOrderService.updateOrder(order); + } + } + + return ResponseMsgUtil.success("充值成功"); } catch (Exception e) { log.error("orderToPay error!", e); return ResponseMsgUtil.exception(e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 4227ab5a..7515653c 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -158,6 +158,31 @@ public class WechatController { } } + @RequestMapping(value = "/loginByTel", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "小程序根据手机号登录或注册") + public ResponseData loginByPhone(@RequestParam(value = "loginByTel", required = true) String loginByTel, + HttpServletRequest request, HttpServletResponse response) { + try { + + // 根据手机号查询用户 + HighUser user = highUserService.findByPhone(loginByTel); + + // 定义个人所有数据 + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel); + userCenter.save(request, response, so); + + return ResponseMsgUtil.success(so); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/getUserInfo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "小程序获取用户信息") diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java index f0bb6ec4..9f7839cf 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.CommonSysConst; import com.hai.config.HuiLianTongConfig; import com.hai.config.TuanYouConfig; @@ -386,17 +387,18 @@ public class UnionPayController { order.setPaySerialNo(body.getString("wtorderid")); // 支付流水号 order.setPayRealPrice(order.getPayPrice()); // 实付金额 - if (order.getRechargeType() != null && order.getRechargeType() == 1) { - outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); - } order.setStatus(2); order.setPayType(4); order.setPayTime(new Date()); // 支付时间 - outRechargeOrderService.updateOrder(order); if (order.getRechargeType() != null && order.getRechargeType() == 1) { - outRechargeOrderService.getMobile(order.getRechargeContent() , order.getPayPrice().intValue() , order.getOrderNo()); + JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); + if (object.getInteger("code") != 200) { + order.setRechargeStatus(1); + order.setAbnormalMsg(object.getString("message")); + } } + outRechargeOrderService.updateOrder(order); } } diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java index 2adc47ea..292a0c3d 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java @@ -47,13 +47,14 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "recharge_type, pay_real_price, ", "pay_serial_no, deduction_price, ", "`status`, recharge_content, ", - "recharge_name, id_card, ", - "create_timed, pay_time, ", - "cancel_time, finish_time, ", - "remarks, out_refund_no, ", - "refund_time, refund_id, ", - "refund_fee, agent_key, ", - "object_id, Identification_code)", + "recharge_name, recharge_status, ", + "id_card, create_timed, ", + "pay_time, cancel_time, ", + "finish_time, remarks, ", + "out_refund_no, refund_time, ", + "refund_id, refund_fee, ", + "agent_key, object_id, ", + "Identification_code, abnormal_msg)", "values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ", "#{memDiscountName,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, ", "#{userName,jdbcType=VARCHAR}, #{userPhone,jdbcType=VARCHAR}, ", @@ -62,13 +63,14 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "#{rechargeType,jdbcType=INTEGER}, #{payRealPrice,jdbcType=DECIMAL}, ", "#{paySerialNo,jdbcType=VARCHAR}, #{deductionPrice,jdbcType=DECIMAL}, ", "#{status,jdbcType=INTEGER}, #{rechargeContent,jdbcType=VARCHAR}, ", - "#{rechargeName,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR}, ", - "#{createTimed,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ", - "#{cancelTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ", - "#{remarks,jdbcType=VARCHAR}, #{outRefundNo,jdbcType=VARCHAR}, ", - "#{refundTime,jdbcType=TIMESTAMP}, #{refundId,jdbcType=VARCHAR}, ", - "#{refundFee,jdbcType=DECIMAL}, #{agentKey,jdbcType=VARCHAR}, ", - "#{objectId,jdbcType=INTEGER}, #{identificationCode,jdbcType=BIGINT})" + "#{rechargeName,jdbcType=VARCHAR}, #{rechargeStatus,jdbcType=INTEGER}, ", + "#{idCard,jdbcType=VARCHAR}, #{createTimed,jdbcType=TIMESTAMP}, ", + "#{payTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ", + "#{finishTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, ", + "#{outRefundNo,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, ", + "#{refundId,jdbcType=VARCHAR}, #{refundFee,jdbcType=DECIMAL}, ", + "#{agentKey,jdbcType=VARCHAR}, #{objectId,jdbcType=INTEGER}, ", + "#{identificationCode,jdbcType=BIGINT}, #{abnormalMsg,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(OutRechargeOrder record); @@ -97,6 +99,7 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="recharge_content", property="rechargeContent", jdbcType=JdbcType.VARCHAR), @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), @Result(column="id_card", property="idCard", jdbcType=JdbcType.VARCHAR), @Result(column="create_timed", property="createTimed", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), @@ -109,7 +112,8 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="refund_fee", property="refundFee", jdbcType=JdbcType.DECIMAL), @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), @Result(column="object_id", property="objectId", jdbcType=JdbcType.INTEGER), - @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT) + @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR) }) List selectByExample(OutRechargeOrderExample example); @@ -117,9 +121,10 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "select", "id, order_no, mem_discount_id, mem_discount_name, user_id, user_name, user_phone, ", "recharge_model, pay_type, pay_price, order_price, recharge_type, pay_real_price, ", - "pay_serial_no, deduction_price, `status`, recharge_content, recharge_name, id_card, ", - "create_timed, pay_time, cancel_time, finish_time, remarks, out_refund_no, refund_time, ", - "refund_id, refund_fee, agent_key, object_id, Identification_code", + "pay_serial_no, deduction_price, `status`, recharge_content, recharge_name, recharge_status, ", + "id_card, create_timed, pay_time, cancel_time, finish_time, remarks, out_refund_no, ", + "refund_time, refund_id, refund_fee, agent_key, object_id, Identification_code, ", + "abnormal_msg", "from out_recharge_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -142,6 +147,7 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="recharge_content", property="rechargeContent", jdbcType=JdbcType.VARCHAR), @Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR), + @Result(column="recharge_status", property="rechargeStatus", jdbcType=JdbcType.INTEGER), @Result(column="id_card", property="idCard", jdbcType=JdbcType.VARCHAR), @Result(column="create_timed", property="createTimed", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), @@ -154,7 +160,8 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { @Result(column="refund_fee", property="refundFee", jdbcType=JdbcType.DECIMAL), @Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR), @Result(column="object_id", property="objectId", jdbcType=JdbcType.INTEGER), - @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT) + @Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT), + @Result(column="abnormal_msg", property="abnormalMsg", jdbcType=JdbcType.VARCHAR) }) OutRechargeOrder selectByPrimaryKey(Long id); @@ -186,6 +193,7 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "`status` = #{status,jdbcType=INTEGER},", "recharge_content = #{rechargeContent,jdbcType=VARCHAR},", "recharge_name = #{rechargeName,jdbcType=VARCHAR},", + "recharge_status = #{rechargeStatus,jdbcType=INTEGER},", "id_card = #{idCard,jdbcType=VARCHAR},", "create_timed = #{createTimed,jdbcType=TIMESTAMP},", "pay_time = #{payTime,jdbcType=TIMESTAMP},", @@ -198,7 +206,8 @@ public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt { "refund_fee = #{refundFee,jdbcType=DECIMAL},", "agent_key = #{agentKey,jdbcType=VARCHAR},", "object_id = #{objectId,jdbcType=INTEGER},", - "Identification_code = #{identificationCode,jdbcType=BIGINT}", + "Identification_code = #{identificationCode,jdbcType=BIGINT},", + "abnormal_msg = #{abnormalMsg,jdbcType=VARCHAR}", "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(OutRechargeOrder record); diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java index 83357fd4..3e099165 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java @@ -68,7 +68,7 @@ public interface OutRechargeOrderMapperExt { " a.user_name userName," + " a.user_phone userPhone," + " case a.recharge_model when 1 then '电信话费' when 2 then '移动话费' when 3 then '联通话费' end rechargeModelName," + - " case a.recharge_type when 1 then '快充' when 2 then '慢充' end getRechargeTypeName," + + " case a.recharge_type when 1 then '快充' when 2 then '慢充' end rechargeTypeName," + " a.recharge_content rechargeContent," + " a.remarks remarks," + " a.id_card cardNo," + diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java index 49d328cb..83894cca 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java @@ -96,6 +96,10 @@ public class OutRechargeOrderSqlProvider { sql.VALUES("recharge_name", "#{rechargeName,jdbcType=VARCHAR}"); } + if (record.getRechargeStatus() != null) { + sql.VALUES("recharge_status", "#{rechargeStatus,jdbcType=INTEGER}"); + } + if (record.getIdCard() != null) { sql.VALUES("id_card", "#{idCard,jdbcType=VARCHAR}"); } @@ -148,6 +152,10 @@ public class OutRechargeOrderSqlProvider { sql.VALUES("Identification_code", "#{identificationCode,jdbcType=BIGINT}"); } + if (record.getAbnormalMsg() != null) { + sql.VALUES("abnormal_msg", "#{abnormalMsg,jdbcType=VARCHAR}"); + } + return sql.toString(); } @@ -175,6 +183,7 @@ public class OutRechargeOrderSqlProvider { sql.SELECT("`status`"); sql.SELECT("recharge_content"); sql.SELECT("recharge_name"); + sql.SELECT("recharge_status"); sql.SELECT("id_card"); sql.SELECT("create_timed"); sql.SELECT("pay_time"); @@ -188,6 +197,7 @@ public class OutRechargeOrderSqlProvider { sql.SELECT("agent_key"); sql.SELECT("object_id"); sql.SELECT("Identification_code"); + sql.SELECT("abnormal_msg"); sql.FROM("out_recharge_order"); applyWhere(sql, example, false); @@ -277,6 +287,10 @@ public class OutRechargeOrderSqlProvider { sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}"); } + if (record.getRechargeStatus() != null) { + sql.SET("recharge_status = #{record.rechargeStatus,jdbcType=INTEGER}"); + } + if (record.getIdCard() != null) { sql.SET("id_card = #{record.idCard,jdbcType=VARCHAR}"); } @@ -329,6 +343,10 @@ public class OutRechargeOrderSqlProvider { sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}"); } + if (record.getAbnormalMsg() != null) { + sql.SET("abnormal_msg = #{record.abnormalMsg,jdbcType=VARCHAR}"); + } + applyWhere(sql, example, true); return sql.toString(); } @@ -355,6 +373,7 @@ public class OutRechargeOrderSqlProvider { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("recharge_content = #{record.rechargeContent,jdbcType=VARCHAR}"); sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}"); + sql.SET("recharge_status = #{record.rechargeStatus,jdbcType=INTEGER}"); sql.SET("id_card = #{record.idCard,jdbcType=VARCHAR}"); sql.SET("create_timed = #{record.createTimed,jdbcType=TIMESTAMP}"); sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); @@ -368,6 +387,7 @@ public class OutRechargeOrderSqlProvider { sql.SET("agent_key = #{record.agentKey,jdbcType=VARCHAR}"); sql.SET("object_id = #{record.objectId,jdbcType=INTEGER}"); sql.SET("Identification_code = #{record.identificationCode,jdbcType=BIGINT}"); + sql.SET("abnormal_msg = #{record.abnormalMsg,jdbcType=VARCHAR}"); OutRechargeOrderExample example = (OutRechargeOrderExample) parameter.get("example"); applyWhere(sql, example, true); @@ -446,6 +466,10 @@ public class OutRechargeOrderSqlProvider { sql.SET("recharge_name = #{rechargeName,jdbcType=VARCHAR}"); } + if (record.getRechargeStatus() != null) { + sql.SET("recharge_status = #{rechargeStatus,jdbcType=INTEGER}"); + } + if (record.getIdCard() != null) { sql.SET("id_card = #{idCard,jdbcType=VARCHAR}"); } @@ -498,6 +522,10 @@ public class OutRechargeOrderSqlProvider { sql.SET("Identification_code = #{identificationCode,jdbcType=BIGINT}"); } + if (record.getAbnormalMsg() != null) { + sql.SET("abnormal_msg = #{abnormalMsg,jdbcType=VARCHAR}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java index 88133011..7596520e 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java @@ -104,6 +104,11 @@ public class OutRechargeOrder implements Serializable { */ private String rechargeName; + /** + * 1:充值异常 + */ + private Integer rechargeStatus; + /** * 中石油需要持卡人身份证 */ @@ -163,6 +168,11 @@ public class OutRechargeOrder implements Serializable { private Long identificationCode; + /** + * 异常信息 + */ + private String abnormalMsg; + private static final long serialVersionUID = 1L; public Long getId() { @@ -309,6 +319,14 @@ public class OutRechargeOrder implements Serializable { this.rechargeName = rechargeName; } + public Integer getRechargeStatus() { + return rechargeStatus; + } + + public void setRechargeStatus(Integer rechargeStatus) { + this.rechargeStatus = rechargeStatus; + } + public String getIdCard() { return idCard; } @@ -413,6 +431,14 @@ public class OutRechargeOrder implements Serializable { this.identificationCode = identificationCode; } + public String getAbnormalMsg() { + return abnormalMsg; + } + + public void setAbnormalMsg(String abnormalMsg) { + this.abnormalMsg = abnormalMsg; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -443,6 +469,7 @@ public class OutRechargeOrder implements Serializable { && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getRechargeContent() == null ? other.getRechargeContent() == null : this.getRechargeContent().equals(other.getRechargeContent())) && (this.getRechargeName() == null ? other.getRechargeName() == null : this.getRechargeName().equals(other.getRechargeName())) + && (this.getRechargeStatus() == null ? other.getRechargeStatus() == null : this.getRechargeStatus().equals(other.getRechargeStatus())) && (this.getIdCard() == null ? other.getIdCard() == null : this.getIdCard().equals(other.getIdCard())) && (this.getCreateTimed() == null ? other.getCreateTimed() == null : this.getCreateTimed().equals(other.getCreateTimed())) && (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime())) @@ -455,7 +482,8 @@ public class OutRechargeOrder implements Serializable { && (this.getRefundFee() == null ? other.getRefundFee() == null : this.getRefundFee().equals(other.getRefundFee())) && (this.getAgentKey() == null ? other.getAgentKey() == null : this.getAgentKey().equals(other.getAgentKey())) && (this.getObjectId() == null ? other.getObjectId() == null : this.getObjectId().equals(other.getObjectId())) - && (this.getIdentificationCode() == null ? other.getIdentificationCode() == null : this.getIdentificationCode().equals(other.getIdentificationCode())); + && (this.getIdentificationCode() == null ? other.getIdentificationCode() == null : this.getIdentificationCode().equals(other.getIdentificationCode())) + && (this.getAbnormalMsg() == null ? other.getAbnormalMsg() == null : this.getAbnormalMsg().equals(other.getAbnormalMsg())); } @Override @@ -480,6 +508,7 @@ public class OutRechargeOrder implements Serializable { result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getRechargeContent() == null) ? 0 : getRechargeContent().hashCode()); result = prime * result + ((getRechargeName() == null) ? 0 : getRechargeName().hashCode()); + result = prime * result + ((getRechargeStatus() == null) ? 0 : getRechargeStatus().hashCode()); result = prime * result + ((getIdCard() == null) ? 0 : getIdCard().hashCode()); result = prime * result + ((getCreateTimed() == null) ? 0 : getCreateTimed().hashCode()); result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode()); @@ -493,6 +522,7 @@ public class OutRechargeOrder implements Serializable { result = prime * result + ((getAgentKey() == null) ? 0 : getAgentKey().hashCode()); result = prime * result + ((getObjectId() == null) ? 0 : getObjectId().hashCode()); result = prime * result + ((getIdentificationCode() == null) ? 0 : getIdentificationCode().hashCode()); + result = prime * result + ((getAbnormalMsg() == null) ? 0 : getAbnormalMsg().hashCode()); return result; } @@ -520,6 +550,7 @@ public class OutRechargeOrder implements Serializable { sb.append(", status=").append(status); sb.append(", rechargeContent=").append(rechargeContent); sb.append(", rechargeName=").append(rechargeName); + sb.append(", rechargeStatus=").append(rechargeStatus); sb.append(", idCard=").append(idCard); sb.append(", createTimed=").append(createTimed); sb.append(", payTime=").append(payTime); @@ -533,6 +564,7 @@ public class OutRechargeOrder implements Serializable { sb.append(", agentKey=").append(agentKey); sb.append(", objectId=").append(objectId); sb.append(", identificationCode=").append(identificationCode); + sb.append(", abnormalMsg=").append(abnormalMsg); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java b/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java index 4e8f3bc7..d5006002 100644 --- a/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java @@ -1276,6 +1276,66 @@ public class OutRechargeOrderExample { return (Criteria) this; } + public Criteria andRechargeStatusIsNull() { + addCriterion("recharge_status is null"); + return (Criteria) this; + } + + public Criteria andRechargeStatusIsNotNull() { + addCriterion("recharge_status is not null"); + return (Criteria) this; + } + + public Criteria andRechargeStatusEqualTo(Integer value) { + addCriterion("recharge_status =", value, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusNotEqualTo(Integer value) { + addCriterion("recharge_status <>", value, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusGreaterThan(Integer value) { + addCriterion("recharge_status >", value, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("recharge_status >=", value, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusLessThan(Integer value) { + addCriterion("recharge_status <", value, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusLessThanOrEqualTo(Integer value) { + addCriterion("recharge_status <=", value, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusIn(List values) { + addCriterion("recharge_status in", values, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusNotIn(List values) { + addCriterion("recharge_status not in", values, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusBetween(Integer value1, Integer value2) { + addCriterion("recharge_status between", value1, value2, "rechargeStatus"); + return (Criteria) this; + } + + public Criteria andRechargeStatusNotBetween(Integer value1, Integer value2) { + addCriterion("recharge_status not between", value1, value2, "rechargeStatus"); + return (Criteria) this; + } + public Criteria andIdCardIsNull() { addCriterion("id_card is null"); return (Criteria) this; @@ -2105,6 +2165,76 @@ public class OutRechargeOrderExample { addCriterion("Identification_code not between", value1, value2, "identificationCode"); return (Criteria) this; } + + public Criteria andAbnormalMsgIsNull() { + addCriterion("abnormal_msg is null"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIsNotNull() { + addCriterion("abnormal_msg is not null"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgEqualTo(String value) { + addCriterion("abnormal_msg =", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotEqualTo(String value) { + addCriterion("abnormal_msg <>", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgGreaterThan(String value) { + addCriterion("abnormal_msg >", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgGreaterThanOrEqualTo(String value) { + addCriterion("abnormal_msg >=", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLessThan(String value) { + addCriterion("abnormal_msg <", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLessThanOrEqualTo(String value) { + addCriterion("abnormal_msg <=", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgLike(String value) { + addCriterion("abnormal_msg like", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotLike(String value) { + addCriterion("abnormal_msg not like", value, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgIn(List values) { + addCriterion("abnormal_msg in", values, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotIn(List values) { + addCriterion("abnormal_msg not in", values, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgBetween(String value1, String value2) { + addCriterion("abnormal_msg between", value1, value2, "abnormalMsg"); + return (Criteria) this; + } + + public Criteria andAbnormalMsgNotBetween(String value1, String value2) { + addCriterion("abnormal_msg not between", value1, value2, "abnormalMsg"); + return (Criteria) this; + } } /** diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java index b2eb6d10..fae8a22c 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java @@ -8,6 +8,7 @@ import com.hai.model.OutRechargeOrderModel; import com.hai.model.OutUserOrderModel; import io.swagger.models.auth.In; +import java.math.BigDecimal; import java.util.List; import java.util.Map; diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index 5d3b6e66..089328cd 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -7,10 +7,7 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; -import com.hai.common.utils.DateUtil; -import com.hai.common.utils.HttpsUtils; -import com.hai.common.utils.IDGenerator; -import com.hai.common.utils.WxUtils; +import com.hai.common.utils.*; import com.hai.config.CommonSysConfig; import com.hai.config.CommonSysConst; import com.hai.config.HuiLianTongUnionCardConfig; @@ -347,7 +344,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号 order.setPayRealPrice(order.getPayPrice()); // 实付金额 if (order.getRechargeType() != null && order.getRechargeType() == 1) { - outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); + JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); + if (object.getInteger("code") != 200) { + order.setRechargeStatus(1); + order.setAbnormalMsg(object.getString("message")); + } } order.setStatus(2); order.setPayType(2); @@ -370,9 +371,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { highUserService.goldHandle(userId, goldNum, 2, 2, order.getId()); order.setPayRealPrice(order.getPayPrice()); // 实付金额 order.setStatus(2); - if (order.getRechargeType() != null && order.getRechargeType() == 1) { - outRechargeOrderService.getMobile(order.getRechargeContent() , order.getPayPrice().intValue() , order.getOrderNo()); - } order.setPayType(3); order.setPayTime(new Date()); // 支付时间 outRechargeOrderService.updateOrder(order); @@ -406,14 +404,14 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { map.put("sign" , signStr); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getCzUrl() , map); + return HttpsUtils.doPost(CommonSysConst.getSysConfig().getCzUrl() + "createOrder" , map); } + @Override public void rechargeOrderToRefund(Long orderId) throws Exception { OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); - // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中 if (order.getStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); @@ -475,6 +473,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { // 金币退款 if (order.getPayType() == 3) { highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().intValue() * 100, 1, 3, order.getId()); + order.setStatus(5); + order.setRefundTime(new Date()); + order.setOutRefundNo("HFR"+new Date().getTime() ); + order.setRefundFee(order.getPayRealPrice()); + outRechargeOrderService.updateOrder(order); } // 银联退款 diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java index 32881945..08b5136d 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/RechargeOrderServiceImpl.java @@ -50,11 +50,6 @@ public class RechargeOrderServiceImpl implements PayService { @Resource private OutRechargeOrderService outRechargeOrderService; - @Resource OutRechargePriceService outRechargePriceService; - - @Resource - private HighProfitSharingRecordService highProfitSharingRecordService; - @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @@ -75,10 +70,14 @@ public class RechargeOrderServiceImpl implements PayService { order.setPayRealPrice(new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100"))); // 实付金额 order.setPayTime(new Date()); // 支付时间 order.setStatus(2); // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 - outRechargeOrderService.updateOrder(order); - if (order.getRechargeType() == 1) { - outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); + if (order.getRechargeType() != null && order.getRechargeType() == 1) { + JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , order.getOrderNo()); + if (object.getInteger("code") != 200) { + order.setRechargeStatus(1); + order.setAbnormalMsg(object.getString("message")); + } } + outRechargeOrderService.updateOrder(order); // 推送订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setType(OrderPushType.type2.getType()); diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index a8afe202..e19a8812 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -54,5 +54,5 @@ TelMemberId=d13091df65d64aafbf0f35d2093157b7 // Mobile CzNotifyUrl = https://hsgcs.dctpay.com/crest/czOrder/rechargeCallback CzAppKey = eaomqcbpdz7yjfih -CzUrl = https://hfcs.dmjvip.com/index.php/third/mobile/createOrder +CzUrl = https://hfcs.dmjvip.com/index.php/third/mobile/ CzAppSecret = xkf9eoq2cjh6uvzp0mtrga134lnibdw8 diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index cf0e2b8c..3b3d8351 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -46,5 +46,5 @@ TelMemberId=d13091df65d64aafbf0f35d2093157b7 CzNotifyUrl = https://hsg.dctpay.com/crest/czOrder/rechargeCallback CzAppKey = p429mlj3cvn5hb07 -CzUrl = https://jj.dmjvip.com/index.php/third/mobile/createOrder +CzUrl = https://jj.dmjvip.com/index.php/third/mobile/ CzAppSecret = bf57pnqy8mkexr0v169c3g4odazwu2ij diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index f45b17a6..199ba1ae 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -46,5 +46,5 @@ TelMemberId=d13091df65d64aafbf0f35d2093157b7 // Mobile CzNotifyUrl = https://hsg.dctpay.com/crest/czOrder/rechargeCallback CzAppKey = p429mlj3cvn5hb07 -CzUrl = https://jj.dmjvip.com/index.php/third/mobile/createOrder +CzUrl = https://jj.dmjvip.com/index.php/third/mobile/ CzAppSecret = bf57pnqy8mkexr0v169c3g4odazwu2ij