超管座驾管理
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.accompany.admin.model.guild;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 后台超管【赠送座驾】权限表实体类
|
||||
*
|
||||
* @author
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
@Data
|
||||
public class GuildAdminCarRef implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id" , type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Integer roleId;
|
||||
private Integer carId;
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.accompany.admin.mapper.guild;
|
||||
|
||||
import com.accompany.admin.model.guild.GuildAdminCarRef;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* 后台超管【赠送座驾】权限表 Mapper 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
public interface GuildAdminCarRefMapper extends BaseMapper<GuildAdminCarRef> {
|
||||
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.accompany.admin.service.guild;
|
||||
|
||||
import com.accompany.admin.mapper.guild.GuildAdminCarRefMapper;
|
||||
import com.accompany.admin.model.guild.GuildAdminCarRef;
|
||||
import com.accompany.admin.service.system.AdminUserService;
|
||||
import com.accompany.admin.vo.AdminUserVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 后台超管【赠送座驾】权限表 服务实现类
|
||||
*
|
||||
* @author
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
@Service
|
||||
public class GuildAdminCarRefService extends ServiceImpl<GuildAdminCarRefMapper, GuildAdminCarRef> {
|
||||
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
public List<Integer> carIds(Integer adminId) {
|
||||
AdminUserVo adminUserVo = adminUserService.getByAdminId(adminId);
|
||||
if (adminUserVo == null || CollectionUtils.isEmpty(adminUserVo.getRoleIds())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
LambdaQueryWrapper<GuildAdminCarRef> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.in(GuildAdminCarRef::getRoleId, adminUserVo.getRoleIds());
|
||||
List<GuildAdminCarRef> guildAdminHeadwearRefs = baseMapper.selectList(wrapper);
|
||||
if (CollectionUtils.isEmpty(guildAdminHeadwearRefs)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return guildAdminHeadwearRefs.stream().map(GuildAdminCarRef::getCarId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package com.accompany.admin.service.guild;
|
||||
|
||||
import com.accompany.admin.base.Pagination;
|
||||
import com.accompany.admin.dto.NameplateDto;
|
||||
import com.accompany.admin.service.family.FamilyIncomeAdminService;
|
||||
import com.accompany.admin.service.family.FamilyManageAdminService;
|
||||
@@ -11,8 +12,11 @@ import com.accompany.admin.vo.AdminUserVo;
|
||||
import com.accompany.admin.vo.family.FamilyAdminVo;
|
||||
import com.accompany.admin.vo.guild.GuildApplyAuditVo;
|
||||
import com.accompany.admin.vo.vip.VipSendRecordVo;
|
||||
import com.accompany.business.model.CarGoods;
|
||||
import com.accompany.business.model.family.Family;
|
||||
import com.accompany.business.model.guild.GuildSuperAdminInfo;
|
||||
import com.accompany.business.service.car.CarGoodsService;
|
||||
import com.accompany.business.service.car.CarPayService;
|
||||
import com.accompany.business.service.guild.GuildSuperAdminInfoService;
|
||||
import com.accompany.business.service.headwear.HeadwearService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
@@ -21,7 +25,7 @@ import com.accompany.business.vo.guild.GuildDiamondStatisticsDayVo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.enumeration.PartitionEnum;
|
||||
import com.accompany.common.utils.BlankUtil;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -31,10 +35,10 @@ import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static java.util.Collections.EMPTY_LIST;
|
||||
|
||||
@@ -70,6 +74,12 @@ public class GuildSuperAdminService {
|
||||
private GuildSuperAdminInfoService guildSuperAdminInfoService;
|
||||
@Autowired
|
||||
private GuildDiamondStatisticsDayAdminService guildDiamondStatisticsDayAdminService;
|
||||
@Autowired
|
||||
private GuildAdminCarRefService guildAdminCarRefService;
|
||||
@Autowired
|
||||
private CarGoodsService carGoodsService;
|
||||
@Autowired
|
||||
private CarPayService carPayService;
|
||||
|
||||
public void createFamily(Long erbanNo, Long inviteErbanNo, Integer adminId) {
|
||||
AdminUserVo adminUserVo = adminUserService.getByAdminId(adminId);
|
||||
@@ -117,12 +127,12 @@ public class GuildSuperAdminService {
|
||||
if (null == u){
|
||||
throw new AdminServiceException(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
if (vipLevel > 3) {
|
||||
if (vipLevel > 4) {
|
||||
throw new AdminServiceException("vipLevel error");
|
||||
}
|
||||
boolean partitionCheck = adminUserVo.getPartitionIds().contains(u.getPartitionId());
|
||||
if (!partitionCheck) {
|
||||
throw new AdminServiceException("会长ID Part Error");
|
||||
throw new AdminServiceException("ID Part Error");
|
||||
}
|
||||
vipSendAdminService.send(uid, vipLevel, adminId, days, Boolean.FALSE);
|
||||
}
|
||||
@@ -229,6 +239,90 @@ public class GuildSuperAdminService {
|
||||
return retMap;
|
||||
}
|
||||
|
||||
public Pagination<CarGoods> getCarGoodsList(Integer page, Integer pageSize, Integer adminId) {
|
||||
|
||||
List<Integer> carGoodsIds = guildAdminCarRefService.carIds(adminId);
|
||||
if (CollectionUtils.isEmpty(carGoodsIds)) {
|
||||
throw new AdminServiceException("CONFIG ERROR:");
|
||||
}
|
||||
Pagination<CarGoods> pagination = new Pagination<>();
|
||||
pagination.setTotal(carGoodsService.countCarGoods((byte)2, null, null, null, null, carGoodsIds));
|
||||
pagination.setRows(carGoodsService.getCarGoodsList(page, pageSize, (byte)2, null, null, null, null, null, carGoodsIds));
|
||||
return pagination;
|
||||
}
|
||||
|
||||
public Map carSend(String erbanNo, Integer carId, Integer days, String desc, Integer otherDay, Integer adminId) {
|
||||
|
||||
List<Integer> carGoodsIds = guildAdminCarRefService.carIds(adminId);
|
||||
if (carGoodsIds == null || carGoodsIds.isEmpty() || !carGoodsIds.contains(carId)) {
|
||||
throw new AdminServiceException("config ERROR:");
|
||||
}
|
||||
AdminUserVo adminUserVo = adminUserService.getByAdminId(adminId);
|
||||
|
||||
//赠送失败的平台号
|
||||
List<String> failErban = new ArrayList<String>();
|
||||
//赠送失败原因
|
||||
List<String> failReason = new ArrayList<String>();
|
||||
Map retMap = new HashMap();
|
||||
//前台js换行符为'\n'
|
||||
String[] erbanList = erbanNo.split("\n");
|
||||
try {
|
||||
if (erbanList == null || carId == null || days == null || BlankUtil.isBlank(desc)) {
|
||||
throw new AdminServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
if (days <= 0 || carId <= 0 || erbanList.length <= 0) {
|
||||
throw new AdminServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
if(otherDay != null && (otherDay <= 0 || otherDay >= 365)){
|
||||
throw new AdminServiceException(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
if(otherDay != null ){
|
||||
log.info("超管赠送座驾 erbanNo:{},carId:{}, days:{} 更换为 otherDay:{}",erbanNo,carId,days,otherDay);
|
||||
days = otherDay;
|
||||
}
|
||||
final CountDownLatch latch = new CountDownLatch(erbanList.length);
|
||||
ExecutorService executors = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 4 - 1);
|
||||
for (String erban : erbanList) {
|
||||
Integer sendDays = days;
|
||||
executors.execute(()->{
|
||||
try {
|
||||
Users users = usersService.getUserByErbanNo(Long.valueOf(erban));
|
||||
if (users == null) {
|
||||
throw new AdminServiceException(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
Long uid = users.getUid();
|
||||
CarGoods carGoods = carGoodsService.getCarGoods(carId);
|
||||
if (carGoods == null) {
|
||||
throw new AdminServiceException(BusiStatus.CARPORTNOTEXIST);
|
||||
}
|
||||
if (!adminUserVo.getPartitionIds().contains(users.getPartitionId())) {
|
||||
throw new AdminServiceException("ID:"+ erban +" Part Error");
|
||||
}
|
||||
carPayService.experCarByOfficial(uid, carId, sendDays, desc, true);
|
||||
} catch (AdminServiceException e) {
|
||||
log.error("exper error:{}", e);
|
||||
failErban.add(erban);
|
||||
failReason.add(e.getMessage());
|
||||
}finally {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
}
|
||||
latch.await();
|
||||
if (failErban.size() > 0) {
|
||||
retMap.put("code", "200");
|
||||
retMap.put("erban", failErban.toString());
|
||||
retMap.put("message", failReason.toString());
|
||||
} else {
|
||||
retMap.put("code", "100");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("exper function error:{}", e);
|
||||
retMap.put("code", "300");
|
||||
retMap.put("message", e.getMessage());
|
||||
}
|
||||
return retMap;
|
||||
}
|
||||
|
||||
public Page<FamilyIncomeAdminVo> pageFamilyIncome(Long erbanNo, Integer regionId, String familyName, String startDate, String endDate,
|
||||
long pageNum, long pageSize, Integer partitionId, Integer adminId) {
|
||||
@@ -266,7 +360,8 @@ public class GuildSuperAdminService {
|
||||
if (inviteUid == null) {
|
||||
return new Page<>();
|
||||
}
|
||||
return guildDiamondStatisticsDayAdminService.list(startDate, endDate, null, null, guildId, ownerErbanNo, pageNo, pageSize, inviteUid);
|
||||
AdminUserVo adminUserVo = adminUserService.getByAdminId(adminId);
|
||||
return guildDiamondStatisticsDayAdminService.list(startDate, endDate, adminUserVo.getPartitionIds().get(0), null, guildId, ownerErbanNo, pageNo, pageSize, inviteUid);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -51,8 +51,8 @@ public class CarGoodsAdminController extends BaseController {
|
||||
enable = null;
|
||||
}
|
||||
Pagination<CarGoods> pagination = new Pagination<>();
|
||||
pagination.setTotal(carGoodsService.countCarGoods(enable, carGoodsId, carGoodsName, carGoodsType, partitionId));
|
||||
pagination.setRows(carGoodsService.getCarGoodsList(page, pageSize, enable, null, carGoodsId, carGoodsName, carGoodsType, partitionId));
|
||||
pagination.setTotal(carGoodsService.countCarGoods(enable, carGoodsId, carGoodsName, carGoodsType, partitionId, null));
|
||||
pagination.setRows(carGoodsService.getCarGoodsList(page, pageSize, enable, null, carGoodsId, carGoodsName, carGoodsType, partitionId, null));
|
||||
return pagination;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.accompany.admin.controller.guild;
|
||||
|
||||
import com.accompany.admin.base.Pagination;
|
||||
import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.dto.NameplateDto;
|
||||
import com.accompany.admin.service.guild.GuildSuperAdminService;
|
||||
@@ -7,6 +8,7 @@ import com.accompany.admin.service.system.AdminLogService;
|
||||
import com.accompany.admin.vo.family.FamilyAdminVo;
|
||||
import com.accompany.admin.vo.guild.GuildApplyAuditVo;
|
||||
import com.accompany.admin.vo.vip.VipSendRecordVo;
|
||||
import com.accompany.business.model.CarGoods;
|
||||
import com.accompany.business.param.BasePageParams;
|
||||
import com.accompany.business.vo.family.FamilyIncomeAdminVo;
|
||||
import com.accompany.business.vo.guild.GuildDiamondStatisticsDayVo;
|
||||
@@ -136,6 +138,19 @@ public class GuildSuperAdminController extends BaseController {
|
||||
writeJson(JSON.toJSONString(objectMap));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "座驾列表(同原有接口页面", httpMethod = "GET")
|
||||
@GetMapping(value = "/cars")
|
||||
public Pagination<CarGoods> getCarGoodsList(Integer page, Integer pageSize) {
|
||||
return guildSuperAdminService.getCarGoodsList(page, pageSize, getAdminId());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "赠送座驾列表(同原有接口页面", httpMethod = "POST")
|
||||
@RequestMapping(value = "/carSend", method = RequestMethod.POST)
|
||||
public void experByOfficial(String erbanNo, Integer carId, Integer days, String desc, Integer otherDay) {
|
||||
Map map = guildSuperAdminService.carSend(erbanNo, carId, days, desc, otherDay, getAdminId());
|
||||
writeJson(JSON.toJSONString(map));
|
||||
}
|
||||
|
||||
@ApiOperation("查询家族流水")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "erbanNo", value = "家族长erbanNo"),
|
||||
|
@@ -56,7 +56,7 @@ public class CarGoodsService extends BaseService {
|
||||
* @return
|
||||
*/
|
||||
public List<CarGoods> getCarGoodsList(Integer page, Integer pageSize, Byte status, Boolean goldSale,
|
||||
Integer carGoodsId, String carGoodsName, Byte carGoodsType, Integer partitionId) {
|
||||
Integer carGoodsId, String carGoodsName, Byte carGoodsType, Integer partitionId, List<Integer> carGoodsIds) {
|
||||
page = (page == null || page <= 0) ? DEFAULT_PAGE : page;
|
||||
pageSize = (pageSize == null || pageSize <= 0) ? DEFAULT_PAGE_SIZE : pageSize;
|
||||
int offSet = (page - 1) * pageSize;
|
||||
@@ -65,6 +65,9 @@ public class CarGoodsService extends BaseService {
|
||||
if (null != carGoodsId){
|
||||
criteria.andIdEqualTo(carGoodsId);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(carGoodsIds)) {
|
||||
criteria.andIdIn(carGoodsIds);
|
||||
}
|
||||
if (status != null) {
|
||||
criteria.andEnableEqualTo(status);
|
||||
}
|
||||
@@ -89,7 +92,7 @@ public class CarGoodsService extends BaseService {
|
||||
public List<UserCarGoodsVo> getUserCarGoodsList(Integer page, Integer pageSize, Long uid, Boolean goldSale) {
|
||||
List<UserCarGoodsVo> userCarGoodsVoList = Lists.newArrayList();
|
||||
List<CarGoods> carGoodsList = this.getCarGoodsList(page, pageSize, Constant.CarGoodsEnable.ENABLE, goldSale,
|
||||
null, null, null, null);
|
||||
null, null, null, null, null);
|
||||
if (carGoodsList == null || carGoodsList.isEmpty()) {
|
||||
return userCarGoodsVoList;
|
||||
}
|
||||
@@ -150,12 +153,15 @@ public class CarGoodsService extends BaseService {
|
||||
* @param carGoodsType
|
||||
* @return
|
||||
*/
|
||||
public Integer countCarGoods(Byte status, Integer carGoodsId, String carGoodsName, Byte carGoodsType, Integer partitionId) {
|
||||
public Integer countCarGoods(Byte status, Integer carGoodsId, String carGoodsName, Byte carGoodsType, Integer partitionId, List<Integer> carGoodsIds) {
|
||||
CarGoodsExample example = new CarGoodsExample();
|
||||
CarGoodsExample.Criteria criteria = example.createCriteria();
|
||||
if (null != carGoodsId){
|
||||
criteria.andIdEqualTo(carGoodsId);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(carGoodsIds)) {
|
||||
criteria.andIdIn(carGoodsIds);
|
||||
}
|
||||
if (status != null) {
|
||||
criteria.andEnableEqualTo(status);
|
||||
}
|
||||
|
Reference in New Issue
Block a user