|
|
@@ -0,0 +1,60 @@
|
|
|
+package org.dromara.backstage.wx.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.dromara.backstage.cardCenter.domain.PtCard;
|
|
|
+import org.dromara.backstage.cardCenter.mapper.PtCardMapper;
|
|
|
+import org.dromara.backstage.consumption.mapper.XfCreditAccountMapper;
|
|
|
+import org.dromara.backstage.payment.domain.vo.PtUserAccountVo;
|
|
|
+import org.dromara.backstage.payment.mapper.PtUserAccountMapper;
|
|
|
+import org.dromara.backstage.wx.domain.vo.WxCreditAccountVo;
|
|
|
+import org.dromara.backstage.wx.service.IWxService;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+import org.dromara.system.api.RemoteDictService;
|
|
|
+import org.dromara.system.api.domain.vo.RemoteDictDataVo;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 微信Service业务层处理
|
|
|
+ *
|
|
|
+ */
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Service
|
|
|
+public class WxServiceImpl implements IWxService {
|
|
|
+
|
|
|
+ private final PtUserAccountMapper accountMapper;
|
|
|
+ private final XfCreditAccountMapper creditAccountMapper;
|
|
|
+ private final PtCardMapper cardMapper;
|
|
|
+ private final RemoteDictService dictService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PtUserAccountVo getUserInfoByUserId(Long userId) {
|
|
|
+ Map<String, String> dictMap = dictService.selectDictDataByType("account_open_status")
|
|
|
+ .stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.toMap(RemoteDictDataVo::getDictValue, RemoteDictDataVo::getDictLabel));
|
|
|
+ PtUserAccountVo vo = accountMapper.selectVoById(userId);
|
|
|
+ vo.setAccountStatus(dictMap.getOrDefault(vo.getAccountStatus(), ""));
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<WxCreditAccountVo> findCreditAccount(Long userId, String startTime, String endTime, PageQuery pageQuery) {
|
|
|
+
|
|
|
+ return TableDataInfo.build(creditAccountMapper.selectCreditAccountPage(pageQuery.build(), userId, startTime,endTime));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean updateCardStatus(Long userId, String cardStatus) {
|
|
|
+ int count = cardMapper.update(new LambdaUpdateWrapper<PtCard>()
|
|
|
+ .set(PtCard::getStatus, cardStatus)
|
|
|
+ .set(PtCard::getChangeTime, DateUtil.date())
|
|
|
+ .eq(PtCard::getUserId, userId));
|
|
|
+ return count > 0;
|
|
|
+ }
|
|
|
+}
|