Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
王兴琳 9 months ago
parent
commit
b620247dd5
  1. 8
      ruoyi-admin/src/main/resources/application-druid.yml
  2. 17
      zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java
  3. 17
      zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java
  4. 10
      zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java
  5. 35
      zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java
  6. 2
      zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml
  7. 1
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml
  8. 129
      zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

8
ruoyi-admin/src/main/resources/application-druid.yml

@ -15,10 +15,10 @@ spring:
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
enabled: true
url: jdbc:mysql://10.168.56.204:3306/jihe-md?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: root
password: Platform123!@#
# 初始连接数
initialSize: 5
# 最小连接池数量

17
zc-business/src/main/java/com/zc/business/mapper/MiddleDatabaseMapper.java

@ -3,6 +3,7 @@ package com.zc.business.mapper;
import com.zc.business.domain.DcBoardReleaseLog;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import com.zc.business.domain.MdEvent;
import java.util.List;
@ -30,4 +31,20 @@ public interface MiddleDatabaseMapper
* @return 结果
*/
boolean updateMiddleDatabaseDevice(DcDevice dcDevice);
/**
* 中间库新增事件
*
* @param mdEvent 事件
* @return 结果
*/
boolean insertMiddleDatabaseEvent(MdEvent mdEvent);
/**
* 中间库更新事件
*
* @param mdEvent 事件
* @return 结果
*/
boolean updateMiddleDatabaseEvent(MdEvent mdEvent);
}

17
zc-business/src/main/java/com/zc/business/service/IMiddleDatabaseService.java

@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcBoardPublish;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import com.zc.business.domain.MdEvent;
import java.util.List;
@ -40,4 +41,20 @@ public interface IMiddleDatabaseService
*/
boolean updateMiddleDatabaseDevice(DcDevice device);
/**
* 中间库新增事件
*
* @param
* @return 结果
*/
boolean insertMiddleDatabaseEvent(MdEvent mdEvent);
/**
* 中间库更新事件
*
* @param
* @return 结果
*/
boolean updateMiddleDatabaseEvent(MdEvent mdEvent);
}

10
zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java

@ -103,7 +103,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
* @return 结果
*/
@Override
@Transactional(rollbackFor = ServiceException.class)
@Transactional(rollbackFor = Exception.class)
public int insertDcShifts(DcShifts dcShifts) throws Exception{
String msg = "";
JSON employeesJson = dcShifts.getEmployeesJson();
@ -155,7 +155,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
* @return 结果
*/
@Override
@Transactional(rollbackFor = ServiceException.class)
@Transactional(rollbackFor = Exception.class)
public int updateDcShifts(DcShifts dcShifts) throws Exception{
String msg = "";
dcShifts.setUpdateTime(DateUtils.getNowDate());
@ -198,7 +198,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
* @return 结果
*/
@Override
@Transactional(rollbackFor = ServiceException.class)
@Transactional(rollbackFor = Exception.class)
public int deleteDcShiftsByIds(Long[] ids) throws Exception{
for (Long id:ids){
DcShifts dcShifts = dcShiftsMapper.selectDcShiftsById(id);
@ -226,7 +226,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
}
@Override
@Transactional(rollbackFor = ServiceException.class)
@Transactional(rollbackFor = Exception.class)
public int deleteDcShiftsListId(DcShifts dcShifts) throws Exception {
List<DcShifts> shiftsValue = dcShiftsMapper.selectDcShiftsDeleteList(dcShifts);
for (DcShifts shifts:shiftsValue){
@ -269,7 +269,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService
}
@Override
@Transactional(rollbackFor = ServiceException.class)
@Transactional(rollbackFor = Exception.class)
public AjaxResult importEquipment(MultipartFile file) throws Exception{
String msg = "";
ExcelUtil<DcShifts> util = new ExcelUtil<DcShifts>(DcShifts.class);

35
zc-business/src/main/java/com/zc/business/service/impl/MiddleDatabaseServiceImpl.java

@ -1,9 +1,12 @@
package com.zc.business.service.impl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.SecurityUtils;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.MdDeviceData;
import com.zc.business.domain.MdEvent;
import com.zc.business.mapper.MiddleDatabaseMapper;
import com.zc.business.service.IMiddleDatabaseService;
import org.springframework.beans.factory.annotation.Autowired;
@ -68,4 +71,36 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService {
{
return middleDatabaseMapper.updateMiddleDatabaseDevice(device);
}
/**
* 中间库新增事件
*
* @param mdEvent 事件
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean insertMiddleDatabaseEvent(MdEvent mdEvent){
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
mdEvent.setCreatorUserId(loginUser.getUserId());
}
return middleDatabaseMapper.insertMiddleDatabaseEvent(mdEvent);
}
/**
* 中间库更新事件
*
* @param mdEvent 事件
* @return 结果
*/
@DataSource(value = DataSourceType.SLAVE)//切换数据源
@Override
public boolean updateMiddleDatabaseEvent(MdEvent mdEvent){
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
mdEvent.setLastModifierUserId(loginUser.getUserId());
}
return middleDatabaseMapper.updateMiddleDatabaseEvent(mdEvent);
}
}

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

@ -120,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(1) from dc_employees where organization_id=#{id}
</select>
<select id="coordinate" resultType="java.util.HashMap">
select ifnull(longitude,null)longitude,ifnull(latitude,null)latitude from
select longitude ,latitude from
dc_stake_mark where stake_mark=#{stakeMark} and direction=#{direction}
</select>

1
zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

@ -43,6 +43,7 @@
<if test="startTime != null and endTime != null ">
and warning.warning_time between #{startTime} and #{endTime}</if>
</where>
order by warning.warning_time desc
</select>
<select id="selectSectionPerceivedEventsList" resultType="hashmap">
select s.section_name sectionName,

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

@ -33,8 +33,135 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updateMiddleDatabaseDevice">
<insert id="insertMiddleDatabaseEvent" parameterType="MdEvent">
insert into event
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fusionId != null">fusionId,</if>
<if test="eventName != null">event_name,</if>
<if test="eventTypeCode != null">event_type_code,</if>
<if test="eventDesc != null">event_desc,</if>
<if test="occurTime != null">occur_time,</if>
<if test="endTime != null">end_time,</if>
<if test="stakeNumber != null and stakeNumber != ''">stake_number,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="lane != null">lane,</if>
<if test="direction != null and direction != ''">direction,</if>
<if test="location != null">location,</if>
<if test="eventSourceCode != null">event_source_code,</if>
<if test="eventSource != null">event_source,</if>
<if test="eventStatus != null">event_status,</if>
<if test="eventLevel != null">event_level,</if>
<if test="sectionId != null">section_id,</if>
<if test="eventTypeCode2 != null">event_type_code2,</if>
<if test="eventCause != null">event_cause,</if>
<if test="accidentWeather != null">accident_weather,</if>
<if test="accidentQueue != null">accident_queue,</if>
<if test="congestionPile != null">congestion_pile,</if>
<if test="congestionReason != null">congestion_reason,</if>
<if test="controlCategory != null">control_category,</if>
<if test="controlReason != null">control_reason,</if>
<if test="controlReasonType != null">control_reason_type,</if>
<if test="controlStation != null">control_station,</if>
<if test="controlPile != null">control_pile,</if>
<if test="controlStrategy != null">control_strategy,</if>
<if test="controlType != null">control_type,</if>
<if test="controlVehicleType != null">control_vehicle_type,</if>
<if test="creatorUserId != null">CreatorUserId,</if>
<if test="lastModificationTime != null">LastModificationTime,</if>
<if test="lastModifierUserId != null">LastModifierUserId,</if>
<if test="isDeleted != null">IsDeleted,</if>
<if test="deleterUserId != null">DeleterUserId,</if>
<if test="deletionTime != null">DeletionTime,</if>
CreationTime,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fusionId != null">#{fusionId},</if>
<if test="eventName != null">#{eventName},</if>
<if test="eventTypeCode != null">#{eventTypeCode},</if>
<if test="eventDesc != null">#{eventDesc},</if>
<if test="occurTime != null">#{occurTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="stakeNumber != null and stakeNumber != ''">#{stakeNumber},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="lane != null">#{lane},</if>
<if test="direction != null and direction != ''">#{direction},</if>
<if test="location != null">#{location},</if>
<if test="eventSourceCode != null">#{eventSourceCode},</if>
<if test="eventSource != null">#{eventSource},</if>
<if test="eventStatus != null">#{eventStatus},</if>
<if test="eventLevel != null">#{eventLevel},</if>
<if test="sectionId != null">#{sectionId},</if>
<if test="eventTypeCode2 != null">#{eventTypeCode2},</if>
<if test="eventCause != null">#{eventCause},</if>
<if test="accidentWeather != null">#{accidentWeather},</if>
<if test="accidentQueue != null">#{accidentQueue},</if>
<if test="congestionPile != null">#{congestionPile},</if>
<if test="congestionReason != null">#{congestionReason},</if>
<if test="controlCategory != null">#{controlCategory},</if>
<if test="controlReason != null">#{controlReason},</if>
<if test="controlReasonType != null">#{controlReasonType},</if>
<if test="controlStation != null">#{controlStation},</if>
<if test="controlPile != null">#{controlPile},</if>
<if test="controlStrategy != null">#{controlStrategy},</if>
<if test="controlType != null">#{controlType},</if>
<if test="controlVehicleType != null">#{controlVehicleType},</if>
<if test="creatorUserId != null">#{creatorUserId},</if>
<if test="lastModificationTime != null">#{lastModificationTime},</if>
<if test="lastModifierUserId != null">#{lastModifierUserId},</if>
<if test="isDeleted != null">#{isDeleted},</if>
<if test="deleterUserId != null">#{deleterUserId},</if>
<if test="deletionTime != null">#{deletionTime},</if>
now()
</trim>
</insert>
<update id="updateMiddleDatabaseDevice" parameterType="MdEvent">
update device set dev_status = #{deviceState} where dev_no = #{iotDeviceId}
</update>
<update id="updateMiddleDatabaseEvent" parameterType="MdEvent">
update event
<trim prefix="SET" suffixOverrides=",">
<if test="fusionId != null">fusionId = #{fusionId},</if>
<if test="eventName != null">event_name = #{eventName},</if>
<if test="eventTypeCode != null">event_type_code = #{eventTypeCode},</if>
<if test="eventDesc != null">event_desc = #{eventDesc},</if>
<if test="occurTime != null">occur_time = #{occurTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="stakeNumber != null and stakeNumber != ''">stake_number = #{stakeNumber},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="lane != null">lane = #{lane},</if>
<if test="direction != null and direction != ''">direction = #{direction},</if>
<if test="location != null">location = #{location},</if>
<if test="eventSourceCode != null">event_source_code = #{eventSourceCode},</if>
<if test="eventSource != null">event_source = #{eventSource},</if>
<if test="eventStatus != null">event_status = #{eventStatus},</if>
<if test="eventLevel != null">event_level = #{eventLevel},</if>
<if test="sectionId != null">section_id = #{sectionId},</if>
<if test="eventTypeCode2 != null">event_type_code2 = #{eventTypeCode2},</if>
<if test="eventCause != null">event_cause = #{eventCause},</if>
<if test="accidentWeather != null">accident_weather = #{accidentWeather},</if>
<if test="accidentQueue != null">accident_queue = #{accidentQueue},</if>
<if test="congestionPile != null">congestion_pile = #{congestionPile},</if>
<if test="congestionReason != null">congestion_reason = #{congestionReason},</if>
<if test="controlCategory != null">control_category = #{controlCategory},</if>
<if test="controlReason != null">control_reason = #{controlReason},</if>
<if test="controlReasonType != null">control_reason_type = #{controlReasonType},</if>
<if test="controlStation != null">control_station = #{controlStation},</if>
<if test="controlPile != null">control_pile = #{controlPile},</if>
<if test="controlStrategy != null">control_strategy = #{controlStrategy},</if>
<if test="controlType != null">control_type = #{controlType},</if>
<if test="controlVehicleType != null">control_vehicle_type = #{controlVehicleType},</if>
LastModificationTime = now(),
<if test="lastModifierUserId != null">LastModifierUserId = #{lastModifierUserId},</if>
<if test="isDeleted != null">IsDeleted = #{isDeleted},</if>
<if test="deleterUserId != null">DeleterUserId = #{deleterUserId},</if>
<if test="deletionTime != null">DeletionTime = #{deletionTime},</if>
</trim>
where id = #{id}
</update>
</mapper>

Loading…
Cancel
Save