| @@ -13,7 +13,8 @@ public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, L | |||||
| List<WxCouponPassword> findAvaPasswordListByCouponId(WxCouponPassword wxCouponPassword); | List<WxCouponPassword> findAvaPasswordListByCouponId(WxCouponPassword wxCouponPassword); | ||||
| void insertCouponPasswds(List<WxCouponPassword> pwdlist); | void insertCouponPasswds(List<WxCouponPassword> pwdlist); | ||||
| int updateStatusByCouponId(Long couponId); | |||||
| int disableByCouponId(Long couponId); | |||||
| int downloadByCouponId(Long couponId); | |||||
| List<WxCouponPassword> findCouponGroupList(WxCouponPassword wxCouponPassword); | List<WxCouponPassword> findCouponGroupList(WxCouponPassword wxCouponPassword); | ||||
| List<WxCouponPasswordCountInfoVO> findCouponCountInfo(WxCouponPassword wxCouponPassword); | List<WxCouponPasswordCountInfoVO> findCouponCountInfo(WxCouponPassword wxCouponPassword); | ||||
| @@ -11,7 +11,6 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxCouponPasswordMapper; | import com.iformall.mapper.WxCouponPasswordMapper; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -142,7 +141,6 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| newOne.setStatus(EnumCouponPasswordStatus.INIT.getCode()); | newOne.setStatus(EnumCouponPasswordStatus.INIT.getCode()); | ||||
| newOne.setCreateDate(curDate); | newOne.setCreateDate(curDate); | ||||
| newOne.setUpdateDate(curDate); | newOne.setUpdateDate(curDate); | ||||
| newOne.setExpireDate(DateUtils.getTimeAfterDays(30, curDate)); | |||||
| couponPasswords.add(newOne); | couponPasswords.add(newOne); | ||||
| } | } | ||||
| wxCouponPasswordMapper.insertCouponPasswds(couponPasswords); | wxCouponPasswordMapper.insertCouponPasswds(couponPasswords); | ||||
| @@ -150,6 +148,9 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Override | @Override | ||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword) { | public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword) { | ||||
| if (couponPassword.getCouponId() != null) { | |||||
| wxCouponPasswordMapper.downloadByCouponId(couponPassword.getCouponId()); | |||||
| } | |||||
| List<WxCouponPassword> pwdList = wxCouponPasswordMapper.findAvaPasswordListByCouponId(couponPassword); | List<WxCouponPassword> pwdList = wxCouponPasswordMapper.findAvaPasswordListByCouponId(couponPassword); | ||||
| excelService.exportExcel(pwdList, null, "兑换码", WxCouponPassword.class, "卡兑换码.xlsx", response, false); | excelService.exportExcel(pwdList, null, "兑换码", WxCouponPassword.class, "卡兑换码.xlsx", response, false); | ||||
| @@ -421,7 +421,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| // 卡下架后,转赠找不到卡相关信息,所以修改卡转赠状态为不可转赠 | // 卡下架后,转赠找不到卡相关信息,所以修改卡转赠状态为不可转赠 | ||||
| wxCardInfoMapper.updateTransferStatusByCouponId(record.getId()); | wxCardInfoMapper.updateTransferStatusByCouponId(record.getId()); | ||||
| // 卡券下架,未使用的卡密要下架 | // 卡券下架,未使用的卡密要下架 | ||||
| couponPasswordMapper.updateStatusByCouponId(record.getId()); | |||||
| couponPasswordMapper.disableByCouponId(record.getId()); | |||||
| } | } | ||||
| record.setUpdateDate(new Date()); | record.setUpdateDate(new Date()); | ||||
| wxCouponMapper.updateByPrimaryKeySelective(record); | wxCouponMapper.updateByPrimaryKeySelective(record); | ||||
| @@ -108,10 +108,16 @@ | |||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||
| <update id="updateStatusByCouponId" parameterType="Long"> | |||||
| <update id="disableByCouponId" parameterType="Long"> | |||||
| update wx_coupon_password | update wx_coupon_password | ||||
| set status=4, update_date=now() | set status=4, update_date=now() | ||||
| where status != 3 and tenant_id = #{tenantId} and coupon_id=#{couponId} | |||||
| where status != 3 and coupon_id=#{couponId} | |||||
| </update> | |||||
| <update id="downloadByCouponId" parameterType="Long"> | |||||
| update wx_coupon_password | |||||
| set status=1, update_date=now(), expire_date=date_add(now(),interval 30 DAY) | |||||
| where status=0 and coupon_id=#{couponId} | |||||
| </update> | </update> | ||||
| <select id="findCouponGroupList" parameterType="com.iformall.domain.po.WxCouponPassword" resultMap="BaseResultMap"> | <select id="findCouponGroupList" parameterType="com.iformall.domain.po.WxCouponPassword" resultMap="BaseResultMap"> | ||||