| @@ -16,6 +16,8 @@ import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/order") | |||
| public class WxOrderController extends BaseController { | |||
| @@ -24,29 +26,37 @@ public class WxOrderController extends BaseController { | |||
| @Autowired | |||
| private WxOrderService wxOrderService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiOperation(value = "券查询接口", notes="{\"pageNum\":int,\"pageSize\":int," + | |||
| "\"merchantId\":Long,\"cUserId\":Long,"+ | |||
| "\"status\":int,\"couponStatus\":int}") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "bUserId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", defaultValue = "0", required = false, dataType = "Integer") | |||
| @ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), | |||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), | |||
| @ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") | |||
| }) | |||
| public ResultData list(@ModelAttribute WxOrder wxOrder, Long bUserId, Integer pageNum, Integer pageSize) { | |||
| if (null == wxOrder) wxOrder = new WxOrder(); | |||
| final PageInfo<WxOrder> page = wxOrderService.blistAsPage(wxOrder, bUserId, pageNum, pageSize); | |||
| public ResultData list(@RequestBody Map<String, Object> params) { | |||
| final PageInfo<Map<String,Object>> page = wxOrderService.bQueryListMap(params); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("订单详情") | |||
| @PostMapping("expired") | |||
| @PostMapping("detail") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long") | |||
| @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long"), | |||
| @ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), | |||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), | |||
| @ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") | |||
| }) | |||
| public ResultData orderDetail(@RequestBody WxOrder wxOrder) { | |||
| public ResultData orderDetail(@RequestBody Map<String, Object> params) { | |||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| return new ResultData(); | |||
| Map<String,Object> map = wxOrderService.queryObject(params); | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("手工退款") | |||
| @@ -8,10 +8,9 @@ import com.simple.domain.po.WxOrder; | |||
| public interface WxOrderMapper extends CommonMapper<WxOrder, String> { | |||
| List<WxOrder> findList(WxOrder wxOrder); | |||
| List<Map<String,Object>> queryListMap(Map<String, Object> params); | |||
| Map<String,Object> queryObject(Map<String, Object> params); | |||
| } | |||
| @@ -20,13 +20,17 @@ public interface WxOrderService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param merchantId | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @param params | |||
| * @return | |||
| */ | |||
| PageInfo<Map<String,Object>> bQueryListMap(Map<String, Object> params); | |||
| /** | |||
| * 查询券详情 | |||
| * @param params | |||
| * @return | |||
| */ | |||
| PageInfo<WxOrder> blistAsPage(WxOrder record, Long merchantId, Integer pageIndex, Integer pageSize); | |||
| Map<String,Object> queryObject(Map<String, Object> params); | |||
| /** | |||
| * 提交订单 | |||
| @@ -36,8 +36,15 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| @Override | |||
| public PageInfo<WxOrder> blistAsPage(WxOrder record, Long merchantId, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); | |||
| public PageInfo<Map<String,Object>> bQueryListMap(Map<String, Object> params) { | |||
| Integer pageIndex = (Integer) params.get("pageIndex"); | |||
| Integer pageSize = (Integer) params.get("pageSize"); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(()->wxOrderMapper.queryListMap(params)); | |||
| } | |||
| @Override | |||
| public Map<String,Object> queryObject(Map<String, Object> params) { | |||
| return wxOrderMapper.queryObject(params); | |||
| } | |||
| @Override | |||
| @@ -101,9 +101,71 @@ | |||
| select <include refid="allColumns" /> from wx_order | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="queryListMap" resultType="hashmap"> | |||
| select o.id, o.coupon_id, c.title, v.verification_date, | |||
| o.c_user_id, u.phone, u.nick_name, c.price, c.sale_price, | |||
| o.status, o.coupon_status | |||
| from wx_order o | |||
| left join wx_coupon c on c.id = o.coupon_id | |||
| left join wx_coupon_verify v on v.coupon_id= o.coupon_id | |||
| left join wx_c_user u on u.id = o.c_user_id | |||
| <where> | |||
| <if test="merchantId != null and merchantId !=''"> | |||
| and c.`merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test="orderId != null and orderId!=''"> | |||
| and o.`id` = #{orderId} | |||
| </if> | |||
| <if test="cUserId != null and cUserId !=''"> | |||
| and o.`c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test="status != null and status != ''" > | |||
| and o.status=#{status} | |||
| </if> | |||
| <if test="couponStatus != null and couponStatus.trim() != ''"> | |||
| and o.coupon_status=#{couponStatus} | |||
| </if> | |||
| </where> | |||
| <choose> | |||
| <otherwise> | |||
| order by id desc | |||
| </otherwise> | |||
| </choose> | |||
| </select> | |||
| <select id="queryObject" resultType="hashmap"> | |||
| select o.id, o.coupon_id, c.title, c.sub_title, v.verification_date, | |||
| o.c_user_id, o.create_date, u.phone, u.nick_name, c.price, c.sale_price, | |||
| o.status, o.coupon_status, c.remark | |||
| from wx_order o | |||
| left join wx_coupon c on c.id = o.coupon_id | |||
| left join wx_coupon_verify v on v.coupon_id= o.coupon_id | |||
| left join wx_c_user u on u.id = o.c_user_id | |||
| <where> | |||
| <if test="merchantId != null and merchantId !=''"> | |||
| and c.`merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test="orderId != null and orderId!=''"> | |||
| and o.`id` = #{orderId} | |||
| </if> | |||
| <if test="cUserId != null and cUserId !=''"> | |||
| and o.`c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test="status != null and status != ''" > | |||
| and o.status=#{status} | |||
| </if> | |||
| <if test="couponStatus != null and couponStatus.trim() != ''"> | |||
| and o.coupon_status=#{couponStatus} | |||
| </if> | |||
| </where> | |||
| <choose> | |||
| <otherwise> | |||
| order by id desc | |||
| </otherwise> | |||
| </choose> | |||
| </select> | |||