提交代码修改

dev-discount
袁野 2 years ago
parent a9cc50fe56
commit 3aab986705
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/ApiMemberProductController.java
  2. 2
      hai-bweb/src/main/resources/dev/application.yml
  3. 4
      hai-bweb/src/main/resources/dev/config.properties
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/HighGoodsTypeController.java
  5. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  6. 52
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  7. 9
      hai-cweb/src/main/java/com/cweb/controller/pay/ThirdOrderController.java
  8. 20
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  9. 1
      hai-cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java
  10. 48
      hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java
  11. 26
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  12. 1
      hai-service/src/main/java/com/hai/common/pay/entity/OrderType.java
  13. 2
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  14. 2
      hai-service/src/main/java/com/hai/enum_type/OrderPushType.java
  15. 11
      hai-service/src/main/java/com/hai/model/ThirdPartyModel.java
  16. 129
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  17. 1
      hai-service/src/main/java/com/hai/service/impl/HighQzOrderServiceImpl.java
  18. 4
      hai-service/src/main/java/com/hai/service/pay/impl/NotifyServiceImpl.java
  19. 17
      hai-service/src/main/java/com/hai/service/pay/impl/StarbucksOrderServiceImpl.java
  20. 70
      hai-service/src/main/java/com/hai/service/pay/impl/ThirdOrderServiceImpl.java

@ -93,6 +93,7 @@ public class ApiMemberProductController {
apiMemberProduct.getTypeId() == null ||
StringUtils.isBlank(apiMemberProduct.getProductId()) ||
apiMemberProduct.getBrandId() == null ||
apiMemberProduct.getCostPrice() == null ||
apiMemberProduct.getPrice() == null ) {
log.error("ApiMemberProductController -> insertMemberProduct() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
@ -129,6 +130,7 @@ public class ApiMemberProductController {
apiMemberProduct.getTypeId() == null ||
StringUtils.isBlank(apiMemberProduct.getProductId()) ||
apiMemberProduct.getBrandId() == null ||
apiMemberProduct.getCostPrice() == null ||
apiMemberProduct.getPrice() == null ) {
log.error("ApiMemberProductController -> insertMemberProduct() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://139.159.177.244:3306/hsg_yy?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource

@ -1,5 +1,5 @@
#fileUrl=/home/project/hsg/filesystem
fileUrl=/Volumes/work/code/filesystem/
fileUrl=/home/project/hsg/filesystem
#fileUrl=/Volumes/work/code/filesystem/
cmsPath=/home/project/hsg/filesystem/cmsPath
agentQrCode=/home/project/hsg/filesystem/agentQrCode
agentQrCodeWxUrl=https://hsgcs.dctpay.com/wx/?action=ic&id=

@ -50,12 +50,14 @@ public class HighGoodsTypeController {
@ApiOperation(value = "获取商品类型列表")
public ResponseData getListGoodsType(@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
@RequestParam(name = "userService", required = false) String userService,
@RequestParam(name = "title", required = false) String title,
HttpServletRequest request) {
try {
Map<String,String> map = new HashMap<>();
map.put("title", title);
map.put("userService", userService);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highGoodsTypeService.getListGoodsType(map)));

File diff suppressed because one or more lines are too long

@ -64,6 +64,9 @@ public class HighThirdPartyController {
@Autowired
private UserCenter userCenter;
@Resource
private ApiMemberProductService apiMemberProductService;
@RequestMapping(value = "/getAllCity", method = RequestMethod.GET)
@ResponseBody
@ -281,7 +284,6 @@ public class HighThirdPartyController {
if (StringUtils.isBlank(object.getString("customerMobile")) ||
StringUtils.isBlank(object.getString("regionId")) ||
StringUtils.isBlank(object.getString("storeCode")) ||
object.getInteger("productType") == null ||
object.getInteger("platformId") == null
) {
@ -330,7 +332,7 @@ public class HighThirdPartyController {
BeanUtils.copyProperties(order, partyModel);
partyModel.setCode(object.getJSONObject("data").getString("ticket"));
partyModel.setThirdOrderStatus(object.getJSONObject("data").getInteger("status"));
partyModel.setStatusDesc(object.getJSONObject("data").getString("statusDesc"));
if (object.getJSONObject("data").getString("ticket") != null) {
String[] s = object.getJSONObject("data").getString("ticket").split(",");
@ -359,7 +361,7 @@ public class HighThirdPartyController {
if (object.getBoolean("success")) {
BeanUtils.copyProperties(order, partyModel);
partyModel.setCode(object.getJSONObject("data").getString("ticket"));
partyModel.setThirdOrderStatus(object.getJSONObject("data").getInteger("status"));
partyModel.setStatusDesc(object.getJSONObject("data").getString("statusDesc"));
partyModel.setObject(object.getJSONObject("data"));
@ -396,12 +398,12 @@ public class HighThirdPartyController {
partyModel.setList(list);
}
}else {
log.error("getThirdOrderByOrderId error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message"));
}
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 10) {
BeanUtils.copyProperties(order, partyModel);
}
return ResponseMsgUtil.success(partyModel);
@ -434,4 +436,44 @@ public class HighThirdPartyController {
}
}
@RequestMapping(value = "/getMemberProducts", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询会员产品")
public ResponseData getMemberProducts(@RequestParam(name = "name", required = false) String name,
@RequestParam(value = "typeId", required = true) Integer typeId,
@RequestParam(value = "brandId", required = true) Integer brandId,
@RequestParam(value = "regionId", required = true) String regionId) {
try {
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId));
BigDecimal productDiscount = null;
if (region != null) {
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString());
productDiscount = thirdProductConfig.getProductConfigNum(3, bsCompany.getId());
}
if (productDiscount == null) {
log.error("getRechargeProduct error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前地区未配置产品");
}
Map<String, Object> map = new HashMap<>();
map.put("name" , name);
map.put("typeId" , typeId);
map.put("brandId" , brandId);
List<ApiMemberProduct> list = apiMemberProductService.getListApiMemberProduct(map);
for (ApiMemberProduct memberProduct : list) {
memberProduct.setCostPrice(memberProduct.getCostPrice().add(memberProduct.getCostPrice().multiply(productDiscount.divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP));
}
return ResponseMsgUtil.success(list);
} catch (Exception e) {
log.error("HighUserCardController --> oilCardRefund() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -6,6 +6,7 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.WechatPayUtil;
import com.hai.common.pay.entity.OrderType;
import com.hai.common.pay.entity.WeChatPayReqInfo;
import com.hai.common.pay.util.MD5Util;
import com.hai.common.security.AESEncodeUtil;
@ -44,7 +45,7 @@ import java.util.concurrent.ThreadLocalRandom;
@Controller
@RequestMapping(value = "/thirdOrder")
@Api(value = "第三方订单支付接口")
public class thirdOrderController {
public class ThirdOrderController {
private static Logger log = LoggerFactory.getLogger(TuanYouController.class);
@ -102,9 +103,11 @@ public class thirdOrderController {
map.put("orderNo", order.getOrderNo());
map.put("payPrice", order.getPayRealPrice());
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
map.put("orderScene", "KFC_ORDER");
map.put("orderScene", OrderType.KFC_ORDER.getModuleCode());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
map.put("orderScene", "STARBUCKS_ORDER");
map.put("orderScene", OrderType.STARBUCKS_ORDER.getModuleCode());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 10) {
map.put("orderScene", OrderType.THIRD_ORDER.getModuleCode());
}
// 肯德基订单 星巴克订单

@ -115,6 +115,9 @@ public class UnionPayController {
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private ApiMemberProductService apiMemberProductService;
@RequestMapping(value = "/notify", method = RequestMethod.POST)
@ApiOperation(value = "银联支付 -> 异步回调")
public void notify(@RequestBody String params,HttpServletRequest request, HttpServletResponse response) {
@ -347,14 +350,27 @@ public class UnionPayController {
}
}
HighGasOrderPush orderPush = new HighGasOrderPush();
JSONObject returnObject = new JSONObject();
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
QianZhuConfig.payKfcOrder(order.getOrderNo());
returnObject = QianZhuConfig.payKfcOrder(order.getOrderNo());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
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());
}
highOrderService.updateOrder(order);
orderPush.setOrderNo(order.getOrderNo());
orderPush.setCreateTime(new Date());
orderPush.setRequestContent(order.getOrderNo());
orderPush.setReturnContent(returnObject.toJSONString());
highGasOrderPushMapper.insert(orderPush);
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
new Thread(() -> {

@ -114,7 +114,6 @@ public class WechatPayController {
+ "<return_msg><![CDATA[签名验证错误]]></return_msg>" + "</xml> ";
}*/
new Thread(() -> {
// 查询订单信息
HighOrder order = highOrderService.getOrderByOrderNo(map.get("out_trade_no"));

@ -3,6 +3,7 @@ package com.hai.schedule;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.config.QianZhuConfig;
import com.hai.entity.ApiKfcStores;
import com.hai.entity.ApiStarbucksProducts;
import com.hai.service.ApiProductService;
import org.slf4j.Logger;
@ -12,6 +13,8 @@ import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class ApiThirdProductSchedule {
@ -69,4 +72,49 @@ public class ApiThirdProductSchedule {
}
}
@Scheduled(cron = "0 0 1 * * ?") // 获取星巴克产品 每日凌晨1点执行一次
public void getKfcStore() throws Exception {
JSONObject jsonObject = QianZhuConfig.getKfcStore();
JSONArray object = jsonObject.getJSONArray("data");
for (Object data : object) {
JSONObject dataObject = (JSONObject) data;
Map<String, Object> mapStore = new HashMap<>();
mapStore.put("storeCode" , dataObject.getString("storeCode"));
ApiKfcStores apiKfcStores = apiProductService.findKfcStores(mapStore);
if (apiKfcStores == null) {
apiKfcStores = new ApiKfcStores();
}
apiKfcStores.setProvinceCode(dataObject.getString("provinceCode"));
apiKfcStores.setProvinceName(dataObject.getString("provinceName"));
apiKfcStores.setCityCode(dataObject.getString("cityCode"));
apiKfcStores.setCityName(dataObject.getString("cityName"));
apiKfcStores.setCityNameFirstLetter(dataObject.getString("cityNameFirstLetter"));
apiKfcStores.setKfcCityId(dataObject.getInteger("kfcCityId"));
apiKfcStores.setKfcCityCode(dataObject.getString("kfcCityCode"));
apiKfcStores.setStoreName(dataObject.getString("storeName"));
apiKfcStores.setStoreCode(dataObject.getString("storeCode"));
apiKfcStores.setLon(dataObject.getString("lon"));
apiKfcStores.setLat(dataObject.getString("lat"));
apiKfcStores.setAddress(dataObject.getString("address"));
apiKfcStores.setStartTime(dataObject.getString("startTime"));
apiKfcStores.setEndTime(dataObject.getString("endTime"));
apiKfcStores.setStoreStatus(dataObject.getInteger("storeStatus"));
apiKfcStores.setShelfStatus(dataObject.getInteger("shelfStatus"));
if (apiKfcStores.getId() == null) {
apiKfcStores.setCreateTime(new Date());
apiKfcStores.setOperatorId(9999L);
apiKfcStores.setOperatorName("系统生成");
apiKfcStores.setStatus(100);
apiProductService.insertKfcStore(apiKfcStores);
} else {
apiKfcStores.setUpdateTime(new Date());
apiProductService.updateKfcStore(apiKfcStores);
}
}
}
}

@ -254,6 +254,32 @@ public class HighOrderSchedule {
}
}
}
} else if (highOrder.getHighChildOrderList().get(0).getGoodsType() == 10) {
// 会员充值订单
// 根据订单号查询订单详情
JSONObject orderObject = QianZhuConfig.QueryV2(highOrder.getOrderNo());
if (orderObject != null && orderObject.getLong("Code") == 999) {
// 订单失败 // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败
if (orderObject.getJSONObject("Data").getInteger("OrderState") == 3) {
// 订单失败
if (order.getOrderStatus() == 2) {
highOrderService.thirdOrderToRefund(order.getId());
} else {
highOrderService.thirdCancelOrder(order.getId());
}
}
// 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败
if (orderObject.getJSONObject("Data").getInteger("OrderState") == 2) {
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
}
order.setOrderStatus(3);
order.setFinishTime(new Date());
highOrderService.updateOrder(order);
}
}
}
}
} catch (Exception e) {

@ -8,6 +8,7 @@ public enum OrderType {
STARBUCKS_ORDER("STARBUCKS", "starbucksOrderService", "星巴克订单"),
CINEMA_ORDER("CINEMA", "cinemaOrderService", "电影票订单"),
MOBILE_ORDER("MOBILE", "mobileOrderService", "话费充值订单"),
THIRD_ORDER("THIRD", "thirdOrderService", "会员充值充值订单"),
TEST("TEST", "testPayService", "支付测试"),
;

@ -43,7 +43,7 @@ public interface HighOrderMapperExt {
List<HighOrder> getCloseOrder();
@Select({"select distinct * from high_order a left join high_child_order b on a.id = b.order_id where order_status in (1,2) and goods_type in (4,9) group by a.id;"})
@Select({"select distinct * from high_order a left join high_child_order b on a.id = b.order_id where order_status in (1,2) and goods_type in (4,9,10) group by a.id;"})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),

@ -14,6 +14,8 @@ public enum OrderPushType {
type5(5 , "汇联通会员卡"),
type6(6 , "汇联通卡券"),
type7(7 , "汇联通会员充值订单"),
type8(8 , "星巴克订单"),
type9(9 , "会员充值订单"),
;
private Integer type;

@ -14,6 +14,9 @@ public class ThirdPartyModel extends HighOrder {
// 第三方订单状态
private Integer thirdOrderStatus;
// 第三方订单状态
private String statusDesc;
// 就餐方式
private Integer eatType;
@ -74,4 +77,12 @@ public class ThirdPartyModel extends HighOrder {
public void setObject(JSONObject object) {
this.object = object;
}
public String getStatusDesc() {
return statusDesc;
}
public void setStatusDesc(String statusDesc) {
this.statusDesc = statusDesc;
}
}

@ -163,6 +163,9 @@ public class HighOrderServiceImpl implements HighOrderService {
private ApiOrderRecordService apiOrderRecordService;
@Resource
private ApiMemberProductService apiMemberProductService;
@Override
@Transactional(
isolation = Isolation.SERIALIZABLE,
@ -1452,6 +1455,12 @@ public class HighOrderServiceImpl implements HighOrderService {
highDiscountAgentCodeService.updateCode(code);
}
}
if (order.getPayGold() != null) {
// 积分返回
highUserService.goldHandle(order.getMemId(), order.getPayGold(), 1, 3, order.getId());
}
updateOrder(order);
}
}
@ -1806,6 +1815,7 @@ public class HighOrderServiceImpl implements HighOrderService {
HighUser user = highUserService.findByUserId(object.getLong("userId"));
JSONObject jsonObject = null;
JSONObject requestContent = null;
// 积分抵扣金额
BigDecimal integralPrice = new BigDecimal(0);
@ -1820,7 +1830,9 @@ public class HighOrderServiceImpl implements HighOrderService {
JSONObject productDetail = thirdProductConfig.getThirdPartyByDetail(object.getInteger("platformId"), object.getInteger("productType"), object.getLong("companyId"));
// 1 星巴克 2 肯德基
highOrder.setProductType(object.getInteger("productType"));
// 1 星巴克 2 肯德基 3 会员充值
if (object.getInteger("productType") == 1) {
JSONObject userToken = QianZhuConfig.getTokenV2(user.getId().toString(), user.getName(), user.getPhone());
@ -1864,9 +1876,9 @@ public class HighOrderServiceImpl implements HighOrderService {
List.add(JSON.toJSONString(contentMap));
}
// 下单
jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile"));
// jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), object.getString("storeCode"), List.toString().replace(" ", ""), object.getString("customerMobile"));
jsonObject = QianZhuConfig.starbucksOrders(user.getId().toString(), "50562", List.toString().replace(" ", ""), object.getString("customerMobile"));
// 判断下单是否成功
if (!Objects.equals(jsonObject.getString("code"), "200")) {
@ -1880,7 +1892,7 @@ public class HighOrderServiceImpl implements HighOrderService {
// 根据订单号查询订单详情
JSONObject orderObject = QianZhuConfig.starbucksOrderByOrderNo(jsonObject.getJSONObject("data").getString("orderNo"));
// 判断下单是否成功
// 判断是否成功
if (!orderObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message"));
}
@ -1894,7 +1906,6 @@ public class HighOrderServiceImpl implements HighOrderService {
highOrder.setMemName(user.getName());
highOrder.setMemPhone(user.getPhone());
highOrder.setOrderStatus(1);
highOrder.setRemarks(object.getString("userRemark"));
highOrderMapper.insert(highOrder);
// 获取星巴克订单内容
@ -1906,6 +1917,8 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setOrderId(highOrder.getId());
childOrder.setChildOrdeStatus(1);
childOrder.setGoodsType(9);
childOrder.setStoreId(object.getLong("storeCode"));
childOrder.setGoodsId(object.getLong("productId"));
childOrder.setStoreAddress(childObject.getString("storeAddress"));
childOrder.setStoreName(childObject.getString("storeName"));
childOrder.setGoodsName(childObject.getString("productName"));
@ -1961,7 +1974,6 @@ public class HighOrderServiceImpl implements HighOrderService {
highOrder.setMemName(user.getName());
highOrder.setMemPhone(user.getPhone());
highOrder.setOrderStatus(1);
highOrder.setRemarks(object.getString("userRemark"));
highOrderMapper.insert(highOrder);
@ -1973,6 +1985,7 @@ public class HighOrderServiceImpl implements HighOrderService {
childOrder.setOrderId(highOrder.getId());
childOrder.setChildOrdeStatus(1);
childOrder.setGoodsType(4);
childOrder.setGoodsId(object.getLong("productId"));
childOrder.setStoreAddress(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeAddress"));
childOrder.setStoreName(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeName"));
childOrder.setGoodsName(childObject.getString("productName"));
@ -1993,6 +2006,45 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrderMapper.insert(childOrder);
}
} else if (object.getInteger("productType") == 3) {
ApiMemberProduct memberProduct = apiMemberProductService.findById(object.getLong("goodsId"));
if (memberProduct == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前产品不可购买");
}
object.put("productId", memberProduct.getProductId());
// 插入订单内容
highOrder.setOrderNo("HF" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5));
highOrder.setRegionId(object.getString("regionId"));
highOrder.setCompanyId(object.getLong("companyId"));
highOrder.setCreateTime(new Date());
highOrder.setMemId(user.getId());
highOrder.setMemName(user.getName());
highOrder.setMemPhone(user.getPhone());
highOrder.setOrderStatus(1);
// 计算实际支付金额
orderPayPrice = memberProduct.getCostPrice().add(memberProduct.getCostPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP);
// 计算市场价金额
marketPrice = memberProduct.getPrice();
highOrderMapper.insert(highOrder);
HighChildOrder childOrder = new HighChildOrder();
childOrder.setOrderId(highOrder.getId());
childOrder.setChildOrdeStatus(1);
childOrder.setGoodsType(10);
childOrder.setStoreId(object.getLong("storeCode"));
childOrder.setGoodsId(memberProduct.getId());
childOrder.setGoodsName(memberProduct.getName());
childOrder.setSaleCount(1);
childOrder.setGoodsPrice(marketPrice);
childOrder.setGoodsActualPrice(orderPayPrice);
childOrder.setTotalPrice(orderPayPrice);
highChildOrderMapper.insert(childOrder);
}
// 定义优惠券
@ -2080,7 +2132,7 @@ public class HighOrderServiceImpl implements HighOrderService {
highOrder.setDeductionPrice(discountPrice);
highOrder.setPayGold(object.getInteger("integralNum"));
// 使用优惠券 或者积分
// 使用优惠券
if (highOrder.getMemDiscountId() != null) {
highOrder.setTotalPrice(marketPrice);
highOrder.setPayPrice(marketPrice.subtract(discountPrice));
@ -2123,28 +2175,29 @@ public class HighOrderServiceImpl implements HighOrderService {
for (HighChildOrder childOrder : highOrderList.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(2);
}
// 推送订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
// 1 星巴克 2 肯德基 3:第三方会员充值
if (object.getInteger("productType") == 1) {
QianZhuConfig.starbucksOrdersPay(highOrder.getOrderNo());
highGasOrderPush.setType(OrderPushType.type8.getType());
requestContent = QianZhuConfig.starbucksOrdersPay(highOrder.getOrderNo());
} else if (object.getInteger("productType") == 2){
QianZhuConfig.payKfcOrder(highOrder.getOrderNo());
}
highGasOrderPush.setType(OrderPushType.type4.getType());
requestContent = QianZhuConfig.payKfcOrder(highOrder.getOrderNo());
} else if (object.getInteger("productType") == 3){
highGasOrderPush.setType(OrderPushType.type9.getType());
requestContent = QianZhuConfig.insertV2(object.getString("productId") , highOrder.getOrderNo() , object.getString("customerMobile"));
}
// 创建提交记录
BsRequestRecord requestRecord = new BsRequestRecord();
requestRecord.setCreateTime(new Date());
requestRecord.setUpdateTime(new Date());
requestRecord.setOrderNo(highOrder.getOrderNo());
requestRecord.setRequestContent(object.toJSONString());
requestRecord.setOperatorId(0L);
requestRecord.setOperatorName("系统生成");
requestRecord.setSourceId(highOrder.getId().toString());
requestRecord.setSourceType(1);
bsRequestRecordService.insertRequestRecord(requestRecord);
highGasOrderPush.setOrderNo(highOrder.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent(highOrder.getOrderNo());
highGasOrderPush.setReturnContent(requestContent.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
}
return highOrder;
}
@ -2168,6 +2221,9 @@ public class HighOrderServiceImpl implements HighOrderService {
} 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, "暂时无法支付,请使用其他支付方式");
}
@ -2209,16 +2265,33 @@ public class HighOrderServiceImpl implements HighOrderService {
order.setPayType(4);
order.setPayTime(new Date()); // 支付时间
updateOrder(order);
HighGasOrderPush orderPush = new HighGasOrderPush();
JSONObject returnObject = new JSONObject();
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(2);
}
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
QianZhuConfig.payKfcOrder(order.getOrderNo());
orderPush.setType(OrderPushType.type4.getType());
returnObject = QianZhuConfig.payKfcOrder(order.getOrderNo());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
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
@ -2285,7 +2358,7 @@ public class HighOrderServiceImpl implements HighOrderService {
}
// 工会卡退款
if (order.getPayType() == 3) {
if (order.getPayType() == 4) {
JSONObject jsonObject = HuiLianTongUnionCardConfig.refund("HFR" + new Date().getTime(), order.getOrderNo());
if (jsonObject == null) {
@ -2310,7 +2383,7 @@ public class HighOrderServiceImpl implements HighOrderService {
}
// 商户预充值 帐户退款
if (order.getPayType() == 6) {
if (order.getPayType() == 7) {
Map<String , Object> map = new HashMap<>();
map.put("orderNo" , order.getOrderNo());
@ -2363,7 +2436,7 @@ public class HighOrderServiceImpl implements HighOrderService {
}
// 银联退款
if (order.getPayType() == 4) {
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")) {

@ -66,7 +66,6 @@ public class HighQzOrderServiceImpl implements HighQzOrderService {
highOrder.setDeductionPrice(new BigDecimal("0"));
highOrder.setOrderStatus(1);
highOrder.setCreateTime(data.getDate("createTime"));
highOrder.setRemarks(data.getString("userRemark"));
HighChildOrder highChildOrder;
if (orderType.equals("KFC")) {

@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.sound.midi.Soundbank;
import java.util.Map;
@Service(value = "notifyService")
@ -37,6 +38,9 @@ public class NotifyServiceImpl implements NotifyService {
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public String alipayNotify(Map<String, String> params) throws Exception {
System.out.println("-----------------------------------------------------------" + params);
String result = "failure";
String trade_status = params.get("trade_status");
if ("TRADE_SUCCESS".equals(trade_status)) {

@ -2,12 +2,17 @@ package com.hai.service.pay.impl;
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.config.QianZhuConfig;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.ApiMemberProduct;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighOrder;
import com.hai.enum_type.OrderPushType;
import com.hai.service.ApiMemberProductService;
import com.hai.service.HighOrderService;
import com.hai.service.pay.PayService;
import org.springframework.stereotype.Service;
@ -16,6 +21,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
@Service("starbucksOrderService")
public class StarbucksOrderServiceImpl implements PayService {
@ -24,6 +30,9 @@ public class StarbucksOrderServiceImpl implements PayService {
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Override
public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) {
@ -44,16 +53,16 @@ public class StarbucksOrderServiceImpl implements PayService {
}
highOrderService.updateOrder(order);
// 支付给千猪
JSONObject object = QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
// 订单支付
JSONObject requestContent = QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
// 推送订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type3.getType());
highGasOrderPush.setType(OrderPushType.type8.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent(order.getOrderNo());
highGasOrderPush.setReturnContent(object.toJSONString());
highGasOrderPush.setReturnContent(requestContent.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
}
}

@ -0,0 +1,70 @@
package com.hai.service.pay.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.config.QianZhuConfig;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.ApiMemberProduct;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighOrder;
import com.hai.enum_type.OrderPushType;
import com.hai.service.ApiMemberProductService;
import com.hai.service.HighOrderService;
import com.hai.service.pay.PayService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
@Service("thirdOrderService")
public class ThirdOrderServiceImpl implements PayService {
@Resource
private HighOrderService highOrderService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private ApiMemberProductService apiMemberProductService;
@Override
public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) {
return;
}
if (payType.equals("WechatPay")) {
HighOrder order = highOrderService.getOrderByOrderNo(map.get("out_trade_no"));
if (order != null && order.getOrderStatus() == 1) {
order.setPaySerialNo(map.get("transaction_id")); // 支付流水号
order.setPayRealPrice(new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100"))); // 实付金额
order.setPayTime(new Date()); // 支付时间
order.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合
order.setPayType(2); // 支付方式: 1:支付宝 2:微信 3:金币
order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
highOrderService.updateOrder(order);
// 下单
ApiMemberProduct memberProduct = apiMemberProductService.findById(order.getHighChildOrderList().get(0).getGoodsId());
JSONObject object = QianZhuConfig.insertV2(memberProduct.getProductId() , order.getOrderNo() , order.getRemarks());
// 推送订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type8.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent(order.getOrderNo());
highGasOrderPush.setReturnContent(object.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
}
}
}
}
Loading…
Cancel
Save