Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
eb5d0d99d3
21 files changed
+263
-36
No files matched your search
+14
@@ -55,6 +55,11 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
|
||||
*/
|
||||
private Boolean isFindCarList = false;
|
||||
|
||||
/**
|
||||
* 是否查询预约相关
|
||||
*/
|
||||
private Boolean isFindApptList = false;
|
||||
|
||||
/**
|
||||
* 退款相关
|
||||
*/
|
||||
@@ -72,4 +77,13 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
|
||||
*/
|
||||
private Boolean productDescIsNotEmpty = false;
|
||||
|
||||
/**
|
||||
* 权限相关
|
||||
*/
|
||||
List<Long> scopeDeptIds;
|
||||
|
||||
/**
|
||||
* 统计是否查询子部门
|
||||
*/
|
||||
Boolean totalIsFindChildren = false;
|
||||
}
|
||||
+11
@@ -8,6 +8,7 @@ import com.bsd.pjcloud.wallet.api.vo.base.BaseWalletInterface;
|
||||
import com.bsd.pjcloud.wallet.api.vo.base.BaseWalletTypeInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -69,4 +70,14 @@ public class HardOrderVo extends HardOrderEntity implements BaseUserDeptInterfac
|
||||
*/
|
||||
private String walletTypeUniqueCode;
|
||||
|
||||
/**
|
||||
* 预约时间相关
|
||||
*/
|
||||
private String apptTitle;
|
||||
|
||||
private String apptHourType;
|
||||
|
||||
private LocalTime apptStartTime;
|
||||
|
||||
private LocalTime apptEndTime;
|
||||
}
|
||||
+6
-3
@@ -1,9 +1,10 @@
|
||||
package com.bsd.pjcloud.hard.controller.order;
|
||||
import com.bsd.pjcloud.common.api.encrypt.annotation.crypto.ApiCryptoAes;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardCanteenProductTotalVo;
|
||||
import com.bsd.pjcloud.hard.service.HardCanteenTotalService;
|
||||
@@ -11,7 +12,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -37,7 +37,10 @@ public class HardCanteenDeptTotalController {
|
||||
@PostMapping("/list-by-dept")
|
||||
public R<List<HardCanteenProductTotalVo>> listByDept(@RequestBody HardOrderDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(canteenTotalService.listByDept(dto, dataScope));
|
||||
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setTotalIsFindChildren(true);
|
||||
return R.ok(canteenTotalService.listByDept(dto, user, dataScope));
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.bsd.pjcloud.hard.service.HardCanteenTotalService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -97,7 +98,7 @@ public class HardCanteenTotalController {
|
||||
@Operation(summary = "食堂菜品购买统计", description = "食堂菜品购买统计")
|
||||
@PostMapping("/proudct-total")
|
||||
public R<Page<HardCanteenProductTotalVo>> productTotal(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
DataScope dataScope = null;
|
||||
DataScope dataScope = DataScope.of().only(true);
|
||||
return R.ok(canteenTotalService.productTotal(page, dto, dataScope));
|
||||
}
|
||||
|
||||
|
||||
+52
-5
@@ -26,6 +26,7 @@ import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardHourTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.app.HardAppCreateOrderScancode;
|
||||
@@ -45,11 +46,7 @@ import com.bsd.pjcloud.hard.api.vo.order.app.HardTakeOutDeliveryTimeOptionVO;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.excel.HardOrderExcelVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOnlineCanteenStatsVo;
|
||||
import com.bsd.pjcloud.hard.service.HardManagerService;
|
||||
import com.bsd.pjcloud.hard.service.HardOnlineCanteenStatsService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.hard.service.HardTakeOutDeliveryTimeOptionService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderSyncService;
|
||||
import com.bsd.pjcloud.hard.service.*;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
@@ -69,6 +66,7 @@ import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -91,6 +89,7 @@ public class HardOrderController {
|
||||
private final HardManagerService hardManagerService;
|
||||
private final HardOnlineCanteenStatsService hardOnlineCanteenStatsService;
|
||||
private final HardOrderSyncService hardOrderSyncService;
|
||||
private final HardCanteenTotalService canteenTotalService;
|
||||
|
||||
private final HardOrderMapper hardOrderMapper;
|
||||
|
||||
@@ -126,6 +125,28 @@ public class HardOrderController {
|
||||
/* ************************************* end 远程调用 ************************************* */
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
@Operation(summary = "app查询当前用户的预约订单", description = "app查询当前用户的预约订单")
|
||||
@GetMapping("/app/user-appt-list")
|
||||
public R<List<HardOrderVo>> userApptList() {
|
||||
HardOrderDto dto = new HardOrderDto();
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setIsFindCarList(true);
|
||||
dto.setIsFindApptList(true);
|
||||
dto.setCreateTimeList(
|
||||
new LocalDateTime[]{
|
||||
now.withHour(0).withMinute(0).withSecond(0),
|
||||
now.withHour(23).withMinute(59).withSecond(59)
|
||||
}
|
||||
);
|
||||
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
|
||||
return R.ok(hardwareOrderService.scopeList(dto, null));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "app查询订单列表", description = "app查询订单列表")
|
||||
@ApiCryptoAes
|
||||
@GetMapping("/app/page-join")
|
||||
@@ -158,6 +179,32 @@ public class HardOrderController {
|
||||
return R.ok(hardwareOrderService.pagejoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询食堂订餐的所有商户统计", description = "app查询食堂订餐的所有商户统计")
|
||||
@GetMapping("/app/caneen-rserve-mch-total")
|
||||
public R appCaneenRserveMchTotal() {
|
||||
DataScope dataScope = null;
|
||||
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
|
||||
HardOrderDto dto = new HardOrderDto();
|
||||
dto.setTotalIsFindChildren(false);
|
||||
return R.ok(canteenTotalService.listByDept(dto, user, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询食堂订餐订单列表", description = "app查询食堂订餐订单列表")
|
||||
@GetMapping("/app/caneen-rserve-page-join")
|
||||
public R appCaneenRservePageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
dto.setIsFindCarList(true);
|
||||
dto.setIsFindApptList(true);
|
||||
dto.setOrderType(HardOrderTypeEnum.RESERVE.getType());
|
||||
dto.setOrderStatusCodes(List.of(HardOrderStatusEnum.PAY.getType(), HardOrderStatusEnum.CANCEL.getType()));
|
||||
|
||||
DataScope dataScope = DataScope.of().only(true);
|
||||
dataScope.setScopeDeptName("user_dept_id");
|
||||
|
||||
return R.ok(hardwareOrderService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询食堂订单列表", description = "app查询订单列表")
|
||||
@ApiCryptoAes
|
||||
@GetMapping("/app/caneen-page-join")
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCarDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppProductByCanteenDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppProductByClassifyDto;
|
||||
@@ -52,5 +53,5 @@ public interface HardCanteenTotalService {
|
||||
/**
|
||||
* 食堂菜品购买部门统计
|
||||
*/
|
||||
List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, DataScope dataScope);
|
||||
List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, PjcloudUser user, DataScope dataScope);
|
||||
}
|
||||
+4
-3
@@ -36,7 +36,7 @@ public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEnt
|
||||
@Override
|
||||
public Long create(HardApptEntity dto) {
|
||||
// title不能重复
|
||||
if (existTitle(dto.getTitle(), null)) {
|
||||
if (existTitle(dto.getTitle(), dto.getMchId(), null)) {
|
||||
throw new RuntimeException("标题不能重复");
|
||||
}
|
||||
// 查询商户id
|
||||
@@ -54,7 +54,7 @@ public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEnt
|
||||
@Override
|
||||
public Long edit(HardApptEntity dto) {
|
||||
// title不能重复
|
||||
if (existTitle(dto.getTitle(), dto.getId())) {
|
||||
if (existTitle(dto.getTitle(), dto.getMchId(), dto.getId())) {
|
||||
throw new RuntimeException("标题不能重复");
|
||||
}
|
||||
// 查询商户id
|
||||
@@ -86,9 +86,10 @@ public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEnt
|
||||
return baseMapper.selectPageByScope(page, wrapper, of);
|
||||
}
|
||||
|
||||
private boolean existTitle(String title, Long id) {
|
||||
private boolean existTitle(String title, Long mchId, Long id) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardApptEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(title), HardApptEntity::getTitle, title)
|
||||
.eq(ObjectUtil.isNotEmpty(mchId), HardApptEntity::getMchId, mchId)
|
||||
.ne(ObjectUtil.isNotEmpty(id), HardApptEntity::getId, id)
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(id)) {
|
||||
|
||||
+16
-6
@@ -3,9 +3,9 @@ package com.bsd.pjcloud.hard.service.impl.order;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDataScopeService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteCanteenCategoryService;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenCategoryEntity;
|
||||
@@ -13,6 +13,8 @@ import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudDefaultDataScopeHandle;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.total.DateRangeTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCarDto;
|
||||
@@ -28,6 +30,7 @@ import com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductLikeTopVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardCarMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCanteenTotalService;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -66,7 +69,7 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
private final RemoteDataScopeService dataScopeService;
|
||||
private final RemoteCanteenCategoryService canteenCategoryService;
|
||||
|
||||
/**
|
||||
@@ -173,7 +176,11 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
@Override
|
||||
public Page<HardCanteenProductTotalVo> productTotal(Page page, HardOrderDto dto, DataScope dataScope) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
Page<HardCanteenProductTotalVo> pageList = hardCarMapper.productTotal(page, dto, dataScope);
|
||||
new PjcloudDefaultDataScopeHandle(dataScopeService).calcScope(dataScope);
|
||||
if (ObjectUtil.isNotEmpty(dataScope.getDeptList())) {
|
||||
dto.setScopeDeptIds(dataScope.getDeptList());
|
||||
}
|
||||
Page<HardCanteenProductTotalVo> pageList = hardCarMapper.productTotal(page, dto, null);
|
||||
if (ObjectUtil.isNotEmpty(pageList)) {
|
||||
for (HardCanteenProductTotalVo v : pageList.getRecords()) {
|
||||
LocalDate localDate = v.getCreateTime().toLocalDate();
|
||||
@@ -196,14 +203,17 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
* 食堂菜品购买部门统计
|
||||
*/
|
||||
@Override
|
||||
public List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, DataScope dataScope) {
|
||||
public List<HardCanteenProductTotalVo> listByDept(HardOrderDto dto, PjcloudUser user, DataScope dataScope) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
// 查询所有的自营食堂
|
||||
List<MchManageVo> mchList = remoteMchService.getByTypes(List.of(MerchantTypeEnum.CANTEEN.getType())).getData();
|
||||
MchManageDto mchListDto = new MchManageDto();
|
||||
mchListDto.setTypesList(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
mchListDto.setScopeUserDeptId(user.getDeptId());
|
||||
List<MchManageVo> mchList = remoteMchService.list(mchListDto).getData();
|
||||
if (ObjectUtil.isEmpty(mchList)) return null;
|
||||
dto.setMchIds(mchList.stream().map(MchManageVo::getId).toList());
|
||||
List<HardCanteenProductTotalVo> list = hardCarMapper.listByDept(dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
if (ObjectUtil.isNotEmpty(list) && ObjectUtil.isNotEmpty(dto.getTotalIsFindChildren()) && dto.getTotalIsFindChildren()) {
|
||||
// 限制最大线程数为10
|
||||
int threadCount = Math.min(list.size(), 10);
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(threadCount);
|
||||
|
||||
+27
-7
@@ -2097,13 +2097,33 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
}
|
||||
});
|
||||
// 购物车
|
||||
if (dto.getIsFindCarList()) {
|
||||
for (HardOrderVo v : list) {
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(v.getParentCarId());
|
||||
List<HardCarVo> carVoList = BeanUtils.toBean(carList, HardCarVo.class);
|
||||
v.setCarList(carVoList);
|
||||
CompletableFuture<Void> findCarListFuture = CompletableFuture.runAsync(() -> {
|
||||
if (dto.getIsFindCarList()) {
|
||||
for (HardOrderVo v : list) {
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(v.getParentCarId());
|
||||
List<HardCarVo> carVoList = BeanUtils.toBean(carList, HardCarVo.class);
|
||||
v.setCarList(carVoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
CompletableFuture.allOf(deptFuture, mchFuture, deviceFuture, currentDeptFuture, walletFuture).join();
|
||||
});
|
||||
// 预约订单
|
||||
CompletableFuture<Void> findApptListFuture = CompletableFuture.runAsync(() -> {
|
||||
if (dto.getIsFindApptList()) {
|
||||
List<Long> apptList = list.stream().map(HardOrderVo::getApptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isEmpty(apptList)) return;
|
||||
List<HardApptEntity> apptOrderList = hardApptService.listByIds(apptList);
|
||||
if (ObjectUtil.isEmpty(apptOrderList)) return;
|
||||
Map<Long, HardApptEntity> apptMap = CollectionUtils.convertMap(apptOrderList, HardApptEntity::getId);
|
||||
for (HardOrderVo v : list) {
|
||||
HardApptEntity target = apptMap.get(v.getApptId());
|
||||
if (ObjectUtil.isEmpty(target)) continue;
|
||||
v.setApptTitle(target.getTitle());
|
||||
v.setApptHourType(target.getHourType());
|
||||
v.setApptStartTime(target.getStartTime());
|
||||
v.setApptEndTime(target.getEndTime());
|
||||
}
|
||||
}
|
||||
});
|
||||
CompletableFuture.allOf(deptFuture, mchFuture, deviceFuture, currentDeptFuture, walletFuture, findCarListFuture, findApptListFuture).join();
|
||||
}
|
||||
}
|
||||
+18
@@ -138,12 +138,21 @@
|
||||
<if test="dto.hourType != null and dto.hourType != '' ">
|
||||
and o.hour_type = #{dto.hourType}
|
||||
</if>
|
||||
<if test="dto.orderType != null and dto.orderType != '' ">
|
||||
and o.order_type = #{dto.orderType}
|
||||
</if>
|
||||
<if test="dto.merchantId != null">
|
||||
and o.merchant_id = #{dto.merchantId}
|
||||
</if>
|
||||
<if test="dto.isOfflineOrder != null">
|
||||
and o.is_offline_order = #{dto.isOfflineOrder}
|
||||
</if>
|
||||
<if test="dto.scopeDeptIds != null and dto.scopeDeptIds.size() != 0">
|
||||
and o.dept_id IN
|
||||
<foreach collection="dto.scopeDeptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
|
||||
<choose>
|
||||
<when test="dto.isInclude != null and dto.isInclude == true">
|
||||
@@ -238,6 +247,15 @@
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
|
||||
and o.merchant_id in
|
||||
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.orderType != null and dto.orderType != '' ">
|
||||
and o.order_type = #{dto.orderType}
|
||||
</if>
|
||||
<if test="dto.hourType != null and dto.hourType != '' ">
|
||||
and o.hour_type = #{dto.hourType}
|
||||
</if>
|
||||
|
||||
+1
@@ -58,6 +58,7 @@
|
||||
a.order_status,
|
||||
a.pay_type,
|
||||
a.hour_type,
|
||||
a.appt_id,
|
||||
a.sys_type,
|
||||
a.total_price,
|
||||
a.extra_price,
|
||||
|
||||
+7
-3
@@ -99,13 +99,17 @@ public interface RemoteDeptService {
|
||||
|
||||
/**
|
||||
* 获得指定部门的所有子部门
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/dept/getDescendantList/{deptId}")
|
||||
R<List<SysDept>> getDescendantList(@PathVariable Long deptId);
|
||||
|
||||
/**
|
||||
* 获得指定部门的所有子部门
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/dept/inner/getDescendantList/{deptId}")
|
||||
R<List<SysDept>> getInnerDescendantList(@PathVariable Long deptId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询部门所属的分组部门
|
||||
|
||||
+8
-1
@@ -30,6 +30,7 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.tenant.TenantContextHolder;
|
||||
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.HasPermission;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
@@ -165,11 +166,17 @@ public class SysDeptController {
|
||||
* @return 返回子级
|
||||
*/
|
||||
@GetMapping(value = "/getDescendantList/{deptId}")
|
||||
public R getDescendantList(@PathVariable Long deptId) {
|
||||
public R<List<SysDept>> getDescendantList(@PathVariable Long deptId) {
|
||||
return R.ok(sysDeptService.listDescendant(deptId));
|
||||
}
|
||||
|
||||
|
||||
@Inner
|
||||
@GetMapping("/inner/getDescendantList/{deptId}")
|
||||
R<List<SysDept>> getInnerDescendantList(@PathVariable Long deptId) {
|
||||
return R.ok(sysDeptService.listDescendant(deptId));
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping(value = "/leader/{deptId}")
|
||||
public R getAllDeptLeader(@PathVariable Long deptId) {
|
||||
|
||||
+24
-2
@@ -219,6 +219,10 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
treeNode.setWeight(dept.getSortOrder());
|
||||
return treeNode;
|
||||
}).toList(), 0L);
|
||||
if (ObjectUtil.isEmpty(user) || ObjectUtil.isEmpty(user.getDeptId()) || CollUtil.isEmpty(deptAllTree)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Tree<Long> currentDeptTree = null;
|
||||
for (Tree<Long> rootNode : deptAllTree) {
|
||||
currentDeptTree = TreeUtil.getNode(rootNode, user.getDeptId());
|
||||
@@ -226,8 +230,26 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
break;
|
||||
}
|
||||
}
|
||||
// List<Tree<Long>> currentDeptAllNodes = getSubTreeNodes(currentDeptTree);
|
||||
return List.of(currentDeptTree);
|
||||
if (currentDeptTree == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Tree<Long> child = currentDeptTree;
|
||||
Tree<Long> ancestor = currentDeptTree.getParent();
|
||||
while (ancestor != null) {
|
||||
List<Tree<Long>> children = ancestor.getChildren();
|
||||
if (children != null) {
|
||||
Long childId = child.getId();
|
||||
children.removeIf(item -> !Objects.equals(item.getId(), childId));
|
||||
}
|
||||
child = ancestor;
|
||||
ancestor = ancestor.getParent();
|
||||
}
|
||||
|
||||
if (Objects.equals(child.getId(), 0L)) {
|
||||
return Optional.ofNullable(child.getChildren()).orElseGet(Collections::emptyList);
|
||||
}
|
||||
return List.of(child);
|
||||
}
|
||||
|
||||
public List<Tree<Long>> getSubTreeNodes(Tree<Long> node) {
|
||||
|
||||
+2
-2
@@ -658,14 +658,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
if (ObjectUtil.isNotEmpty(v.getUsername())) {
|
||||
long repetitionUsername = usernameList.stream().filter(i -> ObjectUtil.equals(i, v.getUsername())).count();
|
||||
if (repetitionUsername > 1) {
|
||||
errorMsg.add("用户名 <" + v.getUsername() + "> 重复");
|
||||
// errorMsg.add("用户名 <" + v.getUsername() + "> 重复");
|
||||
}
|
||||
}
|
||||
|
||||
// 判断输入的编制是否合法
|
||||
String staffingType = null;
|
||||
if (ObjectUtil.isEmpty(v.getStaffingType())) {
|
||||
errorMsg.add("请选择编制");
|
||||
// errorMsg.add("请选择编制");
|
||||
} else {
|
||||
UserStaffingTypeEnum staffingTypeEnum = UserStaffingTypeEnum.valueOfByDescription(v.getStaffingType());
|
||||
if (ObjectUtil.isEmpty(staffingTypeEnum)) {
|
||||
|
||||
+9
@@ -14,8 +14,12 @@ import java.util.List;
|
||||
@Data
|
||||
public class MchManageDto extends MchManageEntity {
|
||||
|
||||
private Long parentDeptId;
|
||||
|
||||
private List<Long> deptIds;
|
||||
|
||||
private List<Long> excludeIds;
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
private List<Long> notIds;
|
||||
@@ -30,4 +34,9 @@ public class MchManageDto extends MchManageEntity {
|
||||
* 分类名
|
||||
*/
|
||||
private String catgoryName;
|
||||
|
||||
/**
|
||||
* 权限用户部门id
|
||||
*/
|
||||
private Long scopeUserDeptId;
|
||||
}
|
||||
+2
@@ -25,6 +25,8 @@ public class WalletActiveDto extends WalletActiveEntity {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
private List<Long> deptIds;
|
||||
|
||||
/**
|
||||
* 是否绑定用户
|
||||
*/
|
||||
|
||||
+23
-1
@@ -7,6 +7,10 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.core.validation.Group;
|
||||
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
|
||||
@@ -20,7 +24,9 @@ import com.bsd.pjcloud.wallet.api.dto.WalletRemoteOpenCardListDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveBindCardDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
|
||||
import com.bsd.pjcloud.wallet.service.MchManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletActiveService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -52,7 +58,10 @@ import java.util.List;
|
||||
public class WalletActiveController {
|
||||
|
||||
private final WalletActiveService walletActiveService;
|
||||
private final MchManageService mchManageService;
|
||||
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
@@ -78,7 +87,20 @@ public class WalletActiveController {
|
||||
@GetMapping("/ad/open-card-list")
|
||||
@Operation(summary = "android开卡列表")
|
||||
public R<Page<WalletActiveVo>> AdOpenCardList(@ParameterObject Page page, @ParameterObject WalletActiveDto dto) {
|
||||
return R.ok(walletActiveService.pageJoin(page, dto));
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
if (ObjectUtil.isNotEmpty(user) && ObjectUtil.isNotEmpty(user.getDeptId())) {
|
||||
UserInfo userInfo = remoteUserService.getInnerByUserId(user.getId()).getData();
|
||||
MchManageVo targetMch = mchManageService.getViewsCanteenMchByDeptId(userInfo.getSysUser().getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(targetMch)) {
|
||||
dto.setDeptIds(List.of(targetMch.getId()));
|
||||
} else {
|
||||
List<SysDept> deptIdList = remoteDeptService.getDescendantList(userInfo.getSysUser().getDeptId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(deptIdList)) {
|
||||
dto.setDeptIds(deptIdList.stream().map(SysDept::getDeptId).toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(walletActiveService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@GetMapping("/ad/open-card-success")
|
||||
|
||||
+28
-1
@@ -16,7 +16,6 @@ import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
@@ -35,6 +34,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -56,6 +56,17 @@ public class MchManageController {
|
||||
@Inner
|
||||
@PostMapping("/list")
|
||||
public R<List<MchManageVo>> remoteList(@RequestBody MchManageDto body) {
|
||||
if (ObjectUtil.isNotEmpty(body.getScopeUserDeptId())) {
|
||||
MchManageVo targetMch = mchManageService.getViewsCanteenMchByDeptId(body.getScopeUserDeptId());
|
||||
if (ObjectUtil.isNotEmpty(targetMch)) {
|
||||
body.setIds(List.of(targetMch.getId()));
|
||||
} else {
|
||||
List<SysDept> deptIdList = remoteDeptService.getInnerDescendantList(body.getScopeUserDeptId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(deptIdList)) {
|
||||
body.setDeptIds(deptIdList.stream().map(SysDept::getDeptId).toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
List<MchManageVo> list = mchManageService.list(body);
|
||||
return R.ok(list);
|
||||
}
|
||||
@@ -149,6 +160,11 @@ public class MchManageController {
|
||||
MchManageVo targetMch = mchManageService.getViewsCanteenMchByDeptId(userInfo.getSysUser().getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(targetMch)) {
|
||||
dto.setIds(List.of(targetMch.getId()));
|
||||
} else {
|
||||
List<SysDept> deptIdList = remoteDeptService.getDescendantList(userInfo.getSysUser().getDeptId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(deptIdList)) {
|
||||
dto.setDeptIds(deptIdList.stream().map(SysDept::getDeptId).toList());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
R.ok(new Page<>());
|
||||
@@ -219,6 +235,17 @@ public class MchManageController {
|
||||
@GetMapping("/select")
|
||||
public R getSelect(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
||||
DataScope dataScope = null;
|
||||
if (ObjectUtil.isNotEmpty(dto.getParentDeptId())) {
|
||||
List<SysDept> deptIdList = remoteDeptService.getDescendantList(dto.getParentDeptId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(deptIdList)) {
|
||||
List<Long> deptIds = dto.getDeptIds();
|
||||
if (ObjectUtil.isEmpty(deptIds)) {
|
||||
deptIds = new ArrayList<>();
|
||||
}
|
||||
deptIds.addAll(deptIdList.stream().map(SysDept::getDeptId).toList());
|
||||
dto.setDeptIds(deptIds);
|
||||
}
|
||||
}
|
||||
return R.ok(mchManageService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -34,6 +34,7 @@ public interface WalletActiveMapper extends PjcloudBaseMapper<WalletActiveEntity
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getIsActiveHardware()), WalletActiveEntity::getIsActiveHardware, dto.getIsActiveHardware())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), WalletActiveEntity::getDeptId, dto.getDeptId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletActiveEntity::getUserId, dto.getUserIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletActiveEntity::getDeptId, dto.getDeptIds())
|
||||
.orderByDesc(WalletActiveEntity::getCardSort);
|
||||
if (ObjectUtil.isNotEmpty(dto.getIsBindUser())) {
|
||||
if (dto.getIsBindUser()) {
|
||||
|
||||
@@ -82,6 +82,12 @@
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.excludeIds != null and dto.excludeIds.size() != 0">
|
||||
and a.id not in
|
||||
<foreach collection="dto.excludeIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.ids != null and dto.ids.size() != 0">
|
||||
and a.id in
|
||||
<foreach collection="dto.ids" item="v" open="(" close=")" separator=",">
|
||||
|
||||
Reference in new issue
Block a user