11/22
This commit is contained in:
@@ -13,5 +13,7 @@ import lombok.NoArgsConstructor;
|
||||
@ApiModel(value = "礼包包含商品信息 视图数据对象", description = "礼包包含商品信息 视图数据对象")
|
||||
@NoArgsConstructor
|
||||
public class LpkGiftBagGoodsVo implements Vo {
|
||||
|
||||
private String goodsName;
|
||||
private double goodsNumber;
|
||||
private String picUrl;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,64 @@
|
||||
package com.yxt.yyth.api.lpkgiftcard;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/11/22 11:07
|
||||
*/
|
||||
@Data
|
||||
public class AppletVo {
|
||||
|
||||
private String dateStart;
|
||||
private String dateEnd;
|
||||
private String customerSid;
|
||||
private String giftbagSid;
|
||||
private String code;
|
||||
private String sid ;
|
||||
private String state;
|
||||
private String states;
|
||||
private boolean showBtn=true;
|
||||
private boolean showRecord=true;
|
||||
private String time;
|
||||
private String name="卡号";
|
||||
private String name="卡号:";
|
||||
private String pName;
|
||||
private List<GoodsVo> goodsVos;
|
||||
|
||||
public String getName() {
|
||||
name=name+code;
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
time=sdf.format(DateUtil.parse(dateStart))+"~"+sdf.format(DateUtil.parse(dateEnd));
|
||||
return time;
|
||||
}
|
||||
|
||||
public boolean isShowBtn() {
|
||||
if(states.equals("5")){
|
||||
this.state="失效";
|
||||
showBtn=false;
|
||||
}
|
||||
return showBtn;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
int i=DateUtil.parse(dateEnd).compareTo(DateUtil.date());
|
||||
if( String.valueOf(i).equals("1")){
|
||||
state="正常";
|
||||
if(states.equals("5")){
|
||||
this.state="失效";
|
||||
showBtn=false;
|
||||
}
|
||||
// appletVo.setShowBtn(true);
|
||||
}else{
|
||||
state="失效";
|
||||
showBtn=false;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
16
src/main/java/com/yxt/yyth/api/lpkgiftcard/GoodsVo.java
Normal file
16
src/main/java/com/yxt/yyth/api/lpkgiftcard/GoodsVo.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yyth.api.lpkgiftcard;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/11/22 15:35
|
||||
*/
|
||||
@Data
|
||||
public class GoodsVo {
|
||||
private String goods;
|
||||
private String pic;
|
||||
private double num;
|
||||
private double lNum;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
||||
newCustomer.setCreateTime(new Date());
|
||||
baseMapper.insert(newCustomer);
|
||||
// return rb.setData(newCustomer).setCode("110");
|
||||
return rb.setData(newCustomer);
|
||||
return rb.success().setData(newCustomer);
|
||||
}
|
||||
// //判断是否绑定手机号
|
||||
// if(StringUtils.isBlank(lpkCustomer.getMobile())){
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.yxt.yyth.biz.lpkgiftbaggoods;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
||||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoods;
|
||||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,5 +20,9 @@ public interface LpkGiftBagGoodsMapper extends BaseMapper<LpkGiftBagGoods> {
|
||||
|
||||
int deleteGoodsByBagSid(@Param("sid") String sid);
|
||||
|
||||
List<LpkGiftBagGoods> getRecordsByBagSid(String sid);
|
||||
|
||||
@Select("select goods.name as goodsName,bads.goodsNumber ,goods.picUrl from lpk_giftbag_goods bads left join lpk_goods goods on goods.sid =bads.goodsSid where bads.giftbagSid=#{sid}")
|
||||
List<LpkGiftBagGoodsVo> getGoodsByBagSid(String sid);
|
||||
List<LpkGiftBagGoods> getRecordsByBagSid(@Param("sid") String sid);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.yxt.yyth.biz.lpkgiftbaggoods;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
||||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoods;
|
||||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -21,5 +22,9 @@ public class LpkGiftBagGoodsService extends MybatisBaseService<LpkGiftBagGoodsMa
|
||||
public List<LpkGiftBagGoods> getRecordsByBagSid(String sid) {
|
||||
return baseMapper.getRecordsByBagSid(sid);
|
||||
}
|
||||
public List<LpkGiftBagGoodsVo> getGoodsByBagSid(String sid) {
|
||||
return baseMapper.getGoodsByBagSid(sid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.yxt.yyth.biz.lpkgiftcard;
|
||||
|
||||
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.lpkgiftbag.LpkGiftBag;
|
||||
import com.yxt.yyth.api.lpkgiftcard.AppletVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCardVo;
|
||||
import com.yxt.yyth.api.lpkstore.LpkStore;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@@ -17,22 +22,20 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface LpkGiftCardMapper extends BaseMapper<LpkGiftCard> {
|
||||
|
||||
@Select("SELECT\n" +
|
||||
"\tcard.*,\n" +
|
||||
"\tcase card.state \n" +
|
||||
"\tWHEN 3 then '未提货'\n" +
|
||||
"\tWHEN 4 then '已经预约提货(预约部分提货)'\n" +
|
||||
"\tWHEN 5 then '已经提取完成'\n" +
|
||||
"\tend stateValue,\n" +
|
||||
"\tbag.dateStart as dateStart\n" +
|
||||
"\t,bag.dateEnd as dateEnd\n" +
|
||||
"\t,bag.name as pname\n" +
|
||||
"FROM\n" +
|
||||
"\tlpk_giftcard card\n" +
|
||||
"\tLEFT JOIN lpk_giftbag bag on card.giftbagSid=bag.sid\n" +
|
||||
"\tLEFT JOIN lpk_giftbag_goods bagg on bagg.giftbagSid =bag.sid\n" +
|
||||
"\tWHERE card.customerSid =#{customerSid}")
|
||||
List<LpkGiftCardVo> getGifCardByCustomerSid(@Param("customerSid")String customerSid);
|
||||
@Select("select * from lpk_giftcard")
|
||||
LpkGiftCardVo getGifCardBySid(@Param("sid")String sid);
|
||||
IPage<AppletVo> getGifCardByCustomerSid(IPage<LpkGiftCard> page, @Param(Constants.WRAPPER) QueryWrapper<LpkGiftCard> qw);
|
||||
@Select(" SELECT\n" +
|
||||
" card.*,\n" +
|
||||
" case card.state\n" +
|
||||
" WHEN 3 then '未提货'\n" +
|
||||
" WHEN 4 then '已经预约提货(预约部分提货)'\n" +
|
||||
" WHEN 5 then '已经提取完成'\n" +
|
||||
" end stateValue,\n" +
|
||||
" bag.dateStart as dateStart\n" +
|
||||
" ,bag.dateEnd as dateEnd\n" +
|
||||
" ,bag.name as pname,card.state as states\n" +
|
||||
" FROM\n" +
|
||||
" lpk_giftcard card\n" +
|
||||
" LEFT JOIN lpk_giftbag bag on card.giftbagSid=bag.sid" +
|
||||
" where card.sid=#{sid}")
|
||||
AppletVo getGifCardBySid(@Param("sid")String sid);
|
||||
}
|
||||
|
||||
@@ -4,4 +4,24 @@
|
||||
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||
<!-- ${ew.customSqlSegment} -->
|
||||
|
||||
|
||||
<select id="getGifCardByCustomerSid" resultType="com.yxt.yyth.api.lpkgiftcard.AppletVo">
|
||||
SELECT
|
||||
card.*,
|
||||
case card.state
|
||||
WHEN 3 then '未提货'
|
||||
WHEN 4 then '已经预约提货(预约部分提货)'
|
||||
WHEN 5 then '已经提取完成'
|
||||
end stateValue,
|
||||
bag.dateStart as dateStart
|
||||
,bag.dateEnd as dateEnd
|
||||
,bag.name as pname,
|
||||
card.state as states
|
||||
FROM
|
||||
lpk_giftcard card
|
||||
LEFT JOIN lpk_giftbag bag on card.giftbagSid=bag.sid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.yxt.yyth.biz.lpkgiftcard;
|
||||
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yyth.api.lpkgiftcard.BindCardDto;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCardQuery;
|
||||
@@ -29,10 +30,10 @@ public class LpkGiftCardRest {
|
||||
}
|
||||
@PostMapping("/gifCardByCustomerSid")
|
||||
@ApiOperation(value = "获取客户绑定的礼包卡")
|
||||
public ResultBean wxBindMobile(@RequestBody LpkGiftCardQuery query) {
|
||||
public ResultBean gifCardByCustomerSid(@RequestBody PagerQuery<LpkGiftCardQuery> query) {
|
||||
return lpkGiftCardService.getGifCardByCustomerSid(query);
|
||||
}
|
||||
@PostMapping("/getGifCardBySid/{sid}")
|
||||
@GetMapping("/getGifCardBySid/{sid}")
|
||||
@ApiOperation(value = "获取礼包卡的详情信息")
|
||||
public ResultBean wxBindMobile(@PathVariable("sid")String sid) {
|
||||
return lpkGiftCardService.getGifCardBySid(sid);
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
package com.yxt.yyth.biz.lpkgiftcard;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.yyth.api.lpkgiftbag.LpkGiftBag;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -18,6 +25,10 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, LpkGiftCard> {
|
||||
@Value("${image.url.prefix:http://127.0.0.1:8080/upload/}")
|
||||
private String urlPrefix;
|
||||
@Autowired
|
||||
com.yxt.yyth.biz.lpkgiftbaggoods.LpkGiftBagGoodsService LpkGiftBagGoodsService;
|
||||
|
||||
public ResultBean bindCard( BindCardDto bindCardDto) {
|
||||
ResultBean rb=new ResultBean().fail();
|
||||
@@ -31,27 +42,57 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
baseMapper.updateById(lpkGiftCard);
|
||||
return rb.success().setMsg("绑定成功");
|
||||
}
|
||||
public ResultBean getGifCardByCustomerSid(LpkGiftCardQuery query) {
|
||||
public ResultBean getGifCardByCustomerSid(PagerQuery<LpkGiftCardQuery> pq) {
|
||||
ResultBean rb=new ResultBean().fail();
|
||||
List<LpkGiftCardVo> list=baseMapper.getGifCardByCustomerSid(query.getCustomerSid());
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<AppletVo> list1=new ArrayList<>();
|
||||
for(LpkGiftCardVo vo:list){
|
||||
AppletVo appletVo=new AppletVo();
|
||||
if(vo.getState().equals("5")){
|
||||
appletVo.setShowBtn(false);
|
||||
}
|
||||
appletVo.setName(appletVo.getName()+":"+vo.getCode());
|
||||
appletVo.setPName(vo.getPName());
|
||||
appletVo.setTime(vo.getDateStart()+"-"+vo.getDateEnd());
|
||||
appletVo.setSid(vo.getSid());
|
||||
list1.add(appletVo);
|
||||
LpkGiftCardQuery query = pq.getParams();
|
||||
QueryWrapper<LpkGiftCard> qw = new QueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(query.getCustomerSid())) {
|
||||
qw.like("customerSid", query.getCustomerSid());
|
||||
}
|
||||
return rb.success().setData(list1);
|
||||
IPage<LpkGiftCard> page = PagerUtil.queryToPage(pq);
|
||||
IPage<AppletVo> list=baseMapper.getGifCardByCustomerSid(page,qw);
|
||||
PagerVo<AppletVo> p = PagerUtil.pageToVo(list, null);
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
public ResultBean getGifCardBySid(String sid) {
|
||||
ResultBean rb=new ResultBean().fail();
|
||||
LpkGiftCardVo vo=baseMapper.getGifCardBySid(sid);
|
||||
AppletVo vo=baseMapper.getGifCardBySid(sid);
|
||||
List<LpkGiftBagGoodsVo> list=LpkGiftBagGoodsService.getGoodsByBagSid(vo.getGiftbagSid());
|
||||
List<GoodsVo> goodsVos=new ArrayList<>();
|
||||
list.forEach(s->{
|
||||
if(vo.getState().equals("失效")){
|
||||
GoodsVo goodsVo=new GoodsVo();
|
||||
goodsVo.setGoods(s.getGoodsName());
|
||||
goodsVo.setNum(s.getGoodsNumber());
|
||||
goodsVo.setPic(urlPrefix+s.getPicUrl());
|
||||
goodsVo.setLNum(0);
|
||||
goodsVos.add(goodsVo);
|
||||
}else if(!vo.isShowBtn()){
|
||||
GoodsVo goodsVo=new GoodsVo();
|
||||
goodsVo.setGoods(s.getGoodsName());
|
||||
goodsVo.setNum(s.getGoodsNumber());
|
||||
goodsVo.setPic(urlPrefix+s.getPicUrl());
|
||||
goodsVo.setLNum(0);
|
||||
goodsVos.add(goodsVo);
|
||||
}else{
|
||||
GoodsVo goodsVo=new GoodsVo();
|
||||
goodsVo.setGoods(s.getGoodsName());
|
||||
goodsVo.setNum(s.getGoodsNumber());
|
||||
goodsVo.setPic(urlPrefix+s.getPicUrl());
|
||||
goodsVo.setLNum(s.getGoodsNumber());
|
||||
goodsVos.add(goodsVo);
|
||||
}
|
||||
// if(!vo.isShowBtn()){
|
||||
// GoodsVo goodsVo=new GoodsVo();
|
||||
// goodsVo.setGoods(s.getGoodsName());
|
||||
// goodsVo.setNum(s.getGoodsNumber());
|
||||
// goodsVo.setPic(s.getPicUrl());
|
||||
// goodsVo.setLNum(0);
|
||||
// goodsVos.add(goodsVo);
|
||||
// }
|
||||
});
|
||||
vo.setGoodsVos(goodsVos);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user