| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | |
| | | */ |
| | | @Service |
| | | public class CalibrationOrderServiceImpl extends ServiceImpl<CalibrationOrderMapper, CalibrationOrder> implements ICalibrationOrderService { |
| | | |
| | | |
| | | /** |
| | | * 用户类型(1 普通成员 2 工段 3 分厂/中心 4 公司) |
| | | */ |
| | | private static final Integer USER_TYPE_1 = 1; |
| | | private static final Integer USER_TYPE_2 = 2; |
| | | private static final Integer USER_TYPE_3 = 3; |
| | | private static final Integer USER_TYPE_4 = 4; |
| | | |
| | | /** |
| | | * 车间层级类型(1 公司 2 分厂、中心 3 工段) |
| | | */ |
| | | private static final String ORG_TYPE_1 = "1"; |
| | | private static final String ORG_TYPE_2 = "2"; |
| | | private static final String ORG_TYPE_3 = "3"; |
| | | |
| | | @Autowired |
| | | private CalibrationOrderMapper calibrationOrderMapper; |
| | |
| | | * qsw 2024-3-15 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> getTwoMaintenancePlanList() { |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | |
| | | List<Area> areaList = areaService.lambdaQuery().eq(Area::getType, "1").eq(Area::getDelFlag, "0").list(); |
| | | List<Map<String, Object>> arrayList = new ArrayList<>(); |
| | | public List<Map<String, Object>> getTwoMaintenancePlanList(String productionCode) { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | List<Area> areaList = null; |
| | | if(USER_TYPE_4.equals(userType)){ |
| | | if(StringUtils.isBlank(productionCode)){ |
| | | areaList = areaService.lambdaQuery().eq(Area::getType, "1").eq(Area::getDelFlag, "0").list(); |
| | | }else{ |
| | | String orgType = this.baseMapper.findOrgType(productionCode); |
| | | if(ORG_TYPE_2.equals(orgType)){ |
| | | Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "1").eq(Area::getDelFlag, 0)); |
| | | areaList = areaService.lambdaQuery().eq(Area::getType, "1").eq(Area::getId,area.getId()).eq(Area::getDelFlag, "0").list(); |
| | | } |
| | | // else if(ORG_TYPE_3.equals(orgType)){ |
| | | // Area area = areaService.getOne(new LambdaQueryWrapper<Area>().eq(Area::getNum, productionCode).eq(Area::getType, "3").eq(Area::getDelFlag, 0)); |
| | | // list = calibrationOrderService.getThisMonthMaintenanceFinishList("",area.getId()); |
| | | // } |
| | | } |
| | | } |
| | | for (Area area : areaList) { |
| | | String id = area.getId(); |
| | | List<Map<String, Object>> centerTwoMaintenancePlanList = this.baseMapper.getCenterTwoMaintenancePlanList(id); |
| | | if(centerTwoMaintenancePlanList.size()>0){ |
| | | arrayList.add(centerTwoMaintenancePlanList.get(0)); |
| | | list.add(centerTwoMaintenancePlanList.get(0)); |
| | | } |
| | | } |
| | | return null; |
| | | return list; |
| | | } |
| | | } |