Browse Source

对值班模板导出与导入

develop
wangsixiang 10 months ago
parent
commit
edc2c81808
  1. 6
      zc-business/src/main/java/com/zc/business/domain/DcShifts.java
  2. 3
      zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java
  3. 24
      zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java
  4. BIN
      zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx
  5. 6
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml
  6. 2
      zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

6
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() {

3
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<HashMap<String,Object>> selectWarningStateDay(DcWarning dcWarning);
//感知事件类型占比
List<HashMap<String,Object>> selectWarningTypeDay(DcWarning dcWarning);
//事件总数量
int selectNumber();
//感知事件日趋势,传入某天的具体时间,结果按照那一天的小时分组
List<HashMap<String,Object>> selectWarningTrendDay(DcWarning dcWarning);
//感知事件月趋势,传入某月的具体时间,结果按照那一天分组

24
zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java

@ -275,21 +275,41 @@ public class DcShiftsServiceImpl implements IDcShiftsService
ExcelUtil<DcShifts> util = new ExcelUtil<DcShifts>(DcShifts.class);
List<DcShifts> equipmentList = util.importExcel(file.getInputStream());
//List<DcShifts> 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<String, Object> map = dcShiftsMapper.contactNumber(contactNumber);//手机号获取人员id
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);
}
Long stationId =(Long) stationIdMap.get("id");
dcShifts.setStation(stationId);//驻点id
Long id = (Long) map.get("id");
dcShifts.setEmployeesId(id);
dcShifts.setCreateTime(DateUtils.getNowDate());

BIN
zc-business/src/main/resources/excelTemplate/值班示例模板.xlsx

Binary file not shown.

6
zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

@ -14,7 +14,7 @@
select event_type, event_name from dc_event_type
</select>
<select id="selectWarningById" resultType="com.zc.business.domain.DcWarning">
SELECT warning.`id`,warning.`stake_mark`, warning.`direction`,
SELECT DISTINCT warning.`id`,warning.`stake_mark`, warning.`direction`,
mark.longitude,mark.latitude,warning.lane,
warning.`dept_id`,warning.`warning_state`,warning.`warning_time`,
warning.`user_id`, warning.`warning_source`,warning.`warning_level`,
@ -281,7 +281,9 @@
GROUP BY QUARTER
ORDER BY QUARTER;
</select>
<select id="selectNumber" resultType="int">
select count(1) from dc_warning
</select>
</mapper>

2
zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectDcShiftsRecord" resultType="com.zc.business.domain.DcShiftsRecord">
select record.id ,record.operator,record.operation_type,
user.nick_name,
user.nick_name,record.station,
record.operation_time,record.modify_content,
record.shifts_date from dc_shifts_record as record
left join sys_user as user on record.operator=user.user_id

Loading…
Cancel
Save