Просмотр исходного кода

日志列表导出

release_toaliyun_real
lrh 2 лет назад
Родитель
Сommit
98b09dd967
10 измененных файлов: 96 добавлений и 14 удалений
  1. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java
  2. +24
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardDailyLogController.java
  3. +10
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCardDailyLog.java
  4. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  5. +4
    -0
      mallinkService/src/main/java/com/iformall/service/WxCardDailyLogService.java
  6. +32
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCardDailyLogServiceImpl.java
  7. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java
  8. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java
  9. +10
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  10. +7
    -0
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/config/ShiroConfig.java Просмотреть файл

@@ -162,8 +162,8 @@ public class ShiroConfig {
//配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了 //配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
filterChainDefinitionMap.put("/logout", "authc"); filterChainDefinitionMap.put("/logout", "authc");


filterChainDefinitionMap.put("/**", "corsFilter,token,authc");
// filterChainDefinitionMap.put("/**", "anon");
// filterChainDefinitionMap.put("/**", "corsFilter,token,authc");
filterChainDefinitionMap.put("/**", "anon");




shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);


+ 24
- 2
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardDailyLogController.java Просмотреть файл

@@ -2,22 +2,30 @@ package com.iformall.controller.market;




import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController; import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.WxCardDailyLog; import com.iformall.domain.po.WxCardDailyLog;
import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.vo.WxCardVo;
import com.iformall.service.WxCardDailyLogService; import com.iformall.service.WxCardDailyLogService;
import com.iformall.service.WxCardSpendService; import com.iformall.service.WxCardSpendService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;



/** /**
* @version 1.0 * @version 1.0
@@ -34,17 +42,31 @@ public class WxCardDailyLogController extends BaseController {
WxCardDailyLogService wxCardDailyLogService; WxCardDailyLogService wxCardDailyLogService;


@ApiOperation("分页列表接口") @ApiOperation("分页列表接口")
@GetMapping("list")
@GetMapping("/list")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData list(@ModelAttribute WxCardDailyLog wxCardDailyLog, Integer pageNum, Integer pageSize) { public ResultData list(@ModelAttribute WxCardDailyLog wxCardDailyLog, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCouponController::list"); logger.debug("[" + getIpAddr() + "] WxCouponController::list");
if (wxCardDailyLog == null) wxCardDailyLog = new WxCardDailyLog(); if (wxCardDailyLog == null) wxCardDailyLog = new WxCardDailyLog();
wxCardDailyLog.updateTenantInfo(getTenantInfo());
// wxCardDailyLog.updateTenantInfo(getTenantInfo());
wxCardDailyLog.setTenantId("789");
wxCardDailyLog.setSortColumns(BaseEntity.SortField.CreateDate_DESC); wxCardDailyLog.setSortColumns(BaseEntity.SortField.CreateDate_DESC);
PageInfo<WxCardDailyLog> info = wxCardDailyLogService.listAsPage(wxCardDailyLog, pageNum, pageSize); PageInfo<WxCardDailyLog> info = wxCardDailyLogService.listAsPage(wxCardDailyLog, pageNum, pageSize);
return new ResultData(info); return new ResultData(info);
} }


@ApiOperation("消费卡日志-导出数据")
@GetMapping("/exportCardLog")
@SystemControllerLog(description = "消费卡日志-导出数据")
public void exportCardOrder(@ModelAttribute WxCardDailyLog wxCardDailyLog, HttpServletRequest request, HttpServletResponse response) {
logger.info("[" + getIpAddr() + "] cardDailyLog/exportCardLog");
if (wxCardDailyLog == null) {
wxCardDailyLog = new WxCardDailyLog();
}
wxCardDailyLog.setTenantId("789");
// wxCardDailyLog.updateTenantInfo(getTenantInfo());
wxCardDailyLogService.exportData(wxCardDailyLog, request, response);
}

} }

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

@@ -1,5 +1,6 @@
package com.iformall.domain.po; package com.iformall.domain.po;


import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
@@ -15,32 +16,41 @@ import java.util.List;
public class WxCardDailyLog extends TenantEntity { public class WxCardDailyLog extends TenantEntity {
protected Long id; protected Long id;
@io.swagger.annotations.ApiModelProperty(value="卡密id",name="cardPasswordId") @io.swagger.annotations.ApiModelProperty(value="卡密id",name="cardPasswordId")
@Excel(name = "卡密ID", width = 20, orderNum = "4")
private Long cardPasswordId; private Long cardPasswordId;
@io.swagger.annotations.ApiModelProperty(value="ip",name="ip") @io.swagger.annotations.ApiModelProperty(value="ip",name="ip")
private String ip; private String ip;
@io.swagger.annotations.ApiModelProperty(value="",name="price") @io.swagger.annotations.ApiModelProperty(value="",name="price")
private Integer price; private Integer price;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
@Excel(name = "操作时间", width = 20, orderNum = "4",format="yyyy-MM-dd HH:mm:ss")
private Date createDate; private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate; private Date updateDate;


@io.swagger.annotations.ApiModelProperty(value="",name="remark") @io.swagger.annotations.ApiModelProperty(value="",name="remark")
@Excel(name = "备注", width = 20, orderNum = "4")
private String remark; private String remark;


@io.swagger.annotations.ApiModelProperty(value="",name="operatorType") @io.swagger.annotations.ApiModelProperty(value="",name="operatorType")
private Integer operatorType; private Integer operatorType;
@io.swagger.annotations.ApiModelProperty(value="",name="operatorId") @io.swagger.annotations.ApiModelProperty(value="",name="operatorId")
private Long operatorId; private Long operatorId;
@Excel(name = "操作人", width = 20, orderNum = "4")
@io.swagger.annotations.ApiModelProperty(value="EnumUserType",name="operatorUser") @io.swagger.annotations.ApiModelProperty(value="EnumUserType",name="operatorUser")
private String operatorUser; private String operatorUser;


@io.swagger.annotations.ApiModelProperty(value="父卷id",name="couponId") @io.swagger.annotations.ApiModelProperty(value="父卷id",name="couponId")
@Excel(name = "消费卡ID", width = 20, orderNum = "4")
private Long couponId; private Long couponId;
@io.swagger.annotations.ApiModelProperty(value="卡卷Id",name="cardInfoId") @io.swagger.annotations.ApiModelProperty(value="卡卷Id",name="cardInfoId")
@Excel(name = "实体卡卡号", width = 20, orderNum = "4")
private Long cardInfoId; private Long cardInfoId;
@io.swagger.annotations.ApiModelProperty(value="操作类型 1-创建,2-设置面额,3-充值 EnumOperateLogType",name="type") @io.swagger.annotations.ApiModelProperty(value="操作类型 1-创建,2-设置面额,3-充值 EnumOperateLogType",name="type")
private Integer type; private Integer type;
@TableField(exist = false)
@Excel(name = "操作类型", width = 20, orderNum = "4")
private String typeDes;
@io.swagger.annotations.ApiModelProperty(value="卡卷总数",name="count") @io.swagger.annotations.ApiModelProperty(value="卡卷总数",name="count")
private Integer count; private Integer count;




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

@@ -416,6 +416,9 @@ public class WxCoupon extends TenantEntity {
@TableField(exist = false) @TableField(exist = false)
private String[] mallTenantIds; private String[] mallTenantIds;


@TableField(exist = false)
private List<Long> couponIds;

public String getSalePriceStr() { public String getSalePriceStr() {
if(salePrice!=null) { if(salePrice!=null) {
salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString(); salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString();


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

@@ -3,6 +3,9 @@ package com.iformall.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public interface WxCardDailyLogService { public interface WxCardDailyLogService {


/** /**
@@ -23,4 +26,5 @@ public interface WxCardDailyLogService {
*/ */
void saveOrUpdate(WxCardDailyLog record); void saveOrUpdate(WxCardDailyLog record);


void exportData(WxCardDailyLog wxCardDailyLog, HttpServletRequest request, HttpServletResponse response);
} }

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

@@ -4,6 +4,8 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker; import com.iformall.common.IdWorker;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCardVo;
import com.iformall.enums.EnumOperateLogType;
import com.iformall.mapper.*; import com.iformall.mapper.*;
import com.iformall.service.*; import com.iformall.service.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@@ -13,6 +15,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;


@@ -27,6 +31,9 @@ public class WxCardDailyLogServiceImpl implements WxCardDailyLogService {
@Autowired @Autowired
WxCouponService wxCouponService; WxCouponService wxCouponService;


@Autowired
ExcelService excelService;



@Override @Override
public PageInfo<WxCardDailyLog> listAsPage(WxCardDailyLog record, Integer pageIndex, Integer pageSize) { public PageInfo<WxCardDailyLog> listAsPage(WxCardDailyLog record, Integer pageIndex, Integer pageSize) {
@@ -70,4 +77,29 @@ public class WxCardDailyLogServiceImpl implements WxCardDailyLogService {
} }
} }


@Override
public void exportData(WxCardDailyLog record, HttpServletRequest request, HttpServletResponse response) {
if (StringUtils.isNotBlank(record.getTitle())) {
List<WxCoupon> title = wxCouponService.getByIdListOrTitle(new ArrayList<>(), record.getTenantId(), record.getTitle());
if (!CollectionUtils.isEmpty(title)) {
List<Long> couponIds = title.parallelStream().map(WxCoupon::getId).collect(Collectors.toList());
record.setCouponIds(couponIds);
}
}

List<WxCardDailyLog> pageInfo = wxCardDailyLogMapper.findList(record);
if (!CollectionUtils.isEmpty(pageInfo)) {
List<Long> couponIds = pageInfo.parallelStream().map(WxCardDailyLog::getCouponId).collect(Collectors.toList());
List<WxCoupon> list = wxCouponService.getByIdListOrTitle(couponIds, record.getTenantId(), null);
if (!CollectionUtils.isEmpty(list)) {
Map<Long, String> map = list.parallelStream().collect(Collectors.toMap(WxCoupon::getId, WxCoupon::getTitle));
for (WxCardDailyLog log : pageInfo) {
log.setTitle(map.get(log.getCouponId()));
log.setTypeDes(EnumOperateLogType.getEnum(log.getType()).getInfo());
}
}
}
excelService.exportExcel(pageInfo, null, "消费卡日志", WxCardDailyLog.class, "消费卡日志.xlsx", response, false);
}

} }

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

@@ -360,7 +360,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService {
WxCoupon wxCoupon = wxCouponMapper.selectById(wxCardInfo.getCouponId(), wxCardInfo.getTenantId()); WxCoupon wxCoupon = wxCouponMapper.selectById(wxCardInfo.getCouponId(), wxCardInfo.getTenantId());


Integer type = cardInfo.getStatus() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode(); Integer type = cardInfo.getStatus() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode();
String remark = user.getUsername() + "给卡密[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(type).getInfo();
String remark = user.getUsername() + "给实体卡卡号[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(type).getInfo();
insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon, type, remark, wxCardInfo.getRemainingAmount()); insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon, type, remark, wxCardInfo.getRemainingAmount());


}catch (Exception e){ }catch (Exception e){
@@ -520,7 +520,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService {
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!"); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!");
} }


String remark = user.getUsername() + "给卡密[" + wxCardInfo.getId() + "]" + "充值,金额:" + cardInfo.getAmount() + "分";
String remark = user.getUsername() + "给实体卡卡号[" + wxCardInfo.getId() + "]" + "充值,金额:" + cardInfo.getAmount()/100 + "元";
insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon,EnumOperateLogType.RECHARGE.getCode(),remark, cardInfo.getAmount()); insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon,EnumOperateLogType.RECHARGE.getCode(),remark, cardInfo.getAmount());


if(record.getCardBeforeAmount().equals(0)){ if(record.getCardBeforeAmount().equals(0)){


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

@@ -349,7 +349,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService {
cardSetPrice.setCardInfoId(cardInfo.getId()); cardSetPrice.setCardInfoId(cardInfo.getId());
cardSetPrice.setType(wxCouponPassword.getIsStop() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode()); cardSetPrice.setType(wxCouponPassword.getIsStop() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode());
cardSetPrice.setCount(1); cardSetPrice.setCount(1);
cardSetPrice.setRemark(user.getUsername() + "给卡密[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(cardSetPrice.getType()).getInfo());
cardSetPrice.setRemark(user.getUsername() + "给实体卡卡号[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(cardSetPrice.getType()).getInfo());
wxCardDailyLogService.saveOrUpdate(cardSetPrice); wxCardDailyLogService.saveOrUpdate(cardSetPrice);
}catch (Exception e){ }catch (Exception e){
logger.error("startOrStop insert error"); logger.error("startOrStop insert error");
@@ -398,7 +398,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService {
cardSetPrice.setCouponId(wxCoupon.getCouponId()); cardSetPrice.setCouponId(wxCoupon.getCouponId());
cardSetPrice.setType(EnumOperateLogType.SET_DENOMINATION.getCode()); cardSetPrice.setType(EnumOperateLogType.SET_DENOMINATION.getCode());
cardSetPrice.setCount(1); cardSetPrice.setCount(1);
cardSetPrice.setRemark(user.getUsername() + "给卡密[" + cardSetPrice.getCardPasswordId() + "]设置了面额,金额:" + cardSetPrice.getPrice() + "分");
cardSetPrice.setRemark(user.getUsername() + "给实体卡卡号[" + cardSetPrice.getCardPasswordId() + "]设置了面额,金额:" + cardSetPrice.getPrice()/100 + "元");
wxCardDailyLogService.saveOrUpdate(cardSetPrice); wxCardDailyLogService.saveOrUpdate(cardSetPrice);
} }
return count; return count;


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

@@ -1829,7 +1829,7 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponChannelService.spuStatusSyncByCoupon(tenantInfo,couponId); wxCouponChannelService.spuStatusSyncByCoupon(tenantInfo,couponId);


WxCoupon record = wxCouponMapper.selectById(couponId, tenantInfo.getTenantId()); WxCoupon record = wxCouponMapper.selectById(couponId, tenantInfo.getTenantId());
String remark = (user != null ? user.getUsername() : "") + "创建了卡[" + record.getTitle() + "], 库存:";
String remark = (user != null ? user.getUsername() : "") + "作废卡[" + record.getTitle() + "], 库存:";
insertWxCardDailyLogInfo(user, record, false, remark); insertWxCardDailyLogInfo(user, record, false, remark);
} }
return new ResultData(); return new ResultData();
@@ -2107,11 +2107,15 @@ public class WxCouponServiceImpl implements WxCouponService {


@Override @Override
public List<WxCoupon> getByIdListOrTitle(List<Long> couponIds, String tenantId, String title) { public List<WxCoupon> getByIdListOrTitle(List<Long> couponIds, String tenantId, String title) {
return wxCouponMapper.selectList(new LambdaQueryWrapper<WxCoupon>()
.eq(WxCoupon::getIsDel, 0)
.in(CollectionUtils.isNotEmpty(couponIds), WxCoupon::getId, couponIds)
.like(StringUtils.isNotBlank(title), WxCoupon::getTitle, title)
.eq(TenantEntity::getTenantId, tenantId));
WxCoupon coupon = new WxCoupon();
coupon.setTenantId(tenantId);
if (CollectionUtils.isNotEmpty(couponIds)) {
coupon.setCouponIds(couponIds);
}
if (StringUtils.isNotBlank(title)) {
coupon.setTitle(title);
}
return wxCouponMapper.findList(coupon);
} }






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

@@ -364,6 +364,13 @@
</foreach> </foreach>
</if> </if>


<if test=" null != couponIds ">
and id in
<foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")">
#{couponIdsItem}
</foreach>
</if>

<if test=" null != sortColumns">order by ${sortColumns}</if> <if test=" null != sortColumns">order by ${sortColumns}</if>
</sql> </sql>




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