Commit 3eab4ba1 authored by mengbali153's avatar mengbali153

优惠卷过滤

parent 996aaa91
......@@ -29,7 +29,7 @@ public interface SysCouponMapper extends BaseMapper<SysCoupon> {
CouponDetailVO getCouponDetail(Long id);
List<CouponAppListVO> getCouponAppList(@Param("coridc") String coridc, @Param("usridc") String usridc, QueryWrapper<CouponAppListVO> qw);
List<CouponAppListVO> getCouponAppList(@Param("coridc") String coridc, @Param("usridc") String usridc);
List<SysCoupon> getById(@Param("param")Long id);
......
......@@ -41,7 +41,7 @@
where scd.coupon_id = sc.id and suc.user_id = #{usridc} ) as isReceive
from sys_coupon sc
left join sys_enterprise se on se.id = sc.enterprise_id
where se.coridc = #{coridc}
where se.coridc = #{coridc} and sc.`status` =1 and sc.is_delete =1;
</select>
......
......@@ -196,7 +196,10 @@ public class CMBOneNetPayService {
try {
couponDetailService.beVerdue();
List<CouponAppListVO> list = couponService.getCouponAppList(coridc, usridc);
if (list!=null || list.size()!=0){
return BaseResponse.ok(list);
}
return BaseResponse.ok("无可用优惠卷");
} catch (Exception e) {
log.error("企业优惠券列表异常! 参数:{}", coridc+","+usridc);
return BaseResponse.error(e.getMessage(), this.getClass().getName());
......
package cn.wise.sc.consume.business.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.wise.sc.consume.business.entity.SysCoupon;
import cn.wise.sc.consume.business.entity.SysCouponDetail;
import cn.wise.sc.consume.business.entity.SysEnterprise;
......@@ -39,7 +40,7 @@ public class SysCouponServiceImpl extends ServiceImpl<SysCouponMapper, SysCoupon
private static final Logger log = LoggerFactory.getLogger("SysCouponServiceImpl");
@Autowired
@Resource
private SysCouponMapper couponMapper;
@Resource
......@@ -62,25 +63,28 @@ public class SysCouponServiceImpl extends ServiceImpl<SysCouponMapper, SysCoupon
@Override
public List<CouponAppListVO> getCouponAppList(String coridc, String usridc) {
QueryWrapper<CouponAppListVO> qw=new QueryWrapper<>();
qw.eq("status",1);
qw.eq("isDelete",1);
List<CouponAppListVO> list = couponMapper.getCouponAppList(coridc, usridc ,qw);
List<CouponAppListVO> list = couponMapper.getCouponAppList(coridc, usridc);
List<CouponAppListVO> rts = new ArrayList<>(list.size());
if (list!=null){
if (CollectionUtil.isNotEmpty(list)){
for (CouponAppListVO couponAppListVO:list){
Long coupId = couponAppListVO.getId();
// List<SysCoupon> byId = sysCouponMapper.getById(coupId);
List<SysCouponDetail> byCouponId=sysCouponDetailMapper.getByCouponId(coupId);
QueryWrapper<SysCouponDetail> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("coupon_id",couponAppListVO.getId() );
queryWrapper.eq("is_receive",0 );
List<SysCouponDetail> scList = sysCouponDetailMapper.selectList(queryWrapper);
if (!CollectionUtil.isEmpty(scList)) {
rts.add(couponAppListVO);
}
/*List<SysCouponDetail> byCouponId=sysCouponDetailMapper.getByCouponId(coupId);
for (SysCouponDetail sysCouponDetail:byCouponId){
boolean equals = sysCouponDetail.getIsReceive() == 0;
boolean equals1 = sysCouponDetail.getIsDelete() == 1;
if ((equals && equals1)){
rts.add(couponAppListVO);
}
}*/
}
}
}
return rts;
......
......@@ -9,7 +9,7 @@ spring:
datasource:
# 192.168.110.84 admin!@#123
url: jdbc:mysql://localhost:3306/cmb_consumption?useUnicode=true&characterEncoding=UTF-8&useSSL=false&useTimezone=true&serverTimezone=CTT
# url: jdbc:mysql://192.168.110.84/cmb_consumption?useUnicode=true&characterEncoding=UTF-8&useSSL=false&useTimezone=true&serverTimezone=CTT
#url: jdbc:mysql://192.168.110.84/cmb_consumption?useUnicode=true&characterEncoding=UTF-8&useSSL=false&useTimezone=true&serverTimezone=CTT
username: root
password: admin!@#123
driverClassName: com.mysql.jdbc.Driver
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment