|
|
@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.ExportExcelUtils; |
|
|
@ -143,6 +144,46 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp |
|
|
|
return rb.success().setMsg("绑定成功"); |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
String a="99231229101555309170"; |
|
|
|
; |
|
|
|
System.out.println(a.substring(0,2)); |
|
|
|
} |
|
|
|
public ResultBean bindAllCard(BindCardDto bindCardDto) { |
|
|
|
ResultBean rb = new ResultBean().fail(); |
|
|
|
|
|
|
|
if(bindCardDto.getCode().substring(0,2).equals("99")){ |
|
|
|
ResultBean rb2=empCardGiftService.bindCard(bindCardDto); |
|
|
|
return rb2; |
|
|
|
|
|
|
|
} |
|
|
|
LpkGiftCard lpkGiftCard1 = baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("code", bindCardDto.getCode())); |
|
|
|
if (null == lpkGiftCard1) { |
|
|
|
ResultBean rb1 = empCardGiftService.bindCard(bindCardDto); |
|
|
|
return rb1; |
|
|
|
} |
|
|
|
LpkGiftCard lpkGiftCard = baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("code", bindCardDto.getCode()) |
|
|
|
.eq("codeKey", bindCardDto.getCodeKey())); |
|
|
|
if (null == lpkGiftCard) { |
|
|
|
return rb.setMsg("请核对卡号和密钥"); |
|
|
|
} |
|
|
|
if (lpkGiftCard.getIsEnable().equals("2")) { |
|
|
|
return rb.setMsg("此卡已作废"); |
|
|
|
} |
|
|
|
|
|
|
|
AppletVo vo = baseMapper.getGifCardBySid(lpkGiftCard.getSid()); |
|
|
|
if (vo.getState().equals("已过期")) { |
|
|
|
return rb.setMsg("该卡已过期"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(lpkGiftCard.getCustomerSid())) { |
|
|
|
return rb.setMsg("该卡已绑定"); |
|
|
|
} |
|
|
|
lpkGiftCard.setCustomerSid(bindCardDto.getCustomerSid()); |
|
|
|
lpkGiftCard.setState("3"); |
|
|
|
lpkGiftCard.setBindDate(new Date()); |
|
|
|
baseMapper.updateById(lpkGiftCard); |
|
|
|
return rb.success().setMsg("绑定成功"); |
|
|
|
} |
|
|
|
public ResultBean getGifCardByCustomerSid(PagerQuery<LpkGiftCardQuery> pq) { |
|
|
|
ResultBean rb = new ResultBean().fail(); |
|
|
|
LpkGiftCardQuery query = pq.getParams(); |
|
|
@ -159,6 +200,22 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
|
public ResultBean getGifCardsByCustomerSid(PagerQuery<LpkGiftCardQuery> pq) { |
|
|
|
ResultBean rb = new ResultBean().fail(); |
|
|
|
LpkGiftCardQuery query = pq.getParams(); |
|
|
|
if (StringUtils.isBlank(query.getCustomerSid())) { |
|
|
|
return rb.setMsg("参数不能为空"); |
|
|
|
} |
|
|
|
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(query.getCustomerSid())) { |
|
|
|
qw.eq("customerSid", query.getCustomerSid()); |
|
|
|
} |
|
|
|
IPage<LpkGiftCard> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<AppletVo> list = baseMapper.getGifCardsByCustomerSid(page, query.getCustomerSid()); |
|
|
|
PagerVo<AppletVo> p = PagerUtil.pageToVo(list, null); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<AppletVo> getGifCardBySid(String sid) { |
|
|
|
ResultBean rb = new ResultBean().fail(); |
|
|
@ -219,6 +276,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp |
|
|
|
vo.setEmpCardGift(empCardGift); |
|
|
|
vo.setOrderCardVoList(lpkReserveOrderCardVos); |
|
|
|
vo.setGoodsVos(goodsVos); |
|
|
|
vo.setPName("家庭菜窖"); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
@ -628,8 +686,6 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp |
|
|
|
return rb.success().setData(array); |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public String getCardByExcel(LpkGiftCardDto dto) { |
|
|
|