11/22
This commit is contained in:
18
src/main/java/com/yxt/yyth/api/lpkgiftcard/AppletVo.java
Normal file
18
src/main/java/com/yxt/yyth/api/lpkgiftcard/AppletVo.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package com.yxt.yyth.api.lpkgiftcard;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2023/11/22 11:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AppletVo {
|
||||||
|
|
||||||
|
private String sid ;
|
||||||
|
private String state;
|
||||||
|
private boolean showBtn=true;
|
||||||
|
private String time;
|
||||||
|
private String name="卡号";
|
||||||
|
private String pName;
|
||||||
|
}
|
||||||
16
src/main/java/com/yxt/yyth/api/lpkgiftcard/BindCardDto.java
Normal file
16
src/main/java/com/yxt/yyth/api/lpkgiftcard/BindCardDto.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.yxt.yyth.api.lpkgiftcard;
|
||||||
|
|
||||||
|
import com.yxt.common.core.dto.Dto;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2023/11/22 10:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BindCardDto implements Dto {
|
||||||
|
private String code;//卡号
|
||||||
|
private String codeKey;//密钥
|
||||||
|
private String customerMobile;//客户手机号
|
||||||
|
private String customerSid;//客户sid
|
||||||
|
}
|
||||||
@@ -11,5 +11,5 @@ import lombok.Data;
|
|||||||
@ApiModel(value = "礼品卡信息 查询条件", description = "礼品卡信息 查询条件")
|
@ApiModel(value = "礼品卡信息 查询条件", description = "礼品卡信息 查询条件")
|
||||||
@Data
|
@Data
|
||||||
public class LpkGiftCardQuery implements Query {
|
public class LpkGiftCardQuery implements Query {
|
||||||
|
private String customerSid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.yxt.yyth.api.lpkgiftcard;
|
package com.yxt.yyth.api.lpkgiftcard;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.yxt.common.core.vo.Vo;
|
import com.yxt.common.core.vo.Vo;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
* @date 2023/11/21 15:12
|
* @date 2023/11/21 15:12
|
||||||
@@ -13,5 +17,22 @@ import lombok.NoArgsConstructor;
|
|||||||
@ApiModel(value = "礼品卡信息 视图数据对象", description = "礼品卡信息 视图数据对象")
|
@ApiModel(value = "礼品卡信息 视图数据对象", description = "礼品卡信息 视图数据对象")
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class LpkGiftCardVo implements Vo {
|
public class LpkGiftCardVo implements Vo {
|
||||||
|
private String id;
|
||||||
|
private String sid ;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
private String remarks;
|
||||||
|
private String isEnable;
|
||||||
|
private String giftbagSid;
|
||||||
|
private String code;
|
||||||
|
private String codeKey;
|
||||||
|
private String state;
|
||||||
|
private String grantName;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date grantDate;
|
||||||
|
private String customerMobile;
|
||||||
|
private String customerSid;
|
||||||
|
private String dateStart;
|
||||||
|
private String dateEnd;
|
||||||
|
private String pName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.yxt.yyth.biz.lpkcustomer;
|
package com.yxt.yyth.biz.lpkcustomer;
|
||||||
|
|
||||||
|
import cn.hutool.Hutool;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.yxt.common.core.query.PagerQuery;
|
import com.yxt.common.core.query.PagerQuery;
|
||||||
import com.yxt.common.core.result.ResultBean;
|
import com.yxt.common.core.result.ResultBean;
|
||||||
import com.yxt.common.core.vo.PagerVo;
|
import com.yxt.common.core.vo.PagerVo;
|
||||||
@@ -9,6 +11,7 @@ import com.yxt.yyth.api.lpkcustomer.LpkCustomerVo;
|
|||||||
import com.yxt.yyth.api.lpkcustomer.WxBindMobileDto;
|
import com.yxt.yyth.api.lpkcustomer.WxBindMobileDto;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -47,5 +50,11 @@ public class LpkCustomerRest {
|
|||||||
public ResultBean customerInfo(String sid){
|
public ResultBean customerInfo(String sid){
|
||||||
return lpkCustomerService.getCustomerInfo(sid);
|
return lpkCustomerService.getCustomerInfo(sid);
|
||||||
}
|
}
|
||||||
|
@Test
|
||||||
|
public void a (){
|
||||||
|
long id= IdUtil.createSnowflake(1,1).nextId();
|
||||||
|
System.out.println(String.valueOf(id).length());
|
||||||
|
System.out.println(id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
|||||||
Map<String,String> map=new HashMap<>();
|
Map<String,String> map=new HashMap<>();
|
||||||
// map.put("unionid",unionid);
|
// map.put("unionid",unionid);
|
||||||
map.put("openid",openid);
|
map.put("openid",openid);
|
||||||
LpkCustomer lpkCustomer= baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wx_mp_openid",openid));
|
LpkCustomer lpkCustomer= baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wxMpOpenid",openid));
|
||||||
//查询用户是否存在
|
//查询用户是否存在
|
||||||
if(null==lpkCustomer){
|
if(null==lpkCustomer){
|
||||||
//新增用户
|
//新增用户
|
||||||
@@ -83,18 +83,19 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
|
|||||||
// newCustomer.setUnionId(unionid);
|
// newCustomer.setUnionId(unionid);
|
||||||
newCustomer.setCreateTime(new Date());
|
newCustomer.setCreateTime(new Date());
|
||||||
baseMapper.insert(newCustomer);
|
baseMapper.insert(newCustomer);
|
||||||
return rb.setData(newCustomer).setCode("110");
|
// return rb.setData(newCustomer).setCode("110");
|
||||||
}
|
return rb.setData(newCustomer);
|
||||||
//判断是否绑定手机号
|
|
||||||
if(StringUtils.isBlank(lpkCustomer.getMobile())){
|
|
||||||
return rb.setData(lpkCustomer).setCode("110");
|
|
||||||
}
|
}
|
||||||
|
// //判断是否绑定手机号
|
||||||
|
// if(StringUtils.isBlank(lpkCustomer.getMobile())){
|
||||||
|
// return rb.setData(lpkCustomer).setCode("110");
|
||||||
|
// }
|
||||||
return rb.success().setData(lpkCustomer);
|
return rb.success().setData(lpkCustomer);
|
||||||
}
|
}
|
||||||
public ResultBean wxBindMobile(WxBindMobileDto wxBindMobileDto) {
|
public ResultBean wxBindMobile(WxBindMobileDto wxBindMobileDto) {
|
||||||
ResultBean rb = ResultBean.fireFail();
|
ResultBean rb = ResultBean.fireFail();
|
||||||
String mobile = wxBindMobileDto.getMobile();
|
String mobile = wxBindMobileDto.getMobile();
|
||||||
LpkCustomer lpkCustomer= baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wx_mp_openid",wxBindMobileDto.getOpenid()));
|
LpkCustomer lpkCustomer= baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wxMpOpenid",wxBindMobileDto.getOpenid()));
|
||||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
lpkCustomer.setBindDate(sdf.format(new Date()));
|
lpkCustomer.setBindDate(sdf.format(new Date()));
|
||||||
lpkCustomer.setMobile(mobile);
|
lpkCustomer.setMobile(mobile);
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ package com.yxt.yyth.biz.lpkgiftcard;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
||||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
|
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
|
||||||
|
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCardVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
@@ -12,5 +17,22 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface LpkGiftCardMapper extends BaseMapper<LpkGiftCard> {
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.yxt.yyth.biz.lpkgiftcard;
|
package com.yxt.yyth.biz.lpkgiftcard;
|
||||||
|
|
||||||
|
import com.yxt.common.core.result.ResultBean;
|
||||||
|
import com.yxt.yyth.api.lpkgiftcard.BindCardDto;
|
||||||
|
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCardQuery;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
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.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
@@ -19,6 +22,19 @@ public class LpkGiftCardRest {
|
|||||||
LpkGiftCardService lpkGiftCardService;
|
LpkGiftCardService lpkGiftCardService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/bindCard")
|
||||||
|
@ApiOperation(value = "客户绑定礼包卡")
|
||||||
|
public ResultBean wxBindMobile(@RequestBody BindCardDto bindCardDto) {
|
||||||
|
return lpkGiftCardService.bindCard(bindCardDto);
|
||||||
|
}
|
||||||
|
@PostMapping("/gifCardByCustomerSid")
|
||||||
|
@ApiOperation(value = "获取客户绑定的礼包卡")
|
||||||
|
public ResultBean wxBindMobile(@RequestBody LpkGiftCardQuery query) {
|
||||||
|
return lpkGiftCardService.getGifCardByCustomerSid(query);
|
||||||
|
}
|
||||||
|
@PostMapping("/getGifCardBySid/{sid}")
|
||||||
|
@ApiOperation(value = "获取礼包卡的详情信息")
|
||||||
|
public ResultBean wxBindMobile(@PathVariable("sid")String sid) {
|
||||||
|
return lpkGiftCardService.getGifCardBySid(sid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
package com.yxt.yyth.biz.lpkgiftcard;
|
package com.yxt.yyth.biz.lpkgiftcard;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.yxt.common.base.service.MybatisBaseService;
|
import com.yxt.common.base.service.MybatisBaseService;
|
||||||
|
import com.yxt.common.core.result.ResultBean;
|
||||||
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
||||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
|
import com.yxt.yyth.api.lpkgiftcard.*;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangpengfei
|
* @author wangpengfei
|
||||||
@@ -12,4 +19,40 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, LpkGiftCard> {
|
public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, LpkGiftCard> {
|
||||||
|
|
||||||
|
public ResultBean bindCard( BindCardDto bindCardDto) {
|
||||||
|
ResultBean rb=new ResultBean().fail();
|
||||||
|
LpkGiftCard lpkGiftCard=baseMapper.selectOne(new QueryWrapper<LpkGiftCard>().eq("code",bindCardDto.getCode())
|
||||||
|
.eq("codeKey",bindCardDto.getCodeKey()).eq("state","2"));
|
||||||
|
if(null==lpkGiftCard){
|
||||||
|
return rb.setMsg("请核对卡号和密钥");
|
||||||
|
}
|
||||||
|
lpkGiftCard.setCustomerSid(bindCardDto.getCustomerSid());
|
||||||
|
lpkGiftCard.setState("3");
|
||||||
|
baseMapper.updateById(lpkGiftCard);
|
||||||
|
return rb.success().setMsg("绑定成功");
|
||||||
|
}
|
||||||
|
public ResultBean getGifCardByCustomerSid(LpkGiftCardQuery query) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return rb.success().setData(list1);
|
||||||
|
}
|
||||||
|
public ResultBean getGifCardBySid(String sid) {
|
||||||
|
ResultBean rb=new ResultBean().fail();
|
||||||
|
LpkGiftCardVo vo=baseMapper.getGifCardBySid(sid);
|
||||||
|
return rb.success().setData(vo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user