xhxu 3 лет назад
Родитель
Сommit
3fb9626167
7 измененных файлов: 73 добавлений и 6 удалений
  1. +43
    -3
      mallinkBApi/src/main/java/com/iformall/controller/WxCardInfoController.java
  2. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxCardCVo.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  4. +10
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  5. +5
    -1
      mallinkService/src/main/resources/mapper/TtCUserMapper.xml
  6. +5
    -1
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml
  7. +6
    -0
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 43
- 3
mallinkBApi/src/main/java/com/iformall/controller/WxCardInfoController.java Просмотреть файл

@@ -1,12 +1,16 @@
package com.iformall.controller;

import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.common.SysConfigConstant;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.vo.WxCardCVo;
import com.iformall.domain.vo.WxCardSpendVo;
import com.iformall.domain.vo.WxCouponOrderCVo;
import com.iformall.enums.EnumCardInfoType;
import com.iformall.enums.EnumCouponOrderStatus;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.exception.MallinkException;
import com.iformall.pay.WxPayConstant;
@@ -24,9 +28,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;

@RestController
@RequestMapping("/api/cardInfo")
@@ -40,11 +42,49 @@ public class WxCardInfoController extends BaseController {
@Autowired
private WxCouponPasswordService couponPasswordService;

@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@Autowired
private SysConfigService sysConfigService;
@Autowired
private WxCouponService wxCouponService;

@Autowired
private WxCouponOrderService wxCouponOrderService;


@ApiOperation("卡包分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true),
})
public ResultData cardList(@ModelAttribute WxCardCVo cardCVo, Integer pageNum, Integer pageSize) {
if(cardCVo == null || StringUtils.isBlank(cardCVo.getUserPhone())){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), cardCVo.getUserPhone());
if(basicInfo == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该手机号未查询到用户");
}
if(pageNum == null){
pageNum = 1;
}
if(pageSize == null){
pageNum = 5;
}

cardCVo.updateTenantInfo(getTenantInfo());
cardCVo.setOwnerId(basicInfo.getId());
cardCVo.setMerchantId(getLoginBUser().getMerchantId());

cardCVo.setCouponOrderStatus(EnumCouponOrderStatus.CARD_USING.getCode());
cardCVo.setSortColumns(BaseEntity.SortField.CreateDate_DESC);

return wxCouponOrderService.listCardVoAsPage(cardCVo, pageNum, pageSize);
}
@ApiOperation(value = "查询卡信息")
@GetMapping("detail")


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

@@ -59,6 +59,9 @@ public class WxCardCVo extends WxCouponOrder {

@TableField(exist = false)
protected String statusStr;

@TableField(exist = false)
private String userPhone;
private WxCardInfo wxCardInfo;



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

@@ -168,7 +168,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {

// 4. 扣减计算
Double paymentD = 1.0 * cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount();
Integer payment = paymentD.intValue();
Integer payment = paymentD.intValue();//实际金额
int iChargeFee = PayUtils.getPayRate(payment, payAccount.getRealRate(), false);
Integer real_payment = payment - iChargeFee;
Integer remain_real_pament = cardInfo.getRemainingShareFeeAmount() - real_payment;


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

@@ -2313,6 +2313,16 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
@Override
public ResultData listCardVoAsPage(WxCardCVo record, Integer pageIndex, Integer pageSize) {
if(record.getMerchantId() != null){
List<Long> merchantIds = new ArrayList<Long>();
merchantIds.add(record.getMerchantId());
List<Long> merchantCouponIds = wxCouponMerchantMapper.findMerchantProductIds(record.getTenantId(), merchantIds, null);
if(merchantCouponIds == null || merchantCouponIds.isEmpty()){
record.setId(-999L);
}else{
record.setCouponIds(merchantCouponIds);
}
}
//List<WxCardCVo> cardTransList = wxCardTransferInfoMapper.findCardListOfCUser(record);
PageInfo<WxCouponOrder> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findCardListOfCUser(record));
PageInfo<WxCardCVo> retPageInfo = new PageInfo<WxCardCVo>();


+ 5
- 1
mallinkService/src/main/resources/mapper/TtCUserMapper.xml Просмотреть файл

@@ -236,10 +236,14 @@
<select id="listOpenId" parameterType="com.iformall.domain.po.tt.TtCUser" resultType="String">
select open_id
from tt_c_user
where `tenant_id` = #{tenantId}
where user_id is not null
and `tenant_id` = #{tenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null == userIds ">
and DATE_SUB(CURDATE(), INTERVAL 100 DAY) &lt;= date(active_time)
</if>
<if test=" null != userIds ">
and user_id in
<foreach collection="userIds" index="index" item="userIdItem" open="(" separator="," close=")">


+ 5
- 1
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Просмотреть файл

@@ -244,10 +244,14 @@
<select id="listOpenId" parameterType="com.iformall.domain.po.WxCUser" resultType="String">
select open_id
from wx_c_user
where `tenant_id` = #{tenantId}
where user_id is not null
and `tenant_id` = #{tenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null == userIds ">
and DATE_SUB(CURDATE(), INTERVAL 100 DAY) &lt;= date(active_time)
</if>
<if test=" null != userIds ">
and user_id in
<foreach collection="userIds" index="index" item="userIdItem" open="(" separator="," close=")">


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

@@ -1068,6 +1068,12 @@
#{sItem}
</foreach>
</if>
<if test=" null != couponIds">
and co.coupon_id in
<foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
#{couponIdItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</select>



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