身份切换
parent
b52e506783
commit
779324080b
|
|
@ -46,7 +46,6 @@ const props = withDefaults(defineProps<{
|
|||
const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel')
|
||||
const status = ref<'add' | 'modify'>('add')
|
||||
const formPanelProps = buildFormPanelProps<${ucc}Types.Search${ucc}Result>({
|
||||
title: status.value === 'add' ? '新建${table.comment}' : '修改${table.comment}信息',
|
||||
detailsLoader(id?: string) {
|
||||
if (Strings.isBlank(id)) {
|
||||
status.value = 'add'
|
||||
|
|
@ -77,7 +76,9 @@ const formPanelProps = buildFormPanelProps<${ucc}Types.Search${ucc}Result>({
|
|||
<%}%>
|
||||
},
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
formPanelProps.title = status.value === 'add' ? '新建${table.comment}' : '修改${table.comment}信息'
|
||||
})
|
||||
defineExpose({
|
||||
open(data?: ${ucc}Types.Search${ucc}Result) {
|
||||
formPanelIns.value?.open(data?.id)
|
||||
|
|
|
|||
|
|
@ -132,11 +132,11 @@ public class CustomerService extends ServiceImpl<CustomerMapper, CustomerEntity>
|
|||
Assert.isTrue(identityInfo.isPresent(), () -> Exceptions.exception("目标身份不存在,无法切换"));
|
||||
Long currentCustomerId = myResult.getCurrentCustomerId();
|
||||
IdentityInfo currentIdentity = myResult.currentIdentity();
|
||||
Assert.isTrue(Objects.equals(currentCustomerId, targetCustomerId), () -> Exceptions.exception("已是【{}】身份,无需切换", currentIdentity.getIdentityCategory().getTxt()));
|
||||
Assert.isFalse(Objects.equals(currentCustomerId, targetCustomerId), () -> Exceptions.exception("已是【{}】身份,无需切换", currentIdentity.getIdentityCategory().getTxt()));
|
||||
myResult.setCurrentCustomerId(targetCustomerId);
|
||||
SecurityUtil.updateUser(myResult);
|
||||
Long userId = myResult.getUserId();
|
||||
Integer client = myResult.getClient();
|
||||
return (MyResult) authService.my(userId, client);
|
||||
return (MyResult) authService.my(userId, client, currentCustomerId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.njzscloud.dispose.cst.order.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
|
@ -34,6 +35,8 @@ import com.njzscloud.dispose.cst.project.pojo.entity.ProjectEntity;
|
|||
import com.njzscloud.dispose.cst.project.service.ProjectService;
|
||||
import com.njzscloud.dispose.cst.station.mapper.StationMapper;
|
||||
import com.njzscloud.dispose.cst.station.pojo.entity.StationEntity;
|
||||
import com.njzscloud.dispose.cst.station.pojo.result.StationResult;
|
||||
import com.njzscloud.dispose.cst.station.service.StationService;
|
||||
import com.njzscloud.dispose.cst.truck.mapper.TruckMapper;
|
||||
import com.njzscloud.dispose.cst.truck.pojo.entity.TruckEntity;
|
||||
import com.njzscloud.dispose.finance.constant.ExpenseItemCategory;
|
||||
|
|
@ -80,6 +83,7 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
private final StationMapper stationMapper;
|
||||
private final PaymentRecordHelper paymentRecordHelper;
|
||||
private final ProjectService projectService;
|
||||
private final StationService stationService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(CreateOrderParam param) {
|
||||
|
|
@ -228,6 +232,27 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
String keywords = searchOrderParam.getKeywords();
|
||||
LocalDateTime orderTimeStart = searchOrderParam.getOrderTimeStart();
|
||||
LocalDateTime orderTimeEnd = searchOrderParam.getOrderTimeEnd();
|
||||
Page<SearchOrderResult> page = pageParam.toPage();
|
||||
|
||||
MyResult myResult = SecurityUtil.loginUser();
|
||||
IdentityCategory identityCategory = myResult.currentIdentity().getIdentityCategory();
|
||||
Long userId = null;
|
||||
Long driverIdUserId = null;
|
||||
Long transOrgId = null;
|
||||
List<Long> stationIds = null;
|
||||
if (myResult.isXiaoNa() && identityCategory == IdentityCategory.XiaoNa) {
|
||||
List<StationResult> stationResults = stationService.listAll();
|
||||
if (CollUtil.isEmpty(stationResults)) return PageResult.of(page);
|
||||
stationIds = stationResults.stream().map(StationResult::getId).toList();
|
||||
} else if ((myResult.isCaiGou() || myResult.isChanFei()) && (identityCategory == IdentityCategory.CaiGou || identityCategory == IdentityCategory.ChanFei)) {
|
||||
userId = myResult.getUserId();
|
||||
} else if (myResult.isYunShu() && identityCategory == IdentityCategory.YunShu) {
|
||||
transOrgId = myResult.getCurrentOrgId();
|
||||
} else if (myResult.isSiJi() && identityCategory == IdentityCategory.SiJi) {
|
||||
driverIdUserId = myResult.getUserId();
|
||||
} else {
|
||||
throw Exceptions.exception("无访问权限");
|
||||
}
|
||||
|
||||
QueryWrapper<Object> ew = Wrappers.query()
|
||||
.exists("YuYue".equals(orderType), "SELECT 1 FROM cst_order_trans b WHERE b.order_id = a.id AND b.trans_status IN ('DaiPaiDan','DaiJieDan')")
|
||||
|
|
@ -235,6 +260,10 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
.exists("LiShi".equals(orderType), "SELECT 1 FROM cst_order_trans b WHERE b.order_id = a.id AND b.trans_status = 'YiWanCheng'")
|
||||
.exists("QuXiao".equals(orderType), "SELECT 1 FROM cst_order_trans b WHERE b.order_id = a.id AND b.trans_status = 'YiQuXiao'")
|
||||
.in("DuanBo".equals(bizType), "a.order_category", OrderCategory.DuanBoChu, OrderCategory.DuanBoRu)
|
||||
.in(CollUtil.isNotEmpty(stationIds), "a.station_id", stationIds)
|
||||
.eq(userId != null, "a.user_id", userId)
|
||||
.eq(transOrgId != null, "a.trans_org_id", transOrgId)
|
||||
.eq(driverIdUserId != null, "b.driver_user_id", driverIdUserId)
|
||||
.eq("HuiShou".equals(bizType), "a.order_category", OrderCategory.HuiShouYuYue)
|
||||
.eq("XiaoShou".equals(bizType), "a.order_category", OrderCategory.XiaoShouYuYue)
|
||||
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
|
||||
|
|
@ -254,7 +283,6 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
.or().like("j.org_name", keywords)
|
||||
.or().like("f.project_name", keywords)
|
||||
);
|
||||
Page<SearchOrderResult> page = pageParam.toPage();
|
||||
page.addOrder(OrderItem.desc("a.create_time"));
|
||||
IPage<SearchOrderResult> resultPage = baseMapper.paging(page, ew);
|
||||
List<SearchOrderResult> results = resultPage.getRecords();
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@ import lombok.RequiredArgsConstructor;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站点信息
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Slf4j
|
||||
|
|
@ -57,6 +60,17 @@ public class StationController {
|
|||
public R<PageResult<StationResult>> paging(PageParam pageParam, StationQueryParam queryParam) {
|
||||
return R.success(stationService.paging(pageParam, queryParam));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前用户的站点
|
||||
*/
|
||||
@GetMapping("/list_all")
|
||||
public R<List<StationResult>> listAll() {
|
||||
return R.success(stationService.listAll());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.njzscloud.dispose.cst.station.controller;
|
||||
|
||||
import com.njzscloud.common.core.utils.R;
|
||||
import com.njzscloud.common.mp.support.PageParam;
|
||||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.dispose.cst.station.pojo.entity.StationMemberEntity;
|
||||
import com.njzscloud.dispose.cst.station.service.StationMemberService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站点成员
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/station_member")
|
||||
@RequiredArgsConstructor
|
||||
public class StationMemberController {
|
||||
private final StationMemberService stationMemberService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public R<?> add(@RequestBody StationMemberEntity stationMemberEntity) {
|
||||
stationMemberService.add(stationMemberEntity);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/modify")
|
||||
public R<?> modify(@RequestBody StationMemberEntity stationMemberEntity) {
|
||||
stationMemberService.modify(stationMemberEntity);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/del")
|
||||
public R<?> del(@RequestBody List<Long> ids) {
|
||||
stationMemberService.del(ids);
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public R<StationMemberEntity> detail(@RequestParam("id") Long id) {
|
||||
return R.success(stationMemberService.detail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public R<PageResult<StationMemberEntity>> paging(PageParam pageParam, StationMemberEntity stationMemberEntity) {
|
||||
return R.success(stationMemberService.paging(pageParam, stationMemberEntity));
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@ import com.njzscloud.dispose.cst.station.pojo.result.StationResult;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站点信息
|
||||
* @author ljw
|
||||
|
|
@ -18,6 +20,8 @@ public interface StationMapper extends BaseMapper<StationEntity> {
|
|||
IPage<StationResult> paging(IPage<StationResult> page, @Param("ew") QueryWrapper<?> ew);
|
||||
|
||||
StationResult detail(@Param("id") Long id);
|
||||
|
||||
List<StationResult> listAll(@Param("ew") QueryWrapper<?> ew);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.njzscloud.dispose.cst.station.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njzscloud.dispose.cst.station.pojo.entity.StationMemberEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 站点成员
|
||||
*/
|
||||
@Mapper
|
||||
public interface StationMemberMapper extends BaseMapper<StationMemberEntity> {
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.njzscloud.dispose.cst.station.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 站点成员
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("cst_station_member")
|
||||
public class StationMemberEntity {
|
||||
|
||||
/**
|
||||
* Id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户 Id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 客户 Id
|
||||
*/
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 组织 Id
|
||||
*/
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 站点 Id
|
||||
*/
|
||||
private Long stationId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.njzscloud.dispose.cst.station.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njzscloud.common.mp.support.PageParam;
|
||||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.dispose.cst.station.mapper.StationMemberMapper;
|
||||
import com.njzscloud.dispose.cst.station.pojo.entity.StationMemberEntity;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站点成员
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StationMemberService extends ServiceImpl<StationMemberMapper, StationMemberEntity> implements IService<StationMemberEntity> {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public void add(StationMemberEntity stationMemberEntity) {
|
||||
this.save(stationMemberEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public void modify(StationMemberEntity stationMemberEntity) {
|
||||
this.updateById(stationMemberEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void del(List<Long> ids) {
|
||||
this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
public StationMemberEntity detail(Long id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<StationMemberEntity> paging(PageParam pageParam, StationMemberEntity stationMemberEntity) {
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<StationMemberEntity>query(stationMemberEntity)));
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njzscloud.common.mp.support.PageParam;
|
||||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.common.security.util.SecurityUtil;
|
||||
import com.njzscloud.dispose.cst.customer.constant.IdentityCategory;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.param.AddCustomerParam;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.result.AddCustomerResult;
|
||||
|
|
@ -18,6 +19,7 @@ import com.njzscloud.dispose.cst.org.constant.OrgCategory;
|
|||
import com.njzscloud.dispose.cst.org.pojo.param.AddOrgParam;
|
||||
import com.njzscloud.dispose.cst.station.mapper.StationMapper;
|
||||
import com.njzscloud.dispose.cst.station.pojo.entity.StationEntity;
|
||||
import com.njzscloud.dispose.cst.station.pojo.entity.StationMemberEntity;
|
||||
import com.njzscloud.dispose.cst.station.pojo.param.AddStationParam;
|
||||
import com.njzscloud.dispose.cst.station.pojo.param.ModifyStationParam;
|
||||
import com.njzscloud.dispose.cst.station.pojo.param.StationQueryParam;
|
||||
|
|
@ -27,6 +29,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站点信息
|
||||
*
|
||||
|
|
@ -38,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
public class StationService extends ServiceImpl<StationMapper, StationEntity> implements IService<StationEntity> {
|
||||
|
||||
private final CustomerService customerService;
|
||||
private final StationMemberService stationMemberService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(AddStationParam addStationParam) {
|
||||
|
|
@ -54,9 +59,18 @@ public class StationService extends ServiceImpl<StationMapper, StationEntity> im
|
|||
.setOrgCategory(OrgCategory.QiYe)
|
||||
);
|
||||
AddCustomerResult customerResult = customerService.add(customer);
|
||||
|
||||
Long orgId = customerResult.getOrgId();
|
||||
StationEntity stationEntity = BeanUtil.copyProperties(addStationParam, StationEntity.class)
|
||||
.setOrgId(customerResult.getOrgId());
|
||||
.setOrgId(orgId);
|
||||
this.save(stationEntity);
|
||||
|
||||
stationMemberService.add(new StationMemberEntity()
|
||||
.setStationId(stationEntity.getId())
|
||||
.setUserId(userId)
|
||||
.setOrgId(orgId)
|
||||
.setCustomerId(customerResult.getCustomerId())
|
||||
);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -86,6 +100,12 @@ public class StationService extends ServiceImpl<StationMapper, StationEntity> im
|
|||
return PageResult.of(baseMapper.paging(page, ew));
|
||||
}
|
||||
|
||||
public List<StationResult> listAll() {
|
||||
Long userId = SecurityUtil.currentUserId();
|
||||
List<StationMemberEntity> memberEntityList = stationMemberService.list(Wrappers.lambdaQuery(StationMemberEntity.class).eq(StationMemberEntity::getUserId, userId));
|
||||
List<Long> stationIds = memberEntityList.stream().map(StationMemberEntity::getStationId).toList();
|
||||
return baseMapper.listAll(Wrappers.query().in("a.id", stationIds));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.njzscloud.common.core.ex.Exceptions;
|
|||
import com.njzscloud.common.core.utils.R;
|
||||
import com.njzscloud.common.security.support.UserDetail;
|
||||
import com.njzscloud.common.security.util.SecurityUtil;
|
||||
import com.njzscloud.dispose.sys.auth.pojo.result.MyResult;
|
||||
import com.njzscloud.dispose.sys.auth.service.AuthService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -27,12 +28,14 @@ public class AuthController {
|
|||
*/
|
||||
@GetMapping("/my")
|
||||
public R<UserDetail> my() {
|
||||
UserDetail userDetail = SecurityUtil.loginUser();
|
||||
MyResult userDetail = SecurityUtil.loginUser();
|
||||
Long userId = userDetail.getUserId();
|
||||
Integer client = userDetail.getClient();
|
||||
|
||||
Assert.notNull(client, () -> Exceptions.exception("客户端信息错误"));
|
||||
|
||||
return R.success(authService.my(userId, client));
|
||||
UserDetail my = authService.my(userId, client, userDetail.getCurrentCustomerId());
|
||||
|
||||
return R.success(my);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.njzscloud.dispose.sys.auth.pojo.result;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.njzscloud.common.core.ex.Exceptions;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.njzscloud.common.security.support.UserDetail;
|
||||
import com.njzscloud.dispose.cst.customer.constant.IdentityCategory;
|
||||
import com.njzscloud.dispose.sys.user.constant.Gender;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
|
@ -12,7 +12,8 @@ import java.math.BigDecimal;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.njzscloud.common.security.contant.Constants.ROLE_ADMIN;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -20,6 +21,11 @@ import java.util.Optional;
|
|||
public class MyResult extends UserDetail {
|
||||
|
||||
public static final String ROLE_KANLIAO = "ROLE_KANLIAO";
|
||||
public static final String ROLE_XiaoNa = "ROLE_XiaoNa";
|
||||
public static final String ROLE_ChanFei = "ROLE_ChanFei";
|
||||
public static final String ROLE_YunShu = "ROLE_YunShu";
|
||||
public static final String ROLE_CaiGou = "ROLE_CaiGou";
|
||||
public static final String ROLE_SiJi = "ROLE_SiJi";
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
|
|
@ -77,12 +83,12 @@ public class MyResult extends UserDetail {
|
|||
*/
|
||||
private BigDecimal revenue;
|
||||
|
||||
@JsonProperty("currentIdentity")
|
||||
public IdentityInfo currentIdentity() {
|
||||
Optional<IdentityInfo> identityInfo = identities.stream().filter(it -> Objects.equals(it.getCustomerId(), currentCustomerId)).findFirst();
|
||||
|
||||
Assert.isTrue(identityInfo.isPresent(), () -> Exceptions.error("无身份信息"));
|
||||
// noinspection OptionalGetWithoutIsPresent
|
||||
return identityInfo.get();
|
||||
return identities.stream()
|
||||
.filter(it -> Objects.equals(it.getCustomerId(), currentCustomerId))
|
||||
.findFirst()
|
||||
.orElseGet(IdentityInfo::new);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -90,8 +96,64 @@ public class MyResult extends UserDetail {
|
|||
*
|
||||
* @return true/false
|
||||
*/
|
||||
@JsonProperty("isKanLiao")
|
||||
public boolean isKanLiao() {
|
||||
return this.getRoles().contains(ROLE_KANLIAO);
|
||||
}
|
||||
|
||||
@JsonProperty("isXiaoNa")
|
||||
public boolean isXiaoNa() {
|
||||
return this.currentIdentity().getIdentityCategory() == IdentityCategory.XiaoNa;
|
||||
}
|
||||
|
||||
@JsonProperty("isChanFei")
|
||||
public boolean isChanFei() {
|
||||
return this.currentIdentity().getIdentityCategory() == IdentityCategory.ChanFei;
|
||||
}
|
||||
|
||||
@JsonProperty("isCaiGou")
|
||||
public boolean isCaiGou() {
|
||||
return this.currentIdentity().getIdentityCategory() == IdentityCategory.CaiGou;
|
||||
}
|
||||
|
||||
@JsonProperty("isYunShu")
|
||||
public boolean isYunShu() {
|
||||
return this.currentIdentity().getIdentityCategory() == IdentityCategory.YunShu;
|
||||
}
|
||||
|
||||
@JsonProperty("isSiJi")
|
||||
public boolean isSiJi() {
|
||||
return this.currentIdentity().getIdentityCategory() == IdentityCategory.SiJi;
|
||||
}
|
||||
|
||||
@JsonProperty("isAdmin")
|
||||
public boolean isAdmin() {
|
||||
return this.getRoles().contains(ROLE_ADMIN);
|
||||
|
||||
}
|
||||
|
||||
@JsonProperty("hasXiaoNa")
|
||||
public boolean hasXiaoNa() {
|
||||
return this.getRoles().contains(ROLE_XiaoNa);
|
||||
}
|
||||
|
||||
@JsonProperty("hasChanFei")
|
||||
public boolean hasChanFei() {
|
||||
return this.getRoles().contains(ROLE_ChanFei);
|
||||
}
|
||||
|
||||
@JsonProperty("hasCaiGou")
|
||||
public boolean hasCaiGou() {
|
||||
return this.getRoles().contains(ROLE_CaiGou);
|
||||
}
|
||||
|
||||
@JsonProperty("hasYunShu")
|
||||
public boolean hasYunShu() {
|
||||
return this.getRoles().contains(ROLE_YunShu);
|
||||
}
|
||||
|
||||
@JsonProperty("hasSiJi")
|
||||
public boolean hasSiJi() {
|
||||
return this.getRoles().contains(ROLE_SiJi);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,20 +75,29 @@ public class AuthService implements IAuthService {
|
|||
return my(userDetail, client);
|
||||
}
|
||||
|
||||
public UserDetail my(Long userId, Integer client, Long currentCustomerId) {
|
||||
UserDetail userDetail = authMapper.selectUser(Wrappers.query().eq("b.id", userId).eq("a.deleted", 0));
|
||||
Assert.notNull(userDetail, () -> Exceptions.exception("未查询到用户信息"));
|
||||
return my(userDetail, client, currentCustomerId);
|
||||
}
|
||||
|
||||
private UserDetail my(UserDetail userDetail, Integer client) {
|
||||
return my(userDetail, client, null);
|
||||
}
|
||||
|
||||
private UserDetail my(UserDetail userDetail, Integer client, Long currentCustomerId) {
|
||||
if (userDetail == null) return null;
|
||||
Long userId = userDetail.getUserId();
|
||||
Assert.notNull(userDetail, () -> Exceptions.exception("未查询到用户信息"));
|
||||
List<MenuResource> menuResources = authMapper.selectUserMenu(userId, client);
|
||||
List<EndpointResource> endpointResources = authMapper.selectUserEndpoint(userId);
|
||||
List<IdentityInfo> identityInfoList = authMapper.selectUserIdentity(userId);
|
||||
Long currentCustomerId = null;
|
||||
Long currentOrgId = null;
|
||||
MoneyAccountEntity moneyAccount = moneyAccountMapper.selectOne(Wrappers.<MoneyAccountEntity>lambdaQuery()
|
||||
.eq(MoneyAccountEntity::getUserId, userId)
|
||||
.eq(MoneyAccountEntity::getDeleted, Boolean.FALSE));
|
||||
|
||||
if (CollUtil.isNotEmpty(identityInfoList)) {
|
||||
if (CollUtil.isNotEmpty(identityInfoList) && currentCustomerId == null) {
|
||||
IdentityInfo identityInfo = identityInfoList.getFirst();
|
||||
currentCustomerId = identityInfo.getCustomerId();
|
||||
currentOrgId = identityInfo.getOrgId();
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ FROM (SELECT a.id
|
|||
a.create_time
|
||||
FROM (SELECT a.id
|
||||
FROM cst_order a
|
||||
INNER JOIN cst_order_trans b ON b.order_id = a.id
|
||||
LEFT JOIN cst_project f ON f.id = a.project_id
|
||||
INNER JOIN cst_org j ON j.id = a.trans_org_id
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -74,4 +74,10 @@
|
|||
<include refid="searchStation"/>
|
||||
WHERE a.id = #{id}
|
||||
</select>
|
||||
<select id="listAll" resultMap="StationResultPagingMap">
|
||||
<include refid="searchStation"/>
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njzscloud.dispose.cst.station.mapper.StationMemberMapper">
|
||||
</mapper>
|
||||
|
|
@ -22567,7 +22567,7 @@
|
|||
"dataLen": "",
|
||||
"numScale": "",
|
||||
"primaryKey": 0,
|
||||
"notNull": 0,
|
||||
"notNull": 1,
|
||||
"autoIncrement": 0,
|
||||
"defaultValue": "",
|
||||
"stndDictId": "",
|
||||
|
|
@ -22707,7 +22707,7 @@
|
|||
"primaryKey": 0,
|
||||
"notNull": 1,
|
||||
"autoIncrement": 0,
|
||||
"defaultValue": "'XianFu'",
|
||||
"defaultValue": "'Wu'",
|
||||
"stndDictId": "settlement_way",
|
||||
"stndFieldId": "",
|
||||
"stndDictKey": "settlement_way",
|
||||
|
|
@ -41858,7 +41858,7 @@
|
|||
"readonly": false,
|
||||
"allowWs": false
|
||||
},
|
||||
"updateTime": 1772157612371,
|
||||
"signature": "1d75ec8e295700be8f58198dab84523e",
|
||||
"updateTime": 1772414968697,
|
||||
"signature": "65777342475351a9f31d7b9e1e5d4087",
|
||||
"branchId": "1111"
|
||||
}
|
||||
Loading…
Reference in New Issue