Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

master
袁野 11 months ago
parent 7ca9ae6559
commit 2172996361
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java
  2. 19
      hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  4. 33
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java
  5. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  6. 12
      hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java
  7. 23
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  8. 2
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  9. 21
      hai-order/src/main/resources/dev/logback.xml
  10. 20
      hai-order/src/main/resources/prod/logback.xml
  11. 2
      hai-service/src/main/java/com/hai/config/CmsContentConfig.java
  12. 2
      hai-service/src/main/java/com/hai/config/HuiLianTongConfig.java
  13. 2
      hai-service/src/main/java/com/hai/config/PetroConfig.java
  14. 12
      hai-service/src/main/java/com/hai/config/RechargeConfig.java
  15. 1
      hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java
  16. 5
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
  17. 4
      hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java
  18. 146
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  19. 3
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java
  20. 870
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  21. 2
      hai-service/src/main/resources/dev/commonConfig.properties
  22. 25
      v1/src/main/java/com/v1/controller/WxMsgController.java
  23. 21
      v1/src/main/resources/dev/logback.xml
  24. 20
      v1/src/main/resources/prod/logback.xml

@ -108,7 +108,7 @@ public class BsCompanyController {
// 校验该区域是否存在公司
if (bsCompanyService.selectCompanyByRegion(secCompanyModel.getCompany().getRegionId()) != null) {
log.error("BsCompanyController --> addCompanyAndUser() error!", "该区域分公司已存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该区域分公司已存在");
}
// 校验公司名称

@ -137,24 +137,5 @@ public class BsDistributionUserRelController {
}
}
@RequestMapping(value = "/orderListByAgentId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "B端查询代理商订单")
public ResponseData orderListByAgentId(@RequestParam(name = "agentId", required = false) Long agentId,
@RequestParam(name = "code", required = false) Long code,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String , Object> map = new HashMap<>();
map.put("agentId" , agentId);
map.put("code" , code);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highOrderService.orderListByAgentId(map)));
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -326,7 +326,7 @@ public class HighCouponController {
}
}
if (coupon.getCompanyId() == 57) {
if (coupon.getCompanyId() == 57 || coupon.getCompanyId() == 58) {
coupon.setStatus(2);
highCouponService.updateCoupon(coupon);
coupon.setUpdateTime(new Date());

@ -13,6 +13,7 @@ import com.hai.entity.HighDiscount;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighDiscountService;
import com.hai.service.HighDiscountUserRelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -47,6 +48,9 @@ public class HighDiscountController {
@Resource
private HighDiscountService highDiscountService;
@Resource
private HighDiscountUserRelService discountUserRelService;
@RequestMapping(value="/insertDiscount",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加优惠券")
@ -234,4 +238,33 @@ public class HighDiscountController {
}
}
@RequestMapping(value="/getAgentDiscountList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询代理商优惠券列表")
public ResponseData getAgentDiscountList(@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "discountName", required = false) String discountName,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getHighAgent() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
Map<String, Object> param = new HashMap<>();
param.put("ext1", userInfoModel.getHighAgent().getId());
param.put("discountName", discountName);
param.put("status", status);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(discountUserRelService.getDiscountList(param)));
} catch (Exception e) {
log.error("HighDiscountController -> getUserDiscountList() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -110,11 +110,13 @@ public class GoodsController {
}
}
if (price == 1) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice)).collect(Collectors.toList());
}
if (price == 2) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice).reversed()).collect(Collectors.toList());
if (price != null) {
if (price == 1) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice)).collect(Collectors.toList());
}
if (price == 2) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice).reversed()).collect(Collectors.toList());
}
}
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsModels.size(), pageSize, new PageInfo<>(goodsModels)));

@ -430,29 +430,6 @@ public class HighThirdPartyController {
}
}
@RequestMapping(value = "/thirdCancelOrder", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "取消订单")
public ResponseData thirdCancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) {
try {
HighOrder order = highOrderService.getOrderById(orderId);
if (order.getOrderStatus() == 1) {
highOrderService.thirdCancelOrder(orderId);
} else {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOrderController --> cancelOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getMemberProducts", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询会员产品")

@ -346,7 +346,7 @@ public class OrderPayController {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE8.getNumber())) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1619676214);
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1648729281);
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);

@ -196,4 +196,25 @@
</logger>
<appender name="petroLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/wechatPay.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/petroLog/petroLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<logger name="com.hai.config.PetroConfig" level="INFO">
<appender-ref ref="petroLog" />
</logger>
</configuration>

@ -215,4 +215,24 @@
<appender-ref ref="blxLog" />
</logger>
<appender name="petroLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/wechatPay.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/petroLog/petroLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<logger name="com.hai.config.PetroConfig" level="INFO">
<appender-ref ref="petroLog" />
</logger>
</configuration>

@ -48,7 +48,7 @@ public class CmsContentConfig {
map.put("status", 2);
PageHelper.startPage(1, 3);
return new PageInfo<>(highCouponService.getCouponList(map)).getList();
} else if (CmsContentDataEnum.MSG.getName().equals(title)){
} else if (CmsContentDataEnum.GOODS.getName().equals(title)){
map.put("companyId", companyId);
map.put("displayArea", CmsContentDataEnum.getTypeByName(title));
map.put("notCouponSource", 2);

@ -64,7 +64,7 @@ public class HuiLianTongConfig {
* @return
* @throws Exception
*/
public static JSONObject recharge(String orderNo, Integer distCouCount, String couTypeCode, String phone) throws Exception {
public static JSONObject recharge(String orderNo, Integer distCouCount, String couTypeCode, String phone) throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("orderNo", orderNo);
map.put("distCouCount", distCouCount);

@ -42,7 +42,7 @@ public class PetroConfig {
private BsTripartiteReqLogService reqLogService;
private static Logger log = LoggerFactory.getLogger(HuiLianTongUnionCardConfig.class);
private static Logger log = LoggerFactory.getLogger(PetroConfig.class);
public static void init(Integer type) {

@ -238,6 +238,18 @@ public class RechargeConfig {
}
/**
* @Author Sum1Dream
* @Name jNiuGoodsList
* @Description // 简牛快充查询产品列表
* @Date 14:11 2024/1/5
* @return com.alibaba.fastjson.JSONObject
*/
// public static JSONObject jNiuGoodsList() throws {
//
// }
private static String paramSort(final Map<String, Object> param) {
Set<String> keySet = param.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);

@ -18,6 +18,7 @@ public enum CmsContentDataEnum {
UNION_CARD(5 , "工会卡专区"),
DISCOUNT(6 , "天天好券"),
BLX_COUPON(7 , "停车券专区"),
GOODS(8 , "实物商品"),
MSG(90 , "消息通知"),
;

@ -58,12 +58,9 @@ public class ApiOrderServiceImpl implements ApiOrderService {
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public ApiOrder createOrder(JSONObject object) throws Exception {
ApiOrder apiOrder = new ApiOrder();
// 获取下单内容
JSONObject dataObject = JSONObject.parseObject(object.getString("content"));
@ -308,7 +305,7 @@ public class ApiOrderServiceImpl implements ApiOrderService {
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW , timeout = 30)
public ApiOrder payOrder(JSONObject object) throws Exception{
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));

@ -65,7 +65,7 @@ public class OrderPayServiceImpl implements OrderPayService {
String businessType = "hisen_consume";
if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) {
instCode = "11101526";
instCode = "11101654";
businessType = "sinopec_oil_code";
goodsDesc = "购买加油券";
tranDesc = order.getHighChildOrderList().get(0).getGoodsName();
@ -87,8 +87,6 @@ public class OrderPayServiceImpl implements OrderPayService {
tranDesc = "购买" + order.getHighChildOrderList().get(0).getGoodsName();
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) {
instCode = "11101608";
businessType = "actual_goods";
goodsDesc = "购买实物产品";
tranDesc = "购买" + order.getHighChildOrderList().get(0).getGoodsName();

@ -43,12 +43,6 @@ public interface HighOrderService {
*/
void updateOrderDetail(HighOrder highOrder);
/**
* 订单业务交易处理
* 注意支付完成后可以调用此方法
* @param order
*/
void orderBusinessTransaction(HighOrder order) throws Exception;
/**
* @Author 胡锐
@ -85,15 +79,6 @@ public interface HighOrderService {
*/
List<HighChildOrder> getChildOrderByOrder(Long orderId);
/**
* @Author Sum1Dream
* @name getChildOrderByPresentation.java
* @Description // 根据是否赠品查询子订单
* @Date 16:20 2021/9/7
* @Param [orderId, isGiveAway]
* @return com.hai.entity.HighChildOrder
**/
HighChildOrder getChildOrderByPresentation(Long orderId);
/**
* @Author 胡锐
@ -130,12 +115,6 @@ public interface HighOrderService {
**/
List<HighOrder> getOrderList(Map<String,Object> map);
/**
* @Author 胡锐
* @Description 查询订单列表
* @Date 2021/3/26 23:06
**/
List<HighOrder> getOrderListNotChild(Map<String,Object> map);
/**
* 查询订单列表
@ -184,13 +163,6 @@ public interface HighOrderService {
*/
List<HighOrderModel> getOrderListByIdCode(String identificationCode, Map<String,Object> map) throws Exception;
/**
* @Author 胡锐
* @Description 查询需要关闭的订单列表
* @Date 2021/3/27 15:43
**/
List<HighOrder> getCloseOrder();
/**
* 根据优惠券代理商id 查询已消费的订单
* @param discountCodeId
@ -205,13 +177,6 @@ public interface HighOrderService {
**/
void childOrderComplete(Long childOrderId);
/**
* @Author 胡锐
* @Description 取消订单
* @Date 2021/3/27 15:50
**/
void cancelOrder(Long orderId);
/**
* @Author 袁野
* @Description 根据用户查询订单统计
@ -226,16 +191,6 @@ public interface HighOrderService {
**/
Long whetherCheck(Long memId , Integer status);
/**
* @Author Sum1Dream
* @name orderCheck.java
* @Description // 订单查看
* @Date 14:46 2022/7/19
* @Param [java.lang.Long]
* @return void
*/
void orderCheck(Long orderId);
/**
* @Author 袁野
* @Description 未使用优惠券数量
@ -243,33 +198,11 @@ public interface HighOrderService {
**/
Integer countUnusedDiscountByUserId(Long userId , Integer status);
/**
* 查询处于已经支付和待支付的话费订单
* @return
*/
List<HighOrder> getAlreadyPaidMobileOrder();
/**
* 查询处于已经支付和待支付的KFC订单
* @return
*/
List<HighOrder> getAlreadyPaidKfcOrder();
/**
* 查询处于已经支付和待支付的话费订单
* @return
*/
List<HighOrder> getAlreadyPaidCinemaOrder();
List<HighOrder> getTest();
/**
* 查询团油超过支付时间24小时订单
* @return
*/
List<Map<String,Object>> getFinishGasOrder();
/**
* 查询订单列表
* @param map
@ -397,12 +330,6 @@ public interface HighOrderService {
*/
List<DateCountModel> getDateCountByRecharge();
/**
* 查询用户当天加油订单数据量
* @param userId
* @return
*/
int getGasTheDayOrderNum(Long userId);
/**
* @Author Sum1Dream
@ -489,51 +416,6 @@ public interface HighOrderService {
HighOrder insertThirdProduct(JSONObject object) throws Exception;
/**
* @Author Sum1Dream
* @name hltUnionCardPay.java
* @Description // 汇联通支付
* @Date 17:21 2022/5/25
* @Param [java.lang.Long, com.hai.entity.OutRechargeOrder]
* @return void
*/
void hltUnionCardPayByThirdProduct(HighUserCard userCard, Long orderId) throws Exception;
/**
* @Author Sum1Dream
* @name getThirdOrder.java
* @Description // 查询第三方为支付已支付订单
* @Date 11:26 2022/7/8
* @Param []
* @return java.util.List<com.hai.entity.HighOrder>
*/
List<HighOrder> getThirdOrder();
/**
* @Author Sum1Dream
* @name orderToRefund.java
* @Description // 第三方订单退款
* @Date 4:44 下午 2022/1/24
* @Param [java.lang.Long]
* @return void
*/
void thirdOrderToRefund(Long orderId) throws Exception;
/**
* @Author Sum1Dream
* @Description //取消订单 Administrator
* @Date 18:37 2021/6/12
* @Param [orderId]
* @return void
**/
void thirdCancelOrder(Long orderId);
/**
* 查询自建站列表
* @param goodsId
* @return
*/
List<SelfOilStationModel> getSelfOilStationOrderList(String goodsId);
/**
* @Author Sum1Dream
@ -545,15 +427,6 @@ public interface HighOrderService {
*/
List<HighOrder> integralRebateOrder();
/**
* @Author Sum1Dream
* @name orderSource.java
* @Description // 查询订单来源
* @Date 14:11 2022/8/4
* @Param [java.lang.Integer, java.lang.Long]
* @return com.alibaba.fastjson.JSONObject
*/
JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId , Integer productId);
/**
* @Author Sum1Dream
@ -565,24 +438,7 @@ public interface HighOrderService {
*/
List<HighOrder> promoteOrderList(String identificationCode) throws Exception;
/**
* @Author Sum1Dream
* @name orderListByAgentId.java
* @Description // B端查询代理商订单
* @Date 16:11 2022/8/19
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.entity.HighOrder>
*/
List<HighOrder> orderListByAgentId(Map<String , Object> map) throws Exception;
/**
* @Author Sum1Dream
* @Name phoneBillOrderMigration
* @Description // 话费订单迁移
* @Date 10:19 2023/2/2
* @Param [highOrder]
* @Return void
*/
void phoneBillOrderMigration(HighOrder highOrder);
}

@ -284,6 +284,9 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
}
if (MapUtils.getString(map, "ext1") != null) {
criteria.andExt1EqualTo(MapUtils.getString(map, "ext1"));
}
if (MapUtils.getInteger(map, "discountUseScope") != null) {
criteria.andDiscountUseScopeEqualTo(MapUtils.getInteger(map, "discountUseScope"));

@ -383,300 +383,6 @@ public class HighOrderServiceImpl implements HighOrderService {
highOrderMapper.updateByPrimaryKey(highOrder);
}
@Override
public void orderBusinessTransaction(HighOrder order) throws Exception {
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) {
// 商品类型 商品类型 1:卡卷 2:金币充值
if (highChildOrder.getGoodsType() == 1) {
highChildOrder.setChildOrderStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId());
// 是否预约
if (coupon.getReserveStatus() == true) {
HighOrderPre orderPre = new HighOrderPre();
orderPre.setCompanyId(coupon.getCompanyId());
orderPre.setMerchantId(coupon.getMerchantId());
orderPre.setMerchantStoreId(highChildOrder.getStoreId());
orderPre.setPreOrderNo(System.currentTimeMillis() + "");
orderPre.setOrderId(order.getId());
orderPre.setOrderNo(order.getOrderNo());
orderPre.setChildOrderId(highChildOrder.getId());
orderPre.setPayRealPrice(order.getPayRealPrice());
orderPre.setGoodsType(1);
orderPre.setGoodsName(coupon.getCouponName());
orderPre.setGoodsId(coupon.getId());
orderPre.setPreUserId(order.getMemId());
orderPre.setPreUserName(order.getMemName());
orderPre.setPreUserPhone(order.getMemPhone());
orderPre.setPreUserRemark(order.getRemarks());
orderPre.setStatus(1);
highOrderPreService.insertOrderPre(orderPre);
}
// 贵州中石化
if (coupon.getCouponSource() == 4) {
Map<String, Object> push = new HashMap<>();
push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", highChildOrder.getSaleCount());
push.put("userPhone", order.getMemPhone());
// push.put("thirdUserId", order.getMerchId());
// 推送给高速
JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(highChildOrder.getExt2());
if (returnParam != null && returnParam.getString("respCode").equals("0000")) {
// 解密
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data"));
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class);
for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(1);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
couponCodeOther.setCouNo(dataObject.getString("couNo"));
couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setOrderId(order.getId());
highUserCoupon.setChildOrderId(highChildOrder.getId());
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
}
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
} else if (coupon.getCouponSource() == 5) {
// 给用户发码
JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone());
// 推送记录
JSONObject request = new JSONObject();
request.put("requestCode", coupon.getCouponKey());
request.put("tradeId", order.getOrderNo());
request.put("ticketSum", highChildOrder.getSaleCount());
request.put("phone", order.getMemPhone());
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type10.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent(request.toJSONString());
highGasOrderPush.setReturnContent(response.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
JSONObject couponDetail = response.getJSONObject("ticketDetail");
JSONArray codeList = response.getJSONArray("codeList");
for (Object data : codeList) {
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(2);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode"));
couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data)));
couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd"));
couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd"));
couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setOrderId(order.getId());
highUserCoupon.setChildOrderId(highChildOrder.getId());
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo());
highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate());
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
} else {
HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId());
code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付
code.setReceiveTime(new Date());
highCouponCodeService.updateCouponCode(code);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setOrderId(order.getId());
highUserCoupon.setChildOrderId(highChildOrder.getId());
highUserCoupon.setMerchantId(code.getMerchantId());
highUserCoupon.setCouponId(code.getCouponId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCouponCodeId(code.getId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(code.getExt1());
// 计算使用有效期
Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, coupon.getRecycleDay());
if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) {
highUserCoupon.setUseEndTime(code.getUseEndTime());
} else {
highUserCoupon.setUseEndTime(userEndTime.getTime());
}
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
// 查询卡券是否有活动
Map<String, Object> activity = highActivityInfoService.getNewActivityByCouponId(coupon.getId());
if (activity != null && MapUtils.getLong(activity, "id") != null) {
highActivityUserLotteryNumService.addLotteryNum(MapUtils.getLong(activity, "id"), order.getMemId(), 1);
}
}
if (highChildOrder.getGoodsType() == 2) {
highChildOrder.setChildOrderStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// 金币 1:100
Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue();
String remark = "订单" + order.getOrderNo() + "积分充值积分:" + goldNum;
highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId(), remark , highChildOrder.getChildOrderNo());
}
/* if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("storeId", highChildOrder.getGoodsId());
pushParam.put("price", order.getTotalPrice());
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
pushParam.put("opUserId", order.getMemId());
pushParam.put("opUserName", order.getMemName());
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
// 打印小票
printGasOrder(highChildOrder.getGoodsId(), order, false);
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String, Object> 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("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.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
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"));
}
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) {
// 推送加好油
shellGroupService.gasSyncPayment(order.getOrderNo(),
store.getStoreKey(),
order.getPayTime(),
highChildOrder.getTotalPrice(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasGunNo(),
order.getPayablePrice(),
order.getDeductionPrice()
);
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) {
// 推送金猪加油
JSONObject jzOrderObject = jinZhuJiaYouService.payOrder(order.getOrderNo(), highChildOrder.getGasPriceChannelPay());
if (jzOrderObject == null
|| !jzOrderObject.getString("type").equals("OK")
|| !jzOrderObject.getInteger("status").equals(200)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jzOrderObject.getString("title"));
}
}
}
*/
if (highChildOrder.getGoodsType() == 7) {
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo());
if (actual != null) {
List<HighDiscountPackageDiscountActual> discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId());
for (HighDiscountPackageDiscountActual discount : discountList) {
highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId());
}
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId());
HighDiscountPackageRecord record = new HighDiscountPackageRecord();
record.setDiscountPackageId(discountPackage.getId());
record.setDiscountPackageTitle(discountPackage.getTitle());
record.setUsingAttribution(discountPackage.getUsingAttribution());
record.setCompanyId(discountPackage.getCompanyId());
record.setOrderId(order.getId().intValue());
record.setChildOrderId(highChildOrder.getId().intValue());
record.setRecordNo(System.currentTimeMillis() + "");
record.setSalesType(1);
record.setPrice(order.getPayPrice());
record.setUserId(order.getMemId().intValue());
discountPackageRecordService.insertRecord(record);
actual.setAllocationTime(new Date());
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
}
}
@Override
public Integer getUndoneChildOrder(Long orderId) {
HighOrder order = getOrderById(orderId);
@ -830,50 +536,6 @@ public class HighOrderServiceImpl implements HighOrderService {
return list;
}
@Override
public List<HighOrder> getOrderListNotChild(Map<String, Object> map) {
HighOrderExample example = new HighOrderExample();
HighOrderExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "memId") != null) {
criteria.andMemIdEqualTo(MapUtils.getLong(map, "memId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "status"))) {
String[] statuses = MapUtils.getString(map, "status").split(",");
List<Integer> list = new ArrayList<>();
for (String status : statuses) {
list.add(Integer.parseInt(status));
}
criteria.andOrderStatusIn(list);
}
if (MapUtils.getString(map, "orderNo") != null) {
criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo"));
}
if (MapUtils.getString(map, "phone") != null) {
criteria.andMemPhoneEqualTo(MapUtils.getString(map, "phone"));
}
if (MapUtils.getInteger(map, "productType") != null) {
criteria.andProductTypeEqualTo(MapUtils.getInteger(map, "productType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "createTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "createTimeE"))) {
criteria.andCreateTimeBetween(
DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"),
DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "refundTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "refundTimeE"))) {
criteria.andRefundTimeBetween(
DateUtil.format(MapUtils.getString(map, "refundTimeS"), "yyyy-MM-dd HH:mm:ss"),
DateUtil.format(MapUtils.getString(map, "refundTimeE"), "yyyy-MM-dd HH:mm:ss"));
}
return highOrderMapper.selectByExample(example);
}
@Override
@ -1006,11 +668,6 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapper.getOrderListByIdCode(map);
}
@Override
public List<HighOrder> getCloseOrder() {
return highOrderMapperExt.getCloseOrder();
}
@Override
public HighOrder getConsumeOrderByDiscountCode(Long discountCodeId) {
@ -1052,65 +709,6 @@ public class HighOrderServiceImpl implements HighOrderService {
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void cancelOrder(Long orderId) {
HighOrder order = getOrderById(orderId);
if (order != null) {
if (order.getOrderStatus() != 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
order.setOrderStatus(5); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
order.setCancelTime(new Date());
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) {
// 商品类型 1:卡卷 2:金币充值
if (highChildOrder.getGoodsType() == 1) {
// 查询卡卷详情
HighCouponCode couponCode = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId());
if (couponCode != null) {
couponCode.setChildOrderId(null);
couponCode.setStatus(1); // 状态:1.待销售 2.未使用 3.已使用 99.预支付
highCouponCodeService.updateCouponCode(couponCode);
}
}
if (highChildOrder.getGoodsType() == 7) {
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo());
if (actual != null) {
actual.setChildOrderId(null);
actual.setUserId(null);
actual.setStatus(1);
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
highChildOrder.setChildOrderStatus(5); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(null);
highDiscountUserRelService.updateDiscountUserRel(rel);
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId());
code.setStatus(2);
highDiscountAgentCodeService.updateCode(code);
}
}
if (order.getPayGold() != null) {
// 积分返回
String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold();
highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo());
}
updateOrder(order);
}
}
@Override
public Long countOrderByUserId(Long memId, Integer status) {
@ -1140,37 +738,11 @@ public class HighOrderServiceImpl implements HighOrderService {
return highDiscountUserRelMapper.selectByExample(example).size();
}
@Override
public List<HighOrder> getAlreadyPaidMobileOrder() {
return highOrderMapperExt.selectAlreadyPaidMobileOrder();
}
@Override
public List<HighOrder> getAlreadyPaidKfcOrder() {
return highOrderMapperExt.selectAlreadyPaidKfcOrder();
}
@Override
public List<HighOrder> getAlreadyPaidCinemaOrder() {
return highOrderMapperExt.selectAlreadyPaidCinemaOrder();
}
@Override
public List<HighOrder> getTest() {
return highOrderMapperExt.selectTest();
}
@Override
public List<Map<String, Object>> getFinishGasOrder() {
return highOrderMapper.selectFinishGasOrder();
}
@Override
public HighChildOrder getChildOrderByPresentation(Long orderId) {
HighChildOrderExample example = new HighChildOrderExample();
example.createCriteria().andOrderIdEqualTo(orderId).andGiveawayTypeEqualTo(false);
return highChildOrderMapper.selectByExample(example).get(0);
}
@Override
public List<HighOrderModel> selectDiscountPackageOrderList(Map<String, Object> map) throws Exception {
@ -1267,10 +839,6 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapper.getDateCountByRecharge();
}
@Override
public int getGasTheDayOrderNum(Long userId) {
return 0;
}
@Override
public TyOrderCountModel TyOrderStatistics(Map<String, Object> map) throws Exception {
@ -1888,341 +1456,9 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrder;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void hltUnionCardPayByThirdProduct(HighUserCard userCard, Long orderId) throws Exception {
String goodsDesc = "";
String tranDesc = "";
String instCode = "11101527";
String businessType = "hisen_consume";
// 查询订单信息
HighOrder order = getOrderById(orderId);
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
goodsDesc = "购买肯德基产品";
tranDesc = goodsDesc + order.getPayRealPrice() + "元";
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
goodsDesc = "购买星巴克产品";
tranDesc = goodsDesc + order.getPayRealPrice() + "元";
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 10) {
goodsDesc = "购买会员充值产品";
tranDesc = goodsDesc + order.getPayRealPrice() + "元";
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,请使用其他支付方式");
}
// 工会卡支付
JSONObject consumption = HuiLianTongUnionCardConfig.consumption(order.getOrderNo(), userCard.getCardNo(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc);
System.out.println("工会卡支付响应参数" + consumption.toJSONString());
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("orderNo", order.getOrderNo());
dataMap.put("cardType", "ghk");
dataMap.put("cardNo", userCard.getCardNo());
dataMap.put("checkPassword", "N");
dataMap.put("tranAmount", order.getPayRealPrice());
dataMap.put("tranChannel", "HiSen");
dataMap.put("businessType", businessType);
dataMap.put("instCode", instCode);
dataMap.put("goodsDesc", goodsDesc);
dataMap.put("tranDesc", tranDesc);
HighGasOrderPush payPush = new HighGasOrderPush();
payPush.setType(OrderPushType.type5.getType());
payPush.setOrderNo(order.getOrderNo());
payPush.setCreateTime(new Date());
payPush.setCode(consumption.getString("respCode"));
payPush.setRequestContent(JSON.toJSONString(dataMap));
payPush.setReturnContent(consumption.toJSONString());
highGasOrderPushMapper.insert(payPush);
if (!consumption.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage"));
}
JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data"));
if (!consumptionResult.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message"));
}
order.setPaySerialNo(consumptionResult.getString("orderId")); // 支付流水号
order.setOrderStatus(2);
order.setMemCardNo(userCard.getCardNo());
order.setPayType(4);
order.setPayTime(new Date()); // 支付时间
updateOrder(order);
HighGasOrderPush orderPush = new HighGasOrderPush();
JSONObject returnObject;
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(2);
}
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
orderPush.setType(OrderPushType.type4.getType());
returnObject = QianZhuConfig.payKfcOrder(order.getOrderNo());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
orderPush.setType(OrderPushType.type8.getType());
returnObject = QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 10){
orderPush.setType(OrderPushType.type9.getType());
ApiMemberProduct memberProduct = apiMemberProductService.findById(order.getHighChildOrderList().get(0).getGoodsId());
returnObject = QianZhuConfig.insertV2(memberProduct.getProductId() , order.getOrderNo() , order.getRemarks());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,请使用其他支付方式");
}
orderPush.setOrderNo(order.getOrderNo());
orderPush.setCreateTime(new Date());
orderPush.setRequestContent(JSON.toJSONString(dataMap));
orderPush.setReturnContent(returnObject.toJSONString());
highGasOrderPushMapper.insert(orderPush);
}
@Override
public List<HighOrder> getThirdOrder() {
return highOrderMapper.getThirdOrder();
}
@Override
public void thirdOrderToRefund(Long orderId) throws Exception {
HighOrder order = highOrderService.getOrderById(orderId);
// 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getOrderStatus() != 2) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");
}
// 微信退款
if (order.getPayType() == 2) {
Map<String, String> param = new HashMap<>();
param.put("appid", "wx637bd6f7314daa46");
param.put("mch_id", "1289663601");
param.put("sub_mch_id", "1614670195");
param.put("nonce_str", WxUtils.makeNonStr());
param.put("transaction_id", order.getPaySerialNo());
param.put("out_refund_no", "HFR" + new Date().getTime());
param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("sign_type", "HMAC-SHA256");
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256);
param.put("sign", signStr);
String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param));
OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
if (orderRefundModel.getResult_code().equals("SUCCESS")) {
//order.setRefundTime(new Date());
// order.setRefundNo(orderRefundModel.getOut_refund_no());
// order.setRefundPrice(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100")));
order.setOrderStatus(4);
//order.setRefundTime(new Date());
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(4);
}
updateOrder(order);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:" + orderRefundModel.getErr_code() + ",错误描述" + orderRefundModel.getErr_code_des());
}
}
// 工会卡退款
if (order.getPayType() == 4) {
JSONObject jsonObject = HuiLianTongUnionCardConfig.refund("HFR" + new Date().getTime(), order.getOrderNo());
if (jsonObject == null) {
jsonObject = HuiLianTongUnionCardConfig.refund("HFR" + new Date().getTime(), order.getOrderNo());
}
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) {
// order.setRefundTime(new Date());
// order.setRefundNo("HFR" + new Date().getTime());
// order.setRefundPrice(order.getPayRealPrice());
order.setOrderStatus(4);
// order.setRefundTime(new Date());
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(4);
}
updateOrder(order);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
}
// 商户预充值 帐户退款
if (order.getPayType() == 7) {
Map<String , Object> map = new HashMap<>();
map.put("orderNo" , order.getOrderNo());
map.put("amountType" , 1);
map.put("sourceType" , 2);
/* if ( apiAmountRecordService.getApiAmountRecordByList(map).size() == 1) {
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(order.getMerchId());
// 插入金额记录
// 变更前金额
BigDecimal beforeAmount = apiMerchants.getAmounts();
// 计算金额
apiMerchants.setAmounts(apiMerchants.getAmounts().add(order.getPayPrice()));
// 变更后金额
BigDecimal afterAmount = apiMerchants.getAmounts();
apiMerchantsService.updateApiMerchants(apiMerchants);
ApiAmountRecord apiAmountRecord = new ApiAmountRecord();
apiAmountRecord.setCreateTime(new Date());
apiAmountRecord.setUpdateTime(new Date());
apiAmountRecord.setMchId(order.getMerchId());
apiAmountRecord.setStatus(100);
apiAmountRecord.setAmount(order.getPayPrice());
apiAmountRecord.setAfterAmount(afterAmount);
apiAmountRecord.setBeforeAmount(beforeAmount);
apiAmountRecord.setAmountType(1);
apiAmountRecord.setSourceType(2);
apiAmountRecord.setSourceOrderNo(order.getOrderNo());
apiAmountRecord.setSourceId(order.getId());
apiAmountRecord.setSourceContent(apiMerchants.getMerchantName() + "|订单退款" + order.getPayPrice());
apiAmountRecordService.insertAmountRecord(apiAmountRecord);
Map<String, Object> orderMap = new HashMap<>();
orderMap.put("orderId" , order.getId());
// 查询是否用重复订单
ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(orderMap);
apiOrderRecord.setStatus(100);
apiOrderRecord.setRequestTime(new Date());
apiOrderRecordService.updateOrderRecord(apiOrderRecord);
}*/
}
}
// 银联退款
if (order.getPayType() == 5) {
// 订单退款
JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
}
//order.setRefundTime(new Date());
//order.setRefundNo(refund.getString("oriwtorderid"));
//order.setRefundPrice(order.getPayRealPrice());
order.setOrderStatus(4);
// order.setRefundTime(new Date());
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(4);
}
updateOrder(order);
}
// 退还积分
if (order.getPayGold() != null) {
String remark = "订单" + order.getOrderNo() + "退款,退还积分:" + order.getPayGold();
highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo());
if (order.getPayRealPrice().compareTo(new BigDecimal(0)) == 0) {
order.setOrderStatus(4);
//order.setRefundTime(new Date());
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(4);
}
updateOrder(order);
}
}
if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(null);
highDiscountUserRelService.updateDiscountUserRel(rel);
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId());
code.setStatus(2);
highDiscountAgentCodeService.updateCode(code);
}
}
}
public String doRefundRequest(String mchId, String data) throws Exception {
//小程序退款需要调用双向证书的认证
CloseableHttpClient httpClient = goodsOrderService.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();
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void thirdCancelOrder(Long orderId) {
HighOrder order = getOrderById(orderId);
if (order != null && order.getOrderStatus() == 1) {
order.setOrderStatus(5);
order.setCancelTime(new Date());
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(5);
}
if (order.getMemDiscountId() != null) {
HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId());
if (rel != null) {
rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
rel.setUseTime(null);
highDiscountUserRelService.updateDiscountUserRel(rel);
HighDiscountAgentCode code = highDiscountAgentCodeService.getCodeById(rel.getDiscountAgentCodeId());
code.setStatus(2);
highDiscountAgentCodeService.updateCode(code);
}
}
if (order.getPayGold() != null) {
// 积分返回
String remark = "订单" + order.getOrderNo() + "取消,退还积分:" + order.getPayGold();
highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId() , remark , order.getOrderNo());
}
updateOrder(order);
}
}
@Override
public Long whetherCheck(Long memId, Integer status) {
@ -2234,23 +1470,6 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapper.countByExample(example);
}
@Override
public void orderCheck(Long orderId) {
HighOrder highOrder = highOrderMapper.selectByPrimaryKey(orderId);
highOrder.setWhetherCheck(true);
if (highOrder.getOrderStatus() == 3) {
highOrderMapper.updateByPrimaryKey(highOrder);
}
}
@Override
public List<SelfOilStationModel> getSelfOilStationOrderList(String goodsId) {
return highOrderMapper.getSelfOilStationOrderList(goodsId);
}
@Override
public List<HighOrder> integralRebateOrder() {
HighOrderExample example = new HighOrderExample();
@ -2259,64 +1478,6 @@ public class HighOrderServiceImpl implements HighOrderService {
return highOrderMapper.selectByExample(example);
}
// todo 废弃代码
@Override
public JSONObject orderSource(Integer goodsType, Long goodsId , String orderNo , Long companyId , Integer productId) {
JSONObject object = new JSONObject();
if (goodsType == 1) {
HighCoupon coupon = highCouponService.getCouponById(goodsId);
object.put("type" , 1);
object.put("productId", 1);
object.put("companyId", coupon.getCompanyId());
object.put("remark" , "卡券订单:"+ coupon.getCouponName() + "-" + orderNo + "积分返利:");
object.put("name" , "购买卡券产品:"+ coupon.getCouponName());
}
if (goodsType == 3) {
HighMerchantStore merchantStore = highMerchantStoreService.getMerchantStoreById(goodsId);
object.put("type" , 2);
object.put("productId", 1);
object.put("companyId", merchantStore.getCompanyId());
object.put("remark" , "在线加油订单" + orderNo + "积分返利:");
object.put("name" , "购买在线加油产品");
}
if (goodsType == 4) {
object.put("type" , 4);
object.put("productId", 2);
object.put("companyId", companyId);
object.put("remark" , "肯德基订单" + orderNo + "积分返利:");
object.put("name" , "购买肯德基产品");
}
if (goodsType == 9) {
object.put("type" , 4);
object.put("productId", 1);
object.put("companyId", companyId);
object.put("remark" , "星巴克订单" + orderNo + "积分返利:");
object.put("name" , "购买星巴克产品");
}
if (goodsType == 10) {
object.put("type" , 4);
object.put("productId", 3);
object.put("companyId", companyId);
object.put("remark" , "会员充值订单" + orderNo + "积分返利:");
object.put("name" , "购买会员充值产品");
}
if (goodsType == 20) {
object.put("type" , 3);
object.put("productId", productId);
object.put("companyId", companyId);
object.put("remark" , "话费充值订单" + orderNo + "积分返利:");
object.put("name" , "购买话费充值产品");
}
// object.put("logoImg" , OrderLogoEnum.getNameByImgUrl(goodsType));
return object;
}
@Override
public List<HighOrder> promoteOrderList(String identificationCode) throws Exception {
@ -2335,36 +1496,5 @@ public class HighOrderServiceImpl implements HighOrderService {
return list;
}
@Override
public List<HighOrder> orderListByAgentId(Map<String, Object> map) throws Exception {
return null;
}
@Override
public void phoneBillOrderMigration(HighOrder highOrder) {
highOrderMapper.insert(highOrder);
HighChildOrder highChildOrder = new HighChildOrder();
highChildOrder.setOrderNo(highOrder.getOrderNo());
highChildOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
highChildOrder.setChildOrderStatus(highOrder.getOrderStatus());
highChildOrder.setTotalPrice(highOrder.getTotalPrice());
highChildOrder.setGoodsPrice(highOrder.getTotalPrice());
highChildOrder.setGoodsActualPrice(highOrder.getPayPrice());
highChildOrder.setGoodsName(highOrder.getTitle());
highChildOrder.setGoodsType(6);
highChildOrder.setSaleCount(1);
highChildOrder.setGiveawayType(false);
highChildOrder.setMemId(highOrder.getMemId());
highChildOrder.setTotalDeductionPrice(highOrder.getTotalDeductionPrice());
highChildOrder.setGoodsSpecName("话费充值");
highChildOrder.setCreateTime(highOrder.getCreateTime());
highChildOrder.setOrderId(highOrder.getId());
highChildOrder.setCancelTime(highOrder.getCancelTime());
highChildOrder.setFinishTime(highOrder.getFinishTime());
highChildOrder.setRefundTime(highOrder.getRefundTime());
highChildOrder.setPayTime(highOrder.getPayTime());
highChildOrderMapper.insert(highChildOrder);
}
}

@ -155,3 +155,5 @@ GzPetroUrl = http://43.136.176.177:8080/hd-api/out/
GzPetroAppid = 520000990232626265
GzPetroAppKey = 520000W4S3BRkFhaDsNMM
GzPetroAesKey = A8P2sUnM6PsKPwusiFEDFjMu8Hh8wB79
#

@ -130,9 +130,6 @@ public class WxMsgController {
String linkContent = "";
String content = "";
log.info("二维码参数:" + eventKey);
// 普通消息
if ("text".equals(msgType)) {
// todo 处理文本消息
@ -147,6 +144,7 @@ public class WxMsgController {
else if ("event".equals(msgType)) {
// 用户关注公众号
if ("subscribe".equals(event)) {
System.out.println("用户关注公众号");
if (eventKey != null && eventKey.length() != 0) {
JSONObject object = weChatQrcodeUtils.paramPars(eventKey);
// type = 1 推广扫码
@ -193,6 +191,16 @@ public class WxMsgController {
+ "油客来自五湖四海,在这里祝您一路顺风。\n\n";
}
// 贵州和重庆
if (Objects.equals(object.getString("code"), "3")) {
linkContent =
"加满好油,一路畅游!✨✨\n\n"
+ "<a href='https://mp.weixin.qq.com/s/4kj9XV-K_s88uji3ZrXqgg'>查看中石化操作流程</a>\n\n"
+ "<a href='https://mp.weixin.qq.com/s?__biz=MzU0ODgyNjIzMQ==&mid=2247496512&idx=2&sn=da73b7c417ac29cd39807bb52eedcb7e&chksm=fbbb8e58cccc074e4f03f3dfdef7569a24e75a8db8f19f6f471b7fc9f786bf3e67eb4718ef4d&from=industrynews&version=4.1.9.6038&platform=win#rd'>查看中石油操作流程</a>\n\n"
+ "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n"
+ "油客来自五湖四海,在这里祝您一路顺风。\n\n";
}
}
// 4:支付码牌扫码
@ -323,6 +331,16 @@ public class WxMsgController {
+ "油客来自五湖四海,在这里祝您一路顺风。\n\n";
}
// 贵州和重庆
if (Objects.equals(object.getString("code"), "3")) {
linkContent =
"加满好油,一路畅游!✨✨\n\n"
+ "<a href='https://mp.weixin.qq.com/s/4kj9XV-K_s88uji3ZrXqgg'>查看中石化操作流程</a>\n\n"
+ "<a href='https://mp.weixin.qq.com/s?__biz=MzU0ODgyNjIzMQ==&mid=2247496512&idx=2&sn=da73b7c417ac29cd39807bb52eedcb7e&chksm=fbbb8e58cccc074e4f03f3dfdef7569a24e75a8db8f19f6f471b7fc9f786bf3e67eb4718ef4d&from=industrynews&version=4.1.9.6038&platform=win#rd'>查看中石油操作流程</a>\n\n"
+ "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n"
+ "油客来自五湖四海,在这里祝您一路顺风。\n\n";
}
}
// 4:支付码牌扫码
@ -401,6 +419,7 @@ public class WxMsgController {
}else if ("unsubscribe".equals(event)) {
// todo 取消关注 业务处理
System.out.println("用户取消关注!");
}else if ("CLICK".equals(event)) {
content = linkContent + "服务热线:400-023-6806";
}

@ -178,4 +178,25 @@
<logger name="com.hai.config.WxOrderConfig" level="INFO">
<appender-ref ref="wechatPayLog" />
</logger>
<appender name="petroLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/wechatPay.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/petroLog/petroLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<logger name="com.hai.config.PetroConfig" level="INFO">
<appender-ref ref="petroLog" />
</logger>
</configuration>

@ -175,4 +175,24 @@
<logger name="com.hai.config.WxOrderConfig" level="INFO">
<appender-ref ref="wechatPayLog" />
</logger>
<appender name="petroLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/wechatPay.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/petroLog/petroLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<logger name="com.hai.config.PetroConfig" level="INFO">
<appender-ref ref="petroLog" />
</logger>
</configuration>

Loading…
Cancel
Save