Просмотр исходного кода

卡延期

release_toaliyun_real
xiaohanzi 5 лет назад
Родитель
Сommit
79a21c191a
9 измененных файлов: 71 добавлений и 1 удалений
  1. +14
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java
  4. +5
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java
  5. +7
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  6. +28
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  7. +4
    -0
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  8. +4
    -0
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  9. +4
    -0
      mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml

+ 14
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java Просмотреть файл

@@ -397,5 +397,19 @@ public class WxCouponController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById");
return new ResultData(wxCouponService.getHtmlById(id));
}
@ApiOperation("卡延期")
@PostMapping("/cardDefer")
@SystemControllerLog(description = "卡延期")
public ResultData cardDefer(@RequestBody WxCoupon wxCoupon) {
if (wxCoupon.getId() == null) {
return new ResultData(ResultData.ERROR, "缺少id");
}
if (wxCoupon.getValidEndDate() == null) {
return new ResultData(ResultData.ERROR, "缺少validEndDate");
}
return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),wxCoupon.getValidEndDate()));
}

}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Просмотреть файл

@@ -82,4 +82,6 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
WxCoupon findCouponModel(WxCoupon wxCoupon);

Integer findCouponListCount(WxCoupon wxCoupon);
void updateValidEndDate(WxCoupon wxCoupon);
}

+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java Просмотреть файл

@@ -81,4 +81,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> {

/// POS接口
List<WxCouponOrderCVo> findAvailCouponOrder(Map<String,Object> params);
//卡延期,将过期的状态变为使用中
void cardDefer(@Param("couponId")Long couponId);
}

+ 5
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java Просмотреть файл

@@ -4,8 +4,11 @@ import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCouponPassword;
import com.iformall.domain.vo.WxCouponPasswordCountInfoVO;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, Long> {

List<WxCouponPassword> findList(WxCouponPassword wxCouponPassword);
@@ -22,5 +25,7 @@ public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, L
void updateStatus(List<WxCouponPassword> tempList);

void updatePostpone(WxCouponPassword wxCouponPassword);
void updateExpiredTime(@Param("couponId")Long couponId,@Param("expiredTime")Date expiredTime);

}

+ 7
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponService.java Просмотреть файл

@@ -224,5 +224,11 @@ public interface WxCouponService {
* @param remainInventory 当前库存
*/
void backRemainInventory(Long id, Integer number, Integer remainInventory);

/**
* 卡延期
* @param wxCoupon
* @return
*/
ResultData cardDefer(Long id,Date validEndDate);
}

+ 28
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxCouponMerchantDto;
import com.iformall.domain.po.*;
@@ -77,6 +78,9 @@ public class WxCouponServiceImpl implements WxCouponService {

@Autowired
WxPayAccountMapper payAccountMapper;
@Autowired
WxCouponOrderMapper wxCouponOrderMapper;

@Autowired
@Qualifier("couponChannelRedisTemplate")
@@ -742,4 +746,28 @@ public class WxCouponServiceImpl implements WxCouponService {
}
}

@Override
@Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public ResultData cardDefer(Long id,Date validEndDate) {
WxCoupon coupon = wxCouponMapper.selectById(id);
if (null == coupon) {
return new ResultData(Result.ERROR,id+"未查询到券信息.");
}
if (new Date().after(validEndDate)) {
return new ResultData(Result.ERROR,"有效期不能小于当前时间.");
}
//更新coupon信息
coupon.setValidEndDate(validEndDate);
coupon.setUpdateDate(new Date());
wxCouponMapper.updateValidEndDate(coupon);
//更新coupon_order的状态,已过期的变为使用中 5-->4
wxCouponOrderMapper.cardDefer(id);
//更新coupon_passwd
couponPasswordMapper.updateExpiredTime(id, validEndDate);
return new ResultData();
}

}

+ 4
- 0
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -1041,4 +1041,8 @@
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>
<update id="updateValidEndDate" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon set valid_end_date = #{validEndDate} , update_date = #{updateDate} where id = #{id}
</update>
</mapper>

+ 4
- 0
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -1393,5 +1393,9 @@
where co.coupon_id = c.id and co.id = a.id
and co.id = #{id}
</select>
<update id="cardDefer" parameterType="java.lang.Long">
update wx_coupon_order set coupon_order_status = 4,update_date = now() where coupon_id = #{couponId} and coupon_order_status = 5
</update>

</mapper>

+ 4
- 0
mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml Просмотреть файл

@@ -195,5 +195,9 @@
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>
<update id="updateExpiredTime" parameterType="map">
update wx_coupon_password set expire_date = #{expiredTime} , update_date = now() where coupon_id = #{couponId}
</update>

</mapper>

Загрузка…
Отмена
Сохранить