|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
import com.ozs.base.domain.BaseAgency;
|
|
|
import com.ozs.base.service.BaseAgencyService;
|
|
|
import com.ozs.common.constant.Constants;
|
|
@@ -16,7 +17,7 @@ import com.ozs.common.core.domain.entity.SysUser;
|
|
|
import com.ozs.common.core.domain.model.LoginUser;
|
|
|
import com.ozs.common.enums.*;
|
|
|
import com.ozs.common.exception.ServiceException;
|
|
|
-import com.ozs.common.exception.base.BaseException;
|
|
|
+import com.ozs.common.utils.PageUtils;
|
|
|
import com.ozs.common.utils.SecurityUtils;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.common.utils.bean.BeanUtils;
|
|
@@ -49,13 +50,13 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import javax.validation.Validator;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
@@ -126,22 +127,6 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
private PmAuditDeptRefService pmAuditDeptRefService;
|
|
|
|
|
|
|
|
|
- //@Override
|
|
|
- //public Page selectPlanYearsExamineList(PlanYearsStandardVo vo) {
|
|
|
- // PlanYears ofYears = new PlanYears();
|
|
|
- // PageHelper.startPage(vo.getPageNum().intValue(), vo.getPageSize().intValue());
|
|
|
- // List<PlanYears> planYears;
|
|
|
- // List<PlanYearsResponseVo> planYearsList = new ArrayList<>();
|
|
|
- // try {
|
|
|
- // BeanUtils.copyProperties(vo, ofYears);
|
|
|
- // planYears = planYearsMapper.selectPlanYearsExamineList(ofYears);
|
|
|
- // planYearsList = changeTo(planYears);
|
|
|
- // } catch (Exception e) {
|
|
|
- // e.printStackTrace();
|
|
|
- // }
|
|
|
- // Page pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planYearsList);
|
|
|
- // return pages;
|
|
|
- //}
|
|
|
|
|
|
@Override
|
|
|
public List<PlanYearsResponseVo> selectPlanYearsListEXP(PlanYearsStandardVo vo, LoginUser loginUser) {
|
|
@@ -171,38 +156,10 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
lw.le(PlanYears::getPlanDemandSubTime, vo.getEndTime());
|
|
|
}
|
|
|
lw.eq(PlanYears::getDelFlay, DataIsDelete.DataNOTDelete.getCode());
|
|
|
- // 添加数据权限
|
|
|
- List<String> roleKeys = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.toList());
|
|
|
- if (roleKeys.contains(Constants.DEMAND_UNIT)) {
|
|
|
- // 需求单位
|
|
|
- /*(purchase_dept_id = 当前用户deptID) */
|
|
|
+ if (!loginUser.getUserId().equals(Long.valueOf("1"))) {
|
|
|
lw.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
- } else if (roleKeys.contains(Constants.PURCHASING_MANAGEMENT)
|
|
|
- || roleKeys.contains(Constants.PURCHASE_SERVICES)) {
|
|
|
- // 采购管理部门 或 采购办
|
|
|
- SysDept sysDept = new SysDept();
|
|
|
- sysDept.setParentId(loginUser.getDeptId());
|
|
|
- sysDept.setStatus("0");
|
|
|
- List<Long> childDeptIds = deptService.selectDeptList(sysDept)
|
|
|
- .stream()
|
|
|
- .map(SysDept::getDeptId)
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (ObjectUtils.isEmpty(childDeptIds)) {
|
|
|
- lw.and((wrapper) -> {
|
|
|
- wrapper.eq(PlanYears::getIsExcess, 0);
|
|
|
- wrapper.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
- });
|
|
|
- } else {
|
|
|
- lw.and((wrapper) -> {
|
|
|
- wrapper.eq(PlanYears::getIsExcess, 0);
|
|
|
- wrapper.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
- })
|
|
|
- .or((wrapper) -> {
|
|
|
- wrapper.eq(PlanYears::getIsExcess, 1);
|
|
|
- wrapper.in(PlanYears::getPurchaseDeptId, childDeptIds);
|
|
|
- });
|
|
|
- }
|
|
|
}
|
|
|
+
|
|
|
Page<PlanYears> page = planYearsMapper.selectPage(new Page<PlanYears>(num, size, false), lw);
|
|
|
list.addAll(page.getRecords());
|
|
|
size = page.getRecords().size();
|
|
@@ -1242,6 +1199,42 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
return AjaxResult.error("没有查到相关数据!");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<PlanYears> queryPage(PlanYearsStandardVo vo) {
|
|
|
+ List<PlanYears> planYears = planYearsMapper.query(vo);
|
|
|
+ if (!ObjectUtils.isEmpty(planYears)) {
|
|
|
+ planYears.stream().map(o -> {
|
|
|
+ LambdaQueryWrapper<PmAuditDeptRef> lw = new LambdaQueryWrapper();
|
|
|
+ lw.eq(PmAuditDeptRef::getRefId, o.getPlanYearId());
|
|
|
+ lw.eq(PmAuditDeptRef::getRefType, "0");
|
|
|
+ List<PmAuditDeptRef> list = pmAuditDeptRefService.list(lw);
|
|
|
+ if (!ObjectUtils.isEmpty(list)) {
|
|
|
+ List<PmAuditDeptRef> collect = list.stream()
|
|
|
+ .filter(f -> f.getDeptId().equals(Long.valueOf(vo.getPurchaseDeptId())))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ String deptLevel = collect.get(0).getDeptLevel();
|
|
|
+ boolean f = true;
|
|
|
+ f = collect.get(0).getStatus().equals(Integer.parseInt("1")) ? false : true;
|
|
|
+ for (PmAuditDeptRef pmAuditDeptRef : collect) {
|
|
|
+ if (pmAuditDeptRef.getDeptLevel().compareTo(deptLevel) == -1
|
|
|
+ && pmAuditDeptRef.getStatus().equals(Integer.parseInt("0"))) {
|
|
|
+ f = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * String s1="A";
|
|
|
+ String s2="B";
|
|
|
+ System.out.println(s1.compareTo(s2));
|
|
|
+ * -1
|
|
|
+ * */
|
|
|
+ o.setFlag(f);
|
|
|
+ }
|
|
|
+ return o;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return planYears;
|
|
|
+ }
|
|
|
+
|
|
|
private List<SysFileInfo> getSysFileInfoList(Long redId, Integer type) {
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
map.put("red_id", redId);
|