This commit is contained in:
parent
252a5a5b67
commit
3c2af99dd5
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.digitalSignage.basic.dao;
|
||||
|
||||
import com.bonus.digitalSignage.basic.vo.TbSpanTowerVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TbSpanTowerMapper {
|
||||
void addTbSpanTower(TbSpanTowerVo tbSpanTowerVo);
|
||||
|
||||
List<TbSpanTowerVo> getTbSpanTowerList(Long threeSpanId);
|
||||
|
||||
void updateTbSpanTower(TbSpanTowerVo tbSpanTowerVo);
|
||||
|
||||
void delTbSpanTower(Long threeSpanId);
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.digitalSignage.basic.service;
|
||||
|
||||
import com.bonus.digitalSignage.basic.vo.TbSpanTowerVo;
|
||||
|
||||
import javax.xml.rpc.ServiceException;
|
||||
import java.util.List;
|
||||
|
||||
public interface TbSpanTowerService {
|
||||
|
||||
/**
|
||||
*跨越杆塔信息--新增
|
||||
* @param threeSpanId
|
||||
* @param tbSpanTowerList
|
||||
*/
|
||||
void addTbSpanTowerList(Long threeSpanId, List<TbSpanTowerVo> tbSpanTowerList) throws Throwable;
|
||||
|
||||
/**
|
||||
* 跨越杆塔信息--列表
|
||||
* @param threeSpanId
|
||||
* @return
|
||||
*/
|
||||
List<TbSpanTowerVo> getTbSpanTowerList(Long threeSpanId);
|
||||
/**
|
||||
* 跨越杆塔信息--修改
|
||||
* @param threeSpanId
|
||||
* @return
|
||||
*/
|
||||
void updateTbSpanTower(List<TbSpanTowerVo> tbSpanTowerList, Long threeSpanId) throws ServiceException;
|
||||
/**
|
||||
* 跨越杆塔信息--删除
|
||||
* @param threeSpanId
|
||||
* @return
|
||||
*/
|
||||
void delTbSpanTower(Long threeSpanId);
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.bonus.digitalSignage.basic.service.impl;
|
||||
|
||||
import com.bonus.digitalSignage.basic.dao.TbSpanTowerMapper;
|
||||
import com.bonus.digitalSignage.basic.service.TbSpanTowerService;
|
||||
import com.bonus.digitalSignage.basic.vo.TbSpanTowerVo;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
import com.bonus.digitalSignage.utils.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.rpc.ServiceException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/4/28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TbSpanTowerServiceImpl implements TbSpanTowerService {
|
||||
|
||||
@Resource
|
||||
private TbSpanTowerMapper tbSpanTowerMapper;
|
||||
|
||||
@Override
|
||||
public void addTbSpanTowerList(Long threeSpanId, List<TbSpanTowerVo> tbSpanTowerList) throws ServiceException {
|
||||
for (TbSpanTowerVo tbSpanTowerVo:tbSpanTowerList) {
|
||||
tbSpanTowerVo.setThreeSpanId(threeSpanId);
|
||||
//判断经纬度是否合法
|
||||
if(!StrUtil.isValidLongitude(Double.parseDouble(tbSpanTowerVo.getLon())) || !StrUtil.isValidLatitude(Double.parseDouble(tbSpanTowerVo.getLat()))){
|
||||
throw new ServiceException("请输入正确的经纬度");
|
||||
}
|
||||
tbSpanTowerVo.setBaiduLon(tbSpanTowerVo.getLon());
|
||||
tbSpanTowerVo.setBaiduLat(tbSpanTowerVo.getLat());
|
||||
tbSpanTowerMapper.addTbSpanTower(tbSpanTowerVo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbSpanTowerVo> getTbSpanTowerList(Long threeSpanId) {
|
||||
return tbSpanTowerMapper.getTbSpanTowerList(threeSpanId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTbSpanTower(List<TbSpanTowerVo> tbSpanTowerList, Long threeSpanId) throws ServiceException {
|
||||
for (TbSpanTowerVo tbSpanTowerVo:tbSpanTowerList) {
|
||||
//判断经纬度是否合法
|
||||
if(!StrUtil.isValidLongitude(Double.parseDouble(tbSpanTowerVo.getLon())) || !StrUtil.isValidLatitude(Double.parseDouble(tbSpanTowerVo.getLat()))){
|
||||
throw new ServiceException("请输入正确的经纬度");
|
||||
}
|
||||
if (tbSpanTowerVo.getId()!=null){
|
||||
tbSpanTowerMapper.updateTbSpanTower(tbSpanTowerVo);
|
||||
}else {
|
||||
tbSpanTowerVo.setThreeSpanId(threeSpanId);
|
||||
tbSpanTowerVo.setBaiduLon(tbSpanTowerVo.getLon());
|
||||
tbSpanTowerVo.setBaiduLat(tbSpanTowerVo.getLat());
|
||||
tbSpanTowerMapper.addTbSpanTower(tbSpanTowerVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delTbSpanTower(Long threeSpanId) {
|
||||
tbSpanTowerMapper.delTbSpanTower(threeSpanId);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,17 @@
|
|||
package com.bonus.digitalSignage.basic.service.impl;
|
||||
|
||||
import com.bonus.digitalSignage.basic.dao.TbThreeSpanMapper;
|
||||
import com.bonus.digitalSignage.basic.service.TbSpanTowerService;
|
||||
import com.bonus.digitalSignage.basic.service.TbThreeSpanService;
|
||||
import com.bonus.digitalSignage.basic.vo.TbSpanTowerVo;
|
||||
import com.bonus.digitalSignage.basic.vo.TbThreeSpanVo;
|
||||
import com.bonus.digitalSignage.utils.ServerResponse;
|
||||
import com.bonus.digitalSignage.utils.UserUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
|
@ -24,6 +28,9 @@ public class TbThreeSpanServiceImpl implements TbThreeSpanService {
|
|||
@Resource
|
||||
private TbThreeSpanMapper tbThreeSpanMapper;
|
||||
|
||||
@Resource
|
||||
private TbSpanTowerService tbSpanTowerService;
|
||||
|
||||
/**
|
||||
* 三跨管理-查询列表
|
||||
* @param data
|
||||
|
|
@ -33,6 +40,13 @@ public class TbThreeSpanServiceImpl implements TbThreeSpanService {
|
|||
public ServerResponse getTbThreeSpanList(TbThreeSpanVo data) {
|
||||
try {
|
||||
List<TbThreeSpanVo> tbThreeSpanVoList = tbThreeSpanMapper.getTbThreeSpanList(data);
|
||||
//获取跨越杆塔信息
|
||||
if (!tbThreeSpanVoList.isEmpty()){
|
||||
for (TbThreeSpanVo tbThreeSpanVo:tbThreeSpanVoList) {
|
||||
List<TbSpanTowerVo> tbSpanTowerList = tbSpanTowerService.getTbSpanTowerList(tbThreeSpanVo.getId());
|
||||
tbThreeSpanVo.setTbSpanTowerList(tbSpanTowerList);
|
||||
}
|
||||
}
|
||||
PageInfo<TbThreeSpanVo> pageInfo = new PageInfo<>(tbThreeSpanVoList);
|
||||
return ServerResponse.createSuccessPage(pageInfo, data.getPageNum(), data.getPageSize());
|
||||
} catch (Exception e) {
|
||||
|
|
@ -50,6 +64,8 @@ public class TbThreeSpanServiceImpl implements TbThreeSpanService {
|
|||
public ServerResponse getTbThreeSpanById(TbThreeSpanVo data) {
|
||||
try {
|
||||
TbThreeSpanVo tbThreeSpanVo = tbThreeSpanMapper.getTbThreeSpanById(data);
|
||||
List<TbSpanTowerVo> tbSpanTowerList = tbSpanTowerService.getTbSpanTowerList(tbThreeSpanVo.getId());
|
||||
tbThreeSpanVo.setTbSpanTowerList(tbSpanTowerList);
|
||||
return ServerResponse.createSuccess(tbThreeSpanVo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
@ -63,15 +79,22 @@ public class TbThreeSpanServiceImpl implements TbThreeSpanService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ServerResponse addTbThreeSpan(TbThreeSpanVo data) {
|
||||
try {
|
||||
Long userId = UserUtil.getLoginUser().getId();
|
||||
data.setCreateUserId(userId);
|
||||
data.setCreateTime(new Date());
|
||||
tbThreeSpanMapper.addTbThreeSpan(data);
|
||||
//获取跨越杆塔信息
|
||||
List<TbSpanTowerVo> tbSpanTowerList = data.getTbSpanTowerList();
|
||||
if (tbSpanTowerList.size()>0){
|
||||
tbSpanTowerService.addTbSpanTowerList(data.getId(),tbSpanTowerList);
|
||||
}
|
||||
return ServerResponse.createSuccess("三跨管理-新增成功");
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ServerResponse.createErroe("三跨管理-新增失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -82,11 +105,17 @@ public class TbThreeSpanServiceImpl implements TbThreeSpanService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public ServerResponse updateTbThreeSpan(TbThreeSpanVo data) {
|
||||
try {
|
||||
Long userId = UserUtil.getLoginUser().getId();
|
||||
data.setUpdateUserId(userId);
|
||||
tbThreeSpanMapper.updateTbThreeSpan(data);
|
||||
List<TbSpanTowerVo> tbSpanTowerList =data.getTbSpanTowerList();
|
||||
//获取跨越杆塔信息
|
||||
if (!tbSpanTowerList.isEmpty()){
|
||||
tbSpanTowerService.updateTbSpanTower(tbSpanTowerList,data.getId());
|
||||
}
|
||||
return ServerResponse.createSuccess("三跨管理-修改成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
@ -103,6 +132,11 @@ public class TbThreeSpanServiceImpl implements TbThreeSpanService {
|
|||
public ServerResponse delTbThreeSpan(TbThreeSpanVo data) {
|
||||
try {
|
||||
tbThreeSpanMapper.delTbThreeSpan(data);
|
||||
List<TbSpanTowerVo> tbSpanTowerList =data.getTbSpanTowerList();
|
||||
//获取跨越杆塔信息
|
||||
if (!tbSpanTowerList.isEmpty()){
|
||||
tbSpanTowerService.delTbSpanTower(data.getId());
|
||||
}
|
||||
return ServerResponse.createSuccess("三跨管理-删除成功");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.bonus.digitalSignage.basic.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/4/28
|
||||
*/
|
||||
@Data
|
||||
public class TbSpanTowerVo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 三跨id
|
||||
*/
|
||||
private Long threeSpanId;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lon;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 百度地图—经度
|
||||
*/
|
||||
private String baiduLon;
|
||||
|
||||
/**
|
||||
* 百度地图-纬度
|
||||
*/
|
||||
private String baiduLat;
|
||||
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int sort;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.bonus.digitalSignage.utils.Excel;
|
|||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -123,6 +124,11 @@ public class TbThreeSpanVo {
|
|||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 跨越杆塔信息
|
||||
*/
|
||||
private List<TbSpanTowerVo> tbSpanTowerList;
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
<?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.bonus.digitalSignage.basic.dao.TbSpanTowerMapper">
|
||||
|
||||
<insert id="addTbSpanTower">
|
||||
insert into tb_span_tower
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="threeSpanId != null ">three_span_id,</if>
|
||||
<if test="lon != null ">lon,</if>
|
||||
<if test="lat != null ">lat,</if>
|
||||
<if test="baiduLon != null">baidu_lon,</if>
|
||||
<if test="baiduLat != null ">baidu_lat,</if>
|
||||
<if test="sort != null ">sort,</if>
|
||||
is_actvice
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="threeSpanId != null ">#{threeSpanId},</if>
|
||||
<if test="lon != null ">#{lon},</if>
|
||||
<if test="lat != null ">#{lat},</if>
|
||||
<if test="baiduLon != null ">#{baiduLon},</if>
|
||||
<if test="baiduLat != null ">#{baiduLat},</if>
|
||||
<if test="sort != null ">#{sort},</if>
|
||||
1
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateTbSpanTower">
|
||||
update tb_span_tower
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="lon != null">lon = #{lon},</if>
|
||||
<if test="lat != null">lat = #{lat},</if>
|
||||
<if test="baiduLon != null">baidu_lon = #{baiduLon},</if>
|
||||
<if test="baiduLat != null">baidu_lat = #{baiduLat},</if>
|
||||
<if test="sort != null">sort = #{sort},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="delTbSpanTower">
|
||||
update tb_span_tower set is_active = '0' where three_span_id = #{threeSpanId}
|
||||
</delete>
|
||||
<select id="getTbSpanTowerList" resultType="com.bonus.digitalSignage.basic.vo.TbSpanTowerVo">
|
||||
select id as id,three_span_id as threeSpanId,lon as lon,lat as lat,baidu_lon as baiduLon,
|
||||
baidu_lat as baiduLat,sort as sort
|
||||
from tb_span_tower where three_span_id = #{threeSpanId} and is_active = '1'
|
||||
ORDER BY sort
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.digitalSignage.basic.dao.TbThreeSpanMapper">
|
||||
<insert id="addTbThreeSpan">
|
||||
<insert id="addTbThreeSpan" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_three_span
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="proId != null ">pro_id,</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue