7 changed files with 315 additions and 75 deletions
@ -0,0 +1,158 @@ |
|||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
-- 个人卡 |
||||
|
CREATE TABLE tmp_cust_goods( |
||||
|
SELECT |
||||
|
r.wxMpOpenid, |
||||
|
d.customerSid, |
||||
|
d.bindDate, |
||||
|
d.giftbagSid, |
||||
|
d.serialNumber, |
||||
|
d.code, |
||||
|
s.goodsSid, |
||||
|
s.goodsNumber, |
||||
|
e.NAME AS goodsName, |
||||
|
'个人卡' cardtype |
||||
|
FROM lpk_giftcard d |
||||
|
LEFT JOIN lpk_customer r ON r.sid = d.customerSid |
||||
|
LEFT JOIN lpk_giftbag_goods s ON s.giftbagSid=d.giftbagSid |
||||
|
LEFT JOIN lpk_goods e ON e.sid = s.goodsSid |
||||
|
WHERE d.customerSid IS NOT NULL AND d.customerSid <> '' |
||||
|
ORDER BY r.wxMpOpenid |
||||
|
); |
||||
|
|
||||
|
select count(1) from tmp_cust_goods; -- 5080 |
||||
|
|
||||
|
-- 企业卡 |
||||
|
INSERT INTO tmp_cust_goods |
||||
|
SELECT |
||||
|
r.wxMpOpenid, |
||||
|
d.customerSid, |
||||
|
d.bindDate, |
||||
|
d.giftbagSid, |
||||
|
d.serialNumber, |
||||
|
d.code, |
||||
|
s.goodsSid, |
||||
|
s.goodsNumber, |
||||
|
e.NAME AS goodsName, |
||||
|
'企业卡' cardtype |
||||
|
FROM emp_card d |
||||
|
LEFT JOIN lpk_customer r ON r.sid = d.customerSid |
||||
|
LEFT JOIN lpk_giftbag_goods s ON s.giftbagSid=d.giftbagSid |
||||
|
LEFT JOIN lpk_goods e ON e.sid = s.goodsSid |
||||
|
WHERE d.customerSid IS NOT NULL AND d.customerSid <> '' |
||||
|
ORDER BY r.wxMpOpenid; |
||||
|
|
||||
|
select count(1) from tmp_cust_goods; -- 5256 |
||||
|
|
||||
|
-- 购买卡 |
||||
|
INSERT INTO tmp_cust_goods |
||||
|
SELECT |
||||
|
r.wxMpOpenid, |
||||
|
d.customerSid, |
||||
|
d.bindDate, |
||||
|
d.sid, |
||||
|
d.serialNumber, |
||||
|
d.code, |
||||
|
s.goodsSid, |
||||
|
s.goodsNumber, |
||||
|
e.NAME AS goodsName, |
||||
|
'购买卡' cardtype |
||||
|
FROM emp_card_gift d |
||||
|
LEFT JOIN lpk_customer r ON r.sid = d.customerSid |
||||
|
LEFT JOIN emp_card_gift_goods s ON s.empCardGiftSid=d.sid |
||||
|
LEFT JOIN lpk_goods e ON e.sid = s.goodsSid |
||||
|
WHERE d.customerSid IS NOT NULL AND d.customerSid <> '' AND d.isSenior = '1' |
||||
|
ORDER BY r.wxMpOpenid; |
||||
|
|
||||
|
select count(1) from tmp_cust_goods; -- 5325 |
||||
|
|
||||
|
-- 转赠卡 |
||||
|
INSERT INTO tmp_cust_goods |
||||
|
SELECT |
||||
|
r.wxMpOpenid, |
||||
|
d.customerSid, |
||||
|
d.bindDate, |
||||
|
d.sid, |
||||
|
d.serialNumber, |
||||
|
d.code, |
||||
|
s.goodsSid, |
||||
|
s.goodsNumber, |
||||
|
e.NAME AS goodsName, |
||||
|
'转赠卡' cardtype |
||||
|
FROM emp_card_gift d |
||||
|
LEFT JOIN lpk_customer r ON r.sid = d.customerSid |
||||
|
LEFT JOIN emp_card_gift_goods s ON s.empCardGiftSid=d.sid |
||||
|
LEFT JOIN lpk_goods e ON e.sid = s.goodsSid |
||||
|
WHERE d.customerSid IS NOT NULL AND d.customerSid <> '' AND d.isSenior = '2' |
||||
|
ORDER BY r.wxMpOpenid; |
||||
|
|
||||
|
select count(1) from tmp_cust_goods; -- 5652 |
||||
|
|
||||
|
|
||||
|
-- 预约提货,数量为负值 |
||||
|
INSERT INTO tmp_cust_goods |
||||
|
SELECT |
||||
|
r.wxMpOpenid, |
||||
|
d.customerSid, |
||||
|
d.reserveDate, |
||||
|
d.sid, |
||||
|
d.storeSid, |
||||
|
d.cardCode, |
||||
|
s.goodsSid, |
||||
|
-s.goodsNumber AS goodsNumber, |
||||
|
e.NAME AS goodsName, |
||||
|
d.cardType cardtype |
||||
|
FROM lpk_reserve_order d |
||||
|
LEFT JOIN lpk_customer r ON r.sid = d.customerSid |
||||
|
LEFT JOIN lpk_reserve_order_goods s ON s.orderSid=d.sid |
||||
|
LEFT JOIN lpk_goods e ON e.sid = s.goodsSid |
||||
|
WHERE 1=1 |
||||
|
ORDER BY r.wxMpOpenid; |
||||
|
|
||||
|
select count(1) from tmp_cust_goods; -- 10917 |
||||
|
|
||||
|
|
||||
|
-- 赠出的卡,数量为负值 |
||||
|
INSERT INTO tmp_cust_goods |
||||
|
SELECT |
||||
|
r.wxMpOpenid, |
||||
|
d.empCardCustomerSid, |
||||
|
d.grantDate, |
||||
|
d.sid, |
||||
|
d.serialNumber, |
||||
|
d.code, |
||||
|
s.goodsSid, |
||||
|
-s.goodsNumber AS goodsNumber, |
||||
|
e.NAME AS goodsName, |
||||
|
'赠出' cardtype |
||||
|
FROM emp_card_gift d |
||||
|
LEFT JOIN lpk_customer r ON r.sid = d.empCardCustomerSid |
||||
|
LEFT JOIN emp_card_gift_goods s ON s.empCardGiftSid=d.sid |
||||
|
LEFT JOIN lpk_goods e ON e.sid = s.goodsSid |
||||
|
WHERE d.empCardCustomerSid IS NOT NULL AND d.empCardCustomerSid <> '' AND d.isSenior = '2' |
||||
|
ORDER BY r.wxMpOpenid; |
||||
|
|
||||
|
select count(1) from tmp_cust_goods; -- 11292 |
||||
|
|
||||
|
select * from tmp_cust_goods; |
||||
|
|
||||
|
delete from vegetable_cellar where 1=1; |
||||
|
|
||||
|
-- 统计 |
||||
|
INSERT INTO vegetable_cellar(sid,customerSid,goodsSid,goodsNumber) |
||||
|
SELECT |
||||
|
UUID(), |
||||
|
customerSid, |
||||
|
goodsSid, |
||||
|
SUM(goodsNumber) AS goodsNumber |
||||
|
FROM tmp_cust_goods |
||||
|
GROUP BY customerSid,goodsSid |
||||
|
HAVING goodsNumber>0 |
||||
|
|
||||
|
|
||||
|
|
||||
|
update vegetable_cellar vc set affiliation=(select brandId from lpk_goods lg where vc.goodsSid=lg.sid) where 1=1 |
||||
|
|
@ -1,33 +1,28 @@ |
|||||
package com.yxt.yythmall.adminapi; |
package com.yxt.yythmall.adminapi; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
import com.yxt.common.core.result.ResultBean; |
import com.yxt.common.core.result.ResultBean; |
||||
import com.yxt.yythmall.adminapi.vo.PmsBrandVo; |
import com.yxt.common.core.vo.PagerVo; |
||||
import com.yxt.yythmall.adminapi.vo.PmsProductCategoryVo; |
import com.yxt.yythmall.api.lpkreserveorder.LpkReserveOrderQuery; |
||||
import com.yxt.yythmall.adminservice.AdminMallService; |
import com.yxt.yythmall.biz.vegecallerreserveorder.ReserveOrderVo; |
||||
|
import com.yxt.yythmall.biz.vegecallerreserveorder.VegeCellarReserveOrderService; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
@RestController("com.yxt.yythmall.adminapi.AdminReserveRest") |
@RestController("com.yxt.yythmall.adminapi.AdminReserveRest") |
||||
@RequestMapping("/adminapi/reserve") |
@RequestMapping("/adminapi/reserve") |
||||
public class AdminReserveRest { |
public class AdminReserveRest { |
||||
|
|
||||
@Autowired |
@Autowired |
||||
private AdminMallService adminMallService; |
private VegeCellarReserveOrderService vegeCellarReserveOrderService; |
||||
|
|
||||
@GetMapping(value = "/listAllBrand") |
@ApiOperation("精确到客户的预约单列表") |
||||
public ResultBean<List<PmsBrandVo>> listAllBrand() { |
@PostMapping("/pageOfCustomer") |
||||
ResultBean rb = ResultBean.fireFail(); |
public ResultBean<PagerVo<ReserveOrderVo>> orderList(@RequestBody PagerQuery<LpkReserveOrderQuery> pq) { |
||||
List<PmsBrandVo> list = adminMallService.listBrand(); |
return vegeCellarReserveOrderService.pageOfCustomer(pq); |
||||
return rb.success().setData(list); |
|
||||
} |
|
||||
@GetMapping(value = "/listAllCategory") |
|
||||
public ResultBean<List<PmsBrandVo>> listAllCategory() { |
|
||||
ResultBean rb = ResultBean.fireFail(); |
|
||||
List<PmsProductCategoryVo> list = adminMallService.listAllCategory(); |
|
||||
return rb.success().setData(list); |
|
||||
} |
} |
||||
} |
} |
||||
|
@ -0,0 +1,37 @@ |
|||||
|
package com.yxt.yythmall.biz.vegecallerreserveorder; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import com.yxt.yythmall.api.lpkreserveorder.OrderGoodsVo; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author Fan |
||||
|
* @description |
||||
|
* @date 2023/11/27 15:11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ReserveOrderVo implements Vo { |
||||
|
private String reserveDate; |
||||
|
private String customerSid; |
||||
|
private String storeSid; |
||||
|
private String storeName; |
||||
|
private String storeLinker; |
||||
|
private String storePhone; |
||||
|
private String storeAddress; |
||||
|
private String affiliation; |
||||
|
private String userName; |
||||
|
private String userPhone; |
||||
|
private String bankSid; |
||||
|
private String bankName; |
||||
|
private String bankLinker; |
||||
|
private String bankPhone; |
||||
|
private String bankAddress; |
||||
|
private String goodsSid; |
||||
|
private String goodsName; |
||||
|
private String goodsNumber; |
||||
|
} |
Loading…
Reference in new issue