| | |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.jeecg.modules.mdc.entity.MdcTorqueConfig; |
| | | import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcTorqueConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Array; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class MdcTorqueConfigServiceImpl extends ServiceImpl<MdcTorqueConfigMapper, MdcTorqueConfig> implements IMdcTorqueConfigService{ |
| | | |
| | | @Autowired |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Override |
| | | public MdcTorqueConfig queryById(String id) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MdcTorqueConfig> queryPageList(Page page, HttpServletRequest req) { |
| | | QueryWrapper<MdcTorqueConfig> queryWrapper=new QueryWrapper(); |
| | | //检查请求体中是否有设备编号字段,存在则返回true |
| | | if (req.getParameterMap().containsKey("equipmentId")){ |
| | | //获取设备编号的值,不为空则添加到查询 |
| | | String equipmentId=req.getParameterMap().get("equipmentId")[0]; |
| | | queryWrapper.eq(StringUtils.isNotBlank(equipmentId),"equipment_id",equipmentId); |
| | | public IPage<MdcTorqueConfig> pageList(String userId, Page page, HttpServletRequest req, MdcTorqueConfig mdcTorqueConfig) { |
| | | List<String> equipmentIds=new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(mdcTorqueConfig.getParentId())&&StringUtils.isEmpty(mdcTorqueConfig.getEquipmentId())){ |
| | | if ("2".equals(mdcTorqueConfig.getTypeTree())){ |
| | | //部门层级 |
| | | equipmentIds=mdcEquipmentService.getEquipmentIdsByDepart(userId,mdcTorqueConfig.getParentId()); |
| | | }else { |
| | | //产线层级 |
| | | equipmentIds=mdcEquipmentService.getEquipmentIdsProduction(userId,mdcTorqueConfig.getParentId()); |
| | | } |
| | | }else if (StringUtils.isNotEmpty(mdcTorqueConfig.getEquipmentId())){ |
| | | //单台设备信息 |
| | | mdcTorqueConfig.setMdcSectionIds(Collections.singletonList(mdcTorqueConfig.getEquipmentId())); |
| | | }else { |
| | | //查询用户所拥有的所有设备信息 |
| | | if ("2".equals(mdcTorqueConfig.getTypeTree())){ |
| | | //部门层级 |
| | | equipmentIds=mdcEquipmentService.getEquipmentIdsByDepart(userId,null); |
| | | }else { |
| | | equipmentIds=mdcEquipmentService.getEquipmentIdsProduction(userId,null); |
| | | } |
| | | } |
| | | return this.page(page,queryWrapper); |
| | | if (mdcTorqueConfig.getMdcSectionIds()==null||mdcTorqueConfig.getMdcSectionIds().isEmpty()){ |
| | | mdcTorqueConfig.setMdcSectionIds(equipmentIds); |
| | | } |
| | | if (mdcTorqueConfig.getMdcSectionIds()==null||mdcTorqueConfig.getMdcSectionIds().isEmpty()){ |
| | | return null; |
| | | } |
| | | return this.baseMapper.pageList(page,mdcTorqueConfig); |
| | | } |
| | | } |