| @@ -13,9 +13,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | |||||
| @SpringBootApplication | @SpringBootApplication | ||||
| @MapperScan(basePackages = {"com.simple.mapper"}) | @MapperScan(basePackages = {"com.simple.mapper"}) | ||||
| @EnableSwagger2 | @EnableSwagger2 | ||||
| public class UserApplication { | |||||
| public class BApplication { | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(UserApplication.class, args); | |||||
| SpringApplication.run(BApplication.class, args); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.simple.domain.vo.OrderVo; | |||||
| import com.simple.enums.EnumOrderStatus; | import com.simple.enums.EnumOrderStatus; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -27,35 +28,36 @@ public class WxOrderController extends BaseController { | |||||
| private WxOrderService wxOrderService; | private WxOrderService wxOrderService; | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiOperation(value = "券查询接口", notes="{\"pageNum\":int,\"pageSize\":int," + | |||||
| "\"merchantId\":Long,\"cUserId\":Long,"+ | |||||
| "\"status\":int,\"couponStatus\":int}") | |||||
| @ApiOperation(value = "券查询接口", notes="") | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), | @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 = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), | ||||
| @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "couponId", value = "券ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), | @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") | @ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") | ||||
| }) | }) | ||||
| public ResultData list(@RequestBody Map<String, Object> params) { | |||||
| final PageInfo<Map<String,Object>> page = wxOrderService.bQueryListMap(params); | |||||
| public ResultData list(@ModelAttribute OrderVo orderVo, Integer pageNum, Integer pageSize) { | |||||
| final PageInfo<Map<String,Object>> page = wxOrderService.bQueryListMap(orderVo, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("订单详情") | @ApiOperation("订单详情") | ||||
| @PostMapping("detail") | |||||
| @GetMapping("detail") | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long"), | |||||
| @ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), | @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 = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), | ||||
| @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "couponId", value = "券ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), | @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") | @ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") | ||||
| }) | }) | ||||
| public ResultData orderDetail(@RequestBody Map<String, Object> params) { | |||||
| public ResultData orderDetail(@ModelAttribute OrderVo orderVo) { | |||||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| Map<String,Object> map = wxOrderService.queryObject(params); | |||||
| Map<String,Object> map = wxOrderService.queryObject(orderVo); | |||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| @@ -13,9 +13,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | |||||
| @SpringBootApplication | @SpringBootApplication | ||||
| @MapperScan(basePackages = {"com.simple.mapper"}) | @MapperScan(basePackages = {"com.simple.mapper"}) | ||||
| @EnableSwagger2 | @EnableSwagger2 | ||||
| public class UserApplication { | |||||
| public class CApplication { | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(UserApplication.class, args); | |||||
| SpringApplication.run(CApplication.class, args); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,76 @@ | |||||
| package com.simple.domain.vo; | |||||
| import java.io.Serializable; | |||||
| public class OrderVo implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| /*租户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||||
| private String tenantId; | |||||
| /*订单ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | |||||
| private Long orderId; | |||||
| /*卡券ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId") | |||||
| private Long couponId; | |||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private Long merchantId; | |||||
| /*c端用户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | |||||
| private Long cUserId; | |||||
| /*订单状态**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="订单状态",name="status") | |||||
| private Integer status; | |||||
| /*券状态**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券状态",name="status") | |||||
| private Integer couponStatus; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public Long getOrderId() { | |||||
| return orderId; | |||||
| } | |||||
| public void setOrderId(Long _orderId) { | |||||
| orderId = _orderId; | |||||
| } | |||||
| public Long getCouponId() { | |||||
| return couponId; | |||||
| } | |||||
| public void setCouponId(Long _couponId) { | |||||
| couponId = _couponId; | |||||
| } | |||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| } | |||||
| public Long getCUserId() { | |||||
| return cUserId; | |||||
| } | |||||
| public void setCUserId(Long _cUserId) { | |||||
| cUserId = _cUserId; | |||||
| } | |||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| } | |||||
| public Integer getCouponStatus() { | |||||
| return couponStatus; | |||||
| } | |||||
| public void setCouponStatus(Integer couponStatus) { | |||||
| this.couponStatus = couponStatus; | |||||
| } | |||||
| } | |||||
| @@ -2,6 +2,7 @@ package com.simple.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.vo.OrderVo; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import com.simple.domain.po.WxOrder; | import com.simple.domain.po.WxOrder; | ||||
| @@ -9,8 +10,8 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, String> { | |||||
| List<WxOrder> findList(WxOrder wxOrder); | List<WxOrder> findList(WxOrder wxOrder); | ||||
| List<Map<String,Object>> queryListMap(Map<String, Object> params); | |||||
| List<Map<String,Object>> queryListMap(OrderVo orderVo); | |||||
| Map<String,Object> queryObject(Map<String, Object> params); | |||||
| Map<String,Object> queryObject(OrderVo orderVo); | |||||
| } | } | ||||
| @@ -3,6 +3,7 @@ package com.simple.service; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxOrder; | import com.simple.domain.po.WxOrder; | ||||
| import com.simple.domain.vo.OrderVo; | |||||
| import com.simple.enums.EnumOrderStatus; | import com.simple.enums.EnumOrderStatus; | ||||
| public interface WxOrderService { | public interface WxOrderService { | ||||
| @@ -20,17 +21,19 @@ public interface WxOrderService { | |||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param params | |||||
| * @param orderVo | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<Map<String,Object>> bQueryListMap(Map<String, Object> params); | |||||
| PageInfo<Map<String,Object>> bQueryListMap(OrderVo orderVo, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 查询券详情 | * 查询券详情 | ||||
| * @param params | |||||
| * @param orderVo | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| Map<String,Object> queryObject(Map<String, Object> params); | |||||
| Map<String,Object> queryObject(OrderVo orderVo); | |||||
| /** | /** | ||||
| * 提交订单 | * 提交订单 | ||||
| @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxOrder; | import com.simple.domain.po.WxOrder; | ||||
| import com.simple.domain.vo.OrderVo; | |||||
| import com.simple.enums.EnumOrderStatus; | import com.simple.enums.EnumOrderStatus; | ||||
| import com.simple.exception.MallinkException; | import com.simple.exception.MallinkException; | ||||
| import com.simple.mapper.WxCouponMapper; | import com.simple.mapper.WxCouponMapper; | ||||
| @@ -36,15 +37,13 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| 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)); | |||||
| public PageInfo<Map<String,Object>> bQueryListMap(OrderVo orderVo, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(()->wxOrderMapper.queryListMap(orderVo)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Map<String,Object> queryObject(Map<String, Object> params) { | |||||
| return wxOrderMapper.queryObject(params); | |||||
| public Map<String,Object> queryObject(OrderVo orderVo) { | |||||
| return wxOrderMapper.queryObject(orderVo); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -103,7 +103,7 @@ | |||||
| </select> | </select> | ||||
| <select id="queryListMap" resultType="hashmap"> | |||||
| <select id="queryListMap" parameterType="com.simple.domain.vo.OrderVo" resultType="hashmap"> | |||||
| select o.id, o.coupon_id, c.title, v.verification_date, | 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.c_user_id, u.phone, u.nick_name, c.price, c.sale_price, | ||||
| o.status, o.coupon_status | o.status, o.coupon_status | ||||
| @@ -112,20 +112,26 @@ | |||||
| left join wx_coupon_verify v on v.coupon_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 | left join wx_c_user u on u.id = o.c_user_id | ||||
| <where> | <where> | ||||
| <if test="tenantId != null and tenantId !=''"> | |||||
| and c.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test="merchantId != null and merchantId !=''"> | <if test="merchantId != null and merchantId !=''"> | ||||
| and c.`merchant_id` = #{merchantId} | and c.`merchant_id` = #{merchantId} | ||||
| </if> | </if> | ||||
| <if test="orderId != null and orderId!=''"> | <if test="orderId != null and orderId!=''"> | ||||
| and o.`id` = #{orderId} | and o.`id` = #{orderId} | ||||
| </if> | </if> | ||||
| <if test="couponId != null and couponId!=''"> | |||||
| and o.`coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test="cUserId != null and cUserId !=''"> | <if test="cUserId != null and cUserId !=''"> | ||||
| and o.`c_user_id` = #{cUserId} | and o.`c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| <if test="status != null and status != ''" > | <if test="status != null and status != ''" > | ||||
| and o.status=#{status} | |||||
| and o.`status` = #{status} | |||||
| </if> | </if> | ||||
| <if test="couponStatus != null and couponStatus.trim() != ''"> | <if test="couponStatus != null and couponStatus.trim() != ''"> | ||||
| and o.coupon_status=#{couponStatus} | |||||
| and o.`coupon_status` = #{couponStatus} | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| <choose> | <choose> | ||||
| @@ -135,7 +141,7 @@ | |||||
| </choose> | </choose> | ||||
| </select> | </select> | ||||
| <select id="queryObject" resultType="hashmap"> | |||||
| <select id="queryObject" parameterType="com.simple.domain.vo.OrderVo" resultType="hashmap"> | |||||
| select o.id, o.coupon_id, c.title, c.sub_title, v.verification_date, | 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.c_user_id, o.create_date, u.phone, u.nick_name, c.price, c.sale_price, | ||||
| o.status, o.coupon_status, c.remark | o.status, o.coupon_status, c.remark | ||||
| @@ -144,20 +150,26 @@ | |||||
| left join wx_coupon_verify v on v.coupon_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 | left join wx_c_user u on u.id = o.c_user_id | ||||
| <where> | <where> | ||||
| <if test="tenantId != null and tenantId !=''"> | |||||
| and c.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test="merchantId != null and merchantId !=''"> | <if test="merchantId != null and merchantId !=''"> | ||||
| and c.`merchant_id` = #{merchantId} | and c.`merchant_id` = #{merchantId} | ||||
| </if> | </if> | ||||
| <if test="orderId != null and orderId!=''"> | <if test="orderId != null and orderId!=''"> | ||||
| and o.`id` = #{orderId} | and o.`id` = #{orderId} | ||||
| </if> | </if> | ||||
| <if test="couponId != null and couponId!=''"> | |||||
| and o.`coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test="cUserId != null and cUserId !=''"> | <if test="cUserId != null and cUserId !=''"> | ||||
| and o.`c_user_id` = #{cUserId} | and o.`c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| <if test="status != null and status != ''" > | <if test="status != null and status != ''" > | ||||
| and o.status=#{status} | |||||
| and o.`status` = #{status} | |||||
| </if> | </if> | ||||
| <if test="couponStatus != null and couponStatus.trim() != ''"> | <if test="couponStatus != null and couponStatus.trim() != ''"> | ||||
| and o.coupon_status=#{couponStatus} | |||||
| and o.`coupon_status` = #{couponStatus} | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| <choose> | <choose> | ||||