diff --git a/zc-business/src/main/java/com/zc/business/domain/DcShifts.java b/zc-business/src/main/java/com/zc/business/domain/DcShifts.java index f07b648a..44a7cad1 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcShifts.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcShifts.java @@ -67,17 +67,21 @@ public class DcShifts extends BaseEntity @ApiModelProperty("备注") @Excel(name = "备注") private String remark; + @ApiModelProperty("所属路管驻点名称") @Excel(name = "所属路管驻点名称") private String organizationName; + @ApiModelProperty("排班 1-白班 2-夜班") - @Excel(name = "排班 1-白班 2-夜班") + @Excel(name = "班次(白班和夜班)") private String scheduling; @ApiModelProperty("驻点id") @Excel(name = "驻点id") private Long station; + + private JSONArray employeesJson; public JSONArray getEmployeesJson() { diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java index b6fbe15c..a27a458f 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java @@ -1,6 +1,5 @@ package com.zc.business.mapper; -import cn.hutool.core.lang.hash.Hash; import com.zc.business.domain.DcEventType; import com.zc.business.domain.DcWarning; import org.apache.ibatis.annotations.Param; @@ -39,6 +38,8 @@ public interface DcPerceivedEventsWarningMapper { List> selectWarningStateDay(DcWarning dcWarning); //感知事件类型占比 List> selectWarningTypeDay(DcWarning dcWarning); + //事件总数量 + int selectNumber(); //感知事件日趋势,传入某天的具体时间,结果按照那一天的小时分组 List> selectWarningTrendDay(DcWarning dcWarning); //感知事件月趋势,传入某月的具体时间,结果按照那一天分组 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java index d2235c55..f14a93e7 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java @@ -275,21 +275,41 @@ public class DcShiftsServiceImpl implements IDcShiftsService ExcelUtil util = new ExcelUtil(DcShifts.class); List equipmentList = util.importExcel(file.getInputStream()); //List equipmentList = util.importExcel("值班人员数据",file.getInputStream(),0); - BeanValidators.validateWithException(validator, equipmentList);//对象属性验证 for (int i = 0; i < equipmentList.size(); i++) { DcShifts dcShifts = equipmentList.get(i);//获取第i条全部的数据,转换给实体类 String name = dcShifts.getName(); String contactNumber = dcShifts.getContactNumber();//手机号 + String organizationName = dcShifts.getOrganizationName();//驻点 + String scheduling = dcShifts.getScheduling();//排班 if (contactNumber == null || contactNumber.equals("")) { msg = "没有获取到相关手机号信息,请输入手机号"; throw new ServiceException(msg); } + if (scheduling == null || scheduling.equals("")) { + msg = "没有获取到相关排版信息,请输入排版信息"; + throw new ServiceException(msg); + } + if (scheduling.equals("白班")){ + dcShifts.setScheduling("1"); + } else if (scheduling.equals("夜班")) { + dcShifts.setScheduling("2"); + }else { + msg = "输入排版格式不正确,请重新输入"; + throw new ServiceException(msg); + } HashMap map = dcShiftsMapper.contactNumber(contactNumber);//手机号获取人员id if (map == null) { - msg = "没有查询到" + name + "的手机号绑定的信息,请查看手机号是否正确"; + msg = "没有查询到" + name + "的手机号绑定的信息,请查看手机号是否正确;是否在系统,人员值班中存在"; + throw new ServiceException(msg); + } + HashMap stationIdMap = dcShiftsMapper.selectStationId(organizationName);//路管驻点名称查询路管驻点id + if (stationIdMap==null){ + msg = "没有查询到" + organizationName + "的驻点信息,请查驻点输入是否正确"; throw new ServiceException(msg); } + Long stationId =(Long) stationIdMap.get("id"); + dcShifts.setStation(stationId);//驻点id Long id = (Long) map.get("id"); dcShifts.setEmployeesId(id); dcShifts.setCreateTime(DateUtils.getNowDate()); diff --git a/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx b/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx index 4ce7809a..8701fd1f 100644 Binary files a/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx and b/zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx differ diff --git a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml index bcd110df..7be20301 100644 --- a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml @@ -14,7 +14,7 @@ select event_type, event_name from dc_event_type - + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml index e1ea10fa..d31e430c 100644 --- a/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml @@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"