Browse Source

12/20

master
wangpengfei 1 year ago
parent
commit
64a6bc364f
  1. 2
      src/main/java/com/yxt/yyth/api/empcardgift/EmpGiftAppletVo.java
  2. 1
      src/main/java/com/yxt/yyth/api/lpkreserveorder/LpkReserveOrder.java
  3. 2
      src/main/java/com/yxt/yyth/api/lpkreserveorder/LpkReserveOrderDto.java
  4. 15
      src/main/java/com/yxt/yyth/biz/empcard/EmpCardService.java
  5. 4
      src/main/java/com/yxt/yyth/biz/empcardgift/EmpCardGiftMapper.xml
  6. 6
      src/main/java/com/yxt/yyth/biz/empcardgift/EmpCardGiftRest.java
  7. 27
      src/main/java/com/yxt/yyth/biz/empcardgift/EmpCardGiftService.java
  8. 2
      src/main/java/com/yxt/yyth/biz/empreserveorder/EmpReserveOrderRest.java
  9. 31
      src/main/java/com/yxt/yyth/biz/empreserveorder/EmpReserveOrderService.java
  10. 48
      src/main/java/com/yxt/yyth/biz/empreserveordergoods/EmpReserveOrderGoodsService.java
  11. 3
      src/main/java/com/yxt/yyth/biz/lpkcardbuildrecord/LpkCardBuildRecordMapper.xml
  12. 27
      src/main/java/com/yxt/yyth/biz/lpkgiftcard/LpkGiftCardService.java
  13. 20
      src/main/java/com/yxt/yyth/biz/lpkreserveorder/LpkReserveOrderMapper.xml
  14. 77
      src/main/java/com/yxt/yyth/biz/scheduled/scheduledRest.java
  15. 40
      src/main/java/com/yxt/yyth/config/SaTokenGloableException.java

2
src/main/java/com/yxt/yyth/api/empcardgift/EmpGiftAppletVo.java

@ -47,7 +47,7 @@ public class EmpGiftAppletVo {
private String addressName;
private String isReservation;//是否超过预约时间 0 否 1是
private boolean notRese = true; //是否能预约
private List<EmpReserveOrderCardVo> orderCardVoList;
private List<LpkReserveOrderCardVo> orderCardVoList;
private String value;
private String serialNumber;
private String isEnable;

1
src/main/java/com/yxt/yyth/api/lpkreserveorder/LpkReserveOrder.java

@ -27,5 +27,6 @@ public class LpkReserveOrder{
private String userAddress;
private String storeSid;
private String reserveDate;
private String cardType;//提货类型,1=提货卡;2=福利卡
}

2
src/main/java/com/yxt/yyth/api/lpkreserveorder/LpkReserveOrderDto.java

@ -23,4 +23,6 @@ public class LpkReserveOrderDto implements Dto {
private List<GoodsVo> goodsVos;
private String orderSid;
private String addressName;
private String cardType;//提货类型,1=提货卡;2=福利卡
}

15
src/main/java/com/yxt/yyth/biz/empcard/EmpCardService.java

@ -58,6 +58,8 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
private HttpServletResponse response;
@Value("${image.url.prefix:http://127.0.0.1:8080/upload/}")
private String urlPrefix;
@Value("${weixin.qrcode.empCard}")
String qrUrl;
@ -208,7 +210,8 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
}
public void exportExcel(LpkGiftCardListQuery query) {
String finUrl = "https://supervise.yxtsoft.com/lpkapi?qy=";
// String finUrl = "https://supervise.yxtsoft.com/lpkapi?qy=";
String finUrl = qrUrl;
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>();
qw.eq("1", "1");
if (StringUtils.isNotBlank(query.getState())) {
@ -306,10 +309,10 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
List<EmpCardGiftGoodsVo> l=empCardGiftGoodsService.getGoodsByEmpCardGiftSid(s.getSid()).getData();
if(StringUtils.isNotBlank(s.getCustomerSid())){
EmpCardGift empCardGift=new EmpCardGift();
BeanUtil.copyProperties(EmpCardGiftVos, empCardGift, "id", "sid");
// BeanUtil.copyProperties(EmpCardGiftVos, empCardGift, "id", "sid");
s.setShare("3");
empCardGift.setIsShare("3");
empCardGiftService.updateById(empCardGift);
// empCardGift.setIsShare("3");
// empCardGiftService.updateById(empCardGift);
}
l.forEach(c->{
if (StringUtils.isBlank(s.getGoods())) {
@ -326,7 +329,9 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
vo.setGiftCodeKey(String.valueOf(randomNumber));
vo.setGiftCode("99"+uuid.substring(2));
vo.setQrCode("https://supervise.yxtsoft.com/lpkapi?qy="+vo.getGiftCode());
// vo.setQrCode("https://supervise.yxtsoft.com/lpkapi?qy="+vo.getGiftCode());
vo.setQrCode(qrUrl+vo.getGiftCode());
return rb.success().setData(vo);
}
public ResultBean changState(String cardSid, String state) {

4
src/main/java/com/yxt/yyth/biz/empcardgift/EmpCardGiftMapper.xml

@ -10,7 +10,6 @@
gi.*,
gi.state AS states,
gi.serialNumber AS serialNumber,
go.goodsNumber,
gif.dateStart,
gif.dateEnd,
CASE
@ -24,7 +23,6 @@
END stateValue
FROM
emp_card_gift gi
LEFT JOIN emp_card_gift_goods go ON go.empCardGiftSid = gi.sid
LEFT JOIN emp_card emp ON emp.sid = gi.empCardSid
LEFT JOIN lpk_giftbag gif ON gif.sid = emp.giftbagSid
<where>
@ -37,7 +35,6 @@
gi.*,
gi.state AS states,
gi.serialNumber AS serialNumber,
go.goodsNumber,
gif.dateStart,
gif.dateEnd,
CASE
@ -51,7 +48,6 @@
END stateValue
FROM
emp_card_gift gi
LEFT JOIN emp_card_gift_goods go ON go.empCardGiftSid = gi.sid
LEFT JOIN emp_card emp ON emp.sid = gi.empCardSid
LEFT JOIN lpk_giftbag gif ON gif.sid = emp.giftbagSid
WHERE

6
src/main/java/com/yxt/yyth/biz/empcardgift/EmpCardGiftRest.java

@ -10,6 +10,7 @@ import com.yxt.yyth.api.lpkgiftcard.BindCardDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
/**
@ -108,5 +109,8 @@ public class EmpCardGiftRest {
// public ResultBean cardGrant(@RequestBody CardGrantDto dto) {
// return EmpCardGiftService.cardGrant(dto);
// }
//@Scheduled(cron = "0/1 * * * * ?")
//public void test() {
// System.out.println("执行");
//}
}

27
src/main/java/com/yxt/yyth/biz/empcardgift/EmpCardGiftService.java

@ -27,6 +27,7 @@ import com.yxt.yyth.api.lpkgiftcard.AppletVo;
import com.yxt.yyth.api.lpkgiftcard.BindCardDto;
import com.yxt.yyth.api.lpkgoods.LpkGoods;
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo;
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo;
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods;
import com.yxt.yyth.api.lpkstore.LpkStoreDetailsVo;
import com.yxt.yyth.biz.empcard.EmpCardService;
@ -36,6 +37,8 @@ import com.yxt.yyth.biz.empreserveorder.EmpReserveOrderService;
import com.yxt.yyth.biz.empreserveordergoods.EmpReserveOrderGoodsService;
import com.yxt.yyth.biz.lpkgiftcard.generateRule.UniqueIdGenerator;
import com.yxt.yyth.biz.lpkgoods.LpkGoodsService;
import com.yxt.yyth.biz.lpkreserveorder.LpkReserveOrderService;
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsService;
import com.yxt.yyth.biz.lpkstore.LpkStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -70,10 +73,14 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
EmpCardService empCardService;
@Autowired
EmpCardGiftGoodsService empCardGiftGoodsService;
// @Autowired
// EmpReserveOrderGoodsService empReserveOrderGoodsService;
@Autowired
EmpReserveOrderGoodsService empReserveOrderGoodsService;
LpkReserveOrderGoodsService lpkReserveOrderGoodsService;
// @Autowired
// EmpReserveOrderService empReserveOrderService;
@Autowired
EmpReserveOrderService empReserveOrderService;
LpkReserveOrderService lpkReserveOrderService;
@Autowired
LpkGoodsService lpkGoodsService;
@Autowired
@ -101,6 +108,7 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
}
empCardGift.setCustomerSid(bindCardDto.getCustomerSid());
empCardGift.setState("2");
empCardGift.setIsShare("3");
empCardGift.setBindDate(new Date());
baseMapper.updateById(empCardGift);
return rb.success().setMsg("绑定成功");
@ -180,7 +188,8 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
List<EmpCardGiftGoodsVo> list = empCardGiftGoodsService.getGoodsByEmpCardGiftSid(vo.getSid()).getData();
List<GoodsVo> goodsVos = new ArrayList<>();
list.forEach(s -> {
EmpReserveOrderGoods goods = empReserveOrderGoodsService.getReserveByCardSid(vo.getSid(), s.getGoodsSid()).getData();
// EmpReserveOrderGoods goods = empReserveOrderGoodsService.getReserveByCardSid(vo.getSid(), s.getGoodsSid()).getData();
LpkReserveOrderGoods goods = lpkReserveOrderGoodsService.getReserveByCardSid(vo.getSid(), s.getGoodsSid()).getData();
GoodsVo goodsVo = new GoodsVo();
goodsVo.setGoods(s.getName());
goodsVo.setNum(s.getGoodsNumber());
@ -207,10 +216,11 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
goodsVos.add(goodsVo);
}
});
List<EmpReserveOrderCardVo> empReserveOrderCardVos = empReserveOrderService.selOrderByCardSid(sid).getData();
for (EmpReserveOrderCardVo vo2 : empReserveOrderCardVos) {
List<EmpReserveOrderGoods> goods = empReserveOrderGoodsService.selByOrderSids(vo2.getSid());
for (EmpReserveOrderGoods goods1 : goods) {
// List<EmpReserveOrderCardVo> empReserveOrderCardVos = empReserveOrderService.selOrderByCardSid(sid).getData();
List<LpkReserveOrderCardVo> empReserveOrderCardVos = lpkReserveOrderService.selOrderByCardSid(sid).getData();
for (LpkReserveOrderCardVo vo2 : empReserveOrderCardVos) {
List<LpkReserveOrderGoods> goods = lpkReserveOrderGoodsService.selByOrderSids(vo2.getSid());
for (LpkReserveOrderGoods goods1 : goods) {
LpkGoods lpkGoods = lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid", goods1.getGoodsSid()));
if (StringUtils.isBlank(vo2.getGoods())) {
vo2.setGoods(lpkGoods.getName() + ":" + goods1.getNum() + lpkGoods.getUnitName());
@ -219,7 +229,8 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
}
}
}
EmpReserveOrderVo vo1 = empReserveOrderService.getStoreByCustomerSid(vo.getCustomerSid()).getData();
//上次取货点
LpkReserveOrderVo vo1 = lpkReserveOrderService.getStoreByCustomerSid(vo.getCustomerSid()).getData();
if (null != vo1) {
LpkStoreDetailsVo vo2 = lpkStoreService.storeInit(vo1.getStoreSid()).getData();
if (null != vo2) {

2
src/main/java/com/yxt/yyth/biz/empreserveorder/EmpReserveOrderRest.java

@ -27,7 +27,7 @@ public class EmpReserveOrderRest {
@ApiOperation("预约提交")
@PostMapping("/submission")
public ResultBean submission(@RequestBody EmpReserveOrderDto dto) {
public ResultBean submission(@RequestBody LpkReserveOrderDto dto) {
return empReserveOrderService.submission(dto);
}

31
src/main/java/com/yxt/yyth/biz/empreserveorder/EmpReserveOrderService.java

@ -19,12 +19,16 @@ import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
import com.yxt.yyth.api.lpkgiftcard.AppletVo;
import com.yxt.yyth.api.lpkgiftcard.GoodsVo;
import com.yxt.yyth.api.lpkgoods.LpkGoods;
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrder;
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto;
import com.yxt.yyth.api.lpkstore.LpkStore;
import com.yxt.yyth.api.lpkstore.StoreSelect;
import com.yxt.yyth.biz.empreserveordergoods.EmpReserveOrderGoodsService;
import com.yxt.yyth.biz.lpkgiftbaggoods.LpkGiftBagGoodsService;
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardMapper;
import com.yxt.yyth.biz.lpkgoods.LpkGoodsService;
import com.yxt.yyth.biz.lpkreserveorder.LpkReserveOrderMapper;
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsService;
import com.yxt.yyth.biz.lpkstore.LpkStoreService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -57,23 +61,44 @@ public class EmpReserveOrderService extends MybatisBaseService<EmpReserveOrderMa
private LpkGoodsService lpkGoodsService;
@Autowired
private HttpServletResponse response;
@Autowired
LpkReserveOrderMapper lpkReserveOrderMapper;
@Autowired
LpkReserveOrderGoodsService lpkReserveOrderGoodsService;
public ResultBean submission(EmpReserveOrderDto dto) {
public ResultBean submission(LpkReserveOrderDto dto) {
ResultBean rb = new ResultBean().fail();
boolean b=isSatAndSun(dto.getReserveDate());
if(!b){
return rb.setMsg("周六、周日不能预约提货");
}
EmpReserveOrder order = new EmpReserveOrder();
LpkReserveOrder order = new LpkReserveOrder();
BeanUtil.copyProperties(dto, order, "id", "sid");
order.setStoreSid(dto.getValue());
order.setCardSid(dto.getSid());
order.setCreateTime(new DateTime());
baseMapper.insert(order);
order.setCardType("2");
lpkReserveOrderMapper.insert(order);
dto.setOrderSid(order.getSid());
empReserveOrderGoodsService.submissionDetail(dto);
return rb.success().setData("预约成功");
}
// public ResultBean submission(EmpReserveOrderDto dto) {
// ResultBean rb = new ResultBean().fail();
// boolean b=isSatAndSun(dto.getReserveDate());
// if(!b){
// return rb.setMsg("周六、周日不能预约提货");
// }
// EmpReserveOrder order = new EmpReserveOrder();
// BeanUtil.copyProperties(dto, order, "id", "sid");
// order.setStoreSid(dto.getValue());
// order.setCardSid(dto.getSid());
// order.setCreateTime(new DateTime());
// baseMapper.insert(order);
// dto.setOrderSid(order.getSid());
// empReserveOrderGoodsService.submissionDetail(dto);
// return rb.success().setData("预约成功");
// }
public boolean isSatAndSun(String date){
DateTime dateTime = DateUtil.parse(date);; // 获取当前时间
int dayOfWeek = dateTime.dayOfWeekEnum().getValue();// 获取星期几(1-7)

48
src/main/java/com/yxt/yyth/biz/empreserveordergoods/EmpReserveOrderGoodsService.java

@ -10,8 +10,11 @@ import com.yxt.yyth.api.empreserveordergoods.EmpReserveOrderGoods;
import com.yxt.yyth.api.lpkgiftcard.AppletVo;
import com.yxt.yyth.api.empcardgift.GoodsVo;
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderDto;
import com.yxt.yyth.api.lpkreserveordergoods.LpkReserveOrderGoods;
import com.yxt.yyth.biz.empcardgift.EmpCardGiftService;
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService;
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsMapper;
import com.yxt.yyth.biz.lpkreserveordergoods.LpkReserveOrderGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -25,30 +28,31 @@ import java.util.List;
public class EmpReserveOrderGoodsService extends MybatisBaseService<EmpReserveOrderGoodsMapper, EmpReserveOrderGoods> {
@Autowired
EmpCardGiftService empCardGiftService;
@Autowired
LpkReserveOrderGoodsMapper lpkReserveOrderGoodsMapper;
public ResultBean<EmpReserveOrderGoods> getReserveByCardSid(String carSid, String goodsSid) {
ResultBean rb = new ResultBean();
EmpReserveOrderGoods goods = baseMapper.getReserveByCardSid(carSid, goodsSid);
return rb.success().setData(goods);
}
public ResultBean submissionDetail(EmpReserveOrderDto dto) {
public ResultBean submissionDetail(LpkReserveOrderDto dto) {
ResultBean rb = new ResultBean();
EmpReserveOrderGoods goods = new EmpReserveOrderGoods();
LpkReserveOrderGoods goods = new LpkReserveOrderGoods();
BeanUtil.copyProperties(dto, goods, "id", "sid");
goods.setCardSid(dto.getSid());
for (GoodsVo goods1 : dto.getGoodsVos()) {
for (com.yxt.yyth.api.lpkgiftcard.GoodsVo goods1 : dto.getGoodsVos()) {
if (goods1.getSelect() != 0) {
goods.setCardSid(dto.getSid());
goods.setGoodsSid(goods1.getGoodsSid());
goods.setGoodsNumber(goods1.getSelect());
goods.setCreateTime(new DateTime());
baseMapper.insert(goods);
lpkReserveOrderGoodsMapper.insert(goods);
}
}
EmpGiftAppletVo vo = empCardGiftService.getGifCardBySid(dto.getSid()).getData();
int i = 0;
for (GoodsVo vo1 : vo.getGoodsVos()) {
EmpReserveOrderGoods goods1 = baseMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid());
LpkReserveOrderGoods goods1 = lpkReserveOrderGoodsMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid());
if (null != goods1) {
if (vo1.getNum() <= goods1.getGoodsNumber()) {
i++;
@ -62,6 +66,38 @@ public class EmpReserveOrderGoodsService extends MybatisBaseService<EmpReserveOr
}
return rb.success().setData("预约成功");
}
//
// public ResultBean submissionDetail(EmpReserveOrderDto dto) {
// ResultBean rb = new ResultBean();
// EmpReserveOrderGoods goods = new EmpReserveOrderGoods();
// BeanUtil.copyProperties(dto, goods, "id", "sid");
// goods.setCardSid(dto.getSid());
// for (GoodsVo goods1 : dto.getGoodsVos()) {
// if (goods1.getSelect() != 0) {
// goods.setCardSid(dto.getSid());
// goods.setGoodsSid(goods1.getGoodsSid());
// goods.setGoodsNumber(goods1.getSelect());
// goods.setCreateTime(new DateTime());
// baseMapper.insert(goods);
// }
// }
// EmpGiftAppletVo vo = empCardGiftService.getGifCardBySid(dto.getSid()).getData();
// int i = 0;
// for (GoodsVo vo1 : vo.getGoodsVos()) {
// EmpReserveOrderGoods goods1 = baseMapper.getReserveByCardSid(dto.getSid(), vo1.getGoodsSid());
// if (null != goods1) {
// if (vo1.getNum() <= goods1.getGoodsNumber()) {
// i++;
// }
// }
// if (vo.getGoodsVos().size() == i) {
// empCardGiftService.changState(dto.getSid(), "5");
// } else {
// empCardGiftService.changState(dto.getSid(), "4");
// }
// }
// return rb.success().setData("预约成功");
// }
public EmpReserveOrderGoods selByOrderSidAndGoodSid(String orderSid, String goodsSid) {
return baseMapper.selByOrderSidAndGoodSid(orderSid,goodsSid);

3
src/main/java/com/yxt/yyth/biz/lpkcardbuildrecord/LpkCardBuildRecordMapper.xml

@ -8,7 +8,8 @@
<select id="recordListPage" resultType="com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecordVo">
select
r.sid,
date_format(r.buildDate, '%Y-%m-%d') as buildDate,
-- date_format(r.buildDate, '%Y-%m-%d') as buildDate,
r.buildDate as buildDate,
r.countNumber,
r.startNumber,
r.endNumber,

27
src/main/java/com/yxt/yyth/biz/lpkgiftcard/LpkGiftCardService.java

@ -84,6 +84,8 @@ import java.util.regex.Pattern;
public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, LpkGiftCard> {
@Value("${image.url.prefix:http://127.0.0.1:8080/upload/}")
private String urlPrefix;
@Value("${weixin.qrcode.giftCard}")
String giftCardQrUrl;
@Autowired
com.yxt.yyth.biz.lpkgiftbaggoods.LpkGiftBagGoodsService LpkGiftBagGoodsService;
@Autowired
@ -146,7 +148,6 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
return rb.setMsg("参数不能为空");
}
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>();
// updateIsItInvalid(query.getCustomerSid());
if (StringUtils.isNotBlank(query.getCustomerSid())) {
qw.eq("customerSid", query.getCustomerSid());
}
@ -157,20 +158,6 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
return rb.success().setData(p);
}
// public ResultBean updateIsItInvalid() {
// ResultBean rb = new ResultBean();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>().lt("dateEnd", sdf.format(new Date())));
// for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
// Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
// if (i != 0) {
// baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
// }
// }
// return rb.success();
// }
public ResultBean<AppletVo> getGifCardBySid(String sid) {
ResultBean rb = new ResultBean().fail();
AppletVo vo = baseMapper.getGifCardBySid(sid);
@ -444,7 +431,8 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
IPage<LpkGiftCard> page = PagerUtil.queryToPage(pq);
IPage<LpkGiftCardWordVo> pagging = baseMapper.selGiftCard(page, qw);
pagging.getRecords().forEach(s -> {
s.setQrCode("https://supervise.yxtsoft.com/lpkapi?code=" + s.getCode());
// s.setQrCode("https://supervise.yxtsoft.com/lpkapi?code=" + s.getCode());
s.setQrCode(giftCardQrUrl + s.getCode());
});
PagerVo<LpkGiftCardWordVo> p = PagerUtil.pageToVo(pagging, null);
// System.out.println(a);
@ -503,7 +491,8 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
public void exportExcel(LpkGiftCardListQuery query) {
String finUrl = "https://supervise.yxtsoft.com/lpkapi?code=";
// String finUrl = "https://supervise.yxtsoft.com/lpkapi?code=";
String finUrl = giftCardQrUrl;
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>();
qw.eq("1", "1");
if (StringUtils.isNotBlank(query.getState())) {
@ -1203,6 +1192,10 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
returnMsg.setInfos(voList);
return returnMsg;
}
public ResultBean DownLoadTemplate(){
ResultBean rb=new ResultBean();
return rb.success().setData("");
}
// public static void main(String[] args) {
// LocalDate start = LocalDate.of(2021, Month.JANUARY, 1); // 设置起始日期为2021年1月1日
// LocalDate end = LocalDate.now(); // 设置结束日期为当前日期

20
src/main/java/com/yxt/yyth/biz/lpkreserveorder/LpkReserveOrderMapper.xml

@ -130,26 +130,6 @@
<where>
${ew.sqlSegment}
</where>
UNION
SELECT date_format(o.reserveDate, '%Y-%m-%d') as reserveDate,
c.`code`,
case
when o.reserveDate IS NOT NULL then 2
end as type,
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 emp_reserve_order AS o
LEFT JOIN lpk_store AS s ON o.storeSid = s.sid
LEFT JOIN emp_card_gift AS c ON o.cardSid = c.sid
LEFT JOIN lpk_giftbag AS b ON c.sid = b.sid
<where>
${ew.sqlSegment}
</where>
ORDER BY reserveDate DESC
</select>
<select id="exportExcel" resultType="com.yxt.yyth.api.lpkreserveorder.ReserveOrderExport">

77
src/main/java/com/yxt/yyth/biz/scheduled/scheduledRest.java

@ -7,9 +7,12 @@ import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo;
import com.yxt.yyth.biz.lpkgiftbag.LpkGiftBagService;
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardMapper;
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService;
import com.yxt.yyth.biz.lpkreserveorder.LpkReserveOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -19,48 +22,44 @@ import java.util.List;
* @author wangpengfei
* @date 2023/12/20 10:44
*/
@RestController
public class scheduledRest {
@Autowired
LpkGiftBagService lpkGiftBagService;
@Autowired
LpkGiftCardService lpkGiftCardService;
// @Scheduled(cron = "0 0 1 * * ? ")
public void updateIsItInvalid(String customerSid) {
// ResultBean rb = new ResultBean();
// List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>());
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
// int in = DateUtil.parse(sdf.format(lpkGiftBag.getDateEnd())).compareTo(DateUtil.parse(sdf.format(new Date())));
// if (String.valueOf(in).equals("-1")) {
// Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
// if (i != 0) {
// baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
// }
// } else {
// List<LpkGiftCard> list = baseMapper.selectList(new QueryWrapper<LpkGiftCard>().eq("customerSid", customerSid).eq("giftbagSid", lpkGiftBag.getSid()));
// for (LpkGiftCard card : list) {
// LpkReserveOrderVo LpkReserveOrderVo = lpkReserveOrderService.selByCardSid(card.getSid()).getData();
// if (null != LpkReserveOrderVo) {
// int c = DateUtil.parse(sdf.format(LpkReserveOrderVo.getReserveDate())).compareTo(DateUtil.parse(sdf.format(new Date())));
//// LpkGiftCard card1 = baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("sid", card.getSid()));
// if (String.valueOf(c).equals("-1")) {
// card.setIsReservation("1");
// baseMapper.updateById(card);
// }
// }
// }
// }
// }
//
//// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//// List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>().lt("dateEnd", sdf.format(new Date())));
//// for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
//// Integer i = baseMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
//// if (i != 0) {
//// baseMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
//// }
//// }
// return rb.success();
LpkGiftCardMapper lpkGiftCardMapper;
@Autowired
LpkReserveOrderService lpkReserveOrderService;
@Scheduled(cron = "0 0 1 * * ? ")
public void updateIsItInvalid() {
List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (LpkGiftBag lpkGiftBag : lpkGiftBags) {
//1>2 1 、1<2 -1 、1=2 0
int in = DateUtil.parse(sdf.format(lpkGiftBag.getDateEnd())).compareTo(DateUtil.parse(sdf.format(new Date())));
if (String.valueOf(in).equals("-1")) {
Integer i = lpkGiftCardMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
if (i != 0) {
lpkGiftCardMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
}
} else {
// List<LpkGiftCard> list = lpkGiftCardMapper.selectList(new QueryWrapper<LpkGiftCard>().eq("customerSid", customerSid).eq("giftbagSid", lpkGiftBag.getSid()));
List<LpkGiftCard> list = lpkGiftCardMapper.selectList(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()));
for (LpkGiftCard card : list) {
LpkReserveOrderVo LpkReserveOrderVo = lpkReserveOrderService.selByCardSid(card.getSid()).getData();
if (null != LpkReserveOrderVo) {
int c = DateUtil.parse(sdf.format(LpkReserveOrderVo.getReserveDate())).compareTo(DateUtil.parse(sdf.format(new Date())));
if (String.valueOf(c).equals("-1")) {
card.setIsReservation("1");
lpkGiftCardMapper.updateById(card);
}
}
}
}
}
}
// @Scheduled(cron = "0/1 * * * * ?")
// public void test() {
// System.out.println("执行");
// }
}

40
src/main/java/com/yxt/yyth/config/SaTokenGloableException.java

@ -2,13 +2,18 @@ package com.yxt.yyth.config;
import com.yxt.common.base.config.handler.GlobalExceptionHandler;
import com.yxt.common.core.result.ResultBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;
import java.util.List;
@ -18,12 +23,45 @@ import java.util.List;
* @description 全局异常处理
*/
@RestControllerAdvice
public class SaTokenGloableException {
public class SaTokenGloableException extends GlobalExceptionHandler {
private static final Logger L = LoggerFactory.getLogger(GlobalExceptionHandler.class);
public SaTokenGloableException() {
}
@ExceptionHandler({Exception.class})
public ResultBean handleException(Exception e) {
if(e.getMessage().contains("token 无效:")){
L.error(e.getMessage(), e);
return ResultBean.fireFail().setCode("5000").setMsg("系统异常::" + e.getMessage());
}
L.error(e.getMessage(), e);
return ResultBean.fireFail().setMsg("系统异常::" + e.getMessage());
}
@ExceptionHandler({NoHandlerFoundException.class})
public ResultBean handlerNoFoundException(Exception e) {
L.error(e.getMessage(), e);
return ResultBean.fireFail().setCode("404").setMsg("路径不存在,请检查路径是否正确");
}
// @ExceptionHandler({Exception.class})
// public ResultBean handleException(Exception e) {
// L.error(e.getMessage(), e);
// return ResultBean.fireFail().setMsg("系统异常::" + e.getMessage());
// }
@ExceptionHandler({BindException.class})
public ResultBean validatedBindException(BindException e) {
L.error(e.getMessage(), e);
String message = ((ObjectError)e.getAllErrors().get(0)).getDefaultMessage();
return ResultBean.fireFail().setCode("405").setMsg(message);
}
@ExceptionHandler({MethodArgumentNotValidException.class})
public ResultBean validExceptionHandler(MethodArgumentNotValidException e) {
L.error(e.getMessage(), e);
String message = e.getBindingResult().getFieldError().getDefaultMessage();
return ResultBean.fireFail().setCode("405").setMsg(message);
}
}

Loading…
Cancel
Save