30 changed files with 864 additions and 22 deletions
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:10 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrder { |
||||
|
private String id; |
||||
|
private String sid= UUID.randomUUID().toString();; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String mainSid; |
||||
|
private int payStatus; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date payTime; |
||||
|
private int cardNumber; |
||||
|
private int source; |
||||
|
private String totalTee; |
||||
|
private String openId; |
||||
|
private String userSid; |
||||
|
private String name; |
||||
|
private int timeRemarks; |
||||
|
private String returnUrl; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import com.yxt.yyth.api.ordorderdetails.OrdOrderDetailVo; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrderDto implements Dto { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String mainSid; |
||||
|
private int payStatus; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date payTime; |
||||
|
private int cardNumber; |
||||
|
private int source; |
||||
|
private String totalTee; |
||||
|
private String openId; |
||||
|
private String userSid; |
||||
|
private String name; |
||||
|
private int timeRemarks; |
||||
|
private String returnUrl; |
||||
|
private String customerSid; |
||||
|
private List<OrdOrderDetailVo> ordOrderDetailsVoList; |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrderQuery implements Query { |
||||
|
private String startDate; //开始时间
|
||||
|
private String endDate; //结束时间
|
||||
|
private String countNumber; //总数
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrderVo implements Vo { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String mainSid; |
||||
|
private int payStatus; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date payTime; |
||||
|
private int cardNumber; |
||||
|
private int source; |
||||
|
private String totalTee; |
||||
|
private String openId; |
||||
|
private String userSid; |
||||
|
private String name; |
||||
|
private int timeRemarks; |
||||
|
private String returnUrl; |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/1/8 17:12 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrderParams { |
||||
|
private String mainSid; |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/1/8 17:09 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrderUrl { |
||||
|
private String page=null; |
||||
|
private OrderParams params; |
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2024/1/8 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class PayOrderVo { |
||||
|
@ApiModelProperty("主订单sid") |
||||
|
private String mainSid; |
||||
|
@ApiModelProperty("订单编号") |
||||
|
private String outTradeNo; |
||||
|
@ApiModelProperty("订单创建时间") |
||||
|
private String createTime; |
||||
|
@ApiModelProperty("商品总价格") |
||||
|
private String price; |
||||
|
@ApiModelProperty("商品名称") |
||||
|
private String goods; |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/1/8 17:15 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PayParams { |
||||
|
private String mainSid; |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/1/8 17:08 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PayResult { |
||||
|
private String price; |
||||
|
private String goods; |
||||
|
private String remainder; |
||||
|
private String orderId; |
||||
|
private OrderUrl order_url; |
||||
|
private PayUrl pay_url; |
||||
|
private TradeNoUrl trade_no_url; |
||||
|
private String[] bus; |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/1/8 17:10 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PayUrl { |
||||
|
private String url; |
||||
|
private PayParams params; |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/1/8 17:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class TradeNoUrl { |
||||
|
private String url; |
||||
|
private TradeParams params; |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.yyth.api.ordorder; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/1/8 17:17 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class TradeParams { |
||||
|
private String trade_no; |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.yxt.yyth.api.ordorderdetails; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:10 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrderDetail { |
||||
|
private String id; |
||||
|
private String sid= UUID.randomUUID().toString(); |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String orderSid; |
||||
|
private String goodsSid; |
||||
|
private String goodsName; |
||||
|
private int partNumber; |
||||
|
private double numofPart; |
||||
|
private double priceUnit; |
||||
|
private double pricePart; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.yyth.api.ordorderdetails; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrderDetailDto implements Dto { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String orderSid; |
||||
|
private String goodsSid; |
||||
|
private String goodsName; |
||||
|
private int partNumber; |
||||
|
private double numofPart; |
||||
|
private double priceUnit; |
||||
|
private double pricePart; |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.yxt.yyth.api.ordorderdetails; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrderDetailQuery implements Query { |
||||
|
private String startDate; //开始时间
|
||||
|
private String endDate; //结束时间
|
||||
|
private String countNumber; //总数
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.yyth.api.ordorderdetails; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/12/8 9:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class OrdOrderDetailVo implements Vo { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String orderSid; |
||||
|
private String goodsSid; |
||||
|
private String goodsName; |
||||
|
private int partNumber; |
||||
|
private double numofPart; |
||||
|
private double priceUnit; |
||||
|
private double pricePart; |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.yxt.yyth.biz.ordorder; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.yyth.api.empreserveorder.*; |
||||
|
import com.yxt.yyth.api.ordorder.OrdOrder; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/23 10:36 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface OrdOrderMapper extends BaseMapper<OrdOrder> { |
||||
|
|
||||
|
} |
@ -0,0 +1,114 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.yyth.biz.ordorder.OrdOrderMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
|
||||
|
<select id="storeListPage" resultType="com.yxt.yyth.api.lpkstore.LpkStoreVo"> |
||||
|
select |
||||
|
sid, |
||||
|
date_format(createTime, '%Y-%m-%d') as createTime, |
||||
|
code, |
||||
|
`name`, |
||||
|
address, |
||||
|
phone, |
||||
|
businessHours |
||||
|
from lpk_store |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="orderList" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
o.userName, |
||||
|
o.userPhone, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
c.`code` |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="orderListByStore" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
s.`name` as store, |
||||
|
s.sid as storeSid |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="orderByCardSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo"> |
||||
|
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
c.`code`, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
o.sid as orderSid |
||||
|
FROM lpk_reserve_order AS o |
||||
|
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
WHERE o.cardSid = #{sid} |
||||
|
</select> |
||||
|
<select id="orderListByUserSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo"> |
||||
|
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
c.`code`, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
o.cardSid as cardSid, |
||||
|
o.sid as orderSid, |
||||
|
o.userName, |
||||
|
o.userPhone,c.serialNumber as serialNumber, |
||||
|
o.sid |
||||
|
FROM lpk_reserve_order AS o |
||||
|
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="exportExcel" resultType="com.yxt.yyth.api.lpkreserveorder.ReserveOrderExport"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
o.userName, |
||||
|
o.userPhone, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
c.`code` |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="exportExcelByStore" resultType="com.yxt.yyth.api.lpkreserveorder.ReserveOrderExportByStore"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
s.`name` as store, |
||||
|
s.sid as storeSid |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.yyth.biz.ordorder; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.yyth.api.empcardgift.EmpCardGiftDto; |
||||
|
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderCardVo; |
||||
|
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderQuery; |
||||
|
import com.yxt.yyth.api.empreserveorder.EmpReserveOrderVo; |
||||
|
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto; |
||||
|
import com.yxt.yyth.api.ordorder.OrdOrderDto; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/23 10:35 |
||||
|
*/ |
||||
|
@Api(tags = "预约订单信息") |
||||
|
@RestController |
||||
|
@RequestMapping("/empsreservoorder") |
||||
|
public class OrdOrderRest { |
||||
|
@Autowired |
||||
|
OrdOrderService ordOrderService; |
||||
|
|
||||
|
|
||||
|
@PostMapping("/createOrder") |
||||
|
@ApiOperation(value = "创建订单") |
||||
|
public ResultBean createOrder(@RequestBody OrdOrderDto dto) { |
||||
|
return ordOrderService.createOrder(dto); |
||||
|
} |
||||
|
} |
@ -0,0 +1,123 @@ |
|||||
|
package com.yxt.yyth.biz.ordorder; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerVo; |
||||
|
import com.yxt.yyth.api.ordorder.*; |
||||
|
import com.yxt.yyth.api.ordorderdetails.OrdOrderDetail; |
||||
|
import com.yxt.yyth.biz.lpkcustomer.LpkCustomerService; |
||||
|
import com.yxt.yyth.biz.ordorderdetails.OrdOrderDetailService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/23 10:36 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder> { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
OrdOrderDetailService ordOrderDetailsService; |
||||
|
@Autowired |
||||
|
LpkCustomerService lpkCustomerService; |
||||
|
|
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public ResultBean createOrder(OrdOrderDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PayResult result=new PayResult(); |
||||
|
Map<String,Object>map =new HashMap<>(); |
||||
|
LpkCustomerVo vo= lpkCustomerService.getCustomerInfo(dto.getCustomerSid()).getData(); |
||||
|
Map<String, Object> sendBody=buildMessageBody( vo.getSid(), vo.getWxMpOpenid(),dto.getTotalTee(),dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"等"+(dto.getOrdOrderDetailsVoList().size()-1)+"件商品"); |
||||
|
ResponseEntity<ResultBean> postForEntity=new RestTemplate().postForEntity("https://supervise.yxtsoft.com/wxPay/order/createOrder", sendBody,ResultBean.class); |
||||
|
|
||||
|
ResultBean<PayOrderVo> rb1= postForEntity.getBody(); |
||||
|
LinkedHashMap rb2= (LinkedHashMap)postForEntity.getBody().getData(); |
||||
|
if(!rb1.getCode().equals("200")){ |
||||
|
return rb1; |
||||
|
} |
||||
|
OrdOrder order=new OrdOrder(); |
||||
|
BeanUtil.copyProperties(dto, order, "id", "sid"); |
||||
|
|
||||
|
order.setMainSid(rb2.get("mainSid").toString()); |
||||
|
order.setPayStatus(1); |
||||
|
order.setPayTime(new Date()); |
||||
|
order.setCardNumber(dto.getCardNumber()); |
||||
|
order.setSource(0); |
||||
|
order.setUserSid(vo.getSid()); |
||||
|
order.setOpenId(vo.getWxMpOpenid()); |
||||
|
order.setTotalTee(dto.getTotalTee()); |
||||
|
if(dto.getOrdOrderDetailsVoList().size()>1){ |
||||
|
order.setName(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"等"+(dto.getOrdOrderDetailsVoList().size()-1)+"件商品"); |
||||
|
} |
||||
|
// order.setName("商品");
|
||||
|
order.setTimeRemarks(10); |
||||
|
order.setReturnUrl("https://supervise.yxtsoft.com/lpkapi/empcardgift/generateTopEmpCard?mainSid="); |
||||
|
baseMapper.insert(order); |
||||
|
|
||||
|
|
||||
|
List<OrdOrderDetail> ordOrders=new ArrayList<>(); |
||||
|
dto.getOrdOrderDetailsVoList().forEach(s->{ |
||||
|
OrdOrderDetail ordOrderDetails=new OrdOrderDetail(); |
||||
|
BeanUtil.copyProperties(s, ordOrderDetails, "id", "sid"); |
||||
|
ordOrderDetails.setOrderSid(order.getSid()); |
||||
|
|
||||
|
ordOrders.add(ordOrderDetails); |
||||
|
|
||||
|
}); |
||||
|
ordOrderDetailsService.saveBatch(ordOrders); |
||||
|
if(dto.getOrdOrderDetailsVoList().size()>1){ |
||||
|
result.setGoods(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"等"+(dto.getOrdOrderDetailsVoList().size()-1)+"件商品"); |
||||
|
}else{ |
||||
|
result.setGoods(dto.getOrdOrderDetailsVoList().get(0).getGoodsName().toString()+"商品"); |
||||
|
} |
||||
|
|
||||
|
result.setPrice(dto.getTotalTee()); |
||||
|
// result.setOrderId(rbData.getOutTradeNo());
|
||||
|
result.setOrderId(rb2.get("outTradeNo").toString()); |
||||
|
result.setRemainder(String.valueOf(10*60)); |
||||
|
|
||||
|
PayUrl payUrl=new PayUrl(); |
||||
|
payUrl.setUrl("https://supervise.yxtsoft.com/wxPay/order/pay"); |
||||
|
PayParams aVoid=new PayParams(); |
||||
|
aVoid.setMainSid(rb2.get("mainSid").toString()); |
||||
|
payUrl.setParams(aVoid); |
||||
|
|
||||
|
OrderUrl orderUrl=new OrderUrl(); |
||||
|
orderUrl.setPage(""); |
||||
|
OrderParams orderParams=new OrderParams(); |
||||
|
orderParams.setMainSid(""); |
||||
|
orderUrl.setParams(orderParams); |
||||
|
|
||||
|
TradeNoUrl tradeNoUrl=new TradeNoUrl(); |
||||
|
tradeNoUrl.setUrl("https://supervise.yxtsoft.com/wxPay/order/orderQuery"); |
||||
|
TradeParams tradeParams=new TradeParams(); |
||||
|
tradeParams.setTrade_no(rb2.get("mainSid").toString()); |
||||
|
tradeNoUrl.setParams(tradeParams); |
||||
|
|
||||
|
result.setOrder_url(orderUrl); |
||||
|
result.setPay_url(payUrl); |
||||
|
// result
|
||||
|
return rb.success().setData(result); |
||||
|
} |
||||
|
private static Map<String, Object> buildMessageBody(String userSid,String openId,String totalTee,String name){ |
||||
|
//拼接base参数
|
||||
|
Map<String, Object> mp_template_msg = new HashMap<>(); |
||||
|
mp_template_msg.put("source", "0"); |
||||
|
mp_template_msg.put("totalTee", totalTee); |
||||
|
mp_template_msg.put("openId", openId); |
||||
|
mp_template_msg.put("userSid", userSid); |
||||
|
mp_template_msg.put("name", name); |
||||
|
mp_template_msg.put("timeRemarks", "10"); |
||||
|
mp_template_msg.put("returnUrl", "https://supervise.yxtsoft.com/lpkapi/empcardgift/generateTopEmpCard?mainSid="); |
||||
|
return mp_template_msg; |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.yxt.yyth.biz.ordorderdetails; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.yxt.yyth.api.ordorderdetails.OrdOrderDetail; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/23 10:36 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface OrdOrderDetailMapper extends BaseMapper<OrdOrderDetail> { |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,114 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.yyth.biz.ordorderdetails.OrdOrderDetailMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
|
||||
|
<select id="storeListPage" resultType="com.yxt.yyth.api.lpkstore.LpkStoreVo"> |
||||
|
select |
||||
|
sid, |
||||
|
date_format(createTime, '%Y-%m-%d') as createTime, |
||||
|
code, |
||||
|
`name`, |
||||
|
address, |
||||
|
phone, |
||||
|
businessHours |
||||
|
from lpk_store |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="orderList" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
o.userName, |
||||
|
o.userPhone, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
c.`code` |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="orderListByStore" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
s.`name` as store, |
||||
|
s.sid as storeSid |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="orderByCardSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo"> |
||||
|
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
c.`code`, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
o.sid as orderSid |
||||
|
FROM lpk_reserve_order AS o |
||||
|
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
WHERE o.cardSid = #{sid} |
||||
|
</select> |
||||
|
<select id="orderListByUserSid" resultType="com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo"> |
||||
|
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
c.`code`, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
o.cardSid as cardSid, |
||||
|
o.sid as orderSid, |
||||
|
o.userName, |
||||
|
o.userPhone,c.serialNumber as serialNumber, |
||||
|
o.sid |
||||
|
FROM lpk_reserve_order AS o |
||||
|
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="exportExcel" resultType="com.yxt.yyth.api.lpkreserveorder.ReserveOrderExport"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
o.userName, |
||||
|
o.userPhone, |
||||
|
s.`name` as store, |
||||
|
b.`name` as bagName, |
||||
|
c.`code` |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="exportExcelByStore" resultType="com.yxt.yyth.api.lpkreserveorder.ReserveOrderExportByStore"> |
||||
|
select |
||||
|
o.sid, |
||||
|
date_format(o.reserveDate, '%Y-%m-%d') as reserveDate, |
||||
|
s.`name` as store, |
||||
|
s.sid as storeSid |
||||
|
from lpk_reserve_order as o |
||||
|
left join lpk_store as s on o.storeSid = s.sid |
||||
|
LEFT JOIN lpk_giftcard AS c ON o.cardSid = c.sid |
||||
|
LEFT JOIN lpk_giftbag AS b ON c.giftbagSid = b.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,15 @@ |
|||||
|
package com.yxt.yyth.biz.ordorderdetails; |
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/23 10:35 |
||||
|
*/ |
||||
|
@Api(tags = "预约订单信息") |
||||
|
@RestController |
||||
|
@RequestMapping("/empsreservoorder") |
||||
|
public class OrdOrderDetailRest { |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.yxt.yyth.biz.ordorderdetails; |
||||
|
|
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.yyth.api.ordorderdetails.OrdOrderDetail; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/23 10:36 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class OrdOrderDetailService extends MybatisBaseService<OrdOrderDetailMapper, OrdOrderDetail> { |
||||
|
|
||||
|
} |
Loading…
Reference in new issue