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)
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<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"
resultType="com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto">
select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode
from cb_firefighters a from cb_firefighters a
where a.is_delete = 0 where a.is_delete = 0
...@@ -12,7 +13,9 @@ ...@@ -12,7 +13,9 @@
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm --> <!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<select id="getFirefighters" <select id="getFirefighters"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto"> resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto">
select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code areasExpertiseCode from cb_firefighters a LEFT JOIN cb_firefighters_post b on select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code
areasExpertiseCode from cb_firefighters a LEFT JOIN
cb_firefighters_post b on
a.sequence_nbr=b.firefighters_id where a.is_delete=0 a.sequence_nbr=b.firefighters_id where a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if> <if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if> <if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
...@@ -20,7 +23,8 @@ ...@@ -20,7 +23,8 @@
<if test='par.state!=null'>and a.state_code= #{par.state}</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.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.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!=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> <if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date desc limit #{pageNum},#{pageSize} ORDER BY a.rec_date desc limit #{pageNum},#{pageSize}
</select> </select>
...@@ -35,7 +39,8 @@ ...@@ -35,7 +39,8 @@
<if test='par.state!=null'>and a.state_code= #{par.state}</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.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.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!=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> <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
...@@ -69,13 +74,21 @@ ...@@ -69,13 +74,21 @@
</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,
emergency_contact,
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} where f.is_delete = #{isDelete}
</select> </select>
......
...@@ -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) {
...@@ -413,14 +435,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -413,14 +435,13 @@ 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) {
return this.baseMapper.queryOrgUsrListByBizOrgCode(bizOrgCode); return this.baseMapper.queryOrgUsrListByBizOrgCode(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);
orgUsr.setSequenceNbr(id); /* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 开始*/
/* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 开始*/
OrgUsr parent = getById(OrgPersonVo.getParentId()); OrgUsr parent = getById(OrgPersonVo.getParentId());
if (!ObjectUtils.isEmpty(parent)){ if (parent != null){
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
/* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 结束*/ /* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 结束*/
orgUsr.setSequenceNbr(id);
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;
} }
...@@ -979,6 +1016,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -979,6 +1016,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
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);
if (ObjectUtils.isEmpty(person)) { if (ObjectUtils.isEmpty(person)) {
...@@ -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;
...@@ -63,6 +74,9 @@ public class ExcelServiceImpl { ...@@ -63,6 +74,9 @@ 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
private RedisUtils redisUtils;
@Autowired @Autowired
DataSourcesImpl dataSourcesImpl; DataSourcesImpl dataSourcesImpl;
@Autowired @Autowired
...@@ -111,8 +125,8 @@ public class ExcelServiceImpl { ...@@ -111,8 +125,8 @@ public class ExcelServiceImpl {
public void templateExport(HttpServletResponse response, ExcelDto excelDto) throws ClassNotFoundException { public void templateExport(HttpServletResponse response, ExcelDto excelDto) throws ClassNotFoundException {
String url = excelDto.getClassUrl(); String url = excelDto.getClassUrl();
Class<?> clz = Class.forName(url); Class<?> clz = Class.forName(url);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null, clz, ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null, clz, dataSourcesImpl,
dataSourcesImpl, true); true);
} }
public void commonExport(HttpServletResponse response, ExcelDto excelDto) { public void commonExport(HttpServletResponse response, ExcelDto excelDto) {
...@@ -125,18 +139,18 @@ public class ExcelServiceImpl { ...@@ -125,18 +139,18 @@ public class ExcelServiceImpl {
break; break;
case "XFZJ": case "XFZJ":
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false); List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireExpertsDtoList,
fireExpertsDtoList, FireExpertsDto.class, dataSourcesImpl, false); FireExpertsDto.class, dataSourcesImpl, false);
break; break;
case "SYXX": case "SYXX":
List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true); List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), waterResourceDtoList,
waterResourceDtoList, WaterResourceDto.class, dataSourcesImpl, false); WaterResourceDto.class, dataSourcesImpl, false);
break; break;
case "HKQ": case "HKQ":
List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false); List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), aircraftDtoList,
aircraftDtoList, AircraftDto.class, dataSourcesImpl, false); AircraftDto.class, dataSourcesImpl, false);
break; break;
case "XFDW": case "XFDW":
List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false); List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false);
...@@ -145,8 +159,8 @@ public class ExcelServiceImpl { ...@@ -145,8 +159,8 @@ public class ExcelServiceImpl {
break; break;
case "WXXFZ": case "WXXFZ":
List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false); List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireStationDtoList,
fireStationDtoList, FireStationDto.class, null, false); FireStationDto.class, null, false);
break; break;
case "XFRY": case "XFRY":
List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false); List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false);
...@@ -154,27 +168,27 @@ public class ExcelServiceImpl { ...@@ -154,27 +168,27 @@ public class ExcelServiceImpl {
firefightersExcelDtoList, FirefightersExcelDto.class, null, false); firefightersExcelDtoList, FirefightersExcelDto.class, null, false);
break; break;
case "WBRY": case "WBRY":
List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = maintenanceCompanyService
maintenanceCompanyService.exportToMaintenancePersonExcel(); .exportToMaintenancePersonExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false); maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false);
break; break;
case "KEYSITE": case "KEYSITE":
List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel(); List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), keySiteDtoList,
keySiteDtoList, KeySiteExcleDto.class, null, false); KeySiteExcleDto.class, null, false);
break; break;
case "JCDWRY": case "JCDWRY":
List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportToExcel(); List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), orgUsrList,
orgUsrList, OrgUsrExcelDto.class, null, false); OrgUsrExcelDto.class, null, false);
break; break;
case "LDDW": case "LDDW":
List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel(); List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), LinkageUnitDtoList,
LinkageUnitDtoList, LinkageUnitDto.class, null, false); LinkageUnitDto.class, null, false);
break; break;
default: default:
break; break;
...@@ -235,13 +249,14 @@ public class ExcelServiceImpl { ...@@ -235,13 +249,14 @@ public class ExcelServiceImpl {
} }
private void excelImportLinkageUnitTGRYDto(MultipartFile multipartFile) throws Exception { private void excelImportLinkageUnitTGRYDto(MultipartFile multipartFile) throws Exception {
List<SpecialPositionStaffDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<SpecialPositionStaffDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
SpecialPositionStaffDto.class, 1); SpecialPositionStaffDto.class, 1);
if(excelDtoList!=null&&excelDtoList.size()>0){ if (excelDtoList != null && excelDtoList.size() > 0) {
outer : for(SpecialPositionStaffDto positionStaffDto : excelDtoList) { outer: for (SpecialPositionStaffDto positionStaffDto : excelDtoList) {
String code = ""; String code = "";
if(positionStaffDto.getPositionName()!=null){ if (positionStaffDto.getPositionName() != null) {
String[] certificates = positionStaffDto.getPositionName().split("@"); String[] certificates = positionStaffDto.getPositionName().split("@");
positionStaffDto.setPositionName(certificates[0]); positionStaffDto.setPositionName(certificates[0]);
positionStaffDto.setPositionNameCode(certificates[1]); positionStaffDto.setPositionNameCode(certificates[1]);
...@@ -249,16 +264,17 @@ public class ExcelServiceImpl { ...@@ -249,16 +264,17 @@ public class ExcelServiceImpl {
} else { } else {
continue; continue;
} }
if(positionStaffDto.getCompany()!=null){ if (positionStaffDto.getCompany() != null) {
String[] certificates = positionStaffDto.getCompany().split("@"); String[] certificates = positionStaffDto.getCompany().split("@");
positionStaffDto.setCompany(certificates[0]); positionStaffDto.setCompany(certificates[0]);
positionStaffDto.setCompanyId(Long.parseLong(certificates[1])); positionStaffDto.setCompanyId(Long.parseLong(certificates[1]));
// 获取特岗人员已经存在的岗位 如果存在则不导入 // 获取特岗人员已经存在的岗位 如果存在则不导入
LambdaQueryWrapper<SpecialPositionStaff> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SpecialPositionStaff> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SpecialPositionStaff::getCompanyId,Long.parseLong(certificates[1])).eq(SpecialPositionStaff::getIsDelete,false); queryWrapper.eq(SpecialPositionStaff::getCompanyId, Long.parseLong(certificates[1]))
.eq(SpecialPositionStaff::getIsDelete, false);
List<SpecialPositionStaff> tempList = specialPositionStaffServiceImpl.list(queryWrapper); List<SpecialPositionStaff> tempList = specialPositionStaffServiceImpl.list(queryWrapper);
for(SpecialPositionStaff temp : tempList) { for (SpecialPositionStaff temp : tempList) {
if(temp.getPositionNameCode().equals(code)) { if (temp.getPositionNameCode().equals(code)) {
continue outer; // 已经存在则不导入继续循环 continue outer; // 已经存在则不导入继续循环
} }
} }
...@@ -271,12 +287,12 @@ public class ExcelServiceImpl { ...@@ -271,12 +287,12 @@ public class ExcelServiceImpl {
} }
private void excelImportLinkageUnitJYZBDto(MultipartFile multipartFile) throws Exception { private void excelImportLinkageUnitJYZBDto(MultipartFile multipartFile) throws Exception {
List<RescueEquipmentDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<RescueEquipmentDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, RescueEquipmentDto.class,
RescueEquipmentDto.class, 1); 1);
if(excelDtoList!=null&&excelDtoList.size()>0){ if (excelDtoList != null && excelDtoList.size() > 0) {
outer : for(RescueEquipmentDto rescueEquipmentDto : excelDtoList ) { outer: for (RescueEquipmentDto rescueEquipmentDto : excelDtoList) {
String code = ""; String code = "";
if(rescueEquipmentDto.getVehicleType()!=null){ if (rescueEquipmentDto.getVehicleType() != null) {
String[] certificates = rescueEquipmentDto.getVehicleType().split("@"); String[] certificates = rescueEquipmentDto.getVehicleType().split("@");
rescueEquipmentDto.setVehicleType(certificates[0]); rescueEquipmentDto.setVehicleType(certificates[0]);
rescueEquipmentDto.setVehicleTypeCode(certificates[1]); rescueEquipmentDto.setVehicleTypeCode(certificates[1]);
...@@ -284,21 +300,22 @@ public class ExcelServiceImpl { ...@@ -284,21 +300,22 @@ public class ExcelServiceImpl {
} else { } else {
continue; continue;
} }
if(rescueEquipmentDto.getCompany()!=null){ if (rescueEquipmentDto.getCompany() != null) {
String[] certificates = rescueEquipmentDto.getCompany().split("@"); String[] certificates = rescueEquipmentDto.getCompany().split("@");
rescueEquipmentDto.setCompany(certificates[0]); rescueEquipmentDto.setCompany(certificates[0]);
rescueEquipmentDto.setCompanyId(Long.parseLong(certificates[1])); rescueEquipmentDto.setCompanyId(Long.parseLong(certificates[1]));
// 获取救援装备已经存在的装备 如果存在则不导入 // 获取救援装备已经存在的装备 如果存在则不导入
LambdaQueryWrapper<RescueEquipment> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<RescueEquipment> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RescueEquipment::getCompanyId,Long.parseLong(certificates[1])).eq(RescueEquipment::getIsDelete,false); queryWrapper.eq(RescueEquipment::getCompanyId, Long.parseLong(certificates[1]))
.eq(RescueEquipment::getIsDelete, false);
List<RescueEquipment> tempList = rescueEquipmentServiceImpl.list(queryWrapper); List<RescueEquipment> tempList = rescueEquipmentServiceImpl.list(queryWrapper);
for(RescueEquipment temp : tempList) { for (RescueEquipment temp : tempList) {
if(temp.getVehicleTypeCode().equals(code)) { if (temp.getVehicleTypeCode().equals(code)) {
continue outer; // 已经存在则不导入继续循环 continue outer; // 已经存在则不导入继续循环
} }
} }
} else { } else {
continue ; continue;
} }
rescueEquipmentServiceImpl.createWithModel(rescueEquipmentDto); rescueEquipmentServiceImpl.createWithModel(rescueEquipmentDto);
...@@ -307,20 +324,17 @@ public class ExcelServiceImpl { ...@@ -307,20 +324,17 @@ public class ExcelServiceImpl {
} }
} }
private void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception { private void excelImportLinkageUnitZhDto(MultipartFile multipartFile) throws Exception {
List<LinkageUnitDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<LinkageUnitDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, LinkageUnitDto.class, 1);
LinkageUnitDto.class, 1);
if(excelDtoList!=null&&excelDtoList.size()>0){ if (excelDtoList != null && excelDtoList.size() > 0) {
excelDtoList.forEach(linkageUnitDto->{ excelDtoList.forEach(linkageUnitDto -> {
if(linkageUnitDto.getLinkageUnitType()!=null){ if (linkageUnitDto.getLinkageUnitType() != null) {
String[] certificates = linkageUnitDto.getLinkageUnitType().split("@"); String[] certificates = linkageUnitDto.getLinkageUnitType().split("@");
linkageUnitDto.setLinkageUnitType(certificates[0]); linkageUnitDto.setLinkageUnitType(certificates[0]);
linkageUnitDto.setLinkageUnitTypeCode(certificates[1]); linkageUnitDto.setLinkageUnitTypeCode(certificates[1]);
} }
if(linkageUnitDto.getEmergencyLinkageUnit()!=null){ if (linkageUnitDto.getEmergencyLinkageUnit() != null) {
String[] certificates = linkageUnitDto.getEmergencyLinkageUnit().split("@"); String[] certificates = linkageUnitDto.getEmergencyLinkageUnit().split("@");
linkageUnitDto.setEmergencyLinkageUnit(certificates[0]); linkageUnitDto.setEmergencyLinkageUnit(certificates[0]);
linkageUnitDto.setEmergencyLinkageUnitCode(certificates[1]); linkageUnitDto.setEmergencyLinkageUnitCode(certificates[1]);
...@@ -330,19 +344,15 @@ public class ExcelServiceImpl { ...@@ -330,19 +344,15 @@ public class ExcelServiceImpl {
}); });
} }
} }
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]);
} }
...@@ -350,18 +360,18 @@ public class ExcelServiceImpl { ...@@ -350,18 +360,18 @@ public class ExcelServiceImpl {
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]);
...@@ -369,7 +379,7 @@ public class ExcelServiceImpl { ...@@ -369,7 +379,7 @@ public class ExcelServiceImpl {
} }
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]);
...@@ -380,7 +390,7 @@ public class ExcelServiceImpl { ...@@ -380,7 +390,7 @@ public class ExcelServiceImpl {
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]);
...@@ -388,14 +398,14 @@ public class ExcelServiceImpl { ...@@ -388,14 +398,14 @@ public class ExcelServiceImpl {
} }
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]);
...@@ -406,7 +416,7 @@ public class ExcelServiceImpl { ...@@ -406,7 +416,7 @@ public class ExcelServiceImpl {
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]);
...@@ -417,7 +427,7 @@ public class ExcelServiceImpl { ...@@ -417,7 +427,7 @@ public class ExcelServiceImpl {
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]);
...@@ -425,7 +435,7 @@ public class ExcelServiceImpl { ...@@ -425,7 +435,7 @@ public class ExcelServiceImpl {
} }
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]);
...@@ -433,7 +443,7 @@ public class ExcelServiceImpl { ...@@ -433,7 +443,7 @@ public class ExcelServiceImpl {
} }
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]);
...@@ -446,7 +456,7 @@ public class ExcelServiceImpl { ...@@ -446,7 +456,7 @@ public class ExcelServiceImpl {
} }
DynamicFormInstance dynamicFormInstance=new DynamicFormInstance(); DynamicFormInstance dynamicFormInstance = new DynamicFormInstance();
BeanUtils.copyProperties(dynamicFormInstanceDto, dynamicFormInstance); BeanUtils.copyProperties(dynamicFormInstanceDto, dynamicFormInstance);
dynamicFormInstancelist.add(dynamicFormInstance); dynamicFormInstancelist.add(dynamicFormInstance);
...@@ -454,7 +464,6 @@ public class ExcelServiceImpl { ...@@ -454,7 +464,6 @@ public class ExcelServiceImpl {
orgUsrExcelDto.setDynamicFormValue(dynamicFormInstancelist); orgUsrExcelDto.setDynamicFormValue(dynamicFormInstancelist);
try { try {
orgUsrService.saveOrgPersonExcel(orgUsrExcelDto); orgUsrService.saveOrgPersonExcel(orgUsrExcelDto);
} catch (Exception e) { } catch (Exception e) {
...@@ -463,26 +472,16 @@ public class ExcelServiceImpl { ...@@ -463,26 +472,16 @@ public class ExcelServiceImpl {
}); });
} }
} }
private void excelImportFirefighters(MultipartFile multipartFile) throws Exception { private void excelImportFirefighters(MultipartFile multipartFile) throws Exception {
List<FirefightersExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<FirefightersExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
FirefightersExcelDto.class, 1); FirefightersExcelDto.class, 1);
excelDtoList.forEach( excelDtoList.forEach(item -> {
item -> {
Firefighters firefighters = new Firefighters(); Firefighters firefighters = new Firefighters();
FirefightersContacts firefightersContacts = new FirefightersContacts(); FirefightersContacts firefightersContacts = new FirefightersContacts();
firefighters = Bean.toPo(item, firefighters); firefighters = Bean.toPo(item, firefighters);
firefighters = Bean.toPo(getCurrentInfo(), firefighters);
firefightersContacts = Bean.toPo(item, firefightersContacts); firefightersContacts = Bean.toPo(item, firefightersContacts);
if (item.getFireTeam() != null) { if (item.getFireTeam() != null) {
Long fireTeamId = Long.valueOf(item.getFireTeam().split("@")[1]); Long fireTeamId = Long.valueOf(item.getFireTeam().split("@")[1]);
...@@ -507,17 +506,17 @@ public class ExcelServiceImpl { ...@@ -507,17 +506,17 @@ public class ExcelServiceImpl {
String relationship = firefightersContacts.getRelationship().split("@")[1]; String relationship = firefightersContacts.getRelationship().split("@")[1];
firefightersContacts.setRelationship(relationship); firefightersContacts.setRelationship(relationship);
} }
if(firefighters.getCompanyName() != null) { if (firefighters.getCompanyName() != null) {
String[] tempCompany = firefighters.getCompanyName().split("@"); String[] tempCompany = firefighters.getCompanyName().split("@");
firefighters.setCompanyName(tempCompany[0]); firefighters.setCompanyName(tempCompany[0]);
firefighters.setCompany(tempCompany[1]); firefighters.setCompany(tempCompany[1]);
} }
if(firefighters.getNativePlaceValue() != null) { if (firefighters.getNativePlaceValue() != null) {
String[] tempCity = firefighters.getNativePlaceValue().split("@"); String[] tempCity = firefighters.getNativePlaceValue().split("@");
firefighters.setNativePlaceValue(tempCity[0]); firefighters.setNativePlaceValue(tempCity[0]);
firefighters.setNativePlace(tempCity[1]); firefighters.setNativePlace(tempCity[1]);
} }
if(firefighters.getResidence() != null) { if (firefighters.getResidence() != null) {
String[] tempCity = firefighters.getResidence().split("@"); String[] tempCity = firefighters.getResidence().split("@");
firefighters.setResidence(tempCity[0]); firefighters.setResidence(tempCity[0]);
firefighters.setResidenceDetails(tempCity[1]); firefighters.setResidenceDetails(tempCity[1]);
...@@ -525,17 +524,16 @@ public class ExcelServiceImpl { ...@@ -525,17 +524,16 @@ public class ExcelServiceImpl {
// BUG 2760 修改消防人员导出模板和 导入问题 bykongfm // BUG 2760 修改消防人员导出模板和 导入问题 bykongfm
FirefightersInfoDto firefightersInfo = new FirefightersInfoDto(firefighters, firefightersContacts); FirefightersInfoDto firefightersInfo = new FirefightersInfoDto(firefighters, firefightersContacts);
firefightersService.saveFirefighters(firefightersInfo); firefightersService.saveFirefighters(firefightersInfo);
} });
);
} }
private void excelImportFireStation(MultipartFile multipartFile) throws Exception { private void excelImportFireStation(MultipartFile multipartFile) throws Exception {
List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1); List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1);
List<FireStation> excelEntityList = new ArrayList<>(); List<FireStation> excelEntityList = new ArrayList<>();
excelDtoList.forEach( excelDtoList.forEach(item -> {
item -> {
FireStation fireStation = new FireStation(); FireStation fireStation = new FireStation();
fireStation = Bean.toPo(item, fireStation); fireStation = Bean.toPo(item, fireStation);
fireStation = Bean.toPo(getCurrentInfo(), fireStation);
if (fireStation.getWhereBuilding() != null) { if (fireStation.getWhereBuilding() != null) {
String[] whereBuilding = fireStation.getWhereBuilding().split("@"); String[] whereBuilding = fireStation.getWhereBuilding().split("@");
fireStation.setWhereBuilding(whereBuilding[0]); fireStation.setWhereBuilding(whereBuilding[0]);
...@@ -548,18 +546,17 @@ public class ExcelServiceImpl { ...@@ -548,18 +546,17 @@ public class ExcelServiceImpl {
fireStation.setBizCompanyCode(bizCompany[2]); fireStation.setBizCompanyCode(bizCompany[2]);
} }
excelEntityList.add(fireStation); excelEntityList.add(fireStation);
} });
);
fireStationService.saveBatch(excelEntityList); fireStationService.saveBatch(excelEntityList);
} }
private void excelImportFireTeam(MultipartFile multipartFile) throws Exception { private void excelImportFireTeam(MultipartFile multipartFile) throws Exception {
List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1); List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class, 1);
List<FireTeam> excelEntityList = new ArrayList<>(); List<FireTeam> excelEntityList = new ArrayList<>();
excelDtoList.forEach( excelDtoList.forEach(item -> {
item -> {
FireTeam fireTeam = new FireTeam(); FireTeam fireTeam = new FireTeam();
fireTeam = Bean.toPo(item, fireTeam); fireTeam = Bean.toPo(item, fireTeam);
fireTeam = Bean.toPo(getCurrentInfo(), fireTeam);
if (fireTeam.getType() != null) { if (fireTeam.getType() != null) {
String[] type = fireTeam.getType().split("@"); String[] type = fireTeam.getType().split("@");
fireTeam.setType(type[0]); fireTeam.setType(type[0]);
...@@ -575,18 +572,17 @@ public class ExcelServiceImpl { ...@@ -575,18 +572,17 @@ public class ExcelServiceImpl {
fireTeam.setParent(Long.valueOf(parentName[1])); fireTeam.setParent(Long.valueOf(parentName[1]));
} }
excelEntityList.add(fireTeam); excelEntityList.add(fireTeam);
} });
);
fireTeamService.saveBatch(excelEntityList); fireTeamService.saveBatch(excelEntityList);
} }
private void excelImportAircraft(MultipartFile multipartFile) throws Exception { private void excelImportAircraft(MultipartFile multipartFile) throws Exception {
List<AircraftDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, 1); List<AircraftDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, 1);
List<Aircraft> excelEntityList = new ArrayList<>(); List<Aircraft> excelEntityList = new ArrayList<>();
excelDtoList.forEach( excelDtoList.forEach(item -> {
item -> {
Aircraft aircraft = new Aircraft(); Aircraft aircraft = new Aircraft();
aircraft = Bean.toPo(item, aircraft); aircraft = Bean.toPo(item, aircraft);
aircraft = Bean.toPo(getCurrentInfo(), aircraft);
if (aircraft.getEngineType() != null) { if (aircraft.getEngineType() != null) {
String[] engineType = aircraft.getEngineType().split("@"); String[] engineType = aircraft.getEngineType().split("@");
aircraft.setEngineType(engineType[0]); aircraft.setEngineType(engineType[0]);
...@@ -598,34 +594,30 @@ public class ExcelServiceImpl { ...@@ -598,34 +594,30 @@ public class ExcelServiceImpl {
aircraft.setFuelTypeCode(fuelType[1]); aircraft.setFuelTypeCode(fuelType[1]);
} }
excelEntityList.add(aircraft); excelEntityList.add(aircraft);
} });
);
aircraftServiceImpl.saveBatch(excelEntityList); aircraftServiceImpl.saveBatch(excelEntityList);
} }
private void excelImportFireChemical(MultipartFile multipartFile) throws Exception { private void excelImportFireChemical(MultipartFile multipartFile) throws Exception {
List<FireChemicalDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireChemicalDto.class, 1); List<FireChemicalDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireChemicalDto.class, 1);
List<FireChemical> excelEntityList = new ArrayList<>(); List<FireChemical> excelEntityList = new ArrayList<>();
excelDtoList.forEach( excelDtoList.forEach(item -> {
item -> {
FireChemical fireChemical = new FireChemical(); FireChemical fireChemical = new FireChemical();
fireChemical = Bean.toPo(item, fireChemical); fireChemical = Bean.toPo(item, fireChemical);
fireChemical = Bean.toPo(getCurrentInfo(), fireChemical);
if (fireChemical.getType() != null) { if (fireChemical.getType() != null) {
String[] type = fireChemical.getType().split("@"); String[] type = fireChemical.getType().split("@");
fireChemical.setType(type[0]); fireChemical.setType(type[0]);
fireChemical.setTypeCode(type[1]); fireChemical.setTypeCode(type[1]);
} }
excelEntityList.add(fireChemical); excelEntityList.add(fireChemical);
} });
);
fireChemicalServiceImpl.saveBatch(excelEntityList); fireChemicalServiceImpl.saveBatch(excelEntityList);
} }
private void excelImportWaterResource(MultipartFile multipartFile) throws Exception { private void excelImportWaterResource(MultipartFile multipartFile) throws Exception {
List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, WaterResourceDto.class, 1);
WaterResourceDto.class, 1); excelDtoList.forEach(item -> {
excelDtoList.forEach(
item -> {
if (item.getResourceTypeName() != null) { if (item.getResourceTypeName() != null) {
String[] resourceTypeName = item.getResourceTypeName().split("@"); String[] resourceTypeName = item.getResourceTypeName().split("@");
item.setResourceTypeName(resourceTypeName[0]); item.setResourceTypeName(resourceTypeName[0]);
...@@ -685,17 +677,15 @@ public class ExcelServiceImpl { ...@@ -685,17 +677,15 @@ public class ExcelServiceImpl {
item.setType(type[0]); item.setType(type[0]);
item.setTypeCode(type[1]); item.setTypeCode(type[1]);
} }
item = Bean.toPo(getCurrentInfo(), item);
waterResourceServiceImpl.importByExcel(item); waterResourceServiceImpl.importByExcel(item);
} });
);
} }
private void excelImportFireExperts(MultipartFile multipartFile) throws Exception { private void excelImportFireExperts(MultipartFile multipartFile) throws Exception {
List<FireExpertsDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<FireExpertsDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireExpertsDto.class, 1);
FireExpertsDto.class, 1);
List<FireExperts> excelEntityList = new ArrayList<>(); List<FireExperts> excelEntityList = new ArrayList<>();
excelDtoList.forEach( excelDtoList.forEach(fireExpertsDto -> {
fireExpertsDto -> {
FireExperts fireExperts = new FireExperts(); FireExperts fireExperts = new FireExperts();
fireExperts = Bean.toPo(fireExpertsDto, fireExperts); fireExperts = Bean.toPo(fireExpertsDto, fireExperts);
if (fireExperts.getCertificatesType() != null) { if (fireExperts.getCertificatesType() != null) {
...@@ -718,8 +708,7 @@ public class ExcelServiceImpl { ...@@ -718,8 +708,7 @@ public class ExcelServiceImpl {
fireExperts.setHighestEducation(highestEducation[0]); fireExperts.setHighestEducation(highestEducation[0]);
} }
excelEntityList.add(fireExperts); excelEntityList.add(fireExperts);
} });
);
fireExpertsServiceImpl.saveBatch(excelEntityList); fireExpertsServiceImpl.saveBatch(excelEntityList);
} }
...@@ -729,7 +718,8 @@ public class ExcelServiceImpl { ...@@ -729,7 +718,8 @@ public class ExcelServiceImpl {
if (fileName == null) { if (fileName == null) {
throw new Exception("文件不存在!"); throw new Exception("文件不存在!");
} }
if (!fileName.toLowerCase().endsWith(ExcelTypeEnum.XLS.getValue()) && !fileName.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())) { if (!fileName.toLowerCase().endsWith(ExcelTypeEnum.XLS.getValue())
&& !fileName.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())) {
throw new Exception("文件类型异常!"); throw new Exception("文件类型异常!");
} }
InputStream input = multipartFile.getInputStream(); InputStream input = multipartFile.getInputStream();
...@@ -737,7 +727,7 @@ public class ExcelServiceImpl { ...@@ -737,7 +727,7 @@ public class ExcelServiceImpl {
XSSFSheet sheet = workbook.getSheetAt(0); XSSFSheet sheet = workbook.getSheetAt(0);
List<Map<String, Object>> dataList = new ArrayList<>(); List<Map<String, Object>> dataList = new ArrayList<>();
if (sheet != null) { if (sheet != null) {
//获取表头月份 // 获取表头月份
Row titleRow = sheet.getRow(0); Row titleRow = sheet.getRow(0);
Cell monthCell = titleRow.getCell(5); Cell monthCell = titleRow.getCell(5);
String dateStr = monthCell == null ? "" : monthCell.toString(); String dateStr = monthCell == null ? "" : monthCell.toString();
...@@ -754,10 +744,10 @@ public class ExcelServiceImpl { ...@@ -754,10 +744,10 @@ public class ExcelServiceImpl {
} }
private void initDutyCarData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) { private void initDutyCarData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
//遍历行,i = 1,从第二行开始,第一行是表头跳过。 // 遍历行,i = 1,从第二行开始,第一行是表头跳过。
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
DutyCarDto dutyCarDto = new DutyCarDto(); DutyCarDto dutyCarDto = new DutyCarDto();
//row是一行数据,row.getCell(i),代表拿到这一行,第i列数据 // row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
Row row = sheet.getRow(i); Row row = sheet.getRow(i);
if (row == null) { if (row == null) {
continue; continue;
...@@ -804,10 +794,10 @@ public class ExcelServiceImpl { ...@@ -804,10 +794,10 @@ public class ExcelServiceImpl {
} }
private void initDutyPersonData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) { private void initDutyPersonData(XSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
//遍历行,i = 1,从第二行开始,第一行是表头跳过。 // 遍历行,i = 1,从第二行开始,第一行是表头跳过。
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
DutyPersonDto dutyPersonDto = new DutyPersonDto(); DutyPersonDto dutyPersonDto = new DutyPersonDto();
//row是一行数据,row.getCell(i),代表拿到这一行,第i列数据 // row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
Row row = sheet.getRow(i); Row row = sheet.getRow(i);
if (row == null) { if (row == null) {
continue; continue;
...@@ -852,8 +842,8 @@ public class ExcelServiceImpl { ...@@ -852,8 +842,8 @@ public class ExcelServiceImpl {
private void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception { private void excelImportMaintenancePerson(MultipartFile multipartFile) throws Exception {
List<MaintenancePersonExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<MaintenancePersonExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
MaintenancePersonExcleDto.class, 1); MaintenancePersonExcleDto.class, 1);
List<DynamicFormColumn> columns = List<DynamicFormColumn> columns = dynamicFormColumnService.list(
dynamicFormColumnService.list(new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, MAINTENANCE_PERSON)); new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, MAINTENANCE_PERSON));
List<MaintenanceCompany> maintenanceCompanyList = new ArrayList<MaintenanceCompany>(); List<MaintenanceCompany> maintenanceCompanyList = new ArrayList<MaintenanceCompany>();
List<DynamicFormInstance> dynamicFormInstanceList = new ArrayList<DynamicFormInstance>(); List<DynamicFormInstance> dynamicFormInstanceList = new ArrayList<DynamicFormInstance>();
for (MaintenancePersonExcleDto maintenancePersonExcleDto : excelDtoList) { for (MaintenancePersonExcleDto maintenancePersonExcleDto : excelDtoList) {
...@@ -882,18 +872,10 @@ public class ExcelServiceImpl { ...@@ -882,18 +872,10 @@ public class ExcelServiceImpl {
} }
private void excelImportKeySite(MultipartFile multipartFile) throws Exception { private void excelImportKeySite(MultipartFile multipartFile) throws Exception {
List<KeySiteExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, List<KeySiteExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, KeySiteExcleDto.class, 1);
KeySiteExcleDto.class, 1);
keySiteService.saveExcel(excelDtoList); keySiteService.saveExcel(excelDtoList);
} }
public void dutyTemplateExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto, public void dutyTemplateExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto,
String ids) { String ids) {
List<List<Object>> data = new ArrayList<>(); List<List<Object>> data = new ArrayList<>();
...@@ -903,17 +885,16 @@ public class ExcelServiceImpl { ...@@ -903,17 +885,16 @@ public class ExcelServiceImpl {
data = initDutyPersonTemplate(ids); data = initDutyPersonTemplate(ids);
} }
// 获取日期 // 获取日期
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
endDate);
List<String> dayByMonth = new ArrayList<>(); List<String> dayByMonth = new ArrayList<>();
rangeDate.forEach(item -> dayByMonth.add((String) item.get("date"))); rangeDate.forEach(item -> dayByMonth.add((String) item.get("date")));
exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true); exportDutyTemplate(response, excelDto.getClassUrl(), dayByMonth, excelDto, data, true);
} }
public void dutyInfoExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto) throws ParseException { public void dutyInfoExport(HttpServletResponse response, String beginDate, String endDate, ExcelDto excelDto)
throws ParseException {
// 获取日期 // 获取日期
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
endDate);
List<String> dayByMonth = new ArrayList<>(); List<String> dayByMonth = new ArrayList<>();
rangeDate.forEach(item -> dayByMonth.add((String) item.get("date"))); rangeDate.forEach(item -> dayByMonth.add((String) item.get("date")));
List<List<Object>> data = new ArrayList<>(); List<List<Object>> data = new ArrayList<>();
...@@ -983,14 +964,16 @@ public class ExcelServiceImpl { ...@@ -983,14 +964,16 @@ public class ExcelServiceImpl {
return data; return data;
} }
private void exportDutyTemplate(HttpServletResponse response, String classUrl, List<String> dayByMonth, private void exportDutyTemplate(HttpServletResponse response, String classUrl, List<String> dayByMonth,
ExcelDto excelDto, List<? extends Object> data, Boolean flag) { ExcelDto excelDto, List<? extends Object> data, Boolean flag) {
try { try {
// 获取排班类型 // 获取排班类型
String[] dutyNameList = getDutyNameList(); String[] dutyNameList = getDutyNameList();
Class<?> clz = Class.forName(classUrl); Class<?> clz = Class.forName(classUrl);
ExcelUtil.createDutyTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data, ExcelUtil.createDutyTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data, clz,
clz, dayByMonth, dutyNameList, dataSourcesImpl, flag); dayByMonth, dutyNameList, dataSourcesImpl, flag);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -1003,7 +986,8 @@ public class ExcelServiceImpl { ...@@ -1003,7 +986,8 @@ public class ExcelServiceImpl {
return dutyShiftList.toArray(new String[dutyShiftList.size()]); return dutyShiftList.toArray(new String[dutyShiftList.size()]);
} }
private List<List<Object>> initDutyCarInfo(String beginDate, String endDate, List<String> dayByMonth) throws ParseException { private List<List<Object>> initDutyCarInfo(String beginDate, String endDate, List<String> dayByMonth)
throws ParseException {
// 查询已值班数据 // 查询已值班数据
List<DutyCarDto> contentList = dutyCarService.downloadList(beginDate, endDate); List<DutyCarDto> contentList = dutyCarService.downloadList(beginDate, endDate);
List<List<Object>> data = new ArrayList<>(); List<List<Object>> data = new ArrayList<>();
...@@ -1041,7 +1025,8 @@ public class ExcelServiceImpl { ...@@ -1041,7 +1025,8 @@ public class ExcelServiceImpl {
} }
} }
private List<List<Object>> initDutyPersonInfo(String beginDate, String endDate, List<String> dayByMonth) throws ParseException { private List<List<Object>> initDutyPersonInfo(String beginDate, String endDate, List<String> dayByMonth)
throws ParseException {
// 查询已值班数据 // 查询已值班数据
List<DutyPersonDto> contentList = iDutyPersonService.downloadList(beginDate, endDate); List<DutyPersonDto> contentList = iDutyPersonService.downloadList(beginDate, endDate);
List<List<Object>> data = new ArrayList<>(); List<List<Object>> data = new ArrayList<>();
...@@ -1065,8 +1050,6 @@ public class ExcelServiceImpl { ...@@ -1065,8 +1050,6 @@ public class ExcelServiceImpl {
return data; return data;
} }
public void exportByParams(HttpServletResponse response, ExcelDto excelDto, String params) { public void exportByParams(HttpServletResponse response, ExcelDto excelDto, String params) {
switch (excelDto.getType()) { switch (excelDto.getType()) {
...@@ -1077,18 +1060,18 @@ public class ExcelServiceImpl { ...@@ -1077,18 +1060,18 @@ public class ExcelServiceImpl {
break; break;
case "XFZJ": case "XFZJ":
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false); List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireExpertsDtoList,
fireExpertsDtoList, FireExpertsDto.class, dataSourcesImpl, false); FireExpertsDto.class, dataSourcesImpl, false);
break; break;
case "SYXX": case "SYXX":
List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true); List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), waterResourceDtoList,
waterResourceDtoList, WaterResourceDto.class, dataSourcesImpl, false); WaterResourceDto.class, dataSourcesImpl, false);
break; break;
case "HKQ": case "HKQ":
List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false); List<AircraftDto> aircraftDtoList = aircraftServiceImpl.queryAircraftDtoForList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), aircraftDtoList,
aircraftDtoList, AircraftDto.class, dataSourcesImpl, false); AircraftDto.class, dataSourcesImpl, false);
break; break;
case "XFDW": case "XFDW":
List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false); List<FireTeamDto> fireTeamDtoList = fireTeamService.queryFireTeamForList(false);
...@@ -1097,8 +1080,8 @@ public class ExcelServiceImpl { ...@@ -1097,8 +1080,8 @@ public class ExcelServiceImpl {
break; break;
case "WXXFZ": case "WXXFZ":
List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false); List<FireStationDto> fireStationDtoList = fireStationService.queryForFireStationList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireStationDtoList,
fireStationDtoList, FireStationDto.class, null, false); FireStationDto.class, null, false);
break; break;
case "XFRY": case "XFRY":
List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false); List<FirefightersExcelDto> firefightersExcelDtoList = firefightersService.exportToExcel(false);
...@@ -1106,15 +1089,15 @@ public class ExcelServiceImpl { ...@@ -1106,15 +1089,15 @@ public class ExcelServiceImpl {
firefightersExcelDtoList, FirefightersExcelDto.class, null, false); firefightersExcelDtoList, FirefightersExcelDto.class, null, false);
break; break;
case "WBRY": case "WBRY":
List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = List<MaintenancePersonExcleDto> maintenancePersonExcelDtoList = maintenanceCompanyService
maintenanceCompanyService.exportToMaintenancePersonExcel(); .exportToMaintenancePersonExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false); maintenancePersonExcelDtoList, MaintenancePersonExcleDto.class, null, false);
break; break;
case "KEYSITE": case "KEYSITE":
List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel(); List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), keySiteDtoList,
keySiteDtoList, KeySiteExcleDto.class, null, false); KeySiteExcleDto.class, null, false);
break; break;
case "JCDWRY": case "JCDWRY":
// 机场单位人员参数传递为 parentId = xxxxxxx // 机场单位人员参数传递为 parentId = xxxxxxx
...@@ -1126,17 +1109,31 @@ public class ExcelServiceImpl { ...@@ -1126,17 +1109,31 @@ public class ExcelServiceImpl {
throw new BadRequest("导出机场单位时未传递正确parentId"); throw new BadRequest("导出机场单位时未传递正确parentId");
} }
List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportPersonToExcelByParentId(parentId); List<OrgUsrExcelDto> orgUsrList = orgUsrService.exportPersonToExcelByParentId(parentId);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), orgUsrList,
orgUsrList, OrgUsrExcelDto.class, null, false); OrgUsrExcelDto.class, null, false);
break; break;
case "LDDW": case "LDDW":
List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel(); List<LinkageUnitDto> LinkageUnitDtoList = linkageUnitServiceImpl.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), LinkageUnitDtoList,
LinkageUnitDtoList, LinkageUnitDto.class, null, false); LinkageUnitDto.class, null, false);
break; break;
default: default:
break; break;
} }
} }
public BaseEntity getCurrentInfo() {
BaseEntity userModel= new BaseEntity();
/* String keyString= RequestContext.getExeUserId();
String token=RequestContext.getToken();
ReginParams params = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(keyString, token)).toString(),
ReginParams.class);*/
userModel.setRecUserId("3141675");
userModel.setRecUserName("admin_jcs");
userModel.setRecDate( new Date());
userModel.setIsDelete(false);
return userModel;
}
} }
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