| | |
| | | |
| | | import com.nanometer.smartlab.dao.HazardousWasteMapper; |
| | | import com.nanometer.smartlab.entity.HazardousWaste; |
| | | import com.nanometer.smartlab.util.ExcelUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class HazardousWasteServiceImpl implements HazardousWasteService{ |
| | |
| | | private HazardousWasteMapper hazardousWasteMapper; |
| | | |
| | | @Override |
| | | public List<HazardousWaste> selectAll(Date startTime, Date endTime, Integer offset, Integer pageSize) { |
| | | public List<HazardousWaste> selectAll(Date startTime, Date endTime,String status,String applyPerson,Long projectId,String department, |
| | | String tid, Integer offset, Integer pageSize) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | params.put("first", offset); |
| | | params.put("pageSize", pageSize); |
| | | if (StringUtils.isNotBlank(status) && !status.equals("全部")){ |
| | | params.put("status", status); |
| | | } |
| | | params.put("applyPerson", applyPerson); |
| | | params.put("projectId", projectId); |
| | | params.put("department", department); |
| | | params.put("tid", tid); |
| | | return hazardousWasteMapper.selectAll(params); |
| | | } |
| | | |
| | | @Override |
| | | public int countAll(Date startTime, Date endTime) { |
| | | public int countAll(Date startTime, Date endTime,String status,String applyPerson,Long projectId,String department,String tid) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | if (StringUtils.isNotBlank(status) && !status.equals("全部")){ |
| | | params.put("status", status); |
| | | } |
| | | params.put("applyPerson", applyPerson); |
| | | params.put("projectId", projectId); |
| | | params.put("department", department); |
| | | params.put("tid", tid); |
| | | return hazardousWasteMapper.countAll(params); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map> exportList(Date startTime, Date endTime, String status, String applyPerson, Long projectId, String department,String tid) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | if (StringUtils.isNotBlank(status) && !status.equals("全部")){ |
| | | params.put("status", status); |
| | | } |
| | | params.put("applyPerson", applyPerson); |
| | | params.put("projectId", projectId); |
| | | params.put("department", department); |
| | | params.put("tid", tid); |
| | | return hazardousWasteMapper.selectExportList(params); |
| | | } |
| | | |
| | | @Override |
| | | public void export2Excel(List<Map> list) throws Exception { |
| | | Map<String,String> map = new LinkedHashMap<>(); |
| | | map.put("tid", "单号"); |
| | | map.put("status", "状态"); |
| | | map.put("acid", "酸性废液"); |
| | | map.put("alkali", "碱性废液"); |
| | | map.put("organic", "有机废液"); |
| | | map.put("solid", "固体废弃物"); |
| | | map.put("medical", "医疗废弃物"); |
| | | map.put("applyPerson", "确认者"); |
| | | map.put("project", "课题组"); |
| | | map.put("department", "部门"); |
| | | map.put("unit", "单位"); |
| | | map.put("creator", "创建者"); |
| | | map.put("createTime", "创建时间"); |
| | | ExcelUtils.export2Excel(list,"危废列表",map); |
| | | } |
| | | |
| | | @Override |
| | | public int countStatistics(Date startTime, Date endTime, String status, String applyPerson, Long projectId, String department) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | if (StringUtils.isNotBlank(status) && !status.equals("全部")){ |
| | | params.put("status", status); |
| | | } |
| | | params.put("applyPerson", applyPerson); |
| | | params.put("projectId", projectId); |
| | | params.put("department", department); |
| | | return hazardousWasteMapper.countStatistics(params); |
| | | } |
| | | |
| | | @Override |
| | | public List<HazardousWaste> selectStatistics(Date startTime, Date endTime, String status, String applyPerson, Long projectId, String department, int first, int pageSize) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | params.put("first", first); |
| | | params.put("pageSize", pageSize); |
| | | if (StringUtils.isNotBlank(status) && !status.equals("全部")){ |
| | | params.put("status", status); |
| | | } |
| | | params.put("applyPerson", applyPerson); |
| | | params.put("projectId", projectId); |
| | | params.put("department", department); |
| | | return hazardousWasteMapper.selectStatistics(params); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map> exportStatisticsList(Date startTime, Date endTime, String status, String applyPerson, Long projectId, String department) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("startTime", startTime); |
| | | params.put("endTime", endTime); |
| | | if (StringUtils.isNotBlank(status) && !status.equals("全部")){ |
| | | params.put("status", status); |
| | | } |
| | | params.put("applyPerson", applyPerson); |
| | | params.put("projectId", projectId); |
| | | params.put("department", department); |
| | | return hazardousWasteMapper.selectStatisticsExportList(params); |
| | | } |
| | | |
| | | @Override |
| | | public void exportStatistics2Excel(List<Map> list)throws Exception { |
| | | Map<String,String> map = new LinkedHashMap<>(); |
| | | map.put("status", "状态"); |
| | | map.put("acid", "酸性废液"); |
| | | map.put("alkali", "碱性废液"); |
| | | map.put("organic", "有机废液"); |
| | | map.put("solid", "固体废弃物"); |
| | | map.put("medical", "医疗废弃物"); |
| | | map.put("applyPerson", "确认者"); |
| | | map.put("project", "课题组"); |
| | | map.put("department", "部门"); |
| | | map.put("unit", "单位"); |
| | | ExcelUtils.export2Excel(list,"危废统计分析",map); |
| | | } |
| | | |
| | | @Override |
| | | public void insertInfo(HazardousWaste hazardousWaste) { |
| | | hazardousWasteMapper.insert(hazardousWaste); |
| | | } |
| | | |
| | | @Override |
| | | public List<HazardousWaste> setAllWasters(String starttime, String endtime, String status, String applyPerson) { |
| | | return hazardousWasteMapper.setAllWasters(starttime,endtime, status, applyPerson); |
| | | } |
| | | |
| | | @Override |
| | | public HazardousWaste selectByTid(String tid) { |
| | | return hazardousWasteMapper.selectByTid(tid); |
| | | } |
| | | |
| | | @Override |
| | | public void updateWaste(HazardousWaste hazardousWaste) { |
| | | hazardousWasteMapper.updateByPrimaryKeySelective(hazardousWaste); |
| | | } |
| | | |
| | | @Override |
| | | public List<HazardousWaste> setAllWasterCount(String starttime, String endtime, String status, String applyPerson) { |
| | | return hazardousWasteMapper.setAllWasterCount(starttime, endtime, status, applyPerson); |
| | | } |
| | | |
| | | @Override |
| | | public HazardousWaste selectById(Long id) { |
| | | return hazardousWasteMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | } |