11
This commit is contained in:
1 parent
cf1c5beff6
commit
e6de7dd2ae
8 files changed
+50
-9
No files matched your search
+6
@@ -62,6 +62,12 @@ public class HardOrderEntity extends Model<HardOrderEntity> {
|
||||
@Schema(description = "商户类型")
|
||||
private String merchantType;
|
||||
|
||||
/**
|
||||
* 商户绑定的部门id
|
||||
*/
|
||||
@Schema(description = "商户绑定的部门id")
|
||||
private Long merchantDeptId;
|
||||
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
|
||||
+5
-1
@@ -157,10 +157,14 @@ public class HardOrderController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
DataScope dataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
|
||||
dataScope.setScopeDeptName("merchant_dept_id");
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
CurrentUserHardTypeInfoDto hardTypeInfo = hardManagerService.getCurrentUserHardTypeInfo(user);
|
||||
dto.setMchTypeCodes(hardTypeInfo.getHardTypeList());
|
||||
return R.ok(hardwareOrderService.scopePageList(page, dto));
|
||||
// List<Long> mchIds = hardManagerService.getCurrentUserMchInfo(user, dto.getMchIds());
|
||||
// dto.setMchIds(mchIds);
|
||||
return R.ok(hardwareOrderService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
return selectListByScope(commonWrapper(dto), DataScope.of());
|
||||
}
|
||||
|
||||
Page<HardOrderVo> scopePageList(Page page, @Param("dto") HardOrderDto dto);
|
||||
Page<HardOrderVo> scopePageList(Page page, @Param("dto") HardOrderDto dto, DataScope dataScope);
|
||||
|
||||
List<HardOrderSbVo> listSb(@Param("dto") HardOrderDto dto, DataScope dataScope);
|
||||
|
||||
|
||||
+7
@@ -9,6 +9,8 @@ import com.bsd.pjcloud.hard.api.dto.hard.HardBindDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardManagerVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HardManagerService extends IService<HardManagerEntity> {
|
||||
|
||||
Page<HardManagerVo> pageJoin(Page page, HardManagerDto dto);
|
||||
@@ -27,4 +29,9 @@ public interface HardManagerService extends IService<HardManagerEntity> {
|
||||
* 判断当前用户是否有食堂或者超市管理元权限
|
||||
*/
|
||||
CurrentUserHardTypeInfoDto getCurrentUserHardTypeInfo(PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 判断当前用户有哪些商户的权限
|
||||
*/
|
||||
List<Long> getCurrentUserMchInfo(PjcloudUser user, List<Long> mchIds);
|
||||
}
|
||||
+1
-1
@@ -24,7 +24,7 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
*/
|
||||
Page<HardOrderVo> appMchPageJoin(Page page, HardOrderDto dto, PjcloudUser user);
|
||||
|
||||
Page<HardOrderVo> scopePageList(Page page, HardOrderDto dto);
|
||||
Page<HardOrderVo> scopePageList(Page page, HardOrderDto dto, DataScope dataScope);
|
||||
|
||||
List<HardOrderVo> scopeList(HardOrderDto dto);
|
||||
|
||||
|
||||
+23
-4
@@ -11,6 +11,7 @@ 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.common.core.constant.CommonRoleConstant;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
@@ -38,10 +39,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 设备管理
|
||||
@@ -235,6 +233,27 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getCurrentUserMchInfo(PjcloudUser user, List<Long> mchIds) {
|
||||
if (ObjectUtil.isEmpty(mchIds)) mchIds = new ArrayList<>();
|
||||
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) return mchIds;
|
||||
String[] roles = userInfo.getRoleCodes();
|
||||
if (roles.length == 0) return mchIds;
|
||||
List<String> roleList = Arrays.asList(roles);
|
||||
MchManageVo mchDetail = null;
|
||||
if (roleList.contains(CommonRoleConstant.SUPERMARKET_ADMIN)) {
|
||||
mchDetail = mchService.getByDeptId(user.getDeptId(), MerchantTypeEnum.SELF_SUPERMARKET).getData();
|
||||
}
|
||||
if (roleList.contains(CommonRoleConstant.CANTEEN_ADMIN)) {
|
||||
mchDetail = mchService.getByDeptId(user.getDeptId(), MerchantTypeEnum.CANTEEN).getData();
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(mchDetail)) {
|
||||
mchIds.add(mchDetail.getId());
|
||||
}
|
||||
return mchIds;
|
||||
}
|
||||
|
||||
private boolean existUniqueCode(String uniqueCode, Long id) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardManagerEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(uniqueCode), HardManagerEntity::getUniqueCode, uniqueCode)
|
||||
|
||||
+5
-2
@@ -132,8 +132,8 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<HardOrderVo> scopePageList(Page page, HardOrderDto dto) {
|
||||
Page<HardOrderVo> list = baseMapper.scopePageList(page, dto);
|
||||
public Page<HardOrderVo> scopePageList(Page page, HardOrderDto dto, DataScope dataScope) {
|
||||
Page<HardOrderVo> list = baseMapper.scopePageList(page, dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(HardOrderVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
@@ -265,6 +265,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
.merchantId(dto.getMerchantId())
|
||||
.merchantType(mch.getTypes())
|
||||
.merchantDeptId(mch.getDeptId())
|
||||
.deptId(dto.getDeptId())
|
||||
.orderType(dto.getOrderType().getType())
|
||||
.payType(dto.getOrderPayType().getType())
|
||||
@@ -332,6 +333,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
.merchantId(parentCar.getMerchantId())
|
||||
.merchantType(hardManager.getTypes())
|
||||
.merchantDeptId(hardManager.getDeptId())
|
||||
.orderType(dto.getOrderType().getType())
|
||||
.payType(dto.getPayType().getType())
|
||||
.orderSourceTypeId(dto.getOrderSourceTypeId())
|
||||
@@ -376,6 +378,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
.userDeptId(userDetail.getSysUser().getDeptId())
|
||||
.merchantId(mch.getId())
|
||||
.merchantType(mch.getTypes())
|
||||
.merchantDeptId(mch.getDeptId())
|
||||
.parentCarId(dto.getCarParentId())
|
||||
.sysType(dto.getHardType().getType())
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
|
||||
+2
@@ -9,6 +9,7 @@
|
||||
<result property="userDeptId" column="user_dept_id"/>
|
||||
<result property="merchantId" column="merchant_id"/>
|
||||
<result property="merchantType" column="merchant_type"/>
|
||||
<result property="merchantDeptId" column="merchant_dept_id"/>
|
||||
<result property="hardId" column="hard_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="walletId" column="wallet_id"/>
|
||||
@@ -47,6 +48,7 @@
|
||||
a.user_dept_id,
|
||||
a.merchant_id,
|
||||
a.merchant_type,
|
||||
a.merchant_dept_id,
|
||||
a.hard_id,
|
||||
a.dept_id,
|
||||
a.wallet_id,
|
||||
|
||||
Reference in new issue
Block a user