Browse Source

与前端对接机构与值班

develop
zhao-meiyu 1 year ago
parent
commit
dcdf368046
  1. 2
      zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java
  2. 5
      zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java
  3. 183
      zc-business/src/main/java/com/zc/business/domain/DcOrganizationExport.java
  4. 40
      zc-business/src/main/java/com/zc/business/domain/DcShifts.java
  5. 6
      zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java
  6. 4
      zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java
  7. 9
      zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java
  8. 17
      zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml
  9. 15
      zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

2
zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java

@ -55,7 +55,7 @@ public class DcEmployeesController extends BaseController
* 导出值班人员信息列表 * 导出值班人员信息列表
*/ */
@ApiOperation("导出值班人员信息列表") @ApiOperation("导出值班人员信息列表")
//@PreAuthorize("@ss.hasPermi('business:employees:export')") @PreAuthorize("@ss.hasPermi('business:employees:export')")
@Log(title = "值班人员信息", businessType = BusinessType.EXPORT) @Log(title = "值班人员信息", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, DcEmployees dcEmployees) public void export(HttpServletResponse response, DcEmployees dcEmployees)

5
zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zc.business.domain.DcOrganizationExport;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -61,8 +62,8 @@ public class DcOrganizationController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, DcOrganization dcOrganization) public void export(HttpServletResponse response, DcOrganization dcOrganization)
{ {
List<DcOrganization> list = dcOrganizationService.selectDcOrganizationListExport(dcOrganization); List<DcOrganizationExport> list = dcOrganizationService.selectDcOrganizationListExport(dcOrganization);
ExcelUtil<DcOrganization> util = new ExcelUtil<>(DcOrganization.class); ExcelUtil<DcOrganizationExport> util = new ExcelUtil<>(DcOrganizationExport.class);
util.exportExcel(response, list, "机构管理数据"); util.exportExcel(response, list, "机构管理数据");
} }

183
zc-business/src/main/java/com/zc/business/domain/DcOrganizationExport.java

@ -0,0 +1,183 @@
package com.zc.business.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.TreeEntity;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* @author 王思祥
* @ClassName DcOrganizationExport
*/
public class DcOrganizationExport extends TreeEntity {
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 1-运管中心2-驻点 */
@ApiModelProperty(value = "类型1-运管中心 2-驻点", required = true)
@Excel(name = "1-运管中心 2-驻点")
private Integer organizationType;
/** 名称 */
@ApiModelProperty(value = "名称", required = true)
@Excel(name = "名称")
private String organizationName;
/** 地址 */
@ApiModelProperty("地址")
@Excel(name = "地址")
private String organizationAddress;
/** 桩号 */
@ApiModelProperty("桩号")
@Excel(name = "桩号")
private String stakeMark;
/** 救援单位 */
@ApiModelProperty("救援单位")
@Excel(name = "救援单位")
private String rescueUnit;
/** 描述 */
@ApiModelProperty("描述")
@Excel(name = "描述")
private String description;
/** 方向 */
@ApiModelProperty(value = "方向", required = true)
@Excel(name = "方向")
private String direction;
/** 机构人员数量 */
@ApiModelProperty(value = "机构人员数量", required = true)
@Excel(name = "机构人员数量")
private String employeesNum;
/** 经度 */
@ApiModelProperty(value = "经度", required = true)
@Excel(name = "经度")
private String longitude;
/** 纬度 */
@ApiModelProperty(value = "纬度", required = true)
@Excel(name = "纬度")
private String latitude;
public String getEmployeesNum() {
return employeesNum;
}
public void setEmployeesNum(String employeesNum) {
this.employeesNum = employeesNum;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOrganizationType(Integer organizationType)
{
this.organizationType = organizationType;
}
public Integer getOrganizationType()
{
return organizationType;
}
public void setOrganizationName(String organizationName)
{
this.organizationName = organizationName;
}
public String getOrganizationName()
{
return organizationName;
}
public void setOrganizationAddress(String organizationAddress)
{
this.organizationAddress = organizationAddress;
}
public String getOrganizationAddress()
{
return organizationAddress;
}
public void setStakeMark(String stakeMark)
{
this.stakeMark = stakeMark;
}
public String getStakeMark()
{
return stakeMark;
}
public void setRescueUnit(String rescueUnit)
{
this.rescueUnit = rescueUnit;
}
public String getRescueUnit()
{
return rescueUnit;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("parentId", getParentId())
.append("organizationType", getOrganizationType())
.append("organizationName", getOrganizationName())
.append("organizationAddress", getOrganizationAddress())
.append("stakeMark", getStakeMark())
.append("rescueUnit", getRescueUnit())
.append("description", getDescription())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

40
zc-business/src/main/java/com/zc/business/domain/DcShifts.java

@ -40,14 +40,14 @@ public class DcShifts extends BaseEntity
/** 开始时间 */ /** 开始时间 */
@ApiModelProperty("开始时间") @ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "开始时间", width = 30, dateFormat = "HH:mm:ss")
private Date startTime; private Date startTime;
/** 结束时间 */ /** 结束时间 */
@ApiModelProperty("结束时间") @ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "结束时间", width = 30, dateFormat = "HH:mm:ss")
private Date endTime; private Date endTime;
@ApiModelProperty("姓名") @ApiModelProperty("姓名")
@ -65,7 +65,29 @@ public class DcShifts extends BaseEntity
private String remark; private String remark;
@ApiModelProperty("所属路管驻点名称") @ApiModelProperty("所属路管驻点名称")
@Excel(name = "所属路管驻点名称") @Excel(name = "所属路管驻点名称")
private String stationName; private String organizationName;
@ApiModelProperty("排班 1-白班 2-夜班")
@Excel(name = "排班 1-白班 2-夜班")
private String scheduling;
@ApiModelProperty("驻点id")
@Excel(name = "驻点id")
private String station;
public String getScheduling() {
return scheduling;
}
public String getStation() {
return station;
}
public void setStation(String station) {
this.station = station;
}
public void setScheduling(String scheduling) {
this.scheduling = scheduling;
}
public Long getIdBefore() { public Long getIdBefore() {
return idBefore; return idBefore;
@ -75,12 +97,12 @@ public class DcShifts extends BaseEntity
this.idBefore = idBefore; this.idBefore = idBefore;
} }
public String getStationName() { public String getOrganizationName() {
return stationName; return organizationName;
} }
public void setStationName(String stationName) { public void setOrganizationName(String organizationName) {
this.stationName = stationName; this.organizationName = organizationName;
} }
public String getName() { public String getName() {

6
zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java

@ -5,6 +5,7 @@ import java.util.List;
import cn.hutool.core.lang.hash.Hash; import cn.hutool.core.lang.hash.Hash;
import com.zc.business.domain.DcOrganization; import com.zc.business.domain.DcOrganization;
import com.zc.business.domain.DcOrganizationExport;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -30,7 +31,8 @@ public interface DcOrganizationMapper
* @return 机构管理集合 * @return 机构管理集合
*/ */
List<DcOrganization> selectDcOrganizationList(DcOrganization dcOrganization); List<DcOrganization> selectDcOrganizationList(DcOrganization dcOrganization);
//导出列表
List<DcOrganizationExport> selectDcOrganizationListExport(DcOrganization dcOrganization);
/** /**
* 新增机构管理 * 新增机构管理
* *
@ -69,5 +71,7 @@ public interface DcOrganizationMapper
List<HashMap> selectDcOrganizationCar(Long id); List<HashMap> selectDcOrganizationCar(Long id);
//计算机构人数 //计算机构人数
String selectEmployeesNum(Long id); String selectEmployeesNum(Long id);
//根据桩号和方向拿到经纬度
HashMap<String,Object> coordinate(@Param("stakeMark") String stakeMark,@Param("direction")String direction);
} }

4
zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.zc.business.domain.DcOrganization; import com.zc.business.domain.DcOrganization;
import com.zc.business.domain.DcOrganizationExport;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -30,7 +31,8 @@ public interface IDcOrganizationService
*/ */
ArrayList<HashMap> selectDcOrganizationList(DcOrganization dcOrganization); ArrayList<HashMap> selectDcOrganizationList(DcOrganization dcOrganization);
List<DcOrganization> selectDcOrganizationListExport(DcOrganization dcOrganization); List<DcOrganizationExport> selectDcOrganizationListExport(DcOrganization dcOrganization);
/** /**
* 新增机构管理 * 新增机构管理
* *

9
zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Scanner; import java.util.Scanner;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.zc.business.domain.DcOrganizationExport;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.checkerframework.framework.qual.FromByteCode; import org.checkerframework.framework.qual.FromByteCode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -53,21 +54,23 @@ public class DcOrganizationServiceImpl implements IDcOrganizationService
return null; return null;
} }
for (DcOrganization dcOrganizations:dcOrganizationsList){ for (DcOrganization dcOrganizations:dcOrganizationsList){
Long id = dcOrganizations.getId(); Long id = dcOrganizations.getId();;
List<HashMap> car = dcOrganizationMapper.selectDcOrganizationCar(id); List<HashMap> car = dcOrganizationMapper.selectDcOrganizationCar(id);
String employeesNum = dcOrganizationMapper.selectEmployeesNum(id); String employeesNum = dcOrganizationMapper.selectEmployeesNum(id);
HashMap<String, Object> coordinate = dcOrganizationMapper.coordinate(dcOrganizations.getStakeMark(), dcOrganizations.getDirection());
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("car",car); map.put("car",car);
map.put("dcOrganizations",dcOrganizations); map.put("dcOrganizations",dcOrganizations);
map.put("employeesNum",employeesNum); map.put("employeesNum",employeesNum);
map.put("coordinate",coordinate);
objects.add(map); objects.add(map);
} }
return objects; return objects;
} }
@Override @Override
public List<DcOrganization> selectDcOrganizationListExport(DcOrganization dcOrganization) { public List<DcOrganizationExport> selectDcOrganizationListExport(DcOrganization dcOrganization) {
return dcOrganizationMapper.selectDcOrganizationList(dcOrganization); return dcOrganizationMapper.selectDcOrganizationListExport(dcOrganization);
} }

17
zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml

@ -34,7 +34,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="organizationName != null and organizationName != ''"> and organization_name like concat('%', #{organizationName}, '%')</if> <if test="organizationName != null and organizationName != ''"> and organization_name like concat('%', #{organizationName}, '%')</if>
</where> </where>
</select> </select>
<select id="selectDcOrganizationListExport" resultType="com.zc.business.domain.DcOrganizationExport">
SELECT organization.id,organization.parent_id,mark.longitude,mark.latitude,organization.direction,
(SELECT COUNT(1) FROM dc_employees AS employees WHERE employees.organization_id=organization.id) employeesNum,
organization.organization_type, organization.organization_name,
organization.organization_address, organization.stake_mark,
organization.rescue_unit, organization.description, organization.create_time,
organization.update_time FROM dc_organization AS organization
LEFT JOIN dc_stake_mark AS mark ON mark.stake_mark=organization.stake_mark
</select>
<select id="selectDcOrganizationById" parameterType="Long" resultMap="DcOrganizationResult"> <select id="selectDcOrganizationById" parameterType="Long" resultMap="DcOrganizationResult">
<include refid="selectDcOrganizationVo"/> <include refid="selectDcOrganizationVo"/>
where id = #{id} where id = #{id}
@ -109,4 +119,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectEmployeesNum" resultType="java.lang.String"> <select id="selectEmployeesNum" resultType="java.lang.String">
select count(1) from dc_employees where organization_id=#{id} select count(1) from dc_employees where organization_id=#{id}
</select> </select>
<select id="coordinate" resultType="java.util.HashMap">
select ifnull(longitude,null)longitude,ifnull(latitude,null)latitude from
dc_stake_mark where stake_mark=#{stakeMark} and direction=#{direction}
</select>
</mapper> </mapper>

15
zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml

@ -20,12 +20,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectDcShiftsVo"> <sql id="selectDcShiftsVo">
select shifts.id, shifts.employees_id, select shifts.id, shifts.employees_id,shifts.station,
employees.name,employees.contact_number,post.post_name, employees.name,employees.contact_number,post.post_name,organization.organization_name,
shifts.date, shifts.start_time, shifts.end_time, shifts.date, shifts.start_time, shifts.end_time,shifts.scheduling,
shifts.remark, shifts.create_time, shifts.update_time from dc_shifts as shifts shifts.remark, shifts.create_time, shifts.update_time from dc_shifts as shifts
left join dc_employees as employees on employees.id=shifts.employees_id left join dc_employees as employees on employees.id=shifts.employees_id
left join sys_post as post on employees.post_id=post.post_id left join sys_post as post on employees.post_id=post.post_id
left join dc_organization as organization on organization.id=shifts.station
</sql> </sql>
<select id="selectDcShiftsList" parameterType="DcShifts" resultMap="DcShiftsResult"> <select id="selectDcShiftsList" parameterType="DcShifts" resultMap="DcShiftsResult">
@ -80,6 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="scheduling != null">scheduling,</if>
<if test="station != null">station,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="employeesId != null">#{employeesId},</if> <if test="employeesId != null">#{employeesId},</if>
@ -89,6 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="scheduling != null">#{scheduling},</if>
<if test="station != null">#{station},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertDcShiftsRecord" parameterType="DcShiftsRecord"> <insert id="insertDcShiftsRecord" parameterType="DcShiftsRecord">
@ -100,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operationTime != null">operation_time,</if> <if test="operationTime != null">operation_time,</if>
<if test="modifyContent != null and modifyContent != ''">modify_content,</if> <if test="modifyContent != null and modifyContent != ''">modify_content,</if>
<if test="shiftsDate != null">shifts_date,</if> <if test="shiftsDate != null">shifts_date,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@ -108,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operationTime != null">#{operationTime},</if> <if test="operationTime != null">#{operationTime},</if>
<if test="modifyContent != null and modifyContent != ''">#{modifyContent},</if> <if test="modifyContent != null and modifyContent != ''">#{modifyContent},</if>
<if test="shiftsDate != null">#{shiftsDate},</if> <if test="shiftsDate != null">#{shiftsDate},</if>
</trim> </trim>
</insert> </insert>
@ -121,6 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="scheduling != null">scheduling = #{scheduling},</if>
<if test="station != null">station = #{station},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

Loading…
Cancel
Save