|
|
@@ -8,11 +8,13 @@ import com.iformall.common.IdWorker; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.domain.po.WxCUserBasicInfo; |
|
|
import com.iformall.domain.po.WxCUserBasicInfo; |
|
|
import com.iformall.domain.po.WxCardInfo; |
|
|
import com.iformall.domain.po.WxCardInfo; |
|
|
|
|
|
import com.iformall.domain.po.WxCardTransferInfo; |
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
import com.iformall.domain.po.WxCouponOrder; |
|
|
import com.iformall.domain.po.WxCouponOrder; |
|
|
import com.iformall.domain.po.WxCouponPassword; |
|
|
import com.iformall.domain.po.WxCouponPassword; |
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
|
|
import com.iformall.domain.vo.WxCardTransferVo; |
|
|
import com.iformall.domain.vo.WxCardVo; |
|
|
import com.iformall.domain.vo.WxCardVo; |
|
|
import com.iformall.domain.vo.WxCouponOrderBVo; |
|
|
import com.iformall.domain.vo.WxCouponOrderBVo; |
|
|
import com.iformall.domain.vo.WxCouponPasswordVo; |
|
|
import com.iformall.domain.vo.WxCouponPasswordVo; |
|
|
@@ -26,6 +28,7 @@ import com.iformall.enums.EnumCouponType; |
|
|
import com.iformall.enums.EnumYesOrNo; |
|
|
import com.iformall.enums.EnumYesOrNo; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.mapper.WxCardInfoMapper; |
|
|
import com.iformall.mapper.WxCardInfoMapper; |
|
|
|
|
|
import com.iformall.mapper.WxCardTransferInfoMapper; |
|
|
import com.iformall.mapper.WxCouponChannelMapper; |
|
|
import com.iformall.mapper.WxCouponChannelMapper; |
|
|
import com.iformall.mapper.WxCouponMapper; |
|
|
import com.iformall.mapper.WxCouponMapper; |
|
|
import com.iformall.mapper.WxCouponOrderMapper; |
|
|
import com.iformall.mapper.WxCouponOrderMapper; |
|
|
@@ -47,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
@@ -86,6 +90,9 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
RedisLock redisLock; |
|
|
RedisLock redisLock; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxCardTransferInfoMapper wxCardTransferInfoMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@@ -101,6 +108,23 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { |
|
|
return pageInfo; |
|
|
return pageInfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Map<Long,WxCUserBasicInfo> getUserMap(List<Long> userIdList,TenantEntity tenantEntity) { |
|
|
|
|
|
Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); |
|
|
|
|
|
if (userIdList.size() > 0) { |
|
|
|
|
|
WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo(); |
|
|
|
|
|
cUserBasicInfoQ.setIds(userIdList); |
|
|
|
|
|
cUserBasicInfoQ.setFinalTenantId(tenantEntity.getFinalTenantId()); |
|
|
|
|
|
List<WxCUserBasicInfo> cuserList = wxCUserBasicInfoService.listPhoneAndNameByIds(cUserBasicInfoQ); |
|
|
|
|
|
if (null != cuserList) { |
|
|
|
|
|
for (int i = 0 ; i < cuserList.size() ; i++) { |
|
|
|
|
|
WxCUserBasicInfo cbi = cuserList.get(i); |
|
|
|
|
|
cUserMap.put(cbi.getId(), cbi); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return cUserMap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private List<WxCardVo> handleToCardVoList(List<WxCardInfo> list,WxCardVo record) { |
|
|
private List<WxCardVo> handleToCardVoList(List<WxCardInfo> list,WxCardVo record) { |
|
|
if (null != list && list.size() > 0) { |
|
|
if (null != list && list.size() > 0) { |
|
|
List<Long> couponIdList = new ArrayList<Long>(); |
|
|
List<Long> couponIdList = new ArrayList<Long>(); |
|
|
@@ -136,19 +160,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); |
|
|
|
|
|
if (userIdList.size() > 0) { |
|
|
|
|
|
WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo(); |
|
|
|
|
|
cUserBasicInfoQ.setIds(userIdList); |
|
|
|
|
|
cUserBasicInfoQ.setFinalTenantId(record.getFinalTenantId()); |
|
|
|
|
|
List<WxCUserBasicInfo> cuserList = wxCUserBasicInfoService.listPhoneAndNameByIds(cUserBasicInfoQ); |
|
|
|
|
|
if (null != cuserList) { |
|
|
|
|
|
for (int i = 0 ; i < cuserList.size() ; i++) { |
|
|
|
|
|
WxCUserBasicInfo cbi = cuserList.get(i); |
|
|
|
|
|
cUserMap.put(cbi.getId(), cbi); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Map<Long,WxCUserBasicInfo> cUserMap = getUserMap(userIdList, record); |
|
|
|
|
|
|
|
|
Map<Long,WxCouponOrder> couponOrderMap = new HashMap<Long,WxCouponOrder>(); |
|
|
Map<Long,WxCouponOrder> couponOrderMap = new HashMap<Long,WxCouponOrder>(); |
|
|
if (cardIdList.size() > 0 ) { |
|
|
if (cardIdList.size() > 0 ) { |
|
|
@@ -365,5 +377,63 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { |
|
|
} |
|
|
} |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public PageInfo<WxCardTransferVo> listTransferAsPage(WxCardTransferInfo transferRecord, Integer pageIndex, Integer pageSize) { |
|
|
|
|
|
PageInfo<WxCardTransferInfo> cardInfoPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardTransferInfoMapper.findList(transferRecord)); |
|
|
|
|
|
PageInfo<WxCardTransferVo> pageInfo = new PageInfo<WxCardTransferVo>(); |
|
|
|
|
|
pageInfo.setList(toTransferVoList(cardInfoPage.getList(),transferRecord)); |
|
|
|
|
|
pageInfo.setPageNum(cardInfoPage.getPageNum()); |
|
|
|
|
|
pageInfo.setPageSize(cardInfoPage.getPageSize()); |
|
|
|
|
|
pageInfo.setPages(cardInfoPage.getPages()); |
|
|
|
|
|
pageInfo.setTotal(cardInfoPage.getTotal()); |
|
|
|
|
|
return pageInfo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<WxCardTransferVo> toTransferVoList(List<WxCardTransferInfo> transferList,TenantEntity tenantEntity) { |
|
|
|
|
|
List<WxCardTransferVo> retList = new ArrayList<WxCardTransferVo>(); |
|
|
|
|
|
if (null != transferList && transferList.size() > 0 ) { |
|
|
|
|
|
List<Long> userList = new ArrayList<>(); |
|
|
|
|
|
for (int i = 0 ; i < transferList.size(); i++) { |
|
|
|
|
|
WxCardTransferInfo cti = transferList.get(i); |
|
|
|
|
|
Long fuserId = cti.getFromUser(); |
|
|
|
|
|
if (null != fuserId && !userList.contains(fuserId)) { |
|
|
|
|
|
userList.add(fuserId); |
|
|
|
|
|
} |
|
|
|
|
|
Long tuserId = cti.getToUser(); |
|
|
|
|
|
if (null != tuserId && !userList.contains(tuserId)) { |
|
|
|
|
|
userList.add(tuserId); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Map<Long,WxCUserBasicInfo> cUserMap = getUserMap(userList, tenantEntity); |
|
|
|
|
|
for (int i = 0 ; i < transferList.size(); i++) { |
|
|
|
|
|
WxCardTransferInfo cti = transferList.get(i); |
|
|
|
|
|
WxCardTransferVo vo = new WxCardTransferVo(); |
|
|
|
|
|
try { |
|
|
|
|
|
BeanUtils.copyProperties(vo, cti); |
|
|
|
|
|
Long fuserId = cti.getFromUser(); |
|
|
|
|
|
if (null != fuserId) { |
|
|
|
|
|
WxCUserBasicInfo fuser = cUserMap.get(fuserId); |
|
|
|
|
|
if (null != fuser) { |
|
|
|
|
|
vo.setFromUserPhone(fuser.getPhone()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Long tuserId = cti.getToUser(); |
|
|
|
|
|
if (null != tuserId) { |
|
|
|
|
|
WxCUserBasicInfo tuser = cUserMap.get(tuserId); |
|
|
|
|
|
if (null != tuser) { |
|
|
|
|
|
vo.setToUserPhone(tuser.getPhone()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
retList.add(vo); |
|
|
|
|
|
} catch (IllegalAccessException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return retList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |