|
@ -275,21 +275,41 @@ public class DcShiftsServiceImpl implements IDcShiftsService |
|
|
ExcelUtil<DcShifts> util = new ExcelUtil<DcShifts>(DcShifts.class); |
|
|
ExcelUtil<DcShifts> util = new ExcelUtil<DcShifts>(DcShifts.class); |
|
|
List<DcShifts> equipmentList = util.importExcel(file.getInputStream()); |
|
|
List<DcShifts> equipmentList = util.importExcel(file.getInputStream()); |
|
|
//List<DcShifts> equipmentList = util.importExcel("值班人员数据",file.getInputStream(),0);
|
|
|
//List<DcShifts> equipmentList = util.importExcel("值班人员数据",file.getInputStream(),0);
|
|
|
|
|
|
|
|
|
BeanValidators.validateWithException(validator, equipmentList);//对象属性验证
|
|
|
BeanValidators.validateWithException(validator, equipmentList);//对象属性验证
|
|
|
for (int i = 0; i < equipmentList.size(); i++) { |
|
|
for (int i = 0; i < equipmentList.size(); i++) { |
|
|
DcShifts dcShifts = equipmentList.get(i);//获取第i条全部的数据,转换给实体类
|
|
|
DcShifts dcShifts = equipmentList.get(i);//获取第i条全部的数据,转换给实体类
|
|
|
String name = dcShifts.getName(); |
|
|
String name = dcShifts.getName(); |
|
|
String contactNumber = dcShifts.getContactNumber();//手机号
|
|
|
String contactNumber = dcShifts.getContactNumber();//手机号
|
|
|
|
|
|
String organizationName = dcShifts.getOrganizationName();//驻点
|
|
|
|
|
|
String scheduling = dcShifts.getScheduling();//排班
|
|
|
if (contactNumber == null || contactNumber.equals("")) { |
|
|
if (contactNumber == null || contactNumber.equals("")) { |
|
|
msg = "没有获取到相关手机号信息,请输入手机号"; |
|
|
msg = "没有获取到相关手机号信息,请输入手机号"; |
|
|
throw new ServiceException(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<String, Object> map = dcShiftsMapper.contactNumber(contactNumber);//手机号获取人员id
|
|
|
HashMap<String, Object> map = dcShiftsMapper.contactNumber(contactNumber);//手机号获取人员id
|
|
|
if (map == null) { |
|
|
if (map == null) { |
|
|
msg = "没有查询到" + name + "的手机号绑定的信息,请查看手机号是否正确"; |
|
|
msg = "没有查询到" + name + "的手机号绑定的信息,请查看手机号是否正确;是否在系统,人员值班中存在"; |
|
|
|
|
|
throw new ServiceException(msg); |
|
|
|
|
|
} |
|
|
|
|
|
HashMap<String, Object> stationIdMap = dcShiftsMapper.selectStationId(organizationName);//路管驻点名称查询路管驻点id
|
|
|
|
|
|
if (stationIdMap==null){ |
|
|
|
|
|
msg = "没有查询到" + organizationName + "的驻点信息,请查驻点输入是否正确"; |
|
|
throw new ServiceException(msg); |
|
|
throw new ServiceException(msg); |
|
|
} |
|
|
} |
|
|
|
|
|
Long stationId =(Long) stationIdMap.get("id"); |
|
|
|
|
|
dcShifts.setStation(stationId);//驻点id
|
|
|
Long id = (Long) map.get("id"); |
|
|
Long id = (Long) map.get("id"); |
|
|
dcShifts.setEmployeesId(id); |
|
|
dcShifts.setEmployeesId(id); |
|
|
dcShifts.setCreateTime(DateUtils.getNowDate()); |
|
|
dcShifts.setCreateTime(DateUtils.getNowDate()); |
|
|