| @@ -57,13 +57,13 @@ public class WxCouponSendController extends BaseController { | |||||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | ||||
| wxCouponSend.setTenantId(getTenantId()); | wxCouponSend.setTenantId(getTenantId()); | ||||
| Integer valid = EnumCouponSendStatus.VALID.getCode(); | Integer valid = EnumCouponSendStatus.VALID.getCode(); | ||||
| if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), wxCouponSend.getSendType())) { | |||||
| if (Objects.nonNull(wxCouponSend.getStatus())) { | |||||
| valid = wxCouponSend.getStatus(); | |||||
| } else { | |||||
| wxCouponSend.setStatus(null); | |||||
| } | |||||
| } | |||||
| // if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), wxCouponSend.getSendType())) { | |||||
| // if (Objects.nonNull(wxCouponSend.getStatus())) { | |||||
| // valid = wxCouponSend.getStatus(); | |||||
| // } else { | |||||
| // wxCouponSend.setStatus(null); | |||||
| // } | |||||
| // } | |||||
| wxCouponSend.setStatus(valid); | wxCouponSend.setStatus(valid); | ||||
| wxCouponSend.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | wxCouponSend.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | ||||
| PageInfo<WxCouponSendVo> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | PageInfo<WxCouponSendVo> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | ||||
| @@ -143,7 +143,7 @@ public class WxCouponSendController extends BaseController { | |||||
| @ApiImplicitParam(name = "sendType", value = "注券类型(会员生日券时必传)", dataType = "int", paramType = "query") | @ApiImplicitParam(name = "sendType", value = "注券类型(会员生日券时必传)", dataType = "int", paramType = "query") | ||||
| }) | }) | ||||
| @SystemControllerLog(description = "注券-删除") | @SystemControllerLog(description = "注券-删除") | ||||
| public ResultData delete(Long id,Integer sendType) { | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::delete"); | logger.debug("[" + getIpAddr() + "] WxCouponSendController::delete"); | ||||
| WxCouponSend wxCouponSend = wxCouponSendService.getById(id); | WxCouponSend wxCouponSend = wxCouponSendService.getById(id); | ||||
| if (wxCouponSend == null) | if (wxCouponSend == null) | ||||
| @@ -59,7 +59,7 @@ public class WxCouponSend extends BaseEntity { | |||||
| private Integer sendType; | private Integer sendType; | ||||
| @io.swagger.annotations.ApiModelProperty(value="发券条件",name="condition") | @io.swagger.annotations.ApiModelProperty(value="发券条件",name="condition") | ||||
| private String conditions; | private String conditions; | ||||
| @io.swagger.annotations.ApiModelProperty(value="全部时不传 0:有效 1:无效",name="status") | |||||
| @io.swagger.annotations.ApiModelProperty(value="0:有效 1:无效",name="status") | |||||
| private Integer status; | private Integer status; | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| @@ -74,4 +74,8 @@ public class WxCouponSend extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "1是0否", name = "是否发送短信1是0否") | @io.swagger.annotations.ApiModelProperty(value = "1是0否", name = "是否发送短信1是0否") | ||||
| private Integer sendSms; | private Integer sendSms; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "0未过期1已过期,全部时不传", name = "expired" ) | |||||
| @Transient | |||||
| private Integer expired; | |||||
| } | } | ||||
| @@ -8,7 +8,7 @@ import com.iformall.domain.vo.WxCouponSendVo; | |||||
| public interface WxCouponSendMapper extends CommonMapper<WxCouponSend, String> { | public interface WxCouponSendMapper extends CommonMapper<WxCouponSend, String> { | ||||
| List<WxCouponSendVo> findListVo(WxCouponSend wxCouponSend); | List<WxCouponSendVo> findListVo(WxCouponSend wxCouponSend); | ||||
| List<WxCouponSendVo> findListVoFilterName(WxCouponSend wxCouponSend); | |||||
| List<WxCouponSendVo> findListVoByNameAndDate(WxCouponSend wxCouponSend); | |||||
| void updateStatusByCouponId(WxCouponSend wxCouponSend); | void updateStatusByCouponId(WxCouponSend wxCouponSend); | ||||
| @@ -7,7 +7,6 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.msg.AppUniformMsg; | import com.iformall.domain.po.msg.AppUniformMsg; | ||||
| import com.iformall.domain.po.msg.MpAppMsg; | import com.iformall.domain.po.msg.MpAppMsg; | ||||
| @@ -26,7 +25,6 @@ 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; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Isolation; | |||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| @@ -71,7 +69,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| PageInfo<WxCouponSendVo> pageInfo; | PageInfo<WxCouponSendVo> pageInfo; | ||||
| //设置商户购买券数 | //设置商户购买券数 | ||||
| if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), record.getSendType())) { | if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), record.getSendType())) { | ||||
| pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVoFilterName(record)); | |||||
| pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVoByNameAndDate(record)); | |||||
| for (WxCouponSendVo cs : pageInfo.getList()) { | for (WxCouponSendVo cs : pageInfo.getList()) { | ||||
| JSONObject jo = JSONObject.parseObject(cs.getConditions()); | JSONObject jo = JSONObject.parseObject(cs.getConditions()); | ||||
| int inventory = jo.getInteger(WxCouponSend.KEY_MERCHANT_LNVENTORY); | int inventory = jo.getInteger(WxCouponSend.KEY_MERCHANT_LNVENTORY); | ||||
| @@ -98,14 +98,25 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findListVoFilterName" parameterType="com.iformall.domain.vo.WxCouponSendVo" resultMap="BaseResultMap"> | |||||
| <select id="findListVoByNameAndDate" parameterType="com.iformall.domain.vo.WxCouponSendVo" resultMap="BaseResultMap"> | |||||
| select tt.* from (select | select tt.* from (select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon_send cs left join wx_coupon c on c.id = cs.coupon_id | from wx_coupon_send cs left join wx_coupon c on c.id = cs.coupon_id | ||||
| <include refid="dynamicWhereConditions"/>) as tt | <include refid="dynamicWhereConditions"/>) as tt | ||||
| where 1=1 | |||||
| <if test=" null != merchantName "> | <if test=" null != merchantName "> | ||||
| where tt.conditions like concat('%', #{merchantName},'%') | |||||
| and tt.conditions like concat('%', #{merchantName},'%') | |||||
| </if> | </if> | ||||
| <choose> | |||||
| <when test="expired == 0"> | |||||
| and <![CDATA[ tt.valid_end_date <= now() ]]> | |||||
| </when> | |||||
| <when test="expired == 1"> | |||||
| and <![CDATA[ tt.valid_end_date > now() ]]> | |||||
| </when> | |||||
| <otherwise> | |||||
| </otherwise> | |||||
| </choose> | |||||
| </select> | </select> | ||||
| <update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel"> | <update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel"> | ||||