12/20
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
* @author dimengzhe
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {
|
||||
"com.yxt.yyth.config",
|
||||
"com.yxt.common.base.config",
|
||||
"com.yxt.yyth"
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yxt.yyth.api.empcard;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.yxt.common.base.utils.StringUtils;
|
||||
import com.yxt.yyth.api.empcardgift.EmpCardGiftVo;
|
||||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.GoodsVo;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderCardVo;
|
||||
@@ -41,7 +42,7 @@ public class EmpAppletVo {
|
||||
private String addressName;
|
||||
private String isReservation;//是否超过预约时间 0 否 1是
|
||||
private boolean notRese=true; //是否能预约
|
||||
private List<EmpCardGrantLogVo> empCardGrantLogVos;
|
||||
private List<EmpCardGiftVo> empCardGiftVos;
|
||||
private String value;
|
||||
private String serialNumber;
|
||||
private String giftCode;
|
||||
|
||||
@@ -36,5 +36,6 @@ public class EmpCardGift {
|
||||
private Date bindDate;
|
||||
private String isItlnvalid;
|
||||
private String isReservation;
|
||||
private String isShare;
|
||||
|
||||
}
|
||||
|
||||
@@ -39,4 +39,6 @@ public class EmpCardGiftVo implements Vo {
|
||||
private String iReservation;
|
||||
private double goodsNumber=0;
|
||||
private String qrCode;
|
||||
private String goods;
|
||||
private String share;
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ public class EmpCardGrantLog {
|
||||
private String empCardCustomerSid;
|
||||
private String serialNumber;
|
||||
private String code;
|
||||
private String isShare;
|
||||
// private String isShare;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,4 @@ public class EmpCardGrantLogVo implements Vo {
|
||||
private String code;
|
||||
private String codeKey;
|
||||
private String remarks;
|
||||
private String isShare;
|
||||
private boolean share=false;
|
||||
|
||||
public boolean isShare() {
|
||||
if(isShare.equals("2")){
|
||||
return share=true;
|
||||
}
|
||||
return share;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.yxt.yyth.biz.empcard;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -12,6 +13,7 @@ import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yyth.api.empcard.*;
|
||||
import com.yxt.yyth.api.empcardbuildrecord.EmpCardBuildRecord;
|
||||
import com.yxt.yyth.api.empcardgift.EmpCardGift;
|
||||
import com.yxt.yyth.api.empcardgift.EmpCardGiftVo;
|
||||
import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsVo;
|
||||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo;
|
||||
@@ -299,9 +301,16 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
|
||||
goodsVos.add(goodsVo);
|
||||
}
|
||||
});
|
||||
List<EmpCardGrantLogVo> empCardGrantLogVos= empCardGrantLogService.recordList(vo.getSid()).getData();
|
||||
empCardGrantLogVos.forEach(s->{
|
||||
List<EmpCardGiftGoodsVo> l=empCardGiftGoodsService.getGoodsByEmpCardGiftSid(s.getCardSid()).getData();
|
||||
List<EmpCardGiftVo> EmpCardGiftVos= empCardGiftService.recordList(vo.getSid()).getData();
|
||||
EmpCardGiftVos.forEach(s->{
|
||||
List<EmpCardGiftGoodsVo> l=empCardGiftGoodsService.getGoodsByEmpCardGiftSid(s.getSid()).getData();
|
||||
if(StringUtils.isNotBlank(s.getCustomerSid())){
|
||||
EmpCardGift empCardGift=new EmpCardGift();
|
||||
BeanUtil.copyProperties(EmpCardGiftVos, empCardGift, "id", "sid");
|
||||
s.setShare("3");
|
||||
empCardGift.setIsShare("3");
|
||||
empCardGiftService.updateById(empCardGift);
|
||||
}
|
||||
l.forEach(c->{
|
||||
if (StringUtils.isBlank(s.getGoods())) {
|
||||
s.setGoods(c.getName() + ":" + c.getGoodsNumber() + c.getUnitName());
|
||||
@@ -310,7 +319,7 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
|
||||
}
|
||||
});
|
||||
});
|
||||
vo.setEmpCardGrantLogVos(empCardGrantLogVos);
|
||||
vo.setEmpCardGiftVos(EmpCardGiftVos);
|
||||
vo.setGoodsVos(goodsVos);
|
||||
String uuid = UniqueIdGenerator.generateUniqueID();
|
||||
int randomNumber = new Random().nextInt(900000) + 100000;
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.empcardgift.*;
|
||||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@@ -44,5 +45,5 @@ public interface EmpCardGiftMapper extends BaseMapper<EmpCardGift> {
|
||||
// List<EmpCardGiftWordVo> selGiftCard(@Param("serialNumbers") List<Integer> serialNumbers);
|
||||
IPage<EmpCardGiftWordVo> selGiftCard(IPage<EmpCardGift> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardGift> qw);
|
||||
EmpCardGiftVo getEmpCardGoods(@Param("empCardSid")String empCardSid,@Param("goodsSid")String goodsSid);
|
||||
|
||||
List<EmpCardGiftVo> recordList(@Param("empCardSid")String empCardSid);
|
||||
}
|
||||
|
||||
@@ -174,4 +174,11 @@
|
||||
gift.empCardSid = #{empCardSid}
|
||||
AND goods.goodsSid = #{goodsSid};
|
||||
</select>
|
||||
<select id="recordList" resultType="com.yxt.yyth.api.empcardgift.EmpCardGiftVo">
|
||||
SELECT
|
||||
gi.*,gi.isShare as share
|
||||
FROM emp_card_gift gi
|
||||
where gi.empCardSid=#{empCardSid}
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -49,11 +49,11 @@ public class EmpCardGiftRest {
|
||||
return EmpCardGiftService.getGifCardBySid(sid);
|
||||
}
|
||||
|
||||
// @GetMapping("/getReservationBySid/{sid}")
|
||||
// @ApiOperation(value = "查询可预约取货的详情")
|
||||
// public ResultBean getReservationBySid(@PathVariable("sid") String sid) {
|
||||
// return EmpCardGiftService.getReservationBySid(sid);
|
||||
// }
|
||||
@GetMapping("/shareEmpCard/{sid}")
|
||||
@ApiOperation(value = "分享")
|
||||
public ResultBean getReservationBySid(@PathVariable("sid") String sid) {
|
||||
return EmpCardGiftService.shareEmpCard(sid);
|
||||
}
|
||||
|
||||
@PostMapping("/generateCard")
|
||||
@ApiOperation(value = "生成礼包卡信息")
|
||||
|
||||
@@ -231,6 +231,18 @@ public class EmpCardGiftService extends MybatisBaseService<EmpCardGiftMapper, Em
|
||||
vo.setGoodsVos(goodsVos);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
public ResultBean<List<EmpCardGiftVo>> recordList(String empCardSid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
List<EmpCardGiftVo> pagging = baseMapper.recordList(empCardSid);
|
||||
return rb.success().setData(pagging);
|
||||
}
|
||||
public ResultBean shareEmpCard(String sid) {
|
||||
ResultBean rb = new ResultBean().fail();
|
||||
EmpCardGift empCardGift=baseMapper.selectOne(new QueryWrapper<EmpCardGift>().eq("sid",sid));
|
||||
empCardGift.setIsShare("2");
|
||||
baseMapper.updateById(empCardGift);
|
||||
return rb.success().setMsg("成功");
|
||||
}
|
||||
//
|
||||
// public ResultBean getReservationBySid(String sid) {
|
||||
// ResultBean rb = new ResultBean().fail();
|
||||
|
||||
@@ -19,19 +19,6 @@
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
<select id="recordList" resultType="com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo">
|
||||
SELECT
|
||||
log.*,
|
||||
gi.sid as cardSid,
|
||||
gi.code as code,
|
||||
gi.codeKey as codeKey,
|
||||
gi.remarks as remakrs
|
||||
FROM
|
||||
emp_card_grant_log log
|
||||
LEFT JOIN emp_card_gift gi ON gi.CODE = log.CODE
|
||||
where log.empCardSid=#{empCardSid}
|
||||
|
||||
</select>
|
||||
<select id="recordGoodsSid" resultType="com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo">
|
||||
SELECT
|
||||
log.*,
|
||||
|
||||
@@ -8,10 +8,7 @@ import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
@@ -28,4 +25,5 @@ public class EmpCardGrantLogRest {
|
||||
public ResultBean<PagerVo<EmpCardGrantLogVo>> recordListPage(@RequestBody PagerQuery<EmpCardGrantLogQuery> pq) {
|
||||
return EmpCardGrantLogService.recordListPage(pq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ 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.yyth.api.empcardgift.EmpCardGift;
|
||||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLog;
|
||||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogQuery;
|
||||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo;
|
||||
@@ -49,11 +50,6 @@ public class EmpCardGrantLogService extends MybatisBaseService<EmpCardGrantLogMa
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
public ResultBean<List<EmpCardGrantLogVo>> recordList(String empCardSid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
List<EmpCardGrantLogVo> pagging = baseMapper.recordList(empCardSid);
|
||||
return rb.success().setData(pagging);
|
||||
}
|
||||
public ResultBean<EmpCardGrantLogVo> recordListGoods(String empCardSid,String goodsSid) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
EmpCardGrantLogVo pagging = baseMapper.recordListGoods(empCardSid,goodsSid);
|
||||
@@ -64,4 +60,5 @@ public class EmpCardGrantLogService extends MybatisBaseService<EmpCardGrantLogMa
|
||||
EmpCardGrantLogVo pagging = baseMapper.recordGoodsSid(empCardSid,goodsSid);
|
||||
return rb.success().setData(pagging);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ public class SysUserRest {
|
||||
System.out.println(StpUtil.getTokenValue());
|
||||
return rb.success().setData(tokenInfo);
|
||||
//return SaResult.ok("登录成功");
|
||||
} else if (sysUserVo.getUserName().equals("0")) {
|
||||
} else {
|
||||
return rb.setMsg("账户不存在或者密码不正确");
|
||||
}
|
||||
return rb.setMsg("登录失败");
|
||||
// return rb.setMsg("登录失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,10 +13,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@Configuration
|
||||
public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
|
||||
// 注册 Sa-Token 拦截器
|
||||
// 注册 Sa-Token 拦截器
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验。
|
||||
|
||||
registry.addInterceptor(new SaInterceptor(handler -> StpUtil.checkLogin()))
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns("/sysuser/doLogin")
|
||||
@@ -41,5 +42,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
.excludePathPatterns("/lpkstore/getAllStoreByQuery")
|
||||
.excludePathPatterns("/lpkgiftcard/getCardByBank")
|
||||
.excludePathPatterns("/lpkcustomer/wxSilentLogin");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yxt.yyth.config;
|
||||
|
||||
import com.yxt.common.base.config.handler.GlobalExceptionHandler;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2020/9/12 3:23
|
||||
* @description 全局异常处理
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class SaTokenGloableException {
|
||||
@ExceptionHandler({Exception.class})
|
||||
public ResultBean handleException(Exception e) {
|
||||
if(e.getMessage().contains("token 无效:")){
|
||||
return ResultBean.fireFail().setCode("5000").setMsg("系统异常::" + e.getMessage());
|
||||
}
|
||||
return ResultBean.fireFail().setMsg("系统异常::" + e.getMessage());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user