add new code

dev
hehang 2 years ago
parent 95eaa20f43
commit 2a331a38d8
  1. 227
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/EPassengerFlowInfo.java
  2. 61
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/EPassengerFlowInfoMapper.java
  3. 61
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/IEPassengerFlowInfoService.java
  4. 97
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/EPassengerFlowInfoServiceImpl.java
  5. 14
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/EquipmentInfoServiceImpl.java
  6. 9
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/EquipmentInfoTask.java
  7. 131
      ruoyi-quartz/src/main/resources/mapper/quartz/EPassengerFlowInfoMapper.xml

@ -0,0 +1,227 @@
package com.ruoyi.quartz.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 客流信息原始数据 对象 e_passenger_flow_info
*
* @author hehang
* @date 2023-05-19
*/
public class EPassengerFlowInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 数据类型 1 按小时 2 按天 3 按周 4 按月 5 按年 */
@Excel(name = "数据类型 1 按小时 2 按天 3 按周 4 按月 5 按年")
private String type;
/** 项目id */
@Excel(name = "项目id")
private String projectId;
/** 时间精度 */
@Excel(name = "时间精度")
private String accuracy;
/** 查询开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "查询开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 查询结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "查询结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 进入的人数 */
@Excel(name = "进入的人数")
private String inFlow;
/** 出去的人数 */
@Excel(name = "出去的人数")
private String outflow;
/** 设备id */
@Excel(name = "设备id")
private String deviceId;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 所属分组id */
@Excel(name = "所属分组id")
private Long relatedRegionId;
/** 所属分组id */
@Excel(name = "所属分组id")
private String relatedRegionName;
/** 数据状态 0新增 1修改 2删除 */
private String delFlag;
/** 企业标识码 数据隔离使用的企业唯一标识 */
@Excel(name = "企业标识码 数据隔离使用的企业唯一标识")
private Long organCode;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setProjectId(String projectId)
{
this.projectId = projectId;
}
public String getProjectId()
{
return projectId;
}
public void setAccuracy(String accuracy)
{
this.accuracy = accuracy;
}
public String getAccuracy()
{
return accuracy;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setInFlow(String inFlow)
{
this.inFlow = inFlow;
}
public String getInFlow()
{
return inFlow;
}
public void setOutflow(String outflow)
{
this.outflow = outflow;
}
public String getOutflow()
{
return outflow;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setRelatedRegionId(Long relatedRegionId)
{
this.relatedRegionId = relatedRegionId;
}
public Long getRelatedRegionId()
{
return relatedRegionId;
}
public void setRelatedRegionName(String relatedRegionName)
{
this.relatedRegionName = relatedRegionName;
}
public String getRelatedRegionName()
{
return relatedRegionName;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setOrganCode(Long organCode)
{
this.organCode = organCode;
}
public Long getOrganCode()
{
return organCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("type", getType())
.append("projectId", getProjectId())
.append("accuracy", getAccuracy())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("inFlow", getInFlow())
.append("outflow", getOutflow())
.append("deviceId", getDeviceId())
.append("deviceName", getDeviceName())
.append("relatedRegionId", getRelatedRegionId())
.append("relatedRegionName", getRelatedRegionName())
.append("delFlag", getDelFlag())
.append("updateTime", getUpdateTime())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("createBy", getCreateBy())
.append("organCode", getOrganCode())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.quartz.mapper;
import com.ruoyi.quartz.domain.EPassengerFlowInfo;
import java.util.List;
/**
* 客流信息原始数据 Mapper接口
*
* @author hehang
* @date 2023-05-19
*/
public interface EPassengerFlowInfoMapper {
/**
* 查询客流信息原始数据
*
* @param id 客流信息原始数据 主键
* @return 客流信息原始数据
*/
public EPassengerFlowInfo selectEPassengerFlowInfoById(Long id);
/**
* 查询客流信息原始数据 列表
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 客流信息原始数据 集合
*/
public List<EPassengerFlowInfo> selectEPassengerFlowInfoList(EPassengerFlowInfo ePassengerFlowInfo);
/**
* 新增客流信息原始数据
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 结果
*/
public int insertEPassengerFlowInfo(EPassengerFlowInfo ePassengerFlowInfo);
/**
* 修改客流信息原始数据
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 结果
*/
public int updateEPassengerFlowInfo(EPassengerFlowInfo ePassengerFlowInfo);
/**
* 删除客流信息原始数据
*
* @param id 客流信息原始数据 主键
* @return 结果
*/
public int deleteEPassengerFlowInfoById(Long id);
/**
* 批量删除客流信息原始数据
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEPassengerFlowInfoByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.quartz.service;
import com.ruoyi.quartz.domain.EPassengerFlowInfo;
import java.util.List;
/**
* 客流信息原始数据 Service接口
*
* @author hehang
* @date 2023-05-19
*/
public interface IEPassengerFlowInfoService {
/**
* 查询客流信息原始数据
*
* @param id 客流信息原始数据 主键
* @return 客流信息原始数据
*/
public EPassengerFlowInfo selectEPassengerFlowInfoById(Long id);
/**
* 查询客流信息原始数据 列表
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 客流信息原始数据 集合
*/
public List<EPassengerFlowInfo> selectEPassengerFlowInfoList(EPassengerFlowInfo ePassengerFlowInfo);
/**
* 新增客流信息原始数据
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 结果
*/
public int insertEPassengerFlowInfo(EPassengerFlowInfo ePassengerFlowInfo);
/**
* 修改客流信息原始数据
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 结果
*/
public int updateEPassengerFlowInfo(EPassengerFlowInfo ePassengerFlowInfo);
/**
* 批量删除客流信息原始数据
*
* @param ids 需要删除的客流信息原始数据 主键集合
* @return 结果
*/
public int deleteEPassengerFlowInfoByIds(Long[] ids);
/**
* 删除客流信息原始数据 信息
*
* @param id 客流信息原始数据 主键
* @return 结果
*/
public int deleteEPassengerFlowInfoById(Long id);
}

@ -0,0 +1,97 @@
package com.ruoyi.quartz.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.quartz.domain.EPassengerFlowInfo;
import com.ruoyi.quartz.mapper.EPassengerFlowInfoMapper;
import com.ruoyi.quartz.service.IEPassengerFlowInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 客流信息原始数据 Service业务层处理
*
* @author hehang
* @date 2023-05-19
*/
@Service
public class EPassengerFlowInfoServiceImpl implements IEPassengerFlowInfoService
{
@Autowired
private EPassengerFlowInfoMapper ePassengerFlowInfoMapper;
/**
* 查询客流信息原始数据
*
* @param id 客流信息原始数据 主键
* @return 客流信息原始数据
*/
@Override
public EPassengerFlowInfo selectEPassengerFlowInfoById(Long id)
{
return ePassengerFlowInfoMapper.selectEPassengerFlowInfoById(id);
}
/**
* 查询客流信息原始数据 列表
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 客流信息原始数据
*/
@Override
public List<EPassengerFlowInfo> selectEPassengerFlowInfoList(EPassengerFlowInfo ePassengerFlowInfo)
{
return ePassengerFlowInfoMapper.selectEPassengerFlowInfoList(ePassengerFlowInfo);
}
/**
* 新增客流信息原始数据
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 结果
*/
@Override
public int insertEPassengerFlowInfo(EPassengerFlowInfo ePassengerFlowInfo)
{
ePassengerFlowInfo.setCreateTime(DateUtils.getNowDate());
return ePassengerFlowInfoMapper.insertEPassengerFlowInfo(ePassengerFlowInfo);
}
/**
* 修改客流信息原始数据
*
* @param ePassengerFlowInfo 客流信息原始数据
* @return 结果
*/
@Override
public int updateEPassengerFlowInfo(EPassengerFlowInfo ePassengerFlowInfo)
{
ePassengerFlowInfo.setUpdateTime(DateUtils.getNowDate());
return ePassengerFlowInfoMapper.updateEPassengerFlowInfo(ePassengerFlowInfo);
}
/**
* 批量删除客流信息原始数据
*
* @param ids 需要删除的客流信息原始数据 主键
* @return 结果
*/
@Override
public int deleteEPassengerFlowInfoByIds(Long[] ids)
{
return ePassengerFlowInfoMapper.deleteEPassengerFlowInfoByIds(ids);
}
/**
* 删除客流信息原始数据 信息
*
* @param id 客流信息原始数据 主键
* @return 结果
*/
@Override
public int deleteEPassengerFlowInfoById(Long id)
{
return ePassengerFlowInfoMapper.deleteEPassengerFlowInfoById(id);
}
}

@ -15,12 +15,14 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SnowflakeIdUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.quartz.domain.EPassengerFlowInfo;
import com.ruoyi.quartz.domain.TpLinkConfig;
import com.ruoyi.quartz.domain.dto.EquipmentResult;
import com.ruoyi.quartz.domain.dto.GroupResult;
import com.ruoyi.quartz.domain.dto.PassengerFlowResult;
import com.ruoyi.quartz.domain.dto.TpLinkConfigExtend;
import com.ruoyi.quartz.service.EquipmentInfoService;
import com.ruoyi.quartz.service.IEPassengerFlowInfoService;
import com.ruoyi.quartz.service.ITpLinkConfigService;
import com.ruoyi.quartz.util.TplinkGetXAuthorizationUtil;
import org.springframework.beans.BeanUtils;
@ -48,6 +50,8 @@ public class EquipmentInfoServiceImpl implements EquipmentInfoService {
private ITpLinkConfigService tpLinkConfigService;
@Autowired
private IIotInfoService iotInfoService;
@Autowired
private IEPassengerFlowInfoService passengerFlowInfoService;
@Override
public void selectEquipmentInfoList(String params) {
@ -245,8 +249,13 @@ public class EquipmentInfoServiceImpl implements EquipmentInfoService {
JSONObject resultJson = JSONObject.parseObject(passengerFlowjson.get("result").toString());
JSONArray jsonArray = JSONArray.parseArray(resultJson.get("list").toString());
List<PassengerFlowResult> passengerFlowList = JSON.parseArray(jsonArray.toJSONString(), PassengerFlowResult.class);
if (!CollectionUtils.isEmpty(passengerFlowList)) {
passengerFlowList.stream().forEach(s-> {
EPassengerFlowInfo ePassengerFlowInfo = new EPassengerFlowInfo();
BeanUtils.copyProperties(s, ePassengerFlowInfo);
passengerFlowInfoService.insertEPassengerFlowInfo(ePassengerFlowInfo);
});
}
}
} catch (Exception e) {
e.printStackTrace();
@ -258,7 +267,6 @@ public class EquipmentInfoServiceImpl implements EquipmentInfoService {
});
}
@Override
public void selectGroupInfo(String params) {
//根据第三方平台的信息 请求第三方 获取企业信息、项目、分组信息 根据信息查询设备列表

@ -49,4 +49,13 @@ public class EquipmentInfoTask {
equipmentInfoService.selectGroupInfo(params);
System.out.println("获取分组信息 end");
}
/**
* 获取客流信息
*/
public void getPassengerFlowInfoList(String params) {
System.out.println("获取分组信息 start");
equipmentInfoService.selectPassengerFlowInfo(params);
System.out.println("获取分组信息 end");
}
}

@ -0,0 +1,131 @@
<?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">
<mapper namespace="com.ruoyi.quartz.mapper.EPassengerFlowInfoMapper">
<resultMap type="EPassengerFlowInfo" id="EPassengerFlowInfoResult">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="projectId" column="projectId" />
<result property="accuracy" column="accuracy" />
<result property="startTime" column="startTime" />
<result property="endTime" column="endTime" />
<result property="inFlow" column="inFlow" />
<result property="outflow" column="outflow" />
<result property="deviceId" column="deviceId" />
<result property="deviceName" column="deviceName" />
<result property="relatedRegionId" column="relatedRegionId" />
<result property="relatedRegionName" column="relatedRegionName" />
<result property="delFlag" column="del_flag" />
<result property="updateTime" column="update_time" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="createBy" column="create_by" />
<result property="organCode" column="organ_code" />
</resultMap>
<sql id="selectEPassengerFlowInfoVo">
select id, type, projectId, accuracy, startTime, endTime, inFlow, outflow, deviceId, deviceName, relatedRegionId, relatedRegionName, del_flag, update_time, create_time, update_by, create_by, organ_code from e_passenger_flow_info
</sql>
<select id="selectEPassengerFlowInfoList" parameterType="EPassengerFlowInfo" resultMap="EPassengerFlowInfoResult">
<include refid="selectEPassengerFlowInfoVo"/>
<where>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="projectId != null and projectId != ''"> and projectId = #{projectId}</if>
<if test="accuracy != null and accuracy != ''"> and accuracy = #{accuracy}</if>
<if test="startTime != null "> and startTime = #{startTime}</if>
<if test="endTime != null "> and endTime = #{endTime}</if>
<if test="inFlow != null and inFlow != ''"> and inFlow = #{inFlow}</if>
<if test="outflow != null and outflow != ''"> and outflow = #{outflow}</if>
<if test="deviceId != null and deviceId != ''"> and deviceId = #{deviceId}</if>
<if test="deviceName != null and deviceName != ''"> and deviceName like concat('%', #{deviceName}, '%')</if>
<if test="relatedRegionId != null "> and relatedRegionId = #{relatedRegionId}</if>
<if test="relatedRegionName != null and relatedRegionName != ''"> and relatedRegionName like concat('%', #{relatedRegionName}, '%')</if>
<if test="organCode != null "> and organ_code = #{organCode}</if>
</where>
</select>
<select id="selectEPassengerFlowInfoById" parameterType="Long" resultMap="EPassengerFlowInfoResult">
<include refid="selectEPassengerFlowInfoVo"/>
where id = #{id}
</select>
<insert id="insertEPassengerFlowInfo" parameterType="EPassengerFlowInfo" useGeneratedKeys="true" keyProperty="id">
insert into e_passenger_flow_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">type,</if>
<if test="projectId != null">projectId,</if>
<if test="accuracy != null">accuracy,</if>
<if test="startTime != null">startTime,</if>
<if test="endTime != null">endTime,</if>
<if test="inFlow != null">inFlow,</if>
<if test="outflow != null">outflow,</if>
<if test="deviceId != null">deviceId,</if>
<if test="deviceName != null">deviceName,</if>
<if test="relatedRegionId != null">relatedRegionId,</if>
<if test="relatedRegionName != null">relatedRegionName,</if>
<if test="delFlag != null">del_flag,</if>
<if test="updateTime != null">update_time,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="createBy != null">create_by,</if>
<if test="organCode != null">organ_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">#{type},</if>
<if test="projectId != null">#{projectId},</if>
<if test="accuracy != null">#{accuracy},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="inFlow != null">#{inFlow},</if>
<if test="outflow != null">#{outflow},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="relatedRegionId != null">#{relatedRegionId},</if>
<if test="relatedRegionName != null">#{relatedRegionName},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createBy != null">#{createBy},</if>
<if test="organCode != null">#{organCode},</if>
</trim>
</insert>
<update id="updateEPassengerFlowInfo" parameterType="EPassengerFlowInfo">
update e_passenger_flow_info
<trim prefix="SET" suffixOverrides=",">
<if test="type != null and type != ''">type = #{type},</if>
<if test="projectId != null">projectId = #{projectId},</if>
<if test="accuracy != null">accuracy = #{accuracy},</if>
<if test="startTime != null">startTime = #{startTime},</if>
<if test="endTime != null">endTime = #{endTime},</if>
<if test="inFlow != null">inFlow = #{inFlow},</if>
<if test="outflow != null">outflow = #{outflow},</if>
<if test="deviceId != null">deviceId = #{deviceId},</if>
<if test="deviceName != null">deviceName = #{deviceName},</if>
<if test="relatedRegionId != null">relatedRegionId = #{relatedRegionId},</if>
<if test="relatedRegionName != null">relatedRegionName = #{relatedRegionName},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="organCode != null">organ_code = #{organCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEPassengerFlowInfoById" parameterType="Long">
delete from e_passenger_flow_info where id = #{id}
</delete>
<delete id="deleteEPassengerFlowInfoByIds" parameterType="String">
delete from e_passenger_flow_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save