parent
604a476e74
commit
1d6ed5bce8
@ -0,0 +1,80 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
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.BsOrderSettle; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.service.order.BsOrderSettleLedgerService; |
||||
import com.hfkj.service.order.BsOrderSettleService; |
||||
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; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/orderSettle") |
||||
@Api(value="订单退款业务") |
||||
public class BsOrderSettleController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(BsOrderSettleController.class); |
||||
@Resource |
||||
private BsOrderSettleService orderSettleService; |
||||
@Resource |
||||
private BsOrderSettleLedgerService orderSettleLedgerService; |
||||
|
||||
@RequestMapping(value="/getDetailByOrderNo",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询交易详情") |
||||
public ResponseData getDetailByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { |
||||
try { |
||||
// 查询结算信息
|
||||
BsOrderSettle orderSettle = orderSettleService.getData(orderNo); |
||||
if (orderSettle == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据"); |
||||
} |
||||
Map<String,Object> map = new HashMap<>(); |
||||
map.put("orderSettle", orderSettle); |
||||
map.put("orderSettleLedger", orderSettleLedgerService.getListBySettleId(orderSettle.getId())); |
||||
return ResponseMsgUtil.success(map); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/revokeLedger",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "撤销分账") |
||||
public ResponseData revokeLedger(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
// 查询结算信息
|
||||
BsOrderSettle orderSettle = orderSettleService.getData(body.getString("orderNo")); |
||||
if (orderSettle == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据"); |
||||
} |
||||
orderSettleService.revokeLedger(orderSettle); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,7 +1,49 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsOrderSettle; |
||||
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.type.JdbcType; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsOrderSettleMapperExt { |
||||
|
||||
@Select(" <script>" + |
||||
" SELECT a.* " + |
||||
" FROM `bs_order_settle` a " + |
||||
" LEFT JOIN bs_order b on b.order_no = a.order_no " + |
||||
" where 1 = 1 " + |
||||
" <if test='param.ledgerFlag != null'> and a.ledger_flag = #{param.ledgerFlag} </if>" + |
||||
" <if test='param.ledgerStatus != null'> and a.ledger_status = #{param.ledgerStatus} </if>" + |
||||
" <if test='param.orderStatus != null'> and b.order_status = #{param.orderStatus} </if>" + |
||||
" <if test='param.createTimeS != null'> <![CDATA[ and a.create_time >= #{param.createTimeS} ]]></if>" + |
||||
" <if test='param.createTimeE != null'> <![CDATA[ and a.create_time <= #{param.createTimeE} ]]></if>" + |
||||
"ORDER BY a.create_time desc" + |
||||
" </script>") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="settle_mer_no", property="settleMerNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="settle_mer_key", property="settleMerKey", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="settle_amount", property="settleAmount", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="ledger_flag", property="ledgerFlag", jdbcType=JdbcType.BIT), |
||||
@Result(column="ledger_order_no", property="ledgerOrderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ledger_amount", property="ledgerAmount", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="ledger_status", property="ledgerStatus", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="revoke_order_no", property="revokeOrderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@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<BsOrderSettle> queryList(@Param("param") Map<String,Object> param); |
||||
} |
Loading…
Reference in new issue