소스 검색

卡延期

release_toaliyun_real
xiaohanzi 5 년 전
부모
커밋
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"); logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById");
return new ResultData(wxCouponService.getHtmlById(id)); 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); WxCoupon findCouponModel(WxCoupon wxCoupon);


Integer findCouponListCount(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接口 /// POS接口
List<WxCouponOrderCVo> findAvailCouponOrder(Map<String,Object> params); 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.po.WxCouponPassword;
import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; import com.iformall.domain.vo.WxCouponPasswordCountInfoVO;


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


import org.apache.ibatis.annotations.Param;

public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, Long> { public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, Long> {


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


void updatePostpone(WxCouponPassword wxCouponPassword); 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 当前库存 * @param remainInventory 当前库存
*/ */
void backRemainInventory(Long id, Integer number, Integer 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.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker; import com.iformall.common.IdWorker;
import com.iformall.common.Result;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxCouponMerchantDto; import com.iformall.domain.dto.WxCouponMerchantDto;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
@@ -77,6 +78,9 @@ public class WxCouponServiceImpl implements WxCouponService {


@Autowired @Autowired
WxPayAccountMapper payAccountMapper; WxPayAccountMapper payAccountMapper;
@Autowired
WxCouponOrderMapper wxCouponOrderMapper;


@Autowired @Autowired
@Qualifier("couponChannelRedisTemplate") @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} and `parent_tenant_id` = #{parentTenantId}
</if> </if>
</select> </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> </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 where co.coupon_id = c.id and co.id = a.id
and co.id = #{id} and co.id = #{id}
</select> </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> </mapper>

+ 4
- 0
mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml 파일 보기

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


</mapper> </mapper>

불러오는 중...
취소
저장