diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java b/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java index e2be97af..f7a665e8 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighBrandController.java @@ -1,8 +1,33 @@ package com.bweb.controller; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighBrand; +import com.hai.entity.HighGoodsType; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.HighBrandService; +import com.hai.service.HighGoodsTypeService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; /** * @Auther: 袁野 @@ -13,4 +38,170 @@ import org.springframework.web.bind.annotation.RequestMapping; @RequestMapping(value = "/highBrand") @Api(value = "品牌接口") public class HighBrandController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighGoodsTypeService highGoodsTypeService; + + @Resource + private HighBrandService highBrandService; + + @RequestMapping(value = "/getBrandByList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取品牌列表") + public ResponseData getBrandByList(@RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + @RequestParam(name = "title", required = false) String title, + @RequestParam(name = "goodTypeId", required = false) String goodTypeId, + HttpServletRequest request) { + try { + + Map map = new HashMap<>(); + map.put("title", title); + map.put("goodTypeId", goodTypeId); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highBrandService.getListBand(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/findById", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询详情") + public ResponseData findById(@RequestParam(name = "id", required = true) Integer id) { + try { + + return ResponseMsgUtil.success(highBrandService.findById(id)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getByDelete", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "根据id删除") + public ResponseData getByDelete( + @RequestBody HighBrand highBrand, + HttpServletRequest request + ) { + try { + + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + HighBrand highBrands = highBrandService.findById(highBrand.getId()); + + if (highBrands == null) { + log.error("HighGoodsTypeController --> getGoodsTypeByDelete() error!", "当前品牌不存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.DELETE_DATA_ERROR, ""); + } + + highBrands.setStatus(0); + highBrands.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrands.setUpdatedTime(new Date()); + + highBrandService.updateBrand(highBrands); + + return ResponseMsgUtil.success("删除成功"); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "/insertBrand", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "新增品牌") + public ResponseData insertBrand(@RequestBody HighBrand highBrand, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + + if (StringUtils.isBlank(highBrand.getTitle()) + || StringUtils.isBlank(highBrand.getImg()) + || highBrand.getGoodTypeId() == null + ) { + log.error("HighAgentController -> insertAgent() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 校验账号用户名是否存在 + if (highBrandService.findByTitle(highBrand.getTitle() , highBrand.getGoodTypeId())) { + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); + } + + highBrand.setCreatedTime(new Date()); + highBrand.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrand.setUpdatedTime(new Date()); + highBrand.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrand.setStatus(1); + + highBrandService.insertBrand(highBrand); + + return ResponseMsgUtil.success("新增成功"); + + } catch (Exception e) { + log.error("HighAgentController --> insertAgent() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/updateBrand", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "修改品牌") + public ResponseData updateBrand(@RequestBody HighBrand highBrand, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + + if (StringUtils.isBlank(highBrand.getTitle()) + || StringUtils.isBlank(highBrand.getImg()) + || highBrand.getId() == null + || highBrand.getGoodTypeId() == null + ) { + log.error("HighAgentController -> insertAgent() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + HighBrand highBrands = highBrandService.findById(highBrand.getId()); + + // 校验账号用户名是否存在 + if (highBrandService.findByTitle(highBrand.getTitle() , highBrand.getGoodTypeId()) && !highBrand.getId().equals(highBrands.getId())) { + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); + } + + highBrands.setUpdatedTime(new Date()); + highBrands.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highBrands.setImg(highBrand.getImg()); + highBrands.setTitle(highBrand.getTitle()); + highBrands.setGoodTypeId(highBrand.getGoodTypeId()); + + highBrandService.updateBrand(highBrands); + + return ResponseMsgUtil.success("修改成功"); + + } catch (Exception e) { + log.error("HighAgentController --> insertAgent() error!", e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index 9b398a48..a244b2b1 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -378,14 +378,16 @@ public class HighCouponController { @ResponseBody @ApiOperation(value = "卡卷列表") public ResponseData getCouponList( - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "couponName", required = false) String couponName, - @RequestParam(name = "couponType", required = false) Integer couponType, - @RequestParam(name = "displayArea", required = false) Integer displayArea, - @RequestParam(name = "couponSource", required = false) Integer couponSource, - @RequestParam(name = "status", required = false) Integer status, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "couponName", required = false) String couponName, + @RequestParam(name = "couponType", required = false) Integer couponType, + @RequestParam(name = "displayArea", required = false) Integer displayArea, + @RequestParam(name = "couponSource", required = false) Integer couponSource, + @RequestParam(name = "brandId", required = false) Integer brandId, + @RequestParam(name = "goodsTypeId", required = false) Integer goodsTypeId, + @RequestParam(name = "status", required = false) Integer status, + @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(); @@ -399,6 +401,8 @@ public class HighCouponController { map.put("merchantId", merchantId); map.put("couponName", couponName); map.put("couponType", couponType); + map.put("brandId", brandId); + map.put("goodsTypeId", goodsTypeId); map.put("displayArea", displayArea); map.put("couponSource", couponSource); map.put("status", status); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java index 0232d24a..60f44f58 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java @@ -81,6 +81,41 @@ public class HighGoodsTypeController { } } + @RequestMapping(value = "/getGoodsTypeByDelete", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "根据id删除") + public ResponseData getGoodsTypeByDelete( + @RequestBody HighGoodsType highGoodsType, + HttpServletRequest request + ) { + try { + + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + HighGoodsType highGoodsTypes = highGoodsTypeService.findById(highGoodsType.getId()); + + if (highGoodsTypes == null) { + log.error("HighGoodsTypeController --> getGoodsTypeByDelete() error!", "当前商品类别不存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.DELETE_DATA_ERROR, ""); + } + + highGoodsTypes.setStatus(0); + highGoodsTypes.setUpdatedUserId(userInfoModel.getSecUser().getId().intValue()); + highGoodsTypes.setUpdatedTime(new Date()); + + highGoodsTypeService.updateGoodsType(highGoodsType); + + return ResponseMsgUtil.success("删除成功"); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/insertGoodsType", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "新增商品类型") @@ -100,8 +135,8 @@ public class HighGoodsTypeController { // 校验账号用户名是否存在 if (highGoodsTypeService.findByTitle(highGoodsType.getTitle())) { - log.error("HighGoodsTypeController --> insertGoodsType() error!", "用户名已存在"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_LOGIN_NAME_IS_EXIST_ERROR, ""); + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); } highGoodsType.setCreatedTime(new Date()); @@ -132,7 +167,7 @@ public class HighGoodsTypeController { if (StringUtils.isBlank(highGoodsType.getTitle()) || StringUtils.isBlank(highGoodsType.getImg()) - || highGoodsType.getId() != null + || highGoodsType.getId() == null ) { log.error("HighAgentController -> insertAgent() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -142,8 +177,8 @@ public class HighGoodsTypeController { // 校验账号用户名是否存在 if (highGoodsTypeService.findByTitle(highGoodsType.getTitle()) && !highGoodsTypes.getId().equals(highGoodsType.getId())) { - log.error("HighGoodsTypeController --> insertGoodsType() error!", "用户名已存在"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_LOGIN_NAME_IS_EXIST_ERROR, ""); + log.error("HighGoodsTypeController --> insertGoodsType() error!", "已存在"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ADD_REPEATEDLY, ""); } highGoodsTypes.setUpdatedTime(new Date()); @@ -151,7 +186,7 @@ public class HighGoodsTypeController { highGoodsTypes.setImg(highGoodsType.getImg()); highGoodsTypes.setTitle(highGoodsType.getTitle()); - highGoodsTypeService.updateGoodsType(highGoodsType); + highGoodsTypeService.updateGoodsType(highGoodsTypes); return ResponseMsgUtil.success("修改成功"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index b6305c4f..370d8555 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -130,7 +130,7 @@ public class HighOrderController { Map map = new HashMap<>(); if (userInfoModel.getSecRole().getRoleType() == 5) { - map.put("companyId" , userInfoModel.getBsCompany().getId()); + map.put("companyId" , userInfoModel.getBsCompany().getId()); } if (userInfoModel.getSecRole().getRoleType() == 2) { map.put("merchantId" , userInfoModel.getMerchant().getId()); @@ -241,7 +241,12 @@ public class HighOrderController { map.put("merchantId", merchantId); } else if (userInfoModel.getSecUser().getObjectType() == 1) { - map.put("companyId", userInfoModel.getBsCompany().getId()); + if (userInfoModel.getBsCompany().getId() == 3) { + map.put("companyId", 23); + } else { + map.put("companyId", userInfoModel.getBsCompany().getId()); + } + map.put("merchantId", merchantId); } else if (userInfoModel.getSecUser().getObjectType() == 2) { @@ -275,19 +280,19 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "查询加油订单列表") public ResponseData getGasOrderList(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); @@ -383,19 +388,19 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "查询电影订单列表") public ResponseData getCinemaOrderList(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); @@ -437,21 +442,21 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "根据表示查询订单") public ResponseData getOrderListByIdCode(@RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "identificationCode", required = true) String identificationCode, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "memPhone", required = false) String memPhone, - @RequestParam(name = "memDiscountName", required = false) String memDiscountName, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + @RequestParam(name = "identificationCode", required = true) String identificationCode, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "memDiscountName", required = false) String memDiscountName, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); @@ -484,20 +489,20 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "导出商品订单列表") public ResponseData exportOrderListByIdCode(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "merchantId", required = false) Long merchantId, - @RequestParam(name = "identificationCode", required = true) String identificationCode, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "memPhone", required = false) String memPhone, - @RequestParam(name = "memDiscountName", required = false) String memDiscountName, - @RequestParam(name = "paySerialNo", required = false) String paySerialNo, - @RequestParam(name = "payModel", required = false) Integer payModel, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE, - HttpServletRequest request) { + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "identificationCode", required = true) String identificationCode, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "memDiscountName", required = false) String memDiscountName, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + HttpServletRequest request) { try { SessionObject sessionObject = userCenter.getSessionObject(request); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); @@ -585,7 +590,7 @@ public class HighOrderController { @ResponseBody @ApiOperation(value = "汇联通订单退款") public ResponseData orderToRefundHlt(@RequestParam(name = "orderId", required = false) Long orderId, - HttpServletRequest request) { + HttpServletRequest request) { try { HighOrder order = highOrderService.getOrderById(orderId); @@ -601,21 +606,21 @@ public class HighOrderController { } - JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); - JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); - - if (dataObject.getBoolean("success")) { - order.setOrderStatus(4); - order.setRefundTime(new Date()); - order.setRefundContent(dataObject.getString("orderId")); - order.setRefusalRefundContent("HFR"+new Date().getTime() ); - order.setRefundPrice(order.getPayRealPrice()); - highOrderService.updateOrder(order); - return ResponseMsgUtil.success("退款成功"); - } else { - log.error("orderToPay error!", dataObject.getString("message")); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); - } + JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); + JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); + + if (dataObject.getBoolean("success")) { + order.setOrderStatus(4); + order.setRefundTime(new Date()); + order.setRefundContent(dataObject.getString("orderId")); + order.setRefusalRefundContent("HFR"+new Date().getTime() ); + order.setRefundPrice(order.getPayRealPrice()); + highOrderService.updateOrder(order); + return ResponseMsgUtil.success("退款成功"); + } else { + log.error("orderToPay error!", dataObject.getString("message")); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); + } } catch (Exception e) { log.error("HighOrderController --> getUserOrderList() error!", e); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java new file mode 100644 index 00000000..15f54463 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java @@ -0,0 +1,329 @@ +package com.bweb.controller; + +import com.alibaba.excel.EasyExcel; +import com.bweb.config.SysConst; +import com.bweb.model.ExportHighOrderModel; +import com.bweb.model.ExportHighPreOrderModel; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.WxOrderConfig; +import com.hai.entity.HighChildOrder; +import com.hai.entity.HighGoodsType; +import com.hai.entity.HighOrder; +import com.hai.entity.HighOrderPre; +import com.hai.model.*; +import com.hai.service.HighOrderPreService; +import com.hai.service.HighOrderService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author Sum1Dream + * @ClassName HighOrderPreController + * @Description // 预约订单 + * @Date 2021/11/19 10:56 上午 + **/ +@Controller +@RequestMapping(value = "/highOrderPre") +@Api(value = "预约订单接口") +public class HighOrderPreController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighOrderPreService highOrderPreService; + + @Resource + private HighOrderService highOrderService; + + + @RequestMapping(value = "/getListPreOrder", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取预约订单列表") + public ResponseData getListGoodsType(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "preOrderNo", required = false) String preOrderNo, + @RequestParam(name = "merchantStoreId", required = false) Long merchantStoreId, + @RequestParam(name = "userPhone", required = false) String userPhone, + @RequestParam(name = "preUserName", required = false) String preUserName, + @RequestParam(name = "goodsName", required = false) String goodsName, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @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(); + + Map map = new HashMap<>(); + + // 用户来源 0:超级管理员 1:公司 2:商户 3:门店 4. 代理商 + if(userInfoModel.getSecUser().getObjectType() == 0) { + map.put("companyId", companyId); + + } else if (userInfoModel.getSecUser().getObjectType() == 1) { + if (userInfoModel.getBsCompany().getId() == 3) { + map.put("companyId", 23); + } else if (userInfoModel.getBsCompany().getId() == 2) { + map.put("companyId", null); + }else { + map.put("companyId", userInfoModel.getBsCompany().getId()); + } + + } else if (userInfoModel.getSecUser().getObjectType() == 2) { + merchantId = userInfoModel.getMerchant().getId(); + } else if (userInfoModel.getSecUser().getObjectType() == 3) { + merchantStoreId = userInfoModel.getMerchantStore().getId(); + } + + map.put("merchantId", merchantId); + map.put("merchantStoreId" , merchantStoreId); + map.put("orderNo" , orderNo); + map.put("preOrderNo" , preOrderNo); + map.put("userPhone" , userPhone); + map.put("preUserName" , preUserName); + map.put("goodsName" , goodsName); + map.put("status" , status); + if (createTimeS != null) { + map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS)); + } + if (createTimeE != null) { + map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE)); + } + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highOrderPreService.getListOrderPre(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getPreOrderById", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询订单详情") + public ResponseData getPreOrderById(@RequestParam(name = "id", required = true) Long id) { + try { + + return ResponseMsgUtil.success(highOrderPreService.findByOrderId(id)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/preOrderSuccess", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "预约成功") + public ResponseData preOrderSuccess(@RequestBody HighOrderPre highOrderPre, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + + if (StringUtils.isBlank(highOrderPre.getPreUserRemark()) + || highOrderPre.getReachTime() == null + || highOrderPre.getId() == null + || StringUtils.isBlank(highOrderPre.getReachAddress()) + ) { + log.error("HighAgentController -> insertAgent() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + HighOrderPre highOrderPres = highOrderPreService.findByOrderId(highOrderPre.getId()); + + // 校验订单是否合法 + if (highOrderPres == null || highOrderPres.getStatus() != 1) { + log.error("HighGoodsTypeController --> preOrderSuccess() error!", "当前状态不合法"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); + } + + highOrderPres.setUpdateTime(new Date()); + highOrderPres.setOpUserId(userInfoModel.getSecUser().getId()); + highOrderPres.setOpUserName(userInfoModel.getSecUser().getUserName()); + highOrderPres.setPreUserRemark(highOrderPre.getPreUserRemark()); + highOrderPres.setReachTime(highOrderPre.getReachTime()); + highOrderPres.setReachAddress(highOrderPre.getReachAddress()); + highOrderPres.setStatus(2); + highOrderPreService.updateOrderPre(highOrderPres); + + return ResponseMsgUtil.success("预约成功"); + + } catch (Exception e) { + log.error("HighAgentController --> insertAgent() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/preOrderFail", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "预约失败") + public ResponseData preOrderFail(@RequestBody HighOrderPre highOrderPre, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + + if (StringUtils.isBlank(highOrderPre.getStatusFailDesc()) + || highOrderPre.getId() == null + ) { + log.error("HighAgentController -> insertAgent() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + HighOrderPre highOrderPres = highOrderPreService.findByOrderId(highOrderPre.getId()); + + // 校验订单是否合法 + if (highOrderPres == null && highOrderPres.getStatus() != 1) { + log.error("HighGoodsTypeController --> preOrderSuccess() error!", "当前状态不合法"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); + } + + highOrderPres.setUpdateTime(new Date()); + highOrderPres.setOpUserId(userInfoModel.getSecUser().getId()); + highOrderPres.setOpUserName(userInfoModel.getSecUser().getUserName()); + highOrderPres.setStatusFailDesc(highOrderPre.getStatusFailDesc()); + + highOrderPres.setStatus(4); + highOrderPreService.updateOrderPre(highOrderPres); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighAgentController --> insertAgent() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/exportListPreOrder", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出预约订单列表") + public ResponseData exportListGoodsType(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "preOrderNo", required = false) String preOrderNo, + @RequestParam(name = "merchantStoreId", required = false) Long merchantStoreId, + @RequestParam(name = "userPhone", required = false) String userPhone, + @RequestParam(name = "preUserName", required = false) String preUserName, + @RequestParam(name = "goodsName", required = false) String goodsName, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + + // 用户来源 0:超级管理员 1:公司 2:商户 3:门店 4. 代理商 + if(userInfoModel.getSecUser().getObjectType() == 0) { + map.put("companyId", companyId); + + } else if (userInfoModel.getSecUser().getObjectType() == 1) { + if (userInfoModel.getBsCompany().getId() == 3) { + map.put("companyId", 23); + } else if (userInfoModel.getBsCompany().getId() == 2) { + map.put("companyId", null); + }else { + map.put("companyId", userInfoModel.getBsCompany().getId()); + } + + } else if (userInfoModel.getSecUser().getObjectType() == 2) { + merchantId = userInfoModel.getMerchant().getId(); + } else if (userInfoModel.getSecUser().getObjectType() == 3) { + merchantStoreId = userInfoModel.getMerchantStore().getId(); + } + + map.put("merchantId", merchantId); + map.put("merchantStoreId" , merchantStoreId); + map.put("orderNo" , orderNo); + map.put("preOrderNo" , preOrderNo); + map.put("userPhone" , userPhone); + map.put("preUserName" , preUserName); + map.put("goodsName" , goodsName); + map.put("status" , status); + if (createTimeS != null) { + map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS)); + } + if (createTimeE != null) { + map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE)); + } + + String name = "/goodsOrder/预约商品订单" + System.currentTimeMillis() + ".xlsx"; + List list = highOrderPreService.ExportPreOrderList(map); + String fileName = SysConst.getSysConfig().getFileUrl() + name; + EasyExcel.write(fileName, ExportHighPreOrderModel.class).sheet("预约商品订单").doWrite(list); + return ResponseMsgUtil.success(name); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "订单退款") + public ResponseData orderToRefund(@RequestParam(name = "orderId", required = false) Long orderId, + HttpServletRequest request) { + try { + + HighOrderPre highOrderPre = highOrderPreService.findByOrderId(orderId); + + HighChildOrder highChildOrder = highOrderService.getChildOrderById(highOrderPre.getChildOrderId()); + + HighOrder highOrder = highOrderService.getOrderById(orderId); + + if (highOrder == null) { + log.error("orderToRefund error!", "未找到订单"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); + } + + if (highOrder.getOrderStatus() != 6) { + log.error("orderToRefund error!", "无法退款,订单不处于退款中状态"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于退款中状态"); + } + + highOrderPreService.orderToRefund(highChildOrder , highOrder , highOrderPre); + + return ResponseMsgUtil.success("退款成功"); + + } catch (Exception e){ + throw new RuntimeException(e); + } + } + +} diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java b/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java index 6c63e9a0..82476f1a 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java @@ -8,11 +8,15 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighOrder; +import com.hai.entity.HighOrderPre; import com.hai.entity.HighRefundAudit; import com.hai.entity.OutRechargeOrder; import com.hai.model.HighAgentModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; +import com.hai.service.HighOrderPreService; +import com.hai.service.HighOrderService; import com.hai.service.HighRefundAuditService; import com.hai.service.OutRechargeOrderService; import io.swagger.annotations.Api; @@ -49,6 +53,12 @@ public class HighRefundAuditController { @Resource private OutRechargeOrderService outRechargeOrderService; + @Resource + private HighOrderService highOrderService; + + @Resource + private HighOrderPreService highOrderPreService; + @Autowired private UserCenter userCenter; @@ -97,7 +107,6 @@ public class HighRefundAuditController { map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); } - PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(highRefundAuditService.getListRefundAudit(map))); @@ -145,13 +154,24 @@ public class HighRefundAuditController { HighRefundAudit highRefundAudit = highRefundAuditService.getRefundAuditById(id); - OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + if (highRefundAudit.getRefundSource() == 1) { + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + outRechargeOrder.setStatus(2); + outRechargeOrderService.updateOrder(outRechargeOrder); + } else { + HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo()); + highOrder.setOrderStatus(2); + highOrderService.updateOrder(highOrder); + HighOrderPre highOrderPre = highOrderPreService.findByRefund(highRefundAudit.getSourceOrderNo()); + highOrderPre.setStatus(4); + highOrderPre.setExt1("退款驳回"); + highOrderPreService.updateOrderPre(highOrderPre); + } + - highRefundAudit.setStatus(2); - outRechargeOrder.setStatus(2); + highRefundAudit.setStatus(2); highRefundAuditService.updateRefundAudit(highRefundAudit); - outRechargeOrderService.updateOrder(outRechargeOrder); return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id)); @@ -175,4 +195,7 @@ public class HighRefundAuditController { } } + + + } 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 ca89a70d..697c01d6 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 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; @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); } } } \ 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 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; @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); } } } \ No newline at end of file diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java index be546e0a..c065c33b 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java @@ -40,10 +40,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Controller @RequestMapping(value = "/outRechargeOrder") @@ -265,9 +262,15 @@ public class OutRechargeOrderController { if (order.getPayType() == 2) { JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); + + if (jsonObject == null) { + log.error("orderToPay error!", "请求超时"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求超时,请重新点击"); + } + JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); - if (dataObject.getBoolean("success")) { + if (dataObject.getBoolean("success") || Objects.equals(dataObject.getString("message"), "原交易已撤销,不可再次操作")) { order.setStatus(5); order.setRefundTime(new Date()); order.setOutRefundNo("HFR"+new Date().getTime() ); diff --git a/hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java b/hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java new file mode 100644 index 00000000..0703e6d7 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java @@ -0,0 +1,162 @@ +package com.bweb.model; + +import com.alibaba.excel.annotation.ExcelProperty; + +import java.math.BigDecimal; +import java.util.Date; + +public class ExportHighPreOrderModel { + @ExcelProperty("预约订单号") + private String preOrderNo; + + @ExcelProperty("支付订单号") + private String orderNo; + + @ExcelProperty("商品名称") + private String goodsName; + + @ExcelProperty("支付金额") + private BigDecimal payRealPrice; + + @ExcelProperty("用户姓名") + private String preUserName; + + @ExcelProperty("用户电话") + private String preUserPhone; + + @ExcelProperty("预约用户备注") + private String preUserRemark; + + @ExcelProperty("预约失败说明") + private String statusFailDesc; + + @ExcelProperty("到达时间") + private Date reachTime; + + @ExcelProperty("到达地点") + private String reachAddress; + + @ExcelProperty("门店名称") + private String storeName; + + @ExcelProperty("门店地址") + private String address; + + @ExcelProperty("创建时间") + private Date createTime; + + @ExcelProperty("状态") + private String status; + + public String getPreOrderNo() { + return preOrderNo; + } + + public void setPreOrderNo(String preOrderNo) { + this.preOrderNo = preOrderNo; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getGoodsName() { + return goodsName; + } + + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + public BigDecimal getPayRealPrice() { + return payRealPrice; + } + + public void setPayRealPrice(BigDecimal payRealPrice) { + this.payRealPrice = payRealPrice; + } + + public String getPreUserName() { + return preUserName; + } + + public void setPreUserName(String preUserName) { + this.preUserName = preUserName; + } + + public String getPreUserPhone() { + return preUserPhone; + } + + public void setPreUserPhone(String preUserPhone) { + this.preUserPhone = preUserPhone; + } + + public String getPreUserRemark() { + return preUserRemark; + } + + public void setPreUserRemark(String preUserRemark) { + this.preUserRemark = preUserRemark; + } + + public String getStatusFailDesc() { + return statusFailDesc; + } + + public void setStatusFailDesc(String statusFailDesc) { + this.statusFailDesc = statusFailDesc; + } + + public Date getReachTime() { + return reachTime; + } + + public void setReachTime(Date reachTime) { + this.reachTime = reachTime; + } + + public String getReachAddress() { + return reachAddress; + } + + public void setReachAddress(String reachAddress) { + this.reachAddress = reachAddress; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} 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 a166949d..8d876b53 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -107,6 +107,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/sms/getSmsCode") .excludePathPatterns("/activity/getWinLotteryList") .excludePathPatterns("/user/login") + .excludePathPatterns("/user/unionPhoneLogin") .excludePathPatterns("/user/getUnionId") .excludePathPatterns("/order/orderToH5Pay") .excludePathPatterns("/order/orderToPay") @@ -122,6 +123,8 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/order/qzOrderToPay") .excludePathPatterns("/czOrder/orderRefundNotify") .excludePathPatterns("/cmsContent/*") + .excludePathPatterns("/highBrand/*") + .excludePathPatterns("/highGoodsType/*") .excludePathPatterns("/sendSms/*") .excludePathPatterns("/test/*") .excludePathPatterns("/sms/*") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighBrandController.java b/hai-cweb/src/main/java/com/cweb/controller/HighBrandController.java new file mode 100644 index 00000000..810c673e --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/HighBrandController.java @@ -0,0 +1,69 @@ +package com.cweb.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighBrand; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.HighBrandService; +import com.hai.service.HighGoodsTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @Auther: 袁野 + * @Description: + * @Date: 2021/3/26 23:08 + */ +@Controller +@RequestMapping(value = "/highBrand") +@Api(value = "品牌接口") +public class HighBrandController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + + + @Resource + private HighBrandService highBrandService; + + @RequestMapping(value = "/getBrandByList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取品牌列表") + public ResponseData getBrandByList(@RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + @RequestParam(name = "title", required = false) String title, + @RequestParam(name = "goodTypeId", required = false) String goodTypeId, + HttpServletRequest request) { + try { + + Map map = new HashMap<>(); + map.put("title", title); + map.put("goodTypeId", goodTypeId); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highBrandService.getListBand(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index 650b9408..ddee2d97 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -73,6 +73,8 @@ public class HighCouponController { @RequestParam(name = "couponName", required = false) String couponName, @RequestParam(name = "couponType", required = false) Integer couponType, @RequestParam(name = "displayArea", required = false) Integer displayArea, + @RequestParam(name = "brandId", required = false) Integer brandId, + @RequestParam(name = "goodsTypeId", required = false) Integer goodsTypeId, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { @@ -86,6 +88,8 @@ public class HighCouponController { map.put("merchantId", merchantId); map.put("couponName", couponName); map.put("couponType", couponType); + map.put("brandId", brandId); + map.put("goodsTypeId", goodsTypeId); map.put("displayArea", displayArea); map.put("notCouponSource", 2); map.put("status", 2); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGoodsTypeController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGoodsTypeController.java new file mode 100644 index 00000000..be13de46 --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGoodsTypeController.java @@ -0,0 +1,69 @@ +package com.cweb.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighGoodsType; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.HighGoodsTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @Auther: 袁野 + * @Description: + * @Date: 2021/3/26 23:08 + */ +@Controller +@RequestMapping(value = "/highGoodsType") +@Api(value = "商品类型接口") +public class HighGoodsTypeController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighGoodsTypeService highGoodsTypeService; + + @RequestMapping(value = "/getListGoodsType", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取商品类型列表") + public ResponseData getListGoodsType(@RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + @RequestParam(name = "title", required = false) String title, + HttpServletRequest request) { + try { + + Map map = new HashMap<>(); + map.put("title", title); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highGoodsTypeService.getListGoodsType(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 65ae2a31..ec1a5abd 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -121,6 +121,22 @@ public class HighOrderController { log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); } + if (coupon.getReserveStatus() == true) { + if (childOrder.getStoreId() == null) { + log.error("HighOrderController --> addOrder() error!", "未选择门店"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未选择门店"); + } + // 查询门店信息 + HighMerchantStoreModel merchantStore = highMerchantStoreService.getMerchantStoreById(childOrder.getStoreId()); + if (merchantStore == null) { + log.error("HighOrderController --> addOrder() error!", "未选择门店"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店信息"); + } + if (!merchantStore.getMerchantId().equals(coupon.getMerchantId())) { + log.error("HighOrderController --> addOrder() error!", "卡券无法在此门店消费"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "卡券无法在此门店消费"); + } + } // 支付类型:1.微信支付 2.金币支付 if(coupon.getPayType() == 2) { highOrder.setPayModel(1); // 支付模式:1 金币,2 第三方平台,3 混合 diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java new file mode 100644 index 00000000..32c3d21c --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderPreController.java @@ -0,0 +1,137 @@ +package com.cweb.controller; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; +import com.hai.common.utils.IDGenerator; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.TuanYouConfig; +import com.hai.entity.*; +import com.hai.model.HighMerchantStoreModel; +import com.hai.model.HighUserModel; +import com.hai.model.ResponseData; +import com.hai.service.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DeadlockLoserDataAccessException; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Auther: 胡锐 + * @Description: + * @Date: 2021/3/26 23:08 + */ +@Controller +@RequestMapping(value = "/orderPre") +@Api(value = "预约订单接口") +public class HighOrderPreController { + private static Logger log = LoggerFactory.getLogger(HighOrderPreController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private HighOrderPreService highOrderPreService; + + + @RequestMapping(value = "/getUserOrderPreList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取用户预约订单") + public ResponseData getUserOrderPreList(@RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "orderPreNo", required = false) String preOrderNo, + @RequestParam(name = "goodsName", required = false) String goodsName, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("preUserId", userInfoModel.getHighUser().getId()); + map.put("status", status); + map.put("orderNo", orderNo); + map.put("preOrderNo", preOrderNo); + map.put("goodsName", goodsName); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highOrderPreService.getListOrderPre(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserPreOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getOrderPreById", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据预约订单id 查询预约订单详情") + public ResponseData getOrderPreById(@RequestParam(name = "orderPreId", required = true) Long orderPreId) { + try { + + return ResponseMsgUtil.success(highOrderPreService.findByOrderId(orderPreId)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getPreByOrderIdId", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据订单id 查询预约订单详情") + public ResponseData getPreByOrderIdId(@RequestParam(name = "orderId", required = true) Long orderId) { + try { + + return ResponseMsgUtil.success(highOrderPreService.getPreByOrderId(orderId)); + + } catch (Exception e) { + log.error("HighOrderController --> getPreByOrderIdId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/orderComplete", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "订单完成") + public ResponseData orderComplete(@RequestBody JSONObject body) { + try { + if (body == null || body.getLong("preOrderId") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + highOrderPreService.orderComplete(body.getLong("preOrderId")); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighOrderController --> orderComplete() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + +} 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 ebb644c7..da378f24 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.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.web.bind.annotation.*; 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 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; @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); } } 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.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.web.bind.annotation.*; 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 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; @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); } } 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/HighUserCommonController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java index 43de0c4b..264287f3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java @@ -1,5 +1,6 @@ package com.cweb.controller; +import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -7,6 +8,8 @@ import com.hai.common.security.*; import com.hai.common.utils.IDGenerator; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.common.utils.UnionUtils; +import com.hai.config.UnionUserConfig; import com.hai.entity.HighUser; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; @@ -41,6 +44,9 @@ public class HighUserCommonController { @Resource private RedisUtil redisUtil; + @Resource + private UnionUserConfig unionUserConfig; + @Resource private UserCenter userCenter; @@ -66,10 +72,73 @@ public class HighUserCommonController { user = new HighUser(); user.setName("用户" + IDGenerator.nextId(5)); user.setPhone(phone); + user.setRegTime(new Date()); user.setGold(0); + user.setStatus(1); + // 用户信息完整状态 + // 0:完整 + // 1:需要填写用户信息 + // 2:需要填写手机号 + user.setInfoCompleteStatus(1); + highUserService.insertUser(user); + } + + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + SessionObject so = new SessionObject(StringUtils.isNotBlank(user.getUnionId())?user.getUnionId():detailData.getId().toString(), 1 , highUserModel); + userCenter.save(request, response, so); + return ResponseMsgUtil.success(so); + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "/unionPhoneLogin", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "银联授权手机号登录接口") + public ResponseData unionPhoneLogin(@RequestParam(value = "code", required = true) String code, + HttpServletRequest request, HttpServletResponse response) { + try { + + // 获取应用访问令牌 + String backendToken = unionUserConfig.getBackendToken(); + + // 获取授权访问令牌 + JSONObject token = unionUserConfig.getAccessToken(backendToken, code); + if (token == null || !token.getString("resp").equals("00")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, token.getString("msg")); + } + + // 获取用户手机号 + JSONObject userMobile = unionUserConfig.getUserMobile(backendToken, token.getJSONObject("params").getString("accessToken"), token.getJSONObject("params").getString("openId")); + if (userMobile == null || !userMobile.getString("resp").equals("00")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, userMobile.getString("msg")); + } + // 解密,获取手机号 + String mobile = UnionUtils.getDecryptedValue(userMobile.getJSONObject("params").getString("mobile"), unionUserConfig.getRsaKey()); + HighUser user = highUserService.findByPhone(mobile); + if(user == null) { + user = new HighUser(); + user.setName("用户" + IDGenerator.nextId(5)); + user.setPhone(mobile); user.setRegTime(new Date()); + user.setGold(0); + user.setUnionOpenId(token.getJSONObject("params").getString("openId")); + user.setUnionUnionId(token.getJSONObject("params").getString("unionId")); user.setStatus(1); + // 用户信息完整状态 + // 0:完整 + // 1:需要填写用户信息 + // 2:需要填写手机号 + user.setInfoCompleteStatus(1); highUserService.insertUser(user); + } else { + user.setUnionOpenId(token.getJSONObject("params").getString("openId")); + user.setUnionUnionId(token.getJSONObject("params").getString("unionId")); + highUserService.updateUser(user); } HighUserModel highUserModel = new HighUserModel(); @@ -83,4 +152,7 @@ public class HighUserCommonController { return ResponseMsgUtil.exception(e); } } + } + + 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 c23f4688..2d2b2da0 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 @@ -45,6 +45,9 @@ public class UnionPayController { @Resource private HighOrderService highOrderService; + @Resource + private HighOrderPreService highOrderPreService; + @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @@ -134,6 +137,29 @@ public class UnionPayController { highChildOrder.setChildOrdeStatus(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) { // 获取token diff --git a/hai-service/pom.xml b/hai-service/pom.xml index 73db3b71..d4d4ac36 100644 --- a/hai-service/pom.xml +++ b/hai-service/pom.xml @@ -312,6 +312,11 @@ wechatpay-apache-httpclient 0.2.2 + + com.sun.jersey + jersey-client + 1.16 + diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index cfc3de98..7798d7bb 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -116,6 +116,7 @@ public enum ErrorCode { USER_PAY_PWD_ERROR("2132","支付密码错误"), NO_BIND_PHONE("2133","未绑定手机号"), title_("2134","名称已存在"), + ADD_REPEATEDLY("2135","重复添加"), STATUS_ERROR("3000","状态错误"), diff --git a/hai-service/src/main/java/com/hai/common/utils/UnionUtils.java b/hai-service/src/main/java/com/hai/common/utils/UnionUtils.java new file mode 100644 index 00000000..71358575 --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/UnionUtils.java @@ -0,0 +1,487 @@ +package com.hai.common.utils; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.WebResource.Builder; +import com.sun.jersey.api.client.config.DefaultClientConfig; +import com.sun.jersey.client.urlconnection.HTTPSProperties; +import org.apache.commons.codec.binary.Base64; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; +import javax.net.ssl.*; +import javax.ws.rs.core.MediaType; +import java.security.*; +import java.security.cert.CertificateException; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.KeySpec; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +public class UnionUtils { + private static Client c = null; + private static Client secureClient =null; + private static Gson gson = new GsonBuilder().disableHtmlEscaping().create(); + public static String DATE_FORMAT = "yyyy-MM-dd"; + /** + * 初始化设置 + */ + static{ + initalizationJersyClient(); + initalizationSecureJersyClient(); + } + /** + * 设置调用参数 + */ + private static void initalizationJersyClient(){ + try { + c = Client.create(); + c.setFollowRedirects(true); + c.setConnectTimeout(10000); + c.setReadTimeout(10000); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void initalizationSecureJersyClient(){ + try { + SSLContext context = SSLContext.getInstance("SSL"); + context.init(null, new TrustManager[] { new X509TrustManager() { + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted( + java.security.cert.X509Certificate[] chain, String authType) + throws CertificateException {} + public void checkServerTrusted( + java.security.cert.X509Certificate[] chain, + String authType) throws CertificateException {} + } }, new SecureRandom()); + HostnameVerifier hv = new HostnameVerifier(){ + public boolean verify(String urlHostName, SSLSession session){ + return true; + } + }; + + HTTPSProperties prop = new HTTPSProperties(hv, context); + DefaultClientConfig dcc = new DefaultClientConfig(); + dcc.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, prop); + secureClient = Client.create(dcc); + secureClient.setFollowRedirects(true); + secureClient.setConnectTimeout(10000); + secureClient.setReadTimeout(10000); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 调用接口 + */ + public static String sendPOSTRequest(String url, Object map, String contentTpye){ + if(null==c){ + initalizationJersyClient(); + } + Client client = null; + if(url.indexOf("https://") == 0){ + if(null==secureClient){ + initalizationJersyClient(); + } + client = secureClient; + }else{ + if(null==c){ + initalizationJersyClient(); + } + client = c; + } + WebResource resource = client.resource(url); + String resultStr = null; + try { + Builder builder = resource.accept("*/*"); + ClientResponse res = builder.type(contentTpye).entity(map).post(ClientResponse.class); + if(res.getStatus() != 200){ + throw new Exception("url:"+url+",response code:" + res.getStatus()); + } + resultStr = res.getEntity(String.class); + return resultStr; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 参数 转为json格式 + * @param url 调用地址 + * @param map 设置的参数 + * @return + */ + public static String sendPostGson(String url, Map map){ + String ps = gson.toJson(map); + + System.out.println("生成加密后的报文:"+ps); + return sendPOSTRequest(url, ps, MediaType.APPLICATION_JSON); + } + + + /** + * 使用公钥加密对称密钥 + * @param publicKey 公钥 + * @param symmetricKeyByte 对称密钥字节 + * @return 加密后的对称密钥字节 + * @throws Exception + */ + public static byte[] encrypt(String publicKey, byte[] symmetricKeyByte) throws Exception { + byte[] encodedKey = Base64.decodeBase64(publicKey); + KeySpec keySpec = new X509EncodedKeySpec(encodedKey); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey pk = keyFactory.generatePublic(keySpec); + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + cipher.init(Cipher.ENCRYPT_MODE, pk); + byte[] result = cipher.doFinal(symmetricKeyByte); + return result; + } + + /** + * 签名加密后的数据装载进map + * @param key 对称秘钥 + * @param params 待加密的字符串 + * @param encryptKeys 加密字段 + * @throws Exception + */ + public static void encryptedParamMap(String key, Map params, String ... encryptKeys) throws Exception{ + if(encryptKeys != null && encryptKeys.length > 0){ + for(String encryptKey : encryptKeys){ + params.put(encryptKey, getEncryptedValue(params.get(encryptKey), key)); + } + } + } + + /** + * 3DES加密 + * @param value 待加密的字符串 + * @param key 加密密钥 + * @return 加密后的字符串 + * @throws Exception + */ + public static String getEncryptedValue(String value, String key) throws Exception { + if (null == value || "".equals(value)) { + return ""; + } + byte[] valueByte = value.getBytes(); + byte[] sl = encrypt3DES(valueByte, hexToBytes(key)); + String result = Base64.encodeBase64String(sl); + // String result = BytesUtil.bytesToHex(sl); + return result; + } + + /** + * 解密 + * @param value 待解密的字符串 + * @param key 解密秘钥 + * @return 解密后字符串 + * @throws Exception + */ + public static String getDecryptedValue(String value, String key) throws Exception { + if (null == value || "".equals(value)) { + return ""; + } + byte[] valueByte = Base64.decodeBase64(value); + byte[] sl = decrypt3DES(valueByte, hexStr2Bytes(key)); + String result = new String(sl); + return result; + } + + /** + * 3DES解密 + * @param input + * @param key + * @return + * @throws Exception + */ + public static byte[] decrypt3DES(byte[] input, byte[] key) throws Exception { + Cipher c = Cipher.getInstance("DESede/ECB/PKCS5Padding"); + c.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "DESede")); + return c.doFinal(input); + } + + + /** + * bytes字符串转换为Byte值 + * @param src String Byte字符串,每个Byte之间没有分隔符(字符范围:0-9 A-F) + * @return byte[] + */ + public static byte[] hexStr2Bytes(String src){ + /*对输入值进行规范化整理*/ + src = src.trim().replace(" ", "").toUpperCase(Locale.US); + //处理值初始化 + int m=0,n=0; + int iLen=src.length()/2; //计算长度 + byte[] ret = new byte[iLen]; //分配存储空间 + + for (int i = 0; i < iLen; i++){ + m=i*2+1; + n=m+1; + ret[i] = (byte)(Integer.decode("0x"+ src.substring(i*2, m) + src.substring(m,n)) & 0xFF); + } + return ret; + } + + /** + * 3DES加密 + * @param input 待加密的字节 + * @param key 密钥 + * @return 加密后的字节 + * @throws Exception + */ + private static byte[] encrypt3DES(byte[] input, byte[] key) throws Exception { + Cipher c = Cipher.getInstance("DESede/ECB/PKCS5Padding"); + c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "DESede")); + return c.doFinal(input); + } + + /** + * 获取随机字符串 + * @return 随机字符串 + */ + public static String createNonceStr(){ + String sl = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + StringBuilder sb = new StringBuilder(); + for(int i = 0 ; i < 16 ; i ++){ + sb.append(sl.charAt(new Random().nextInt(sl.length()))); + } + return sb.toString(); + } + + /** + * h获取32位随机数字字符串 + * @return + */ + public static String createNonceNumber(){ + String sl = "0123456789"; + StringBuilder sb = new StringBuilder(); + for(int i = 0 ; i < 32 ; i ++){ + sb.append(sl.charAt(new Random().nextInt(sl.length()))); + } + return sb.toString(); + } + /** + * 获取当前日期时间 + * + * @return + */ + public static String getCurrentDateTime(String Dateformat) { + String datestr = null; + SimpleDateFormat df = new SimpleDateFormat(Dateformat); + datestr = df.format(new Date()); + return datestr; + } + + /** + * 在输入日期上增加(+)或减去(-)天数 + * + * @param date 输入日期 + */ + public static Date addDay(Date date, int iday) { + Calendar cd = Calendar.getInstance(); + + cd.setTime(date); + + cd.add(Calendar.DAY_OF_MONTH, iday); + + return cd.getTime(); + } + /** + * 将日期格式日期转换为字符串格式 自定義格式 + * + * @param date + * @param dateformat + * @return + */ + public static String dateToString(Date date, String dateformat) { + String datestr = null; + SimpleDateFormat df = new SimpleDateFormat(dateformat); + datestr = df.format(date); + return datestr; + } + + /** + * 将字符串日期转换为日期格式 + * + * @param datestr + * @return + */ + public static Date stringToDate(String datestr) throws Exception{ + + if (datestr == null || datestr.equals("")) { + return null; + } + Date date = new Date(); + SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); + try { + date = df.parse(datestr); + } catch (ParseException e) { + date = stringToDate(datestr, "yyyyMMdd"); + } + return date; + } + + /** + * 将字符串日期转换为日期格式 + * 自定義格式 + * + * @param datestr + * @return + */ + public static Date stringToDate(String datestr, String dateformat) throws Exception{ + Date date = new Date(); + SimpleDateFormat df = new SimpleDateFormat(dateformat); + date = df.parse(datestr); + return date; + } + /** + * 签名 + * @param param 待签名的参数 + * @param signKey 签名密钥 + * @return 签名结果字符串 + * @throws Exception + */ + public static String sign(Map param, String signKey) throws Exception { + String value = sortMap(param); + byte[] keyBytes = Base64.decodeBase64(signKey); + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyf = KeyFactory.getInstance("RSA"); + PrivateKey priKey = keyf.generatePrivate(keySpec); + Signature signature = Signature.getInstance("SHA256WithRSA"); + signature.initSign(priKey); + signature.update(value.getBytes()); + byte[] signed = signature.sign(); + String result = Base64.encodeBase64String(signed); + return result; + } + + + + /** + * 排序 + * @param param 待排序的参数 + * @return 排序结果字符串 + */ + public static String sortMap(Map param){ + StringBuilder result = new StringBuilder(); + Collection keySet = param.keySet(); + List list = new ArrayList(keySet); + Collections.sort(list); + for (int i = 0; i < list.size(); ++i) { + String key = list.get(i); + if("symmetricKey".equals(key)){ + continue; + } +// 非空字段需要参与签名 +// if(param.get(key) == null || "".equals(param.get(key).trim())){ +// continue; +// } + result.append(key).append("=").append(param.get(key)).append("&"); + } + return result.substring(0, result.length() - 1); + } + + + public static String sha256(byte[] data) { + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + return bytesToHex(md.digest(data)); + + } catch (Exception ex) { + + return null; + } + } + + /** + * 将byte数组转换成16进制字符串 + * + * @param bytes + * @return 16进制字符串 + */ + public static String bytesToHex(byte[] bytes) { + String hexArray = "0123456789abcdef"; + StringBuilder sb = new StringBuilder(bytes.length * 2); + for (byte b : bytes) { + int bi = b & 0xff; + sb.append(hexArray.charAt(bi >> 4)); + sb.append(hexArray.charAt(bi & 0xf)); + } + return sb.toString(); + } + + public static byte[] hexToBytes(String hex) { + return hexToBytes(hex.toCharArray()); + } + + public static byte[] hexToBytes(char[] hex) { + int length = hex.length / 2; + byte[] raw = new byte[length]; + for (int i = 0; i < length; i++) { + int high = Character.digit(hex[i * 2], 16); + int low = Character.digit(hex[i * 2 + 1], 16); + int value = (high << 4) | low; + if (value > 127) { + value -= 256; + } + raw[i] = (byte) value; + } + return raw; + } + + public static String createSign(Map params){ + StringBuilder sb = new StringBuilder(); + // 将参数以参数名的字典升序排序 + Map sortParams = new TreeMap(params); + // 遍历排序的字典,并拼接"key=value"格式 + for (Map.Entry entry : sortParams.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue().trim(); + if (null != value && !"".equals(value)) + sb.append("&").append(key).append("=").append(value); + } + String stringA = sb.toString().replaceFirst("&",""); + String stringSignTemp = stringA ; + String signValue = sha256(stringSignTemp.getBytes()); + return signValue; + } + + + + + /** + * 签名 + * @param param 待签名的参数 + * @param sign 签名结果字符串 + * @return 签名结果 + * @throws NoSuchAlgorithmException + * @throws InvalidKeySpecException + * @throws InvalidKeyException + * @throws SignatureException + */ + public static boolean verify(Map param, String sign,String rescissionPublicKey) throws Exception { + String value = sortMap(param); + byte[] keyBytes = Base64.decodeBase64(rescissionPublicKey); + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyf = KeyFactory.getInstance("RSA"); + PublicKey pubkey = keyf.generatePublic(keySpec); + Signature signature = Signature.getInstance("SHA256WithRSA"); + signature.initVerify(pubkey); + signature.update(value.getBytes()); + boolean result = signature.verify(Base64.decodeBase64(sign.getBytes())); + return result; + } + +} diff --git a/hai-service/src/main/java/com/hai/config/UnionUserConfig.java b/hai-service/src/main/java/com/hai/config/UnionUserConfig.java index 095c095b..1ebe4997 100644 --- a/hai-service/src/main/java/com/hai/config/UnionUserConfig.java +++ b/hai-service/src/main/java/com/hai/config/UnionUserConfig.java @@ -4,8 +4,13 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.HttpsUtils; +import com.hai.common.utils.RedisUtil; +import com.hai.common.utils.UnionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import javax.ws.rs.core.MediaType; import javax.xml.bind.DatatypeConverter; import java.security.KeyPair; import java.security.KeyPairGenerator; @@ -19,23 +24,75 @@ import java.util.*; * 银联用户信息 * @author hurui */ +@Component public class UnionUserConfig { - private static String requestUrl = "https://open.95516.com/open/access/1.0/backendToken"; - private static String appId = "1900bc84497cab3b"; + private static String requestUrl = "https://open.95516.com/open/access/1.0/"; + private static String appId = "cf56ac6f9f6b4744bfba9e5587db147c"; private static String secret = "665193ddd44248acb461594cfe0ded5b"; + private static String rsaKey = "df0bdf7f5ef7bff770f2f21fe549c461df0bdf7f5ef7bff7"; + @Resource + private RedisUtil redisUtil; /** * 获取应用访问令牌backendToken * @return */ - public static JSONObject getBackendToken() { - Map paramMap = new HashMap<>(); + public String getBackendToken() { + Object token = redisUtil.get("UNION_BACKEND_TOKEN"); + if (token != null) { + return token.toString(); + } + Map paramMap = new HashMap<>(); + paramMap.put("appId", appId); + paramMap.put("secret", secret); + paramMap.put("nonceStr", UnionUtils.createNonceStr()); + paramMap.put("timestamp", String.valueOf(System.currentTimeMillis()/1000)); + paramMap.put("signature", generateSign(paramMap)); + paramMap.remove("secret"); + JSONObject jsonObject = JSONObject.parseObject(UnionUtils.sendPostGson(requestUrl+"backendToken", paramMap)); + String backendToken = jsonObject.getJSONObject("params").getString("backendToken"); + redisUtil.set("UNION_BACKEND_TOKEN", backendToken,jsonObject.getJSONObject("params").getLong("expiresIn")); + return backendToken; + } + + /** + * 获取授权访问令牌accessToken + * @return + */ + public JSONObject getAccessToken(String backendToken,String code) { + Map paramMap = new HashMap<>(); + paramMap.put("appId", appId); + paramMap.put("secret", secret); + paramMap.put("nonceStr", UnionUtils.createNonceStr()); + paramMap.put("timestamp", String.valueOf(System.currentTimeMillis()/1000)); + + paramMap.put("backendToken", backendToken); + paramMap.put("code", code); + paramMap.put("grantType", "authorization_code"); + paramMap.put("signature", generateSign(paramMap)); + paramMap.remove("secret"); + return JSONObject.parseObject(UnionUtils.sendPostGson(requestUrl+"token", paramMap)); + } + + + /** + * 获取用户手机号 + * @return + */ + public JSONObject getUserMobile(String backendToken,String accessToken,String openId) { + Map paramMap = new HashMap<>(); paramMap.put("appId", appId); - paramMap.put("nonceStr", createNonceStr()); - paramMap.put("timestamp", System.currentTimeMillis()); + paramMap.put("secret", secret); + paramMap.put("nonceStr", UnionUtils.createNonceStr()); + paramMap.put("timestamp", String.valueOf(System.currentTimeMillis()/1000)); + + paramMap.put("backendToken", backendToken); + paramMap.put("accessToken", accessToken); + paramMap.put("openId", openId); paramMap.put("signature", generateSign(paramMap)); - return HttpsUtils.doPost(requestUrl, JSONObject.toJSONString(paramMap)); + paramMap.remove("secret"); + return JSONObject.parseObject(UnionUtils.sendPostGson(requestUrl+"user.mobile", paramMap)); } @@ -44,7 +101,7 @@ public class UnionUserConfig { * @param param * @return */ - private static String paramSort(final Map param) { + private static String paramSort(final Map param) { Set keySet = param.keySet(); String[] keyArray = keySet.toArray(new String[keySet.size()]); Arrays.sort(keyArray); @@ -59,7 +116,6 @@ public class UnionUserConfig { sb.append("&").append(k).append("=").append(param.get(k)); } } - param.remove("secret"); return sb.toString(); } @@ -69,7 +125,7 @@ public class UnionUserConfig { * @return * @throws Exception */ - private static String generateSign(Map data){ + private static String generateSign(Map data){ data.put("secret", secret); String sign = sha256(paramSort(data).getBytes()); return sign; @@ -88,6 +144,10 @@ public class UnionUserConfig { return sb.toString(); } + public String getRsaKey(){ + return rsaKey; + } + public static String sha256(byte[] data) { try { MessageDigest md = MessageDigest.getInstance("SHA-256"); diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java b/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java index fb34bebd..795517ed 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java @@ -51,7 +51,9 @@ public interface HighCouponMapper extends HighCouponMapperExt { "operator_id, operator_name, ", "pay_type, ext_1, ext_2, ", "ext_3, `status`, display_area, ", - "coupon_source, distributor)", + "coupon_source, distributor, ", + "goods_type_id, brand_id, ", + "reserve_status)", "values (#{companyId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ", "#{couponKey,jdbcType=VARCHAR}, #{couponName,jdbcType=VARCHAR}, ", "#{couponPrice,jdbcType=DECIMAL}, #{couponImg,jdbcType=VARCHAR}, ", @@ -64,7 +66,9 @@ public interface HighCouponMapper extends HighCouponMapperExt { "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", "#{payType,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", "#{ext3,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{displayArea,jdbcType=INTEGER}, ", - "#{couponSource,jdbcType=INTEGER}, #{distributor,jdbcType=INTEGER})" + "#{couponSource,jdbcType=INTEGER}, #{distributor,jdbcType=INTEGER}, ", + "#{goodsTypeId,jdbcType=INTEGER}, #{brandId,jdbcType=INTEGER}, ", + "#{reserveStatus,jdbcType=BIT})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighCoupon record); @@ -103,7 +107,10 @@ public interface HighCouponMapper extends HighCouponMapperExt { @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER), @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER), - @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER) + @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER), + @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER), + @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER), + @Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT) }) List selectByExample(HighCouponExample example); @@ -113,7 +120,7 @@ public interface HighCouponMapper extends HighCouponMapperExt { "coupon_carousel_img, coupon_desc, coupon_type, sales_end_time, recycle_day, ", "limit_number, sales_price, discount_price, sales_count, is_present, create_time, ", "update_time, operator_id, operator_name, pay_type, ext_1, ext_2, ext_3, `status`, ", - "display_area, coupon_source, distributor", + "display_area, coupon_source, distributor, goods_type_id, brand_id, reserve_status", "from high_coupon", "where id = #{id,jdbcType=BIGINT}" }) @@ -146,7 +153,10 @@ public interface HighCouponMapper extends HighCouponMapperExt { @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER), @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER), - @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER) + @Result(column="distributor", property="distributor", jdbcType=JdbcType.INTEGER), + @Result(column="goods_type_id", property="goodsTypeId", jdbcType=JdbcType.INTEGER), + @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER), + @Result(column="reserve_status", property="reserveStatus", jdbcType=JdbcType.BIT) }) HighCoupon selectByPrimaryKey(Long id); @@ -188,7 +198,10 @@ public interface HighCouponMapper extends HighCouponMapperExt { "`status` = #{status,jdbcType=INTEGER},", "display_area = #{displayArea,jdbcType=INTEGER},", "coupon_source = #{couponSource,jdbcType=INTEGER},", - "distributor = #{distributor,jdbcType=INTEGER}", + "distributor = #{distributor,jdbcType=INTEGER},", + "goods_type_id = #{goodsTypeId,jdbcType=INTEGER},", + "brand_id = #{brandId,jdbcType=INTEGER},", + "reserve_status = #{reserveStatus,jdbcType=BIT}", "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(HighCoupon record); diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java index b5cda6a7..6ebc98ca 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java @@ -140,6 +140,18 @@ public class HighCouponSqlProvider { sql.VALUES("distributor", "#{distributor,jdbcType=INTEGER}"); } + if (record.getGoodsTypeId() != null) { + sql.VALUES("goods_type_id", "#{goodsTypeId,jdbcType=INTEGER}"); + } + + if (record.getBrandId() != null) { + sql.VALUES("brand_id", "#{brandId,jdbcType=INTEGER}"); + } + + if (record.getReserveStatus() != null) { + sql.VALUES("reserve_status", "#{reserveStatus,jdbcType=BIT}"); + } + return sql.toString(); } @@ -178,6 +190,9 @@ public class HighCouponSqlProvider { sql.SELECT("display_area"); sql.SELECT("coupon_source"); sql.SELECT("distributor"); + sql.SELECT("goods_type_id"); + sql.SELECT("brand_id"); + sql.SELECT("reserve_status"); sql.FROM("high_coupon"); applyWhere(sql, example, false); @@ -311,6 +326,18 @@ public class HighCouponSqlProvider { sql.SET("distributor = #{record.distributor,jdbcType=INTEGER}"); } + if (record.getGoodsTypeId() != null) { + sql.SET("goods_type_id = #{record.goodsTypeId,jdbcType=INTEGER}"); + } + + if (record.getBrandId() != null) { + sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}"); + } + + if (record.getReserveStatus() != null) { + sql.SET("reserve_status = #{record.reserveStatus,jdbcType=BIT}"); + } + applyWhere(sql, example, true); return sql.toString(); } @@ -348,6 +375,9 @@ public class HighCouponSqlProvider { sql.SET("display_area = #{record.displayArea,jdbcType=INTEGER}"); sql.SET("coupon_source = #{record.couponSource,jdbcType=INTEGER}"); sql.SET("distributor = #{record.distributor,jdbcType=INTEGER}"); + sql.SET("goods_type_id = #{record.goodsTypeId,jdbcType=INTEGER}"); + sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}"); + sql.SET("reserve_status = #{record.reserveStatus,jdbcType=BIT}"); HighCouponExample example = (HighCouponExample) parameter.get("example"); applyWhere(sql, example, true); @@ -470,6 +500,18 @@ public class HighCouponSqlProvider { sql.SET("distributor = #{distributor,jdbcType=INTEGER}"); } + if (record.getGoodsTypeId() != null) { + sql.SET("goods_type_id = #{goodsTypeId,jdbcType=INTEGER}"); + } + + if (record.getBrandId() != null) { + sql.SET("brand_id = #{brandId,jdbcType=INTEGER}"); + } + + if (record.getReserveStatus() != null) { + sql.SET("reserve_status = #{reserveStatus,jdbcType=BIT}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index c2bc992b..425a1e2e 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -3,6 +3,7 @@ package com.hai.dao; import com.hai.entity.HighOrder; import com.hai.model.HighOrderData; import com.hai.model.HighOrderModel; +import com.hai.model.HighOrderPreModel; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; @@ -586,4 +587,39 @@ public interface HighOrderMapperExt { List> selectFinishGasOrder(); + @Select({""}) + List ExportPreOrderList(@Param("map") Map map); + } diff --git a/hai-service/src/main/java/com/hai/dao/HighUserMapper.java b/hai-service/src/main/java/com/hai/dao/HighUserMapper.java index 69ace2cb..200fd730 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserMapper.java @@ -44,6 +44,7 @@ public interface HighUserMapper extends HighUserMapperExt { "sex, birthdate, reg_time, ", "gold, `status`, open_id, ", "open_id_h5, union_id, ", + "union_open_id, union_union_id, ", "info_complete_status, ext_1, ", "ext_2, ext_3, ext_4)", "values (#{headerImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ", @@ -51,6 +52,7 @@ public interface HighUserMapper extends HighUserMapperExt { "#{sex,jdbcType=VARCHAR}, #{birthdate,jdbcType=DATE}, #{regTime,jdbcType=TIMESTAMP}, ", "#{gold,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, ", "#{openIdH5,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR}, ", + "#{unionOpenId,jdbcType=VARCHAR}, #{unionUnionId,jdbcType=VARCHAR}, ", "#{infoCompleteStatus,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, ", "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR})" }) @@ -76,6 +78,8 @@ public interface HighUserMapper extends HighUserMapperExt { @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), @Result(column="open_id_h5", property="openIdH5", jdbcType=JdbcType.VARCHAR), @Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR), + @Result(column="union_open_id", property="unionOpenId", jdbcType=JdbcType.VARCHAR), + @Result(column="union_union_id", property="unionUnionId", jdbcType=JdbcType.VARCHAR), @Result(column="info_complete_status", property="infoCompleteStatus", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -87,7 +91,8 @@ public interface HighUserMapper extends HighUserMapperExt { @Select({ "select", "id, header_img, `name`, phone, `password`, sex, birthdate, reg_time, gold, `status`, ", - "open_id, open_id_h5, union_id, info_complete_status, ext_1, ext_2, ext_3, ext_4", + "open_id, open_id_h5, union_id, union_open_id, union_union_id, info_complete_status, ", + "ext_1, ext_2, ext_3, ext_4", "from high_user", "where id = #{id,jdbcType=BIGINT}" }) @@ -105,6 +110,8 @@ public interface HighUserMapper extends HighUserMapperExt { @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), @Result(column="open_id_h5", property="openIdH5", jdbcType=JdbcType.VARCHAR), @Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR), + @Result(column="union_open_id", property="unionOpenId", jdbcType=JdbcType.VARCHAR), + @Result(column="union_union_id", property="unionUnionId", jdbcType=JdbcType.VARCHAR), @Result(column="info_complete_status", property="infoCompleteStatus", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -136,6 +143,8 @@ public interface HighUserMapper extends HighUserMapperExt { "open_id = #{openId,jdbcType=VARCHAR},", "open_id_h5 = #{openIdH5,jdbcType=VARCHAR},", "union_id = #{unionId,jdbcType=VARCHAR},", + "union_open_id = #{unionOpenId,jdbcType=VARCHAR},", + "union_union_id = #{unionUnionId,jdbcType=VARCHAR},", "info_complete_status = #{infoCompleteStatus,jdbcType=INTEGER},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java index c10a1cd1..db1ab51f 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java @@ -76,6 +76,14 @@ public class HighUserSqlProvider { sql.VALUES("union_id", "#{unionId,jdbcType=VARCHAR}"); } + if (record.getUnionOpenId() != null) { + sql.VALUES("union_open_id", "#{unionOpenId,jdbcType=VARCHAR}"); + } + + if (record.getUnionUnionId() != null) { + sql.VALUES("union_union_id", "#{unionUnionId,jdbcType=VARCHAR}"); + } + if (record.getInfoCompleteStatus() != null) { sql.VALUES("info_complete_status", "#{infoCompleteStatus,jdbcType=INTEGER}"); } @@ -118,6 +126,8 @@ public class HighUserSqlProvider { sql.SELECT("open_id"); sql.SELECT("open_id_h5"); sql.SELECT("union_id"); + sql.SELECT("union_open_id"); + sql.SELECT("union_union_id"); sql.SELECT("info_complete_status"); sql.SELECT("ext_1"); sql.SELECT("ext_2"); @@ -192,6 +202,14 @@ public class HighUserSqlProvider { sql.SET("union_id = #{record.unionId,jdbcType=VARCHAR}"); } + if (record.getUnionOpenId() != null) { + sql.SET("union_open_id = #{record.unionOpenId,jdbcType=VARCHAR}"); + } + + if (record.getUnionUnionId() != null) { + sql.SET("union_union_id = #{record.unionUnionId,jdbcType=VARCHAR}"); + } + if (record.getInfoCompleteStatus() != null) { sql.SET("info_complete_status = #{record.infoCompleteStatus,jdbcType=INTEGER}"); } @@ -233,6 +251,8 @@ public class HighUserSqlProvider { sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}"); sql.SET("open_id_h5 = #{record.openIdH5,jdbcType=VARCHAR}"); sql.SET("union_id = #{record.unionId,jdbcType=VARCHAR}"); + sql.SET("union_open_id = #{record.unionOpenId,jdbcType=VARCHAR}"); + sql.SET("union_union_id = #{record.unionUnionId,jdbcType=VARCHAR}"); sql.SET("info_complete_status = #{record.infoCompleteStatus,jdbcType=INTEGER}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); @@ -296,6 +316,14 @@ public class HighUserSqlProvider { sql.SET("union_id = #{unionId,jdbcType=VARCHAR}"); } + if (record.getUnionOpenId() != null) { + sql.SET("union_open_id = #{unionOpenId,jdbcType=VARCHAR}"); + } + + if (record.getUnionUnionId() != null) { + sql.SET("union_union_id = #{unionUnionId,jdbcType=VARCHAR}"); + } + if (record.getInfoCompleteStatus() != null) { sql.SET("info_complete_status = #{infoCompleteStatus,jdbcType=INTEGER}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighCoupon.java b/hai-service/src/main/java/com/hai/entity/HighCoupon.java index 3ee4589b..af52d038 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCoupon.java +++ b/hai-service/src/main/java/com/hai/entity/HighCoupon.java @@ -138,7 +138,7 @@ public class HighCoupon extends HighCouponModel implements Serializable { private Integer status; /** - * 1.赠券专区 2.金币专区 + * 1.赠券专区 2.金币专区 。3 。银联专区 4. 优选商品 */ private Integer displayArea; @@ -152,6 +152,21 @@ public class HighCoupon extends HighCouponModel implements Serializable { */ private Integer distributor; + /** + * 商品类别id + */ + private Integer goodsTypeId; + + /** + * 品牌id + */ + private Integer brandId; + + /** + * 是否预约产品 0:否 1:是 + */ + private Boolean reserveStatus; + private static final long serialVersionUID = 1L; public Long getId() { @@ -386,6 +401,30 @@ public class HighCoupon extends HighCouponModel implements Serializable { this.distributor = distributor; } + public Integer getGoodsTypeId() { + return goodsTypeId; + } + + public void setGoodsTypeId(Integer goodsTypeId) { + this.goodsTypeId = goodsTypeId; + } + + public Integer getBrandId() { + return brandId; + } + + public void setBrandId(Integer brandId) { + this.brandId = brandId; + } + + public Boolean getReserveStatus() { + return reserveStatus; + } + + public void setReserveStatus(Boolean reserveStatus) { + this.reserveStatus = reserveStatus; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -426,7 +465,10 @@ public class HighCoupon extends HighCouponModel implements Serializable { && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getDisplayArea() == null ? other.getDisplayArea() == null : this.getDisplayArea().equals(other.getDisplayArea())) && (this.getCouponSource() == null ? other.getCouponSource() == null : this.getCouponSource().equals(other.getCouponSource())) - && (this.getDistributor() == null ? other.getDistributor() == null : this.getDistributor().equals(other.getDistributor())); + && (this.getDistributor() == null ? other.getDistributor() == null : this.getDistributor().equals(other.getDistributor())) + && (this.getGoodsTypeId() == null ? other.getGoodsTypeId() == null : this.getGoodsTypeId().equals(other.getGoodsTypeId())) + && (this.getBrandId() == null ? other.getBrandId() == null : this.getBrandId().equals(other.getBrandId())) + && (this.getReserveStatus() == null ? other.getReserveStatus() == null : this.getReserveStatus().equals(other.getReserveStatus())); } @Override @@ -462,6 +504,9 @@ public class HighCoupon extends HighCouponModel implements Serializable { result = prime * result + ((getDisplayArea() == null) ? 0 : getDisplayArea().hashCode()); result = prime * result + ((getCouponSource() == null) ? 0 : getCouponSource().hashCode()); result = prime * result + ((getDistributor() == null) ? 0 : getDistributor().hashCode()); + result = prime * result + ((getGoodsTypeId() == null) ? 0 : getGoodsTypeId().hashCode()); + result = prime * result + ((getBrandId() == null) ? 0 : getBrandId().hashCode()); + result = prime * result + ((getReserveStatus() == null) ? 0 : getReserveStatus().hashCode()); return result; } @@ -500,6 +545,9 @@ public class HighCoupon extends HighCouponModel implements Serializable { sb.append(", displayArea=").append(displayArea); sb.append(", couponSource=").append(couponSource); sb.append(", distributor=").append(distributor); + sb.append(", goodsTypeId=").append(goodsTypeId); + sb.append(", brandId=").append(brandId); + sb.append(", reserveStatus=").append(reserveStatus); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponExample.java b/hai-service/src/main/java/com/hai/entity/HighCouponExample.java index f3089f47..61c19413 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponExample.java @@ -1955,6 +1955,186 @@ public class HighCouponExample { addCriterion("distributor not between", value1, value2, "distributor"); return (Criteria) this; } + + public Criteria andGoodsTypeIdIsNull() { + addCriterion("goods_type_id is null"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdIsNotNull() { + addCriterion("goods_type_id is not null"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdEqualTo(Integer value) { + addCriterion("goods_type_id =", value, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdNotEqualTo(Integer value) { + addCriterion("goods_type_id <>", value, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdGreaterThan(Integer value) { + addCriterion("goods_type_id >", value, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdGreaterThanOrEqualTo(Integer value) { + addCriterion("goods_type_id >=", value, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdLessThan(Integer value) { + addCriterion("goods_type_id <", value, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdLessThanOrEqualTo(Integer value) { + addCriterion("goods_type_id <=", value, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdIn(List values) { + addCriterion("goods_type_id in", values, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdNotIn(List values) { + addCriterion("goods_type_id not in", values, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdBetween(Integer value1, Integer value2) { + addCriterion("goods_type_id between", value1, value2, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIdNotBetween(Integer value1, Integer value2) { + addCriterion("goods_type_id not between", value1, value2, "goodsTypeId"); + return (Criteria) this; + } + + public Criteria andBrandIdIsNull() { + addCriterion("brand_id is null"); + return (Criteria) this; + } + + public Criteria andBrandIdIsNotNull() { + addCriterion("brand_id is not null"); + return (Criteria) this; + } + + public Criteria andBrandIdEqualTo(Integer value) { + addCriterion("brand_id =", value, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdNotEqualTo(Integer value) { + addCriterion("brand_id <>", value, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdGreaterThan(Integer value) { + addCriterion("brand_id >", value, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdGreaterThanOrEqualTo(Integer value) { + addCriterion("brand_id >=", value, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdLessThan(Integer value) { + addCriterion("brand_id <", value, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdLessThanOrEqualTo(Integer value) { + addCriterion("brand_id <=", value, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdIn(List values) { + addCriterion("brand_id in", values, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdNotIn(List values) { + addCriterion("brand_id not in", values, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdBetween(Integer value1, Integer value2) { + addCriterion("brand_id between", value1, value2, "brandId"); + return (Criteria) this; + } + + public Criteria andBrandIdNotBetween(Integer value1, Integer value2) { + addCriterion("brand_id not between", value1, value2, "brandId"); + return (Criteria) this; + } + + public Criteria andReserveStatusIsNull() { + addCriterion("reserve_status is null"); + return (Criteria) this; + } + + public Criteria andReserveStatusIsNotNull() { + addCriterion("reserve_status is not null"); + return (Criteria) this; + } + + public Criteria andReserveStatusEqualTo(Boolean value) { + addCriterion("reserve_status =", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusNotEqualTo(Boolean value) { + addCriterion("reserve_status <>", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusGreaterThan(Boolean value) { + addCriterion("reserve_status >", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusGreaterThanOrEqualTo(Boolean value) { + addCriterion("reserve_status >=", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusLessThan(Boolean value) { + addCriterion("reserve_status <", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusLessThanOrEqualTo(Boolean value) { + addCriterion("reserve_status <=", value, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusIn(List values) { + addCriterion("reserve_status in", values, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusNotIn(List values) { + addCriterion("reserve_status not in", values, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusBetween(Boolean value1, Boolean value2) { + addCriterion("reserve_status between", value1, value2, "reserveStatus"); + return (Criteria) this; + } + + public Criteria andReserveStatusNotBetween(Boolean value1, Boolean value2) { + addCriterion("reserve_status not between", value1, value2, "reserveStatus"); + return (Criteria) this; + } } /** diff --git a/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java b/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java index 5133b74e..32a14cee 100644 --- a/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java +++ b/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java @@ -20,7 +20,7 @@ public class HighRefundAudit implements Serializable { private Integer id; /** - * 退款来源 1:话费 + * 退款来源 1:话费 2:优选商品 */ private Integer refundSource; @@ -335,4 +335,4 @@ public class HighRefundAudit implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/entity/HighUser.java b/hai-service/src/main/java/com/hai/entity/HighUser.java index 4caf07d5..4703c460 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUser.java +++ b/hai-service/src/main/java/com/hai/entity/HighUser.java @@ -75,7 +75,20 @@ public class HighUser extends UserModel implements Serializable { private String unionId; /** - * 用户信息完整状态 0:完整 1:需要填写用户信息 2:需要填写手机号 + * 银联用户唯一标识 + */ + private String unionOpenId; + + /** + * 银联统一用户标识 + */ + private String unionUnionId; + + /** + * 用户信息完整状态 +0:完整 +1:需要填写用户信息 +2:需要填写手机号 */ private Integer infoCompleteStatus; @@ -193,6 +206,22 @@ public class HighUser extends UserModel implements Serializable { this.unionId = unionId; } + public String getUnionOpenId() { + return unionOpenId; + } + + public void setUnionOpenId(String unionOpenId) { + this.unionOpenId = unionOpenId; + } + + public String getUnionUnionId() { + return unionUnionId; + } + + public void setUnionUnionId(String unionUnionId) { + this.unionUnionId = unionUnionId; + } + public Integer getInfoCompleteStatus() { return infoCompleteStatus; } @@ -258,6 +287,8 @@ public class HighUser extends UserModel implements Serializable { && (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId())) && (this.getOpenIdH5() == null ? other.getOpenIdH5() == null : this.getOpenIdH5().equals(other.getOpenIdH5())) && (this.getUnionId() == null ? other.getUnionId() == null : this.getUnionId().equals(other.getUnionId())) + && (this.getUnionOpenId() == null ? other.getUnionOpenId() == null : this.getUnionOpenId().equals(other.getUnionOpenId())) + && (this.getUnionUnionId() == null ? other.getUnionUnionId() == null : this.getUnionUnionId().equals(other.getUnionUnionId())) && (this.getInfoCompleteStatus() == null ? other.getInfoCompleteStatus() == null : this.getInfoCompleteStatus().equals(other.getInfoCompleteStatus())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) @@ -282,6 +313,8 @@ public class HighUser extends UserModel implements Serializable { result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode()); result = prime * result + ((getOpenIdH5() == null) ? 0 : getOpenIdH5().hashCode()); result = prime * result + ((getUnionId() == null) ? 0 : getUnionId().hashCode()); + result = prime * result + ((getUnionOpenId() == null) ? 0 : getUnionOpenId().hashCode()); + result = prime * result + ((getUnionUnionId() == null) ? 0 : getUnionUnionId().hashCode()); result = prime * result + ((getInfoCompleteStatus() == null) ? 0 : getInfoCompleteStatus().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); @@ -309,6 +342,8 @@ public class HighUser extends UserModel implements Serializable { sb.append(", openId=").append(openId); sb.append(", openIdH5=").append(openIdH5); sb.append(", unionId=").append(unionId); + sb.append(", unionOpenId=").append(unionOpenId); + sb.append(", unionUnionId=").append(unionUnionId); sb.append(", infoCompleteStatus=").append(infoCompleteStatus); sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); diff --git a/hai-service/src/main/java/com/hai/entity/HighUserExample.java b/hai-service/src/main/java/com/hai/entity/HighUserExample.java index 0601560d..62383012 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUserExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserExample.java @@ -1012,6 +1012,146 @@ public class HighUserExample { return (Criteria) this; } + public Criteria andUnionOpenIdIsNull() { + addCriterion("union_open_id is null"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdIsNotNull() { + addCriterion("union_open_id is not null"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdEqualTo(String value) { + addCriterion("union_open_id =", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdNotEqualTo(String value) { + addCriterion("union_open_id <>", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdGreaterThan(String value) { + addCriterion("union_open_id >", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdGreaterThanOrEqualTo(String value) { + addCriterion("union_open_id >=", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdLessThan(String value) { + addCriterion("union_open_id <", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdLessThanOrEqualTo(String value) { + addCriterion("union_open_id <=", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdLike(String value) { + addCriterion("union_open_id like", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdNotLike(String value) { + addCriterion("union_open_id not like", value, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdIn(List values) { + addCriterion("union_open_id in", values, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdNotIn(List values) { + addCriterion("union_open_id not in", values, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdBetween(String value1, String value2) { + addCriterion("union_open_id between", value1, value2, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionOpenIdNotBetween(String value1, String value2) { + addCriterion("union_open_id not between", value1, value2, "unionOpenId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdIsNull() { + addCriterion("union_union_id is null"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdIsNotNull() { + addCriterion("union_union_id is not null"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdEqualTo(String value) { + addCriterion("union_union_id =", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdNotEqualTo(String value) { + addCriterion("union_union_id <>", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdGreaterThan(String value) { + addCriterion("union_union_id >", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdGreaterThanOrEqualTo(String value) { + addCriterion("union_union_id >=", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdLessThan(String value) { + addCriterion("union_union_id <", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdLessThanOrEqualTo(String value) { + addCriterion("union_union_id <=", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdLike(String value) { + addCriterion("union_union_id like", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdNotLike(String value) { + addCriterion("union_union_id not like", value, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdIn(List values) { + addCriterion("union_union_id in", values, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdNotIn(List values) { + addCriterion("union_union_id not in", values, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdBetween(String value1, String value2) { + addCriterion("union_union_id between", value1, value2, "unionUnionId"); + return (Criteria) this; + } + + public Criteria andUnionUnionIdNotBetween(String value1, String value2) { + addCriterion("union_union_id not between", value1, value2, "unionUnionId"); + return (Criteria) this; + } + public Criteria andInfoCompleteStatusIsNull() { addCriterion("info_complete_status is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/model/HighOrderPreModel.java b/hai-service/src/main/java/com/hai/model/HighOrderPreModel.java new file mode 100644 index 00000000..b7cfaca5 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/HighOrderPreModel.java @@ -0,0 +1,194 @@ +package com.hai.model; + +import com.alibaba.excel.annotation.ExcelProperty; + +import java.math.BigDecimal; +import java.util.Date; + +public class HighOrderPreModel { + /** + * 预约订单号 + */ + private String preOrderNo; + + /** + * 支付订单号 + */ + private String orderNo; + + /** + * 实付金额 + */ + private BigDecimal payRealPrice; + + + /** + * 商品名称 + */ + private String goodsName; + + + /** + * 预约用户姓名 + */ + private String preUserName; + + /** + * 预约用户手机号 + */ + private String preUserPhone; + + /** + * 预约用户备注 + */ + private String preUserRemark; + + /** + * 状态 1.预约中 2. 预约成功 3.预约完成 4.预约失败 5.预约取消 + */ + private String status; + + /** + * 预约失败说明 + */ + private String statusFailDesc; + + + /** + * 到达时间 + */ + private Date reachTime; + + /** + * 到达地点 + */ + private String reachAddress; + + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 门店名称 + */ + private String storeName; + + /** + * 门店地址 + */ + private String address; + + public String getPreOrderNo() { + return preOrderNo; + } + + public void setPreOrderNo(String preOrderNo) { + this.preOrderNo = preOrderNo; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public BigDecimal getPayRealPrice() { + return payRealPrice; + } + + public void setPayRealPrice(BigDecimal payRealPrice) { + this.payRealPrice = payRealPrice; + } + + public String getGoodsName() { + return goodsName; + } + + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + public String getPreUserName() { + return preUserName; + } + + public void setPreUserName(String preUserName) { + this.preUserName = preUserName; + } + + public String getPreUserPhone() { + return preUserPhone; + } + + public void setPreUserPhone(String preUserPhone) { + this.preUserPhone = preUserPhone; + } + + public String getPreUserRemark() { + return preUserRemark; + } + + public void setPreUserRemark(String preUserRemark) { + this.preUserRemark = preUserRemark; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getStatusFailDesc() { + return statusFailDesc; + } + + public void setStatusFailDesc(String statusFailDesc) { + this.statusFailDesc = statusFailDesc; + } + + public Date getReachTime() { + return reachTime; + } + + public void setReachTime(Date reachTime) { + this.reachTime = reachTime; + } + + public String getReachAddress() { + return reachAddress; + } + + public void setReachAddress(String reachAddress) { + this.reachAddress = reachAddress; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/hai-service/src/main/java/com/hai/service/HighBrandService.java b/hai-service/src/main/java/com/hai/service/HighBrandService.java index 58bf9180..78ff7f13 100644 --- a/hai-service/src/main/java/com/hai/service/HighBrandService.java +++ b/hai-service/src/main/java/com/hai/service/HighBrandService.java @@ -19,12 +19,22 @@ public interface HighBrandService { /** * @Author Sum1Dream - * @Description // 根据订单ID查询订单 + * @Description // 根据订单ID查询 * @Date 15:19 2021/6/11 * @Param [id] * @return com.hai.entity.HighBrand **/ - HighBrand findByOrderId(Integer id); + HighBrand findById(Integer id); + + /** + * @Author Sum1Dream + * @name HighGoodsType.java + * @Description // 根据标题判断是否存在 + * @Date 4:58 下午 2021/11/11 + * @Param + * @return + **/ + Boolean findByTitle(String title , Integer goodsTypeId); /*** diff --git a/hai-service/src/main/java/com/hai/service/HighOrderPreService.java b/hai-service/src/main/java/com/hai/service/HighOrderPreService.java index eabbaf38..dff0c2c5 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderPreService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderPreService.java @@ -1,6 +1,10 @@ package com.hai.service; +import com.hai.entity.HighChildOrder; +import com.hai.entity.HighOrder; import com.hai.entity.HighOrderPre; +import com.hai.model.HighOrderPreModel; + import java.util.List; import java.util.Map; @@ -13,7 +17,17 @@ public interface HighOrderPreService { * @Param [map] * @return java.util.List **/ - List getListOrderPre(Map map); + List getListOrderPre(Map map); + + /** + * @Author Sum1Dream + * @name ExportPreOrderList.java + * @Description // 查询导出订单 + * @Date 12:09 下午 2021/11/22 + * @Param [java.util.Map] + * @return java.util.List + */ + List ExportPreOrderList(Map map); /** * @Author Sum1Dream @@ -24,6 +38,13 @@ public interface HighOrderPreService { **/ HighOrderPre findByOrderId(Long orderId); + /** + * 根据订单ID 查询预约信息 + * @param orderId + * @return + */ + HighOrderPre getPreByOrderId(Long orderId); + /** * @Author Sum1Dream * @Description // 根据订单号查询订单 @@ -33,6 +54,16 @@ public interface HighOrderPreService { **/ HighOrderPre findByOrderNo(String orderNo); + /** + * @Author Sum1Dream + * @name findByRefund.java + * @Description // 查询退款中订单 + * @Date 3:09 下午 2021/11/22 + * @Param [java.lang.String] + * @return com.hai.entity.HighOrderPre + */ + HighOrderPre findByRefund(String orderNo); + /*** * @Author Sum1Dream * @Description // 新增订单 @@ -50,4 +81,21 @@ public interface HighOrderPreService { * @return void **/ void updateOrderPre(HighOrderPre highOrderPre); + + /** + * 订单完成 + * @param preOrderId + */ + void orderComplete(Long preOrderId); + + + /** + * @Author Sum1Dream + * @name orderToRefund.java + * @Description // 预约订单退款 + * @Date 5:34 下午 2021/11/22 + * @Param [java.lang.Long] + * @return void + */ + void orderToRefund(HighChildOrder highChildOrder , HighOrder highOrder , HighOrderPre highOrderPre) throws Exception; } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java index 22c88d57..5fd9de74 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighBrandServiceImpl.java @@ -1,9 +1,7 @@ package com.hai.service.impl; import com.hai.dao.HighBrandMapper; -import com.hai.entity.HighBrand; -import com.hai.entity.HighBrandExample; -import com.hai.entity.HighOrder; +import com.hai.entity.*; import com.hai.service.HighBrandService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -33,6 +31,10 @@ public class HighBrandServiceImpl implements HighBrandService { criteria.andTitleLike("%" + MapUtils.getString(map, "title") + "%"); } + if (MapUtils.getString(map, "goodTypeId") != null) { + criteria.andGoodTypeIdEqualTo(MapUtils.getIntValue(map, "goodTypeId")); + } + criteria.andStatusEqualTo(1); example.setOrderByClause("created_time desc"); @@ -41,10 +43,22 @@ public class HighBrandServiceImpl implements HighBrandService { } @Override - public HighBrand findByOrderId(Integer id) { + public HighBrand findById(Integer id) { return highBrandMapper.selectByPrimaryKey(id); } + @Override + public Boolean findByTitle(String title , Integer goodsTypeId) { + HighBrandExample example = new HighBrandExample(); + HighBrandExample.Criteria criteria = example.createCriteria(); + + criteria.andTitleEqualTo(title).andStatusEqualTo(1).andGoodTypeIdEqualTo(goodsTypeId); + + List highBrands = highBrandMapper.selectByExample(example); + + return highBrands.size() > 0; + } + @Override public void insertBrand(HighBrand highBrand) { highBrandMapper.insert(highBrand); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index dcc80d75..cba36210 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -356,8 +356,16 @@ public class HighCouponServiceImpl implements HighCouponService { criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); } - if (MapUtils.getInteger(map, "couponSource") != null) { - criteria.andCouponSourceEqualTo(MapUtils.getInteger(map, "couponSource")); + if (MapUtils.getInteger(map, "displayArea") != null) { + criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); + } + + if (MapUtils.getInteger(map, "brandId") != null) { + criteria.andBrandIdEqualTo(MapUtils.getInteger(map, "brandId")); + } + + if (MapUtils.getInteger(map, "goodsTypeId") != null) { + criteria.andGoodsTypeIdEqualTo(MapUtils.getInteger(map, "goodsTypeId")); } if (MapUtils.getInteger(map, "status") != null) { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java index 55ceef27..2ed27137 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java @@ -1,16 +1,28 @@ package com.hai.service.impl; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; +import com.hai.config.WxOrderConfig; +import com.hai.dao.HighOrderMapper; import com.hai.dao.HighOrderPreMapper; +import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; import com.hai.entity.HighOrderPre; import com.hai.entity.HighOrderPreExample; +import com.hai.model.HighOrderPreModel; +import com.hai.model.OrderRefundModel; import com.hai.service.HighOrderPreService; +import com.hai.service.HighOrderService; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; @@ -20,23 +32,48 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { @Resource private HighOrderPreMapper highOrderPreMapper; + @Resource + private HighOrderService highOrderService; + + @Resource + private HighOrderMapper highOrderMapper; + + @Resource + private HighOrderPreService highOrderPreService; + @Override - public List getListOrderPre(Map map) { + public List getListOrderPre(Map map) { HighOrderPreExample example = new HighOrderPreExample(); HighOrderPreExample.Criteria criteria = example.createCriteria(); + if (MapUtils.getLong(map, "preUserId") != null) { + criteria.andPreUserIdEqualTo(MapUtils.getLong(map, "preUserId")); + } + if (MapUtils.getInteger(map, "status") != null) { criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); } - if (MapUtils.getInteger(map, "goodsType") != null) { - criteria.andGoodsTypeEqualTo(MapUtils.getInteger(map, "goodsType")); + if (MapUtils.getInteger(map, "companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); + } + + if (MapUtils.getInteger(map, "merchantId") != null) { + criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId")); + } + + if (MapUtils.getInteger(map, "merchantStoreId") != null) { + criteria.andMerchantStoreIdEqualTo(MapUtils.getLong(map, "merchantStoreId")); } if (MapUtils.getString(map, "orderNo") != null) { criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); } + if (MapUtils.getString(map, "preOrderNo") != null) { + criteria.andPreOrderNoLike("%" + MapUtils.getString(map, "preOrderNo") + "%"); + } + if (MapUtils.getString(map, "goodsName") != null) { criteria.andGoodsNameLike("%" + MapUtils.getString(map, "goodsName") + "%"); } @@ -45,31 +82,117 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { criteria.andPreUserPhoneEqualTo(MapUtils.getString(map, "userPhone")); } - if (StringUtils.isNotBlank(map.get("createTimeS")) && StringUtils.isNotBlank(map.get("createTimeE"))) { + if (StringUtils.isNotBlank(MapUtils.getString(map,"createTimeS")) + && StringUtils.isNotBlank(MapUtils.getString(map,"createTimeE"))) { criteria.andCreateTimeBetween( - DateUtil.format(map.get("createTimeS") , "yyyy-MM-dd HH:mm:ss") , - DateUtil.format(map.get("createTimeE") , "yyyy-MM-dd HH:mm:ss")); + 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 (MapUtils.getString(map, "preOrderNo") != null) { + criteria.andPreOrderNoLike("%" + MapUtils.getString(map, "preOrderNo") + "%"); + } + + if (MapUtils.getString(map, "preUserName") != null) { + criteria.andPreUserNameLike("%" + MapUtils.getString(map, "preUserName") + "%"); } + + example.setOrderByClause("create_time desc"); + return highOrderPreMapper.selectByExample(example); } + @Override + public List ExportPreOrderList(Map map) { + return highOrderMapper.ExportPreOrderList(map); + } + @Override public HighOrderPre findByOrderId(Long orderId) { return highOrderPreMapper.selectByPrimaryKey(orderId); } + @Override + public HighOrderPre getPreByOrderId(Long orderId) { + HighOrderPreExample example = new HighOrderPreExample(); + example.createCriteria().andOrderIdEqualTo(orderId); + List list = highOrderPreMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public HighOrderPre findByOrderNo(String orderNo) { + HighOrderPreExample example = new HighOrderPreExample(); + example.createCriteria().andOrderNoEqualTo(orderNo); + List list = highOrderPreMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + + @Override + public HighOrderPre findByRefund(String orderNo) { + HighOrderPreExample example = new HighOrderPreExample(); + example.createCriteria().andOrderNoEqualTo(orderNo).andExt1EqualTo("退款中"); + List list = highOrderPreMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } return null; } @Override public void insertOrderPre(HighOrderPre highOrderPre) { - highOrderPreMapper.insert(highOrderPre); + highOrderPre.setCreateTime(new Date()); + highOrderPre.setUpdateTime(new Date()); + highOrderPreMapper.insert(highOrderPre); } @Override public void updateOrderPre(HighOrderPre highOrderPre) { - highOrderPreMapper.updateByPrimaryKey(highOrderPre); + highOrderPreMapper.updateByPrimaryKey(highOrderPre); + } + + @Override + @Transactional(propagation= Propagation.REQUIRES_NEW) + public void orderComplete(Long preOrderId) { + // 查询预约订单详情 + HighOrderPre orderPre = findByOrderId(preOrderId); + if (orderPre == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到预约订单"); + } + if (orderPre.getStatus() != 2) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, ""); + } + orderPre.setStatus(3); + orderPre.setUpdateTime(new Date()); + updateOrderPre(orderPre); + + highOrderService.childOrderComplete(orderPre.getChildOrderId()); + } + + @Override + @Transactional(propagation= Propagation.REQUIRES_NEW) + public void orderToRefund(HighChildOrder highChildOrder, HighOrder highOrder, HighOrderPre highOrderPre) throws Exception { + // 支付方式: 1:支付宝 2:微信 3:金币 4:汇联通工会卡 5:银联 + if (highOrder.getPayType() == 2) { + // 微信退款 + OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(),highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); + if(orderRefundModel.getResult_code().equals("SUCCESS")) { + highChildOrder.setChildOrdeStatus(5); + highOrder.setOrderStatus(5); + highOrder.setRefundTime(new Date()); + highOrder.setRefundPrice(highOrder.getPayRealPrice()); + highOrderService.updateOrderDetail(highOrder); + highOrderService.updateChildOrder(highChildOrder); + highOrderPre.setExt1("退款成功"); + highOrderPreService.updateOrderPre(highOrderPre); + + } + } } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 1a4a05df..14eb2db2 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -80,6 +80,9 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private HighOrderService highOrderService; + @Resource + private HighOrderPreService highOrderPreService; + @Resource private HighActivityInfoService highActivityInfoService; @@ -199,6 +202,28 @@ public class HighOrderServiceImpl implements HighOrderService { if (highChildOrder.getGoodsType() == 1) { // 查询卡券 HighCoupon coupon = highCouponService.getCouponDetail(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(highOrder.getId()); + orderPre.setOrderNo(highOrder.getOrderNo()); + orderPre.setChildOrderId(highChildOrder.getId()); + orderPre.setPayRealPrice(highOrder.getPayPrice()); + orderPre.setGoodsType(1); + orderPre.setGoodsName(coupon.getCouponName()); + orderPre.setGoodsId(coupon.getId()); + orderPre.setPreUserId(highOrder.getMemId()); + orderPre.setPreUserName(highOrder.getMemName()); + orderPre.setPreUserPhone(highOrder.getMemPhone()); + orderPre.setPreUserRemark(highOrder.getRemarks()); + orderPre.setStatus(1); + highOrderPreService.insertOrderPre(orderPre); + } // 贵州高速 if (coupon.getCouponSource() == 4) { // 获取token @@ -392,6 +417,29 @@ public class HighOrderServiceImpl implements HighOrderService { highChildOrder.setChildOrdeStatus(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) { // 获取token diff --git a/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java index 708a54f0..6705d819 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java @@ -2,11 +2,10 @@ package com.hai.service.impl; import com.hai.common.utils.DateUtil; import com.hai.dao.HighRefundAuditMapper; -import com.hai.entity.HighRefundAudit; -import com.hai.entity.HighRefundAuditExample; -import com.hai.entity.OutRechargeOrder; -import com.hai.entity.OutRechargeOrderExample; +import com.hai.entity.*; import com.hai.model.UserInfoModel; +import com.hai.service.HighOrderPreService; +import com.hai.service.HighOrderService; import com.hai.service.HighRefundAuditService; import com.hai.service.OutRechargeOrderService; import io.swagger.models.auth.In; @@ -31,6 +30,12 @@ public class HighRefundAuditServiceImpl implements HighRefundAuditService { @Resource private OutRechargeOrderService outRechargeOrderService; + @Resource + private HighOrderService highOrderService; + + @Resource + private HighOrderPreService highOrderPreService; + @Override public List getListRefundAudit(Map map) { @@ -85,20 +90,35 @@ public class HighRefundAuditServiceImpl implements HighRefundAuditService { @Transactional(propagation= Propagation.REQUIRES_NEW) public void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel) { - OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + if (highRefundAudit.getRefundSource() == 1) { + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice()); + highRefundAudit.setPayType(outRechargeOrder.getPayType()); + highRefundAudit.setPayTime(outRechargeOrder.getPayTime()); + highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId())); + outRechargeOrder.setStatus(6); + outRechargeOrderService.updateOrder(outRechargeOrder); + } else { + HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo()); + highRefundAudit.setRefundPrice(highOrder.getPayPrice()); + highRefundAudit.setPayType(highOrder.getPayType()); + highRefundAudit.setPayTime(highOrder.getPayTime()); + highRefundAudit.setExt1(String.valueOf(highOrder.getId())); + highOrder.setOrderStatus(6); + + HighOrderPre highOrderPre = highOrderPreService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + highOrderPre.setExt1("退款中"); + + highOrderService.updateOrder(highOrder); + highOrderPreService.updateOrderPre(highOrderPre); + } highRefundAudit.setCompanId(userInfoModel.getBsCompany().getId().intValue()); highRefundAudit.setStatus(0); - highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice()); highRefundAudit.setCreatedTime(new Date()); highRefundAudit.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); highRefundAudit.setCreatedUserName(userInfoModel.getSecUser().getUserName()); - highRefundAudit.setPayType(outRechargeOrder.getPayType()); - highRefundAudit.setPayTime(outRechargeOrder.getPayTime()); - highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId())); - outRechargeOrder.setStatus(6); - outRechargeOrderService.updateOrder(outRechargeOrder); highRefundAuditMapper.insert(highRefundAudit); } diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index cb924279..efbebf0e 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -59,6 +59,9 @@ public class GoodsOrderServiceImpl implements PayService { @Resource private HighOrderService highOrderService; + @Resource + private HighOrderPreService highOrderPreService; + @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @@ -126,6 +129,27 @@ public class GoodsOrderServiceImpl implements PayService { highChildOrder.setChildOrdeStatus(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) { // 获取token