|
@@ -17,7 +17,6 @@ import com.jeeplus.sys.constant.enums.OfficeTypeEnum;
|
|
|
import com.jeeplus.sys.domain.Office;
|
|
|
import com.jeeplus.sys.mapper.OfficeMapper;
|
|
|
import com.jeeplus.sys.service.dto.OfficeDTO;
|
|
|
-import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.service.mapstruct.OfficeWrapper;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -25,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import javax.validation.constraints.NotNull;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -393,4 +391,45 @@ public class OfficeService extends TreeService<OfficeMapper, Office> {
|
|
|
queryWrapper.orderByDesc("so.name");
|
|
|
return officeMapper.findList(page, queryWrapper).getRecords();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询当前登录人所属部门是评估还是兴光会计
|
|
|
+ * 1 评估
|
|
|
+ * 2 兴光会计
|
|
|
+ * 3 其他
|
|
|
+ * 4 管理员
|
|
|
+ */
|
|
|
+ public String checkLoginIsPgOrKj() {
|
|
|
+ AtomicReference<String> returnCode = new AtomicReference<>("3");
|
|
|
+ // 如果当前登录人是管理员,直接返回 4
|
|
|
+ if (UserUtils.getCurrentUserDTO().isAdmin()) {
|
|
|
+ return "4";
|
|
|
+ }
|
|
|
+ // 获取当前登录人所属部门
|
|
|
+ String officeId = UserUtils.getCurrentUserDTO().getOfficeDTO().getId();
|
|
|
+ // 获取当前登录人所属部门的所有上级机构的id
|
|
|
+ List<String> supOfficeIds = new ArrayList<>();
|
|
|
+ Office office = officeMapper.selectById(officeId);
|
|
|
+ if (ObjectUtil.isNotEmpty(office)) {
|
|
|
+ if (StringUtils.isNotBlank(office.getParentIds())) {
|
|
|
+ String[] splitIds = office.getParentIds().split(",");
|
|
|
+ if (ObjectUtil.isNotEmpty(splitIds)) {
|
|
|
+ for (String splitId : splitIds) {
|
|
|
+ supOfficeIds.add(splitId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ supOfficeIds.add(officeId);
|
|
|
+ List<Office> officeList = officeMapper.selectList(new LambdaQueryWrapper<Office>().in(Office::getId, supOfficeIds));
|
|
|
+ officeList.stream().forEach(item -> {
|
|
|
+ if ("xgzcpg".equals(item.getCode())) { // 当前人所属评估部门
|
|
|
+ returnCode.set("1");
|
|
|
+ }
|
|
|
+ if ("xgkjssws".equals(item.getCode())) { // 当前人所属兴光会计部门
|
|
|
+ returnCode.set("2");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return returnCode.get();
|
|
|
+ }
|
|
|
}
|