feat:用户部门
This commit is contained in:
1 parent
20de94f6b4
commit
6443922c3f
7 files changed
+31
-30
No files matched your search
+1
-1
@@ -21,6 +21,6 @@ public enum HardHourTypeEnum {
|
||||
|
||||
public static HardHourTypeEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
+7
-4
@@ -1,17 +1,15 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.order;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.base.BaseMchInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardOrderVo extends HardOrderEntity implements BaseUserInterface, BaseDeptInterface, BaseMchInterface, BaseHardInterface {
|
||||
public class HardOrderVo extends HardOrderEntity implements BaseUserDeptInterface, BaseMchInterface, BaseHardInterface {
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
@@ -26,6 +24,11 @@ public class HardOrderVo extends HardOrderEntity implements BaseUserInterface, B
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 用户部门
|
||||
*/
|
||||
private String userDeptName;
|
||||
|
||||
/**
|
||||
* 商户相关
|
||||
*/
|
||||
|
||||
+3
@@ -24,6 +24,9 @@ public class HardOrderExcelVo {
|
||||
@ExcelProperty("部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String userDeptName;
|
||||
|
||||
@ExcelProperty("支付方式")
|
||||
private String payType;
|
||||
|
||||
|
||||
+2
@@ -309,6 +309,8 @@ public class HardOrderController {
|
||||
HardHourTypeEnum hardHourTypeEnum = HardHourTypeEnum.valueOfByType(v.getHourType());
|
||||
if (ObjectUtil.isNotEmpty(hardHourTypeEnum)) {
|
||||
v.setHourType(hardHourTypeEnum.getDescription());
|
||||
} else {
|
||||
v.setHourType("");
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getPayType())) {
|
||||
|
||||
+10
-3
@@ -3,6 +3,7 @@ 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.RemoteDeptService;
|
||||
@@ -111,7 +112,14 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
// 查询自营食堂
|
||||
List<Map<String, List<HardAppProductByCanteenVo>>> result = new ArrayList<>();
|
||||
for (MchManageVo vo : canteenList) {
|
||||
result.add(Map.of(vo.getName(), dateList));
|
||||
// 为每个食堂创建dateList的副本
|
||||
List<HardAppProductByCanteenVo> canteenDateList = new LinkedList<>();
|
||||
for (HardAppProductByCanteenVo item : dateList) {
|
||||
// 创建每个日期项的副本
|
||||
HardAppProductByCanteenVo copy = BeanUtil.toBean(item, HardAppProductByCanteenVo.class);
|
||||
canteenDateList.add(copy);
|
||||
}
|
||||
result.add(Map.of(vo.getName(), canteenDateList));
|
||||
}
|
||||
|
||||
List<HardAppProductByCanteenVo> totalList = hardCarMapper.productByCanteen(dto);
|
||||
@@ -121,8 +129,7 @@ public class HardCanteenTotalServiceImpl implements HardCanteenTotalService {
|
||||
for (Map<String, List<HardAppProductByCanteenVo>> map : result) {
|
||||
for (Map.Entry<String, List<HardAppProductByCanteenVo>> entry : map.entrySet()) {
|
||||
String canteenName = entry.getKey();
|
||||
List<HardAppProductByCanteenVo> currentCanteenList = entry.getValue();
|
||||
for (HardAppProductByCanteenVo vo : currentCanteenList) {
|
||||
for (HardAppProductByCanteenVo vo : entry.getValue()) {
|
||||
totalList.stream().filter(item -> ObjectUtil.equals(item.getCanteenName(), canteenName) && ObjectUtil.equals(item.getTime(), vo.getTime())).findFirst().ifPresent(target -> {
|
||||
vo.setCanteenId(target.getCanteenId());
|
||||
vo.setCanteenName(canteenName);
|
||||
|
||||
+8
-22
@@ -14,6 +14,7 @@ import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteOnlineCanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
@@ -167,16 +168,9 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
if (ObjectUtil.isNotEmpty(detail)) {
|
||||
// 用户
|
||||
if (ObjectUtil.isNotEmpty(detail.getUserId())) {
|
||||
R<UserInfo> user = userService.getInnerByUserId(detail.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(user.getData())) {
|
||||
DataUtil.convertUser(detail, user.getData().getSysUser());
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
if (ObjectUtil.isNotEmpty(detail.getDeptId())) {
|
||||
R<SysDept> dept = deptService.getDeptByDeptId(detail.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(dept.getData())) {
|
||||
DataUtil.convertDept(detail, dept.getData());
|
||||
List<UserVO> userVoList = userService.getUserDeptByIds(List.of(detail.getUserId())).getData();
|
||||
if (ObjectUtil.isNotEmpty(userVoList) && ObjectUtil.isNotEmpty(userVoList.get(0))) {
|
||||
DataUtil.convertUserDept(detail, userVoList.get(0));
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
@@ -1069,20 +1063,12 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
|
||||
private void disposeList(List<HardOrderVo> list, HardOrderDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 用户
|
||||
// 用户部门
|
||||
List<Long> userIds = list.stream().map(HardOrderVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getInnerUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list, CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.stream().map(HardOrderVo::getUserDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list, deptList.getData());
|
||||
List<UserVO> userList = userService.getUserDeptByIds(new ArrayList<>(userIds)).getData();
|
||||
if (ObjectUtil.isNotEmpty(userList)) {
|
||||
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList, UserVO::getUserId));
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user