Commit f4231d1a authored by wanghao's avatar wanghao

1 大屏端 地图显示 液化气用户 及气瓶信息接口开发 及联调。

parent 0f799cc3
...@@ -133,6 +133,16 @@ public class TDetectorUserController extends BaseController ...@@ -133,6 +133,16 @@ public class TDetectorUserController extends BaseController
} }
/**
* 根据气瓶条码查询 气瓶详情和 气瓶追溯
* @param code r
* @return r
*/
@GetMapping("/getLpgGasBottleFilesBackToByCode")
public AjaxResult getLpgGasBottleFilesBackToByCode(String code) {
return AjaxResult.success(tDetectorUserService.getLpgGasBottleFilesBackToByCode(code));
}
/** /**
* 获取探测器用户列表 大屏地图 labelsLayer 标注的方式 分页查询 居民用户 * 获取探测器用户列表 大屏地图 labelsLayer 标注的方式 分页查询 居民用户
* @param tDetectorUser t * @param tDetectorUser t
......
package com.zehong.system.domain.dto;
public class UserLinkGasBottleIdDTO {
/**
* 用户id
*/
private Long userId;
/**
* 村庄id
*/
private Long villageId;
/**
* 气瓶id
*/
private Long gasBottleFilesId;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getVillageId() {
return villageId;
}
public void setVillageId(Long villageId) {
this.villageId = villageId;
}
public Long getGasBottleFilesId() {
return gasBottleFilesId;
}
public void setGasBottleFilesId(Long gasBottleFilesId) {
this.gasBottleFilesId = gasBottleFilesId;
}
}
package com.zehong.system.domain.dto;
public class UserLinkGasBottleTitleDTO {
/**
* 用户id
*/
private Long userId;
/**
* 村庄id
*/
private Long villageId;
/**
* 气瓶id
*/
private Long gasBottleFilesId;
/**
* 气瓶条码
*/
private String rCode;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getVillageId() {
return villageId;
}
public void setVillageId(Long villageId) {
this.villageId = villageId;
}
public Long getGasBottleFilesId() {
return gasBottleFilesId;
}
public void setGasBottleFilesId(Long gasBottleFilesId) {
this.gasBottleFilesId = gasBottleFilesId;
}
public String getrCode() {
return rCode;
}
public void setrCode(String rCode) {
this.rCode = rCode;
}
}
...@@ -5,6 +5,8 @@ import java.util.Map; ...@@ -5,6 +5,8 @@ import java.util.Map;
import com.zehong.system.domain.TDetectorUser; import com.zehong.system.domain.TDetectorUser;
import com.zehong.system.domain.TDetectorUserCount; import com.zehong.system.domain.TDetectorUserCount;
import com.zehong.system.domain.dto.UserLinkGasBottleIdDTO;
import com.zehong.system.domain.dto.UserLinkGasBottleTitleDTO;
import com.zehong.system.domain.vo.TDetectorUserInspectVo; import com.zehong.system.domain.vo.TDetectorUserInspectVo;
import com.zehong.system.domain.vo.TDetectorUserVO; import com.zehong.system.domain.vo.TDetectorUserVO;
import com.zehong.system.domain.vo.TDetectorUserVillageSafetyDeviceInfoVo; import com.zehong.system.domain.vo.TDetectorUserVillageSafetyDeviceInfoVo;
...@@ -40,6 +42,19 @@ public interface TDetectorUserMapper ...@@ -40,6 +42,19 @@ public interface TDetectorUserMapper
*/ */
List<TDetectorUserVillageSafetyDeviceInfoVo> queryDuserVilSafDevInfo(TDetectorUser tDetectorUser); List<TDetectorUserVillageSafetyDeviceInfoVo> queryDuserVilSafDevInfo(TDetectorUser tDetectorUser);
/**
* 根据村庄查询 用户 关联 气瓶数量
* @param villageIds v
* @return r
*/
List<UserLinkGasBottleIdDTO> queryUserIdLinkGasBottleIdByVillageIds(@Param("villageIds") List<Long> villageIds);
/**
* 根据村庄查询 用户 关联 气瓶信息
* @param villageIds v
* @return r
*/
List<UserLinkGasBottleTitleDTO> queryUserIdLinkGasBottleTitleByVillageIds(@Param("villageIds") List<Long> villageIds);
/** /**
* 查询燃气用户统计信息大屏界面 使用massMarks标注的方式 * 查询燃气用户统计信息大屏界面 使用massMarks标注的方式
* @param tDetectorUser * @param tDetectorUser
......
...@@ -44,6 +44,13 @@ public interface TLpgAirChargeFilesMapper ...@@ -44,6 +44,13 @@ public interface TLpgAirChargeFilesMapper
*/ */
public List<TLpgAirChargeFiles> queryALlByBarcodeAndGizId(@Param("list") List<TLpgAirChargeFiles> tLpgAirChargeFiles); public List<TLpgAirChargeFiles> queryALlByBarcodeAndGizId(@Param("list") List<TLpgAirChargeFiles> tLpgAirChargeFiles);
/**
* 根据气瓶条码 查询 最近的两条充装记录
* @param barCode r
* @return r
*/
public List<TLpgAirChargeFiles> queryAllByBarCodeLimit2(String barCode);
/** /**
* 新增液化石油气-充装记录 * 新增液化石油气-充装记录
* *
......
...@@ -29,6 +29,13 @@ public interface TLpgDeliveryRecordMapper ...@@ -29,6 +29,13 @@ public interface TLpgDeliveryRecordMapper
*/ */
public List<TLpgDeliveryRecord> selectTLpgDeliveryRecordList(TLpgDeliveryRecord tLpgDeliveryRecord); public List<TLpgDeliveryRecord> selectTLpgDeliveryRecordList(TLpgDeliveryRecord tLpgDeliveryRecord);
/**
* 根据气瓶条码查询配气记录
* @param bottleCode r
* @return r
*/
public List<TLpgDeliveryRecord> queryAllByBottleCodeLimit2(String bottleCode);
/** /**
* 新增液化石油配送记录 * 新增液化石油配送记录
* *
......
...@@ -57,6 +57,13 @@ public interface ITDetectorUserService ...@@ -57,6 +57,13 @@ public interface ITDetectorUserService
*/ */
TableDataInfo pageQueryLabelsLayerMarksDUser(TDetectorUser tDetectorUser); TableDataInfo pageQueryLabelsLayerMarksDUser(TDetectorUser tDetectorUser);
/**
* 根据气瓶条码 查询 详情和追溯信息
* @param code r
* @return r
*/
LpgGasBottleFilesBackToVo getLpgGasBottleFilesBackToByCode(String code);
/** /**
* 查询探测器用户列表 * 查询探测器用户列表
* *
......
...@@ -5,10 +5,7 @@ import java.sql.Connection; ...@@ -5,10 +5,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.zehong.common.core.domain.model.LoginUser; import com.zehong.common.core.domain.model.LoginUser;
...@@ -18,6 +15,8 @@ import com.zehong.common.core.page.TableSupport; ...@@ -18,6 +15,8 @@ import com.zehong.common.core.page.TableSupport;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils; import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.*; import com.zehong.system.domain.*;
import com.zehong.system.domain.dto.UserLinkGasBottleIdDTO;
import com.zehong.system.domain.dto.UserLinkGasBottleTitleDTO;
import com.zehong.system.domain.vo.*; import com.zehong.system.domain.vo.*;
import com.zehong.system.mapper.*; import com.zehong.system.mapper.*;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -58,6 +57,25 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -58,6 +57,25 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
@Resource @Resource
private DataSource dataSource; private DataSource dataSource;
/**
* 气瓶档案
*/
@Resource
private TLpgGasBottleFilesMapper lpgGasBottleFilesMapper;
/**
* 重装记录
*/
@Resource
private TLpgAirChargeFilesMapper lpgAirChargeFilesMapper;
/**
* 配送记录
*/
@Resource
private TLpgDeliveryRecordMapper tLpgDeliveryRecordMapper;
/** /**
* 查询探测器用户列表 * 查询探测器用户列表
* *
...@@ -165,6 +183,82 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -165,6 +183,82 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
return collect; return collect;
} }
/**
* 根据气瓶条码查询 气瓶详情和 气瓶追溯
* @param code r
* @return r
*/
@Override
public LpgGasBottleFilesBackToVo getLpgGasBottleFilesBackToByCode(String code) {
LpgGasBottleFilesBackToVo lpgGasBottleFilesBackToVo = new LpgGasBottleFilesBackToVo();
List<String> strings = Collections.singletonList(code);
List<TLpgGasBottleFiles> lpgGasBottleFiles = lpgGasBottleFilesMapper.queryAllByFQRcodeList(strings);
if (lpgGasBottleFiles != null && lpgGasBottleFiles.size() > 0) {
TLpgGasBottleFiles tLpgGasBottleFiles = lpgGasBottleFiles.get(0);
BeanUtils.copyProperties(tLpgGasBottleFiles, lpgGasBottleFilesBackToVo);
}
//最后两次的充装记录
List<TLpgAirChargeFiles> lpgAirChargeFiles = lpgAirChargeFilesMapper.queryAllByBarCodeLimit2(code);
//最后两次的配送记录
List<TLpgDeliveryRecord> lpgDeliveryRecords = tLpgDeliveryRecordMapper.queryAllByBottleCodeLimit2(code);
List<Map<String,Object>> backToMessage = new ArrayList<>();
StringBuilder sb = new StringBuilder();
Map<String,Object> map = new HashMap<>();
if (lpgAirChargeFiles.size() > 0) {
TLpgAirChargeFiles tLpgAirChargeFiles = lpgAirChargeFiles.get(0);
map.put("time",tLpgAirChargeFiles.getFillEndTime());
map.put("title","充装记录");
sb.append("由充装单位为【").append(tLpgAirChargeFiles.getStationName()).append("】完成充装");
map.put("message",sb.toString());
backToMessage.add(map);
if(lpgAirChargeFiles.size() > 1) {
TLpgAirChargeFiles tLpgAirChargeFiles1 = lpgAirChargeFiles.get(1);
map = new HashMap<>();
sb = new StringBuilder();
map.put("time",tLpgAirChargeFiles1.getFillEndTime());
map.put("title","充装记录");
sb.append("由充装单位为【").append(tLpgAirChargeFiles1.getStationName()).append("】完成充装");
map.put("message",sb.toString());
backToMessage.add(map);
}
}
if (lpgDeliveryRecords.size() > 0) {
map = new HashMap<>();
sb = new StringBuilder();
TLpgDeliveryRecord lpgDeliveryRecord = lpgDeliveryRecords.get(0);
map.put("time",lpgDeliveryRecord.getDeliveryDate());
map.put("title","配送记录");
sb.append("由配送人员【").append(lpgDeliveryRecord.getDeliveryPerson()).append("】完成配送");
map.put("message",sb.toString());
backToMessage.add(map);
if (lpgDeliveryRecords.size() > 1) {
map = new HashMap<>();
sb = new StringBuilder();
TLpgDeliveryRecord lpgDeliveryRecord1 = lpgDeliveryRecords.get(1);
map.put("time",lpgDeliveryRecord1.getDeliveryDate());
map.put("title","配送记录");
sb.append("由配送人员【").append(lpgDeliveryRecord1.getDeliveryPerson()).append("】完成配送");
map.put("message",sb.toString());
backToMessage.add(map);
}
}
lpgGasBottleFilesBackToVo.setBackToMessage(backToMessage);
return lpgGasBottleFilesBackToVo;
}
/** /**
* 获取探测器用户列表 大屏地图 labelsLayer 标注的方式 分页查询 居民用户 * 获取探测器用户列表 大屏地图 labelsLayer 标注的方式 分页查询 居民用户
...@@ -398,6 +492,11 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -398,6 +492,11 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
//按照 村id 分组 //按照 村id 分组
Map<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> collect1 = collect.stream().collect(Collectors.groupingBy(TDetectorUserVillageSafetyDeviceInfoVo::getVillageId)); Map<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> collect1 = collect.stream().collect(Collectors.groupingBy(TDetectorUserVillageSafetyDeviceInfoVo::getVillageId));
// 查询气瓶信息
List<Long> collect5 = collect.stream().map(TDetectorUserVillageSafetyDeviceInfoVo::getVillageId).collect(Collectors.toList());
List<UserLinkGasBottleTitleDTO> userLinkGasBottleTitleDTOS = tDetectorUserMapper.queryUserIdLinkGasBottleTitleByVillageIds(collect5);
Map<Long, List<UserLinkGasBottleTitleDTO>> collect6 = userLinkGasBottleTitleDTOS.stream().collect(Collectors.groupingBy(UserLinkGasBottleTitleDTO::getUserId));
for (Map.Entry<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> longListEntry : collect1.entrySet()) { for (Map.Entry<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> longListEntry : collect1.entrySet()) {
List<TDetectorUserVillageSafetyDeviceInfoVo> villageList = longListEntry.getValue(); List<TDetectorUserVillageSafetyDeviceInfoVo> villageList = longListEntry.getValue();
...@@ -413,6 +512,7 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -413,6 +512,7 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
for (Map.Entry<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> listEntry : collect2.entrySet()) { for (Map.Entry<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> listEntry : collect2.entrySet()) {
List<Map<String,Object>> safetyDeviceMapList= new ArrayList<>(); List<Map<String,Object>> safetyDeviceMapList= new ArrayList<>();
List<String> gasBottleTitleList = new ArrayList<>();
List<TDetectorUserVillageSafetyDeviceInfoVo> userList = listEntry.getValue(); List<TDetectorUserVillageSafetyDeviceInfoVo> userList = listEntry.getValue();
Long key = listEntry.getKey(); Long key = listEntry.getKey();
...@@ -458,6 +558,22 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -458,6 +558,22 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
} }
} }
} }
// 封装 气瓶条码,只是气瓶条码,然后点击条码再查询详细数据
userMapListItme.put("gasBottleTitleList",gasBottleTitleList);
List<UserLinkGasBottleTitleDTO> userLinkGasBottleTitleDTOS1 = collect6.get(key);
if (userLinkGasBottleTitleDTOS1 != null && userLinkGasBottleTitleDTOS1.size() > 0) {
List<String> collect7 = userLinkGasBottleTitleDTOS1.stream().map(UserLinkGasBottleTitleDTO::getrCode).collect(Collectors.toList());
List<Map<String,Object>> gasBottleTitleMapList = new ArrayList<>();
if (collect7.size() > 0) {
for (String s : collect7) {
Map<String,Object> map = new HashMap<>();
map.put("code",s);
gasBottleTitleMapList.add(map);
}
}
userMapListItme.put("gasBottleTitleList",gasBottleTitleMapList);
}
userMapList.add(userMapListItme); userMapList.add(userMapListItme);
} }
} }
...@@ -486,6 +602,11 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -486,6 +602,11 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
//按照 村id 分组 //按照 村id 分组
Map<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> collect1 = collect5.stream().collect(Collectors.groupingBy(TDetectorUserVillageSafetyDeviceInfoVo::getVillageId)); Map<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> collect1 = collect5.stream().collect(Collectors.groupingBy(TDetectorUserVillageSafetyDeviceInfoVo::getVillageId));
// 统计气瓶数量
List<Long> collect6 = collect5.stream().map(TDetectorUserVillageSafetyDeviceInfoVo::getVillageId).collect(Collectors.toList());
List<UserLinkGasBottleIdDTO> userLinkGasBottleIdDTOS = tDetectorUserMapper.queryUserIdLinkGasBottleIdByVillageIds(collect6);
Map<Long, List<UserLinkGasBottleIdDTO>> collect7 = userLinkGasBottleIdDTOS.stream().collect(Collectors.groupingBy(UserLinkGasBottleIdDTO::getVillageId));
for (Map.Entry<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> longListEntry : collect1.entrySet()) { for (Map.Entry<Long, List<TDetectorUserVillageSafetyDeviceInfoVo>> longListEntry : collect1.entrySet()) {
List<TDetectorUserVillageSafetyDeviceInfoVo> villageList = longListEntry.getValue(); List<TDetectorUserVillageSafetyDeviceInfoVo> villageList = longListEntry.getValue();
Long key1 = longListEntry.getKey(); Long key1 = longListEntry.getKey();
...@@ -527,6 +648,12 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService ...@@ -527,6 +648,12 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
villageMapListItem.put("userNum",userNum); villageMapListItem.put("userNum",userNum);
villageMapListItem.put("deviceNum",deviceNum); villageMapListItem.put("deviceNum",deviceNum);
villageMapListItem.put("userMapList",userMapList); villageMapListItem.put("userMapList",userMapList);
List<UserLinkGasBottleIdDTO> userLinkGasBottleIdDTOS1 = collect7.get(key1);
if (userLinkGasBottleIdDTOS1 != null && userLinkGasBottleIdDTOS1.size() > 0) {
villageMapListItem.put("gasBottle",userLinkGasBottleIdDTOS1.size());
} else {
villageMapListItem.put("gasBottle",0);
}
villageMapList.add(villageMapListItem); villageMapList.add(villageMapListItem);
} }
} }
......
...@@ -300,6 +300,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -300,6 +300,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) t2 on t2.userId = t1.userId ) t2 on t2.userId = t1.userId
</select> </select>
<select id="queryUserIdLinkGasBottleIdByVillageIds" resultType="com.zehong.system.domain.dto.UserLinkGasBottleIdDTO">
SELECT
duser.user_id as userId,
duser.f_village_id as villageId,
userlinkgas.f_gas_bottle_files_id as gasBottleFilesId
FROM
t_detector_user duser
LEFT JOIN t_detector_user_link_gas_bottle userlinkgas
on duser.user_id = userlinkgas.f_user_id
WHERE
duser.user_type = 1
AND duser.f_village_id IS NOT NULL
and duser.f_village_id in
<foreach collection="villageIds" close=")" separator="," open="(" item="item" index="i">
#{item}
</foreach>
</select>
<select id="queryUserIdLinkGasBottleTitleByVillageIds" resultType="com.zehong.system.domain.dto.UserLinkGasBottleTitleDTO">
SELECT
duser.user_id as userId,
duser.f_village_id as villageId,
userlinkgas.f_gas_bottle_files_id as gasBottleFilesId,
gasBottleFiles.f_q_rcode as rcode
FROM
t_detector_user duser
LEFT JOIN t_detector_user_link_gas_bottle userlinkgas
on duser.user_id = userlinkgas.f_user_id
LEFT JOIN t_lpg_gas_bottle_files gasBottleFiles
on userlinkgas.f_gas_bottle_files_id = gasBottleFiles.f_gas_bottle_files_id
WHERE
duser.user_type = 1
AND duser.f_village_id IS NOT NULL
and duser.f_village_id in
<foreach collection="villageIds" close=")" separator="," open="(" item="item" index="i">
#{item}
</foreach>
</select>
<select id="queryDuserVilSafDevInfo" resultType="TDetectorUserVillageSafetyDeviceInfoVo" parameterType="TDetectorUser"> <select id="queryDuserVilSafDevInfo" resultType="TDetectorUserVillageSafetyDeviceInfoVo" parameterType="TDetectorUser">
SELECT SELECT
dUser.user_id as userId, dUser.user_id as userId,
......
...@@ -53,6 +53,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -53,6 +53,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item.barCode}, #{item.gzId}) (#{item.barCode}, #{item.gzId})
</foreach> </foreach>
</select> </select>
<select id="queryAllByBarCodeLimit2" resultMap="TLpgAirChargeFilesResult">
<include refid="selectTLpgAirChargeFilesVo"></include>
where f_bar_code = #{barCode} order by f_fill_end_time desc limit 2
</select>
<select id="selectTLpgAirChargeFilesById" parameterType="Long" resultMap="TLpgAirChargeFilesResult"> <select id="selectTLpgAirChargeFilesById" parameterType="Long" resultMap="TLpgAirChargeFilesResult">
<include refid="selectTLpgAirChargeFilesVo"/> <include refid="selectTLpgAirChargeFilesVo"/>
where f_gas_air_charge_id = #{gasAirChargeId} where f_gas_air_charge_id = #{gasAirChargeId}
......
...@@ -56,6 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -56,6 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bottleCode != null and bottleCode != ''"> and bottle.f_bottle_code like concat('%', #{bottleCode}, '%')</if> <if test="bottleCode != null and bottleCode != ''"> and bottle.f_bottle_code like concat('%', #{bottleCode}, '%')</if>
</where> </where>
</select> </select>
<select id="queryAllByBottleCodeLimit2" resultMap="TLpgDeliveryRecordResult">
<include refid="selectTLpgDeliveryRecordVo"></include>
where delivery.f_bottle_code = #{bottleCode}
</select>
<select id="selectTLpgDeliveryRecordById" parameterType="Long" resultMap="TLpgDeliveryRecordResult"> <select id="selectTLpgDeliveryRecordById" parameterType="Long" resultMap="TLpgDeliveryRecordResult">
<include refid="selectTLpgDeliveryRecordVo"/> <include refid="selectTLpgDeliveryRecordVo"/>
......
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