|
|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.yami.shop.bean.model.PointsRecharge;
|
|
|
import com.yami.shop.bean.po.EnterpriseUserPo;
|
|
|
import com.yami.shop.bean.vo.PointsRechargeVO;
|
|
|
+import com.yami.shop.common.config.Constant;
|
|
|
import com.yami.shop.common.exception.GlobalException;
|
|
|
import com.yami.shop.common.util.PageParam;
|
|
|
import com.yami.shop.common.util.R;
|
|
|
@@ -15,15 +16,18 @@ import com.yami.shop.security.platform.model.YamiSysUser;
|
|
|
import com.yami.shop.security.platform.util.SecurityUtils;
|
|
|
import com.yami.shop.service.PointsRechargeService;
|
|
|
import com.yami.shop.service.UserService;
|
|
|
+import com.yami.shop.sys.service.SysUserService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -40,6 +44,8 @@ import java.util.List;
|
|
|
public class PointsRechargeController {
|
|
|
|
|
|
private final PointsRechargeService pointsRechargeService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
/**
|
|
|
* 分页获取积分充值列表
|
|
|
@@ -49,8 +55,18 @@ public class PointsRechargeController {
|
|
|
if (pointsRecharge==null||pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty()){
|
|
|
return R.FAIL("请求参数-所属企业不允许为空");
|
|
|
}
|
|
|
+ if (pointsRecharge.getChannelIdList().contains(0L)){
|
|
|
+ Long userId = SecurityUtils.getSysUser().getUserId();
|
|
|
+ List<Long> channelIdList = sysUserService.findByUserIdListId(userId);
|
|
|
+ pointsRecharge.setChannelIdList(channelIdList);
|
|
|
+ if (userId != Constant.SUPER_ADMIN_ID&&(pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty())){
|
|
|
+ List<Long> longs = new ArrayList<>();
|
|
|
+ longs.add(0L);
|
|
|
+ pointsRecharge.setChannelIdList(longs);
|
|
|
+ }
|
|
|
+ }
|
|
|
IPage<PointsRecharge> page = pointsRechargeService.page(pageParam,new LambdaQueryWrapper<PointsRecharge>()
|
|
|
- .in(PointsRecharge::getChannelId,pointsRecharge.getChannelIdList())
|
|
|
+ .in(ObjectUtils.isNotEmpty(pointsRecharge.getChannelIdList()),PointsRecharge::getChannelId,pointsRecharge.getChannelIdList())
|
|
|
.eq(ObjectUtils.isNotEmpty(pointsRecharge.getUserPhone()),PointsRecharge::getUserPhone,pointsRecharge.getUserPhone())
|
|
|
.orderByDesc(PointsRecharge::getCreateTime)
|
|
|
);
|
|
|
@@ -63,6 +79,19 @@ public class PointsRechargeController {
|
|
|
*/
|
|
|
@GetMapping("/statisticsList")
|
|
|
public R<IPage<PointsRechargeVO>> statisticsList(PageParam<PointsRecharge> pageParam, PointsRecharge pointsRecharge) {
|
|
|
+ if (pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty()){
|
|
|
+ throw new GlobalException("请求参数-所属企业不允许为空");
|
|
|
+ }
|
|
|
+ if (pointsRecharge.getChannelIdList().contains(0L)){
|
|
|
+ Long userId = SecurityUtils.getSysUser().getUserId();
|
|
|
+ List<Long> channelIdList = sysUserService.findByUserIdListId(userId);
|
|
|
+ pointsRecharge.setChannelIdList(channelIdList);
|
|
|
+ if (userId != Constant.SUPER_ADMIN_ID&&(pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty())){
|
|
|
+ List<Long> longs = new ArrayList<>();
|
|
|
+ longs.add(0L);
|
|
|
+ pointsRecharge.setChannelIdList(longs);
|
|
|
+ }
|
|
|
+ }
|
|
|
IPage<PointsRechargeVO> page = pointsRechargeService.statisticsList(pointsRecharge);
|
|
|
return R.SUCCESS(page);
|
|
|
}
|
|
|
@@ -145,6 +174,22 @@ public class PointsRechargeController {
|
|
|
if (pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty()){
|
|
|
throw new GlobalException("请求参数-所属企业不允许为空");
|
|
|
}
|
|
|
+ if (pointsRecharge.getChannelIdList().contains(0L)){
|
|
|
+ Long userId = null;
|
|
|
+ try {
|
|
|
+ userId = SecurityUtils.getSysUser().getUserId();
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new GlobalException("获取当前登录用户失败");
|
|
|
+ }
|
|
|
+ List<Long> channelIdList = sysUserService.findByUserIdListId(userId);
|
|
|
+ pointsRecharge.setChannelIdList(channelIdList);
|
|
|
+ if (userId != Constant.SUPER_ADMIN_ID&&(pointsRecharge.getChannelIdList()==null||pointsRecharge.getChannelIdList().isEmpty())){
|
|
|
+ List<Long> longs = new ArrayList<>();
|
|
|
+ longs.add(0L);
|
|
|
+ pointsRecharge.setChannelIdList(longs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
pointsRechargeService.export(pointsRecharge,response);
|
|
|
}
|
|
|
|