提交代码

master
胡锐 5 months ago
parent 2381eafc38
commit 3be28f5226
  1. 6
      bweb/src/main/java/com/bweb/controller/BsGasOilGunNoController.java
  2. 11
      bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java
  3. 26
      bweb/src/main/java/com/bweb/controller/BsMerchantUserController.java
  4. 168
      bweb/src/main/java/com/bweb/controller/BsOrderRefundController.java
  5. 2
      cweb/src/main/java/com/cweb/controller/order/OrderPayController.java
  6. 2
      service/src/main/java/com/hfkj/common/utils/DateUtil.java
  7. 5
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  8. 4
      service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java
  9. 192
      service/src/main/java/com/hfkj/dao/BsOrderRefundMapper.java
  10. 7
      service/src/main/java/com/hfkj/dao/BsOrderRefundMapperExt.java
  11. 556
      service/src/main/java/com/hfkj/dao/BsOrderRefundSqlProvider.java
  12. 492
      service/src/main/java/com/hfkj/entity/BsOrderRefund.java
  13. 2054
      service/src/main/java/com/hfkj/entity/BsOrderRefundExample.java
  14. 2
      service/src/main/java/com/hfkj/model/AgentMerAllot.java
  15. 2
      service/src/main/java/com/hfkj/service/gas/BsGasOilGunNoService.java
  16. 9
      service/src/main/java/com/hfkj/service/gas/impl/BsGasOilGunNoServiceImpl.java
  17. 5
      service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceServiceImpl.java
  18. 24
      service/src/main/java/com/hfkj/service/gas/impl/BsGasStaffServiceImpl.java
  19. 18
      service/src/main/java/com/hfkj/service/impl/BsMerchantQrCodeServiceImpl.java
  20. 4
      service/src/main/java/com/hfkj/service/impl/BsMerchantUserServiceImpl.java
  21. 55
      service/src/main/java/com/hfkj/service/order/BsOrderRefundService.java
  22. 278
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  23. 2
      service/src/main/resources/dev/commonConfig.properties

@ -14,6 +14,7 @@ import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.gas.BsGasService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -39,6 +40,8 @@ public class BsGasOilGunNoController {
@Resource
private BsMerchantService merchantService;
@Resource
private BsGasService gasService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/createOilGunNo", method = RequestMethod.POST)
@ -87,6 +90,8 @@ public class BsGasOilGunNoController {
oilGunNo.setStatus(1);
gasOilGunNoService.editData(oilGunNo);
// 删除油站缓存
gasService.clean(oilPrice.getMerNo());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
@ -107,6 +112,7 @@ public class BsGasOilGunNoController {
gasOilGunNoService.delete(body.getLong("gunNoId"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {

@ -14,6 +14,7 @@ import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.CommonService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.sysenum.gas.GasOilPriceStatusEnum;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import io.swagger.annotations.Api;
@ -43,6 +44,8 @@ public class BsGasOilPriceController {
private UserCenter userCenter;
@Resource
private CommonService commonService;
@Resource
private BsGasService gasService;
@RequestMapping(value = "/createOil", method = RequestMethod.POST)
@ResponseBody
@ -102,6 +105,8 @@ public class BsGasOilPriceController {
oilPrice.setStatus(GasOilPriceStatusEnum.status1.getNumber());
gasOilPriceService.editOilPrice(oilPrice);
// 删除缓存
gasService.clean(oilPrice.getMerNo());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
@ -135,6 +140,8 @@ public class BsGasOilPriceController {
oilPrice.setStatus(GasOilPriceStatusEnum.status1.getNumber());
gasOilPriceService.editOilPrice(oilPrice);
// 删除缓存
gasService.clean(oilPrice.getMerNo());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
@ -168,6 +175,8 @@ public class BsGasOilPriceController {
oilPrice.setStatus(GasOilPriceStatusEnum.status2.getNumber());
gasOilPriceService.editOilPrice(oilPrice);
// 删除缓存
gasService.clean(oilPrice.getMerNo());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("BsMerchantController --> disableOil() error!", e);
@ -199,6 +208,8 @@ public class BsGasOilPriceController {
}
gasOilPriceService.delete(oilPrice);
// 删除缓存
gasService.clean(oilPrice.getMerNo());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("BsMerchantController --> disableOil() error!", e);

@ -2,10 +2,16 @@ package com.bweb.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsMerchantUser;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.BsMerchantUserService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -29,17 +35,31 @@ public class BsMerchantUserController {
@Resource
private BsMerchantUserService merchantUserService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/queryList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData queryList(@RequestParam(value = "merId", required = false) Long merId,
public ResponseData queryList(@RequestParam(value = "merNo", required = false) String merNo,
@RequestParam(value = "userPhone", required = false) String userPhone,
@RequestParam(value = "pageNum", required = true) Integer pageNum,
@RequestParam(value = "pageSize", required = true) Integer pageSize) {
try {
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (userSession == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
Map<String,Object> param = new HashMap<>();
param.put("merId", merId);
param.put("userPhone", userPhone);
if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merNo", merNo);
} else if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
param.put("merId", userSession.getAccount().getObjectId());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(merchantUserService.getList(param)));

@ -0,0 +1,168 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
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.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
* @className: OrderController
* @author: HuRui
* @date: 2024/4/30
**/
@Controller
@RequestMapping(value="/refund")
@Api(value="订单退款业务")
public class BsOrderRefundController {
Logger log = LoggerFactory.getLogger(BsOrderRefundController.class);
@Resource
private UserCenter userCenter;
@Resource
private BsOrderRefundService orderRefundService;
@Resource
private BsOrderChildService orderChildService;
@RequestMapping(value="/tradeOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款交易订单")
public ResponseData tradeOrder(@RequestBody JSONObject body) {
try {
// 用户session
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (userSession == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
return ResponseMsgUtil.success(orderRefundService.tradeOrderRefund(body.getString("orderNo"),body.getString("remark")));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/tradeOrderChild",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款交易子订单")
public ResponseData tradeOrderChild(@RequestBody JSONObject body) {
try {
// 用户session
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (userSession == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
if (body == null
|| StringUtils.isBlank(body.getString("childOrderNo"))
|| body.getInteger("productCount") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
return ResponseMsgUtil.success(orderRefundService.tradeOrderChildRefund(
body.getString("childOrderNo"),
body.getInteger("productCount"),
body.getString("remark")
));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryRefund",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询退款订单")
public ResponseData queryRefund(@RequestParam(value = "refundOrderNo" , required = false) String refundOrderNo) {
try {
if (StringUtils.isBlank(refundOrderNo)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询退款
BsOrderRefund refund = orderRefundService.getRefund(refundOrderNo);
if (refund == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的退款");
}
Map<String,Object> map = new HashMap<>();
map.put("refund", refund);
map.put("orderChild", orderChildService.getDetail(refund.getOrderChildNo()));
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询退款订单列表")
public ResponseData queryList(@RequestParam(value = "merId" , required = false) Long merId,
@RequestParam(value = "userPhone" , required = false) String userPhone,
@RequestParam(value = "orderNo" , required = false) String orderNo,
@RequestParam(value = "orderChildNo" , required = false) String orderChildNo,
@RequestParam(value = "refundOrderNo" , required = false) String refundOrderNo,
@RequestParam(value = "refundStatus" , required = false) Integer refundStatus,
@RequestParam(value = "createTimeS" , required = false) Long createTimeS,
@RequestParam(value = "createTimeE" , required = false) Long createTimeE,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
// 用户session
SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class);
if (userSession == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
Map<String,Object> param = new HashMap<>();
if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) {
param.put("merId", merId);
} else if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
param.put("merId", userSession.getAccount().getObjectId());
}else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
param.put("userPhone", userPhone);
param.put("orderNo", orderNo);
param.put("orderChildNo", orderChildNo);
param.put("refundOrderNo", refundOrderNo);
param.put("refundStatus", refundStatus);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(orderRefundService.getRefundList(param)));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -75,7 +75,7 @@ public class OrderPayController {
}
order.setPayType(OrderPayTypeEnum.type1.getCode());
// 请求支付渠道
Map<Object, Object> preorder = HuiPayService.preorder(merPay.getChannelMerNo(), merPay.getChannelMerKey(), body.getString("userId"), merPay.getLedgerAccountFlag(), order);
Map<Object, Object> preorder = HuiPayService.preorder(merPay.getChannelMerNo(), merPay.getChannelMerKey(), body.getString("openId"), merPay.getLedgerAccountFlag(), order);
// 交易入账
BsOrderSettle orderSettle = new BsOrderSettle();

@ -39,7 +39,7 @@ public class DateUtil {
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.YEAR);
}
public static String date2String(Date date,String format) throws Exception{
public static String date2String(Date date,String format) {
String str = null;
SimpleDateFormat sdf = new SimpleDateFormat(format);
if(date != null){

@ -19,4 +19,9 @@ public class CommonSysConfig {
* 惠支付支付渠道回调地址
*/
private String huiPayPreorderNotifyUrl;
/**
* 嗨加油域名
*/
private String domainName;
}

@ -37,6 +37,7 @@ public interface BsAgentMerMapperExt {
@Select({" <script> " +
" select " +
" a.agentMerId," +
" a.merSourceType," +
" a.provinceCode," +
" a.provinceName," +
@ -44,7 +45,6 @@ public interface BsAgentMerMapperExt {
" a.merName," +
" a.merAddress," +
" a.agentName," +
" a.qrCodeImgUrl," +
" a.createTime," +
" GROUP_CONCAT(a.agentStaffName) agentStaff" +
" FROM " +
@ -56,11 +56,11 @@ public interface BsAgentMerMapperExt {
" a.mer_no merNo," +
" a.mer_name merName," +
" a.address merAddress," +
" b.id agentMerId," +
" b.agent_id agentId," +
" b.agent_name agentName," +
" b.agent_staff_id agentStaffId," +
" b.agent_staff_name agentStaffName," +
" b.qr_code_img_url qrCodeImgUrl," +
" b.create_time createTime" +
" FROM" +
" bs_merchant a" +

@ -0,0 +1,192 @@
package com.hfkj.dao;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.entity.BsOrderRefundExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsOrderRefundMapper extends BsOrderRefundMapperExt {
@SelectProvider(type=BsOrderRefundSqlProvider.class, method="countByExample")
long countByExample(BsOrderRefundExample example);
@DeleteProvider(type=BsOrderRefundSqlProvider.class, method="deleteByExample")
int deleteByExample(BsOrderRefundExample example);
@Delete({
"delete from bs_order_refund",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_order_refund (mer_id, mer_no, ",
"order_no, order_child_no, ",
"user_id, user_phone, ",
"refund_order_no, account_merchant_no, ",
"account_merchant_key, refund_pay_channel, ",
"reufnd_pay_type, refund_serial_no, ",
"refund_pay_channel_order_no, refund_price, ",
"refund_integral, refund_remark, ",
"refund_status, refund_fail_reason, ",
"create_time, update_time, ",
"finish_time, op_user_type, ",
"op_user_id, op_user_name, ",
"ext_1, ext_2, ext_3)",
"values (#{merId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, ",
"#{orderNo,jdbcType=VARCHAR}, #{orderChildNo,jdbcType=VARCHAR}, ",
"#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ",
"#{refundOrderNo,jdbcType=VARCHAR}, #{accountMerchantNo,jdbcType=VARCHAR}, ",
"#{accountMerchantKey,jdbcType=VARCHAR}, #{refundPayChannel,jdbcType=INTEGER}, ",
"#{reufndPayType,jdbcType=INTEGER}, #{refundSerialNo,jdbcType=VARCHAR}, ",
"#{refundPayChannelOrderNo,jdbcType=VARCHAR}, #{refundPrice,jdbcType=DECIMAL}, ",
"#{refundIntegral,jdbcType=BIGINT}, #{refundRemark,jdbcType=VARCHAR}, ",
"#{refundStatus,jdbcType=INTEGER}, #{refundFailReason,jdbcType=VARCHAR}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{finishTime,jdbcType=TIMESTAMP}, #{opUserType,jdbcType=INTEGER}, ",
"#{opUserId,jdbcType=BIGINT}, #{opUserName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsOrderRefund record);
@InsertProvider(type=BsOrderRefundSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsOrderRefund record);
@SelectProvider(type=BsOrderRefundSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="order_child_no", property="orderChildNo", jdbcType=JdbcType.VARCHAR),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_order_no", property="refundOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="account_merchant_no", property="accountMerchantNo", jdbcType=JdbcType.VARCHAR),
@Result(column="account_merchant_key", property="accountMerchantKey", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_pay_channel", property="refundPayChannel", jdbcType=JdbcType.INTEGER),
@Result(column="reufnd_pay_type", property="reufndPayType", jdbcType=JdbcType.INTEGER),
@Result(column="refund_serial_no", property="refundSerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_pay_channel_order_no", property="refundPayChannelOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="refund_integral", property="refundIntegral", jdbcType=JdbcType.BIGINT),
@Result(column="refund_remark", property="refundRemark", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_status", property="refundStatus", jdbcType=JdbcType.INTEGER),
@Result(column="refund_fail_reason", property="refundFailReason", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsOrderRefund> selectByExample(BsOrderRefundExample example);
@Select({
"select",
"id, mer_id, mer_no, order_no, order_child_no, user_id, user_phone, refund_order_no, ",
"account_merchant_no, account_merchant_key, refund_pay_channel, reufnd_pay_type, ",
"refund_serial_no, refund_pay_channel_order_no, refund_price, refund_integral, ",
"refund_remark, refund_status, refund_fail_reason, create_time, update_time, ",
"finish_time, op_user_type, op_user_id, op_user_name, ext_1, ext_2, ext_3",
"from bs_order_refund",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="order_child_no", property="orderChildNo", jdbcType=JdbcType.VARCHAR),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_order_no", property="refundOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="account_merchant_no", property="accountMerchantNo", jdbcType=JdbcType.VARCHAR),
@Result(column="account_merchant_key", property="accountMerchantKey", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_pay_channel", property="refundPayChannel", jdbcType=JdbcType.INTEGER),
@Result(column="reufnd_pay_type", property="reufndPayType", jdbcType=JdbcType.INTEGER),
@Result(column="refund_serial_no", property="refundSerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_pay_channel_order_no", property="refundPayChannelOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="refund_integral", property="refundIntegral", jdbcType=JdbcType.BIGINT),
@Result(column="refund_remark", property="refundRemark", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_status", property="refundStatus", jdbcType=JdbcType.INTEGER),
@Result(column="refund_fail_reason", property="refundFailReason", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsOrderRefund selectByPrimaryKey(Long id);
@UpdateProvider(type=BsOrderRefundSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsOrderRefund record, @Param("example") BsOrderRefundExample example);
@UpdateProvider(type=BsOrderRefundSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsOrderRefund record, @Param("example") BsOrderRefundExample example);
@UpdateProvider(type=BsOrderRefundSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsOrderRefund record);
@Update({
"update bs_order_refund",
"set mer_id = #{merId,jdbcType=BIGINT},",
"mer_no = #{merNo,jdbcType=VARCHAR},",
"order_no = #{orderNo,jdbcType=VARCHAR},",
"order_child_no = #{orderChildNo,jdbcType=VARCHAR},",
"user_id = #{userId,jdbcType=BIGINT},",
"user_phone = #{userPhone,jdbcType=VARCHAR},",
"refund_order_no = #{refundOrderNo,jdbcType=VARCHAR},",
"account_merchant_no = #{accountMerchantNo,jdbcType=VARCHAR},",
"account_merchant_key = #{accountMerchantKey,jdbcType=VARCHAR},",
"refund_pay_channel = #{refundPayChannel,jdbcType=INTEGER},",
"reufnd_pay_type = #{reufndPayType,jdbcType=INTEGER},",
"refund_serial_no = #{refundSerialNo,jdbcType=VARCHAR},",
"refund_pay_channel_order_no = #{refundPayChannelOrderNo,jdbcType=VARCHAR},",
"refund_price = #{refundPrice,jdbcType=DECIMAL},",
"refund_integral = #{refundIntegral,jdbcType=BIGINT},",
"refund_remark = #{refundRemark,jdbcType=VARCHAR},",
"refund_status = #{refundStatus,jdbcType=INTEGER},",
"refund_fail_reason = #{refundFailReason,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"finish_time = #{finishTime,jdbcType=TIMESTAMP},",
"op_user_type = #{opUserType,jdbcType=INTEGER},",
"op_user_id = #{opUserId,jdbcType=BIGINT},",
"op_user_name = #{opUserName,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsOrderRefund record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface BsOrderRefundMapperExt {
}

@ -0,0 +1,556 @@
package com.hfkj.dao;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.entity.BsOrderRefundExample.Criteria;
import com.hfkj.entity.BsOrderRefundExample.Criterion;
import com.hfkj.entity.BsOrderRefundExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsOrderRefundSqlProvider {
public String countByExample(BsOrderRefundExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_order_refund");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsOrderRefundExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_order_refund");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsOrderRefund record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_order_refund");
if (record.getMerId() != null) {
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}");
}
if (record.getOrderNo() != null) {
sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}");
}
if (record.getOrderChildNo() != null) {
sql.VALUES("order_child_no", "#{orderChildNo,jdbcType=VARCHAR}");
}
if (record.getUserId() != null) {
sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
}
if (record.getUserPhone() != null) {
sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}");
}
if (record.getRefundOrderNo() != null) {
sql.VALUES("refund_order_no", "#{refundOrderNo,jdbcType=VARCHAR}");
}
if (record.getAccountMerchantNo() != null) {
sql.VALUES("account_merchant_no", "#{accountMerchantNo,jdbcType=VARCHAR}");
}
if (record.getAccountMerchantKey() != null) {
sql.VALUES("account_merchant_key", "#{accountMerchantKey,jdbcType=VARCHAR}");
}
if (record.getRefundPayChannel() != null) {
sql.VALUES("refund_pay_channel", "#{refundPayChannel,jdbcType=INTEGER}");
}
if (record.getReufndPayType() != null) {
sql.VALUES("reufnd_pay_type", "#{reufndPayType,jdbcType=INTEGER}");
}
if (record.getRefundSerialNo() != null) {
sql.VALUES("refund_serial_no", "#{refundSerialNo,jdbcType=VARCHAR}");
}
if (record.getRefundPayChannelOrderNo() != null) {
sql.VALUES("refund_pay_channel_order_no", "#{refundPayChannelOrderNo,jdbcType=VARCHAR}");
}
if (record.getRefundPrice() != null) {
sql.VALUES("refund_price", "#{refundPrice,jdbcType=DECIMAL}");
}
if (record.getRefundIntegral() != null) {
sql.VALUES("refund_integral", "#{refundIntegral,jdbcType=BIGINT}");
}
if (record.getRefundRemark() != null) {
sql.VALUES("refund_remark", "#{refundRemark,jdbcType=VARCHAR}");
}
if (record.getRefundStatus() != null) {
sql.VALUES("refund_status", "#{refundStatus,jdbcType=INTEGER}");
}
if (record.getRefundFailReason() != null) {
sql.VALUES("refund_fail_reason", "#{refundFailReason,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getFinishTime() != null) {
sql.VALUES("finish_time", "#{finishTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.VALUES("op_user_type", "#{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.VALUES("op_user_id", "#{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.VALUES("op_user_name", "#{opUserName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsOrderRefundExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("mer_id");
sql.SELECT("mer_no");
sql.SELECT("order_no");
sql.SELECT("order_child_no");
sql.SELECT("user_id");
sql.SELECT("user_phone");
sql.SELECT("refund_order_no");
sql.SELECT("account_merchant_no");
sql.SELECT("account_merchant_key");
sql.SELECT("refund_pay_channel");
sql.SELECT("reufnd_pay_type");
sql.SELECT("refund_serial_no");
sql.SELECT("refund_pay_channel_order_no");
sql.SELECT("refund_price");
sql.SELECT("refund_integral");
sql.SELECT("refund_remark");
sql.SELECT("refund_status");
sql.SELECT("refund_fail_reason");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("finish_time");
sql.SELECT("op_user_type");
sql.SELECT("op_user_id");
sql.SELECT("op_user_name");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_order_refund");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsOrderRefund record = (BsOrderRefund) parameter.get("record");
BsOrderRefundExample example = (BsOrderRefundExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_order_refund");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getMerId() != null) {
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
}
if (record.getOrderNo() != null) {
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
}
if (record.getOrderChildNo() != null) {
sql.SET("order_child_no = #{record.orderChildNo,jdbcType=VARCHAR}");
}
if (record.getUserId() != null) {
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
}
if (record.getRefundOrderNo() != null) {
sql.SET("refund_order_no = #{record.refundOrderNo,jdbcType=VARCHAR}");
}
if (record.getAccountMerchantNo() != null) {
sql.SET("account_merchant_no = #{record.accountMerchantNo,jdbcType=VARCHAR}");
}
if (record.getAccountMerchantKey() != null) {
sql.SET("account_merchant_key = #{record.accountMerchantKey,jdbcType=VARCHAR}");
}
if (record.getRefundPayChannel() != null) {
sql.SET("refund_pay_channel = #{record.refundPayChannel,jdbcType=INTEGER}");
}
if (record.getReufndPayType() != null) {
sql.SET("reufnd_pay_type = #{record.reufndPayType,jdbcType=INTEGER}");
}
if (record.getRefundSerialNo() != null) {
sql.SET("refund_serial_no = #{record.refundSerialNo,jdbcType=VARCHAR}");
}
if (record.getRefundPayChannelOrderNo() != null) {
sql.SET("refund_pay_channel_order_no = #{record.refundPayChannelOrderNo,jdbcType=VARCHAR}");
}
if (record.getRefundPrice() != null) {
sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}");
}
if (record.getRefundIntegral() != null) {
sql.SET("refund_integral = #{record.refundIntegral,jdbcType=BIGINT}");
}
if (record.getRefundRemark() != null) {
sql.SET("refund_remark = #{record.refundRemark,jdbcType=VARCHAR}");
}
if (record.getRefundStatus() != null) {
sql.SET("refund_status = #{record.refundStatus,jdbcType=INTEGER}");
}
if (record.getRefundFailReason() != null) {
sql.SET("refund_fail_reason = #{record.refundFailReason,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getFinishTime() != null) {
sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_order_refund");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
sql.SET("order_child_no = #{record.orderChildNo,jdbcType=VARCHAR}");
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
sql.SET("refund_order_no = #{record.refundOrderNo,jdbcType=VARCHAR}");
sql.SET("account_merchant_no = #{record.accountMerchantNo,jdbcType=VARCHAR}");
sql.SET("account_merchant_key = #{record.accountMerchantKey,jdbcType=VARCHAR}");
sql.SET("refund_pay_channel = #{record.refundPayChannel,jdbcType=INTEGER}");
sql.SET("reufnd_pay_type = #{record.reufndPayType,jdbcType=INTEGER}");
sql.SET("refund_serial_no = #{record.refundSerialNo,jdbcType=VARCHAR}");
sql.SET("refund_pay_channel_order_no = #{record.refundPayChannelOrderNo,jdbcType=VARCHAR}");
sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}");
sql.SET("refund_integral = #{record.refundIntegral,jdbcType=BIGINT}");
sql.SET("refund_remark = #{record.refundRemark,jdbcType=VARCHAR}");
sql.SET("refund_status = #{record.refundStatus,jdbcType=INTEGER}");
sql.SET("refund_fail_reason = #{record.refundFailReason,jdbcType=VARCHAR}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}");
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsOrderRefundExample example = (BsOrderRefundExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsOrderRefund record) {
SQL sql = new SQL();
sql.UPDATE("bs_order_refund");
if (record.getMerId() != null) {
sql.SET("mer_id = #{merId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}");
}
if (record.getOrderNo() != null) {
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}");
}
if (record.getOrderChildNo() != null) {
sql.SET("order_child_no = #{orderChildNo,jdbcType=VARCHAR}");
}
if (record.getUserId() != null) {
sql.SET("user_id = #{userId,jdbcType=BIGINT}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}");
}
if (record.getRefundOrderNo() != null) {
sql.SET("refund_order_no = #{refundOrderNo,jdbcType=VARCHAR}");
}
if (record.getAccountMerchantNo() != null) {
sql.SET("account_merchant_no = #{accountMerchantNo,jdbcType=VARCHAR}");
}
if (record.getAccountMerchantKey() != null) {
sql.SET("account_merchant_key = #{accountMerchantKey,jdbcType=VARCHAR}");
}
if (record.getRefundPayChannel() != null) {
sql.SET("refund_pay_channel = #{refundPayChannel,jdbcType=INTEGER}");
}
if (record.getReufndPayType() != null) {
sql.SET("reufnd_pay_type = #{reufndPayType,jdbcType=INTEGER}");
}
if (record.getRefundSerialNo() != null) {
sql.SET("refund_serial_no = #{refundSerialNo,jdbcType=VARCHAR}");
}
if (record.getRefundPayChannelOrderNo() != null) {
sql.SET("refund_pay_channel_order_no = #{refundPayChannelOrderNo,jdbcType=VARCHAR}");
}
if (record.getRefundPrice() != null) {
sql.SET("refund_price = #{refundPrice,jdbcType=DECIMAL}");
}
if (record.getRefundIntegral() != null) {
sql.SET("refund_integral = #{refundIntegral,jdbcType=BIGINT}");
}
if (record.getRefundRemark() != null) {
sql.SET("refund_remark = #{refundRemark,jdbcType=VARCHAR}");
}
if (record.getRefundStatus() != null) {
sql.SET("refund_status = #{refundStatus,jdbcType=INTEGER}");
}
if (record.getRefundFailReason() != null) {
sql.SET("refund_fail_reason = #{refundFailReason,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getFinishTime() != null) {
sql.SET("finish_time = #{finishTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{opUserName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsOrderRefundExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,492 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* bs_order_refund
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsOrderRefund implements Serializable {
/**
* 主键ID
*/
private Long id;
/**
* 商户id
*/
private Long merId;
/**
* 商户号
*/
private String merNo;
/**
* 交易订单号
*/
private String orderNo;
/**
* 商品订单号
*/
private String orderChildNo;
/**
* 用户id
*/
private Long userId;
/**
* 用户手机号
*/
private String userPhone;
/**
* 退款订单号
*/
private String refundOrderNo;
/**
* 退款入账商户号
*/
private String accountMerchantNo;
/**
* 退款入账商户key
*/
private String accountMerchantKey;
/**
* 支付渠道 1惠支付
*/
private Integer refundPayChannel;
/**
* 支付类型 数据字典ORDER_PAY_TYPE
*/
private Integer reufndPayType;
/**
* 客户退款流水号
*/
private String refundSerialNo;
/**
* 支付渠道退款流水号
*/
private String refundPayChannelOrderNo;
/**
* 退款金额
*/
private BigDecimal refundPrice;
/**
* 退款积分
*/
private Long refundIntegral;
/**
* 退款备注
*/
private String refundRemark;
/**
* 退款状态
1. 退款中
2. 退款成功
3. 退款失败
*/
private Integer refundStatus;
/**
* 退款失败原因
*/
private String refundFailReason;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 完成时间
*/
private Date finishTime;
/**
* 操作人类型 1. 系统 2. 管理员 3. 用户
*/
private Integer opUserType;
/**
* 操作人id
*/
private Long opUserId;
/**
* 操作人名称
*/
private String opUserName;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMerId() {
return merId;
}
public void setMerId(Long merId) {
this.merId = merId;
}
public String getMerNo() {
return merNo;
}
public void setMerNo(String merNo) {
this.merNo = merNo;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getOrderChildNo() {
return orderChildNo;
}
public void setOrderChildNo(String orderChildNo) {
this.orderChildNo = orderChildNo;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getRefundOrderNo() {
return refundOrderNo;
}
public void setRefundOrderNo(String refundOrderNo) {
this.refundOrderNo = refundOrderNo;
}
public String getAccountMerchantNo() {
return accountMerchantNo;
}
public void setAccountMerchantNo(String accountMerchantNo) {
this.accountMerchantNo = accountMerchantNo;
}
public String getAccountMerchantKey() {
return accountMerchantKey;
}
public void setAccountMerchantKey(String accountMerchantKey) {
this.accountMerchantKey = accountMerchantKey;
}
public Integer getRefundPayChannel() {
return refundPayChannel;
}
public void setRefundPayChannel(Integer refundPayChannel) {
this.refundPayChannel = refundPayChannel;
}
public Integer getReufndPayType() {
return reufndPayType;
}
public void setReufndPayType(Integer reufndPayType) {
this.reufndPayType = reufndPayType;
}
public String getRefundSerialNo() {
return refundSerialNo;
}
public void setRefundSerialNo(String refundSerialNo) {
this.refundSerialNo = refundSerialNo;
}
public String getRefundPayChannelOrderNo() {
return refundPayChannelOrderNo;
}
public void setRefundPayChannelOrderNo(String refundPayChannelOrderNo) {
this.refundPayChannelOrderNo = refundPayChannelOrderNo;
}
public BigDecimal getRefundPrice() {
return refundPrice;
}
public void setRefundPrice(BigDecimal refundPrice) {
this.refundPrice = refundPrice;
}
public Long getRefundIntegral() {
return refundIntegral;
}
public void setRefundIntegral(Long refundIntegral) {
this.refundIntegral = refundIntegral;
}
public String getRefundRemark() {
return refundRemark;
}
public void setRefundRemark(String refundRemark) {
this.refundRemark = refundRemark;
}
public Integer getRefundStatus() {
return refundStatus;
}
public void setRefundStatus(Integer refundStatus) {
this.refundStatus = refundStatus;
}
public String getRefundFailReason() {
return refundFailReason;
}
public void setRefundFailReason(String refundFailReason) {
this.refundFailReason = refundFailReason;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getFinishTime() {
return finishTime;
}
public void setFinishTime(Date finishTime) {
this.finishTime = finishTime;
}
public Integer getOpUserType() {
return opUserType;
}
public void setOpUserType(Integer opUserType) {
this.opUserType = opUserType;
}
public Long getOpUserId() {
return opUserId;
}
public void setOpUserId(Long opUserId) {
this.opUserId = opUserId;
}
public String getOpUserName() {
return opUserName;
}
public void setOpUserName(String opUserName) {
this.opUserName = opUserName;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsOrderRefund other = (BsOrderRefund) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId()))
&& (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo()))
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
&& (this.getOrderChildNo() == null ? other.getOrderChildNo() == null : this.getOrderChildNo().equals(other.getOrderChildNo()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone()))
&& (this.getRefundOrderNo() == null ? other.getRefundOrderNo() == null : this.getRefundOrderNo().equals(other.getRefundOrderNo()))
&& (this.getAccountMerchantNo() == null ? other.getAccountMerchantNo() == null : this.getAccountMerchantNo().equals(other.getAccountMerchantNo()))
&& (this.getAccountMerchantKey() == null ? other.getAccountMerchantKey() == null : this.getAccountMerchantKey().equals(other.getAccountMerchantKey()))
&& (this.getRefundPayChannel() == null ? other.getRefundPayChannel() == null : this.getRefundPayChannel().equals(other.getRefundPayChannel()))
&& (this.getReufndPayType() == null ? other.getReufndPayType() == null : this.getReufndPayType().equals(other.getReufndPayType()))
&& (this.getRefundSerialNo() == null ? other.getRefundSerialNo() == null : this.getRefundSerialNo().equals(other.getRefundSerialNo()))
&& (this.getRefundPayChannelOrderNo() == null ? other.getRefundPayChannelOrderNo() == null : this.getRefundPayChannelOrderNo().equals(other.getRefundPayChannelOrderNo()))
&& (this.getRefundPrice() == null ? other.getRefundPrice() == null : this.getRefundPrice().equals(other.getRefundPrice()))
&& (this.getRefundIntegral() == null ? other.getRefundIntegral() == null : this.getRefundIntegral().equals(other.getRefundIntegral()))
&& (this.getRefundRemark() == null ? other.getRefundRemark() == null : this.getRefundRemark().equals(other.getRefundRemark()))
&& (this.getRefundStatus() == null ? other.getRefundStatus() == null : this.getRefundStatus().equals(other.getRefundStatus()))
&& (this.getRefundFailReason() == null ? other.getRefundFailReason() == null : this.getRefundFailReason().equals(other.getRefundFailReason()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime()))
&& (this.getOpUserType() == null ? other.getOpUserType() == null : this.getOpUserType().equals(other.getOpUserType()))
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode());
result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode());
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
result = prime * result + ((getOrderChildNo() == null) ? 0 : getOrderChildNo().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode());
result = prime * result + ((getRefundOrderNo() == null) ? 0 : getRefundOrderNo().hashCode());
result = prime * result + ((getAccountMerchantNo() == null) ? 0 : getAccountMerchantNo().hashCode());
result = prime * result + ((getAccountMerchantKey() == null) ? 0 : getAccountMerchantKey().hashCode());
result = prime * result + ((getRefundPayChannel() == null) ? 0 : getRefundPayChannel().hashCode());
result = prime * result + ((getReufndPayType() == null) ? 0 : getReufndPayType().hashCode());
result = prime * result + ((getRefundSerialNo() == null) ? 0 : getRefundSerialNo().hashCode());
result = prime * result + ((getRefundPayChannelOrderNo() == null) ? 0 : getRefundPayChannelOrderNo().hashCode());
result = prime * result + ((getRefundPrice() == null) ? 0 : getRefundPrice().hashCode());
result = prime * result + ((getRefundIntegral() == null) ? 0 : getRefundIntegral().hashCode());
result = prime * result + ((getRefundRemark() == null) ? 0 : getRefundRemark().hashCode());
result = prime * result + ((getRefundStatus() == null) ? 0 : getRefundStatus().hashCode());
result = prime * result + ((getRefundFailReason() == null) ? 0 : getRefundFailReason().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getFinishTime() == null) ? 0 : getFinishTime().hashCode());
result = prime * result + ((getOpUserType() == null) ? 0 : getOpUserType().hashCode());
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", merId=").append(merId);
sb.append(", merNo=").append(merNo);
sb.append(", orderNo=").append(orderNo);
sb.append(", orderChildNo=").append(orderChildNo);
sb.append(", userId=").append(userId);
sb.append(", userPhone=").append(userPhone);
sb.append(", refundOrderNo=").append(refundOrderNo);
sb.append(", accountMerchantNo=").append(accountMerchantNo);
sb.append(", accountMerchantKey=").append(accountMerchantKey);
sb.append(", refundPayChannel=").append(refundPayChannel);
sb.append(", reufndPayType=").append(reufndPayType);
sb.append(", refundSerialNo=").append(refundSerialNo);
sb.append(", refundPayChannelOrderNo=").append(refundPayChannelOrderNo);
sb.append(", refundPrice=").append(refundPrice);
sb.append(", refundIntegral=").append(refundIntegral);
sb.append(", refundRemark=").append(refundRemark);
sb.append(", refundStatus=").append(refundStatus);
sb.append(", refundFailReason=").append(refundFailReason);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", finishTime=").append(finishTime);
sb.append(", opUserType=").append(opUserType);
sb.append(", opUserId=").append(opUserId);
sb.append(", opUserName=").append(opUserName);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -11,6 +11,7 @@ import java.util.Date;
**/
@Data
public class AgentMerAllot {
private String agentMerId;
private String provinceCode;
private String provinceName;
private Integer merSourceType;
@ -20,6 +21,5 @@ public class AgentMerAllot {
private String agentName;
private Date createTime;
private String agentStaff;
private String qrCodeImgUrl;
}

@ -28,7 +28,7 @@ public interface BsGasOilGunNoService {
* 删除
* @param merNo
*/
void delete(String merNo);
void delete(String merNo, String oilNo);
/**
* 查询油站枪号列表

@ -8,6 +8,7 @@ import com.hfkj.dao.BsGasOilGunNoMapper;
import com.hfkj.entity.BsGasOilGunNo;
import com.hfkj.entity.BsGasOilGunNoExample;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -27,6 +28,8 @@ public class BsGasOilGunNoServiceImpl implements BsGasOilGunNoService {
private BsGasOilGunNoMapper gasOilGunNoMapper;
@Resource
private RedisUtil redisUtil;
@Resource
private BsGasService gasService;
private final static String GAS_OIL_NO_KEY = "GAS_OIL_NO:";
@ -50,12 +53,14 @@ public class BsGasOilGunNoServiceImpl implements BsGasOilGunNoService {
}
oilGunNo.setStatus(0);
editData(oilGunNo);
// 删除油站缓存
gasService.clean(oilGunNo.getMerNo());
}
@Override
public void delete(String merNo) {
public void delete(String merNo, String oilNo) {
BsGasOilGunNoExample example = new BsGasOilGunNoExample();
example.createCriteria().andMerNoEqualTo(merNo).andStatusEqualTo(1);
example.createCriteria().andMerNoEqualTo(merNo).andOilNoEqualTo(oilNo).andStatusEqualTo(1);
List<BsGasOilGunNo> list = gasOilGunNoMapper.selectByExample(example);
for (BsGasOilGunNo oilGunNo : list) {
oilGunNo.setStatus(0);

@ -62,7 +62,10 @@ public class BsGasOilPriceServiceImpl implements BsGasOilPriceService {
editOilPrice(data);
// 删除抢号
gasOilGunNoService.delete(data.getMerNo());
gasOilGunNoService.delete(data.getMerNo(), data.getOilNo());
// 删除缓存
redisUtil.del(GAS_OIL_PRICE_KEY + data.getId());
}
@Override

@ -1,13 +1,17 @@
package com.hfkj.service.gas.impl;
import com.hfkj.common.QRCodeGenerator;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.MD5Util;
import com.hfkj.config.CommonSysConst;
import com.hfkj.dao.BsGasStaffMapper;
import com.hfkj.entity.BsGasStaff;
import com.hfkj.entity.BsGasStaffExample;
import com.hfkj.entity.BsMerchant;
import com.hfkj.entity.SecUser;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.gas.BsGasStaffService;
import com.hfkj.service.sec.SecUserService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
@ -28,9 +32,10 @@ public class BsGasStaffServiceImpl implements BsGasStaffService {
@Resource
private BsGasStaffMapper gasStaffMapper;
@Resource
private SecUserService userService;
@Resource
private BsMerchantService merchantService;
@Override
public void editData(BsGasStaff gasStaff) {
@ -51,6 +56,23 @@ public class BsGasStaffServiceImpl implements BsGasStaffService {
if (userService.getDetailByLoginName(gasStaff.getTelephone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "电话已存在,请更换");
}
// 查询商户
BsMerchant merchant = merchantService.getMerchant(gasStaff.getMerId());
if (merchant == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户");
}
editData(gasStaff);
// 二维码
String qrContent = CommonSysConst.getSysConfig().getDomainName() + "/cwebh5/#/petrolStation/comfirmOrder/index?merNo=" + merchant.getMerNo()+"&gasStaffId="+gasStaff.getId();
String qrCodeFile = "/merOilQrCode/" + merchant.getMerNo() + "/" + System.currentTimeMillis() + ".png";
QRCodeGenerator.generateQRCodeImage(
qrContent,
350,
350,
CommonSysConst.getSysConfig().getFilesystem() + qrCodeFile);
gasStaff.setQrCodeImgUrl(qrCodeFile);
editData(gasStaff);
SecUser secUser = new SecUser();

@ -47,7 +47,7 @@ public class BsMerchantQrCodeServiceImpl implements BsMerchantQrCodeService {
@Override
public void generateMerQrCode(BsMerchant merchant) throws Exception {
/** 综合二维码 **/
/* *//** 综合二维码 **//*
BsMerchantQrCode compositeQrCode = new BsMerchantQrCode();
compositeQrCode.setMerchantId(merchant.getId());
compositeQrCode.setMerchantNo(merchant.getMerNo());
@ -56,7 +56,7 @@ public class BsMerchantQrCodeServiceImpl implements BsMerchantQrCodeService {
compositeQrCode.setCodeContent("https://gratia-pay.dctpay.com?sn="+merchant.getMerNo());
// 二维码
String compositeQrCodeFile = "/merchantQrCode/" + merchant.getId() + "/" + System.currentTimeMillis() + ".png";
String compositeQrCodeFile = "/merOilQrCode/" + merchant.getMerNo() + "/" + System.currentTimeMillis() + ".png";
QRCodeGenerator.generateQRCodeImage(
compositeQrCode.getCodeContent(),
350,
@ -66,7 +66,7 @@ public class BsMerchantQrCodeServiceImpl implements BsMerchantQrCodeService {
compositeQrCode.setStatus(MerchantQrCodeStatusEnum.status1.getNumber());
compositeQrCode.setCreateTime(new Date());
compositeQrCode.setUpdateTime(new Date());
merchantQrCodeMapper.insert(compositeQrCode);
merchantQrCodeMapper.insert(compositeQrCode);*/
/** 加油二维码 **/
BsMerchantQrCode oilQrCode = new BsMerchantQrCode();
@ -74,12 +74,12 @@ public class BsMerchantQrCodeServiceImpl implements BsMerchantQrCodeService {
oilQrCode.setMerchantNo(merchant.getMerNo());
oilQrCode.setMerchantNo(merchant.getMerNo());
oilQrCode.setCodeType(MerchantQrCodeTypeEnum.type2.getNumber());
oilQrCode.setCodeContent("https://gratia-pay.dctpay.com?sn="+merchant.getMerNo());
oilQrCode.setCodeContent(CommonSysConst.getSysConfig().getDomainName()+"/cwebh5/#/petrolStation/comfirmOrder/index?merNo="+merchant.getMerNo());
// 二维码
String oilQrCodeFile = "/merchantQrCode/" + merchant.getId() + "/" + System.currentTimeMillis() + ".png";
String oilQrCodeFile = "/merOilQrCode/" + merchant.getMerNo() + "/" + System.currentTimeMillis() + ".png";
QRCodeGenerator.generateQRCodeImage(
compositeQrCode.getCodeContent(),
oilQrCode.getCodeContent(),
350,
350,
CommonSysConst.getSysConfig().getFilesystem() + oilQrCodeFile);
@ -91,7 +91,7 @@ public class BsMerchantQrCodeServiceImpl implements BsMerchantQrCodeService {
/** 商城二维码 **/
BsMerchantQrCode shopQrCode = new BsMerchantQrCode();
/*BsMerchantQrCode shopQrCode = new BsMerchantQrCode();
shopQrCode.setMerchantId(merchant.getId());
shopQrCode.setMerchantNo(merchant.getMerNo());
shopQrCode.setMerchantNo(merchant.getMerNo());
@ -99,7 +99,7 @@ public class BsMerchantQrCodeServiceImpl implements BsMerchantQrCodeService {
shopQrCode.setCodeContent("https://gratia-pay.dctpay.com?sn="+merchant.getMerNo());
// 二维码
String shopQrCodeFile = "/merchantQrCode/" + merchant.getId() + "/" + System.currentTimeMillis() + ".png";
String shopQrCodeFile = "/merOilQrCode/" + merchant.getMerNo() + "/" + System.currentTimeMillis() + ".png";
QRCodeGenerator.generateQRCodeImage(
compositeQrCode.getCodeContent(),
350,
@ -109,7 +109,7 @@ public class BsMerchantQrCodeServiceImpl implements BsMerchantQrCodeService {
shopQrCode.setStatus(MerchantQrCodeStatusEnum.status1.getNumber());
shopQrCode.setCreateTime(new Date());
shopQrCode.setUpdateTime(new Date());
merchantQrCodeMapper.insert(shopQrCode);
merchantQrCodeMapper.insert(shopQrCode);*/
}
@Override

@ -55,6 +55,10 @@ public class BsMerchantUserServiceImpl implements BsMerchantUserService {
criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) {
criteria.andMerNoEqualTo(MapUtils.getString(param, "merNo"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "userPhone"))) {
criteria.andUserPhoneLike("%"+MapUtils.getString(param, "userPhone")+"%");
}

@ -0,0 +1,55 @@
package com.hfkj.service.order;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.model.order.OrderModel;
import java.util.List;
import java.util.Map;
/**
* @className: BsOrderRefundService
* @author: HuRui
* @date: 2024/6/21
**/
public interface BsOrderRefundService {
/**
* 编辑数据
* @param data
*/
void editData(BsOrderRefund data);
/**
* 退款金额
* @return
*/
boolean refundMoney(BsOrderRefund orderRefund);
/**
* 交易订单退款
* @param orderNo
* @return
*/
OrderModel tradeOrderRefund(String orderNo, String remark);
/**
* 交易子订单退款
* @param childOrderNo 子订单号
* @param productCount 退款产品数量
* @return
*/
BsOrderRefund tradeOrderChildRefund(String childOrderNo, Integer productCount, String remark);
/**
* 查询退款
* @param refundOrderNo 退款单号
* @return
*/
BsOrderRefund getRefund(String refundOrderNo);
/**
* 查询退款列表
* @param param
* @return
*/
List<BsOrderRefund> getRefundList(Map<String,Object> param);
}

@ -0,0 +1,278 @@
package com.hfkj.service.order.impl;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.BaseException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.RandomUtils;
import com.hfkj.dao.BsOrderRefundMapper;
import com.hfkj.entity.BsMerchant;
import com.hfkj.entity.BsOrder;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.entity.BsOrderRefundExample;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.pay.HuiPayService;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderPayChannelEnum;
import com.hfkj.sysenum.order.OrderRefundStatusEnum;
import com.hfkj.sysenum.order.OrderStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @className: BsOrderRefundServiceImpl
* @author: HuRui
* @date: 2024/6/21
**/
@Service("orderRefundService")
public class BsOrderRefundServiceImpl implements BsOrderRefundService {
@Resource
public BsOrderRefundMapper orderRefundMapper;
@Resource
private BsOrderService orderService;
@Resource
private BsOrderChildService orderChildService;
@Resource
private BsMerchantService merchantService;
@Override
public void editData(BsOrderRefund data) {
data.setUpdateTime(new Date());
if (data.getId() == null) {
data.setCreateTime(new Date());
orderRefundMapper.insert(data);
} else {
orderRefundMapper.updateByPrimaryKey(data);
}
}
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED, isolation = Isolation.READ_UNCOMMITTED)
public boolean refundMoney(BsOrderRefund orderRefund) {
try {
if (OrderPayChannelEnum.type1.getCode() == orderRefund.getRefundPayChannel()) {
// 渠道退款
JSONObject refund = HuiPayService.refund(orderRefund.getAccountMerchantNo(), orderRefund.getAccountMerchantKey(), orderRefund.getOrderNo(), orderRefund.getRefundOrderNo(), orderRefund.getRefundPrice());
if (refund.getString("return_code").equals("000000")) {
JSONObject data = refund.getJSONObject("return_data");
orderRefund.setRefundPayChannelOrderNo(data.getString("refundTradeNo"));
orderRefund.setRefundSerialNo(data.getString("accTradeNo"));
orderRefund.setRefundStatus(OrderRefundStatusEnum.status2.getCode());
orderRefund.setFinishTime(new Date());
editData(orderRefund);
return true;
} else {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode());
orderRefund.setRefundFailReason(refund.getString("return_msg"));
editData(orderRefund);
}
}/* else if (OrderPayChannelEnum.type2.getCode() == orderRefund.getRefundPayChannel()) {
// TODO 暂无该支付方式
} else if (OrderPayChannelEnum.type3.getCode() ==orderRefund.getRefundPayChannel()) {
// TODO 暂无该支付方式
}*/ else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!该支付方式暂不支持退款");
}
} catch (BaseException e) {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode());
orderRefund.setRefundFailReason(e.getErrorMsg());
editData(orderRefund);
} catch (Exception e) {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode());
orderRefund.setRefundFailReason("未知问题");
editData(orderRefund);
}
return false;
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public OrderModel tradeOrderRefund(String orderNo, String remark) {
// 查询交易订单
OrderModel order = orderService.getDetail(orderNo);
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该账户已被禁用,无法进行交易");
}
if (!order.getOrderStatus().equals(OrderStatusEnum.status2.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "该账户已被禁用,无法进行交易");
}
boolean refundSuccess = true;
for (OrderChildModel orderChild : order.getOrderChildList()) {
try {
tradeOrderChildRefund(orderChild.getChildOrderNo(), orderChild.getProductCount(), remark);
} catch (Exception e) {
refundSuccess = false;
}
}
order.setOrderStatus(refundSuccess ? OrderStatusEnum.status4.getCode() : order.getOrderStatus());
order.setRefundTime(refundSuccess ? new Date() : null);
orderService.editData(order);
// 删除缓存
orderService.cacheDelete(order.getOrderNo());
return order;
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public BsOrderRefund tradeOrderChildRefund(String childOrderNo, Integer productCount, String remark) {
// 查询子订单
OrderChildModel orderChild = orderChildService.getDetail(childOrderNo);
if (orderChild == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的子订单");
}
if (productCount > orderChild.getSurplusRefundCount()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!退货数量超过子订单可退数量");
}
// 查询交易订单
BsOrder order = orderService.getOrder(orderChild.getOrderNo());
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的交易订单");
}
// 查询商户
BsMerchant merchant = merchantService.getMerchant(orderChild.getMerNo());
if (merchant == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户");
}
// 创建退款订单
BsOrderRefund orderRefund = new BsOrderRefund();
orderRefund.setMerId(merchant.getId());
orderRefund.setMerNo(merchant.getMerNo());
orderRefund.setOrderNo(orderChild.getOrderNo());
orderRefund.setOrderChildNo(orderChild.getChildOrderNo());
orderRefund.setUserId(order.getUserId());
orderRefund.setUserPhone(order.getUserPhone());
// 退款订单号 退款标识:R + 时间 + 随机3位数字
orderRefund.setRefundOrderNo("R"+ DateUtil.date2String(new Date(), "yyMMddHHmmss") + RandomUtils.number(3, false));
orderRefund.setRefundPayChannel(order.getPayChannel());
orderRefund.setReufndPayType(order.getPayType());
if (orderChild.getSurplusRefundCount().equals(productCount)) {
// 全部退款
orderRefund.setRefundPrice(orderChild.getSurplusRefundPrice());
orderRefund.setRefundIntegral(orderChild.getSurplusRefundIntegral());
} else {
// 部分退款
// 计算单价
BigDecimal unitPrice = orderChild.getSurplusRefundPrice().divide(new BigDecimal(orderChild.getProductCount().toString()), 2, BigDecimal.ROUND_DOWN).setScale(2);
BigDecimal unitPriceIntegral = new BigDecimal(orderChild.getSurplusRefundIntegral().toString()).divide(new BigDecimal("100"))
.divide(new BigDecimal(orderChild.getProductCount().toString()), 2, BigDecimal.ROUND_DOWN).setScale(2);
orderRefund.setRefundPrice(unitPrice.multiply(new BigDecimal(productCount.toString())));
orderRefund.setRefundIntegral(unitPriceIntegral.multiply(new BigDecimal("100")).longValue());
}
/* if (orderRefund.getRefundIntegral() > 0L) {
Map<String,Object> opUser = new HashMap<>();
opUser.put("opUserType", orderRefund.getOpUserType());
opUser.put("opUserId", orderRefund.getUserId());
opUser.put("opUserPhone", orderRefund.getUserPhone());
Map<String,Object> source = new HashMap<>();
source.put("sourceType", UserIntegralRecordSourceTypeEnum.type2.getCode());
source.put("sourceId", orderChild.getId());
source.put("sourceOrderNo", orderChild.getChildOrderNo());
source.put("sourceContent", "商品订单退款退回积分");
// 退款积分
userIntegralService.entry(orderRefund.getUserId(),orderRefund.getRefundIntegral(), opUser, source);
}*/
orderRefund.setRefundRemark(remark);
orderRefund.setRefundStatus(OrderRefundStatusEnum.status1.getCode());
orderRefund.setAccountMerchantNo(orderChild.getSettleAccount());
orderRefund.setAccountMerchantKey(orderChild.getSettleAccountKey());
editData(orderRefund);
// 资金退款
orderRefund.setRefundStatus(refundMoney(orderRefund)?OrderRefundStatusEnum.status2.getCode():OrderRefundStatusEnum.status3.getCode());
editData(orderRefund);
// 退款成功
if (orderRefund.getRefundStatus().equals(OrderRefundStatusEnum.status2.getCode())) {
// 修改子订单可退数量、金额、积分
orderChild.setSurplusRefundCount(orderChild.getSurplusRefundCount() - productCount);
orderChild.setSurplusRefundPrice(orderChild.getSurplusRefundPrice().subtract(orderRefund.getRefundPrice()));
orderChild.setSurplusRefundIntegral(orderChild.getSurplusRefundIntegral() - orderRefund.getRefundIntegral());
orderChild.setStatus(orderChild.getSurplusRefundCount()==0? OrderChildStatusEnum.status4.getCode():orderChild.getStatus());
orderChildService.editData(orderChild);
}
// 删除缓存
orderService.cacheDelete(order.getOrderNo());
return orderRefund;
}
@Override
public BsOrderRefund getRefund(String refundOrderNo) {
BsOrderRefundExample example = new BsOrderRefundExample();
example.createCriteria().andRefundOrderNoEqualTo(refundOrderNo);
List<BsOrderRefund> list = orderRefundMapper.selectByExample(example);
if (!list.isEmpty()){
return list.get(0);
}
return null;
}
@Override
public List<BsOrderRefund> getRefundList(Map<String, Object> param) {
BsOrderRefundExample example = new BsOrderRefundExample();
BsOrderRefundExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(MapUtils.getString(param, "userPhone"))) {
criteria.andUserPhoneEqualTo(MapUtils.getString(param, "userPhone"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "orderNo"))) {
criteria.andOrderNoLike("%"+MapUtils.getString(param, "orderNo")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "orderChildNo"))) {
criteria.andOrderChildNoLike("%"+MapUtils.getString(param, "orderChildNo")+"%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "refundOrderNo"))) {
criteria.andRefundOrderNoLike("%"+MapUtils.getString(param, "refundOrderNo")+"%");
}
if (MapUtils.getInteger(param, "refundStatus") != null) {
criteria.andRefundStatusEqualTo(MapUtils.getInteger(param, "refundStatus"));
}
if (MapUtils.getLong(param, "createTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS")));
}
if (MapUtils.getLong(param, "createTimeE") != null) {
criteria.andCreateTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeE")));
}
example.setOrderByClause("create_time desc");
return orderRefundMapper.selectByExample(example);
}
}

@ -1 +1,3 @@
filesystem=/home/project/oil/filesystem
huiPayPreorderNotifyUrl=https://test-oil.dctpay.com/crest/notify/huipay
domainName=https://test-oil.dctpay.com

Loading…
Cancel
Save