Commit e64b50f3 authored by fupeiyang's avatar fupeiyang

导入导出

parent 19fcd6a4
spring.application.name=JCS-tb spring.application.name=JCS-FPY
server.servlet.context-path=/jcs server.servlet.context-path=/jcs
server.port=11100 server.port=11100
spring.profiles.active=dev spring.profiles.active=dev
......
package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
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 lombok.EqualsAndHashCode;
import java.util.Date;
/**
* @author fengwang
* @date 2021-06-18.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "OrgUsr对象", description = "人员信息")
public class ExcelOrgPersonDto extends BaseDto {
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "姓名", index = 0)
@ApiModelProperty(value = "人员名称")
private String bizOrgName;
@ExcelIgnore
@ApiModelProperty(value = "人员编码")
private String bizOrgCode;
@ExcelProperty(value = "关联账户", index = 1)
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ExcelIgnore
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ExcelIgnore
@ApiModelProperty(value = "机构类型(部门:DEPARTMENT,单位:COMPANY,人员:PERSON)")
private String bizOrgType = CommonConstant.BIZ_ORG_TYPE_PERSON;
@ExcelProperty(value = "所属单位/部门", index = 2)
@ApiModelProperty(value = "归属机构/部门/人员")
private String parentId;
@ExcelProperty(value = "员工编号", index = 3)
@ApiModelProperty(value = "员工编号")
private String personNumber;
@ExplicitConstraint(type = "XB", indexNum = 4, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "性别", index = 4)
@ApiModelProperty(value = "性别")
private String gender;
@ExcelIgnore
@ApiModelProperty(value = "性别code")
private String genderCode;
@ExplicitConstraint(type = "RYZJLX", indexNum = 5, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "证件类型", index = 5)
@ApiModelProperty(value = "证件类型")
private String certificatesType;
@ExcelIgnore
@ApiModelProperty(value = "证件类型code")
private String certificatesTypeCode;
@ExcelProperty(value = "证件号码", index = 6)
@ApiModelProperty(value = "证件号码")
private String certificatesNumber;
@ExcelProperty(value = "联系电话", index = 7)
@ApiModelProperty(value = "联系电话")
private String telephone;
@ExplicitConstraint(type = "RYZT", indexNum = 8, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "人员状态", index = 8)
@ApiModelProperty(value = "人员状态")
private String state;
@ExcelIgnore
@ApiModelProperty(value = "人员状态code")
private String stateCode;
@ExplicitConstraint(type = "AQPX", indexNum = 9, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "是否进行安全培训", index = 9)
@ApiModelProperty(value = "是否进行安全培训")
private String safetyTraining;
@ExcelIgnore
@ApiModelProperty(value = "是否进行安全培训code")
private String safetyTrainingCode;
@ExplicitConstraint(type = "XZZW", indexNum = 10, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "行政职务", index = 10)
@ApiModelProperty(value = "行政职务")
private String administrativePosition;
@ExcelIgnore
@ApiModelProperty(value = "行政职务code")
private String administrativePositionCode;
@ExplicitConstraint(type = "JGNBZW", indexNum = 11, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "消防管理组织机构内部职务", index = 11)
@ApiModelProperty(value = "消防管理组织机构内部职务")
private String internalPosition;
@ExcelIgnore
@ApiModelProperty(value = "消防管理组织机构内部职务code")
private String internalPositionCode;
@ExplicitConstraint(type = "XFGLGW", indexNum = 12, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "消防管理岗位", index = 12)
@ApiModelProperty(value = "消防管理岗位")
private String fireManagementPost;
@ExcelIgnore
@ApiModelProperty(value = "消防管理岗位code")
private String fireManagementPostCode;
@ExplicitConstraint(type = "GWMC", indexNum = 13, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "岗位类型", index = 13)
@ApiModelProperty(value = "岗位类型")
private String positionType;
@ExcelIgnore
@ApiModelProperty(value = "岗位类型code")
private String positionTypeCode;
@ExplicitConstraint(type = "CZLB", indexNum = 14, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "持证类别", index = 14)
@ApiModelProperty(value = "持证类别")
private String certificateType;
@ExcelIgnore
@ApiModelProperty(value = "持证类别code")
private String certificateTypeCode;
@ExcelProperty(value = "持证时间", index = 15)
@ApiModelProperty(value = "持证时间")
private Date holdingTime;
@ExplicitConstraint(type = "SHZQ", indexNum = 16, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "审核周期", index = 16)
@ApiModelProperty(value = "审核周期")
private String auditCycle;
@ExcelIgnore
@ApiModelProperty(value = "审核周期code")
private String auditCycleCode;
@ExcelProperty(value = "人员照片", index = 17)
@ApiModelProperty(value = "人员照片")
private String personImg;
@ExcelProperty(value = "重点工种资质证书", index = 18)
@ApiModelProperty(value = "重点工种资质证书")
private String certificateImg;
@ExcelIgnore
@ApiModelProperty(value = "更新人")
@TableField(fill = FieldFill.INSERT_UPDATE)
private String recUserName;
}
package com.yeejoin.amos.boot.module.common.api.dto; package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -8,90 +10,112 @@ import lombok.Data; ...@@ -8,90 +10,112 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
/** /**
* 微型消防站 * 微型消防站
* *
* @author system_generator * @author system_generator
* @date 2021-06-28 * @date 2021-06-28
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value="FireStationDto", description="微型消防站") @ApiModel(value = "FireStationDto", description = "微型消防站")
public class FireStationDto extends BaseDto { public class FireStationDto extends BaseDto {
@ExcelIgnore
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ExcelProperty(value = "微型消防站名称", index = 0)
@ApiModelProperty(value = "微型消防站名称") @ApiModelProperty(value = "微型消防站名称")
private String name; private String name;
@ExcelIgnore
@ApiModelProperty(value = "所在建筑物id") @ApiModelProperty(value = "所在建筑物id")
private String whereBuildingId; private String whereBuildingId;
@ExcelProperty(value = "所在建筑", index = 1)
@ApiModelProperty(value = "所在建筑物名称") @ApiModelProperty(value = "所在建筑物名称")
private String whereBuilding; private String whereBuilding;
@ApiModelProperty(value = "装备简要情况") @ExcelProperty(value = "地址", index = 2)
private String equipmentBrief;
@ApiModelProperty(value = "地址") @ApiModelProperty(value = "地址")
private String address; private String address;
@ApiModelProperty(value = "经度") @ExcelProperty(value = "联系电话", index = 3)
private Double longitude;
@ApiModelProperty(value = "纬度")
private Double latitude;
@ApiModelProperty(value = "行政区区划名称")
private String administrativeDivisions;
@ApiModelProperty(value = "行政区区划编号")
private String administrativeDivisionsCode;
@ApiModelProperty(value = "值班室电话") @ApiModelProperty(value = "值班室电话")
private String dutyRoomTelephone; private String dutyRoomTelephone;
@ExcelProperty(value = "负责人名称", index = 4)
@ApiModelProperty(value = "负责人名称") @ApiModelProperty(value = "负责人名称")
private String personChargeName; private String personChargeName;
@ExcelProperty(value = "负责人电话", index = 5)
@ApiModelProperty(value = "负责人电话") @ApiModelProperty(value = "负责人电话")
private String personChargeTelephone; private String personChargeTelephone;
@ExcelIgnore
@ApiModelProperty(value = "单位id") @ApiModelProperty(value = "单位id")
private Long bizCompanyId; private Long bizCompanyId;
@ExcelProperty(value = "所属单位", index = 6)
@ApiModelProperty(value = "所属单位名称") @ApiModelProperty(value = "所属单位名称")
private String bizCompany; private String bizCompany;
@ExcelIgnore
@ApiModelProperty(value = "所属单位code") @ApiModelProperty(value = "所属单位code")
private String bizCompanyCode; private String bizCompanyCode;
@ExcelProperty(value = "建造日期", index = 7)
@ApiModelProperty(value = "建造日期") @ApiModelProperty(value = "建造日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date buildTime; private Date buildTime;
@ExcelProperty(value = "启用日期", index = 8)
@ApiModelProperty(value = "启用日期") @ApiModelProperty(value = "启用日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date enableTime; private Date enableTime;
@ExcelProperty(value = "装备简要情况", index = 9)
@ApiModelProperty(value = "装备简要情况")
private String equipmentBrief;
@ExcelProperty(value = "微型消防站照片", index = 10)
@ApiModelProperty(value = "图片信息") @ApiModelProperty(value = "图片信息")
private String img; private String img;
@ExcelIgnore
@ApiModelProperty(value = "经度")
private Double longitude;
@ExcelIgnore
@ApiModelProperty(value = "纬度")
private Double latitude;
@ExcelIgnore
@ApiModelProperty(value = "行政区区划名称")
private String administrativeDivisions;
@ExcelIgnore
@ApiModelProperty(value = "行政区区划编号")
private String administrativeDivisionsCode;
@ExcelIgnore
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private Date updateTime; private Date updateTime;
@ExcelIgnore
@ApiModelProperty(value = "操作人名称") @ApiModelProperty(value = "操作人名称")
private String recUserName; private String recUserName;
@ExcelIgnore
@ApiModelProperty(value = "战备装备数量") @ApiModelProperty(value = "战备装备数量")
private Integer eqNum; private Integer eqNum;
@ExcelIgnore
@ApiModelProperty(value = "战备人数量") @ApiModelProperty(value = "战备人数量")
private Integer userNum; private Integer userNum;
@ExcelIgnore
@ApiModelProperty(value = "战备车辆数量") @ApiModelProperty(value = "战备车辆数量")
private Integer carNum; private Integer carNum;
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.api.dto; 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.biz.common.dto.BaseDto;
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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -10,66 +14,100 @@ import java.util.Date; ...@@ -10,66 +14,100 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 消防队伍 * 消防队伍
* *
* @author tb * @author tb
* @date 2021-06-07 * @date 2021-06-07
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value="FireTeamDto", description="消防队伍") @ApiModel(value = "FireTeamDto", description = "消防队伍")
public class FireTeamDto extends BaseDto { public class FireTeamDto extends BaseDto {
@ExcelIgnore
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ExcelProperty(value = "所属单位", index = 0)
@ApiModelProperty(value = "机构名称")
private String companyName;
@ApiModelProperty(value = "消防队伍图片") @ExcelIgnore
private String img; @ApiModelProperty(value = "机构id")
private Long company;
@ExcelIgnore
@ApiModelProperty(value = "机构code")
private String companyCode;
@ExcelProperty(value = "上级单位", index = 1)
@ApiModelProperty(value = "父级名称")
private String parentName;
@ExcelIgnore
@ApiModelProperty(value = "父级")
private Long parent;
@ExcelProperty(value = "队伍名称", index = 2)
@ApiModelProperty(value = "单位名称") @ApiModelProperty(value = "单位名称")
private String name; private String name;
@ApiModelProperty(value = "所属机构") @ExplicitConstraint(type = "XFJGLX", indexNum = 3, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
private Long company; @ExcelProperty(value = "队伍类型", index = 3)
@ApiModelProperty(value = "消防队类型(专职消防队,监控大队)")
private String type;
@ApiModelProperty(value = "机构code") @ExcelIgnore
private String companyCode; @ApiModelProperty(value = "队伍类型code")
private String typeCode;
@ExcelProperty(value = "队伍地址", index = 4)
@ApiModelProperty(value = "队伍地址")
private String address;
@ExcelProperty(value = "地球经度", index = 5)
@ApiModelProperty(value = "经度")
private Double longitude;
@ExcelProperty(value = "地球纬度", index = 6)
@ApiModelProperty(value = "纬度")
private Double latitude;
@ExcelIgnore
@ApiModelProperty(value = "联系人id") @ApiModelProperty(value = "联系人id")
private Integer contactUserId; private Long contactUserId;
@ExcelProperty(value = "联系人", index = 7)
@ApiModelProperty(value = "联系人") @ApiModelProperty(value = "联系人")
private String contactUser; private String contactUser;
@ExcelProperty(value = "联系电话", index = 8)
@ApiModelProperty(value = "联系电话") @ApiModelProperty(value = "联系电话")
private String contactPhone; private String contactPhone;
@ExcelProperty(value = "职责_简要情况", index = 9)
@ApiModelProperty(value = "职责_简要情况") @ApiModelProperty(value = "职责_简要情况")
private String obligation; private String obligation;
@ApiModelProperty(value = "经度") @ExcelProperty(value = "消防队伍图片", index = 10)
private Double longitude; @ApiModelProperty(value = "消防队伍图片")
private String img;
@ApiModelProperty(value = "纬度")
private Double latitude;
@ApiModelProperty(value = "机构名称")
private String companyName;
@ExcelIgnore
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private Date updateTime; private Date updateTime;
@ExcelIgnore
@ApiModelProperty(value = "操作人名称") @ApiModelProperty(value = "操作人名称")
private String recUserName; private String recUserName;
@ApiModelProperty(value = "消防队类型(专职消防队,监控大队)") @ExcelIgnore
private String type;
@ApiModelProperty(value = "执勤车辆数") @ApiModelProperty(value = "执勤车辆数")
private String onDutyCount; private String onDutyCount;
@ExcelIgnore
@ApiModelProperty(value = "出动车辆数") @ApiModelProperty(value = "出动车辆数")
private String outCount; private String outCount;
@ExcelIgnore
@ApiModelProperty(value = "队伍下车辆") @ApiModelProperty(value = "队伍下车辆")
private List<FireBrigadeResourceDto> children; private List<FireBrigadeResourceDto> children;
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.api.dto; package com.yeejoin.amos.boot.module.common.api.dto;
import java.util.Date;
import java.util.List;
import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint; import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint; import com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/** /**
* @author system_generator * @author system_generator
* @date 2021-06-29 * @date 2021-06-29
...@@ -51,7 +50,7 @@ public class WaterResourceDto extends BaseDto { ...@@ -51,7 +50,7 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "所在建筑id") @ApiModelProperty(value = "所在建筑id")
private Long belongBuildingId; private Long belongBuildingId;
// @ExplicitConstraint(indexNum = 3, sourceClass = SelectionDataFromInterface.class, method = "getBuildingList") // @ExplicitConstraint(indexNum = 3, sourceClass = SelectionDataFromInterface.class, method = "getBuildingList")
//动态下拉内容 //动态下拉内容
@ExcelProperty(value = "所在建筑", index = 3) @ExcelProperty(value = "所在建筑", index = 3)
@ApiModelProperty(value = "所在建筑") @ApiModelProperty(value = "所在建筑")
...@@ -61,7 +60,8 @@ public class WaterResourceDto extends BaseDto { ...@@ -61,7 +60,8 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "所属消防系统id") @ApiModelProperty(value = "所属消防系统id")
private Long belongFightingSystemId; private Long belongFightingSystemId;
// @ExplicitConstraint(indexNum = 4, sourceClass = SelectionDataFromInterface.class, method = "getFireSystemList") // @ExplicitConstraint(indexNum = 4, sourceClass = SelectionDataFromInterface.class, method =
// "getFireSystemList")
//动态下拉内容 //动态下拉内容
@ExcelProperty(value = "所属消防系统", index = 4) @ExcelProperty(value = "所属消防系统", index = 4)
@ApiModelProperty(value = "所属消防系统") @ApiModelProperty(value = "所属消防系统")
......
...@@ -7,24 +7,23 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -7,24 +7,23 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
* * @author tb
* * @date 2021-06-17
* @author tb */
* @date 2021-06-17
*/
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("jc_alert_form_value") @TableName("jc_alert_form_value")
@ApiModel(value="AlertFormValue对象", description="") @ApiModel(value = "AlertFormValue对象", description = "AlertFormValue对象")
public class AlertFormValue extends BaseEntity { public class AlertFormValue extends BaseEntity {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "表单id") @ApiModelProperty(value = "表单id")
private Long alertFormId; private Long alertFormId;
@ApiModelProperty(value = "警情id") @ApiModelProperty(value = "警情id")
...@@ -51,9 +50,9 @@ public class AlertFormValue extends BaseEntity { ...@@ -51,9 +50,9 @@ public class AlertFormValue extends BaseEntity {
@ApiModelProperty(value = "是否一行显示") @ApiModelProperty(value = "是否一行显示")
private Boolean block; private Boolean block;
public AlertFormValue() { public AlertFormValue() {
super(); super();
} }
public AlertFormValue(Long alertFormId, String fieldName, String fieldCode, boolean block) { public AlertFormValue(Long alertFormId, String fieldName, String fieldCode, boolean block) {
this.alertFormId = alertFormId; this.alertFormId = alertFormId;
...@@ -61,7 +60,7 @@ public class AlertFormValue extends BaseEntity { ...@@ -61,7 +60,7 @@ public class AlertFormValue extends BaseEntity {
this.fieldCode = fieldCode; this.fieldCode = fieldCode;
this.block = block; this.block = block;
} }
public AlertFormValue(Long alertFormId, String fieldName, String fieldCode, boolean block, String alertTypeCode) { public AlertFormValue(Long alertFormId, String fieldName, String fieldCode, boolean block, String alertTypeCode) {
this.alertFormId = alertFormId; this.alertFormId = alertFormId;
this.fieldName = fieldName; this.fieldName = fieldName;
...@@ -70,7 +69,8 @@ public class AlertFormValue extends BaseEntity { ...@@ -70,7 +69,8 @@ public class AlertFormValue extends BaseEntity {
this.alertTypeCode = alertTypeCode; this.alertTypeCode = alertTypeCode;
} }
public AlertFormValue(Long alertFormId, String fieldName, String fieldCode,boolean block, String alertTypeCode,String fieldValue, String fieldValueCode) { public AlertFormValue(Long alertFormId, String fieldName, String fieldCode, boolean block, String alertTypeCode,
String fieldValue, String fieldValueCode) {
this.alertFormId = alertFormId; this.alertFormId = alertFormId;
this.fieldName = fieldName; this.fieldName = fieldName;
this.fieldCode = fieldCode; this.fieldCode = fieldCode;
...@@ -78,7 +78,16 @@ public class AlertFormValue extends BaseEntity { ...@@ -78,7 +78,16 @@ public class AlertFormValue extends BaseEntity {
this.alertTypeCode = alertTypeCode; this.alertTypeCode = alertTypeCode;
this.fieldValue = fieldValue; this.fieldValue = fieldValue;
this.fieldValueCode = fieldValueCode; this.fieldValueCode = fieldValueCode;
}
public AlertFormValue(Long alertFormId, String alertTypeCode, String fieldName, String fieldCode,
String fieldValue, String fieldValueCode, Boolean block) {
this.alertFormId = alertFormId;
this.alertTypeCode = alertTypeCode;
this.fieldName = fieldName;
this.fieldCode = fieldCode;
this.fieldValue = fieldValue;
this.fieldValueCode = fieldValueCode;
this.block = block;
} }
} }
package com.yeejoin.amos.boot.module.common.api.mapper; package com.yeejoin.amos.boot.module.common.api.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto; import com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto; import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
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.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam; import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import java.util.List;
/** /**
* 消防队伍 Mapper 接口 * 消防队伍 Mapper 接口
* *
...@@ -50,4 +51,6 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> { ...@@ -50,4 +51,6 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> {
* @return * @return
*/ */
IPage<FireTeamCardDto> getFireTeamForPage(Page page, FireTeamListDto par); IPage<FireTeamCardDto> getFireTeamForPage(Page page, FireTeamListDto par);
List<FireTeamDto> listFireTeamDto(Boolean isDelete);
} }
package com.yeejoin.amos.boot.module.common.api.mapper; package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelOrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -27,4 +28,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -27,4 +28,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<Map<String, Object>> selectPersonAllList(Map<String, Object> map); List<Map<String, Object>> selectPersonAllList(Map<String, Object> map);
List<OrgUsr> queryOrgUsrListByBizOrgCode(String bizOrgCode); List<OrgUsr> queryOrgUsrListByBizOrgCode(String bizOrgCode);
List<ExcelOrgPersonDto> queryOrgPersonDtoList(boolean isDelete);
} }
...@@ -3,18 +3,15 @@ ...@@ -3,18 +3,15 @@
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.FireTeamMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.FireTeamMapper">
<select id="listMonitorFireBrigade" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto"> <select id="listMonitorFireBrigade" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto">
SELECT SELECT ft.sequence_nbr id,
ft.sequence_nbr id, ft.NAME,
ft.NAME, ft.img,
ft.img, COUNT(DISTINCT ff.sequence_nbr) personCount
COUNT( DISTINCT ff.sequence_nbr ) personCount FROM cb_fire_team ft
FROM LEFT JOIN cb_firefighters ff ON ff.fire_team_id = ft.sequence_nbr
cb_fire_team ft WHERE ft.is_delete = 0
LEFT JOIN cb_firefighters ff ON ff.fire_team_id = ft.sequence_nbr and ft.type_code = 118
WHERE GROUP BY ft.sequence_nbr
ft.is_delete = 0 and ft.type_code = 118
GROUP BY
ft.sequence_nbr
</select> </select>
<select id="getFireTeamForPage" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto"> <select id="getFireTeamForPage" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto">
SELECT SELECT
...@@ -34,4 +31,11 @@ ...@@ -34,4 +31,11 @@
<if test='par.companyCode!=null'>and a.company_code = #{par.companyCode}</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.name!=null'>and a.name like concat('%', #{par.name}, '%')</if>
</select> </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>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.OrgUsrMapper"> <mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper">
<select id="selectUpUnitByParam" resultType="java.lang.String"> <select id="selectUpUnitByParam" resultType="java.lang.String">
SELECT SELECT
...@@ -10,148 +10,195 @@ ...@@ -10,148 +10,195 @@
WHERE WHERE
1=1 1=1
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and `sequence_nbr` = ( SELECT parent_id FROM `cb_org_usr` WHERE sequence_nbr = #{id} and is_delete = 0 limit 1) and `sequence_nbr` = ( SELECT parent_id FROM `cb_org_usr` WHERE sequence_nbr = #{id} and is_delete = 0 limit
1)
</if> </if>
</select> </select>
<select id="selectPersonListCount" resultType="Integer"> <select id="selectPersonListCount" resultType="Integer">
select count(1) from ( select count(1) from (
SELECT SELECT
DISTINCT DISTINCT
u.sequence_nbr sequenceNbr, u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName, u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode, u.biz_org_code bizOrgCode,
<if test="fields != null"> <if test="fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then v.field_value end) ${item}</foreach> <foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then v.field_value
</if> end) ${item}
FROM </foreach>
cb_org_usr u LEFT JOIN </if>
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id FROM
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id cb_org_usr u LEFT JOIN
where jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
u.biz_org_type = #{bizOrgType} LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
AND u.is_delete = 0 where
<if test="bizOrgName != null"> u.biz_org_type = #{bizOrgType}
AND u.biz_org_name = #{bizOrgName} AND u.is_delete = 0
</if> <if test="bizOrgName != null">
<if test="bizOrgCode != null and bizOrgCode != '-1'"> AND u.biz_org_name = #{bizOrgName}
AND u.biz_org_code like concat(#{bizOrgCode}, '%') </if>
</if> <if test="bizOrgCode != null and bizOrgCode != '-1'">
GROUP BY AND u.biz_org_code like concat(#{bizOrgCode}, '%')
u.sequence_nbr , </if>
u.biz_org_name , GROUP BY
u.biz_org_code u.sequence_nbr ,
)a where a.sequenceNbr is not null u.biz_org_name ,
u.biz_org_code
<if test="fieldsValue != null"> )a where a.sequenceNbr is not null
<foreach collection="fieldsValue.keys" item="item"> AND a.${item} = #{fieldsValue[${item}]} </foreach>
</if> <if test="fieldsValue != null">
</select> <foreach collection="fieldsValue.keys" item="item">AND a.${item} = #{fieldsValue[${item}]}</foreach>
</if>
</select>
<select id="selectPersonList" resultType="Map">
select * from (
SELECT
DISTINCT
u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode,
<if test="fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then v.field_value
end) ${item}
</foreach>
</if>
FROM
cb_org_usr u LEFT JOIN
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where
u.biz_org_type = #{bizOrgType}
AND u.is_delete = 0
<if test="bizOrgName != null">
AND u.biz_org_name = #{bizOrgName}
</if>
<if test="bizOrgCode != null and bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
)a where a.sequenceNbr is not null
<if test="fieldsValue != null">
<foreach collection="fieldsValue.keys" item="item">AND a.${item} = #{fieldsValue[${item}]}</foreach>
</if>
LIMIT #{pageNum}, #{pageSize}
</select>
<select id="selectPersonList" resultType="Map"> <select id="selectPersonAllList" resultType="Map">
select * from ( select * from (
SELECT SELECT
DISTINCT DISTINCT
u.sequence_nbr sequenceNbr, u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName, u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode, u.biz_org_code bizOrgCode,
<if test="fields != null"> <if test="fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then v.field_value end) ${item}</foreach> <foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then v.field_value
</if> end) ${item}
FROM </foreach>
cb_org_usr u LEFT JOIN </if>
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id FROM
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id cb_org_usr u LEFT JOIN
where jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
u.biz_org_type = #{bizOrgType} LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
AND u.is_delete = 0 where u.parent_id = #{parentId}
<if test="bizOrgName != null"> AND u.biz_org_type = #{bizOrgType}
AND u.biz_org_name = #{bizOrgName} AND U.is_delete = 0
</if> GROUP BY
<if test="bizOrgCode != null and bizOrgCode != '-1'"> u.sequence_nbr ,
AND u.biz_org_code like concat(#{bizOrgCode}, '%') u.biz_org_name ,
</if> u.biz_org_code
GROUP BY )a where a.sequenceNbr is not null
u.sequence_nbr , </select>
u.biz_org_name ,
u.biz_org_code <select id="selectCompanyDepartmentMsg" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
)a where a.sequenceNbr is not null SELECT sequence_nbr,
<if test="fieldsValue != null"> biz_org_name,
<foreach collection="fieldsValue.keys" item="item" > AND a.${item} = #{fieldsValue[${item}]} </foreach> biz_org_code,
</if> biz_org_type,
LIMIT #{pageNum}, #{pageSize} parent_id
</select> FROM `cb_org_usr`
WHERE is_delete = 0
and biz_org_type = "COMPANY"
or biz_org_type = "DEPARTMENT"
</select>
<select id="selectPersonAllList" resultType="Map">
select * from (
SELECT
DISTINCT
u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode,
<if test="fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then v.field_value end) ${item}</foreach>
</if>
FROM
cb_org_usr u LEFT JOIN
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where u.parent_id = #{parentId}
AND u.biz_org_type = #{bizOrgType}
AND U.is_delete = 0
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
)a where a.sequenceNbr is not null
</select>
<select id="selectCompanyDepartmentMsg" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> <select id="queryOrgUsrListByBizOrgCode" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT SELECT sequence_nbr,
sequence_nbr, biz_org_name,
biz_org_name, biz_org_code,
biz_org_code, amos_org_id,
biz_org_type, amos_org_code,
parent_id biz_org_type,
FROM build_name,
`cb_org_usr` build_id,
WHERE parent_id,
is_delete = 0 org_expand_attr1,
and biz_org_type = "COMPANY" or biz_org_type = "DEPARTMENT" org_expand_attr2,
</select> org_expand_attr3,
org_expand_attr4,
<select id="queryOrgUsrListByBizOrgCode" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> org_expand_attr5,
SELECT org_expand_attr6,
sequence_nbr, org_expand_attr7,
biz_org_name, org_expand_attr8,
biz_org_code, rec_user_name,
amos_org_id, rec_user_id,
amos_org_code, rec_date,
biz_org_type, is_delete
build_name, FROM `cb_org_usr`
build_id, WHERE is_delete = 0
parent_id, and biz_org_code like concat(#{bizOrgCode}, '%')
org_expand_attr1, </select>
org_expand_attr2,
org_expand_attr3, <select id="queryOrgPersonDtoList" resultType="com.yeejoin.amos.boot.module.common.api.dto.ExcelOrgPersonDto">
org_expand_attr4, select u.*,
org_expand_attr5, v.person_number,
org_expand_attr6, v.certificates_type,
org_expand_attr7, v.gender,
org_expand_attr8, v.certificates_number,
rec_user_name, v.telephone,
rec_user_id, v.state,
rec_date, v.safety_training,
is_delete v.administrative_position,
FROM v.internal_position,
`cb_org_usr` v.fireManagement_post,
WHERE v.position_type,
is_delete = 0 v.certificate_type,
and biz_org_code like concat(#{bizOrgCode}, '%') v.holding_time,
</select> v.audit_cycle,
v.person_img,
v.certificate_img
from cb_org_usr u
left join
(
select alert_called_id,
max(case field_code when 'personNumber' then field_value end) person_number,
max(case field_code when 'certificatesTypeCode' then field_value end) certificates_type,
max(case field_code when 'gender' then field_value end) gender,
max(case field_code when 'certificatesNumber' then field_value end) certificates_number,
max(case field_code when 'telephone' then field_value end) telephone,
max(case field_code when 'stateCode' then field_value end) state,
max(case field_code when 'safetyTraining' then field_value end) safety_training,
max(
case field_code when 'administrativePositionCode' then field_value end) administrative_position,
max(case field_code when 'internalPositionCode' then field_value end) internal_position,
max(case field_code when 'fireManagementPostCode' then field_value end) fireManagement_post,
max(case field_code when 'positionType' then field_value end) position_type,
max(case field_code when 'certificateType' then field_value end) certificate_type,
max(case field_code when 'holdingTime' then field_value end) holding_time,
max(case field_code when 'auditCycle' then field_value end) audit_cycle,
max(case field_code when 'personImg' then field_value end) person_img,
max(case field_code when 'certificateImg' then field_value end) certificate_img
from jc_alert_form_value
where alert_type_code = 246
group by alert_called_id
) v
on u.sequence_nbr = v.alert_called_id
where u.is_delete = #{isDelete}
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.WaterResourceMapper"> <mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper">
<select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto"> <select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto">
select r.name, select r.name,
......
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Resource;
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.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto; import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto; import com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireChemical; import com.yeejoin.amos.boot.module.common.api.entity.FireChemical;
import com.yeejoin.amos.boot.module.common.api.excel.DataSources;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireChemicalServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FireChemicalServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/** /**
...@@ -51,7 +37,6 @@ public class FireChemicalController extends BaseController { ...@@ -51,7 +37,6 @@ public class FireChemicalController extends BaseController {
@Autowired @Autowired
FireChemicalServiceImpl fireChemicalServiceImpl; FireChemicalServiceImpl fireChemicalServiceImpl;
/** /**
* 新增危化品 * 新增危化品
...@@ -146,7 +131,7 @@ public class FireChemicalController extends BaseController { ...@@ -146,7 +131,7 @@ public class FireChemicalController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入危化品") @ApiOperation(value = "导入危化品")
@PostMapping("/import_batch") @PostMapping("/import_batch")
public void importByExcel(MultipartFile multipartFile, HttpServletResponse response) throws Exception { public void importByExcel(MultipartFile multipartFile) throws Exception {
List<FireChemicalDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireChemicalDto.class, List<FireChemicalDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireChemicalDto.class,
1); 1);
List<FireChemical> excelEntityList = new ArrayList<>(); List<FireChemical> excelEntityList = new ArrayList<>();
...@@ -165,5 +150,17 @@ public class FireChemicalController extends BaseController { ...@@ -165,5 +150,17 @@ public class FireChemicalController extends BaseController {
fireChemicalServiceImpl.saveBatch(excelEntityList); fireChemicalServiceImpl.saveBatch(excelEntityList);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出危化品")
@GetMapping("/export")
public void exportToExcel(HttpServletResponse response, ExcelDto excelDto) {
try {
List<FireChemicalDto> data = fireChemicalServiceImpl.queryForFireChemicalList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
FireChemicalDto.class, null, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
} }
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -40,15 +12,24 @@ import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto; ...@@ -40,15 +12,24 @@ import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto; import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary; import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.entity.FireExperts; import com.yeejoin.amos.boot.module.common.api.entity.FireExperts;
import com.yeejoin.amos.boot.module.common.api.excel.DataSources;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.common.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
/** /**
...@@ -71,8 +52,6 @@ public class FireExpertsController extends BaseController { ...@@ -71,8 +52,6 @@ public class FireExpertsController extends BaseController {
@Autowired @Autowired
DataDictionaryServiceImpl dataDictionaryService; DataDictionaryServiceImpl dataDictionaryService;
/** /**
* 新增 * 新增
* *
...@@ -125,7 +104,7 @@ public class FireExpertsController extends BaseController { ...@@ -125,7 +104,7 @@ public class FireExpertsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<FireExpertsDto> selectOne(@PathVariable Long sequenceNbr) throws Exception { public ResponseModel<FireExpertsDto> selectOne(@PathVariable Long sequenceNbr) {
FireExpertsDto fireExpertsDto = fireExpertsServiceImpl.queryBySeq(sequenceNbr); FireExpertsDto fireExpertsDto = fireExpertsServiceImpl.queryBySeq(sequenceNbr);
Date birthdayTime = fireExpertsDto.getBirthdayTime(); Date birthdayTime = fireExpertsDto.getBirthdayTime();
int age = BeanDtoVoUtils.getAge(birthdayTime); int age = BeanDtoVoUtils.getAge(birthdayTime);
...@@ -228,7 +207,7 @@ public class FireExpertsController extends BaseController { ...@@ -228,7 +207,7 @@ public class FireExpertsController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "批量导入消防专家") @ApiOperation(value = "批量导入消防专家")
@PostMapping("/import_batch") @PostMapping("/import_batch")
public void importByExcel(MultipartFile multipartFile, HttpServletResponse response) throws Exception { public void importByExcel(MultipartFile multipartFile) throws Exception {
List<FireExpertsDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireExpertsDto.class, 1); List<FireExpertsDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireExpertsDto.class, 1);
List<FireExperts> excelEntityList = new ArrayList<>(); List<FireExperts> excelEntityList = new ArrayList<>();
excelDtoList.forEach( excelDtoList.forEach(
...@@ -260,6 +239,18 @@ public class FireExpertsController extends BaseController { ...@@ -260,6 +239,18 @@ public class FireExpertsController extends BaseController {
fireExpertsServiceImpl.saveBatch(excelEntityList); fireExpertsServiceImpl.saveBatch(excelEntityList);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出消防专家")
@GetMapping("/export")
public void exportToExcel(HttpServletResponse response, ExcelDto excelDto) {
try {
List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), fireExpertsDtoList,
FireExpertsDto.class, null, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常");
}
}
} }
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto; import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireStation;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireStationServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FireStationServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/** /**
* 微型消防站 * 微型消防站
* *
* @author system_generator * @author system_generator
* @date 2021-06-28 * @date 2021-06-28
*/ */
@RestController @RestController
@Api(tags = "微型消防站Api") @Api(tags = "微型消防站Api")
@RequestMapping(value = "/common/fire-station") @RequestMapping(value = "/common/fire-station")
...@@ -43,93 +39,134 @@ public class FireStationController extends BaseController { ...@@ -43,93 +39,134 @@ public class FireStationController extends BaseController {
FireStationServiceImpl fireStationServiceImpl; FireStationServiceImpl fireStationServiceImpl;
/** /**
* 新增微型消防站 * 新增微型消防站
* @return *
*/ * @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增微型消防站", notes = "新增微型消防站")
public ResponseModel<FireStationDto> save(@RequestBody FireStationDto model) {
model = fireStationServiceImpl.add(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "POST", value = "新增微型消防站", notes = "新增微型消防站") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新微型消防站", notes = "根据sequenceNbr更新微型消防站")
public ResponseModel<FireStationDto> save(@RequestBody FireStationDto model) public ResponseModel<FireStationDto> updateBySequenceNbrFireStation(@RequestBody FireStationDto model,
{ @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model=fireStationServiceImpl.add(model); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(fireStationServiceImpl.Update(model));
} }
/**
* 根据sequenceNbr更新 /**
* @param sequenceNbr 主键 * 根据sequenceNbr删除
* @return *
*/ * @param sequenceNbr 主键
@TycloudOperation(ApiLevel = UserType.AGENCY) * @return
@PutMapping(value = "/{sequenceNbr}") */
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新微型消防站", notes = "根据sequenceNbr更新微型消防站")
public ResponseModel<FireStationDto> updateBySequenceNbrFireStation(@RequestBody FireStationDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(fireStationServiceImpl.Update(model));
}
/**
* 根据sequenceNbr删除
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除微型消防站", notes = "根据sequenceNbr删除微型消防站") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除微型消防站", notes = "根据sequenceNbr删除微型消防站")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(fireStationServiceImpl.updateisDelete(sequenceNbr)); return ResponseHelper.buildResponse(fireStationServiceImpl.updateisDelete(sequenceNbr));
} }
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个微型消防站", notes = "根据sequenceNbr查询单个微型消防站")
public ResponseModel<FireStationDto> seleteOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(fireStationServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "微型消防站分页查询", notes = "微型消防站分页查询")
public ResponseModel<Page<FireStationDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
Page<FireStationDto> page = new Page<FireStationDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(fireStationServiceImpl.queryForFireStationPage(page));
}
/** /**
* 根据sequenceNbr查询 * 新列表分页查询
* @param sequenceNbr 主键 *
* @return * @param pageNum 当前页
*/ * @param pageSize 每页大小
@TycloudOperation(ApiLevel = UserType.AGENCY) * @return
@GetMapping(value = "/{sequenceNbr}") */
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个微型消防站", notes = "根据sequenceNbr查询单个微型消防站") @TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel<FireStationDto> seleteOne(@PathVariable Long sequenceNbr) @GetMapping(value = "/list/page")
{ @ApiOperation(httpMethod = "GET", value = "新微型消防站分页查询", notes = "新微型消防站分页查询")
return ResponseHelper.buildResponse(fireStationServiceImpl.queryBySeq(sequenceNbr)); public ResponseModel<Page<FireStationDto>> getFireStation(@RequestParam(value = "pageNum") int pageNum,
} @RequestParam(value = "pageSize") int pageSize,
/** FireStationDto fireStationDto) {
* 列表分页查询 return ResponseHelper.buildResponse(fireStationServiceImpl.getFirefighters(pageNum, pageSize, fireStationDto));
*@param current 当前页 }
*@param current 每页大小
* @return
*/ /**
@TycloudOperation(ApiLevel = UserType.AGENCY) * 列表全部数据查询
@GetMapping(value = "/page") *
@ApiOperation(httpMethod = "GET",value = "微型消防站分页查询", notes = "微型消防站分页查询") * @return
public ResponseModel<Page<FireStationDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam(value = "size") int size) */
{ @TycloudOperation(ApiLevel = UserType.AGENCY)
Page<FireStationDto> page=new Page<FireStationDto>(); @ApiOperation(httpMethod = "GET", value = "微型消防站列表全部数据查询", notes = "微型消防站列表全部数据查询")
page.setCurrent(current); @GetMapping(value = "/list")
page.setSize(size); public ResponseModel<List<FireStationDto>> selectForList() {
return ResponseHelper.buildResponse(fireStationServiceImpl.queryForFireStationPage(page)); return ResponseHelper.buildResponse(fireStationServiceImpl.queryForFireStationList(false));
} }
/** @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
* 新列表分页查询 @ApiOperation(value = "导入微型消防站")
*@param current 当前页 @PostMapping("/import_batch")
*@param current 每页大小 public void importByExcel(MultipartFile multipartFile) throws Exception {
* @return List<FireStationDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireStationDto.class, 1);
*/ List<FireStation> excelEntityList = new ArrayList<>();
@TycloudOperation(ApiLevel = UserType.AGENCY) excelDtoList.forEach(
@GetMapping(value = "/list/page") item -> {
@ApiOperation(httpMethod = "GET",value = "新微型消防站分页查询", notes = "新微型消防站分页查询") FireStation fireStation = new FireStation();
public ResponseModel<Page<FireStationDto>> getFireStation(@RequestParam(value = "pageNum") int pageNum,@RequestParam(value = "pageSize") int pageSize, FireStationDto fireStationDto) fireStation = Bean.toPo(item, fireStation);
{ excelEntityList.add(fireStation);
return ResponseHelper.buildResponse(fireStationServiceImpl.getFirefighters(pageNum, pageSize, fireStationDto)); }
} );
fireStationServiceImpl.saveBatch(excelEntityList);
}
/**
*列表全部数据查询 @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
*@return @ApiOperation(value = "导出微型消防站")
*/ @GetMapping("/export")
@TycloudOperation(ApiLevel = UserType.AGENCY) public void exportToExcel(HttpServletResponse response, ExcelDto excelDto) {
@ApiOperation(httpMethod = "GET",value = "微型消防站列表全部数据查询", notes = "微型消防站列表全部数据查询") try {
@GetMapping(value = "/list") List<FireStationDto> data = fireStationServiceImpl.queryForFireStationList(false);
public ResponseModel<List<FireStationDto>> selectForList() ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
{ FireStationDto.class, null, false);
return ResponseHelper.buildResponse(fireStationServiceImpl.queryForFireStationList()); } catch (Exception e) {
} e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
} }
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.AlertFormValueServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author fengwang * @author fengwang
...@@ -41,55 +33,57 @@ import io.swagger.annotations.ApiOperation; ...@@ -41,55 +33,57 @@ import io.swagger.annotations.ApiOperation;
@Api(tags = "人员Api") @Api(tags = "人员Api")
@RequestMapping(value = "/org-person") @RequestMapping(value = "/org-person")
public class OrgPersonController { public class OrgPersonController {
@Autowired @Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
@Autowired @Autowired
AlertFormValueServiceImpl iAlertFromValueService; AlertFormValueServiceImpl iAlertFromValueService;
/** /**
* 新增人员信息 * 新增人员信息
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST) @RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增人员信息", notes = "新增人员信息") @ApiOperation(httpMethod = "POST", value = "新增人员信息", notes = "新增人员信息")
public ResponseModel<?> saveOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo) throws Exception { public ResponseModel<?> saveOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo) throws Exception {
OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON); OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
iOrgUsrService.saveOrgPerson(OrgPersonVo); iOrgUsrService.saveOrgPerson(OrgPersonVo);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
/** /**
* 根据id删除 * 根据id删除
* *
* @param id * @param id
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除") @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public ResponseModel<?> deleteById(HttpServletRequest request, @PathVariable Long id) { public ResponseModel<?> deleteById(HttpServletRequest request, @PathVariable Long id) {
// 删除时,只作逻辑删除 // 删除时,只作逻辑删除
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete", CommonConstant.IS_DELETE_01)); iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete",
return ResponseHelper.buildResponse(null); CommonConstant.IS_DELETE_01));
} return ResponseHelper.buildResponse(null);
}
/**
* 更新人员数据 /**
* * 更新人员数据
* @return *
*/ * @return
@TycloudOperation(ApiLevel = UserType.AGENCY) */
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据") @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo, @PathVariable Long id) throws Exception { @ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据")
OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON); public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo,
iOrgUsrService.updateByIdOrgPerson(OrgPersonVo,id); @PathVariable Long id) throws Exception {
return ResponseHelper.buildResponse(null); OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
} iOrgUsrService.updateByIdOrgPerson(OrgPersonVo, id);
return ResponseHelper.buildResponse(null);
}
/** /**
* 根据id查询人员 * 根据id查询人员
* *
...@@ -105,119 +99,144 @@ public class OrgPersonController { ...@@ -105,119 +99,144 @@ public class OrgPersonController {
return ResponseHelper.buildResponse(iOrgUsrService.selectPersonById(id)); return ResponseHelper.buildResponse(iOrgUsrService.selectPersonById(id));
} }
/** /**
* * @param request
* @param request * @param id
* @param id * @return
* @return * @throws Exception
* @throws Exception */
*/ @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/{id}/detail", method = RequestMethod.GET)
@RequestMapping(value = "/{id}/detail", method = RequestMethod.GET) @ApiOperation(httpMethod = "GET", value = "获取人员详情", notes = "获取人员详情")
@ApiOperation(httpMethod = "GET", value = "获取人员详情", notes = "获取人员详情") public ResponseModel<OrgPersonFormDto> selectByIdDetail(HttpServletRequest request, @PathVariable Long id) throws Exception {
public ResponseModel<OrgPersonFormDto> selectByIdDetail(HttpServletRequest request, @PathVariable Long id) throws Exception { return ResponseHelper.buildResponse(iOrgUsrService.selectPersonByIdDetail(id));
return ResponseHelper.buildResponse(iOrgUsrService.selectPersonByIdDetail(id)); }
}
/**
/** * 根据id查询人员
* 根据id查询人员 *
* * @param id
* @param id * @return
* @return */
*/ @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/show/{id}", method = RequestMethod.GET)
@RequestMapping(value = "/show/{id}", method = RequestMethod.GET) @ApiOperation(httpMethod = "GET", value = "获取人员详情(map类型)", notes = "获取人员详情")
@ApiOperation(httpMethod = "GET", value = "获取人员详情(map类型)", notes = "获取人员详情") public ResponseModel<Map<String, Object>> selectForShowById(HttpServletRequest request, @PathVariable Long id) throws Exception {
public ResponseModel<Map<String, Object>> selectForShowById(HttpServletRequest request, @PathVariable Long id) throws Exception { OrgUsr orgUsr = iOrgUsrService.getById(id);
OrgUsr orgUsr = iOrgUsrService.getById(id); Map<String, Object> result = iOrgUsrService.selectForShowById(orgUsr, id);
Map<String, Object> result = iOrgUsrService.selectForShowById(orgUsr, id); return ResponseHelper.buildResponse(result);
return ResponseHelper.buildResponse(result); }
}
/**
/** * 获取人员树
* 获取人员树 *
* * @param
* @param * @return
* @return */
*/ @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/companyTree", method = RequestMethod.GET)
@RequestMapping(value = "/companyTree", method = RequestMethod.GET) @ApiOperation(httpMethod = "GET", value = "获取人员树", notes = "获取人员树")
@ApiOperation(httpMethod = "GET", value = "获取人员树", notes = "获取人员树") public ResponseModel<List<OrgMenuDto>> selectPersonTree() throws Exception {
public ResponseModel<List<OrgMenuDto> > selectPersonTree() throws Exception { return ResponseHelper.buildResponse(iOrgUsrService.selectPersonTree());
return ResponseHelper.buildResponse(iOrgUsrService.selectPersonTree()); }
}
/**
/** * 列表分页查询
* 列表分页查询 *
* * @return
* @return */
*/ @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/list", method = RequestMethod.GET)
@RequestMapping(value = "/list", method = RequestMethod.GET) @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") public ResponseModel<Object> listPage(@RequestParam Map<String, Object> requestBody) {
public ResponseModel<Object> listPage(@RequestParam Map<String, Object> requestBody) { return ResponseHelper.buildResponse(iOrgUsrService.pagePerson(requestBody.get("pageNum").toString(),
return ResponseHelper.buildResponse(iOrgUsrService.pagePerson(requestBody.get("pageNum").toString(), requestBody.get("pageSize").toString(), requestBody)); requestBody.get("pageSize").toString(), requestBody));
} }
/** /**
* * 根据orgCode查询
* 根据orgCode查询 *
* @param orgCode * @param orgCode
* @return * @return
*/ */
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{orgCode}/users", method = RequestMethod.GET) @RequestMapping(value = "/{orgCode}/users", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据orgCode查询", notes = "根据orgCode查询") @ApiOperation(httpMethod = "GET", value = "根据orgCode查询", notes = "根据orgCode查询")
public ResponseModel<Collection<OrgUsr>> selectUsersByOrgCode(HttpServletRequest request, String pageNum, String pageSize, @PathVariable Long orgCode) { public ResponseModel<Collection<OrgUsr>> selectUsersByOrgCode(HttpServletRequest request, String pageNum,
Map<String, Object> columnMap = new HashMap<>(); String pageSize, @PathVariable Long orgCode) {
columnMap.put("is_delete", CommonConstant.IS_DELETE_00); Map<String, Object> columnMap = new HashMap<>();
columnMap.put("biz_org_code", orgCode); columnMap.put("is_delete", CommonConstant.IS_DELETE_00);
columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON); columnMap.put("biz_org_code", orgCode);
return ResponseHelper.buildResponse(iOrgUsrService.listByMap(columnMap)); columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON);
} return ResponseHelper.buildResponse(iOrgUsrService.listByMap(columnMap));
}
/**
* 导出人员模板 /**
* * 导出人员模板
* @param response *
* @param OrgUsrDownloadTemplateVO * @param response
* @return * @param
*/ * @return
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) */
@RequestMapping(value = "/download-template", method = RequestMethod.GET) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "导出人员模板", notes = "导出人员模板") @RequestMapping(value = "/download-template", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "导出人员模板", notes = "导出人员模板")
public ResponseModel<?> downloadTemplate(HttpServletResponse response) throws UnsupportedEncodingException { public ResponseModel<?> downloadTemplate(HttpServletResponse response) throws UnsupportedEncodingException {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
// List<OrgUsrDownloadTemplateVO> OrgUsrDownloadTemplateVO = new ArrayList<OrgUsrDownloadTemplateVO>(); // List<OrgUsrDownloadTemplateVO> OrgUsrDownloadTemplateVO = new ArrayList<OrgUsrDownloadTemplateVO>();
// ExcelUtils.exportExcel(OrgUsrDownloadTemplateVO, "人员信息", "人员信息", OrgUsrDownloadTemplateVO.class, simpleDateFormat.format(new Date()) + ".xls", response); // ExcelUtils.exportExcel(OrgUsrDownloadTemplateVO, "人员信息", "人员信息", OrgUsrDownloadTemplateVO.class,
// simpleDateFormat.format(new Date()) + ".xls", response);
return ResponseHelper.buildResponse(null);
}
/**
* 导入人员信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/savePerson", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "导入人员信息", notes = "导入人员信息")
public ResponseModel<?> savePerson(HttpServletRequest request, @RequestBody List<OrgPersonDto> OrgPersonVo) throws Exception {
iOrgUsrService.savePersonList(OrgPersonVo);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
/** /**
* 导入人员信息 * 根据id查询人员
* *
* @return * @param ids
*/ * @return
@TycloudOperation(ApiLevel = UserType.AGENCY) */
@RequestMapping(value = "/savePerson", method = RequestMethod.POST) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "导入人员信息", notes = "导入人员信息") @RequestMapping(value = "/showPersonList/{ids}", method = RequestMethod.GET)
public ResponseModel<?> savePerson(HttpServletRequest request, @RequestBody List<OrgPersonDto> OrgPersonVo) throws Exception { @ApiOperation(httpMethod = "GET", value = "获取人员列表详情(map类型)", notes = "获取人员详情")
iOrgUsrService.savePersonList(OrgPersonVo); public ResponseModel<List<Map<String, Object>>> selectForShowByListId(HttpServletRequest request,
return ResponseHelper.buildResponse(null); @PathVariable List<Long> ids) throws Exception {
} return ResponseHelper.buildResponse(iOrgUsrService.selectForShowByListId(ids)
/**
* 根据id查询人员
*
* @param ids
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/showPersonList/{ids}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取人员列表详情(map类型)", notes = "获取人员详情")
public ResponseModel<List<Map<String, Object>> > selectForShowByListId(HttpServletRequest request, @PathVariable List<Long> ids) throws Exception {
return ResponseHelper.buildResponse(iOrgUsrService.selectForShowByListId(ids)
); );
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入机场单位")
@PostMapping("/import_batch")
public void importByExcel(MultipartFile multipartFile) throws Exception {
List<ExcelOrgPersonDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, ExcelOrgPersonDto.class, 1);
iOrgUsrService.importByExcel(excelDtoList);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出机场单位")
@GetMapping("/export")
public void exportToExcel(HttpServletResponse response, ExcelDto excelDto) {
try {
List<ExcelOrgPersonDto> data = iOrgUsrService.queryOrgPersonDtoList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
ExcelOrgPersonDto.class, null, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
} }
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
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.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto; import com.yeejoin.amos.boot.module.common.api.entity.*;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceHydrantDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceIotDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceNaturalDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourcePoolDto;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResource;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIot;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceNatural;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourcePool;
import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum;
import com.yeejoin.amos.boot.module.common.api.excel.DataSources;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper; import com.yeejoin.amos.boot.module.common.biz.service.impl.*;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceCraneServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceHydrantServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceIotServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceNaturalServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourcePoolServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/** /**
...@@ -79,7 +49,6 @@ public class WaterResourceController extends BaseController { ...@@ -79,7 +49,6 @@ public class WaterResourceController extends BaseController {
WaterResourcePoolServiceImpl waterResourcePoolService; WaterResourcePoolServiceImpl waterResourcePoolService;
@Autowired @Autowired
WaterResourceIotServiceImpl waterResourceIotService; WaterResourceIotServiceImpl waterResourceIotService;
/** /**
* 新增 * 新增
...@@ -356,7 +325,7 @@ public class WaterResourceController extends BaseController { ...@@ -356,7 +325,7 @@ public class WaterResourceController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "批量导入消防水源") @ApiOperation(value = "批量导入消防水源")
@PostMapping("/import_batch") @PostMapping("/import_batch")
public void importByExcel(MultipartFile multipartFile, HttpServletResponse response) throws Exception { public void importByExcel(MultipartFile multipartFile) throws Exception {
List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, WaterResourceDto.class, 1); List<WaterResourceDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, WaterResourceDto.class, 1);
excelDtoList.forEach( excelDtoList.forEach(
item -> { item -> {
...@@ -385,5 +354,17 @@ public class WaterResourceController extends BaseController { ...@@ -385,5 +354,17 @@ public class WaterResourceController extends BaseController {
); );
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出消防水源")
@GetMapping("/export")
public void exportToExcel(HttpServletResponse response, ExcelDto excelDto) {
try {
List<WaterResourceDto> waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), waterResourceDtoList,
WaterResourceDto.class, null, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常");
}
}
} }
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.excel.DataSources;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class DataSourcesImpl implements DataSources {
@Resource
DataDictionaryMapper dataDictionaryMapper;
@Override
public String[] selectList(String type, String method) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
if ("ZJLY".equals(type)) {
queryWrapper.isNull("parent");
}
queryWrapper.orderByAsc("sort_num");
List<DataDictionary> list = dataDictionaryMapper.selectList(queryWrapper);
List<String> names = list.stream().map(dataDictionary -> {
return dataDictionary.getName() + "@" + dataDictionary.getCode();
}).collect(Collectors.toList());
String[] str = names.toArray(new String[names.size()]);
return str;
}
}
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto; import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
...@@ -16,6 +8,15 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; ...@@ -16,6 +8,15 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.mapper.FireStationMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FireStationMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireStationService; import com.yeejoin.amos.boot.module.common.api.service.IFireStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
import java.util.Map;
/** /**
* 微型消防站服务实现类 * 微型消防站服务实现类
...@@ -25,73 +26,69 @@ import com.yeejoin.amos.boot.module.common.api.service.IFireStationService; ...@@ -25,73 +26,69 @@ import com.yeejoin.amos.boot.module.common.api.service.IFireStationService;
*/ */
@Service @Service
public class FireStationServiceImpl extends BaseService<FireStationDto, FireStation, FireStationMapper> public class FireStationServiceImpl extends BaseService<FireStationDto, FireStation, FireStationMapper>
implements IFireStationService { implements IFireStationService {
@Autowired @Autowired
FireStationMapper fireStationMapper; FireStationMapper fireStationMapper;
@Autowired @Autowired
OrgUsrMapper orgUsrMapper; OrgUsrMapper orgUsrMapper;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<FireStationDto> queryForFireStationPage(Page<FireStationDto> page) { public Page<FireStationDto> queryForFireStationPage(Page<FireStationDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<FireStationDto> queryForFireStationList() { public List<FireStationDto> queryForFireStationList(@Condition(Operator.eq) Boolean isDelete) {
return this.queryForList("", false); return this.queryForList("", false, isDelete);
} }
/** /**
* 删除 * 删除
*/ */
public Boolean updateisDelete(Long sequenceNbr) { public Boolean updateisDelete(Long sequenceNbr) {
return this.update(new UpdateWrapper<FireStation>().eq("sequence_nbr", sequenceNbr).set("is_delete", 1)); return this.update(new UpdateWrapper<FireStation>().eq("sequence_nbr", sequenceNbr).set("is_delete", 1));
} }
@Override @Override
public Page<FireStationDto> getFirefighters(int pageNum, int pageSize, FireStationDto par) { public Page<FireStationDto> getFirefighters(int pageNum, int pageSize, FireStationDto par) {
List<FireStationDto> list = fireStationMapper.getFireStation((pageNum - 1) * pageSize, pageSize, par); List<FireStationDto> list = fireStationMapper.getFireStation((pageNum - 1) * pageSize, pageSize, par);
Map<String, Long> num = fireStationMapper.getFireStationCount(par); Map<String, Long> num = fireStationMapper.getFireStationCount(par);
Page<FireStationDto> pageBean = new Page<>(pageNum, pageSize, num.get("num")); Page<FireStationDto> pageBean = new Page<>(pageNum, pageSize, num.get("num"));
return pageBean.setRecords(list); return pageBean.setRecords(list);
} }
/** /**
* * 新增
* 新增 ***/
* public FireStationDto add(FireStationDto model) {
***/
public FireStationDto add(FireStationDto model) {
if (model.getBizCompanyId() != null) { if (model.getBizCompanyId() != null) {
OrgUsr orgUsr = orgUsrMapper.selectById(model.getBizCompanyId()); OrgUsr orgUsr = orgUsrMapper.selectById(model.getBizCompanyId());
model.setBizCompany(orgUsr.getBizOrgName()); model.setBizCompany(orgUsr.getBizOrgName());
model.setBizCompanyCode(orgUsr.getBizOrgCode()); model.setBizCompanyCode(orgUsr.getBizOrgCode());
} }
FireStation entity = this.prepareEntity(model); FireStation entity = this.prepareEntity(model);
this.save(entity); this.save(entity);
return Bean.toModel(entity, model); return Bean.toModel(entity, model);
} }
/** /**
* * 修改
* 修改 ***/
* public FireStationDto Update(FireStationDto model) {
***/ if (model.getBizCompanyId() != null) {
public FireStationDto Update(FireStationDto model) { OrgUsr orgUsr = orgUsrMapper.selectById(model.getBizCompanyId());
if (model.getBizCompanyId() != null) { model.setBizCompany(orgUsr.getBizOrgName());
OrgUsr orgUsr = orgUsrMapper.selectById(model.getBizCompanyId()); model.setBizCompanyCode(orgUsr.getBizOrgCode());
model.setBizCompany(orgUsr.getBizOrgName()); }
model.setBizCompanyCode(orgUsr.getBizOrgCode()); FireStation entity = this.prepareEntity(model);
} this.updateById(entity);
FireStation entity = this.prepareEntity(model); return Bean.toModel(entity, model);
this.updateById(entity); }
return Bean.toModel(entity, model);
}
} }
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
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.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.AlertFormDto; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.dto.AlertFormValueDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.entity.AlertForm; import com.yeejoin.amos.boot.module.common.api.entity.AlertForm;
import com.yeejoin.amos.boot.module.common.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.common.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
...@@ -42,6 +14,19 @@ import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; ...@@ -42,6 +14,19 @@ import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService; import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.StringUtils;
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.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* 机构/部门/人员表 服务实现类 * 机构/部门/人员表 服务实现类
...@@ -56,28 +41,32 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -56,28 +41,32 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
AlertFormValueServiceImpl alertFormValueServiceImpl; AlertFormValueServiceImpl alertFormValueServiceImpl;
@Autowired @Autowired
AlertFormServiceImpl alertFormServiceImpl; AlertFormServiceImpl alertFormServiceImpl;
@Resource
OrgUsrMapper orgUsrMapper;
@Override @Override
public String selectUpUnitByParam(String id) { public String selectUpUnitByParam(String id) {
return this.baseMapper.selectUpUnitByParam(id); return this.baseMapper.selectUpUnitByParam(id);
} }
public static List<OrgMenuDto> buildTreeParallel(List<OrgUsr> list) { public static List<OrgMenuDto> buildTreeParallel(List<OrgUsr> list) {
List<OrgMenuDto> menuList = list.stream().map(o -> { List<OrgMenuDto> menuList = list.stream().map(o -> {
OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName(), ObjectUtils.isEmpty(o.getParentId()) ? 0L :Long.valueOf(o.getParentId()), o.getBizOrgType(), false, o.getBizOrgCode()); OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName(),
return menu; ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.valueOf(o.getParentId()), o.getBizOrgType(),
false, o.getBizOrgCode());
return menu;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<OrgMenuDto> result = new ArrayList<>(); List<OrgMenuDto> result = new ArrayList<>();
Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size()); Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size());
menuList.forEach(e -> map.put(e.getKey(), e)); menuList.forEach(e -> map.put(e.getKey(), e));
Set<? extends Map.Entry<Long, ? extends OrgMenuDto>> entries = map.entrySet(); Set<? extends Map.Entry<Long, ? extends OrgMenuDto>> entries = map.entrySet();
entries.parallelStream().forEach(entry -> { entries.parallelStream().forEach(entry -> {
OrgMenuDto value = entry.getValue(); OrgMenuDto value = entry.getValue();
if (value != null) { if (value != null) {
OrgMenuDto treeDto = map.get(value.getParentId()); OrgMenuDto treeDto = map.get(value.getParentId());
if (treeDto != null) { if (treeDto != null) {
List<OrgMenuDto> children = treeDto.getChildren(); List<OrgMenuDto> children = treeDto.getChildren();
if (children == null) { if (children == null) {
...@@ -94,7 +83,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -94,7 +83,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
@Override @Override
public List<OrgMenuDto> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception { public List<OrgMenuDto> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName,
int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName,
String OrgTypeMethodName) throws Exception {
List<OrgMenuDto> resultList = new ArrayList<>(); List<OrgMenuDto> resultList = new ArrayList<>();
Class<?> clazz = Class.forName(packageURL); Class<?> clazz = Class.forName(packageURL);
Method IDMethodNameme = null; Method IDMethodNameme = null;
...@@ -122,23 +113,29 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -122,23 +113,29 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Object entity = clazz.cast(ob); Object entity = clazz.cast(ob);
parentId = PARENTIDMethodNameme.invoke(entity) != null ? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null; parentId = PARENTIDMethodNameme.invoke(entity) != null ?
Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null;
if (parentId == null || topId == parentId) { if (parentId == null || topId == parentId) {
OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false); OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))),
String.valueOf(NAMEMethodNameme.invoke(entity)), parentId,
String.valueOf(OrgTypeMethodNameme.invoke(entity)), false);
resultList.add(menu); resultList.add(menu);
} }
} }
//获取每个顶层元素的子数据集合 //获取每个顶层元素的子数据集合
for (OrgMenuDto entity : resultList) { for (OrgMenuDto entity : resultList) {
entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName)); entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy,
NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName));
} }
return resultList; return resultList;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<OrgMenuDto> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception { public List<OrgMenuDto> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL
, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName,
String OrgTypeMethodName) throws Exception {
List<OrgMenuDto> childList = new ArrayList<>(); List<OrgMenuDto> childList = new ArrayList<>();
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
...@@ -166,16 +163,21 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -166,16 +163,21 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
for (Object ob : entityList) { for (Object ob : entityList) {
Object entity = clazz.cast(ob); Object entity = clazz.cast(ob);
parentId = PARENTIDMethodNameme.invoke(entity) != null ? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null; parentId = PARENTIDMethodNameme.invoke(entity) != null ?
Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null;
if (parentId == null) { if (parentId == null) {
if (topId == parentId) { if (topId == parentId) {
OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity))); OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))),
String.valueOf(NAMEMethodNameme.invoke(entity)), parentId,
String.valueOf(OrgTypeMethodNameme.invoke(entity)));
childList.add(menu); childList.add(menu);
} }
} else { } else {
if (topId.longValue() == parentId.longValue()) { if (topId.longValue() == parentId.longValue()) {
OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity))); OrgMenuDto menu = new OrgMenuDto(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))),
String.valueOf(NAMEMethodNameme.invoke(entity)), parentId,
String.valueOf(OrgTypeMethodNameme.invoke(entity)));
childList.add(menu); childList.add(menu);
} }
} }
...@@ -184,7 +186,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -184,7 +186,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
//子集的间接子对象 //子集的间接子对象
for (OrgMenuDto entity : childList) { for (OrgMenuDto entity : childList) {
entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName)); entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy,
NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName));
if (entity.getChildren() != null) { if (entity.getChildren() != null) {
entity.setLeaf(false); entity.setLeaf(false);
} }
...@@ -207,7 +210,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -207,7 +210,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr company = getById(ids.get(i)); OrgUsr company = getById(ids.get(i));
resultMap.put("id", company.getSequenceNbr()); resultMap.put("id", company.getSequenceNbr());
// 上级单位 // 上级单位
resultMap.put("upUnit", selectUpUnitByParam(company.getSequenceNbr()+"")); resultMap.put("upUnit", selectUpUnitByParam(company.getSequenceNbr() + ""));
// 当前单位 // 当前单位
resultMap.put("currentUnit", company.getBizOrgName()); resultMap.put("currentUnit", company.getBizOrgName());
// 下级单位 // 下级单位
...@@ -232,10 +235,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -232,10 +235,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
int personNum = count(personNumWrapper); int personNum = count(personNumWrapper);
resultMap.put("personNum", personNum); resultMap.put("personNum", personNum);
if (0 == personNum) { if (0 == personNum) {
continue; continue;
} }
List<Map<String, Object>> personList = new ArrayList<>(); List<Map<String, Object>> personList = new ArrayList<>();
// 查询动态表单Phone // 查询动态表单Phone
Map<String, Object> phone = new HashMap<>(); Map<String, Object> phone = new HashMap<>();
phone.put("alert_called_id", company.getSequenceNbr()); phone.put("alert_called_id", company.getSequenceNbr());
phone.put("field_code", "companyPhone"); phone.put("field_code", "companyPhone");
...@@ -243,42 +246,41 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -243,42 +246,41 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
phoneWrapper.allEq(phone); phoneWrapper.allEq(phone);
AlertFormValue phoneValue = alertFormValueServiceImpl.getOne(phoneWrapper); AlertFormValue phoneValue = alertFormValueServiceImpl.getOne(phoneWrapper);
if (phoneValue == null) { if (phoneValue == null) {
resultMap.put("tel", ""); resultMap.put("tel", "");
} else { } else {
resultMap.put("tel", phoneValue.getFieldValue()); resultMap.put("tel", phoneValue.getFieldValue());
} }
// 获取单位人员列表信息 // 获取单位人员列表信息
personList = listPerson(company.getSequenceNbr()+"").stream().map( p -> { personList = listPerson(company.getSequenceNbr() + "").stream().map(p -> {
Map<String, Object> person = new HashMap<>(); Map<String, Object> person = new HashMap<>();
person.put("tel", getValue(p.get("telephone"), null)); person.put("tel", getValue(p.get("telephone"), null));
person.put("img", getValue(p.get("personImg"), null)); person.put("img", getValue(p.get("personImg"), null));
person.put("id", getValue(p.get("sequenceNbr"), null)); person.put("id", getValue(p.get("sequenceNbr"), null));
person.put("name", getValue(p.get("bizOrgName"), null)); person.put("name", getValue(p.get("bizOrgName"), null));
person.put("zhiwei", getValue(p.get("administrativePositionCode"), null)); person.put("zhiwei", getValue(p.get("administrativePositionCode"), null));
person.put("unit", getValue(p.get("fireManagementPostCode"), null)); person.put("unit", getValue(p.get("fireManagementPostCode"), null));
return person; return person;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
resultMap.put("children", personList); resultMap.put("children", personList);
companyPersonMsg.add(resultMap); companyPersonMsg.add(resultMap);
} }
return companyPersonMsg; return companyPersonMsg;
} }
private Object getValue(Object obj, Object defaultValue) { private Object getValue(Object obj, Object defaultValue) {
return ObjectUtils.isEmpty(obj) ? defaultValue : obj; return ObjectUtils.isEmpty(obj) ? defaultValue : obj;
} }
public List<Map<String, Object>> listPerson(String parentId) { public List<Map<String, Object>> listPerson(String parentId) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode())); map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode()));
map.put("bizOrgType", OrgPersonEnum.人员.getKey()); map.put("bizOrgType", OrgPersonEnum.人员.getKey());
map.put("parentId", parentId); map.put("parentId", parentId);
List<Map<String, Object>> list = this.baseMapper.selectPersonAllList(map); List<Map<String, Object>> list = this.baseMapper.selectPersonAllList(map);
return list == null ? new ArrayList<Map<String, Object>>() : list; return list == null ? new ArrayList<Map<String, Object>>() : list;
} }
public IPage<Map<String, Object>> pagePerson(String pageNum, String pageSize, Map<String, Object> req) { public IPage<Map<String, Object>> pagePerson(String pageNum, String pageSize, Map<String, Object> req) {
...@@ -291,9 +293,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -291,9 +293,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("bizOrgType", OrgPersonEnum.人员.getKey()); map.put("bizOrgType", OrgPersonEnum.人员.getKey());
if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) { if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) {
map.put("bizOrgName", req.get("bizOrgName")); map.put("bizOrgName", req.get("bizOrgName"));
} }
OrgUsr parent = this.getById( Long.valueOf(req.get("parentId").toString())); OrgUsr parent = this.getById(Long.valueOf(req.get("parentId").toString()));
map.put("bizOrgCode", ObjectUtils.isEmpty(parent) ? null : parent.getBizOrgCode()); map.put("bizOrgCode", ObjectUtils.isEmpty(parent) ? null : parent.getBizOrgCode());
req.remove("bizOrgName"); req.remove("bizOrgName");
req.remove("pageSize"); req.remove("pageSize");
...@@ -304,7 +306,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -304,7 +306,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
pageBean.setTotal(this.baseMapper.selectPersonListCount(map)); pageBean.setTotal(this.baseMapper.selectPersonListCount(map));
map.put("pageNum", (pageBean.getCurrent() - 1) * pageBean.getSize()); map.put("pageNum", (pageBean.getCurrent() - 1) * pageBean.getSize());
map.put("pageSize", pageBean.getSize()); map.put("pageSize", pageBean.getSize());
List<Map<String, Object>> list = this.baseMapper.selectPersonList(map); List<Map<String, Object>> list = this.baseMapper.selectPersonList(map);
pageBean.setRecords(list); pageBean.setRecords(list);
...@@ -318,11 +320,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -318,11 +320,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<FormValue> formValue = new ArrayList<>(); List<FormValue> formValue = new ArrayList<>();
for (AlertFormValueDto alertFormValue : list) { for (AlertFormValueDto alertFormValue : list) {
if (alertFormValue.getFieldValueCode() == null) { if (alertFormValue.getFieldValueCode() == null) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), alertFormValue.getFieldType(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(),
alertFormValue.getFieldValue(), alertFormValue.getBlock()); alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
} else { } else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), alertFormValue.getFieldType(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(),
alertFormValue.getFieldValueCode(), alertFormValue.getBlock()); alertFormValue.getFieldValueCode(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
} }
...@@ -335,7 +339,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -335,7 +339,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<AlertFormValueDto> list = alertFormValueServiceImpl.listByCalledId(id); List<AlertFormValueDto> list = alertFormValueServiceImpl.listByCalledId(id);
List<FormValue> formValue = new ArrayList<>(); List<FormValue> formValue = new ArrayList<>();
for (AlertFormValueDto alertFormValue : list) { for (AlertFormValueDto alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), alertFormValue.getFieldType(), FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(),
alertFormValue.getFieldValue(), alertFormValue.getBlock()); alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value); formValue.add(value);
} }
...@@ -352,54 +357,54 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -352,54 +357,54 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
orgUsr.setRecUserName(ori.getRecUserName()); orgUsr.setRecUserName(ori.getRecUserName());
orgUsr.setAmosOrgId(ori.getAmosOrgId()); orgUsr.setAmosOrgId(ori.getAmosOrgId());
orgUsr.setAmosOrgCode(ori.getAmosOrgCode()); orgUsr.setAmosOrgCode(ori.getAmosOrgCode());
if (oriOrgUsr.getParentId() != null) { if (oriOrgUsr.getParentId() != null) {
if (!ori.getParentId().equals(oriOrgUsr.getParentId())) { if (!ori.getParentId().equals(oriOrgUsr.getParentId())) {
OrgUsr parent = getById(oriOrgUsr.getParentId()); OrgUsr parent = getById(oriOrgUsr.getParentId());
if (parent != null && ObjectUtils.isEmpty(oriOrgUsr.getBizOrgCode())) { if (parent != null && ObjectUtils.isEmpty(oriOrgUsr.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
updateChildOrgCode(ori.getBizOrgCode(), parent.getBizOrgCode()); updateChildOrgCode(ori.getBizOrgCode(), parent.getBizOrgCode());
orgUsr.setParentId(oriOrgUsr.getParentId()); orgUsr.setParentId(oriOrgUsr.getParentId());
} }
} else { } else {
orgUsr.setBizOrgCode(getOrgCodeStr()); orgUsr.setBizOrgCode(getOrgCodeStr());
updateChildOrgCode(ori.getBizOrgCode(), orgUsr.getBizOrgCode()); updateChildOrgCode(ori.getBizOrgCode(), orgUsr.getBizOrgCode());
} }
updateById(orgUsr); updateById(orgUsr);
} }
private void updateChildOrgCode(String oriOrgCode, String targetOrgCode) { private void updateChildOrgCode(String oriOrgCode, String targetOrgCode) {
List<OrgUsr> list = queryOrgUsrList(oriOrgCode); List<OrgUsr> list = queryOrgUsrList(oriOrgCode);
if (ObjectUtils.isEmpty(list)) { if (ObjectUtils.isEmpty(list)) {
return; return;
} }
list.forEach(action -> { list.forEach(action -> {
action.setBizOrgCode(action.getBizOrgCode().replace(oriOrgCode, targetOrgCode)); action.setBizOrgCode(action.getBizOrgCode().replace(oriOrgCode, targetOrgCode));
updateById(action); updateById(action);
}); });
} }
public List<OrgUsr> queryOrgUsrList(String bizOrgCode) { public List<OrgUsr> queryOrgUsrList(String bizOrgCode) {
return this.baseMapper.queryOrgUsrListByBizOrgCode(bizOrgCode); return this.baseMapper.queryOrgUsrListByBizOrgCode(bizOrgCode);
} }
@Override @Override
public void saveOrgUsrAlertFormValue(OrgUsr orgUsr, List<AlertFormValue> alertFromValuelist) { public void saveOrgUsrAlertFormValue(OrgUsr orgUsr, List<AlertFormValue> alertFromValuelist) {
orgUsr.setRecDate(new Date()); orgUsr.setRecDate(new Date());
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult(); AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
orgUsr.setRecUserName(user.getRealName()); orgUsr.setRecUserName(user.getRealName());
orgUsr.setRecUserId(user.getUserId()); orgUsr.setRecUserId(user.getUserId());
// 单位新增情况 // 单位新增情况
save(orgUsr); save(orgUsr);
// 填充主键 // 填充主键
alertFromValuelist.stream().forEach(alertFromValue -> { alertFromValuelist.stream().forEach(alertFromValue -> {
if (OrgPersonEnum.公司.getKey().equals(orgUsr.getBizOrgType())) { if (OrgPersonEnum.公司.getKey().equals(orgUsr.getBizOrgType())) {
alertFromValue.setAlertTypeCode(OrgPersonEnum.公司.getCode()); alertFromValue.setAlertTypeCode(OrgPersonEnum.公司.getCode());
} else if (OrgPersonEnum.部门.getKey().equals(orgUsr.getBizOrgType())) { } else if (OrgPersonEnum.部门.getKey().equals(orgUsr.getBizOrgType())) {
alertFromValue.setAlertTypeCode(OrgPersonEnum.部门.getCode()); alertFromValue.setAlertTypeCode(OrgPersonEnum.部门.getCode());
} }
alertFromValue.setAlertCalledId(orgUsr.getSequenceNbr()); alertFromValue.setAlertCalledId(orgUsr.getSequenceNbr());
}); });
// 保存动态表单数据 // 保存动态表单数据
...@@ -414,7 +419,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -414,7 +419,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}); });
List<AlertFormValueDto> formList = alertFormValueServiceImpl.queryByCalledId(orgUsr.getSequenceNbr()); List<AlertFormValueDto> formList = alertFormValueServiceImpl.queryByCalledId(orgUsr.getSequenceNbr());
if (formList != null && formList.size() > 0) { if (formList != null && formList.size() > 0) {
for (AlertFormValue dis : alertFromValuelist) { for (AlertFormValue dis : alertFromValuelist) {
for (AlertFormValueDto src : formList) { for (AlertFormValueDto src : formList) {
if (dis.getAlertFormId() == src.getAlertFormId()) { if (dis.getAlertFormId() == src.getAlertFormId()) {
dis.setSequenceNbr(src.getSequenceNbr()); dis.setSequenceNbr(src.getSequenceNbr());
...@@ -428,34 +433,35 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -428,34 +433,35 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
} }
} }
// 保存动态表单数据 // 保存动态表单数据
alertFormValueServiceImpl.updateBatchById(alertFromValuelist); alertFormValueServiceImpl.updateBatchById(alertFromValuelist);
List<AlertFormDto> form = alertFormServiceImpl.queryListByTypeCode(formList.get(0).getAlertTypeCode()); List<AlertFormDto> form = alertFormServiceImpl.queryListByTypeCode(formList.get(0).getAlertTypeCode());
if (form.size() != alertFromValuelist.size()) { if (form.size() != alertFromValuelist.size()) {
List<AlertFormValue> creatList = new ArrayList<>(); List<AlertFormValue> creatList = new ArrayList<>();
for (AlertFormValue dis : alertFromValuelist) { for (AlertFormValue dis : alertFromValuelist) {
boolean exist = false; boolean exist = false;
for (AlertFormValueDto src : formList) { for (AlertFormValueDto src : formList) {
if (dis.getAlertFormId() == src.getSequenceNbr()) { if (dis.getAlertFormId() == src.getSequenceNbr()) {
exist = true; exist = true;
break; break;
} }
} }
if (ObjectUtils.isEmpty(dis) && !exist) { if (ObjectUtils.isEmpty(dis) && !exist) {
creatList.add(dis); creatList.add(dis);
} }
} }
alertFormValueServiceImpl.saveBatch(creatList); alertFormValueServiceImpl.saveBatch(creatList);
} }
List<AlertFormValue> creatList = alertFromValuelist.stream().filter(v -> v.getSequenceNbr() == null || v.getSequenceNbr() == 0).collect(Collectors.toList()); List<AlertFormValue> creatList =
alertFromValuelist.stream().filter(v -> v.getSequenceNbr() == null || v.getSequenceNbr() == 0).collect(Collectors.toList());
if (creatList != null && creatList.size() > 0) { if (creatList != null && creatList.size() > 0) {
alertFormValueServiceImpl.saveBatch(creatList); alertFormValueServiceImpl.saveBatch(creatList);
} }
} else { } else {
// 保存动态表单数据 // 保存动态表单数据
...@@ -466,13 +472,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -466,13 +472,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public Map<String, Object> selectForShowById(OrgUsr orgUsr, Long id) throws Exception { public Map<String, Object> selectForShowById(OrgUsr orgUsr, Long id) throws Exception {
QueryWrapper<AlertForm> queryWrapper = new QueryWrapper<AlertForm>(); QueryWrapper<AlertForm> queryWrapper = new QueryWrapper<AlertForm>();
queryWrapper.eq("alert_type_code",OrgPersonEnum.人员.getCode()); queryWrapper.eq("alert_type_code", OrgPersonEnum.人员.getCode());
List<AlertForm> alertForms = alertFormServiceImpl.list(queryWrapper); List<AlertForm> alertForms = alertFormServiceImpl.list(queryWrapper);
// 动态表单数据 // 动态表单数据
List<AlertFormValueDto> list = alertFormValueServiceImpl.listByCalledId(id); List<AlertFormValueDto> list = alertFormValueServiceImpl.listByCalledId(id);
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = Bean.BeantoMap(orgUsr); result = Bean.BeantoMap(orgUsr);
result.put("parenName",getById(orgUsr.getParentId()).getBizOrgName()); result.put("parenName", getById(orgUsr.getParentId()).getBizOrgName());
// 放入所有动态表单数据 // 放入所有动态表单数据
for (AlertForm alertForm : alertForms) { for (AlertForm alertForm : alertForms) {
result.put(alertForm.getFieldCode(), null); result.put(alertForm.getFieldCode(), null);
...@@ -485,11 +491,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -485,11 +491,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<OrgUsr> selectCompanyDepartmentMsg() { public List<OrgUsr> selectCompanyDepartmentMsg() {
List<OrgUsr> list = this.baseMapper.selectCompanyDepartmentMsg(); List<OrgUsr> list = this.baseMapper.selectCompanyDepartmentMsg();
if (list == null) { if (list == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
list = list.stream().filter(o -> !ObjectUtils.isEmpty(o)).collect(Collectors.toList()); list = list.stream().filter(o -> !ObjectUtils.isEmpty(o)).collect(Collectors.toList());
return list; return list;
} }
...@@ -499,12 +505,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -499,12 +505,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
BeanUtils.copyProperties(OrgUsrVo, orgUsr); BeanUtils.copyProperties(OrgUsrVo, orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY); orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
if (OrgUsrVo.getParentId() != null) { if (OrgUsrVo.getParentId() != null) {
OrgUsr parent = getById(OrgUsrVo.getParentId()); OrgUsr parent = getById(OrgUsrVo.getParentId());
if (parent != null && ObjectUtils.isEmpty(OrgUsrVo.getBizOrgCode())) { if (parent != null && ObjectUtils.isEmpty(OrgUsrVo.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
} else { } else {
orgUsr.setBizOrgCode(getOrgCodeStr()); orgUsr.setBizOrgCode(getOrgCodeStr());
} }
saveOrgUsrAlertFormValue(orgUsr, OrgUsrVo.getAlertFormValue()); saveOrgUsrAlertFormValue(orgUsr, OrgUsrVo.getAlertFormValue());
} }
...@@ -515,20 +521,20 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -515,20 +521,20 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
BeanUtils.copyProperties(OrgPersonVo, orgUsr); BeanUtils.copyProperties(OrgPersonVo, orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON); orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
if (OrgPersonVo.getParentId() != null) { if (OrgPersonVo.getParentId() != null) {
OrgUsr parent = getById(OrgPersonVo.getParentId()); OrgUsr parent = getById(OrgPersonVo.getParentId());
if (parent != null && ObjectUtils.isEmpty(OrgPersonVo.getBizOrgCode())) { if (parent != null && ObjectUtils.isEmpty(OrgPersonVo.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
} else { } else {
orgUsr.setBizOrgCode(getOrgCodeStr()); orgUsr.setBizOrgCode(getOrgCodeStr());
} }
if (!ObjectUtils.isEmpty(OrgPersonVo.getAmosOrgId())) { if (!ObjectUtils.isEmpty(OrgPersonVo.getAmosOrgId())) {
AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult(); AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult();
OrgPersonVo.setAmosOrgCode(user.getRealName()); OrgPersonVo.setAmosOrgCode(user.getRealName());
} }
saveOrgUsrAlertFormValue(orgUsr, OrgPersonVo.getAlertFormValue()); saveOrgUsrAlertFormValue(orgUsr, OrgPersonVo.getAlertFormValue());
} }
...@@ -539,12 +545,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -539,12 +545,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr oriOrgUsr = getById(id); OrgUsr oriOrgUsr = getById(id);
BeanUtils.copyProperties(OrgUsrVo, orgUsr); BeanUtils.copyProperties(OrgUsrVo, orgUsr);
if (orgUsr.getParentId() != null) { if (orgUsr.getParentId() != null) {
OrgUsr parent = getById(orgUsr.getParentId()); OrgUsr parent = getById(orgUsr.getParentId());
if (parent != null && ObjectUtils.isEmpty(OrgUsrVo.getBizOrgCode())) { if (parent != null && ObjectUtils.isEmpty(OrgUsrVo.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
} else { } else {
orgUsr.setBizOrgCode(getOrgCodeStr()); orgUsr.setBizOrgCode(getOrgCodeStr());
} }
saveOrgUsr(orgUsr, id); saveOrgUsr(orgUsr, id);
// 保存动态表单数据 // 保存动态表单数据
...@@ -558,13 +564,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -558,13 +564,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr oriOrgUsr = getById(id); OrgUsr oriOrgUsr = getById(id);
BeanUtils.copyProperties(OrgPersonVo, orgUsr); BeanUtils.copyProperties(OrgPersonVo, orgUsr);
if (!ObjectUtils.isEmpty(OrgPersonVo.getAmosOrgId())) { if (!ObjectUtils.isEmpty(OrgPersonVo.getAmosOrgId())) {
AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult(); AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult();
oriOrgUsr.setAmosOrgCode(user.getRealName()); oriOrgUsr.setAmosOrgCode(user.getRealName());
oriOrgUsr.setAmosOrgId(user.getUserId()); oriOrgUsr.setAmosOrgId(user.getUserId());
orgUsr.setAmosOrgCode(user.getRealName()); orgUsr.setAmosOrgCode(user.getRealName());
orgUsr.setAmosOrgId(user.getUserId()); orgUsr.setAmosOrgId(user.getUserId());
} }
saveOrgUsr(oriOrgUsr, id); saveOrgUsr(oriOrgUsr, id);
// 保存动态表单数据 // 保存动态表单数据
updateAlertFormValue(oriOrgUsr, orgUsr.getSequenceNbr(), OrgPersonVo.getAlertFormValue()); updateAlertFormValue(oriOrgUsr, orgUsr.getSequenceNbr(), OrgPersonVo.getAlertFormValue());
...@@ -631,9 +637,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -631,9 +637,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
BeanUtils.copyProperties(orgUsr, orgPersonFormVo); BeanUtils.copyProperties(orgUsr, orgPersonFormVo);
OrgUsr parent = getById(orgUsr.getParentId()); OrgUsr parent = getById(orgUsr.getParentId());
if (!ObjectUtils.isEmpty(parent)) { if (!ObjectUtils.isEmpty(parent)) {
orgPersonFormVo.setParentName(parent.getBizOrgName()); orgPersonFormVo.setParentName(parent.getBizOrgName());
} }
return orgPersonFormVo; return orgPersonFormVo;
} }
...@@ -655,7 +661,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -655,7 +661,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
columnMap.put("is_delete", CommonConstant.IS_DELETE_00); columnMap.put("is_delete", CommonConstant.IS_DELETE_00);
columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON); columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON);
Collection<OrgUsr> list = listByMap(columnMap); Collection<OrgUsr> list = listByMap(columnMap);
return getTree(null, list, OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType"); return getTree(null, list, OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId",
"getBizOrgType");
} }
...@@ -675,12 +682,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -675,12 +682,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
BeanUtils.copyProperties(OrgDepartmentVo, orgUsr); BeanUtils.copyProperties(OrgDepartmentVo, orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_DEPARTMENT); orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_DEPARTMENT);
if (OrgDepartmentVo.getParentId() != null) { if (OrgDepartmentVo.getParentId() != null) {
OrgUsr parent = getById(OrgDepartmentVo.getParentId()); OrgUsr parent = getById(OrgDepartmentVo.getParentId());
if (parent != null && ObjectUtils.isEmpty(OrgDepartmentVo.getBizOrgCode())) { if (parent != null && ObjectUtils.isEmpty(OrgDepartmentVo.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
} else { } else {
orgUsr.setBizOrgCode(getOrgCodeStr()); orgUsr.setBizOrgCode(getOrgCodeStr());
} }
saveOrgUsrAlertFormValue(orgUsr, OrgDepartmentVo.getAlertFormValue()); saveOrgUsrAlertFormValue(orgUsr, OrgDepartmentVo.getAlertFormValue());
} }
...@@ -692,12 +699,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -692,12 +699,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr oriOrgUsr = getById(id); OrgUsr oriOrgUsr = getById(id);
BeanUtils.copyProperties(OrgDepartmentVo, orgUsr); BeanUtils.copyProperties(OrgDepartmentVo, orgUsr);
if (orgUsr.getParentId() != null) { if (orgUsr.getParentId() != null) {
OrgUsr parent = getById(orgUsr.getParentId()); OrgUsr parent = getById(orgUsr.getParentId());
if (parent != null && ObjectUtils.isEmpty(OrgDepartmentVo.getBizOrgCode())) { if (parent != null && ObjectUtils.isEmpty(OrgDepartmentVo.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
} else { } else {
orgUsr.setBizOrgCode(getOrgCodeStr()); orgUsr.setBizOrgCode(getOrgCodeStr());
} }
saveOrgUsr(orgUsr, id); saveOrgUsr(orgUsr, id);
// 保存动态表单数据 // 保存动态表单数据
...@@ -724,16 +731,138 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -724,16 +731,138 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
return personResult; return personResult;
} }
public static String getOrgCodeStr(){ public static String getOrgCodeStr() {
int length = 6; int length = 6;
String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Random random=new Random(); Random random = new Random();
StringBuffer sb=new StringBuffer(); StringBuffer sb = new StringBuffer();
for(int i=0;i<length;i++){ for (int i = 0; i < length; i++) {
int number=random.nextInt(62); int number = random.nextInt(62);
sb.append(str.charAt(number)); sb.append(str.charAt(number));
} }
return sb.toString(); return sb.toString();
} }
public void importByExcel(List<ExcelOrgPersonDto> list) {
list.forEach(item -> {
OrgPersonDto orgPersonDto = new OrgPersonDto();
orgPersonDto = Bean.toPo(item, orgPersonDto);
List<AlertFormValue> alertFormValueList = new ArrayList<>();
if (item.getPersonNumber() != null) {
AlertFormValue alertFormValue = new AlertFormValue(102L, "246", "员工编号", "personNumber",
item.getPersonNumber(), null, false);
alertFormValueList.add(alertFormValue);
}
if (item.getCertificatesType() != null) {
String certificatesType = item.getCertificatesType();
String[] split = certificatesType.split("@");
AlertFormValue alertFormValue = new AlertFormValue(23L, "246", "证件类型", "certificatesTypeCode"
, split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getGender() != null) {
String gender = item.getGender();
String[] split = gender.split("@");
AlertFormValue alertFormValue = new AlertFormValue(22L, "246", "性别", "gender", split[0],
split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getCertificatesNumber() != null) {
AlertFormValue alertFormValue = new AlertFormValue(100L, "246", "证件号码", "certificatesNumber",
item.getCertificatesNumber(), null, false);
alertFormValueList.add(alertFormValue);
}
if (item.getTelephone() != null) {
AlertFormValue alertFormValue = new AlertFormValue(24L, "246", "联系电话", "telephone",
item.getTelephone(), null, false);
alertFormValueList.add(alertFormValue);
}
if (item.getState() != null) {
String state = item.getState();
String[] split = state.split("@");
AlertFormValue alertFormValue = new AlertFormValue(25L, "246", "人员状态", "stateCode", split[0],
split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getSafetyTraining() != null) {
String safetyTraining = item.getSafetyTraining();
String[] split = safetyTraining.split("@");
AlertFormValue alertFormValue = new AlertFormValue(29L, "246", "是否进行安全培训", "safetyTraining",
split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getAdministrativePosition() != null) {
String administrativePosition = item.getAdministrativePosition();
String[] split = administrativePosition.split("@");
AlertFormValue alertFormValue = new AlertFormValue(28L, "246", "行政职务",
"administrativePositionCode", split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getInternalPosition() != null) {
String internalPosition = item.getInternalPosition();
String[] split = internalPosition.split("@");
AlertFormValue alertFormValue = new AlertFormValue(26L, "246", "消防管理组织机构内部职务",
"internalPositionCode", split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getFireManagementPost() != null) {
String fireManagementPost = item.getFireManagementPost();
String[] split = fireManagementPost.split("@");
AlertFormValue alertFormValue = new AlertFormValue(27L, "246", "消防管理岗位",
"fireManagementPostCode", split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getPositionType() != null) {
String positionType = item.getPositionType();
String[] split = positionType.split("@");
AlertFormValue alertFormValue = new AlertFormValue(30L, "246", "岗位类型", "positionType",
split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getCertificateType() != null) {
String certificateType = item.getCertificateType();
String[] split = certificateType.split("@");
AlertFormValue alertFormValue = new AlertFormValue(31L, "246", "持证类别", "certificateType",
split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getHoldingTime() != null) {
AlertFormValue alertFormValue = new AlertFormValue(32L, "246", "持证时间", "holdingTime",
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(item.getHoldingTime()), null, false);
alertFormValueList.add(alertFormValue);
}
if (item.getAuditCycle() != null) {
String auditCycle = item.getAuditCycle();
String[] split = auditCycle.split("@");
AlertFormValue alertFormValue = new AlertFormValue(33L, "246", "审核周期", "auditCycle",
split[0], split[1], false);
alertFormValueList.add(alertFormValue);
}
if (item.getPersonImg() != null) {
AlertFormValue alertFormValue = new AlertFormValue(34L, "246", "人员照片", "personImg",
item.getPersonImg(), null, false);
alertFormValueList.add(alertFormValue);
}
if (item.getCertificateImg() != null) {
AlertFormValue alertFormValue = new AlertFormValue(101L, "246", "重点工种资质证书", "certificateImg",
item.getCertificateImg(), null, false);
alertFormValueList.add(alertFormValue);
}
try {
orgPersonDto.setAlertFormValue(alertFormValueList);
this.saveOrgPerson(orgPersonDto);
} catch (Exception e) {
e.printStackTrace();
}
}
);
}
public List<ExcelOrgPersonDto> queryOrgPersonDtoList(boolean isDelete) {
List<ExcelOrgPersonDto> excelOrgPersonDtoList = orgUsrMapper.queryOrgPersonDtoList(isDelete);
return excelOrgPersonDtoList;
}
} }
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.ArrayList; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import javax.annotation.Resource; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import javax.servlet.http.HttpServletResponse; import com.yeejoin.amos.boot.module.common.biz.service.impl.DataSourcesImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AircraftServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
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.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -26,18 +22,9 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -26,18 +22,9 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import java.util.ArrayList;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto; import java.util.List;
import com.yeejoin.amos.boot.module.common.api.excel.DataSources;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AircraftServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
...@@ -53,7 +40,8 @@ public class AircraftController extends BaseController { ...@@ -53,7 +40,8 @@ public class AircraftController extends BaseController {
@Autowired @Autowired
private AircraftServiceImpl aircraftServiceImpl; private AircraftServiceImpl aircraftServiceImpl;
@Autowired
DataSourcesImpl dataSourcesImpl;
/** /**
* 新增航空器信息 * 新增航空器信息
...@@ -144,7 +132,7 @@ public class AircraftController extends BaseController { ...@@ -144,7 +132,7 @@ public class AircraftController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入航空器") @ApiOperation(value = "导入航空器")
@PostMapping("/import_batch") @PostMapping("/import_batch")
public void importByExcel(MultipartFile multipartFile, HttpServletResponse response) throws Exception { public void importByExcel(MultipartFile multipartFile) throws Exception {
List<AircraftDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, List<AircraftDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class,
1); 1);
List<Aircraft> excelEntityList = new ArrayList<>(); List<Aircraft> excelEntityList = new ArrayList<>();
...@@ -168,6 +156,31 @@ public class AircraftController extends BaseController { ...@@ -168,6 +156,31 @@ public class AircraftController extends BaseController {
aircraftServiceImpl.saveBatch(excelEntityList); aircraftServiceImpl.saveBatch(excelEntityList);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出航空器")
@GetMapping("/export")
public void exportToExcel(HttpServletResponse response, ExcelDto excelDto) {
try {
List<AircraftDto> data = aircraftServiceImpl.queryAircraftDtoForList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
AircraftDto.class, null, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "下载航空器模板")
@GetMapping("/template")
public void template(HttpServletResponse response, ExcelDto excelDto) {
try {
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null,
AircraftDto.class, dataSourcesImpl, true);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
} }
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -29,13 +8,28 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -29,13 +8,28 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto; import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
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.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam; import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
/** /**
* 消防队伍 * 消防队伍
...@@ -189,4 +183,40 @@ public class FireTeamController extends BaseController { ...@@ -189,4 +183,40 @@ public class FireTeamController extends BaseController {
page = iFireTeamService.page(pageBean, fireTeamQueryWrapper); page = iFireTeamService.page(pageBean, fireTeamQueryWrapper);
return page; return page;
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入消防队伍")
@PostMapping("/import_batch")
public void importByExcel(MultipartFile multipartFile, HttpServletResponse response) throws Exception {
List<FireTeamDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile, FireTeamDto.class,
1);
List<FireTeam> excelEntityList = new ArrayList<>();
excelDtoList.forEach(
item -> {
FireTeam fireTeam = new FireTeam();
fireTeam = Bean.toPo(item, fireTeam);
if (fireTeam.getType() != null) {
String[] type = fireTeam.getType().split("@");
fireTeam.setType(type[0]);
fireTeam.setTypeCode(type[1]);
}
excelEntityList.add(fireTeam);
}
);
iFireTeamService.saveBatch(excelEntityList);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出消防队伍")
@GetMapping("/export")
public void exportToExcel(HttpServletResponse response, ExcelDto excelDto) {
try {
List<FireTeamDto> data = iFireTeamService.queryFireTeamForList(false);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), data,
FireTeamDto.class, null, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary; import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.excel.DataSources; 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.api.mapper.DataDictionaryMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class DataSourcesImpl implements DataSources { public class DataSourcesImpl implements DataSources {
@Resource @Resource
DataDictionaryMapper dataDictionaryMapper; DataDictionaryMapper dataDictionaryMapper;
@Override @Override
public String[] selectList(String type, String method) { public String[] selectList(String type, String method) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type); queryWrapper.eq("type", type);
queryWrapper.isNull("parent"); if ("ZJLY".equals(type)) {
queryWrapper.orderByAsc("sort_num"); queryWrapper.isNull("parent");
List<DataDictionary> list = dataDictionaryMapper.selectList(queryWrapper); }
List<String> names = list.stream().map(dataDictionary -> { queryWrapper.orderByAsc("sort_num");
return dataDictionary.getName() + "@" + dataDictionary.getCode(); List<DataDictionary> list = dataDictionaryMapper.selectList(queryWrapper);
}).collect(Collectors.toList()); List<String> names = list.stream().map(dataDictionary -> {
String[] str = names.toArray(new String[names.size()]); return dataDictionary.getName() + "@" + dataDictionary.getCode();
return str; }).collect(Collectors.toList());
} String[] str = names.toArray(new String[names.size()]);
return str;
}
} }
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
...@@ -21,59 +11,73 @@ import com.yeejoin.amos.boot.module.common.api.entity.FireTeam; ...@@ -21,59 +11,73 @@ import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService; import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 消防队伍 服务实现类 * 消防队伍 服务实现类
* *
* @author tb * @author tb
* @date 2021-06-07 * @date 2021-06-07
*/ */
@Service @Service
public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam,FireTeamMapper> implements IFireTeamService { public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, FireTeamMapper> implements IFireTeamService {
@Autowired @Resource
FireTeamMapper fireTeamMapper; FireTeamMapper fireTeamMapper;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired /**
EquipFeignClient equipFeignClient; * 获取监控大队列表
*
* @return
*/
public List<FireBrigadeResourceDto> listMonitorFireBrigade() {
return fireTeamMapper.listMonitorFireBrigade();
}
/** /**
* 获取监控大队列表 * 消防队伍分页查询
* *
* @return * @param page 分页对象
*/ * @param team 查询参数
public List<FireBrigadeResourceDto> listMonitorFireBrigade() { * @return
return fireTeamMapper.listMonitorFireBrigade(); */
} 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()));
}
}
IPage<FireTeamCardDto> fireTeamListPage = this.baseMapper.getFireTeamForPage(page, team);
List<FireTeamCardDto> fireTeamList = fireTeamListPage.getRecords();
Map<Object, Long> finalTeamCarCountMap = teamCarCountMap;
fireTeamList.forEach(t -> {
if (!ValidationUtil.isEmpty(finalTeamCarCountMap.get(t.getSequenceNbr().toString()))) {
t.setCarNum(finalTeamCarCountMap.get(t.getSequenceNbr().toString()).intValue());
}
});
fireTeamListPage.setRecords(fireTeamList);
return fireTeamListPage;
}
/** public List<FireTeamDto> queryFireTeamForList(Boolean isDelete) {
* 消防队伍分页查询 return fireTeamMapper.listFireTeamDto(isDelete);
* }
* @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()));
}
}
IPage<FireTeamCardDto> fireTeamListPage = this.baseMapper.getFireTeamForPage(page, team);
List<FireTeamCardDto> fireTeamList = fireTeamListPage.getRecords();
Map<Object, Long> finalTeamCarCountMap = teamCarCountMap;
fireTeamList.forEach(t -> {
if (!ValidationUtil.isEmpty(finalTeamCarCountMap.get(t.getSequenceNbr().toString()))) {
t.setCarNum(finalTeamCarCountMap.get(t.getSequenceNbr().toString()).intValue());
}
});
fireTeamListPage.setRecords(fireTeamList);
return fireTeamListPage;
}
} }
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