Commit 675cdd1b authored by tangwei's avatar tangwei

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 5dc4c319 4b6f8dc1
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
and s.duty_date >= #{beginDate} and s.duty_date >= #{beginDate}
and s.duty_date <![CDATA[<=]]> #{endDate} and s.duty_date <![CDATA[<=]]> #{endDate}
and s.app_Key = #{appKey} and s.app_Key = #{appKey}
GROUP BY s.duty_date GROUP BY s.duty_date,s.shift_id <!--增添分组条件 根据班次分组技术 -->
) a) as maxDutyPersonNumDay, ) a) as maxDutyPersonNumDay,
(select (select
IFNULL(max(num),0) IFNULL(max(num),0)
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper <mapper
namespace="com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper"> namespace="com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper">
<select id="getFirefightersJobTitleCount" resultType="com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto"> <select id="getFirefightersJobTitleCount"
select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode resultType="com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto">
from cb_firefighters a select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode
where a.is_delete = 0 from cb_firefighters a
GROUP BY a.job_title_code where a.is_delete = 0
</select> GROUP BY a.job_title_code
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm --> </select>
<select id="getFirefighters" <!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto"> <select id="getFirefighters"
select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code areasExpertiseCode from cb_firefighters a LEFT JOIN cb_firefighters_post b on resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto">
a.sequence_nbr=b.firefighters_id where a.is_delete=0 select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if> areasExpertiseCode from cb_firefighters a LEFT JOIN
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if> cb_firefighters_post b on
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if> a.sequence_nbr=b.firefighters_id where a.is_delete=0
<if test='par.state!=null'>and a.state_code= #{par.state}</if> <if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if> <if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if> <if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if> <if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if> <if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
ORDER BY a.rec_date desc limit #{pageNum},#{pageSize} <if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
</select> <if
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm --> test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<select id="getFirefightersCount" resultType="Map"> <if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN ORDER BY a.rec_date desc limit #{pageNum},#{pageSize}
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where </select>
a.is_delete=0 <!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if> <select id="getFirefightersCount" resultType="Map">
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if> select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if> cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
<if test='par.state!=null'>and a.state_code= #{par.state}</if> a.is_delete=0
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if> <if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if> <if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if> <if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if> <if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date desc ORDER BY a.rec_date desc
</select> </select>
<select id="listToSelectById" resultType="Map"> <select id="listToSelectById" resultType="Map">
SELECT IFNULL(a.personnel_photos, '') personnelPhotos, SELECT IFNULL(a.personnel_photos, '') personnelPhotos,
a.sequence_nbr a.sequence_nbr
sequenceNbr, sequenceNbr,
IFNULL(a.`name`, '无') `name`, IFNULL(a.`name`, '无') `name`,
IFNULL(a.job_title, '无') IFNULL(a.job_title, '无')
jobTitle, jobTitle,
IFNULL(b.administrative_position, '无') IFNULL(b.administrative_position, '无')
administrativePosition, administrativePosition,
IFNULL(c.`name`, '无') fireTeamName, IFNULL(c.`name`, '无') fireTeamName,
IFNULL(a.state, '无') state, IFNULL(a.state, '无') state,
IFNULL(b.employee_hierarchy, '无') IFNULL(b.employee_hierarchy, '无')
employeeHierarchy, employeeHierarchy,
IFNULL(b.areas_expertise, '无') areasExpertise, IFNULL(b.areas_expertise, '无') areasExpertise,
IFNULL(a.gender, '无') gender, IFNULL(a.gender, '无') gender,
IFNULL(b.post_qualification, '无') IFNULL(b.post_qualification, '无')
postQualification, year ( from_days( datediff( now( ), postQualification, year ( from_days( datediff( now( ),
a.birthday_time))) age a.birthday_time))) age
FROM cb_firefighters a LEFT JOIN cb_firefighters_post b FROM cb_firefighters a LEFT JOIN cb_firefighters_post b
ON a.sequence_nbr ON a.sequence_nbr
= b.firefighters_id LEFT JOIN cb_fire_team c on = b.firefighters_id LEFT JOIN cb_fire_team c on
c.sequence_nbr=a.fire_team_id c.sequence_nbr=a.fire_team_id
WHERE a.is_delete =0 WHERE a.is_delete =0
and a.sequence_nbr=#{id} and a.sequence_nbr=#{id}
</select> </select>
<!-- BUG3553 BY kongfm 人员关系显示汉字--> <!-- BUG3553 BY kongfm 人员关系显示汉字 -->
<select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto"> <select id="exportToExcel"
select f.*, resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto">
(select cb_fire_team.name from cb_fire_team where cb_fire_team.sequence_nbr=f.fire_team_id) fireTeam, SELECT
emergency_contact, (select da.name from cb_data_dictionary da where da.code = fc.relationship) as relationship , emergency_contact_phone f.*,
from cb_firefighters f ( SELECT cb_fire_team.NAME FROM cb_fire_team WHERE
left join cb_firefighters_contacts fc on f.sequence_nbr = fc.firefighters_id cb_fire_team.sequence_nbr = f.fire_team_id ) fireTeam,
where f.is_delete = #{isDelete} emergency_contact,
</select> da.NAME AS relationship,
emergency_contact_phone
FROM
cb_firefighters f
LEFT JOIN cb_firefighters_contacts fc ON f.sequence_nbr =
fc.firefighters_id
left join cb_data_dictionary da on da.CODE = fc.relationship
where f.is_delete = #{isDelete}
</select>
</mapper> </mapper>
...@@ -79,7 +79,7 @@ public class OrgPersonController { ...@@ -79,7 +79,7 @@ public class OrgPersonController {
@ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据") @ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据")
public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo, public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo,
@PathVariable Long id) throws Exception { @PathVariable Long id) throws Exception {
//OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON); OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
iOrgUsrService.updateByIdOrgPerson(OrgPersonVo, id); iOrgUsrService.updateByIdOrgPerson(OrgPersonVo, id);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
......
...@@ -87,7 +87,10 @@ public class OrgUsrController extends BaseController { ...@@ -87,7 +87,10 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse("-1"); return ResponseHelper.buildResponse("-1");
} }
} }
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete", CommonConstant.IS_DELETE_01)); // iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete", CommonConstant.IS_DELETE_01));
/*bug 2812 一次删除多条数据 传入类型修改为string 问题解决 2021-09-09 陈召 开始*/
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", String.valueOf(id)).set("is_delete", CommonConstant.IS_DELETE_01));
/*bug 2812 一次删除多条数据 传入类型修改为string 问题解决 2021-09-09 陈召 结束*/
try { try {
eSOrgUsrService.deleteById(id); eSOrgUsrService.deleteById(id);
emqKeeper.getMqttClient().publish(airportDeleteTopic, JSON.toJSONString(id).getBytes(), 2, false); emqKeeper.getMqttClient().publish(airportDeleteTopic, JSON.toJSONString(id).getBytes(), 2, false);
...@@ -108,6 +111,7 @@ public class OrgUsrController extends BaseController { ...@@ -108,6 +111,7 @@ public class OrgUsrController extends BaseController {
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据") @ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据")
public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgUsrDto OrgUsrVo, @PathVariable Long id) throws Exception { public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgUsrDto OrgUsrVo, @PathVariable Long id) throws Exception {
OrgUsrVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY); OrgUsrVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id); iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
......
...@@ -100,7 +100,6 @@ public class WaterResourceController extends BaseController { ...@@ -100,7 +100,6 @@ public class WaterResourceController extends BaseController {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE))); model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE))); model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}*/ }*/
if (!StringUtils.isEmpty(resourceType)) { if (!StringUtils.isEmpty(resourceType)) {
switch (resourceType) { switch (resourceType) {
case "hydrant": case "hydrant":
...@@ -176,8 +175,6 @@ public class WaterResourceController extends BaseController { ...@@ -176,8 +175,6 @@ public class WaterResourceController extends BaseController {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE))); model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE))); model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}*/ }*/
// 更新基本信息 // 更新基本信息
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList())); model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
......
...@@ -85,16 +85,43 @@ public class DutyCommonServiceImpl implements IDutyCommonService { ...@@ -85,16 +85,43 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
} }
private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException { private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException {
// 获取值班的实例id
String instanceId = m.get("instanceId").toString(); String instanceId = m.get("instanceId").toString();
// 根据appkey 获取未删除的值班班次
List<DutyShift> dutyShifts = dutyShiftService.list(new LambdaQueryWrapper<DutyShift>() List<DutyShift> dutyShifts = dutyShiftService.list(new LambdaQueryWrapper<DutyShift>()
.eq(BaseEntity::getIsDelete, false).eq(DutyShift::getAppKey, RequestContext.getAppKey())); .eq(BaseEntity::getIsDelete, false).eq(DutyShift::getAppKey, RequestContext.getAppKey()));
// 根据id 保存成key -value
Map<Long, DutyShift> keyNameMap = dutyShifts.stream() Map<Long, DutyShift> keyNameMap = dutyShifts.stream()
.collect(Collectors.toMap(BaseEntity::getSequenceNbr, Function.identity())); .collect(Collectors.toMap(BaseEntity::getSequenceNbr, Function.identity()));
// 根据时间 查询值班关系表
// BUG 2806 获取月份第一天和最后一天 2021-09-09 by kongfm
if(beginDate != null ) {
Calendar c = Calendar.getInstance();
c.setTime(DateUtils.longStr2Date(beginDate));
c.set(Calendar.DAY_OF_MONTH, 1);
c.set(Calendar.HOUR_OF_DAY,0);
c.set(Calendar.MINUTE,0);
c.set(Calendar.SECOND,0);
beginDate = DateUtils.date2LongStr(c.getTime());
}
if(endDate != null ) {
Calendar c = Calendar.getInstance();
c.setTime(DateUtils.longStr2Date(beginDate));
c.add(Calendar.MONTH, 1);
c.set(Calendar.DAY_OF_MONTH, 1);
c.add(Calendar.DATE, -1);
c.set(Calendar.HOUR_OF_DAY,23);
c.set(Calendar.MINUTE,59);
c.set(Calendar.SECOND,59);
endDate = DateUtils.date2LongStr(c.getTime());
}
List<DutyPersonShiftDto> personShiftList = dutyPersonShiftService List<DutyPersonShiftDto> personShiftList = dutyPersonShiftService
.list(new LambdaQueryWrapper<DutyPersonShift>().eq(DutyPersonShift::getInstanceId, instanceId) .list(new LambdaQueryWrapper<DutyPersonShift>().eq(DutyPersonShift::getInstanceId, instanceId)
.ge(beginDate != null, DutyPersonShift::getDutyDate, beginDate) .ge(beginDate != null, DutyPersonShift::getDutyDate, beginDate)
.le(endDate != null, DutyPersonShift::getDutyDate, endDate)) .le(endDate != null, DutyPersonShift::getDutyDate, endDate))
.stream().map(e -> { .stream().map(e -> {
// 值班关系查询到以后 重新封装
DutyPersonShiftDto dto = new DutyPersonShiftDto(); DutyPersonShiftDto dto = new DutyPersonShiftDto();
Bean.copyExistPropertis(e, dto); Bean.copyExistPropertis(e, dto);
// 没值班信息,默认休 // 没值班信息,默认休
...@@ -152,6 +179,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService { ...@@ -152,6 +179,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
public List<Map<String, Object>> list(Long teamId, String beginDate, String endDate) throws ParseException { public List<Map<String, Object>> list(Long teamId, String beginDate, String endDate) throws ParseException {
// 1.已column为准 进行返回 // 1.已column为准 进行返回
String groupCode = this.getGroupCode(); String groupCode = this.getGroupCode();
// 动态表单查询所有值班信息
List<Map<String, Object>> list = dynamicFormInstanceService.listAll(groupCode); List<Map<String, Object>> list = dynamicFormInstanceService.listAll(groupCode);
// 2.组织值班数据 // 2.组织值班数据
...@@ -299,6 +327,9 @@ public class DutyCommonServiceImpl implements IDutyCommonService { ...@@ -299,6 +327,9 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
@Override @Override
public Boolean deleteDutyData(Long instanceId) { public Boolean deleteDutyData(Long instanceId) {
// 一个人共用一个 instanceId
dynamicFormInstanceService.remove( dynamicFormInstanceService.remove(
new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId, instanceId)); new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId, instanceId));
dutyPersonShiftService dutyPersonShiftService
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -8,7 +33,24 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -8,7 +33,24 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.CheckObjectDto;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto;
import com.yeejoin.amos.boot.module.common.api.dto.ESOrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.dto.UserUnitDto;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany; import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
...@@ -23,24 +65,6 @@ import com.yeejoin.amos.feign.privilege.Privilege; ...@@ -23,24 +65,6 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.component.emq.EmqKeeper;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* 机构/部门/人员表 服务实现类 * 机构/部门/人员表 服务实现类
* *
...@@ -169,13 +193,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -169,13 +193,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return resultList; return resultList;
} }
@SuppressWarnings("unchecked")
@Override @Override
public List<OrgMenuDto> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, public List<OrgMenuDto> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL,
String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName,
String OrgTypeMethodName) throws Exception { String OrgTypeMethodName) throws Exception {
List<OrgMenuDto> childList = new ArrayList<>(); List<OrgMenuDto> childList = new ArrayList<>();
@SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
Method IDMethodNameme = null; Method IDMethodNameme = null;
switch (IDHierarchy) { switch (IDHierarchy) {
...@@ -239,7 +261,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -239,7 +261,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return childList; return childList;
} }
@Override @Override
public List<Map<String, Object>> returnCompanyPersonMsg(List<Long> ids) throws Exception { public List<Map<String, Object>> returnCompanyPersonMsg(List<Long> ids) throws Exception {
List<Map<String, Object>> companyPersonMsg = new ArrayList<>(); List<Map<String, Object>> companyPersonMsg = new ArrayList<>();
...@@ -413,13 +435,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -413,13 +435,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
private void updateChildOrgCode(String oriOrgCode, String targetOrgCode) { private void updateChildOrgCode(String oriOrgCode, String targetOrgCode) {
List<OrgUsr> list = queryOrgUsrList(oriOrgCode); List<OrgUsr> list = queryOrgUsrList(oriOrgCode);
if (ObjectUtils.isEmpty(list)) { if (!ObjectUtils.isEmpty(list)) {
return;
}
list.forEach(action -> { list.forEach(action -> {
action.setBizOrgCode(action.getBizOrgCode().replace(oriOrgCode, targetOrgCode)); action.setBizOrgCode(action.getBizOrgCode().replace(oriOrgCode, targetOrgCode));
updateById(action); updateById(action);
}); });
}
} }
public List<OrgUsr> queryOrgUsrList(String bizOrgCode) { public List<OrgUsr> queryOrgUsrList(String bizOrgCode) {
...@@ -621,6 +642,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -621,6 +642,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr orgUsr = new OrgUsr(); OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id); OrgUsr oriOrgUsr = getById(id);
BeanUtils.copyProperties(OrgUsrVo, orgUsr); BeanUtils.copyProperties(OrgUsrVo, orgUsr);
/*单位编辑后 code值也应做出修改 2021-09-09 陈召 开始 */
OrgUsr parent = getById(OrgUsrVo.getParentId());
if (parent != null){
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
}
orgUsr.setSequenceNbr(id);
/*单位编辑后 code值也应做出修改 2021-09-09 陈召 结束 */
saveOrgUsr(orgUsr, oriOrgUsr); saveOrgUsr(orgUsr, oriOrgUsr);
// 保存动态表单数据 // 保存动态表单数据
updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgUsrVo.getDynamicFormValue()); updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgUsrVo.getDynamicFormValue());
...@@ -636,13 +664,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -636,13 +664,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr orgUsr = new OrgUsr(); OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id); OrgUsr oriOrgUsr = getById(id);
BeanUtils.copyProperties(OrgPersonVo, orgUsr); BeanUtils.copyProperties(OrgPersonVo, orgUsr);
/* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 开始*/
OrgUsr parent = getById(OrgPersonVo.getParentId());
if (parent != null){
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
}
/* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 结束*/
orgUsr.setSequenceNbr(id); orgUsr.setSequenceNbr(id);
/* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 开始*/
OrgUsr parent = getById(OrgPersonVo.getParentId());
if (!ObjectUtils.isEmpty(parent)){
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
}
/* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 结束*/
if (!ObjectUtils.isEmpty(OrgPersonVo.getAmosOrgId())) { if (!ObjectUtils.isEmpty(OrgPersonVo.getAmosOrgId())) {
AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult(); AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult();
oriOrgUsr.setAmosOrgCode(user.getRealName()); oriOrgUsr.setAmosOrgCode(user.getRealName());
...@@ -776,6 +804,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -776,6 +804,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr orgUsr = new OrgUsr(); OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id); OrgUsr oriOrgUsr = getById(id);
BeanUtils.copyProperties(OrgDepartmentVo, orgUsr); BeanUtils.copyProperties(OrgDepartmentVo, orgUsr);
/*部门编辑后 code值也应做出修改 2021-09-09 陈召 开始 */
OrgUsr parent = getById(OrgDepartmentVo.getParentId());
if (parent != null){
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
}
orgUsr.setSequenceNbr(id);
/*部门编辑后 code值也应做出修改 2021-09-09 陈召 结束 */
saveOrgUsr(orgUsr, oriOrgUsr); saveOrgUsr(orgUsr, oriOrgUsr);
// 保存动态表单数据 // 保存动态表单数据
updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgDepartmentVo.getDynamicFormValue()); updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgDepartmentVo.getDynamicFormValue());
...@@ -961,7 +997,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -961,7 +997,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return null; return null;
} }
return ids.stream().map(m -> { return ids.stream().map(m -> {
OrgUsr org = getById(m); // BUG 2740 机场单位主键varchar 导致 通过主键搜索返回多条数据 2021 - 09 - 09by kongfm
OrgUsr org = getById(m.toString());
if (ObjectUtils.isEmpty(org)) { if (ObjectUtils.isEmpty(org)) {
return null; return null;
} }
...@@ -978,6 +1015,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -978,6 +1015,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public List<OrgUsrDto> queryForListByParentIdAndOrgType(Long parentId, String bizOrgType, Boolean isDelete) { public List<OrgUsrDto> queryForListByParentIdAndOrgType(Long parentId, String bizOrgType, Boolean isDelete) {
return this.queryForList(null, false, parentId, bizOrgType, isDelete); return this.queryForList(null, false, parentId, bizOrgType, isDelete);
} }
public List<OrgUsrDto> queryForListByParentIdAndOrgType(Long parentId, String bizOrgType) {
return Bean.toModels(this.list(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getParentId,parentId).eq(OrgUsr::getBizOrgType,bizOrgType)), this.getModelClass());
}
public OrgUsrDto getOrg(String amosUserId) { public OrgUsrDto getOrg(String amosUserId) {
OrgUsrDto person = queryForListByParentIdAndOrgType(amosUserId); OrgUsrDto person = queryForListByParentIdAndOrgType(amosUserId);
...@@ -1383,7 +1424,6 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1383,7 +1424,6 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<OrgUsr> orgUsrList = this.baseMapper.selectList(wrapper); List<OrgUsr> orgUsrList = this.baseMapper.selectList(wrapper);
return orgUsrList; return orgUsrList;
} }
} }
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
...@@ -26,6 +32,10 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.*; ...@@ -26,6 +32,10 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft; import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums; import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import ch.qos.logback.core.subst.Token;
import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.ConvertUtils;
import org.apache.ibatis.annotations.Case; import org.apache.ibatis.annotations.Case;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
...@@ -38,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -38,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -60,1083 +71,1069 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -60,1083 +71,1069 @@ import java.util.concurrent.atomic.AtomicInteger;
@Service @Service
public class ExcelServiceImpl { public class ExcelServiceImpl {
private static final String NOT_DUTY = "休班"; private static final String NOT_DUTY = "休班";
private static final String PERSON = "PERSON"; private static final String PERSON = "PERSON";
private static final String MAINTENANCE_PERSON = "maintenancePerson"; private static final String MAINTENANCE_PERSON = "maintenancePerson";
@Autowired
DataSourcesImpl dataSourcesImpl; @Autowired
@Autowired private RedisUtils redisUtils;
FireChemicalServiceImpl fireChemicalServiceImpl; @Autowired
@Autowired DataSourcesImpl dataSourcesImpl;
FireExpertsServiceImpl fireExpertsServiceImpl; @Autowired
@Autowired FireChemicalServiceImpl fireChemicalServiceImpl;
WaterResourceServiceImpl waterResourceServiceImpl; @Autowired
@Autowired FireExpertsServiceImpl fireExpertsServiceImpl;
AircraftServiceImpl aircraftServiceImpl; @Autowired
@Autowired WaterResourceServiceImpl waterResourceServiceImpl;
FireTeamServiceImpl fireTeamService; @Autowired
@Autowired AircraftServiceImpl aircraftServiceImpl;
FireStationServiceImpl fireStationService; @Autowired
@Autowired FireTeamServiceImpl fireTeamService;
FirefightersServiceImpl firefightersService; @Autowired
@Autowired FireStationServiceImpl fireStationService;
IMaintenanceCompanyService maintenanceCompanyService; @Autowired
@Autowired FirefightersServiceImpl firefightersService;
IKeySiteService keySiteService; @Autowired
@Autowired IMaintenanceCompanyService maintenanceCompanyService;
DutyCarServiceImpl dutyCarService; @Autowired
@Autowired IKeySiteService keySiteService;
DutyPersonServiceImpl dutyPersonService; @Autowired
@Autowired DutyCarServiceImpl dutyCarService;
Sequence sequence; @Autowired
@Autowired DutyPersonServiceImpl dutyPersonService;
DynamicFormColumnServiceImpl dynamicFormColumnService; @Autowired
@Autowired Sequence sequence;
DutyPersonShiftServiceImpl dutyPersonShiftService; @Autowired
@Autowired DynamicFormColumnServiceImpl dynamicFormColumnService;
OrgUsrServiceImpl orgUsrService; @Autowired
@Autowired DutyPersonShiftServiceImpl dutyPersonShiftService;
DutyShiftServiceImpl dutyShiftService; @Autowired
@Autowired OrgUsrServiceImpl orgUsrService;
IDutyPersonService iDutyPersonService; @Autowired
@Autowired DutyShiftServiceImpl dutyShiftService;
DynamicFormColumnServiceImpl dynamicFormColumnServiceImpl; @Autowired
@Autowired IDutyPersonService iDutyPersonService;
LinkageUnitServiceImpl linkageUnitServiceImpl; @Autowired
@Autowired DynamicFormColumnServiceImpl dynamicFormColumnServiceImpl;
SpecialPositionStaffServiceImpl specialPositionStaffServiceImpl; @Autowired
@Autowired LinkageUnitServiceImpl linkageUnitServiceImpl;
RescueEquipmentServiceImpl rescueEquipmentServiceImpl; @Autowired
SpecialPositionStaffServiceImpl specialPositionStaffServiceImpl;
public void templateExport(HttpServletResponse response, ExcelDto excelDto) throws ClassNotFoundException { @Autowired
String url = excelDto.getClassUrl(); RescueEquipmentServiceImpl rescueEquipmentServiceImpl;
Class<?> clz = Class.forName(url);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null, clz, public void templateExport(HttpServletResponse response, ExcelDto excelDto) throws ClassNotFoundException {
dataSourcesImpl, true); String url = excelDto.getClassUrl();
} Class<?> clz = Class.forName(url);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null, clz, dataSourcesImpl,
public void commonExport(HttpServletResponse response, ExcelDto excelDto) { true);
switch (excelDto.getType()) { }
case "WHP": public void commonExport(HttpServletResponse response, ExcelDto excelDto) {
List<FireChemicalDto> data = fireChemicalServiceImpl.queryForFireChemicalList(false); switch (excelDto.getType()) {
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
FireChemicalDto.class, dataSourcesImpl, false); case "WHP":
break; List<FireChemicalDto> data = fireChemicalServiceImpl.queryForFireChemicalList(false);
case "XFZJ": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false); FireChemicalDto.class, dataSourcesImpl, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
fireExpertsDtoList, FireExpertsDto.class, dataSourcesImpl, false); case "XFZJ":
break; List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
case "SYXX": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireExpertsDtoList,
List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true); FireExpertsDto.class, dataSourcesImpl, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
waterResourceDtoList, WaterResourceDto.class, dataSourcesImpl, false); case "SYXX":
break; List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true);
case "HKQ": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), waterResourceDtoList,
List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false); WaterResourceDto.class, dataSourcesImpl, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
aircraftDtoList, AircraftDto.class, dataSourcesImpl, false); case "HKQ":
break; List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false);
case "XFDW": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), aircraftDtoList,
List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false); AircraftDto.class, dataSourcesImpl, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList, break;
FireTeamDto.class, dataSourcesImpl, false); case "XFDW":
break; List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false);
case "WXXFZ": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList,
List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false); FireTeamDto.class, dataSourcesImpl, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
fireStationDtoList, FireStationDto.class, null, false); case "WXXFZ":
break; List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false);
case "XFRY": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireStationDtoList,
List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false); FireStationDto.class, null, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
firefightersExcelDtoList, FirefightersExcelDto.class, null, false); case "XFRY":
break; List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false);
case "WBRY": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = firefightersExcelDtoList, FirefightersExcelDto.class, null, false);
maintenanceCompanyService.exportToMaintenancePersonExcel(); break;
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), case "WBRY":
maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false); List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = maintenanceCompanyService
break; .exportToMaintenancePersonExcel();
case "KEYSITE": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel(); maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
keySiteDtoList, KeySiteExcleDto.class, null, false); case "KEYSITE":
break; List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel();
case "JCDWRY": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), keySiteDtoList,
List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportToExcel(); KeySiteExcleDto.class, null, false);
break;
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), case "JCDWRY":
orgUsrList, OrgUsrExcelDto.class, null, false); List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportToExcel();
break;
case "LDDW": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), orgUsrList,
List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel(); OrgUsrExcelDto.class, null, false);
break;
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), case "LDDW":
LinkageUnitDtoList, LinkageUnitDto.class, null, false); List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel();
break;
default: ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), LinkageUnitDtoList,
break; LinkageUnitDto.class, null, false);
} break;
} default:
break;
public void commonUpload(MultipartFile multipartFile, ExcelDto excelDto) throws Exception { }
switch (excelDto.getType()) { }
case "WHP": public void commonUpload(MultipartFile multipartFile, ExcelDto excelDto) throws Exception {
excelImportFireChemical(multipartFile); switch (excelDto.getType()) {
break;
case "XFZJ": case "WHP":
excelImportFireExperts(multipartFile); excelImportFireChemical(multipartFile);
break; break;
case "SYXX": case "XFZJ":
excelImportWaterResource(multipartFile); excelImportFireExperts(multipartFile);
break; break;
case "HKQ": case "SYXX":
excelImportAircraft(multipartFile); excelImportWaterResource(multipartFile);
break; break;
case "XFDW": case "HKQ":
excelImportFireTeam(multipartFile); excelImportAircraft(multipartFile);
break; break;
case "WXXFZ": case "XFDW":
excelImportFireStation(multipartFile); excelImportFireTeam(multipartFile);
break; break;
case "XFRY": case "WXXFZ":
excelImportFirefighters(multipartFile); excelImportFireStation(multipartFile);
break; break;
case "CLZQ": case "XFRY":
excelImportDutyPerson(multipartFile, "CLZQ"); excelImportFirefighters(multipartFile);
break; break;
case "RYZB": case "CLZQ":
excelImportDutyPerson(multipartFile, "RYZB"); excelImportDutyPerson(multipartFile, "CLZQ");
break; break;
case "WBRY": case "RYZB":
excelImportMaintenancePerson(multipartFile); excelImportDutyPerson(multipartFile, "RYZB");
break; break;
case "KEYSITE": case "WBRY":
excelImportKeySite(multipartFile); excelImportMaintenancePerson(multipartFile);
break; break;
case "JCDWRY": case "KEYSITE":
excelImportOrgUsrExcelDto(multipartFile); excelImportKeySite(multipartFile);
break; break;
case "LDDW": case "JCDWRY":
excelImportLinkageUnitZhDto(multipartFile); excelImportOrgUsrExcelDto(multipartFile);
break; break;
// BUG 2455 相关代码 bykongfm case "LDDW":
case "TGRY": excelImportLinkageUnitZhDto(multipartFile);
excelImportLinkageUnitTGRYDto(multipartFile); break;
break; // BUG 2455 相关代码 bykongfm
case "JYZB": case "TGRY":
excelImportLinkageUnitJYZBDto(multipartFile); excelImportLinkageUnitTGRYDto(multipartFile);
break; break;
} case "JYZB":
return; excelImportLinkageUnitJYZBDto(multipartFile);
} break;
}
private void excelImportLinkageUnitTGRYDto(MultipartFile multipartFile) throws Exception { return;
List<SpecialPositionStaffDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, }
SpecialPositionStaffDto.class, 1);
private void excelImportLinkageUnitTGRYDto(MultipartFile multipartFile) throws Exception {
if(excelDtoList!=null&&excelDtoList.size()>0){
outer : for(SpecialPositionStaffDto positionStaffDto : excelDtoList) { List<SpecialPositionStaffDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
String code = ""; SpecialPositionStaffDto.class, 1);
if(positionStaffDto.getPositionName()!=null){
String[] certificates = positionStaffDto.getPositionName().split("@"); if (excelDtoList != null && excelDtoList.size() > 0) {
positionStaffDto.setPositionName(certificates[0]); outer: for (SpecialPositionStaffDto positionStaffDto : excelDtoList) {
positionStaffDto.setPositionNameCode(certificates[1]); String code = "";
code = certificates[1]; if (positionStaffDto.getPositionName() != null) {
} else { String[] certificates = positionStaffDto.getPositionName().split("@");
continue; positionStaffDto.setPositionName(certificates[0]);
} positionStaffDto.setPositionNameCode(certificates[1]);
if(positionStaffDto.getCompany()!=null){ code = certificates[1];
String[] certificates = positionStaffDto.getCompany().split("@"); } else {
positionStaffDto.setCompany(certificates[0]); continue;
positionStaffDto.setCompanyId(Long.parseLong(certificates[1])); }
// 获取特岗人员已经存在的岗位 如果存在则不导入 if (positionStaffDto.getCompany() != null) {
LambdaQueryWrapper<SpecialPositionStaff> queryWrapper = new LambdaQueryWrapper<>(); String[] certificates = positionStaffDto.getCompany().split("@");
queryWrapper.eq(SpecialPositionStaff::getCompanyId,Long.parseLong(certificates[1])).eq(SpecialPositionStaff::getIsDelete,false); positionStaffDto.setCompany(certificates[0]);
List<SpecialPositionStaff> tempList = specialPositionStaffServiceImpl.list(queryWrapper); positionStaffDto.setCompanyId(Long.parseLong(certificates[1]));
for(SpecialPositionStaff temp : tempList) { // 获取特岗人员已经存在的岗位 如果存在则不导入
if(temp.getPositionNameCode().equals(code)) { LambdaQueryWrapper<SpecialPositionStaff> queryWrapper = new LambdaQueryWrapper<>();
continue outer; // 已经存在则不导入继续循环 queryWrapper.eq(SpecialPositionStaff::getCompanyId, Long.parseLong(certificates[1]))
} .eq(SpecialPositionStaff::getIsDelete, false);
} List<SpecialPositionStaff> tempList = specialPositionStaffServiceImpl.list(queryWrapper);
} else { for (SpecialPositionStaff temp : tempList) {
continue; if (temp.getPositionNameCode().equals(code)) {
} continue outer; // 已经存在则不导入继续循环
specialPositionStaffServiceImpl.createWithModel(positionStaffDto); }
} }
} } else {
} continue;
}
private void excelImportLinkageUnitJYZBDto(MultipartFile multipartFile) throws Exception { specialPositionStaffServiceImpl.createWithModel(positionStaffDto);
List<RescueEquipmentDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, }
RescueEquipmentDto.class, 1); }
if(excelDtoList!=null&&excelDtoList.size()>0){ }
outer : for(RescueEquipmentDto rescueEquipmentDto : excelDtoList ) {
String code = ""; private void excelImportLinkageUnitJYZBDto(MultipartFile multipartFile) throws Exception {
if(rescueEquipmentDto.getVehicleType()!=null){ List<RescueEquipmentDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, RescueEquipmentDto.class,
String[] certificates = rescueEquipmentDto.getVehicleType().split("@"); 1);
rescueEquipmentDto.setVehicleType(certificates[0]); if (excelDtoList != null && excelDtoList.size() > 0) {
rescueEquipmentDto.setVehicleTypeCode(certificates[1]); outer: for (RescueEquipmentDto rescueEquipmentDto : excelDtoList) {
code = certificates[1]; String code = "";
} else { if (rescueEquipmentDto.getVehicleType() != null) {
continue; String[] certificates = rescueEquipmentDto.getVehicleType().split("@");
} rescueEquipmentDto.setVehicleType(certificates[0]);
if(rescueEquipmentDto.getCompany()!=null){ rescueEquipmentDto.setVehicleTypeCode(certificates[1]);
String[] certificates = rescueEquipmentDto.getCompany().split("@"); code = certificates[1];
rescueEquipmentDto.setCompany(certificates[0]); } else {
rescueEquipmentDto.setCompanyId(Long.parseLong(certificates[1])); continue;
// 获取救援装备已经存在的装备 如果存在则不导入 }
LambdaQueryWrapper<RescueEquipment> queryWrapper = new LambdaQueryWrapper<>(); if (rescueEquipmentDto.getCompany() != null) {
queryWrapper.eq(RescueEquipment::getCompanyId,Long.parseLong(certificates[1])).eq(RescueEquipment::getIsDelete,false); String[] certificates = rescueEquipmentDto.getCompany().split("@");
List<RescueEquipment> tempList = rescueEquipmentServiceImpl.list(queryWrapper); rescueEquipmentDto.setCompany(certificates[0]);
for(RescueEquipment temp : tempList) { rescueEquipmentDto.setCompanyId(Long.parseLong(certificates[1]));
if(temp.getVehicleTypeCode().equals(code)) { // 获取救援装备已经存在的装备 如果存在则不导入
continue outer; // 已经存在则不导入继续循环 LambdaQueryWrapper<RescueEquipment> queryWrapper = new LambdaQueryWrapper<>();
} queryWrapper.eq(RescueEquipment::getCompanyId, Long.parseLong(certificates[1]))
} .eq(RescueEquipment::getIsDelete, false);
} else { List<RescueEquipment> tempList = rescueEquipmentServiceImpl.list(queryWrapper);
continue ; for (RescueEquipment temp : tempList) {
} if (temp.getVehicleTypeCode().equals(code)) {
continue outer; // 已经存在则不导入继续循环
rescueEquipmentServiceImpl.createWithModel(rescueEquipmentDto); }
} }
} else {
} continue;
} }
rescueEquipmentServiceImpl.createWithModel(rescueEquipmentDto);
}
private void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception {
List<LinkageUnitDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, }
LinkageUnitDto.class, 1); }
if(excelDtoList!=null&&excelDtoList.size()>0){ private void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception {
excelDtoList.forEach(linkageUnitDto->{ List<LinkageUnitDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, LinkageUnitDto.class, 1);
if(linkageUnitDto.getLinkageUnitType()!=null){
String[] certificates = linkageUnitDto.getLinkageUnitType().split("@"); if (excelDtoList != null && excelDtoList.size() > 0) {
linkageUnitDto.setLinkageUnitType(certificates[0]); excelDtoList.forEach(linkageUnitDto -> {
linkageUnitDto.setLinkageUnitTypeCode(certificates[1]); if (linkageUnitDto.getLinkageUnitType() != null) {
} String[] certificates = linkageUnitDto.getLinkageUnitType().split("@");
if(linkageUnitDto.getEmergencyLinkageUnit()!=null){ linkageUnitDto.setLinkageUnitType(certificates[0]);
String[] certificates = linkageUnitDto.getEmergencyLinkageUnit().split("@"); linkageUnitDto.setLinkageUnitTypeCode(certificates[1]);
linkageUnitDto.setEmergencyLinkageUnit(certificates[0]); }
linkageUnitDto.setEmergencyLinkageUnitCode(certificates[1]); if (linkageUnitDto.getEmergencyLinkageUnit() != null) {
} String[] certificates = linkageUnitDto.getEmergencyLinkageUnit().split("@");
linkageUnitDto.setEmergencyLinkageUnit(certificates[0]);
linkageUnitServiceImpl.saveLinkageModel(linkageUnitDto); linkageUnitDto.setEmergencyLinkageUnitCode(certificates[1]);
}); }
}
linkageUnitServiceImpl.saveLinkageModel(linkageUnitDto);
});
}
} }
private void excelImportOrgUsrExcelDto(MultipartFile multipartFile) throws Exception { private void excelImportOrgUsrExcelDto(MultipartFile multipartFile) throws Exception {
List<OrgUsrExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<OrgUsrExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, OrgUsrExcelDto.class, 1);
OrgUsrExcelDto.class, 1);
if (excelDtoList != null && excelDtoList.size() > 0) {
if(excelDtoList!=null&&excelDtoList.size()>0){ excelDtoList.forEach(orgUsrExcelDto -> {
excelDtoList.forEach(orgUsrExcelDto->{ if (orgUsrExcelDto.getParentId() != null) {
if(orgUsrExcelDto.getParentId()!=null){ String[] certificates = orgUsrExcelDto.getParentId().split("@");
String[] certificates = orgUsrExcelDto.getParentId().split("@"); orgUsrExcelDto.setParentId(certificates[1]);
orgUsrExcelDto.setParentId(certificates[1]); }
} // 动态字段填充
// 动态字段填充
List<DynamicFormInitDto> dynamicFormColumn = dynamicFormColumnServiceImpl.getFormlist("246");
List<DynamicFormInitDto> dynamicFormColumn = dynamicFormColumnServiceImpl.getFormlist("246");
List<DynamicFormInstanceDto> dynamicFormValue = new ArrayList<>();
List<DynamicFormInstanceDto> dynamicFormValue =new ArrayList<>(); List<DynamicFormInstance> dynamicFormInstancelist = new ArrayList<>();
List<DynamicFormInstance> dynamicFormInstancelist =new ArrayList<>();
dynamicFormColumn.forEach(DynamicFormInitDto -> {
dynamicFormColumn.forEach(DynamicFormInitDto->{ dynamicFormValue.add(DynamicFormInitDto.getFormItemDescr());
dynamicFormValue.add(DynamicFormInitDto.getFormItemDescr()); });
});
dynamicFormValue.forEach(dynamicFormInstanceDto -> {
dynamicFormValue.forEach(dynamicFormInstanceDto->{ switch (dynamicFormInstanceDto.getFieldCode()) {
switch (dynamicFormInstanceDto.getFieldCode()) {
case "administrativePositionCode":
case "administrativePositionCode": if (orgUsrExcelDto.getAdministrativePositionCode() != null) {
if(orgUsrExcelDto.getAdministrativePositionCode()!=null){ String[] certificates = orgUsrExcelDto.getAdministrativePositionCode().split("@");
String[] certificates = orgUsrExcelDto.getAdministrativePositionCode().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "auditCycle":
case "auditCycle": if (orgUsrExcelDto.getAuditCycle() != null) {
if(orgUsrExcelDto.getAuditCycle()!=null){ String[] certificates = orgUsrExcelDto.getAuditCycle().split("@");
String[] certificates = orgUsrExcelDto.getAuditCycle().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "certificatesNumber":
case "certificatesNumber": dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getCertificatesNumber());
dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getCertificatesNumber()); break;
break; case "certificatesTypeCode":
case "certificatesTypeCode": if (orgUsrExcelDto.getCertificatesTypeCode() != null) {
if(orgUsrExcelDto.getCertificatesTypeCode()!=null){ String[] certificates = orgUsrExcelDto.getCertificatesTypeCode().split("@");
String[] certificates = orgUsrExcelDto.getCertificatesTypeCode().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "certificateType":
case "certificateType": if (orgUsrExcelDto.getCertificateType() != null) {
if(orgUsrExcelDto.getCertificateType()!=null){ String[] certificates = orgUsrExcelDto.getCertificateType().split("@");
String[] certificates = orgUsrExcelDto.getCertificateType().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} case "fireManagementPostCode":
case "fireManagementPostCode": if (orgUsrExcelDto.getFireManagementPostCode() != null) {
if(orgUsrExcelDto.getFireManagementPostCode()!=null){ String[] certificates = orgUsrExcelDto.getFireManagementPostCode().split("@");
String[] certificates = orgUsrExcelDto.getFireManagementPostCode().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "gender":
case "gender": dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getGender());
dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getGender()); break;
break; case "internalPositionCode":
case "internalPositionCode": if (orgUsrExcelDto.getInternalPositionCode() != null) {
if(orgUsrExcelDto.getInternalPositionCode()!=null){ String[] certificates = orgUsrExcelDto.getInternalPositionCode().split("@");
String[] certificates = orgUsrExcelDto.getInternalPositionCode().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "personNumber":
case "personNumber": dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getPersonNumber());
dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getPersonNumber()); break;
break; case "positionType":
case "positionType": if (orgUsrExcelDto.getPositionType() != null) {
if(orgUsrExcelDto.getPositionType()!=null){ String[] certificates = orgUsrExcelDto.getPositionType().split("@");
String[] certificates = orgUsrExcelDto.getPositionType().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "safetyTraining":
case "safetyTraining": if (orgUsrExcelDto.getSafetyTraining() != null) {
if(orgUsrExcelDto.getSafetyTraining()!=null){ String[] certificates = orgUsrExcelDto.getSafetyTraining().split("@");
String[] certificates = orgUsrExcelDto.getSafetyTraining().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "stateCode":
case "stateCode": if (orgUsrExcelDto.getStateCode() != null) {
if(orgUsrExcelDto.getStateCode()!=null){ String[] certificates = orgUsrExcelDto.getStateCode().split("@");
String[] certificates = orgUsrExcelDto.getStateCode().split("@"); dynamicFormInstanceDto.setFieldValue(certificates[1]);
dynamicFormInstanceDto.setFieldValue(certificates[1]); dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
dynamicFormInstanceDto.setFieldValueLabel(certificates[0]);
}
} break;
break; case "telephone":
case "telephone": dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getTelephone());
dynamicFormInstanceDto.setFieldValue(orgUsrExcelDto.getTelephone()); break;
break;
}
}
DynamicFormInstance dynamicFormInstance = new DynamicFormInstance();
DynamicFormInstance dynamicFormInstance=new DynamicFormInstance(); BeanUtils.copyProperties(dynamicFormInstanceDto, dynamicFormInstance);
BeanUtils.copyProperties(dynamicFormInstanceDto, dynamicFormInstance); dynamicFormInstancelist.add(dynamicFormInstance);
dynamicFormInstancelist.add(dynamicFormInstance);
});
});
orgUsrExcelDto.setDynamicFormValue(dynamicFormInstancelist);
orgUsrExcelDto.setDynamicFormValue(dynamicFormInstancelist);
try {
orgUsrService.saveOrgPersonExcel(orgUsrExcelDto);
try { } catch (Exception e) {
orgUsrService.saveOrgPersonExcel(orgUsrExcelDto); throw new RuntimeException("导入失败!");
} catch (Exception e) { }
throw new RuntimeException("导入失败!"); });
} }
});
} }
private void excelImportFirefighters(MultipartFile multipartFile) throws Exception {
List<FirefightersExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
} FirefightersExcelDto.class, 1);
excelDtoList.forEach(item -> {
Firefighters firefighters = new Firefighters();
FirefightersContacts firefightersContacts = new FirefightersContacts();
firefighters = Bean.toPo(item, firefighters);
firefighters = Bean.toPo(getCurrentInfo(), firefighters);
firefightersContacts = Bean.toPo(item, firefightersContacts);
if (item.getFireTeam() != null) {
Long fireTeamId = Long.valueOf(item.getFireTeam().split("@")[1]);
firefighters.setFireTeamId(fireTeamId);
private void excelImportFirefighters(MultipartFile multipartFile) throws Exception { }
List<FirefightersExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, if (firefighters.getCertificatesType() != null) {
FirefightersExcelDto.class, 1); String[] certificates = firefighters.getCertificatesType().split("@");
excelDtoList.forEach( firefighters.setCertificatesType(certificates[0]);
item -> { firefighters.setCertificatesTypeCode(certificates[1]);
Firefighters firefighters = new Firefighters(); }
FirefightersContacts firefightersContacts = new FirefightersContacts(); if (firefighters.getState() != null) {
firefighters = Bean.toPo(item, firefighters); String[] state = firefighters.getState().split("@");
firefightersContacts = Bean.toPo(item, firefightersContacts); firefighters.setState(state[0]);
if (item.getFireTeam() != null) { firefighters.setStateCode(state[1]);
Long fireTeamId = Long.valueOf(item.getFireTeam().split("@")[1]); }
firefighters.setFireTeamId(fireTeamId); if (firefighters.getJobTitle() != null) {
} String[] jobTitle = firefighters.getJobTitle().split("@");
if (firefighters.getCertificatesType() != null) { firefighters.setJobTitle(jobTitle[0]);
String[] certificates = firefighters.getCertificatesType().split("@"); firefighters.setJobTitleCode(jobTitle[1]);
firefighters.setCertificatesType(certificates[0]); }
firefighters.setCertificatesTypeCode(certificates[1]); if (firefightersContacts.getRelationship() != null) {
} String relationship = firefightersContacts.getRelationship().split("@")[1];
if (firefighters.getState() != null) { firefightersContacts.setRelationship(relationship);
String[] state = firefighters.getState().split("@"); }
firefighters.setState(state[0]); if (firefighters.getCompanyName() != null) {
firefighters.setStateCode(state[1]); String[] tempCompany = firefighters.getCompanyName().split("@");
} firefighters.setCompanyName(tempCompany[0]);
if (firefighters.getJobTitle() != null) { firefighters.setCompany(tempCompany[1]);
String[] jobTitle = firefighters.getJobTitle().split("@"); }
firefighters.setJobTitle(jobTitle[0]); if (firefighters.getNativePlaceValue() != null) {
firefighters.setJobTitleCode(jobTitle[1]); String[] tempCity = firefighters.getNativePlaceValue().split("@");
} firefighters.setNativePlaceValue(tempCity[0]);
if (firefightersContacts.getRelationship() != null) { firefighters.setNativePlace(tempCity[1]);
String relationship = firefightersContacts.getRelationship().split("@")[1]; }
firefightersContacts.setRelationship(relationship); if (firefighters.getResidence() != null) {
} String[] tempCity = firefighters.getResidence().split("@");
if(firefighters.getCompanyName() != null) { firefighters.setResidence(tempCity[0]);
String[] tempCompany = firefighters.getCompanyName().split("@"); firefighters.setResidenceDetails(tempCity[1]);
firefighters.setCompanyName(tempCompany[0]); }
firefighters.setCompany(tempCompany[1]); // BUG 2760 修改消防人员导出模板和 导入问题 bykongfm
} FirefightersInfoDto firefightersInfo = new FirefightersInfoDto(firefighters, firefightersContacts);
if(firefighters.getNativePlaceValue() != null) { firefightersService.saveFirefighters(firefightersInfo);
String[] tempCity = firefighters.getNativePlaceValue().split("@"); });
firefighters.setNativePlaceValue(tempCity[0]); }
firefighters.setNativePlace(tempCity[1]);
} private void excelImportFireStation(MultipartFile multipartFile) throws Exception {
if(firefighters.getResidence() != null) { List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1);
String[] tempCity = firefighters.getResidence().split("@"); List<FireStation> excelEntityList = new ArrayList<>();
firefighters.setResidence(tempCity[0]); excelDtoList.forEach(item -> {
firefighters.setResidenceDetails(tempCity[1]); FireStation fireStation = new FireStation();
} fireStation = Bean.toPo(item, fireStation);
// BUG 2760 修改消防人员导出模板和 导入问题 bykongfm fireStation = Bean.toPo(getCurrentInfo(), fireStation);
FirefightersInfoDto firefightersInfo = new FirefightersInfoDto(firefighters, firefightersContacts); if (fireStation.getWhereBuilding() != null) {
firefightersService.saveFirefighters(firefightersInfo); String[] whereBuilding = fireStation.getWhereBuilding().split("@");
} fireStation.setWhereBuilding(whereBuilding[0]);
); fireStation.setWhereBuildingId(whereBuilding[1]);
} }
if (fireStation.getBizCompany() != null) {
private void excelImportFireStation(MultipartFile multipartFile) throws Exception { String[] bizCompany = fireStation.getBizCompany().split("@");
List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1); fireStation.setBizCompany(bizCompany[0]);
List<FireStation> excelEntityList = new ArrayList<>(); fireStation.setBizCompanyId(Long.valueOf(bizCompany[1]));
excelDtoList.forEach( fireStation.setBizCompanyCode(bizCompany[2]);
item -> { }
FireStation fireStation = new FireStation(); excelEntityList.add(fireStation);
fireStation = Bean.toPo(item, fireStation); });
if (fireStation.getWhereBuilding() != null) { fireStationService.saveBatch(excelEntityList);
String[] whereBuilding = fireStation.getWhereBuilding().split("@"); }
fireStation.setWhereBuilding(whereBuilding[0]);
fireStation.setWhereBuildingId(whereBuilding[1]); private void excelImportFireTeam(MultipartFile multipartFile) throws Exception {
} List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1);
if (fireStation.getBizCompany() != null) { List<FireTeam> excelEntityList = new ArrayList<>();
String[] bizCompany = fireStation.getBizCompany().split("@"); excelDtoList.forEach(item -> {
fireStation.setBizCompany(bizCompany[0]); FireTeam fireTeam = new FireTeam();
fireStation.setBizCompanyId(Long.valueOf(bizCompany[1])); fireTeam = Bean.toPo(item, fireTeam);
fireStation.setBizCompanyCode(bizCompany[2]); fireTeam = Bean.toPo(getCurrentInfo(), fireTeam);
} if (fireTeam.getType() != null) {
excelEntityList.add(fireStation); String[] type = fireTeam.getType().split("@");
} fireTeam.setType(type[0]);
); fireTeam.setTypeCode(type[1]);
fireStationService.saveBatch(excelEntityList); }
} if (fireTeam.getContactUser() != null) {
String[] contactUser = fireTeam.getContactUser().split("@");
private void excelImportFireTeam(MultipartFile multipartFile) throws Exception { fireTeam.setContactUser(contactUser[0]);
List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1); fireTeam.setContactUserId(Long.valueOf(contactUser[1]));
List<FireTeam> excelEntityList = new ArrayList<>(); }
excelDtoList.forEach( if (item.getParentName() != null) {
item -> { String[] parentName = item.getParentName().split("@");
FireTeam fireTeam = new FireTeam(); fireTeam.setParent(Long.valueOf(parentName[1]));
fireTeam = Bean.toPo(item, fireTeam); }
if (fireTeam.getType() != null) { excelEntityList.add(fireTeam);
String[] type = fireTeam.getType().split("@"); });
fireTeam.setType(type[0]); fireTeamService.saveBatch(excelEntityList);
fireTeam.setTypeCode(type[1]); }
}
if (fireTeam.getContactUser() != null) { private void excelImportAircraft(MultipartFile multipartFile) throws Exception {
String[] contactUser = fireTeam.getContactUser().split("@"); List<AircraftDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, 1);
fireTeam.setContactUser(contactUser[0]); List<Aircraft> excelEntityList = new ArrayList<>();
fireTeam.setContactUserId(Long.valueOf(contactUser[1])); excelDtoList.forEach(item -> {
} Aircraft aircraft = new Aircraft();
if (item.getParentName() != null) { aircraft = Bean.toPo(item, aircraft);
String[] parentName = item.getParentName().split("@"); aircraft = Bean.toPo(getCurrentInfo(), aircraft);
fireTeam.setParent(Long.valueOf(parentName[1])); if (aircraft.getEngineType() != null) {
} String[] engineType = aircraft.getEngineType().split("@");
excelEntityList.add(fireTeam); aircraft.setEngineType(engineType[0]);
} aircraft.setEngineTypeCode(engineType[1]);
); }
fireTeamService.saveBatch(excelEntityList); if (aircraft.getFuelType() != null) {
} String[] fuelType = aircraft.getFuelType().split("@");
aircraft.setFuelType(fuelType[0]);
private void excelImportAircraft(MultipartFile multipartFile) throws Exception { aircraft.setFuelTypeCode(fuelType[1]);
List<AircraftDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, 1); }
List<Aircraft> excelEntityList = new ArrayList<>(); excelEntityList.add(aircraft);
excelDtoList.forEach( });
item -> { aircraftServiceImpl.saveBatch(excelEntityList);
Aircraft aircraft = new Aircraft(); }
aircraft = Bean.toPo(item, aircraft);
if (aircraft.getEngineType() != null) { private void excelImportFireChemical(MultipartFile multipartFile) throws Exception {
String[] engineType = aircraft.getEngineType().split("@"); List<FireChemicalDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireChemicalDto.class, 1);
aircraft.setEngineType(engineType[0]); List<FireChemical> excelEntityList = new ArrayList<>();
aircraft.setEngineTypeCode(engineType[1]); excelDtoList.forEach(item -> {
} FireChemical fireChemical = new FireChemical();
if (aircraft.getFuelType() != null) { fireChemical = Bean.toPo(item, fireChemical);
String[] fuelType = aircraft.getFuelType().split("@"); fireChemical = Bean.toPo(getCurrentInfo(), fireChemical);
aircraft.setFuelType(fuelType[0]); if (fireChemical.getType() != null) {
aircraft.setFuelTypeCode(fuelType[1]); String[] type = fireChemical.getType().split("@");
} fireChemical.setType(type[0]);
excelEntityList.add(aircraft); fireChemical.setTypeCode(type[1]);
} }
); excelEntityList.add(fireChemical);
aircraftServiceImpl.saveBatch(excelEntityList); });
} fireChemicalServiceImpl.saveBatch(excelEntityList);
}
private void excelImportFireChemical(MultipartFile multipartFile) throws Exception {
List<FireChemicalDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireChemicalDto.class, 1); private void excelImportWaterResource(MultipartFile multipartFile) throws Exception {
List<FireChemical> excelEntityList = new ArrayList<>(); List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, WaterResourceDto.class, 1);
excelDtoList.forEach( excelDtoList.forEach(item -> {
item -> { if (item.getResourceTypeName() != null) {
FireChemical fireChemical = new FireChemical(); String[] resourceTypeName = item.getResourceTypeName().split("@");
fireChemical = Bean.toPo(item, fireChemical); item.setResourceTypeName(resourceTypeName[0]);
if (fireChemical.getType() != null) { item.setResourceType(resourceTypeName[1]);
String[] type = fireChemical.getType().split("@"); }
fireChemical.setType(type[0]); if (item.getSystemType() != null) {
fireChemical.setTypeCode(type[1]); String[] systemType = item.getSystemType().split("@");
} item.setSystemType(systemType[0]);
excelEntityList.add(fireChemical); item.setSystemTypeCode(systemType[1]);
} }
); if (item.getPlaceForm() != null) {
fireChemicalServiceImpl.saveBatch(excelEntityList); String[] placeForm = item.getPlaceForm().split("@");
} item.setPlaceForm(placeForm[0]);
item.setPlaceFormCode(placeForm[1]);
private void excelImportWaterResource(MultipartFile multipartFile) throws Exception { }
List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, if (item.getBelongBuilding() != null) {
WaterResourceDto.class, 1); String[] belongBuilding = item.getBelongBuilding().split("@");
excelDtoList.forEach( item.setBelongBuilding(belongBuilding[0]);
item -> { item.setBelongBuildingId(Long.valueOf(belongBuilding[1]));
if (item.getResourceTypeName() != null) { }
String[] resourceTypeName = item.getResourceTypeName().split("@"); if (item.getBelongFightingSystem() != null) {
item.setResourceTypeName(resourceTypeName[0]); String[] belongFightingSystem = item.getBelongFightingSystem().split("@");
item.setResourceType(resourceTypeName[1]); item.setBelongFightingSystem(belongFightingSystem[0]);
} item.setBelongFightingSystemId(Long.valueOf(belongFightingSystem[1]));
if (item.getSystemType() != null) { }
String[] systemType = item.getSystemType().split("@"); if (item.getManagementUnit() != null) {
item.setSystemType(systemType[0]); String[] managementUnit = item.getManagementUnit().split("@");
item.setSystemTypeCode(systemType[1]); item.setManagementUnit(managementUnit[0]);
} item.setManagementUnitId(Long.valueOf(managementUnit[1]));
if (item.getPlaceForm() != null) { }
String[] placeForm = item.getPlaceForm().split("@"); if (item.getMaintenanceUnit() != null) {
item.setPlaceForm(placeForm[0]); String[] maintenanceUnit = item.getMaintenanceUnit().split("@");
item.setPlaceFormCode(placeForm[1]); item.setMaintenanceUnit(maintenanceUnit[0]);
} item.setMaintenanceUnitId(Long.valueOf(maintenanceUnit[1]));
if (item.getBelongBuilding() != null) { }
String[] belongBuilding = item.getBelongBuilding().split("@"); if (item.getHoseConnection() != null) {
item.setBelongBuilding(belongBuilding[0]); String[] hoseConnection = item.getHoseConnection().split("@");
item.setBelongBuildingId(Long.valueOf(belongBuilding[1])); item.setHoseConnection(hoseConnection[0]);
} item.setHoseConnectionCode(hoseConnection[1]);
if (item.getBelongFightingSystem() != null) { }
String[] belongFightingSystem = item.getBelongFightingSystem().split("@"); if (item.getIntakeForm() != null) {
item.setBelongFightingSystem(belongFightingSystem[0]); String[] intakeForm = item.getIntakeForm().split("@");
item.setBelongFightingSystemId(Long.valueOf(belongFightingSystem[1])); item.setIntakeForm(intakeForm[0]);
} }
if (item.getManagementUnit() != null) { if (item.getPipeTypeName() != null) {
String[] managementUnit = item.getManagementUnit().split("@"); String[] pipeTypeName = item.getPipeTypeName().split("@");
item.setManagementUnit(managementUnit[0]); item.setPipeTypeName(pipeTypeName[0]);
item.setManagementUnitId(Long.valueOf(managementUnit[1])); item.setPipeTypeCode(pipeTypeName[1]);
} }
if (item.getMaintenanceUnit() != null) { if (item.getStatus() != null) {
String[] maintenanceUnit = item.getMaintenanceUnit().split("@"); String[] status = item.getStatus().split("@");
item.setMaintenanceUnit(maintenanceUnit[0]); item.setStatus(status[0]);
item.setMaintenanceUnitId(Long.valueOf(maintenanceUnit[1])); item.setStatusCode(status[1]);
} }
if (item.getHoseConnection() != null) { if (item.getType() != null) {
String[] hoseConnection = item.getHoseConnection().split("@"); String[] type = item.getType().split("@");
item.setHoseConnection(hoseConnection[0]); item.setType(type[0]);
item.setHoseConnectionCode(hoseConnection[1]); item.setTypeCode(type[1]);
} }
if (item.getIntakeForm() != null) { item = Bean.toPo(getCurrentInfo(), item);
String[] intakeForm = item.getIntakeForm().split("@"); waterResourceServiceImpl.importByExcel(item);
item.setIntakeForm(intakeForm[0]); });
} }
if (item.getPipeTypeName() != null) {
String[] pipeTypeName = item.getPipeTypeName().split("@"); private void excelImportFireExperts(MultipartFile multipartFile) throws Exception {
item.setPipeTypeName(pipeTypeName[0]); List<FireExpertsDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireExpertsDto.class, 1);
item.setPipeTypeCode(pipeTypeName[1]); List<FireExperts> excelEntityList = new ArrayList<>();
} excelDtoList.forEach(fireExpertsDto -> {
if (item.getStatus() != null) { FireExperts fireExperts = new FireExperts();
String[] status = item.getStatus().split("@"); fireExperts = Bean.toPo(fireExpertsDto, fireExperts);
item.setStatus(status[0]); if (fireExperts.getCertificatesType() != null) {
item.setStatusCode(status[1]); String[] certificates = fireExperts.getCertificatesType().split("@");
} fireExperts.setCertificatesType(certificates[0]);
if (item.getType() != null) { fireExperts.setCertificatesTypeCode(certificates[1]);
String[] type = item.getType().split("@"); }
item.setType(type[0]); if (fireExperts.getJobs() != null) {
item.setTypeCode(type[1]); String[] jobs = fireExperts.getJobs().split("@");
} fireExperts.setJobs(jobs[0]);
waterResourceServiceImpl.importByExcel(item); fireExperts.setJobsCode(jobs[1]);
} }
); if (fireExperts.getExpert() != null) {
} String[] expert = fireExperts.getExpert().split("@");
fireExperts.setExpert(expert[0]);
private void excelImportFireExperts(MultipartFile multipartFile) throws Exception { fireExperts.setExpertCode(expert[1]);
List<FireExpertsDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, }
FireExpertsDto.class, 1); if (fireExperts.getHighestEducation() != null) {
List<FireExperts> excelEntityList = new ArrayList<>(); String[] highestEducation = fireExperts.getHighestEducation().split("@");
excelDtoList.forEach( fireExperts.setHighestEducation(highestEducation[0]);
fireExpertsDto -> { }
FireExperts fireExperts = new FireExperts(); excelEntityList.add(fireExperts);
fireExperts = Bean.toPo(fireExpertsDto, fireExperts); });
if (fireExperts.getCertificatesType() != null) { fireExpertsServiceImpl.saveBatch(excelEntityList);
String[] certificates = fireExperts.getCertificatesType().split("@"); }
fireExperts.setCertificatesType(certificates[0]);
fireExperts.setCertificatesTypeCode(certificates[1]); private void excelImportDutyPerson(MultipartFile multipartFile, String dutyType) throws Exception {
}
if (fireExperts.getJobs() != null) { String fileName = multipartFile.getOriginalFilename();
String[] jobs = fireExperts.getJobs().split("@"); if (fileName == null) {
fireExperts.setJobs(jobs[0]); throw new Exception("文件不存在!");
fireExperts.setJobsCode(jobs[1]); }
} if (!fileName.toLowerCase().endsWith(ExcelTypeEnum.XLS.getValue())
if (fireExperts.getExpert() != null) { && !fileName.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())) {
String[] expert = fireExperts.getExpert().split("@"); throw new Exception("文件类型异常!");
fireExperts.setExpert(expert[0]); }
fireExperts.setExpertCode(expert[1]); InputStream input = multipartFile.getInputStream();
} XSSFWorkbook workbook = new XSSFWorkbook(input);
if (fireExperts.getHighestEducation() != null) { XSSFSheet sheet = workbook.getSheetAt(0);
String[] highestEducation = fireExperts.getHighestEducation().split("@"); List<Map<String, Object>> dataList = new ArrayList<>();
fireExperts.setHighestEducation(highestEducation[0]); if (sheet != null) {
} // 获取表头月份
excelEntityList.add(fireExperts); Row titleRow = sheet.getRow(0);
} Cell monthCell = titleRow.getCell(5);
); String dateStr = monthCell == null ? "" : monthCell.toString();
fireExpertsServiceImpl.saveBatch(excelEntityList);
} List<Date> dayByMonth = DateUtils.getDayByMonth(dateStr);
if (ExcelEnums.CLZQ.getType().equals(dutyType)) {
private void excelImportDutyPerson(MultipartFile multipartFile, String dutyType) throws Exception { initDutyCarData(sheet, dataList, dayByMonth);
dutyCarService.saveImportData(dataList);
String fileName = multipartFile.getOriginalFilename(); } else if (ExcelEnums.RYZB.getType().equals(dutyType)) {
if (fileName == null) { initDutyPersonData(sheet, dataList, dayByMonth);
throw new Exception("文件不存在!"); dutyPersonService.saveImportData(dataList);
} }
if (!fileName.toLowerCase().endsWith(ExcelTypeEnum.XLS.getValue()) && !fileName.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())) { }
throw new Exception("文件类型异常!"); }
}
InputStream input = multipartFile.getInputStream(); private void initDutyCarData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
XSSFWorkbook workbook = new XSSFWorkbook(input); // 遍历行,i = 1,从第二行开始,第一行是表头跳过。
XSSFSheet sheet = workbook.getSheetAt(0); for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
List<Map<String, Object>> dataList = new ArrayList<>(); DutyCarDto dutyCarDto = new DutyCarDto();
if (sheet != null) { // row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
//获取表头月份 Row row = sheet.getRow(i);
Row titleRow = sheet.getRow(0); if (row == null) {
Cell monthCell = titleRow.getCell(5); continue;
String dateStr = monthCell == null ? "" : monthCell.toString(); }
Cell cell = row.getCell(1);
List<Date> dayByMonth = DateUtils.getDayByMonth(dateStr); if (cell != null) {
if (ExcelEnums.CLZQ.getType().equals(dutyType)) { String[] split = cell.toString().split("@");
initDutyCarData(sheet, dataList, dayByMonth); dutyCarDto.setTeamName(split[0]);
dutyCarService.saveImportData(dataList); dutyCarDto.setTeamId(split[1]);
} else if (ExcelEnums.RYZB.getType().equals(dutyType)) { }
initDutyPersonData(sheet, dataList, dayByMonth); cell = row.getCell(2);
dutyPersonService.saveImportData(dataList); if (cell != null) {
} String[] userName = cell.toString().split("@");
} dutyCarDto.setUserName(userName[0]);
} dutyCarDto.setUserId(userName[1]);
private void initDutyCarData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) { cell = row.getCell(3);
//遍历行,i = 1,从第二行开始,第一行是表头跳过。 if (cell != null) {
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { String[] postType = cell.toString().split("@");
DutyCarDto dutyCarDto = new DutyCarDto(); dutyCarDto.setPostTypeName(postType[0]);
//row是一行数据,row.getCell(i),代表拿到这一行,第i列数据 dutyCarDto.setPostType(postType[1]);
Row row = sheet.getRow(i); }
if (row == null) { cell = row.getCell(4);
continue; if (cell != null) {
} String[] carName = cell.toString().split("@");
Cell cell = row.getCell(1); dutyCarDto.setCarName(carName[0]);
if (cell != null) { dutyCarDto.setCarId(carName[1]);
String[] split = cell.toString().split("@"); }
dutyCarDto.setTeamName(split[0]); List<DutyPersonShiftDto> dutyShift = dutyCarDto.getDutyShift();
dutyCarDto.setTeamId(split[1]); for (int j = 0; j < dayByMonth.size(); j++) {
} cell = row.getCell(5 + j);
cell = row.getCell(2); String dutyType = cell == null ? "" : cell.toString();
if (cell != null) { if (!StringUtils.isEmpty(dutyType)) {
String[] userName = cell.toString().split("@"); DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto();
dutyCarDto.setUserName(userName[0]); dutyPersonShiftDto.setDutyDate(dayByMonth.get(j));
dutyCarDto.setUserId(userName[1]); dutyPersonShiftDto.setShiftId(Long.valueOf(dutyType.split("@")[1]));
dutyShift.add(dutyPersonShiftDto);
cell = row.getCell(3); }
if (cell != null) { }
String[] postType = cell.toString().split("@"); Map<String, Object> dutyCarDtoMap = Bean.BeantoMap(dutyCarDto);
dutyCarDto.setPostTypeName(postType[0]); dataList.add(dutyCarDtoMap);
dutyCarDto.setPostType(postType[1]); }
} }
cell = row.getCell(4); }
if (cell != null) {
String[] carName = cell.toString().split("@"); private void initDutyPersonData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
dutyCarDto.setCarName(carName[0]); // 遍历行,i = 1,从第二行开始,第一行是表头跳过。
dutyCarDto.setCarId(carName[1]); for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
} DutyPersonDto dutyPersonDto = new DutyPersonDto();
List<DutyPersonShiftDto> dutyShift = dutyCarDto.getDutyShift(); // row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
for (int j = 0; j < dayByMonth.size(); j++) { Row row = sheet.getRow(i);
cell = row.getCell(5 + j); if (row == null) {
String dutyType = cell == null ? "" : cell.toString(); continue;
if (!StringUtils.isEmpty(dutyType)) { }
DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto(); Cell cell = row.getCell(1);
dutyPersonShiftDto.setDutyDate(dayByMonth.get(j)); if (cell != null) {
dutyPersonShiftDto.setShiftId(Long.valueOf(dutyType.split("@")[1])); dutyPersonDto.setUserId(cell.toString());
dutyShift.add(dutyPersonShiftDto); cell = row.getCell(2);
} if (cell != null) {
} dutyPersonDto.setUserName(cell.toString());
Map<String, Object> dutyCarDtoMap = Bean.BeantoMap(dutyCarDto); }
dataList.add(dutyCarDtoMap); cell = row.getCell(3);
} if (cell != null) {
} String[] split = cell.toString().split("@");
} dutyPersonDto.setDeptName(split[0]);
dutyPersonDto.setDeptId(split[1]);
private void initDutyPersonData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) { }
//遍历行,i = 1,从第二行开始,第一行是表头跳过。 cell = row.getCell(4);
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { if (cell != null) {
DutyPersonDto dutyPersonDto = new DutyPersonDto(); String[] split = cell.toString().split("@");
//row是一行数据,row.getCell(i),代表拿到这一行,第i列数据 dutyPersonDto.setPostTypeName(split[0]);
Row row = sheet.getRow(i); dutyPersonDto.setPostType(split[1]);
if (row == null) { }
continue; List<DutyPersonShiftDto> dutyShift = new ArrayList<>();
} for (int j = 0; j < dayByMonth.size(); j++) {
Cell cell = row.getCell(1); cell = row.getCell(5 + j);
if (cell != null) { String dutyType = cell == null ? "" : cell.toString();
dutyPersonDto.setUserId(cell.toString()); if (!StringUtils.isEmpty(dutyType)) {
cell = row.getCell(2); DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto();
if (cell != null) { dutyPersonShiftDto.setDutyDate(dayByMonth.get(j));
dutyPersonDto.setUserName(cell.toString()); dutyPersonShiftDto.setShiftId(Long.valueOf(dutyType.split("@")[1]));
} dutyShift.add(dutyPersonShiftDto);
cell = row.getCell(3); }
if (cell != null) { }
String[] split = cell.toString().split("@"); dutyPersonDto.setDutyShift(dutyShift);
dutyPersonDto.setDeptName(split[0]); Map<String, Object> dutyPersonDtoMap = Bean.BeantoMap(dutyPersonDto);
dutyPersonDto.setDeptId(split[1]); dataList.add(dutyPersonDtoMap);
} }
cell = row.getCell(4); }
if (cell != null) { }
String[] split = cell.toString().split("@");
dutyPersonDto.setPostTypeName(split[0]); private void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception {
dutyPersonDto.setPostType(split[1]); List<MaintenancePersonExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
} MaintenancePersonExcleDto.class, 1);
List<DutyPersonShiftDto> dutyShift = new ArrayList<>(); List<DynamicFormColumn> columns = dynamicFormColumnService.list(
for (int j = 0; j < dayByMonth.size(); j++) { new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, MAINTENANCE_PERSON));
cell = row.getCell(5 + j); List<MaintenanceCompany> maintenanceCompanyList = new ArrayList<MaintenanceCompany>();
String dutyType = cell == null ? "" : cell.toString(); List<DynamicFormInstance> dynamicFormInstanceList = new ArrayList<DynamicFormInstance>();
if (!StringUtils.isEmpty(dutyType)) { for (MaintenancePersonExcleDto maintenancePersonExcleDto : excelDtoList) {
DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto(); Long instanceId = sequence.nextId();
dutyPersonShiftDto.setDutyDate(dayByMonth.get(j)); // 先填充主表的属性
dutyPersonShiftDto.setShiftId(Long.valueOf(dutyType.split("@")[1])); MaintenanceCompany maintenanceCompany = new MaintenanceCompany();
dutyShift.add(dutyPersonShiftDto); maintenanceCompany = Bean.toPo(maintenancePersonExcleDto, maintenanceCompany);
} maintenanceCompany.setType(PERSON);
} if (maintenanceCompany.getParentId() != null) {
dutyPersonDto.setDutyShift(dutyShift); long getParentId = Long.valueOf(maintenancePersonExcleDto.getParentName().split("@")[1]);
Map<String, Object> dutyPersonDtoMap = Bean.BeantoMap(dutyPersonDto); maintenanceCompany.setParentId(getParentId);
dataList.add(dutyPersonDtoMap); }
} if (maintenanceCompanyService.checkPersonCodeExists(maintenancePersonExcleDto.getCode())) {
} maintenanceCompany.setBizCode(maintenancePersonExcleDto.getCode());
} } else {
maintenanceCompany.setCode(null);
private void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception { }
List<MaintenancePersonExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, maintenanceCompany.setOrgCode(null);
MaintenancePersonExcleDto.class, 1); maintenanceCompany.setBizCode(sequence.nextId() + "");
List<DynamicFormColumn> columns = maintenanceCompany.setInstanceId(instanceId);
dynamicFormColumnService.list(new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, MAINTENANCE_PERSON)); maintenanceCompanyList.add(maintenanceCompany);
List<MaintenanceCompany> maintenanceCompanyList = new ArrayList<MaintenanceCompany>(); maintenanceCompanyService.maintenancePersonExcleDtoToDynamicFormInstanceList(columns,
List<DynamicFormInstance> dynamicFormInstanceList = new ArrayList<DynamicFormInstance>(); maintenancePersonExcleDto, instanceId, dynamicFormInstanceList);
for (MaintenancePersonExcleDto maintenancePersonExcleDto : excelDtoList) { }
Long instanceId = sequence.nextId(); maintenanceCompanyService.saveMaintenanceCompanyBatch(maintenanceCompanyList, dynamicFormInstanceList);
// 先填充主表的属性 }
MaintenanceCompany maintenanceCompany = new MaintenanceCompany();
maintenanceCompany = Bean.toPo(maintenancePersonExcleDto, maintenanceCompany); private void excelImportKeySite(MultipartFile multipartFile) throws Exception {
maintenanceCompany.setType(PERSON); List<KeySiteExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, KeySiteExcleDto.class, 1);
if (maintenanceCompany.getParentId() != null) { keySiteService.saveExcel(excelDtoList);
long getParentId = Long.valueOf(maintenancePersonExcleDto.getParentName().split("@")[1]); }
maintenanceCompany.setParentId(getParentId);
} public void dutyTemplateExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto,
if (maintenanceCompanyService.checkPersonCodeExists(maintenancePersonExcleDto.getCode())) { String ids) {
maintenanceCompany.setBizCode(maintenancePersonExcleDto.getCode()); List<List<Object>> data = new ArrayList<>();
} else { if (ExcelEnums.CLZQ.getType().equals(excelDto.getType())) {
maintenanceCompany.setCode(null); data = initDutyCarTemplate(ids);
} } else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) {
maintenanceCompany.setOrgCode(null); data = initDutyPersonTemplate(ids);
maintenanceCompany.setBizCode(sequence.nextId() + ""); }
maintenanceCompany.setInstanceId(instanceId); // 获取日期
maintenanceCompanyList.add(maintenanceCompany); List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
maintenanceCompanyService.maintenancePersonExcleDtoToDynamicFormInstanceList(columns, List<String> dayByMonth = new ArrayList<>();
maintenancePersonExcleDto, instanceId, dynamicFormInstanceList); rangeDate.forEach(item -> dayByMonth.add((String) item.get("date")));
} exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true);
maintenanceCompanyService.saveMaintenanceCompanyBatch(maintenanceCompanyList, dynamicFormInstanceList); }
}
public void dutyInfoExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto)
private void excelImportKeySite(MultipartFile multipartFile) throws Exception { throws ParseException {
List<KeySiteExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, // 获取日期
KeySiteExcleDto.class, 1); List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
keySiteService.saveExcel(excelDtoList); List<String> dayByMonth = new ArrayList<>();
} rangeDate.forEach(item -> dayByMonth.add((String) item.get("date")));
List<List<Object>> data = new ArrayList<>();
if (ExcelEnums.CLZQ.getType().equals(excelDto.getType())) {
data = initDutyCarInfo(beginDate, endDate, dayByMonth);
} else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) {
data = initDutyPersonInfo(beginDate, endDate, dayByMonth);
}
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, false);
public void dutyTemplateExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto, }
String ids) {
List<List<Object>> data = new ArrayList<>(); private List<List<Object>> initDutyCarTemplate(String teamIds) {
if (ExcelEnums.CLZQ.getType().equals(excelDto.getType())) { List<List<Object>> data = new ArrayList<>();
data = initDutyCarTemplate(ids); // 根据id列表获取队伍下的人
} else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) { List<String> teamIdList = Lists.newArrayList();
data = initDutyPersonTemplate(ids); if (!ValidationUtil.isEmpty(teamIds)) {
} teamIdList = Lists.newArrayList(teamIds.split(","));
// 获取日期 }
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, List<FirefightersDto> firefightersDtoList = fireTeamService.getFighterByTeamId(teamIdList);
endDate);
List<String> dayByMonth = new ArrayList<>(); if (!firefightersDtoList.isEmpty()) {
rangeDate.forEach(item -> dayByMonth.add((String) item.get("date"))); AtomicInteger row = new AtomicInteger(1);
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true); firefightersDtoList.forEach(o -> {
} ArrayList<Object> list = new ArrayList<>();
list.add(row.getAndIncrement());
public void dutyInfoExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto) throws ParseException { list.add(o.getFireTeamName() + "@" + o.getFireTeamId());
// 获取日期 list.add(o.getName() + "@" + o.getSequenceNbr());
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, list.add(o.getJobTitle() + "@" + o.getJobTitleCode());
endDate); data.add(list);
List<String> dayByMonth = new ArrayList<>(); });
rangeDate.forEach(item -> dayByMonth.add((String) item.get("date"))); }
List<List<Object>> data = new ArrayList<>(); return data;
if (ExcelEnums.CLZQ.getType().equals(excelDto.getType())) { }
data = initDutyCarInfo(beginDate, endDate, dayByMonth);
} else if (ExcelEnums.RYZB.getType().equals(excelDto.getType())) { private List<List<Object>> initDutyPersonTemplate(String ids) {
data = initDutyPersonInfo(beginDate, endDate, dayByMonth); List<List<Object>> data = new ArrayList<>();
} // 根据id列表获取部门下的人
List<Long> idList = Lists.newArrayList();
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, false); if (!ValidationUtil.isEmpty(ids)) {
} String[] strings = ids.split(",");
Long[] convert = (Long[]) ConvertUtils.convert(strings, Long.class);
private List<List<Object>> initDutyCarTemplate(String teamIds) { idList = Arrays.asList(convert);
List<List<Object>> data = new ArrayList<>(); }
// 根据id列表获取队伍下的人 try {
List<String> teamIdList = Lists.newArrayList(); List<CompanyPerson> companyPeople = orgUsrService.returnCompanyPerson(idList);
if (!ValidationUtil.isEmpty(teamIds)) { if (!companyPeople.isEmpty()) {
teamIdList = Lists.newArrayList(teamIds.split(",")); AtomicInteger row = new AtomicInteger(1);
} companyPeople.forEach(item -> {
List<FirefightersDto> firefightersDtoList = fireTeamService.getFighterByTeamId(teamIdList); List<OrgUsrDto> persons = item.getPersons();
if (persons != null && !persons.isEmpty()) {
if (!firefightersDtoList.isEmpty()) { persons.forEach(o -> {
AtomicInteger row = new AtomicInteger(1); ArrayList<Object> list = new ArrayList<>();
firefightersDtoList.forEach(o -> { list.add(row.getAndIncrement());
ArrayList<Object> list = new ArrayList<>(); list.add(o.getSequenceNbr().toString());
list.add(row.getAndIncrement()); list.add(o.getBizOrgName());
list.add(o.getFireTeamName() + "@" + o.getFireTeamId()); list.add(item.getBizOrgName() + "@" + item.getSequenceNbr());
list.add(o.getName() + "@" + o.getSequenceNbr()); data.add(list);
list.add(o.getJobTitle() + "@" + o.getJobTitleCode()); });
data.add(list); }
}); });
} }
return data; } catch (Exception e) {
} e.printStackTrace();
throw new RuntimeException("系统异常!");
private List<List<Object>> initDutyPersonTemplate(String ids) { }
List<List<Object>> data = new ArrayList<>(); return data;
// 根据id列表获取部门下的人 }
List<Long> idList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(ids)) {
String[] strings = ids.split(",");
Long[] convert = (Long[]) ConvertUtils.convert(strings, Long.class); private void exportDutyTemplate(HttpServletResponse response, String classUrl, List<String> dayByMonth,
idList = Arrays.asList(convert); ExcelDto excelDto, List<? extends Object> data, Boolean flag) {
} try {
try { // 获取排班类型
List<CompanyPerson> companyPeople = orgUsrService.returnCompanyPerson(idList); String[] dutyNameList = getDutyNameList();
if (!companyPeople.isEmpty()) { Class<?> clz = Class.forName(classUrl);
AtomicInteger row = new AtomicInteger(1); ExcelUtil.createDutyTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data, clz,
companyPeople.forEach(item -> { dayByMonth, dutyNameList, dataSourcesImpl, flag);
List<OrgUsrDto> persons = item.getPersons(); } catch (ClassNotFoundException e) {
if (persons != null && !persons.isEmpty()) { e.printStackTrace();
persons.forEach(o -> { }
ArrayList<Object> list = new ArrayList<>(); }
list.add(row.getAndIncrement());
list.add(o.getSequenceNbr().toString()); private String[] getDutyNameList() {
list.add(o.getBizOrgName()); List<String> dutyShiftList = new ArrayList<>();
list.add(item.getBizOrgName() + "@" + item.getSequenceNbr()); List<DutyShiftDto> dutyShiftDtoList = dutyShiftService.queryForDutyShiftList(null, false);
data.add(list); dutyShiftDtoList.forEach(item -> dutyShiftList.add(item.getName() + "@" + item.getSequenceNbr()));
}); return dutyShiftList.toArray(new String[dutyShiftList.size()]);
} }
});
} private List<List<Object>> initDutyCarInfo(String beginDate, String endDate, List<String> dayByMonth)
} catch (Exception e) { throws ParseException {
e.printStackTrace(); // 查询已值班数据
throw new RuntimeException("系统异常!"); List<DutyCarDto> contentList = dutyCarService.downloadList(beginDate, endDate);
} List<List<Object>> data = new ArrayList<>();
return data; // 组装导出数据
} if (!contentList.isEmpty()) {
AtomicInteger row = new AtomicInteger(1);
private void exportDutyTemplate(HttpServletResponse response, String classUrl, List<String> dayByMonth, contentList.forEach(o -> {
ExcelDto excelDto, List<? extends Object> data, Boolean flag) { ArrayList<Object> list = new ArrayList<>();
try { list.add(row.getAndIncrement());
// 获取排班类型 list.add(o.getTeamName());
String[] dutyNameList = getDutyNameList(); list.add(o.getUserName());
Class<?> clz = Class.forName(classUrl); list.add(o.getPostTypeName());
ExcelUtil.createDutyTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data, list.add(o.getCarName());
clz, dayByMonth, dutyNameList, dataSourcesImpl, flag);
} catch (ClassNotFoundException e) { List<DutyPersonShiftDto> dutyShift = o.getDutyShift();
e.printStackTrace(); initDutyShift(dayByMonth, dutyShift, list);
}
} data.add(list);
});
private String[] getDutyNameList() { }
List<String> dutyShiftList = new ArrayList<>(); return data;
List<DutyShiftDto> dutyShiftDtoList = dutyShiftService.queryForDutyShiftList(null, false); }
dutyShiftDtoList.forEach(item -> dutyShiftList.add(item.getName() + "@" + item.getSequenceNbr()));
return dutyShiftList.toArray(new String[dutyShiftList.size()]); private void initDutyShift(List<String> dayByMonth, List<DutyPersonShiftDto> dutyShift, ArrayList<Object> list) {
} HashMap<String, String> dutyShiftMap = new HashMap<>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
private List<List<Object>> initDutyCarInfo(String beginDate, String endDate, List<String> dayByMonth) throws ParseException { dutyShift.forEach(item -> dutyShiftMap.put(format.format(item.getDutyDate()), item.getShiftName()));
// 查询已值班数据
List<DutyCarDto> contentList = dutyCarService.downloadList(beginDate, endDate); for (int i = 0; i < dayByMonth.size(); i++) {
List<List<Object>> data = new ArrayList<>(); if (dutyShiftMap.containsKey(dayByMonth.get(i))) {
// 组装导出数据 list.add(dutyShiftMap.get(dayByMonth.get(i)));
if (!contentList.isEmpty()) { } else {
AtomicInteger row = new AtomicInteger(1); list.add(NOT_DUTY);
contentList.forEach(o -> { }
ArrayList<Object> list = new ArrayList<>(); }
list.add(row.getAndIncrement()); }
list.add(o.getTeamName());
list.add(o.getUserName()); private List<List<Object>> initDutyPersonInfo(String beginDate, String endDate, List<String> dayByMonth)
list.add(o.getPostTypeName()); throws ParseException {
list.add(o.getCarName()); // 查询已值班数据
List<DutyPersonDto> contentList = iDutyPersonService.downloadList(beginDate, endDate);
List<DutyPersonShiftDto> dutyShift = o.getDutyShift(); List<List<Object>> data = new ArrayList<>();
initDutyShift(dayByMonth, dutyShift, list); // 组装导出数据
if (!contentList.isEmpty()) {
data.add(list); AtomicInteger row = new AtomicInteger(1);
}); contentList.forEach(o -> {
} ArrayList<Object> list = new ArrayList<>();
return data; list.add(row.getAndIncrement());
} list.add(o.getUserId());
list.add(o.getUserName());
private void initDutyShift(List<String> dayByMonth, List<DutyPersonShiftDto> dutyShift, ArrayList<Object> list) { list.add(o.getDeptName());
HashMap<String, String> dutyShiftMap = new HashMap<>(); list.add(o.getPostTypeName());
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
dutyShift.forEach(item -> dutyShiftMap.put(format.format(item.getDutyDate()), item.getShiftName())); List<DutyPersonShiftDto> dutyShift = o.getDutyShift();
initDutyShift(dayByMonth, dutyShift, list);
for (int i = 0; i < dayByMonth.size(); i++) {
if (dutyShiftMap.containsKey(dayByMonth.get(i))) { data.add(list);
list.add(dutyShiftMap.get(dayByMonth.get(i))); });
} else { }
list.add(NOT_DUTY); return data;
} }
}
} public void exportByParams(HttpServletResponse response, ExcelDto excelDto, String params) {
switch (excelDto.getType()) {
private List<List<Object>> initDutyPersonInfo(String beginDate, String endDate, List<String> dayByMonth) throws ParseException {
// 查询已值班数据 case "WHP":
List<DutyPersonDto> contentList = iDutyPersonService.downloadList(beginDate, endDate); List<FireChemicalDto> data = fireChemicalServiceImpl.queryForFireChemicalList(false);
List<List<Object>> data = new ArrayList<>(); ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
// 组装导出数据 FireChemicalDto.class, dataSourcesImpl, false);
if (!contentList.isEmpty()) { break;
AtomicInteger row = new AtomicInteger(1); case "XFZJ":
contentList.forEach(o -> { List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
ArrayList<Object> list = new ArrayList<>(); ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireExpertsDtoList,
list.add(row.getAndIncrement()); FireExpertsDto.class, dataSourcesImpl, false);
list.add(o.getUserId()); break;
list.add(o.getUserName()); case "SYXX":
list.add(o.getDeptName()); List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true);
list.add(o.getPostTypeName()); ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), waterResourceDtoList,
WaterResourceDto.class, dataSourcesImpl, false);
List<DutyPersonShiftDto> dutyShift = o.getDutyShift(); break;
initDutyShift(dayByMonth, dutyShift, list); case "HKQ":
List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false);
data.add(list); ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), aircraftDtoList,
}); AircraftDto.class, dataSourcesImpl, false);
} break;
return data; case "XFDW":
} List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList,
FireTeamDto.class, dataSourcesImpl, false);
break;
public void exportByParams(HttpServletResponse response, ExcelDto excelDto, String params) { case "WXXFZ":
switch (excelDto.getType()) { List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireStationDtoList,
case "WHP": FireStationDto.class, null, false);
List<FireChemicalDto> data = fireChemicalServiceImpl.queryForFireChemicalList(false); break;
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data, case "XFRY":
FireChemicalDto.class, dataSourcesImpl, false); List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false);
break; ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
case "XFZJ": firefightersExcelDtoList, FirefightersExcelDto.class, null, false);
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false); break;
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), case "WBRY":
fireExpertsDtoList, FireExpertsDto.class, dataSourcesImpl, false); List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = maintenanceCompanyService
break; .exportToMaintenancePersonExcel();
case "SYXX": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true); maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
waterResourceDtoList, WaterResourceDto.class, dataSourcesImpl, false); case "KEYSITE":
break; List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel();
case "HKQ": ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), keySiteDtoList,
List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false); KeySiteExcleDto.class, null, false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
aircraftDtoList, AircraftDto.class, dataSourcesImpl, false); case "JCDWRY":
break; // 机场单位人员参数传递为 parentId = xxxxxxx
case "XFDW": String parentIdStr = params.split("=")[1];
List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false); Long parentId = -1l;
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireTeamDtoList, try {
FireTeamDto.class, dataSourcesImpl, false); parentId = Long.parseLong(parentIdStr);
break; } catch (NumberFormatException e) {
case "WXXFZ": throw new BadRequest("导出机场单位时未传递正确parentId");
List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false); }
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportPersonToExcelByParentId(parentId);
fireStationDtoList, FireStationDto.class, null, false); ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), orgUsrList,
break; OrgUsrExcelDto.class, null, false);
case "XFRY": break;
List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false); case "LDDW":
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel();
firefightersExcelDtoList, FirefightersExcelDto.class, null, false);
break; ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), LinkageUnitDtoList,
case "WBRY": LinkageUnitDto.class, null, false);
List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = break;
maintenanceCompanyService.exportToMaintenancePersonExcel(); default:
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), break;
maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false); }
break; }
case "KEYSITE":
List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel(); public BaseEntity getCurrentInfo() {
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), BaseEntity userModel= new BaseEntity();
keySiteDtoList, KeySiteExcleDto.class, null, false); /* String keyString= RequestContext.getExeUserId();
break; String token=RequestContext.getToken();
case "JCDWRY": ReginParams params = JSONObject.parseObject(redisUtils
// 机场单位人员参数传递为 parentId = xxxxxxx .get(RedisKey.buildReginKey(keyString, token)).toString(),
String parentIdStr = params.split("=")[1]; ReginParams.class);*/
Long parentId = -1l; userModel.setRecUserId("3141675");
try { userModel.setRecUserName("admin_jcs");
parentId = Long.parseLong(parentIdStr); userModel.setRecDate( new Date());
} catch (NumberFormatException e) { userModel.setIsDelete(false);
throw new BadRequest("导出机场单位时未传递正确parentId"); return userModel;
} }
List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportPersonToExcelByParentId(parentId);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
orgUsrList, OrgUsrExcelDto.class, null, false);
break;
case "LDDW":
List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
LinkageUnitDtoList, LinkageUnitDto.class, null, false);
break;
default:
break;
}
}
} }
spring.application.name=JCS-chenhao spring.application.name=JCS
server.servlet.context-path=/jcs server.servlet.context-path=/jcs
server.port=11100 server.port=11100
spring.profiles.active=dev spring.profiles.active=dev
...@@ -7,10 +7,10 @@ spring.jackson.time-zone=GMT+8 ...@@ -7,10 +7,10 @@ spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
logging.config=classpath:logback-${spring.profiles.active}.xml logging.config=classpath:logback-${spring.profiles.active}.xml
## mybatis-plus配置控制台打印完整带参数SQL语句 ## mybatis-plus配置控制台打印完整带参数SQL语句
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
## redis失效时间 ## redis失效时间
redis.cache.failure.time=10800 redis.cache.failure.time=10800
## unit(h) ## unit(h)
...@@ -52,13 +52,13 @@ spring.redis.lettuce.pool.min-idle=0 ...@@ -52,13 +52,13 @@ spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
#在重启服务的过程中是否清空缓存的标识符 --2021-09-09 #在重启服务的过程中是否清空缓存的标识符 --2021-09-09
my.spring.redis.cache.isclean=false my.spring.redis.cache.isclean=false
## mqtt-警情初报消息主题 ## mqtt-警情初报消息主题
mqtt.topic.alert.reporting=alertReporting mqtt.topic.alert.reporting=alertReporting
## 实战指挥新警情�?�报主题 ## 实战指挥新警情主题
mqtt.topic.command.alert.notice=alertNotice mqtt.topic.command.alert.notice=alertNotice
## 跑马灯地震,天气预警信息 ## 跑马灯地震、天气预警信息
mqtt.topic.command.meteorological.notice=meteorological mqtt.topic.command.meteorological.notice=meteorological
mqtt.topic.command.power.deployment=power mqtt.topic.command.power.deployment=power
...@@ -72,8 +72,8 @@ iot.fegin.name=AMOS-API-IOT ...@@ -72,8 +72,8 @@ iot.fegin.name=AMOS-API-IOT
equip.fegin.name=AMOS-EQUIPMANAGE equip.fegin.name=AMOS-EQUIPMANAGE
## 设备联动服务(车库门、广播、警铃) ## 设备联动服务(车库门、广播、警铃)
control.fegin.name=JCS-API-CONTROL control.fegin.name=JCS-API-CONTROL
## 故障报修流程 ## 故障报修流程
failure.work.flow.processDefinitionKey=malfunction_repair failure.work.flow.processDefinitionKey=malfunction_repair
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment