| @@ -144,26 +144,25 @@ public class WxCreditHistoryController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| //TODO 待优化数据 | |||||
| // @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 list(@ModelAttribute WxCreditHistory wxCreditHistory, Integer pageNum, Integer pageSize) { | |||||
| // log.debug("[" + getIpAddr() + "] WxCreditHistoryController::list"); | |||||
| // if (null == wxCreditHistory) wxCreditHistory = new WxCreditHistory(); | |||||
| // wxCreditHistory.setTenantId(getTenantInfo().getFinalTenantId()); | |||||
| // wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId()); | |||||
| // WxMerchantBUser bUser = getLoginBUser(); | |||||
| // WxMerchant merchant = wxMerchantService.getById(wxCreditHistory.getMerchantId()); | |||||
| // if (merchant != null && merchant.getIsAdmin() != null && merchant.getIsAdmin() == 1) { | |||||
| // wxCreditHistory.setOperatorId(bUser.getId()); | |||||
| // wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | |||||
| // wxCreditHistory.setMerchantId(null); | |||||
| // } | |||||
| // final PageInfo<WxCreditHistoryVo> page = wxCreditHistoryService.listAsPageMore(wxCreditHistory, pageNum, pageSize); | |||||
| // return new ResultData(page); | |||||
| // } | |||||
| @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 list(@ModelAttribute WxCreditHistory wxCreditHistory, Integer pageNum, Integer pageSize) { | |||||
| log.debug("[" + getIpAddr() + "] WxCreditHistoryController::list"); | |||||
| if (null == wxCreditHistory) wxCreditHistory = new WxCreditHistory(); | |||||
| wxCreditHistory.setTenantId(getTenantInfo().getFinalTenantId()); | |||||
| wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId()); | |||||
| WxMerchantBUser bUser = getLoginBUser(); | |||||
| WxMerchant merchant = wxMerchantService.getById(wxCreditHistory.getMerchantId()); | |||||
| if (merchant != null && merchant.getIsAdmin() != null && merchant.getIsAdmin() == 1) { | |||||
| wxCreditHistory.setOperatorId(bUser.getId()); | |||||
| wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | |||||
| wxCreditHistory.setMerchantId(null); | |||||
| } | |||||
| final PageInfo<WxCreditHistoryVo> page = wxCreditHistoryService.listAsPageMore(wxCreditHistory, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | } | ||||
| @@ -43,6 +43,9 @@ public class WxCreditHistory extends BaseTenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | ||||
| private Long cUserId; | private Long cUserId; | ||||
| @TableField(exist = false) | |||||
| private List<Long> cUserIds; | |||||
| @io.swagger.annotations.ApiModelProperty(value="总积分",name="creditAmount") | @io.swagger.annotations.ApiModelProperty(value="总积分",name="creditAmount") | ||||
| private Integer creditAmount; | private Integer creditAmount; | ||||
| @io.swagger.annotations.ApiModelProperty(value="每笔积分明细",name="creditNum") | @io.swagger.annotations.ApiModelProperty(value="每笔积分明细",name="creditNum") | ||||
| @@ -57,8 +60,12 @@ public class WxCreditHistory extends BaseTenantEntity { | |||||
| private Integer operatorType; | private Integer operatorType; | ||||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | ||||
| private Long operatorId; | private Long operatorId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | ||||
| private Long merchantId; | private Long merchantId; | ||||
| @TableField(exist = false) | |||||
| private List<Long> merchantIds; | |||||
| @io.swagger.annotations.ApiModelProperty(value="券ID(积分兑换券时生成)",name="couponId") | @io.swagger.annotations.ApiModelProperty(value="券ID(积分兑换券时生成)",name="couponId") | ||||
| private Long couponId; | private Long couponId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="业态ID(计算新增积分时使用)",name="businessId") | @io.swagger.annotations.ApiModelProperty(value="业态ID(计算新增积分时使用)",name="businessId") | ||||
| @@ -81,6 +88,11 @@ public class WxCreditHistory extends BaseTenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value = "标签", name = "tags") | @io.swagger.annotations.ApiModelProperty(value = "标签", name = "tags") | ||||
| private List<Long> tags; | private List<Long> tags; | ||||
| @TableField(exist = false) | |||||
| private Integer begin; | |||||
| @TableField(exist = false) | |||||
| private Integer limit; | |||||
| public String getSpendStr() { | public String getSpendStr() { | ||||
| if(getSpend()!=null) { | if(getSpend()!=null) { | ||||
| @@ -1,6 +1,8 @@ | |||||
| package com.iformall.domain.vo; | package com.iformall.domain.vo; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | import cn.afterturn.easypoi.excel.annotation.Excel; | ||||
| import com.iformall.domain.po.WxCreditHistory; | |||||
| import com.iformall.domain.po.base.BaseTenantEntity; | import com.iformall.domain.po.base.BaseTenantEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -76,5 +78,21 @@ public class WxCreditHistoryVo extends BaseTenantEntity { | |||||
| @Excel(name = "说明", width = 20, orderNum = "11") | @Excel(name = "说明", width = 20, orderNum = "11") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "兑换用途", name = "changePurpose") | @io.swagger.annotations.ApiModelProperty(value = "兑换用途", name = "changePurpose") | ||||
| private String changePurpose; | private String changePurpose; | ||||
| public void initByCreditHistory(WxCreditHistory c) { | |||||
| this.creditId = String.valueOf(c.getId()); | |||||
| this.tenantId = c.getTenantId(); | |||||
| this.cUserId = c.getCUserId(); | |||||
| this.creditAmount = c.getCreditAmount(); | |||||
| this.creditNum = c.getCreditNum(); | |||||
| this.createDate = c.getCreateDate(); | |||||
| this.creditType = c.getCreditType(); | |||||
| this.receiptUrl = c.getReceiptUrl(); | |||||
| this.operatorType = c.getOperatorType(); | |||||
| this.operatorId = c.getOperatorId(); | |||||
| this.merchantId = c.getMerchantId(); | |||||
| this.ticketNumber = c.getTicketNumber(); | |||||
| this.changePurpose = c.getChangePurpose(); | |||||
| } | |||||
| } | } | ||||
| @@ -23,6 +23,7 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| List<WxCUserBasicInfo> findList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo wxCUserBasicInfo); | List<WxCUserBasicInfo> findList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo wxCUserBasicInfo); | ||||
| List<WxCUserBasicInfo> findListPhoneAndNameByIds(WxCUserBasicInfo wxCUserBasicInfo); | List<WxCUserBasicInfo> findListPhoneAndNameByIds(WxCUserBasicInfo wxCUserBasicInfo); | ||||
| List<Long> findIdList(WxCUserBasicInfo wxCUserBasicInfo); | |||||
| WxCUserBasicInfo selectById(@Param("id")Long id,@Param("finalTenantId")String finalTenantId); | WxCUserBasicInfo selectById(@Param("id")Long id,@Param("finalTenantId")String finalTenantId); | ||||
| @@ -16,7 +16,7 @@ public interface WxCreditHistoryMapper extends CommonMapper<WxCreditHistory, Lon | |||||
| List<WxCreditHistory> findList(WxCreditHistory wxCreditHistory); | List<WxCreditHistory> findList(WxCreditHistory wxCreditHistory); | ||||
| List<WxCreditHistoryVo> findListMore(WxCreditHistory wxCreditHistory); | |||||
| List<WxCreditHistory> findListMore(WxCreditHistory wxCreditHistory); | |||||
| int loginCount(WxCreditHistory wxCreditHistory); | int loginCount(WxCreditHistory wxCreditHistory); | ||||
| @@ -87,4 +87,6 @@ public interface WxCreditHistoryService { | |||||
| PageInfo<MerchantCreditRankingVo> listAsPageMcrv(WxCreditHistory record, Integer pageIndex, Integer pageSize); | PageInfo<MerchantCreditRankingVo> listAsPageMcrv(WxCreditHistory record, Integer pageIndex, Integer pageSize); | ||||
| long getIncrementCreditAmount(WxCreditHistory wxCreditHistory); | long getIncrementCreditAmount(WxCreditHistory wxCreditHistory); | ||||
| PageInfo<WxCreditHistoryVo> findListMorePage(WxCreditHistory wxCreditHistory,Integer pageIndex, Integer pageSize); | |||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.msg.WxMsg; | import com.iformall.domain.po.msg.WxMsg; | ||||
| import com.iformall.domain.vo.MerchantCreditRankingVo; | import com.iformall.domain.vo.MerchantCreditRankingVo; | ||||
| @@ -22,6 +23,8 @@ import com.iformall.utils.CreditUtil; | |||||
| import com.iformall.utils.RedisLock; | import com.iformall.utils.RedisLock; | ||||
| import com.iformall.utils.UserUtil; | import com.iformall.utils.UserUtil; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.commons.beanutils.BeanUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -34,8 +37,11 @@ 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.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -122,10 +128,209 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| @Override | @Override | ||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory) { | public void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory) { | ||||
| List<WxCreditHistoryVo> wxCreditHistoryVoList = wxCreditHistoryMapper.findListMore(wxCreditHistory); | |||||
| excelService.exportExcel(wxCreditHistoryVoList, null, "积分变更记录", WxCreditHistoryVo.class, "积分变更记录.xlsx", response, false); | |||||
| PageInfo<WxCreditHistoryVo> wxCreditHistoryVoList = findListMorePage(wxCreditHistory,0,50000); | |||||
| excelService.exportExcel(wxCreditHistoryVoList.getList(), null, "积分变更记录", WxCreditHistoryVo.class, "积分变更记录.xlsx", response, false); | |||||
| } | } | ||||
| private Map<Long,WxCUserBasicInfo> getUserMap(BaseTenantEntity tenantEntity,List<Long> cUserIdList) { | |||||
| Map<Long,WxCUserBasicInfo> userMap = new HashMap<Long,WxCUserBasicInfo>(); | |||||
| if (cUserIdList.size() > 0) { | |||||
| WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo(); | |||||
| cUserBasicInfoQ.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||||
| cUserBasicInfoQ.setIds(cUserIdList); | |||||
| List<WxCUserBasicInfo> userList = wxCUserBasicInfoMapper.findListPhoneAndNameByIds(cUserBasicInfoQ); | |||||
| if (null != userList) { | |||||
| for (int i = 0 ; i < userList.size() ; i ++) { | |||||
| WxCUserBasicInfo cbi = userList.get(i); | |||||
| userMap.put(cbi.getId(), cbi); | |||||
| } | |||||
| } | |||||
| } | |||||
| return userMap; | |||||
| } | |||||
| private Map<Long,String> getMerchantNameMap(BaseTenantEntity tenantEntity,List<Long> merchantIdList) { | |||||
| Map<Long,String> merchantNameMap = new HashMap<Long,String>(); | |||||
| if (merchantIdList.size() > 0) { | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(tenantEntity); | |||||
| merchantQ.setIds(merchantIdList); | |||||
| List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ); | |||||
| if (null != merchantList) { | |||||
| for (int i = 0 ; i < merchantList.size() ; i ++) { | |||||
| WxMerchant cbi = merchantList.get(i); | |||||
| merchantNameMap.put(cbi.getId(), cbi.getName()); | |||||
| } | |||||
| } | |||||
| } | |||||
| return merchantNameMap; | |||||
| } | |||||
| private Map<Long,String> getMallUserInfoOperatorMap(BaseTenantEntity tenantEntity,List<Long> mallUserInfoOperatorIdList) { | |||||
| Map<Long,String> mallUserInfoOperatorMap = new HashMap<Long,String>(); | |||||
| if (mallUserInfoOperatorIdList.size() > 0) { | |||||
| MallUserInfo mallUserInfoQ = new MallUserInfo(); | |||||
| mallUserInfoQ.updateTenantInfo(tenantEntity); | |||||
| mallUserInfoQ.setIds(mallUserInfoOperatorIdList); | |||||
| List<MallUserInfo> userList = mallUserInfoMapper.findList(mallUserInfoQ); | |||||
| if (null != userList) { | |||||
| for (int i = 0 ; i < userList.size() ; i ++) { | |||||
| MallUserInfo cbi = userList.get(i); | |||||
| mallUserInfoOperatorMap.put(cbi.getId(), cbi.getName()); | |||||
| } | |||||
| } | |||||
| } | |||||
| return mallUserInfoOperatorMap; | |||||
| } | |||||
| private Map<Long,String> getMerchantBUserOperatorMap(BaseTenantEntity tenantEntity,List<Long> merchantBUserOperatorIdList) { | |||||
| Map<Long,String> merchantBUserOperatorMap = new HashMap<Long,String>(); | |||||
| if (merchantBUserOperatorIdList.size() > 0) { | |||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(tenantEntity); | |||||
| merchantBUserQ.setIds(merchantBUserOperatorIdList); | |||||
| List<WxMerchantBUser> userList = wxMerchantBUserMapper.findSimpleList(null); | |||||
| if (null != userList) { | |||||
| for (int i = 0 ; i < userList.size() ; i ++) { | |||||
| WxMerchantBUser cbi = userList.get(i); | |||||
| merchantBUserOperatorMap.put(cbi.getId(), cbi.getName()); | |||||
| } | |||||
| } | |||||
| } | |||||
| return merchantBUserOperatorMap; | |||||
| } | |||||
| private List<WxCreditHistoryVo> creditHistoryToVoList(BaseTenantEntity tenantEntity,List<WxCreditHistory> credithistoryList) { | |||||
| if (null != credithistoryList) { | |||||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||||
| List<Long> cUserIdList = new ArrayList<Long>(); | |||||
| List<Long> mallUserInfoOperatorIdList = new ArrayList<Long>(); | |||||
| List<Long> merchantBUserOperatorIdList = new ArrayList<Long>(); | |||||
| List<Long> cUserBasicInfoOperatorIdList = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < credithistoryList.size() ; i++) { | |||||
| WxCreditHistory creditHistory = credithistoryList.get(i); | |||||
| Long cUserId = creditHistory.getCUserId(); | |||||
| Long merchantId = creditHistory.getMerchantId(); | |||||
| Long operatorId = creditHistory.getOperatorId(); | |||||
| if (null != cUserId) { | |||||
| if (!cUserIdList.contains(cUserId)) { | |||||
| cUserIdList.add(cUserId); | |||||
| } | |||||
| } | |||||
| if (null != merchantId) { | |||||
| if (!merchantIdList.contains(merchantId)) { | |||||
| merchantIdList.add(merchantId); | |||||
| } | |||||
| } | |||||
| if (null != operatorId && null != creditHistory.getOperatorType()) { | |||||
| if (creditHistory.getOperatorType() == 4) { | |||||
| if (!mallUserInfoOperatorIdList.contains(operatorId)) { | |||||
| mallUserInfoOperatorIdList.add(operatorId); | |||||
| } | |||||
| }else if (creditHistory.getOperatorType() == 3) { | |||||
| if (!merchantBUserOperatorIdList.contains(operatorId)) { | |||||
| merchantBUserOperatorIdList.add(operatorId); | |||||
| } | |||||
| }else if (creditHistory.getOperatorType() == 2) { | |||||
| if (!cUserBasicInfoOperatorIdList.contains(operatorId)) { | |||||
| cUserBasicInfoOperatorIdList.add(operatorId); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxCUserBasicInfo> userMap = getUserMap(tenantEntity,cUserIdList); | |||||
| Map<Long,String> merchantNameMap = getMerchantNameMap(tenantEntity,merchantIdList); | |||||
| Map<Long,String> mallUserInfoOperatorMap = getMallUserInfoOperatorMap(tenantEntity,mallUserInfoOperatorIdList); | |||||
| Map<Long,String> merchantBUserOperatorMap = getMerchantBUserOperatorMap(tenantEntity,merchantBUserOperatorIdList); | |||||
| Map<Long,WxCUserBasicInfo> cUserBasicInfoOperatorMap = getUserMap(tenantEntity,cUserBasicInfoOperatorIdList); | |||||
| List<WxCreditHistoryVo> retList = new ArrayList<WxCreditHistoryVo>(); | |||||
| for (int i = 0 ; i < credithistoryList.size() ; i++) { | |||||
| WxCreditHistory creditHistory = credithistoryList.get(i); | |||||
| WxCreditHistoryVo vo = new WxCreditHistoryVo(); | |||||
| vo.initByCreditHistory(creditHistory); | |||||
| if (null != vo.getCUserId()) { | |||||
| WxCUserBasicInfo user = userMap.get(vo.getCUserId()); | |||||
| if (null != user) { | |||||
| String name = user.getNickName(); | |||||
| if (StringUtils.isBlank(name)) { | |||||
| name = user.getName(); | |||||
| } | |||||
| vo.setName(name); | |||||
| if (null != user.getSex()) { | |||||
| vo.setSex(String.valueOf(user.getSex())); | |||||
| } | |||||
| vo.setPhone(user.getPhone()); | |||||
| } | |||||
| } | |||||
| vo.setMerchantName(merchantNameMap.get(vo.getMerchantId())); | |||||
| if (null != vo.getOperatorId()) { | |||||
| if (creditHistory.getOperatorType() == 4) { | |||||
| vo.setOperator(mallUserInfoOperatorMap.get(vo.getOperatorId())); | |||||
| }else if (creditHistory.getOperatorType() == 3) { | |||||
| vo.setOperator(merchantBUserOperatorMap.get(vo.getOperatorId())); | |||||
| }else if (creditHistory.getOperatorType() == 2) { | |||||
| WxCUserBasicInfo bi = cUserBasicInfoOperatorMap.get(vo.getOperatorId()); | |||||
| if (null != bi) { | |||||
| String name = bi.getNickName(); | |||||
| if (StringUtils.isBlank(name)) { | |||||
| name = bi.getName(); | |||||
| } | |||||
| vo.setOperator(name); | |||||
| } | |||||
| }else { | |||||
| vo.setOperator(""); | |||||
| } | |||||
| } | |||||
| retList.add(vo); | |||||
| } | |||||
| return retList; | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public PageInfo<WxCreditHistoryVo> findListMorePage(WxCreditHistory wxCreditHistory,Integer pageIndex, Integer pageSize) { | |||||
| String merchantName = StringUtils.trimToNull(wxCreditHistory.getMerchantName()); | |||||
| if(!StringUtils.isBlank(merchantName)) { | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(wxCreditHistory); | |||||
| merchantQ.setName(merchantName); | |||||
| List<Long> merchantIds = wxMerchantMapper.findIdList(merchantQ); | |||||
| if (null != merchantIds && merchantIds.size() > 0 ) { | |||||
| wxCreditHistory.setMerchantIds(merchantIds); | |||||
| } | |||||
| } | |||||
| String name = StringUtils.trimToNull(wxCreditHistory.getName()); | |||||
| String phone = StringUtils.trimToNull(wxCreditHistory.getPhone()); | |||||
| if (StringUtils.isBlank(name) && StringUtils.isBlank(phone)) { | |||||
| }else { | |||||
| WxCUserBasicInfo biq = new WxCUserBasicInfo(); | |||||
| biq.setFinalTenantId(wxCreditHistory.getFinalTenantId()); | |||||
| biq.setName(name); | |||||
| biq.setPhone(phone); | |||||
| List<Long> cUserIds = wxCUserBasicInfoMapper.findIdList(biq); | |||||
| if (null != cUserIds && cUserIds.size() > 0 ) { | |||||
| wxCreditHistory.setCUserIds(cUserIds); | |||||
| } | |||||
| } | |||||
| PageInfo<WxCreditHistory> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findListMore(wxCreditHistory)); | |||||
| PageInfo<WxCreditHistoryVo> retPageInfo = new PageInfo<WxCreditHistoryVo>(); | |||||
| retPageInfo.setPageNum(pageInfo.getPageNum()); | |||||
| retPageInfo.setPageSize(pageInfo.getPageSize()); | |||||
| retPageInfo.setPages(pageInfo.getPages()); | |||||
| retPageInfo.setList(creditHistoryToVoList(wxCreditHistory,pageInfo.getList())); | |||||
| return retPageInfo; | |||||
| } | |||||
| @Override | @Override | ||||
| public ResultData getCreditSummary(WxCreditHistory wxCreditHistory) { | public ResultData getCreditSummary(WxCreditHistory wxCreditHistory) { | ||||
| @@ -168,9 +373,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxCreditHistoryVo> listAsPageMore(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCreditHistoryVo> listAsPageMore(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | ||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<WxCreditHistoryVo> wxCreditHistoryVoList = wxCreditHistoryMapper.findListMore(record); | |||||
| return new PageInfo<>(wxCreditHistoryVoList); | |||||
| return findListMorePage(record,pageIndex,pageSize); | |||||
| } | } | ||||
| // public void supplyCreditInfo(List<WxCreditHistoryVo> wxCreditHistoryVoList) { | // public void supplyCreditInfo(List<WxCreditHistoryVo> wxCreditHistoryVoList) { | ||||
| @@ -45,16 +45,12 @@ | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | |||||
| where wcubi.`final_tenant_id` = #{finalTenantId} | |||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and wcubi.`id` = #{id} | and wcubi.`id` = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||||
| </if> | |||||
| <if test=" null != phone "> | <if test=" null != phone "> | ||||
| and wcubi.`phone` like concat('%', #{phone},'%') | and wcubi.`phone` like concat('%', #{phone},'%') | ||||
| </if> | </if> | ||||
| @@ -244,7 +240,7 @@ | |||||
| </sql> | </sql> | ||||
| <select id="findListPhoneAndNameByIds" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | <select id="findListPhoneAndNameByIds" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | ||||
| select id, phone, nick_name | |||||
| select id, phone, nick_name, name, sex | |||||
| from wx_c_user_basic_info wcubi | from wx_c_user_basic_info wcubi | ||||
| where wcubi.`final_tenant_id` = #{finalTenantId} | where wcubi.`final_tenant_id` = #{finalTenantId} | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| @@ -255,6 +251,12 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findIdList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="Long"> | |||||
| select id | |||||
| from wx_c_user_basic_info wcubi | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="findList1" resultMap="BaseResultMap"> | <select id="findList1" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| @@ -140,38 +140,60 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findListMore" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="com.iformall.domain.vo.WxCreditHistoryVo"> | |||||
| <select id="findListMore" parameterType="com.iformall.domain.po.WxCreditHistory" resultMap="BaseResultMap"> | |||||
| SELECT | SELECT | ||||
| credit.id creditId, | |||||
| case when basic.nick_name is null then basic.name else basic.nick_name end name, | |||||
| basic.phone phone, | |||||
| basic.sex sex, | |||||
| credit.tenant_id tenantId, | |||||
| credit.c_user_id cUserId, | |||||
| credit.credit_amount creditAmount, | |||||
| credit.credit_num creditNum, | |||||
| credit.create_date createDate, | |||||
| credit.credit_type creditType, | |||||
| credit.receipt_url receiptUrl, | |||||
| credit.operator_type operatorType, | |||||
| credit.operator_id operatorId, | |||||
| merchant.NAME merchantName, | |||||
| credit.merchant_id merchantId, | |||||
| credit.ticket_number ticketNumber, | |||||
| case when credit.operator_type=4 then (select name from mall_user_info where id=credit.operator_id) | |||||
| when credit.operator_type=3 then (select name from wx_merchant_b_user where id=credit.operator_id) | |||||
| when credit.operator_type=2 then (select nick_name from wx_c_user_basic_info where id=credit.operator_id) | |||||
| else '' end operator, | |||||
| credit.change_purpose changePurpose | |||||
| FROM | |||||
| wx_c_user_basic_info basic | |||||
| INNER JOIN wx_credit_history credit ON basic.id = credit.c_user_id | |||||
| LEFT JOIN wx_merchant merchant ON credit.merchant_id = merchant.id | |||||
| <include refid="customWhereConditions"/> | |||||
| ORDER BY | |||||
| credit.create_date desc,credit.id DESC | |||||
| credit.id ,credit.tenant_id ,credit.c_user_id ,credit.credit_amount ,credit.credit_num,credit.create_date,credit.credit_type,credit.receipt_url , | |||||
| credit.operator_type,credit.operator_id,credit.merchant_id,credit.ticket_number,credit.change_purpose | |||||
| FROM wx_credit_history credit | |||||
| where credit.`tenant_id` = #{tenantId} | |||||
| <if test=" null != startTime "> | |||||
| and credit.create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and credit.create_date < #{endTime} | |||||
| </if> | |||||
| <if test=" null != operatorType "> | |||||
| and credit.operator_type = #{operatorType} | |||||
| </if> | |||||
| <if test=" null != operatorId "> | |||||
| and credit.operator_id = #{operatorId} | |||||
| </if> | |||||
| <if test=" null != creditType "> | |||||
| and credit.credit_type = #{creditType} | |||||
| </if> | |||||
| <if test=" null != cUserId "> | |||||
| and credit.c_user_id = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and credit.merchant_id = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != ticketNumber and ''!=ticketNumber "> | |||||
| and credit.ticket_number like concat('%', #{ticketNumber},'%') | |||||
| </if> | |||||
| <if test=" null != buserId "> | |||||
| and credit.buser_id = #{buserId} | |||||
| </if> | |||||
| <if test=" null != merchantIds "> | |||||
| and credit.merchantId in | |||||
| <foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")"> | |||||
| #{merchantIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != cUserIds "> | |||||
| and credit.c_user_id in | |||||
| <foreach collection="cUserIds" index="index" item="cUserIdItem" open="(" separator="," close=")"> | |||||
| #{cUserIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| ORDER BY credit.id DESC | |||||
| <if test=" null != begin "> | |||||
| limit #{begin}, #{limit} | |||||
| </if> | |||||
| </select> | </select> | ||||
| <select id="loginCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Integer"> | <select id="loginCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Integer"> | ||||
| select COUNT(0) from wx_credit_history | select COUNT(0) from wx_credit_history | ||||
| where 1=1 | where 1=1 | ||||