Commit fbe6db89 authored by chenhao's avatar chenhao

添加120急救站开发的代码

parent b1e78d84
package com.yeejoin.amos.boot.biz.common.service;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import java.util.List;
......@@ -18,4 +19,6 @@ public interface IDataDictionaryService {
Object gwmcDataDictionary(String type) throws Exception;
List<MenuFrom> getGWMCDataDictionary(String type) throws Exception;
public List<DataDictionary> getByType(String type);
}
......@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.dto.DataDictionaryDto;
......@@ -106,4 +107,10 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
return list;
}
public List<DataDictionary> getByType(String type) {
LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<DataDictionary>();
wrapper.eq(DataDictionary::getIsDelete, false);
wrapper.eq(DataDictionary::getType, type);
return this.baseMapper.selectList(wrapper);
}
}
package com.yeejoin.amos.boot.module.common.api.dto;
import java.io.Serializable;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "DutyFirstAidDto", description = "120急救站值班")
public class DutyFirstAidDto implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "用户名称")
private String userName;
@ApiModelProperty(value = "单位ID")
private String teamId;
@ApiModelProperty(value = "单位名称")
private String teamName;
@ApiModelProperty(value = "岗位id")
private String postType;
@ApiModelProperty(value = "岗位名称")
private String postTypeName;
@ApiModelProperty(value = "值班信息")
private List<DutyPersonShiftDto> dutyShift;
@ApiModelProperty(value = "值班开始时间")
private String startTime;
@ApiModelProperty(value = "值班结束时间")
private String endTime;
@ApiModelProperty(value = "120急救站")
private String firstAid;
@ApiModelProperty(value = "120急救站Id")
private String firstAidId;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import java.io.Serializable;
import java.util.List;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "DutyFirstAidExcleDto", description = "120急救站值班")
public class DutyFirstAidExcleDto implements Serializable{
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "序号", index = 0)
@ApiModelProperty(value = "序号")
private Integer number;
@ExcelIgnore
@ApiModelProperty(value = "单位ID")
private String teamId;
@ExcelProperty(value = "单位名称", index = 1)
@ApiModelProperty(value = "单位名称")
private String teamName;
@ExcelIgnore
@ApiModelProperty(value = "用户id")
private String userId;
@ExcelProperty(value = "用户名称", index = 2)
@ApiModelProperty(value = "用户名称")
private String userName;
@ExcelIgnore
@ApiModelProperty(value = "岗位id")
private String postType;
@ExcelProperty(value = "岗位", index = 3)
@ApiModelProperty(value = "岗位名称")
private String postTypeName;
@ExcelProperty(value = "120急救站", index = 4)
@ApiModelProperty(value = "120急救站")
private String firstAid;
@ExcelIgnore
@ApiModelProperty(value = "120急救站Id")
private String firstAidId;
@ExcelIgnore
@ApiModelProperty(value = "值班信息")
private List<DutyPersonShiftDto> dutyShift;
@ExcelIgnore
@ApiModelProperty(value = "值班开始时间")
private String startTime;
@ExcelIgnore
@ApiModelProperty(value = "值班结束时间")
private String endTime;
}
......@@ -30,5 +30,4 @@ public interface IDutyCarService extends IDutyCommonService {
*/
JSONObject isFireCarDriver();
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType);
}
......@@ -116,4 +116,6 @@ public interface IDutyCommonService {
* @param dutyShiftList
*/
public void insertPersonShift(Long instanceId, List<DutyPersonShiftDto> dutyShiftList);
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType);
}
package com.yeejoin.amos.boot.module.common.api.service;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
public interface IDutyFireFightingService extends IDutyCommonService {
......@@ -17,6 +20,7 @@ public interface IDutyFireFightingService extends IDutyCommonService {
* @return List<DutyCarDto>
*/
DutyFireFightingDto update(Long instanceId, DutyFireFightingDto dto);
List<Map<String, Object>> getFirstAidExportData(List<String> companyIdList);
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType);
}
package com.yeejoin.amos.boot.module.common.api.service;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
public interface IDutyFirstAidService extends IDutyCommonService {
/**
* 值班信息保存
* @param DutyFireFightingDto 对象
* @return List<DutyCarDto>
*/
DutyFirstAidDto save(DutyFirstAidDto dto);
/**
* 更新
* @param instanceId 实例id
* @param DutyFireFightingDto 业务对象
* @return List<DutyCarDto>
*/
DutyFirstAidDto update(Long instanceId, DutyFirstAidDto dto);
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import java.util.List;
import java.util.Map;
/**
* 消防队伍 服务类
......@@ -43,5 +44,7 @@ public interface IFireTeamService {
*
* **/
List<FireTeamZhDto> getFireTeamCountList();
public List<FireTeam> getFirstAidForTypeCodeAndCompanyId(String dicCode,String typeCode,Long companyId);
}
......@@ -239,4 +239,6 @@ public interface IOrgUsrService {
OrgUsr selectByAmosOrgId(Long id);
public List<OrgUsr> getPersonListByParentIds(List<String> ids) ;
}
......@@ -27,6 +27,7 @@ public enum ExcelEnums {
JYZB ("救援装备", "救援装备", "com.yeejoin.amos.boot.module.common.api.dto.RescueEquipmentDto","JYZB"),//("JYZB","救援装备")
XFZB ("消防装备", "消防装备", "com.yeejoin.amos.boot.module.common.api.dto.EquipmentDetailDownloadTemplateDto","XFZB"),//("XFZB","消防装备")
WXXFZB("微型消防站值班", "微型消防站值班", "com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingExcleDto","WXXFZB"),//("WXXFZB","微型消防站值班")
JJZB("120急救站值班", "120急救站值班", "com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidExcleDto","JJZB"),//("JJZB","120急救站值班")
XFAQBG("消防安全报告", "消防安全报告", "com.yeejoin.amos.boot.module.jcs.api.dto.OrgUsrSafeReportExcelDto","XFAQBG");//("XFAQBG","微型消防站值班")
private String fileName;
private String sheetName;
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@RestController
@Api(tags = "120急救站值班接口Api")
@RequestMapping(value = "/common/duty-FirstAid")
public class DutyFirstAidController extends BaseController{
@Autowired
IDutyFirstAidService iDutyFirstAidService;
/**
* 值班列表视图--分页
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page-list")
@ApiOperation(httpMethod = "GET", value = "值班列表视图-分页", notes = "值班列表视图-分页")
public ResponseModel<IPage<Map<String, Object>>> pageList(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "当前页", required = true) @RequestParam(value = "current") int current,
@ApiParam(value = "页面大小", required = true) @RequestParam(value = "size") int size) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.pageList(current, size, beginDate, endDate));
}
/**
* 值班列表视图--不分页
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "值班列表视图-不分页", notes = "值班列表视图-不分页")
public ResponseModel list(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.list(null,beginDate, endDate));
}
/**
* 值班月视图
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/statistics-day")
@ApiOperation(httpMethod = "GET", value = "值班月视图", notes = "值班月视图")
public ResponseModel<List<Map<String, Object>>> dutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.statisticsDay(beginDate, endDate));
}
/**
* 调班
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping("/duty-adjust")
@ApiOperation(httpMethod = "POST", value = "调班保存", notes = "调班保存")
public ResponseModel dutyAdjustSave(@RequestBody DutyFirstAidDto dto) {
return ResponseHelper.buildResponse(iDutyFirstAidService.save(dto));
}
/**
* 调班
*
* @param instanceId 实例id
* @param dutyCarDto 业务对象
* @return DutyCarDto
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping("/duty-adjust")
@ApiOperation(httpMethod = "PUT", value = "调班更新", notes = "调班更新")
public ResponseModel dutyAdjustUpdate(
@RequestParam Long instanceId,
@RequestBody DutyFirstAidDto dto) {
return ResponseHelper.buildResponse(iDutyFirstAidService.update(instanceId, dto));
}
/**
* 微型消防站导出
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/exportExcel")
@ApiOperation(httpMethod = "GET", value = "120急救站导出", notes = "120急救站导出")
public ResponseModel exportExcel(HttpServletResponse response, @ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.downloadList(beginDate, endDate));
}
/**
* 值班数据删除
*
* @param instanceId 实例id
* @param startTime 开始时间
* @param endTime 结束时间
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}/{startTime}/{endTime}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) {
if (ValidationUtil.isEmpty(instanceId)
|| ValidationUtil.isEmpty(startTime)
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
return ResponseHelper.buildResponse(iDutyFirstAidService.deleteDutyData(instanceId, startTime, endTime));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("查询指定日期值班人信息列表")
@GetMapping("/person/{dutyDay}/list")
public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay,
@ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId,
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyFirstAidService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
}
}
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.LinkedHashMap;
......@@ -19,7 +17,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
......
......@@ -36,6 +36,7 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
......@@ -299,6 +300,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
list = jsonArray.toJavaList(DutyPersonDto.class);
}else if("dutyFireFighting".equals(groupCode)){
list = jsonArray.toJavaList(DutyFireFightingDto.class);
}else if("dutyFirstAid".equals(groupCode)){
list = jsonArray.toJavaList(DutyFirstAidDto.class);
}
return list;
}
......@@ -591,4 +594,9 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
}
@Override
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
// TODO Auto-generated method stub
return null;
}
}
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
@Service
public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements IDutyFirstAidService {
@Autowired
IFireTeamService fireTeamService;
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
@Autowired
OrgUsrServiceImpl orgUsrServiceImpl;
@Autowired
DataDictionaryServiceImpl dataDictionaryService;
public String getGroupCode() {
return "dutyFirstAid";
}
@Override
public DutyFirstAidDto save(DutyFirstAidDto dto) {
FireTeam fireStationDtoResult = fireTeamService.getFireTeamBySequenceNbr(Long.parseLong(dto.getFirstAidId()));
dto.setFirstAid(fireStationDtoResult.getName());
Map<String, Object> map = Bean.BeantoMap(dto);
Long instanceId = excuteDynamicFormInstance(dto.getUserId(), map, this.getGroupCode());
saveDutyPersonShiftDetail(instanceId, dto.getDutyShift(), dto.getStartTime());
insertPersonShift(instanceId, dto.getDutyShift());
return dto;
}
@Override
public DutyFirstAidDto update(Long instanceId, DutyFirstAidDto dto) {
updateDynamicFormInstance(this.getGroupCode(), instanceId, Bean.BeantoMap(dto));
insertPersonShift(instanceId, dto.getDutyShift());
return dto;
}
@Override
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "firstAidId", "firstAid", "teamName", "result.firstAidId");
if (equipmentList == null || equipmentList.size() < 1 || equipmentList.get(0) == null) {
return null;
}
List<Object> detailList = new ArrayList<Object>();
for (Map<String, Object> map : equipmentList) {
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
LinkedHashMap<String, Object> titleMap_1 = new LinkedHashMap<String, Object>();
titleMap_1.put("120急救站", map.get("firstAid").toString());
resultList.add(titleMap_1);
LinkedHashMap<String, Object> titleMap_2 = new LinkedHashMap<String, Object>();
titleMap_2.put("单位/部门", map.get("teamName").toString());
resultList.add(titleMap_2);
String carId = map.get("firstAidId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
this.getGroupCode(), carId);
if (instanceMap == null) {
continue;
}
String instanceId = instanceMap.get("instanceIds").toString();
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
if (dutyList != null && dutyList.size() > 0) {
for (Map<String, Object> dutyDetail : dutyList) {
if (!dutyDetail.containsKey("name")) {
continue;
}
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper
.getPositionStaffDutyForSpecifyDate(dutyDay, this.getGroupCode(), instanceIds,
dutyDetail.get("name").toString());
if (specifyDateList == null || specifyDateList.size() < 1 || specifyDateList.get(0) == null) {
continue;
}
LinkedHashMap<String, Object> infoMap_1 = new LinkedHashMap<String, Object>();
infoMap_1.put(dutyDetail.get("name").toString(), "");
resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 = new LinkedHashMap<String, Object>();
infoMap_2.put(specify.get("postTypeName").toString(), specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
}
detailList.add(resultList);
}
return detailList;
}
public List< Map<String, Object>> getFirstAidExportData(List<String> ids) {
List< Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
String dicCodeString = "830";
String typeString = "XFJGLX";
List<OrgUsr> personList = orgUsrServiceImpl.getPersonListByParentIds(ids);
personList.stream().forEach(i -> {
String userNameString =i.getBizOrgName()+ "@" +i.getSequenceNbr();
Map<String, Object> map = new HashMap<String, Object>();
List<FireTeam> list = fireTeamService.getFirstAidForTypeCodeAndCompanyId(dicCodeString, typeString,
Long.parseLong(i.getParentId()));
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companySimpleList = new ArrayList<String>();
list.stream().forEach(m -> {
String firstAidNameString = m.getName() + "@" + m.getSequenceNbr();
String companyNameString = m.getCompanyName() + "@" + m.getCompany();
firstAidSimpleList.add(firstAidNameString);
companySimpleList.add(companyNameString);
});
List<DataDictionary> dataDicList= dataDictionaryService.getByType(typeString);
List<String> dataDicSimpleList = new ArrayList<String>();
dataDicList.stream().forEach(l->{
String dataDic = l.getName() + "@" +l.getCode();
dataDicSimpleList.add(dataDic);
});
map.put("firstAidName", firstAidSimpleList);
map.put("companyName", companySimpleList);
map.put("userName", userNameString);
map.put("postTypeName",dataDicSimpleList);
resultList.add(map);
});
return resultList;
}
}
......@@ -1527,6 +1527,19 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
wrapper.eq(OrgUsr::getBizOrgType, OrgPersonEnum.人员.getKey());
return this.baseMapper.selectList(wrapper);
}
/**
* 查询组织机构下面的人员信息
*
* @param id
* @return
*/
public List<OrgUsr> getPersonListByParentIds(List<String> ids) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
wrapper.in(OrgUsr::getParentId, ids);
wrapper.eq(OrgUsr::getBizOrgType, OrgPersonEnum.人员.getKey());
return this.baseMapper.selectList(wrapper);
}
@Override
public List<OrgUsrExcelDto> exportPersonToExcelByParentId(Long parentId) {
......
......@@ -243,4 +243,11 @@ public class FireTeamController extends BaseController {
List<FirefightersDto> fighters = iFireTeamService.getFighterByTeamId(teamIdList);
return ResponseHelper.buildResponse(fighters);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/firstAid", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "急救站", notes = "急救站")
public Object getFirstAidForTypeCodeAndCompanyId(String code, String typeCode,Long companyId) {
return ResponseHelper.buildResponse(iFireTeamService.getFirstAidForTypeCodeAndCompanyId(code,typeCode,companyId));
}
}
\ No newline at end of file
......@@ -1187,6 +1187,8 @@ public class ExcelServiceImpl {
data = initDutyPersonTemplate(ids);
} else if (ExcelEnums.WXXFZB.getType().equals(excelDto.getType())) {
data = initDutyDutyFireFightingTemplate(ids);
} else if (ExcelEnums.JJZB.getType().equals(excelDto.getType())) {
//data = initDutyDutyFirstAidTemplate(ids);
}
// 获取日期
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
......@@ -1199,7 +1201,29 @@ public class ExcelServiceImpl {
}
}
private List<List<Object>> initDutyDutyFirstAidTemplate(String ids) {
List<List<Object>> data = new ArrayList<>();
// 根据id列表获取单位下的微型消防站集合
List<String> companyIdList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(ids)) {
companyIdList = Lists.newArrayList(ids.split(","));
}
List<Map<String, Object>> personDetailList = dutyFireFightingService.getFirstAidExportData(companyIdList);
if (!personDetailList.isEmpty()) {
AtomicInteger row = new AtomicInteger(1);
personDetailList.forEach(o -> {
ArrayList<Object> list = new ArrayList<>();
list.add(row.getAndIncrement());
list.add(null);
list.add(null);
list.add(null);
list.add(o.get("fireStation"));
data.add(list);
});
}
return data;
}
private List<List<Object>> initDutyDutyFireFightingTemplate(String ids) {
List<List<Object>> data = new ArrayList<>();
// 根据id列表获取单位下的微型消防站集合
......
......@@ -10,7 +10,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
......@@ -55,341 +56,352 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceService
* @date 2021-06-07
*/
@Service
public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, FireTeamMapper> implements IFireTeamService {
@Resource
FireTeamMapper fireTeamMapper;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
OrgUsrServiceImpl orgUsrService;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
/**
* 获取监控大队列表
*
* @return
*/
public List<FireBrigadeResourceDto> listMonitorFireBrigade(String code) {
return fireTeamMapper.listMonitorFireBrigade(code);
}
/**
* 消防队伍分页查询
*
* @param page 分页对象
* @param team 查询参数
* @return
*/
public IPage<FireTeamCardDto> listFireTeamByPage(Page page, FireTeamListDto team) {
// 获取消防车辆列表
ResponseModel<Object> result = equipFeignClient.getFireCarListAll();
Map<Object, Long> teamCarCountMap = Maps.newConcurrentMap();
if (!ValidationUtil.isEmpty(result)) {
List<Map<String, Object>> fireCarListMapList = (List<Map<String, Object>>) result.getResult();
if (!ValidationUtil.isEmpty(fireCarListMapList)) {
teamCarCountMap =
fireCarListMapList.stream().filter(car -> !ValidationUtil.isEmpty(car.get("teamId"))).collect(Collectors.groupingBy(car -> car.get(
"teamId"), Collectors.counting()));
}
}
// 查询单位
if (Objects.equals("1", team.getNodeType())) {
List<OrgUsr> companyDeptList = orgUsrService.listOrgUserById(team.getNodeId());
team.setNodeIds(companyDeptList.stream().map(e -> e.getSequenceNbr().toString()).collect(Collectors.toList()));
}
// 查询队伍
if (Objects.equals("0", team.getNodeType())) {
List<FireTeam> teamList = listFireTeamById(team.getNodeId());
team.setNodeIds(teamList.stream().map(e -> e.getSequenceNbr().toString()).collect(Collectors.toList()));
}
IPage<FireTeamCardDto> fireTeamListPage = this.baseMapper.getFireTeamForPage(page, team);
List<FireTeamCardDto> fireTeamList = fireTeamListPage.getRecords();
Map<Object, Long> finalTeamCarCountMap = teamCarCountMap;
fireTeamList.forEach(t -> {
//递归返回teamId bug2684 bykongfm
List<Long> teamIds = new ArrayList<Long>();
getAllTeamId(teamIds,t.getSequenceNbr());
int carNum = 0;
int fighterNum = 0;
for(Long tempId : teamIds ) {
if(finalTeamCarCountMap.get(tempId.toString()) != null) {
carNum += finalTeamCarCountMap.get(tempId.toString()).intValue();
}
fighterNum += fireTeamMapper.getFighterNumByTeamId(tempId);
}
t.setCarNum(carNum);
t.setFighterNum(fighterNum);
/*//递归查找全部战备人数 BUG2217 bykongfmfirefighters/1435850387868385282
t.setFighterNum(getFightNumByTeamId(t.getSequenceNbr()));*/
});
fireTeamListPage.setRecords(fireTeamList);
return fireTeamListPage;
}
public List<FireTeam> listFireTeamById(Long teamId) {
return this.baseMapper.listFireTeamById(teamId);
}
public List<FireTeamDto> queryFireTeamForList(Boolean isDelete) {
return fireTeamMapper.listFireTeamDto(isDelete);
}
/**
* 根据列表构造队伍树
*
* @param columnMap 查询列表条件
* @return 队伍树
* @throws Exception
*/
public List<Menu> getTeamTree(Map<String, Object> columnMap) throws Exception {
Collection<FireTeam> list = this.listByMap(columnMap);
return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName",
"getParent", null);
}
/**
* 获取机场单位-队伍树
*
* @return
*/
public List<MenuFrom> getCompanyTeamTree() throws Exception {
MenuFrom root = new MenuFrom("-1", "消防队伍", null, null);
// 机场单位
//bug:2457需求要求不显示部门,因此更换方法 by 陈浩 2021-08-18
// List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg();
List<OrgUsr> companyDeptList = orgUsrService.selectCompanyList();
List<MenuFrom> companyDeptMenuList = Lists.newArrayList();
companyDeptList.forEach(o -> {
if (ValidationUtil.isEmpty(o.getParentId())) {
o.setParentId("-1");
}
companyDeptMenuList.add(new MenuFrom(o.getSequenceNbr().toString(), o.getBizOrgName(), o.getParentId(),
"1"));
});
// 消防队伍
List<MenuFrom> teamMenuList = Lists.newArrayList();
List<FireTeamDto> teamList = this.queryFireTeamForList(false);
teamList.forEach(team -> {
if (ValidationUtil.isEmpty(team.getParent())) {
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
team.setParent(team.getCompany());
}
teamMenuList.add(new MenuFrom(team.getSequenceNbr().toString(), team.getName(),
team.getParent().toString(), "0"));
});
companyDeptMenuList.addAll(teamMenuList);
List<MenuFrom> menuList = TreeParser.getTreexin("-1", companyDeptMenuList, MenuFrom.class.getName(), "getKey",
1, "getName", "getParentId", "getNodeType");
root.setChildren(menuList);
return Lists.newArrayList(root);
}
/**
* 根据队伍id查询队伍下人员列表
*
* @param teamIds
* @return
*/
public List<FirefightersDto> getFighterByTeamId(List<String> teamIds) {
return this.baseMapper.queryFighterByTeamId(teamIds);
}
public FireTeam saveFireTeam(FireTeam fireTeam) {
if(fireTeam.getAddress()!=null){
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(fireTeam.getAddress());
fireTeam.setAddress(address.getString(BizConstant.ADDRESS));
fireTeam.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
fireTeam.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
if (ValidationUtil.isEmpty(fireTeam.getParent())) {
fireTeam.setTreeCode(TreeParser.genTreeCode());
} else {
FireTeam parentTeam = getById(fireTeam.getParent());
fireTeam.setTreeCode(parentTeam.getTreeCode() + TreeParser.genTreeCode());
}
DataDictionary dataDictionary = iDataDictionaryService.getById(fireTeam.getTypeCode());
if (null != dataDictionary) {
fireTeam.setType(dataDictionary.getName());
}
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) {
save(fireTeam);
} else {
updateById(fireTeam);
}
return fireTeam;
}
public static JSONObject getLongLatFromAddress(String address) {
JSONObject result = new JSONObject();
result.put(BizConstant.ADDRESS, "");
result.put(BizConstant.LONGITUDE, "0");
result.put(BizConstant.LATITUDE, "0");
if (StringUtils.isNotEmpty(address)) {
String[] addressData = address.split("@address@");
if (addressData.length > 1) {
result.put(BizConstant.ADDRESS, addressData[0]);
JSONObject langLatObj = JSON.parseObject(addressData[1]);
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LONGITUDE))) {
result.put(BizConstant.LONGITUDE, langLatObj.getString(BizConstant.LONGITUDE));
} else {
result.put(BizConstant.LONGITUDE, "0");
}
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LATITUDE))) {
result.put(BizConstant.LATITUDE, langLatObj.getString(BizConstant.LATITUDE));
} else {
result.put(BizConstant.LATITUDE, "0");
}
} else {
result.put(BizConstant.ADDRESS, addressData[0]);
}
}
return result;
}
/**
* 根据id删除队伍
*
* @param parent
*/
public void deleteById(Long parent) throws Exception {
// 查询是否有下属队伍
// List<FireTeamDto> fireTeamList = queryForList(null, false, parent);
/*3026 【web】日常管理>机场单位,删除有级联数据的部门时,应无法直接删除 chenzhao 2021-09-28 start*/
LambdaQueryWrapper<FireTeam> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireTeam::getParent,parent);
wrapper.eq(BaseEntity::getIsDelete,0);
List<FireTeam> fireTeams = baseMapper.selectList(wrapper);
/*3026 【web】日常管理>机场单位,删除有级联数据的部门时,应无法直接删除 chenzhao 2021-09-28 end*/
if (!ValidationUtil.isEmpty(fireTeams) && fireTeams.size() > 0) {
// 有下属队伍不能删除
throw new BaseException("该队伍下有下级队伍,不能删除", null, "该队伍下有下级队伍,不能删除");
}
update(new UpdateWrapper<FireTeam>().eq("sequence_nbr", parent).set("is_delete", 1));
}
@Override
public List<FireTeamZhDto> getFireTeamList(Integer pageNum, Integer pageSize, RequestData par) {
if (null == pageNum || null == pageSize) {
pageNum = 1;
pageSize = Integer.MAX_VALUE;
} else {
pageNum = (pageNum - 1) * pageSize;
}
List<FireTeamZhDto> list = fireTeamMapper.getFireTeamList(pageNum, pageSize, par);
// 获取消防车辆列表
ResponseModel<List<Map<String, Object>>> result = equipFeignClient.getFireCarListAllcount();
List<Map<String, Object>> result1 = result.getResult();
list.forEach(fireTeamZhDto -> {
Long sequenceNbr = fireTeamZhDto.getSequenceNbr();
result1.forEach(map -> {
String mapId = String.valueOf(map.get("teamId"));
if(String.valueOf(sequenceNbr).equals(mapId)){
Integer carNum = Integer.valueOf(map.get("carNum").toString());
fireTeamZhDto.setCarNum(carNum);
}
});
});
/*
if(result1!=null&&result1.size()>0){
Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj ->{
combineResultMap.put(obj.get("teamId").toString(),obj.get("carNum"));
});
list.stream().forEach(obj ->{
if(combineResultMap.containsKey(obj.getSequenceNbr())){
obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr()).toString()));
}
});
}*/
return list;
}
@Override
public Integer getFireTeamListCount(RequestData par) {
return fireTeamMapper.getFireTeamListCount(par);
}
@Override
public FireTeam getFireTeamBySequenceNbr(Long id) {
return this.getById(id);
}
@Override
public List<FireTeamZhDto> getFireTeamCountList() {
List<FireTeamZhDto> list = fireTeamMapper.getFireTeamCountList();
// 获取消防车辆列表
ResponseModel<List<Map<String, Object>>> result = equipFeignClient.getFireCarListAllcount();
List<Map<String, Object>> result1 = result.getResult();
if (result1 != null && result1.size() > 0) {
Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj -> {
combineResultMap.put(obj.get("teamId").toString(), obj.get("carNum"));
});
list.stream().forEach(obj -> {
if (combineResultMap.containsKey(obj.getSequenceNbr().toString())) {
obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr().toString()).toString()));
}
});
}
return list;
}
public Integer getFightNumByTeamId(Long teamId) {
Integer count = 0;
// 获取自己的数据
count += fireTeamMapper.getFighterNumByTeamId(teamId);
// 获取下部分数据
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FireTeam::getParent, teamId).eq(FireTeam::getIsDelete, false);
List<FireTeam> fireTeamList = this.list(queryWrapper);
if (fireTeamList.size() == 0) {
return count;
} else {
for (FireTeam t : fireTeamList) {
count += getFightNumByTeamId(t.getSequenceNbr());
}
}
// 获取子集数据
return count;
}
public void getAllTeamId(List<Long> teamIds, Long teamId) {
teamIds.add(teamId);
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FireTeam::getParent, teamId).eq(FireTeam::getIsDelete, false);
List<FireTeam> fireTeamList = this.list(queryWrapper);
if (fireTeamList.size() == 0) {
// 没有下级单位
} else {
for (FireTeam t : fireTeamList) {
getAllTeamId(teamIds, t.getSequenceNbr());
}
}
}
public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, FireTeamMapper>
implements IFireTeamService {
@Resource
FireTeamMapper fireTeamMapper;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
OrgUsrServiceImpl orgUsrService;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
/**
* 获取监控大队列表
*
* @return
*/
public List<FireBrigadeResourceDto> listMonitorFireBrigade(String code) {
return fireTeamMapper.listMonitorFireBrigade(code);
}
/**
* 消防队伍分页查询
*
* @param page 分页对象
* @param team 查询参数
* @return
*/
public IPage<FireTeamCardDto> listFireTeamByPage(Page page, FireTeamListDto team) {
// 获取消防车辆列表
ResponseModel<Object> result = equipFeignClient.getFireCarListAll();
Map<Object, Long> teamCarCountMap = Maps.newConcurrentMap();
if (!ValidationUtil.isEmpty(result)) {
List<Map<String, Object>> fireCarListMapList = (List<Map<String, Object>>) result.getResult();
if (!ValidationUtil.isEmpty(fireCarListMapList)) {
teamCarCountMap = fireCarListMapList.stream().filter(car -> !ValidationUtil.isEmpty(car.get("teamId")))
.collect(Collectors.groupingBy(car -> car.get("teamId"), Collectors.counting()));
}
}
// 查询单位
if (Objects.equals("1", team.getNodeType())) {
List<OrgUsr> companyDeptList = orgUsrService.listOrgUserById(team.getNodeId());
team.setNodeIds(
companyDeptList.stream().map(e -> e.getSequenceNbr().toString()).collect(Collectors.toList()));
}
// 查询队伍
if (Objects.equals("0", team.getNodeType())) {
List<FireTeam> teamList = listFireTeamById(team.getNodeId());
team.setNodeIds(teamList.stream().map(e -> e.getSequenceNbr().toString()).collect(Collectors.toList()));
}
IPage<FireTeamCardDto> fireTeamListPage = this.baseMapper.getFireTeamForPage(page, team);
List<FireTeamCardDto> fireTeamList = fireTeamListPage.getRecords();
Map<Object, Long> finalTeamCarCountMap = teamCarCountMap;
fireTeamList.forEach(t -> {
// 递归返回teamId bug2684 bykongfm
List<Long> teamIds = new ArrayList<Long>();
getAllTeamId(teamIds, t.getSequenceNbr());
int carNum = 0;
int fighterNum = 0;
for (Long tempId : teamIds) {
if (finalTeamCarCountMap.get(tempId.toString()) != null) {
carNum += finalTeamCarCountMap.get(tempId.toString()).intValue();
}
fighterNum += fireTeamMapper.getFighterNumByTeamId(tempId);
}
t.setCarNum(carNum);
t.setFighterNum(fighterNum);
/*
* //递归查找全部战备人数 BUG2217 bykongfmfirefighters/1435850387868385282
* t.setFighterNum(getFightNumByTeamId(t.getSequenceNbr()));
*/
});
fireTeamListPage.setRecords(fireTeamList);
return fireTeamListPage;
}
public List<FireTeam> listFireTeamById(Long teamId) {
return this.baseMapper.listFireTeamById(teamId);
}
public List<FireTeamDto> queryFireTeamForList(Boolean isDelete) {
return fireTeamMapper.listFireTeamDto(isDelete);
}
/**
* 根据列表构造队伍树
*
* @param columnMap 查询列表条件
* @return 队伍树
* @throws Exception
*/
public List<Menu> getTeamTree(Map<String, Object> columnMap) throws Exception {
Collection<FireTeam> list = this.listByMap(columnMap);
return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null);
}
/**
* 获取机场单位-队伍树
*
* @return
*/
public List<MenuFrom> getCompanyTeamTree() throws Exception {
MenuFrom root = new MenuFrom("-1", "消防队伍", null, null);
// 机场单位
// bug:2457需求要求不显示部门,因此更换方法 by 陈浩 2021-08-18
// List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg();
List<OrgUsr> companyDeptList = orgUsrService.selectCompanyList();
List<MenuFrom> companyDeptMenuList = Lists.newArrayList();
companyDeptList.forEach(o -> {
if (ValidationUtil.isEmpty(o.getParentId())) {
o.setParentId("-1");
}
companyDeptMenuList
.add(new MenuFrom(o.getSequenceNbr().toString(), o.getBizOrgName(), o.getParentId(), "1"));
});
// 消防队伍
List<MenuFrom> teamMenuList = Lists.newArrayList();
List<FireTeamDto> teamList = this.queryFireTeamForList(false);
teamList.forEach(team -> {
if (ValidationUtil.isEmpty(team.getParent())) {
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
team.setParent(team.getCompany());
}
teamMenuList.add(
new MenuFrom(team.getSequenceNbr().toString(), team.getName(), team.getParent().toString(), "0"));
});
companyDeptMenuList.addAll(teamMenuList);
List<MenuFrom> menuList = TreeParser.getTreexin("-1", companyDeptMenuList, MenuFrom.class.getName(), "getKey",
1, "getName", "getParentId", "getNodeType");
root.setChildren(menuList);
return Lists.newArrayList(root);
}
/**
* 根据队伍id查询队伍下人员列表
*
* @param teamIds
* @return
*/
public List<FirefightersDto> getFighterByTeamId(List<String> teamIds) {
return this.baseMapper.queryFighterByTeamId(teamIds);
}
public FireTeam saveFireTeam(FireTeam fireTeam) {
if (fireTeam.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(fireTeam.getAddress());
fireTeam.setAddress(address.getString(BizConstant.ADDRESS));
fireTeam.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
fireTeam.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
if (ValidationUtil.isEmpty(fireTeam.getParent())) {
fireTeam.setTreeCode(TreeParser.genTreeCode());
} else {
FireTeam parentTeam = getById(fireTeam.getParent());
fireTeam.setTreeCode(parentTeam.getTreeCode() + TreeParser.genTreeCode());
}
DataDictionary dataDictionary = iDataDictionaryService.getById(fireTeam.getTypeCode());
if (null != dataDictionary) {
fireTeam.setType(dataDictionary.getName());
}
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) {
save(fireTeam);
} else {
updateById(fireTeam);
}
return fireTeam;
}
public static JSONObject getLongLatFromAddress(String address) {
JSONObject result = new JSONObject();
result.put(BizConstant.ADDRESS, "");
result.put(BizConstant.LONGITUDE, "0");
result.put(BizConstant.LATITUDE, "0");
if (StringUtils.isNotEmpty(address)) {
String[] addressData = address.split("@address@");
if (addressData.length > 1) {
result.put(BizConstant.ADDRESS, addressData[0]);
JSONObject langLatObj = JSON.parseObject(addressData[1]);
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LONGITUDE))) {
result.put(BizConstant.LONGITUDE, langLatObj.getString(BizConstant.LONGITUDE));
} else {
result.put(BizConstant.LONGITUDE, "0");
}
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LATITUDE))) {
result.put(BizConstant.LATITUDE, langLatObj.getString(BizConstant.LATITUDE));
} else {
result.put(BizConstant.LATITUDE, "0");
}
} else {
result.put(BizConstant.ADDRESS, addressData[0]);
}
}
return result;
}
/**
* 根据id删除队伍
*
* @param parent
*/
public void deleteById(Long parent) throws Exception {
// 查询是否有下属队伍
// List<FireTeamDto> fireTeamList = queryForList(null, false, parent);
/* 3026 【web】日常管理>机场单位,删除有级联数据的部门时,应无法直接删除 chenzhao 2021-09-28 start */
LambdaQueryWrapper<FireTeam> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireTeam::getParent, parent);
wrapper.eq(BaseEntity::getIsDelete, 0);
List<FireTeam> fireTeams = baseMapper.selectList(wrapper);
/* 3026 【web】日常管理>机场单位,删除有级联数据的部门时,应无法直接删除 chenzhao 2021-09-28 end */
if (!ValidationUtil.isEmpty(fireTeams) && fireTeams.size() > 0) {
// 有下属队伍不能删除
throw new BaseException("该队伍下有下级队伍,不能删除", null, "该队伍下有下级队伍,不能删除");
}
update(new UpdateWrapper<FireTeam>().eq("sequence_nbr", parent).set("is_delete", 1));
}
@Override
public List<FireTeamZhDto> getFireTeamList(Integer pageNum, Integer pageSize, RequestData par) {
if (null == pageNum || null == pageSize) {
pageNum = 1;
pageSize = Integer.MAX_VALUE;
} else {
pageNum = (pageNum - 1) * pageSize;
}
List<FireTeamZhDto> list = fireTeamMapper.getFireTeamList(pageNum, pageSize, par);
// 获取消防车辆列表
ResponseModel<List<Map<String, Object>>> result = equipFeignClient.getFireCarListAllcount();
List<Map<String, Object>> result1 = result.getResult();
list.forEach(fireTeamZhDto -> {
Long sequenceNbr = fireTeamZhDto.getSequenceNbr();
result1.forEach(map -> {
String mapId = String.valueOf(map.get("teamId"));
if (String.valueOf(sequenceNbr).equals(mapId)) {
Integer carNum = Integer.valueOf(map.get("carNum").toString());
fireTeamZhDto.setCarNum(carNum);
}
});
});
/*
*
* if(result1!=null&&result1.size()>0){ Map<String, Object> combineResultMap =
* new HashMap<String, Object>(); result1.stream().forEach(obj ->{
* combineResultMap.put(obj.get("teamId").toString(),obj.get("carNum")); });
* list.stream().forEach(obj ->{
* if(combineResultMap.containsKey(obj.getSequenceNbr())){
* obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr()).
* toString())); } }); }
*/
return list;
}
@Override
public Integer getFireTeamListCount(RequestData par) {
return fireTeamMapper.getFireTeamListCount(par);
}
@Override
public FireTeam getFireTeamBySequenceNbr(Long id) {
return this.getById(id);
}
@Override
public List<FireTeamZhDto> getFireTeamCountList() {
List<FireTeamZhDto> list = fireTeamMapper.getFireTeamCountList();
// 获取消防车辆列表
ResponseModel<List<Map<String, Object>>> result = equipFeignClient.getFireCarListAllcount();
List<Map<String, Object>> result1 = result.getResult();
if (result1 != null && result1.size() > 0) {
Map<String, Object> combineResultMap = new HashMap<String, Object>();
result1.stream().forEach(obj -> {
combineResultMap.put(obj.get("teamId").toString(), obj.get("carNum"));
});
list.stream().forEach(obj -> {
if (combineResultMap.containsKey(obj.getSequenceNbr().toString())) {
obj.setCarNum(Integer.valueOf(combineResultMap.get(obj.getSequenceNbr().toString()).toString()));
}
});
}
return list;
}
public Integer getFightNumByTeamId(Long teamId) {
Integer count = 0;
// 获取自己的数据
count += fireTeamMapper.getFighterNumByTeamId(teamId);
// 获取下部分数据
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FireTeam::getParent, teamId).eq(FireTeam::getIsDelete, false);
List<FireTeam> fireTeamList = this.list(queryWrapper);
if (fireTeamList.size() == 0) {
return count;
} else {
for (FireTeam t : fireTeamList) {
count += getFightNumByTeamId(t.getSequenceNbr());
}
}
// 获取子集数据
return count;
}
public void getAllTeamId(List<Long> teamIds, Long teamId) {
teamIds.add(teamId);
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FireTeam::getParent, teamId).eq(FireTeam::getIsDelete, false);
List<FireTeam> fireTeamList = this.list(queryWrapper);
if (fireTeamList.size() == 0) {
// 没有下级单位
} else {
for (FireTeam t : fireTeamList) {
getAllTeamId(teamIds, t.getSequenceNbr());
}
}
}
/**
* 加载系统中本单位消防队伍中类型为【企(事)业单位医疗救援队(站)】的队伍 --->急救站
* @param typeCode
*/
public List<FireTeam> getFirstAidForTypeCodeAndCompanyId(String dicCode,String typeCode,Long companyId) {
DataDictionary dataDictionary = iDataDictionaryService.getByCode(dicCode,typeCode);
if (ObjectUtils.isEmpty(dataDictionary)) {
return null;
}
String code = dataDictionary.getCode();
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<FireTeam>();
queryWrapper.eq(FireTeam::getTypeCode, code);
queryWrapper.eq(FireTeam::getIsDelete, false);
queryWrapper.eq(FireTeam::getCompany, companyId);
return this.baseMapper.selectList(queryWrapper);
}
}
......@@ -1753,14 +1753,34 @@
</changeSet>
<changeSet id="2021-10-14" author="chenhao-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_group" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_dynamic_form_group"/>
</preConditions>
<comment>add data cb_dynamic_form_group</comment>
<sql>
INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674816', '值班120急救站', 'dutyFirstAid', '0', NULL, '10', '1', NULL, NULL, '2021-10-14 16:48:41', '\0');
</sql>
</changeSet>
<changeSet id="2021-10-14" author="chenhao-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_column" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_dynamic_form_column"/>
</preConditions>
<comment>add data cb_dynamic_form_column</comment>
<sql>
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812077', 'userId', '用户id', 'input', '132828674816', 'eq', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812078', 'userName', '用户名称', 'input', '132828674816', 'like', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812079', 'postType', '岗位id', 'input', '132828674816', 'eq', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812080', 'postTypeName', '岗位名称', 'input', '132828674816', 'like', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812081', 'firstAid', '120急救站', 'input', '132828674816', 'like', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812082', 'firstAidId', '120急救站Id', 'input', '132828674816', 'eq', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812083', 'teamId', '单位名称id', 'input', '132828674816', 'eq', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812084', 'teamName', '单位名称', 'input', '132828674816', 'like', '\0', '\0', 'dutyFirstAid', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
INSERT INTO cb_dynamic_form_column (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812076', 'teamName', '单位名称', 'input', '132828674815', 'like', '\0', '\0', 'dutyFireFighting', NULL, NULL, NULL, '2021-09-28 10:34:05', '\0', NULL, NULL, NULL);
</sql>
</changeSet>
</databaseChangeLog>
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