| | |
| | | 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) { |
| | |
| | | return this.baseMapper.findSpindleRunningCurve(torqueValue,equipmentId); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | 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); |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | } |