Browse Source

Merge remote-tracking branch 'origin/master'

master
wangpengfei 1 year ago
parent
commit
021de0cf55
  1. 158
      docs/databases/将卡中数据导入到账户中20240123.sql
  2. 31
      src/main/java/com/yxt/yythmall/adminapi/AdminReserveRest.java
  3. 4
      src/main/java/com/yxt/yythmall/biz/smscoupon/SmsCouponController.java
  4. 37
      src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveOrderVo.java
  5. 7
      src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.java
  6. 31
      src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.xml
  7. 62
      src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderService.java

158
docs/databases/将卡中数据导入到账户中20240123.sql

@ -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

31
src/main/java/com/yxt/yythmall/adminapi/AdminReserveRest.java

@ -1,33 +1,28 @@
package com.yxt.yythmall.adminapi;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.yythmall.adminapi.vo.PmsBrandVo;
import com.yxt.yythmall.adminapi.vo.PmsProductCategoryVo;
import com.yxt.yythmall.adminservice.AdminMallService;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.yythmall.api.lpkreserveorder.LpkReserveOrderQuery;
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.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.RestController;
import java.util.List;
@RestController("com.yxt.yythmall.adminapi.AdminReserveRest")
@RequestMapping("/adminapi/reserve")
public class AdminReserveRest {
@Autowired
private AdminMallService adminMallService;
private VegeCellarReserveOrderService vegeCellarReserveOrderService;
@GetMapping(value = "/listAllBrand")
public ResultBean<List<PmsBrandVo>> listAllBrand() {
ResultBean rb = ResultBean.fireFail();
List<PmsBrandVo> list = adminMallService.listBrand();
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);
@ApiOperation("精确到客户的预约单列表")
@PostMapping("/pageOfCustomer")
public ResultBean<PagerVo<ReserveOrderVo>> orderList(@RequestBody PagerQuery<LpkReserveOrderQuery> pq) {
return vegeCellarReserveOrderService.pageOfCustomer(pq);
}
}

4
src/main/java/com/yxt/yythmall/biz/smscoupon/SmsCouponController.java

@ -39,7 +39,9 @@ public class SmsCouponController {
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
) {
try {
return new CommonResult().success(ISmsCouponService.page(new Page<SmsCoupon>(pageNum, pageSize), new QueryWrapper<>(entity)));
return new CommonResult().success(
ISmsCouponService.page(new Page<SmsCoupon>(pageNum, pageSize), new QueryWrapper<>(entity).orderByDesc("id"))
);
} catch (Exception e) {
log.error("根据条件查询所有优惠卷表列表:%s", e.getMessage(), e);
}

37
src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveOrderVo.java

@ -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;
}

7
src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.java

@ -3,16 +3,13 @@ package com.yxt.yythmall.biz.vegecallerreserveorder;
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.common.core.vo.PagerVo;
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrder;
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderQuery;
import com.yxt.yythmall.api.vegecallerreserveorder.VegeCellarReserveOrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author wangpengfei
@ -28,6 +25,8 @@ public interface VegeCellarReserveOrderMapper extends BaseMapper<VegeCellarReser
//
//// IPage<VegeCellarReserveOrderCardVo> orderListByUserSid(IPage<VegeCellarReserveOrder> page, @Param(Constants.WRAPPER) QueryWrapper<VegeCellarReserveOrder> qw);
IPage<VegeCellarReserveOrderVo> orderListByUserSid(IPage<VegeCellarReserveOrder> page, @Param("query") VegeCellarReserveOrderQuery query);
PagerVo<ReserveOrderVo> pageOfCustomer(IPage<VegeCellarReserveOrder> page,QueryWrapper<VegeCellarReserveOrder> qw);
//
// List<ReserveOrderExport> exportExcel(@Param("qw") VegeCellarReserveOrderQuery qw);
// List<ReserveOrderExportByStore> exportExcelByStore(@Param(Constants.WRAPPER) QueryWrapper<VegeCellarReserveOrderQuery> qw);

31
src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.xml

@ -447,4 +447,35 @@
${ew.sqlSegment}
</where>
</select>
<select id="pageOfCustomer" resultType="com.yxt.yythmall.biz.vegecallerreserveorder.ReserveOrderVo">
select
date_format(vo.reserveDate,'%Y-%m-%d') reserveDate,
vo.customerSid,
vo.storeSid,
max(ls.name) storeName,
max(ls.linker) storeLinker,
max(ls.phone) storePhone,
max(ls.address) storeAddress,
max(vo.affiliation) affiliation,
max(vo.userName) userName,
max(vo.userPhone) userPhone,
max(lb.sid) bankSid,
max(lb.name) bankName,
max(lb.linker) bankLinker,
max(lb.linkPhone) bankPhone,
max(lb.address) bankAddress,
vd.goodsSid,
max(vd.goodsName) goodsName,
sum(vd.goodsNumber) goodsNumber
from vege_cellar_reserve_order vo
LEFT JOIN lpk_store ls ON ls.sid=vo.storeSid
LEFT JOIN lpk_bank lb ON lb.sid=ls.bankSid
left join vege_cellar_reserve_details vd on vo.sid=vd.orderSid
left join lpk_goods lg on vd.goodsSid=lg.sid
<where>
${ew.sqlSegment}
</where>
GROUP BY vo.reserveDate,vo.storeSid,vo.customerSid,vd.goodsSid
</select>
</mapper>

62
src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderService.java

@ -3,47 +3,29 @@ package com.yxt.yythmall.biz.vegecallerreserveorder;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.common.base.config.component.FileUploadComponent;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.base.utils.StringUtils;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.yythmall.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
import com.yxt.yythmall.api.lpkgiftcard.AppletVo;
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo;
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
import com.yxt.yythmall.api.lpkreserveorder.LpkReserveOrderQuery;
import com.yxt.yythmall.api.lpkstore.LpkStore;
import com.yxt.yythmall.api.lpkstore.StoreSelect;
import com.yxt.yythmall.api.vegecallerreservedetails.VegeCellarReserveDetails;
import com.yxt.yythmall.api.vegecallerreserveorder.*;
import com.yxt.yythmall.biz.lpkgiftbaggoods.LpkGiftBagGoodsService;
import com.yxt.yythmall.biz.lpkgiftcard.LpkGiftCardMapper;
import com.yxt.yythmall.biz.lpkgiftcard.generateRule.UniqueIdGenerator;
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
import com.yxt.yythmall.biz.lpkstore.LpkStoreService;
import com.yxt.yythmall.biz.vegecallerreservedetail.VegeCellarReserveDetailsService;
import com.yxt.yythmall.utils.StyleUtils;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -64,6 +46,7 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
// private FileUploadComponent fileUploadComponent;
@Autowired
private LpkGoodsService lpkGoodsService;
// @Autowired
// private HttpServletResponse response;
//
@ -88,6 +71,7 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
rb = vegeCellarReserveDetailsService.submissionDetail(dto);
return rb;
}
public ResultBean addGoodsOrder(VegeCellarReserveOrderDto dto) {
ResultBean rb = new ResultBean().fail();
boolean b = isSatAndSun(dto.getReserveDate());
@ -108,6 +92,7 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
vegeCellarReserveDetailsService.addDetail(dto);
return rb.success().setData("预约成功");
}
public ResultBean minusGoodsOrder(VegeCellarReserveOrderDto dto) {
ResultBean rb = new ResultBean().fail();
boolean b = isSatAndSun(dto.getReserveDate());
@ -130,9 +115,9 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
}
public boolean isSatAndSun(String date) {
DateTime dateTime = DateUtil.parse(date);; // 获取当前时间
DateTime dateTime = DateUtil.parse(date);
; // 获取当前时间
int dayOfWeek = dateTime.dayOfWeekEnum().getValue();// 获取星期几(1-7)
System.out.println(dayOfWeek);
if (dayOfWeek == 1 || dayOfWeek == 7) {
@ -141,6 +126,7 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
return true;
}
}
// @Test
// public void isSatAndSun(){
// String date="2023-12-11";
@ -722,4 +708,36 @@ public class VegeCellarReserveOrderService extends MybatisBaseService<VegeCellar
// return new ResultBean().success().setData(baseMapper.selOrderByCardSid(sid));
// }
private QueryWrapper<VegeCellarReserveOrder> buildQuery(LpkReserveOrderQuery query) {
QueryWrapper<VegeCellarReserveOrder> qw = new QueryWrapper<>();
if (StrUtil.isNotBlank(query.getStartDate())) {
qw.ge("date_format(vo.reserveDate,'%Y-%m-%d')", query.getStartDate());
}
if (StrUtil.isNotBlank(query.getEndDate())) {
qw.le("date_format(vo.reserveDate,'%Y-%m-%d')", query.getEndDate());
}
if (StrUtil.isNotBlank(query.getBankSid())) {
qw.eq("lb.sid", query.getBankSid());
}
if (StrUtil.isNotBlank(query.getStore())) {
qw.eq("vo.storeSid", query.getStore());
}
if (StrUtil.isNotBlank(query.getCardType())) {
qw.eq("vo.affiliation", query.getCardType());
}
qw.orderByAsc("vo.reserveDate");
return qw;
}
public ResultBean<PagerVo<ReserveOrderVo>> pageOfCustomer(PagerQuery<LpkReserveOrderQuery> pq) {
ResultBean rb = ResultBean.fireFail();
LpkReserveOrderQuery query = pq.getParams();
QueryWrapper<VegeCellarReserveOrder> qw = buildQuery(query);
IPage<VegeCellarReserveOrder> page = PagerUtil.queryToPage(pq);
PagerVo<ReserveOrderVo> pagerVo = baseMapper.pageOfCustomer(page,qw);
return rb.success().setData(pagerVo);
}
}

Loading…
Cancel
Save