| @@ -18,6 +18,9 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @RestController | |||
| @RequestMapping("wxCreditHistory") | |||
| public class WxCreditHistoryController extends BaseController { | |||
| @@ -87,4 +90,11 @@ public class WxCreditHistoryController extends BaseController { | |||
| return new ResultData(Result.SUCCESS); | |||
| } | |||
| @GetMapping("exportData") | |||
| @SystemControllerLog(description = "积分历史-导出数据") | |||
| public void exportData(@ModelAttribute WxCreditHistory wxCreditHistory, HttpServletRequest request, HttpServletResponse response) { | |||
| wxCreditHistory.setTenantId(getTenantId()); | |||
| wxCreditHistoryService.exportData(request, response, wxCreditHistory); | |||
| } | |||
| } | |||
| @@ -72,7 +72,9 @@ public class WxCreditHistory implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="兑换用途",name="changePurpose") | |||
| private String changePurpose; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value = "商户名称", name = "merchantName") | |||
| private String merchantName; | |||
| public static enum Field | |||
| { | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| @@ -7,51 +8,63 @@ import java.util.Date; | |||
| @Data | |||
| public class WxCreditHistoryVo { | |||
| @io.swagger.annotations.ApiModelProperty(value="手机号",name="phone") | |||
| private String phone; | |||
| @Excel(name = "微信昵称", width = 20, orderNum = "1") | |||
| @io.swagger.annotations.ApiModelProperty(value="姓名",name="name") | |||
| private String name; | |||
| @Excel(name = "手机号", width = 20, orderNum = "2") | |||
| @io.swagger.annotations.ApiModelProperty(value = "手机号", name = "phone") | |||
| private String phone; | |||
| @Excel(name = "性别", width = 20, orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="性别",name="sex") | |||
| private String sex; | |||
| @io.swagger.annotations.ApiModelProperty(value="积分ID",name="creditId") | |||
| private String creditId; | |||
| @Excel(name = "总积分", width = 20, orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value = "总积分", name = "creditAmount") | |||
| private Integer creditAmount; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @Excel(name = "积分操作", width = 20, orderNum = "5") | |||
| @io.swagger.annotations.ApiModelProperty(value = "每笔积分明细", name = "creditNum") | |||
| private Integer creditNum; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | |||
| private Long cUserId; | |||
| @Excel(name = "时间", width = 20, orderNum = "6", format = "yyyy-MM-dd HH:mm:ss") | |||
| @io.swagger.annotations.ApiModelProperty(value = "创建日期", name = "createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="总积分",name="creditAmount") | |||
| private Integer creditAmount; | |||
| @Excel(name = "消费商户", width = 20, orderNum = "7") | |||
| @io.swagger.annotations.ApiModelProperty(value = "商户", name = "merchantName") | |||
| private String merchantName; | |||
| @io.swagger.annotations.ApiModelProperty(value="每笔积分明细",name="creditNum") | |||
| private Integer creditNum; | |||
| @Excel(name = "积分来源", width = 20, orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value = "操作人类型", name = "operator") | |||
| private Integer operatorType; | |||
| @io.swagger.annotations.ApiModelProperty(value="积分类型",name="creditType") | |||
| @Excel(name = "操作说明", width = 20, orderNum = "9", replace = {"每日登录_1", "消费_2", "绑车牌_3", "连接WIFI_4", "微信用户昵称授权_5", "微信用户手机授权_6", "完善个人信息_7", "会员导入_8", "会员成长值扣减_9", "新增积分_10", "积分兑换_11", "消费积分_12", "活动报名_13"}) | |||
| @io.swagger.annotations.ApiModelProperty(value = "积分类型", name = "creditType") | |||
| private Integer creditType; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="小票URL",name="receiptUrl") | |||
| @Excel(name = "购物小票", width = 20, orderNum = "10") | |||
| @io.swagger.annotations.ApiModelProperty(value = "小票URL", name = "receiptUrl") | |||
| private String receiptUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户",name="merchantName") | |||
| private String merchantName; | |||
| @Excel(name = "操作人", width = 20, orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value = "操作人", name = "operator") | |||
| private String operator; | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人类型",name="operator") | |||
| private Integer operatorType; | |||
| @io.swagger.annotations.ApiModelProperty(value="积分ID",name="creditId") | |||
| private String creditId; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | |||
| private Long cUserId; | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||
| private Long operatorId; | |||
| @io.swagger.annotations.ApiModelProperty(value="操作人",name="operator") | |||
| private String operator; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||
| private Long merchantId; | |||
| @@ -4,6 +4,8 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| public interface WxCreditHistoryService { | |||
| @@ -53,4 +55,7 @@ public interface WxCreditHistoryService { | |||
| Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, String tenantId); | |||
| void clearCreditByYear(); | |||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory); | |||
| } | |||
| @@ -13,6 +13,7 @@ import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxCreditHistoryService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import com.iformall.utils.RedisLock; | |||
| @@ -23,6 +24,8 @@ import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -60,6 +63,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| @Autowired | |||
| RedisLock redisLock; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Override | |||
| public void clearCreditByYear() { | |||
| WxScoreRules wxScoreRules = new WxScoreRules(); | |||
| @@ -69,6 +75,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| } | |||
| @Override | |||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory) { | |||
| List<WxCreditHistoryVo> wxCreditHistoryVoList = wxCreditHistoryMapper.findListMore(wxCreditHistory); | |||
| if (!wxCreditHistoryVoList.isEmpty()) { | |||
| supplyCreditInfo(wxCreditHistoryVoList); | |||
| } | |||
| excelService.exportExcel(wxCreditHistoryVoList, null, "积分变更记录", WxCreditHistoryVo.class, "积分变更记录.xlsx", response, false); | |||
| } | |||
| @Override | |||
| public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); | |||
| @@ -81,6 +97,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| if (wxCreditHistoryVoList == null || wxCreditHistoryVoList.size() == 0) { | |||
| return new PageInfo<>(wxCreditHistoryVoList); | |||
| } | |||
| supplyCreditInfo(wxCreditHistoryVoList); | |||
| return new PageInfo<>(wxCreditHistoryVoList); | |||
| } | |||
| public void supplyCreditInfo(List<WxCreditHistoryVo> wxCreditHistoryVoList) { | |||
| List<Long> cUserIds = wxCreditHistoryVoList.stream().filter(a -> a.getOperatorType().equals(EnumUserType.CUSER.getCode())).map(WxCreditHistoryVo::getOperatorId).collect(Collectors.toList()); | |||
| List<Long> cUserBasicIds = wxCreditHistoryVoList.stream().filter(a -> a.getOperatorType().equals(EnumUserType.CUSERBASIC.getCode())).map(WxCreditHistoryVo::getOperatorId).collect(Collectors.toList()); | |||
| List<Long> bUserIds = wxCreditHistoryVoList.stream().filter(a -> a.getOperatorType().equals(EnumUserType.BUSER.getCode())).map(WxCreditHistoryVo::getOperatorId).collect(Collectors.toList()); | |||
| @@ -142,7 +163,6 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| credit.setMerchantName(EnumMerchantType.MERCHANT_MORE.getMessage()); | |||
| } | |||
| } | |||
| return new PageInfo<>(wxCreditHistoryVoList); | |||
| } | |||
| @Override | |||
| @@ -105,6 +105,9 @@ | |||
| <if test=" null != merchantId "> | |||
| and credit.merchant_id = #{merchantId} | |||
| </if> | |||
| <if test=" null != merchantName and ''!=merchantName "> | |||
| and merchant.name like concat('%', #{merchantName},'%') | |||
| </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCreditHistory" resultMap="BaseResultMap"> | |||