Browse Source

中间库设备表维护经纬度

develop
lau572 4 months ago
parent
commit
8b39bfc252
  1. 28
      zc-business/src/main/java/com/zc/business/domain/MdDevice.java
  2. 15
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
  3. 2
      zc-business/src/main/java/com/zc/business/service/impl/DcStakeMarkServiceImpl.java
  4. 2
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml
  5. 12
      zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

28
zc-business/src/main/java/com/zc/business/domain/MdDevice.java

@ -120,6 +120,14 @@ public class MdDevice
@Excel(name = "删除人")
private Long deleterUserId;
/** 经度 */
@Excel(name = "经度")
private String longitude;
/** 纬度 */
@Excel(name = "纬度")
private String latitude;
/** 删除时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ -287,6 +295,22 @@ public class MdDevice
this.childTypeCode = childTypeCode;
}
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;
}
@Override
public String toString() {
return new ToStringBuilder(this)
@ -309,6 +333,8 @@ public class MdDevice
.append("isDeleted", isDeleted)
.append("deleterUserId", deleterUserId)
.append("deletionTime", deletionTime)
.append("longitude", longitude)
.append("latitude", latitude)
.toString();
}
@ -330,5 +356,7 @@ public class MdDevice
this.opmaManagerId = dcDevice.getGroupId().toString();
}
this.supplierName = dcDevice.getManufacturer();
this.longitude = dcDevice.getLongitude();
this.latitude = dcDevice.getLatitude();
}
}

15
zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

@ -237,6 +237,14 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
dcDevice.setCreateTime(new Date());
dcDevice.setUseState(DcDevice.UNUSEDSTATE);
if (Objects.nonNull(dcDevice.getStakeMark())){
DcStakeMark dcStakeMark = dcStakeMarkService.getStakeMark(dcDevice.getStakeMark());
if (Objects.nonNull(dcStakeMark)){
dcDevice.setLongitude(dcStakeMark.getLongitude());
dcDevice.setLatitude(dcStakeMark.getLatitude());
}
}
if (save(dcDevice)) {
// 更新缓存
updateRedisCache();
@ -281,6 +289,13 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
}
dcDevice.setUpdateTime(new Date());
if (Objects.nonNull(dcDevice.getStakeMark())){
DcStakeMark dcStakeMark = dcStakeMarkService.getStakeMark(dcDevice.getStakeMark());
if (Objects.nonNull(dcStakeMark)){
dcDevice.setLongitude(dcStakeMark.getLongitude());
dcDevice.setLatitude(dcStakeMark.getLatitude());
}
}
if (updateById(dcDevice)) {
// 更新缓存

2
zc-business/src/main/java/com/zc/business/service/impl/DcStakeMarkServiceImpl.java

@ -134,7 +134,7 @@ public class DcStakeMarkServiceImpl extends ServiceImpl<DcStakeMarkMapper, DcSta
throw new ServiceException("桩号ID[" + id + "]不存在", HttpStatus.BAD_REQUEST);
}
return getById(id);
return product;
}
/**

2
zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.create_time,t1.update_time,t1.facilities_type,t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,
t1.facilities_type,t2.longitude,t2.latitude,t3.manufacturer
from dc_device t1
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark
left join dc_product t3 on t3.id = t1.product_id
<where>
<if test="id != null and id != ''">and t1.id = #{id}</if>

12
zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

@ -162,6 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDeleted != null">IsDeleted,</if>
<if test="deleterUserId != null">DeleterUserId,</if>
<if test="deletionTime != null">DeletionTime,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -184,6 +186,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDeleted != null">#{isDeleted},</if>
<if test="deleterUserId != null">#{deleterUserId},</if>
<if test="deletionTime != null">#{deletionTime},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
</trim>
</insert>
@ -212,6 +216,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mdDevice.isDeleted != null">IsDeleted,</if>
<if test="mdDevice.deleterUserId != null">DeleterUserId,</if>
<if test="mdDevice.deletionTime != null">DeletionTime,</if>
<if test="mdDevice.longitude != null">longitude,</if>
<if test="mdDevice.latitude != null">latitude,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mdDevice.id != null">#{mdDevice.id},</if>
@ -234,6 +240,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mdDevice.isDeleted != null">#{mdDevice.isDeleted},</if>
<if test="mdDevice.deleterUserId != null">#{mdDevice.deleterUserId},</if>
<if test="mdDevice.deletionTime != null">#{mdDevice.deletionTime},</if>
<if test="mdDevice.longitude != null">#{mdDevice.longitude},</if>
<if test="mdDevice.latitude != null">#{mdDevice.latitude},</if>
</trim>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
@ -254,6 +262,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mdDevice.isDeleted != null">IsDeleted = #{mdDevice.isDeleted},</if>
<if test="mdDevice.deleterUserId != null">DeleterUserId = #{mdDevice.deleterUserId},</if>
<if test="mdDevice.deletionTime != null">DeletionTime = #{mdDevice.deletionTime},</if>
<if test="mdDevice.longitude != null">longitude = #{mdDevice.longitude},</if>
<if test="mdDevice.latitude != null">latitude = #{mdDevice.latitude},</if>
</trim>
</foreach>
</insert>
@ -386,6 +396,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isDeleted != null">IsDeleted = #{isDeleted},</if>
<if test="deleterUserId != null">DeleterUserId = #{deleterUserId},</if>
<if test="deletionTime != null">DeletionTime = #{deletionTime},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
</set>
where id = #{id}
</update>

Loading…
Cancel
Save