Commit 667c954e authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/developer' into develop

# Conflicts: # amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/DutyCarController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/IDutyCommonService.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyCommonServiceImpl.java
parents f7d4a0b0 44686417
......@@ -587,6 +587,7 @@ public class DateUtils {
e.printStackTrace();
}
return now;
}
public static void main(String[] args) throws Exception {
......@@ -600,7 +601,8 @@ public class DateUtils {
/*
System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
//System.out.println(dateFormat(dateAddMonths(dateParse("2017-02-07", StrUtils.MONTH_PATTERN), -12), StrUtils.MONTH_PATTERN));
//System.out.println(dateFormat(dateAddMonths(dateParse("2017-02-07", StrUtils.MONTH_PATTERN), -12), StrUtils
// .MONTH_PATTERN));
/*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
}
......
......@@ -6,6 +6,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;
/**
* 生成树工具类
......@@ -328,5 +329,15 @@ public class TreeParser {
return childList;
}
public static String genTreeCode() {
int length = 6;
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random = new Random();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = random.nextInt(62);
sb.append(str.charAt(number));
}
return sb.toString();
}
}
package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 值班班次
*
* @author system_generator
* @date 2021-07-06
*/
@Data
@ApiModel(value = "DutyCarDto", description = "值班车辆")
public class DutyCarExcelDto 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;
@ExcelIgnore
@ApiModelProperty(value = "车辆id")
private String carId;
@ExplicitConstraint(indexNum = 4, sourceClass = RoleNameExplicitConstraint.class, method = "getCarList") //固定下拉内容
@ExcelProperty(value = "车辆名称(车牌)", index = 4)
@ApiModelProperty(value = "车辆名称")
private String carName;
@ExcelIgnore
@ApiModelProperty(value = "值班信息")
private List<DutyPersonShiftDto> dutyShift = new ArrayList<>();
}
package com.yeejoin.amos.boot.module.common.api.dto;
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;
import java.io.Serializable;
import java.util.List;
/**
* 值班班次
*
* @author system_generator
* @date 2021-07-06
*/
@Data
@ApiModel(value = "DutyPersonDto", description = "值班人")
public class DutyPersonExcelDto implements Serializable {
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "序号", index = 0)
@ApiModelProperty(value = "序号")
private Integer number;
@ExcelProperty(value = "用户id", index = 1)
@ApiModelProperty(value = "用户id")
private String userId;
@ExcelProperty(value = "姓名", index = 2)
@ApiModelProperty(value = "用户名称")
private String userName;
@ExcelIgnore
@ApiModelProperty(value = "部门id")
private String deptId;
@ExcelIgnore
@ApiModelProperty(value = "部门名称")
private String deptName;
@ApiModelProperty(value = "岗位id")
private String postType;
@ApiModelProperty(value = "岗位名称")
private String postTypeName;
@ApiModelProperty(value = "值班信息")
private List<DutyPersonShiftDto> dutyShift;
}
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.enums.ExcelSelectData;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint;
......
......@@ -38,4 +38,7 @@ public class FireTeamCardDto {
private Integer dispatchNum;
@ApiModelProperty(value = "执勤数量")
private Integer onDutyNum;
@ApiModelProperty(value = "树结构层级code")
private String treeCode;
}
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
*
* @author DELL
......@@ -27,4 +29,7 @@ public class FireTeamListDto {
@ApiModelProperty(value = "树节点id")
private Long nodeId;
@ApiModelProperty(value = "树节点子节点id集合")
private List<String> nodeIds;
}
......@@ -68,7 +68,7 @@ public class FirefightersExcelDto extends BaseDto {
private Date birthdayTime;
@ExplicitConstraint(indexNum = 7, source = {"男", "女"}) //固定下拉内容
@ExcelProperty(value = "性别", index = 5)
@ExcelProperty(value = "性别", index = 7)
@ApiModelProperty(value = "性别")
private String gender;
......
......@@ -80,4 +80,6 @@ public class FireTeam extends BaseEntity {
@TableField(fill=FieldFill.INSERT_UPDATE)
private String recUserName;
@ApiModelProperty(value = "树结构层级code")
private String treeCode;
}
package com.yeejoin.amos.boot.module.common.api.enums;
/**
* @Author: Xing Lei
* @Description:
* @Date: 2020/4/7 13:50
*/
public enum TitleEnum {
NUMBER("序号", "number"),
FIRE_TEAM("消防队伍", "teamName"),
USER_ID("用户ID", "userId"),
USER_NAME("姓名", "userName"),
POST("岗位", "post"),
CAR("车辆", "carName"),
ARRANGE("班次", "arrange");
TitleEnum(String name, String key) {
this.name = name;
this.key = key;
}
private String name;
private String key;
public String getName() {
return name;
}
public String getKey() {
return key;
}
}
package com.yeejoin.amos.boot.module.common.api.excel;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams;
import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler;
import org.apache.poi.ss.usermodel.*;
/**
* @title: ExcelStyleUtil
* @Author fpy
* @Date: 2021/7/8 15:36
* @Version 1.0
*/
public class ExcelStyleUtil implements IExcelExportStyler {
private static final short STRING_FORMAT = (short) BuiltinFormats.getBuiltinFormat("TEXT");
private static final short FONT_SIZE_TEN = 10;
private static final short FONT_SIZE_ELEVEN = 11;
private static final short FONT_SIZE_TWELVE = 12;
/**
* 大标题样式
*/
private CellStyle headerStyle;
/**
* 每列标题样式
*/
private CellStyle titleStyle;
/**
* 数据行样式
*/
private CellStyle styles;
public ExcelStyleUtil(Workbook workbook) {
this.init(workbook);
}
/**
* 初始化样式
*
* @param workbook
*/
private void init(Workbook workbook) {
//this.headerStyle = initHeaderStyle(workbook);
this.titleStyle = initTitleStyle(workbook);
this.styles = initStyles(workbook);
}
/**
* 大标题样式
*
* @param color
* @return
*/
@Override
public CellStyle getHeaderStyle(short color) {
return headerStyle;
}
/**
* 每列标题样式
*
* @param color
* @return
*/
@Override
public CellStyle getTitleStyle(short color) {
return titleStyle;
}
/**
* 数据行样式
*
* @param parity 可以用来表示奇偶行
* @param entity 数据内容
* @return 样式
*/
@Override
public CellStyle getStyles(boolean parity, ExcelExportEntity entity) {
return styles;
}
/**
* 获取样式方法
*
* @param dataRow 数据行
* @param obj 对象
* @param data 数据
*/
@Override
public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity entity, Object obj, Object data) {
return getStyles(true, entity);
}
/**
* 模板使用的样式设置
*/
@Override
public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams) {
return null;
}
/**
* 初始化--大标题样式
*
* @param workbook
* @return
*/
private CellStyle initHeaderStyle(Workbook workbook) {
CellStyle style = getBaseCellStyle(workbook);
style.setFont(getFont(workbook, FONT_SIZE_TWELVE, true));
return style;
}
/**
* 初始化--每列标题样式
*
* @param workbook
* @return
*/
private CellStyle initTitleStyle(Workbook workbook) {
CellStyle style = getBaseCellStyle(workbook);
//style.setFont(getFont(workbook, FONT_SIZE_ELEVEN, false));
//背景色
style.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
return style;
}
/**
* 初始化--数据行样式
*
* @param workbook
* @return
*/
private CellStyle initStyles(Workbook workbook) {
CellStyle style = getBaseCellStyle(workbook);
style.setFont(getFont(workbook, FONT_SIZE_TEN, false));
style.setDataFormat(STRING_FORMAT);
return style;
}
/**
* 基础样式
*
* @return
*/
private CellStyle getBaseCellStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
//下边框
style.setBorderBottom(BorderStyle.THIN);
//左边框
style.setBorderLeft(BorderStyle.THIN);
//上边框
style.setBorderTop(BorderStyle.THIN);
//右边框
style.setBorderRight(BorderStyle.THIN);
//水平居中
style.setAlignment(HorizontalAlignment.CENTER);
//上下居中
style.setVerticalAlignment(VerticalAlignment.CENTER);
//设置自动换行
style.setWrapText(true);
return style;
}
/**
* 字体样式
*
* @param size 字体大小
* @param isBold 是否加粗
* @return
*/
private Font getFont(Workbook workbook, short size, boolean isBold) {
Font font = workbook.createFont();
//字体样式
font.setFontName("宋体");
//是否加粗
font.setBold(isBold);
//字体大小
font.setFontHeightInPoints(size);
return font;
}
}
\ No newline at end of file
......@@ -26,9 +26,15 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
* @param appKey 应用标识
* @param fieldCodes 列
* @param groupCode 分组code
* @param params 查询参数map
* @return List<Map>
*/
List<Map<String, Object>> listAll(@Param("appKey") String appKey, @Param("fieldCodes") Map<String, Object> fieldCodes, @Param("groupCode") String groupCode);
List<Map<String, Object>> listAll(
@Param("appKey") String appKey,
@Param("fieldCodes") Map<String, Object> fieldCodes,
@Param("groupCode") String groupCode,
@Param("params") Map<String, String> params
);
/**
* 分页查询
......@@ -39,5 +45,11 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
* @param groupCode 表单类型
* @return IPage<Map<String, Object>>
*/
IPage<Map<String, Object>> pageList(Page page, @Param("appKey") String appKey, @Param("fieldCodes") Map<String, Object> fieldCodes, @Param("groupCode") String groupCode, @Param("params") Map<String,String> params );
IPage<Map<String, Object>> pageList(
Page page,
@Param("appKey") String appKey,
@Param("fieldCodes") Map<String, Object> fieldCodes,
@Param("groupCode") String groupCode,
@Param("params") Map<String,String> params
);
}
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -58,8 +59,16 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> {
/**
* 根据队伍id查询队伍下人员列表
*
* @param teamIds
* @return
*/
List<FirefightersDto> queryFighterByTeamId(@Param("teamIds") List<String> teamIds);
/**
* 根据当前队伍id查询该队伍下所有子队伍
*
* @param teamId
* @return
*/
List<FirefightersDto> queryFighterByTeamId(Long teamId);
List<FireTeam> listFireTeamById(Long teamId);
}
......@@ -30,4 +30,12 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<OrgUsr> queryOrgUsrListByBizOrgCode(String bizOrgCode);
List<OrgPersonExcelDto> queryOrgPersonDtoList(boolean isDelete);
/**
* 根据id查询当前单位下的所有子单位、部门
*
* @param orgUserId
* @return
*/
List<OrgUsr> listOrgUserById(Long orgUserId);
}
......@@ -74,7 +74,7 @@
</select>
<select id="genRangeDate" resultType="map">
SELECT
DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY ) ) AS date,
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
......
......@@ -39,6 +39,20 @@
and i.APP_KEY = #{appKey}
GROUP by
i.INSTANCE_ID)d
<if test="params != null and params.size() > 0">
where
1=1
<foreach collection="params" index="key" item="value" separator="">
<choose>
<when test="fieldCodes[key] == 'like' and value !=null and value !=''">
and d.${key} like concat('%',#{value},'%')
</when>
<when test="fieldCodes[key] == 'eq' and value !=null and value !=''">
and d.${key} = #{value}
</when>
</choose>
</foreach>
</if>
order by instanceId desc
</select>
<select id="pageList" resultType="java.util.Map">
......
......@@ -13,6 +13,19 @@
and ft.type_code = 118
GROUP BY ft.sequence_nbr
</select>
<select id="queryFighterByTeamId" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto">
select *
from cb_firefighters
where is_delete = 0
and fire_team_id in
<if test="teamIds != null">
<foreach collection="teamIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</select>
<select id="getFireTeamForPage" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto">
SELECT
a.sequence_nbr sequenceNbr,
......@@ -30,21 +43,37 @@
<if test='par.typeCode != null'>and a.type_code = #{par.typeCode}</if>
<if test='par.companyCode != null'>and a.company_code = #{par.companyCode}</if>
<if test='par.name != null'>and a.name like concat('%', #{par.name}, '%')</if>
<if test='par.nodeType != null and par.nodeType == "1"'>and a.company = #{par.nodeId}</if>
<if test='par.nodeType != null and par.nodeType == "0"'>and a.parent = #{par.nodeId} or a.sequence_nbr =
#{par.nodeId}</if>
<if test='par.nodeType != null and par.nodeType == "1" and par.nodeIds != null'>
and a.company in
<foreach collection="par.nodeIds" separator="," open="(" item="nodeId" close=")">
#{nodeId}
</foreach>
</if>
<if test='par.nodeType != null and par.nodeType == "0" and par.nodeIds != null'>
<if test="par.nodeIds.size() > 0" >
and a.parent in
<foreach collection="par.nodeIds" separator="," open="(" item="nodeId" close=")">
#{nodeId}
</foreach>
or a.sequence_nbr = #{par.nodeId}
</if>
<if test="par.nodeIds.size() == 0" >
and a.sequence_nbr = #{par.nodeId}
</if>
</if>
</select>
<select id="listFireTeamDto" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto">
select t.*, p.name parentName
from cb_fire_team t
left join cb_fire_team p on t.parent = p.sequence_nbr
where t.is_delete = #{isDelete}
</select>
<select id="queryFighterByTeamId" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto">
select *
from cb_firefighters
where is_delete = 0
and fire_team_id = #{teamId}
<select id="listFireTeamById" resultType="com.yeejoin.amos.boot.module.common.api.entity.FireTeam">
SELECT *
FROM cb_fire_team
WHERE is_delete = 0
<if test="teamId != null">
AND tree_code LIKE CONCAT((SELECT tree_code FROM cb_fire_team WHERE sequence_nbr = #{teamId}),'%');
</if>
</select>
</mapper>
......@@ -201,4 +201,12 @@
on u.sequence_nbr = v.instance_id
where u.is_delete = #{isDelete}
</select>
<select id="listOrgUserById" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT *
FROM cb_org_usr
WHERE is_delete = 0
<if test="orgUserId != null">
AND biz_org_code LIKE CONCAT((SELECT biz_org_code FROM cb_org_usr WHERE sequence_nbr = #{orgUserId}),'%');
</if>
</select>
</mapper>
......@@ -11,4 +11,5 @@ public class ExcelEnums {
public static final String XFDW = "XFDW";//("XFDW","消防队伍")
public static final String WXXFZ = "WXXFZ";//("WXXFZ","微型消防站")
public static final String XFRY = "XFRY";//("XFRY","消防人员")
public static final String CLZQ = "CLZQ";//("CLZQ","车辆执勤")
}
......@@ -212,7 +212,7 @@ public class DataDictionaryController extends BaseController {
}else{
Collection<DataDictionary> list=iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus =TreeParser.getTreexin(null, list, DataDictionary.class.getName(),"getCode",0,
"getName", "getParent", "getNodeType");
"getName", "getParent", null);
MenuFrom Me= new MenuFrom( "-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false);
Me.setChildren(menus);
......@@ -242,7 +242,7 @@ public class DataDictionaryController extends BaseController {
Collection<DataDictionary> list=iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(),"getCode",0, "getName",
"getParent", "getNodeType");
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN+type, JSON.toJSON(menus),time);
objectObjectHashMap.put(type,menus);
}
......
......@@ -59,7 +59,7 @@ public class DutyCarController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "值班列表视图", notes = "值班列表视图")
@ApiOperation(httpMethod = "GET", value = "值班列表视图-不分页", notes = "值班列表视图-不分页")
public ResponseModel list(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate) throws ParseException {
......@@ -123,4 +123,15 @@ public class DutyCarController extends BaseController {
iDutyCarService.downloadList(beginDate, endDate, response);
}
/**
* 值班数据删除
* @param instanceId 实例id
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId) {
return ResponseHelper.buildResponse(iDutyCarService.deleteDutyData(instanceId));
}
}
......@@ -57,7 +57,7 @@ public class DutyPersonController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "值班列表视图", notes = "值班列表视图")
@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(iDutyPersonService.list(beginDate, endDate));
......@@ -108,4 +108,16 @@ public class DutyPersonController extends BaseController {
@RequestBody DutyPersonDto dutyPersonDto) {
return ResponseHelper.buildResponse(iDutyPersonService.update(instanceId, dutyPersonDto));
}
/**
* 值班数据删除
* @param instanceId 实例id
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId) {
return ResponseHelper.buildResponse(iDutyPersonService.deleteDutyData(instanceId));
}
}
package com.yeejoin.amos.boot.module.common.biz.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.DownloadCarDto;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
......@@ -14,11 +13,12 @@ import java.util.Map;
public interface IDutyCommonService {
/**
* 分页查询
* @param current 当前页
* @param size 页大小
*
* @param current 当前页
* @param size 页大小
* @param beginDate 开始日期
* @param endDate 结束日期
* @return IPage<Map<String, Object>>
* @param endDate 结束日期
* @return IPage<Map < String, Object>>
*/
IPage<Map<String, Object>> pageList(int current, int size, String beginDate, String endDate) throws ParseException;
......@@ -42,9 +42,24 @@ public interface IDutyCommonService {
/**
* 获取表单参数
*
* @return String
*/
String getGroupCode();
void downloadList(String beginDate, String endDate, HttpServletResponse response) throws ParseException;
/**
* 值班数据入库
*
* @param dataList 数据
*/
void saveImportData(List<Map<String, Object>> dataList);
/**
* 删除值班数据
* @param instanceId 实例id
* @return Boolean
*/
Boolean deleteDutyData(Long instanceId);
}
......@@ -7,8 +7,6 @@ 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.biz.service.IDutyCarService;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.util.ArrayList;
......@@ -62,19 +60,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
Map<String, Object> map = Bean.BeantoMap(dutyCarDto);
//4.已列为主 填充动态表单数据
List<DynamicFormInstance> entrys = new ArrayList<>();
for (DynamicFormColumn column : columns) {
DynamicFormInstance formInstance = instanceMap.get(column.getFieldCode());
if (!ObjectUtils.isEmpty(formInstance)) {
//有的更新
formInstance.setFieldValue(map.get(column.getFieldCode()) != null ? map.get(column.getFieldCode()).toString() : "");
} else {
//没有的新增
formInstance = new DynamicFormInstance();
buildFormInstanceData(instanceId, map, column, formInstance);
}
entrys.add(formInstance);
}
if(!entrys.isEmpty()){
updateFormValue(entrys, map, instanceId, columns, instanceMap);
if (!entrys.isEmpty()) {
dynamicFormInstanceService.saveOrUpdateBatch(entrys);
}
//5.更新值班信息人日期数据
......@@ -95,11 +82,6 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
}
private void buildFormInstanceData(Long instanceId, Map<String, Object> map, DynamicFormColumn column, DynamicFormInstance formInstance) {
Bean.copyExistPropertis(column, formInstance);
formInstance.setAppKey(RequestContext.getAppKey());
formInstance.setInstanceId(instanceId);
formInstance.setSequenceNbr(sequence.nextId());
formInstance.setFormColumnId(column.getSequenceNbr());
formInstance.setFieldValue(map.get(column.getFieldCode()) != null ? map.get(column.getFieldCode()).toString() : "");
fillFormInstanceData(instanceId, map, column, formInstance, sequence.nextId());
}
}
......@@ -95,11 +95,6 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
}
private void buildFormInstanceData(Long instanceId, Map<String, Object> map, DynamicFormColumn column, DynamicFormInstance formInstance) {
Bean.copyExistPropertis(column, formInstance);
formInstance.setAppKey(RequestContext.getAppKey());
formInstance.setInstanceId(instanceId);
formInstance.setSequenceNbr(sequence.nextId());
formInstance.setFormColumnId(column.getSequenceNbr());
formInstance.setFieldValue(map.get(column.getFieldCode()) != null ? map.get(column.getFieldCode()).toString() : "");
fillFormInstanceData(instanceId, map, column, formInstance, sequence.nextId());
}
}
......@@ -19,7 +19,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -259,7 +258,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<Map<String, Object>> personList = new ArrayList<>();
// 查询动态表单Phone
Map<String, Object> phone = new HashMap<>();
phone.put("alert_called_id", company.getSequenceNbr());
phone.put("instance_id", company.getSequenceNbr());
phone.put("field_code", "companyPhone");
QueryWrapper<DynamicFormInstance> phoneWrapper = new QueryWrapper<DynamicFormInstance>();
phoneWrapper.allEq(phone);
......@@ -846,4 +845,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return excelOrgPersonDtoList;
}
/**
* 根据id查询当前单位下的所有子单位、部门
*
* @param orgUserId
* @return
*/
public List<OrgUsr> listOrgUserById(Long orgUserId) {
return this.baseMapper.listOrgUserById(orgUserId);
}
}
package com.yeejoin.amos.boot.module.common.biz.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @title: DateUtils
* @Author fpy
* @Date: 2021/7/8 14:58
* @Version 1.0
*/
public class DateUtils {
private static final SimpleDateFormat shortSdf = new SimpleDateFormat("yyyy/M/d");
private static final Calendar calendar = Calendar.getInstance();
/**
* 获取某月的日期List
*
* @param yearParam
* @param monthParam
* @return
*/
public static List<String> getDayByMonth(int yearParam, int monthParam) {
List list = new ArrayList();
Calendar aCalendar = Calendar.getInstance(Locale.CHINA);
aCalendar.set(yearParam, monthParam - 1, 1);
int year = aCalendar.get(Calendar.YEAR);//年份
int month = aCalendar.get(Calendar.MONTH) + 1;//月份
int day = aCalendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) {
list.add(year + "/" + month + "/" + i);
}
return list;
}
/**
* 获取某月的日期List
*
* @param dateStr
* @return
*/
public static List<Date> getDayByMonth(String dateStr) {
List list = new ArrayList();
Date date = null;
try {
date = shortSdf.parse(dateStr);
calendar.setTime(date);
int month = calendar.get(Calendar.MONTH) + 1;//月份
int year = calendar.get(Calendar.YEAR);//年份
int day = calendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) {
list.add(year + "/" + month + "/" + i);
}
} catch (ParseException e) {
e.printStackTrace();
}
return list;
}
/**
* 日期返回Date类型
*
* @param dateStr
* @return
*/
public static int strToDateShort(String dateStr) {
try {
Date date = shortSdf.parse(dateStr);
calendar.setTime(date);
int month = calendar.get(Calendar.MONTH) + 1;
return month;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.ArrayList;
import java.util.List;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.*;
import com.yeejoin.amos.boot.module.common.api.enums.TitleEnum;
import com.yeejoin.amos.boot.module.common.biz.service.impl.*;
import com.yeejoin.amos.boot.module.common.biz.utils.DateUtils;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.EquipmentServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -57,6 +68,16 @@ public class ExcelController extends BaseController {
FireStationServiceImpl fireStationService;
@Autowired
FirefightersServiceImpl firefightersService;
@Autowired
DutyCarServiceImpl dutyCarService;
@Autowired
AmosFeignService amosFeignService;
@Autowired
EquipmentServiceImpl equipmentService;
@Autowired
DutyShiftServiceImpl dutyShiftService;
@Autowired
DutyCommonServiceImpl dutyCommonServiceImpl;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -151,6 +172,10 @@ public class ExcelController extends BaseController {
case ExcelEnums.XFRY:
excelImportFirefighters(multipartFile);
break;
case ExcelEnums.CLZQ:
excelImportDutyCar(multipartFile);
break;
}
} catch (Exception e) {
e.printStackTrace();
......@@ -158,6 +183,82 @@ public class ExcelController extends BaseController {
}
}
private void excelImportDutyCar(MultipartFile multipartFile) throws Exception {
String fileName = multipartFile.getOriginalFilename();
if (fileName == null) {
throw new Exception("文件不存在!");
}
if (!fileName.toLowerCase().endsWith(ExcelTypeEnum.XLS.getValue()) && !fileName.toLowerCase().endsWith(ExcelTypeEnum.XLSX.getValue())) {
throw new Exception("文件类型异常!");
}
InputStream input = multipartFile.getInputStream();
HSSFWorkbook xssfWorkbook = new HSSFWorkbook(input);
HSSFSheet sheet = xssfWorkbook.getSheetAt(0);
List<Map<String, Object>> dataList = new ArrayList<>();
if (sheet != null) {
//获取表头月份
String dateStr = "";
Row titleRow = sheet.getRow(0);
Cell monthCell = titleRow.getCell(5);
dateStr = monthCell == null ? "" : monthCell.toString();
List<Date> dayByMonth = DateUtils.getDayByMonth(dateStr);
initDutyCarData(sheet, dataList, dayByMonth);
}
dutyCommonServiceImpl.saveImportData(dataList);
}
private void initDutyCarData(HSSFSheet sheet, List<Map<String, Object>> dataList, List<Date> dayByMonth) {
//遍历行,i = 1,从第二行开始,第一行是表头跳过。
for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
DutyCarDto dutyCarDto = new DutyCarDto();
//row是一行数据,row.getCell(i),代表拿到这一行,第i列数据
Row row = sheet.getRow(i);
if (row == null) {
continue;
}
Cell cell = null;
cell = row.getCell(1);
if (cell != null) {
String[] split = cell.toString().split("@");
dutyCarDto.setTeamName(split[0]);
dutyCarDto.setTeamId(split[1]);
}
cell = row.getCell(2);
if (cell != null) {
String[] split = cell.toString().split("@");
dutyCarDto.setUserName(split[0]);
dutyCarDto.setUserId(split[1]);
}
cell = row.getCell(3);
if (cell != null) {
String[] split = cell.toString().split("@");
dutyCarDto.setPostTypeName(split[0]);
dutyCarDto.setPostType(split[1]);
}
cell = row.getCell(4);
if (cell != null) {
String[] split = cell.toString().split("@");
dutyCarDto.setCarName(split[0]);
dutyCarDto.setCarId(split[1]);
}
List<DutyPersonShiftDto> dutyShift = dutyCarDto.getDutyShift();
for (int j = 0; j < dayByMonth.size(); j++) {
cell = row.getCell(4 + j);
String dutyType = cell == null ? "" : cell.toString();
if (!StringUtils.isEmpty(dutyType)) {
DutyPersonShiftDto dutyPersonShiftDto = new DutyPersonShiftDto();
dutyPersonShiftDto.setDutyDate(dayByMonth.get(j));
dutyPersonShiftDto.setShiftId(Long.valueOf(dutyType.split("@")[1]));
dutyShift.add(dutyPersonShiftDto);
}
}
Map<String, Object> dutyCarDtoMap = Bean.BeantoMap(dutyCarDto);
dataList.add(dutyCarDtoMap);
}
}
private void excelImportFirefighters(MultipartFile multipartFile) throws Exception {
List<FirefightersExcelDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
FirefightersExcelDto.class, 1);
......@@ -390,5 +491,45 @@ public class ExcelController extends BaseController {
fireExpertsServiceImpl.saveBatch(excelEntityList);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出值班模板", notes = "导出值班模板")
@GetMapping(value = "/duty_car_template/{year}/{month}")
public void dutyCarTemplate(HttpServletResponse response, @PathVariable("year") int year,
@PathVariable("month") int month, ExcelDto excelDto,
@RequestParam(value = "orgCode", required = false) String orgCode) {
try {
List<Map<String, Object>> contentList = new ArrayList<>();
// 根据id列表获取队伍下的人
List<DutyCarDto> orgTeam = new ArrayList<>();
if (!orgTeam.isEmpty()) {
AtomicInteger row = new AtomicInteger(1);
orgTeam.forEach(o -> {
Map<String, Object> map = new HashMap<>();
map.put(TitleEnum.NUMBER.getKey(), "" + (row.getAndIncrement()));
map.put(TitleEnum.FIRE_TEAM.getKey(), o.getTeamName());
map.put(TitleEnum.USER_NAME.getKey(), o.getUserName());
map.put(TitleEnum.POST.getKey(), o.getPostTypeName());
contentList.add(map);
});
}
// 获取日期
List<String> dayByMonth = DateUtils.getDayByMonth(year, month);
// 获取排班类型
String[] dutyNameList = getDutyNameList();
ExcelUtil.createDutyTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), contentList,
DutyCarExcelDto.class, dayByMonth, dutyNameList, dataSourcesImpl, true);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
private String[] getDutyNameList() {
List<String> dutyShiftList = new ArrayList<>();
List<DutyShiftDto> dutyShiftDtoList = dutyShiftService.queryForDutyShiftList();
dutyShiftDtoList.forEach(item -> dutyShiftList.add(item.getName() + "@" + item.getSequenceNbr()));
String[] dutyNameList = dutyShiftList.toArray(new String[dutyShiftList.size()]);
return dutyNameList;
}
}
......@@ -8,9 +8,11 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
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.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -62,8 +65,7 @@ public class FireTeamController extends BaseController {
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增消防队伍", notes = "新增消防队伍")
public ResponseModel<Object> saveFireTeam(HttpServletRequest request, @RequestBody FireTeam fireTeam) {
iFireTeamService.save(fireTeam);
return ResponseHelper.buildResponse(null);
return ResponseHelper.buildResponse(iFireTeamService.saveFireTeam(fireTeam));
}
/**
......@@ -89,8 +91,7 @@ public class FireTeamController extends BaseController {
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改消防队伍", notes = "修改消防队伍")
public ResponseModel<Object> updateByIdFireTeam(HttpServletRequest request, @RequestBody FireTeam fireTeam) {
iFireTeamService.updateById(fireTeam);
return ResponseHelper.buildResponse(null);
return ResponseHelper.buildResponse(iFireTeamService.saveFireTeam(fireTeam));
}
/**
......@@ -228,10 +229,14 @@ public class FireTeamController extends BaseController {
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{teamId}/fighter", method = RequestMethod.GET)
@RequestMapping(value = "/fighter", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "查询消防队伍下的人员", notes = "查询消防队伍下的人员")
public ResponseModel<List<FirefightersDto>> listFighterByTeamId(@PathVariable("teamId") Long teamId) {
List<FirefightersDto> fighters = iFireTeamService.getFighterByTeamId(teamId);
public ResponseModel<List<FirefightersDto>> listFighterByTeamId(@RequestParam("teamIds") String teamIds) {
List<String> teamIdList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(teamIds)) {
teamIdList = Lists.newArrayList(teamIds.split(","));
}
List<FirefightersDto> fighters = iFireTeamService.getFighterByTeamId(teamIdList);
return ResponseHelper.buildResponse(fighters);
}
}
\ No newline at end of file
......@@ -223,7 +223,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
mobiles.add((String) orgUser.get("telephone"));
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone"));
}
alertSubmittedObjectList.add(alertSubmittedObject);
}
// 组装报送内容
......@@ -317,7 +319,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setUserName(person.getPersonName());
alertSubmittedObject.setUserPhone(person.getPersonPhone());
alertSubmittedObject.setRecUserName(userName);
mobiles.add(person.getPersonPhone());
if (!ValidationUtil.isEmpty(person.getPersonPhone())) {
mobiles.add(person.getPersonPhone());
}
alertSubmittedObjectList.add(alertSubmittedObject);
});
});
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
......@@ -16,16 +17,19 @@ import com.yeejoin.amos.boot.module.common.api.excel.DataSources;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
......@@ -41,6 +45,8 @@ public class DataSourcesImpl implements DataSources {
FirefightersServiceImpl firefightersService;
@Autowired
FireTeamServiceImpl fireTeamService;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
......@@ -94,11 +100,26 @@ public class DataSourcesImpl implements DataSources {
break;
case "getMaritalStatus":
str = ExcelSelectData.MARITAL_STATUS;
break;
case "getCarList":
str = getCarList();
break;
}
}
return str;
}
private String[] getCarList() {
ResponseModel<Object> response = equipFeignClient.getFireCarListAll();
List<Map<String, Object>> carList = (List<Map<String, Object>>) response.getResult();
List<String> carNameList = Lists.newArrayList();
carList.forEach(car -> {
carNameList.add(car.get("name") + "(" + car.get("carNum") + ")" + "@" + car.get("id"));
});
String[] str = carNameList.toArray(new String[carNameList.size()]);
return str;
}
private String[] getFireTeam() {
Page<FireTeamCardDto> pageBean = new Page<>(1, Integer.MAX_VALUE);
IPage<FireTeamCardDto> fireTeamCardDtoIPage = fireTeamService.listFireTeamByPage(pageBean,
......
......@@ -25,9 +25,11 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
......@@ -76,6 +78,18 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
"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;
......@@ -84,14 +98,14 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
t.setCarNum(finalTeamCarCountMap.get(t.getSequenceNbr().toString()).intValue());
}
});
// 如果队伍下没有队伍则将自己加入返回列表
if ("0".equals(team.getNodeType()) && !ValidationUtil.isEmpty(fireTeamList) && fireTeamList.size() > 1) {
fireTeamList = fireTeamList.stream().filter(t -> t.getSequenceNbr().equals(team.getNodeId())).collect(Collectors.toList());
}
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);
}
......@@ -135,7 +149,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
team.setParent(team.getCompany());
}
teamMenuList.add(new MenuFrom(team.getSequenceNbr().toString(), team.getName(),
team.getParent().toString(), "1"));
team.getParent().toString(), "0"));
});
companyDeptMenuList.addAll(teamMenuList);
List<MenuFrom> menuList = TreeParser.getTreexin("-1", companyDeptMenuList, MenuFrom.class.getName(), "getKey",
......@@ -147,10 +161,26 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
/**
* 根据队伍id查询队伍下人员列表
*
* @param teamId
* @param teamIds
* @return
*/
public List<FirefightersDto> getFighterByTeamId(Long teamId) {
return this.baseMapper.queryFighterByTeamId(teamId);
public List<FirefightersDto> getFighterByTeamId(List<String> teamIds) {
return this.baseMapper.queryFighterByTeamId(teamIds);
}
public FireTeam saveFireTeam(FireTeam fireTeam) {
if (ValidationUtil.isEmpty(fireTeam.getParent())) {
fireTeam.setTreeCode(TreeParser.genTreeCode());
} else {
FireTeam parentTeam = getById(fireTeam.getParent());
fireTeam.setTreeCode(parentTeam.getTreeCode() + TreeParser.genTreeCode());
}
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) {
save(fireTeam);
} else {
updateById(fireTeam);
}
return fireTeam;
}
}
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