正在显示
25 个修改的文件
包含
1034 行增加
和
118 行删除
| @@ -7,6 +7,7 @@ import java.lang.reflect.Field; | @@ -7,6 +7,7 @@ import java.lang.reflect.Field; | ||
| 7 | import java.lang.reflect.InvocationTargetException; | 7 | import java.lang.reflect.InvocationTargetException; |
| 8 | import java.lang.reflect.Method; | 8 | import java.lang.reflect.Method; |
| 9 | import java.text.MessageFormat; | 9 | import java.text.MessageFormat; |
| 10 | +import java.util.ArrayList; | ||
| 10 | import java.util.List; | 11 | import java.util.List; |
| 11 | import java.util.Map; | 12 | import java.util.Map; |
| 12 | 13 | ||
| @@ -678,91 +679,57 @@ public class PublicSQL { | @@ -678,91 +679,57 @@ public class PublicSQL { | ||
| 678 | * @param objectlist 对象列表 | 679 | * @param objectlist 对象列表 |
| 679 | * @return | 680 | * @return |
| 680 | */ | 681 | */ |
| 681 | - public String saveOrUpdateObjectList(List<Object> objectlist) | ||
| 682 | - { | ||
| 683 | - StringBuffer sb =new StringBuffer(); | ||
| 684 | - String update = ""; | ||
| 685 | - for(int i = 0; i<objectlist.size();i++) | ||
| 686 | - { | ||
| 687 | - Object object = objectlist.get(i); | 682 | + public String saveOrUpdateObjectList(List<Object> objectlist) { |
| 683 | + if (objectlist == null || objectlist.isEmpty()) { | ||
| 684 | + throw new IllegalArgumentException("objectlist cannot be empty"); | ||
| 685 | + } | ||
| 688 | 686 | ||
| 689 | - Field[] fields = object.getClass().getDeclaredFields( ); | ||
| 690 | - if(i==0) | ||
| 691 | - { | ||
| 692 | - String tableName = changTableNameFromObject(object); | ||
| 693 | - sb.append("INSERT INTO `"+tableName+"` "); | ||
| 694 | - sb.append("("); | ||
| 695 | - for(Field field:fields) | ||
| 696 | - { | ||
| 697 | - PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 698 | - if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 699 | - { | ||
| 700 | - continue; | ||
| 701 | - } | ||
| 702 | - if(!"".equals(update) ) | ||
| 703 | - { | ||
| 704 | - sb.append(","); | ||
| 705 | - update += ","; | ||
| 706 | - } | ||
| 707 | - sb.append("`"+com.ruoyi.common.utils.StringUtils.toUnderScoreCase(field.getName())+"`"); | ||
| 708 | - update += "`"+com.ruoyi.common.utils.StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+com.ruoyi.common.utils.StringUtils.toUnderScoreCase(field.getName())+"`)"; | ||
| 709 | - } | ||
| 710 | - sb.append(")"); | ||
| 711 | - sb.append("VALUES "); | ||
| 712 | - }else{ | ||
| 713 | - sb.append(","); | 687 | + StringBuilder sb = new StringBuilder(); |
| 688 | + StringBuilder update = new StringBuilder(); | ||
| 689 | + | ||
| 690 | + Object firstObject = objectlist.get(0); | ||
| 691 | + String tableName = changTableNameFromObject(firstObject); | ||
| 692 | + Field[] fields = firstObject.getClass().getDeclaredFields(); | ||
| 693 | + | ||
| 694 | + // 拼字段列表 | ||
| 695 | + sb.append("INSERT INTO `").append(tableName).append("` ("); | ||
| 696 | + List<Field> validFields = new ArrayList<>(); | ||
| 697 | + for (Field field : fields) { | ||
| 698 | + PublicSQLConfig cfg = field.getAnnotation(PublicSQLConfig.class); | ||
| 699 | + if (cfg != null && !cfg.isSelect()) { | ||
| 700 | + continue; | ||
| 714 | } | 701 | } |
| 715 | - for(int j=0;j<fields.length;j++) | ||
| 716 | - { | ||
| 717 | - Field field = fields[j]; | ||
| 718 | - Method method; | ||
| 719 | - try { | ||
| 720 | - PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 721 | - if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 722 | - { | ||
| 723 | - continue; | ||
| 724 | - } | ||
| 725 | - method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); | ||
| 726 | - Object value = method.invoke(object); | ||
| 727 | - if(null == value) | ||
| 728 | - { | ||
| 729 | - value = ""; | ||
| 730 | - } | ||
| 731 | - if(j!=0) | ||
| 732 | - { | ||
| 733 | - sb.append(","); | ||
| 734 | - }else{ | ||
| 735 | - sb.append("("); | ||
| 736 | - } | ||
| 737 | - sb.append("#{"+ field.getName()+"}"); | ||
| 738 | - if(j==fields.length-1) | ||
| 739 | - { | ||
| 740 | - sb.append(")"); | ||
| 741 | - } | ||
| 742 | - } catch (NoSuchMethodException e) { | ||
| 743 | - // TODO Auto-generated catch block | ||
| 744 | - e.printStackTrace(); | ||
| 745 | - } catch (SecurityException e) { | ||
| 746 | - // TODO Auto-generated catch block | ||
| 747 | - e.printStackTrace(); | ||
| 748 | - } catch (IllegalAccessException e) { | ||
| 749 | - // TODO Auto-generated catch block | ||
| 750 | - e.printStackTrace(); | ||
| 751 | - } catch (IllegalArgumentException e) { | ||
| 752 | - // TODO Auto-generated catch block | ||
| 753 | - e.printStackTrace(); | ||
| 754 | - } catch (InvocationTargetException e) { | ||
| 755 | - // TODO Auto-generated catch block | ||
| 756 | - e.printStackTrace(); | ||
| 757 | - } | 702 | + validFields.add(field); |
| 703 | + } | ||
| 758 | 704 | ||
| 705 | + for (int i = 0; i < validFields.size(); i++) { | ||
| 706 | + Field field = validFields.get(i); | ||
| 707 | + String column = com.ruoyi.common.utils.StringUtils.toUnderScoreCase(field.getName()); | ||
| 708 | + if (i > 0) { | ||
| 709 | + sb.append(","); | ||
| 710 | + update.append(","); | ||
| 759 | } | 711 | } |
| 712 | + sb.append("`").append(column).append("`"); | ||
| 713 | + update.append("`").append(column).append("`=VALUES(`").append(column).append("`)"); | ||
| 714 | + } | ||
| 715 | + sb.append(") VALUES "); | ||
| 716 | + | ||
| 717 | + // 拼 values | ||
| 718 | + for (int i = 0; i < objectlist.size(); i++) { | ||
| 719 | + if (i > 0) sb.append(","); | ||
| 720 | + sb.append("("); | ||
| 721 | + for (int j = 0; j < validFields.size(); j++) { | ||
| 722 | + if (j > 0) sb.append(","); | ||
| 723 | + sb.append("#{list[").append(i).append("].").append(validFields.get(j).getName()).append("}"); | ||
| 724 | + } | ||
| 725 | + sb.append(")"); | ||
| 760 | } | 726 | } |
| 761 | - sb.append(" ON DUPLICATE KEY UPDATE "); | ||
| 762 | - sb.append(update); | 727 | + |
| 728 | + sb.append(" ON DUPLICATE KEY UPDATE ").append(update); | ||
| 763 | return sb.toString(); | 729 | return sb.toString(); |
| 764 | } | 730 | } |
| 765 | 731 | ||
| 732 | + | ||
| 766 | public String getObjectListBySQL(Map<String, Object> para) | 733 | public String getObjectListBySQL(Map<String, Object> para) |
| 767 | { | 734 | { |
| 768 | return para.get("sql")+""; | 735 | return para.get("sql")+""; |
| @@ -4,11 +4,12 @@ import java.util.List; | @@ -4,11 +4,12 @@ import java.util.List; | ||
| 4 | import com.ruoyi.common.utils.DateUtils; | 4 | import com.ruoyi.common.utils.DateUtils; |
| 5 | import com.zhonglai.luhui.datasource.enums.DataSource; | 5 | import com.zhonglai.luhui.datasource.enums.DataSource; |
| 6 | import com.zhonglai.luhui.datasource.enums.DataSourceType; | 6 | import com.zhonglai.luhui.datasource.enums.DataSourceType; |
| 7 | +import com.zhonglai.luhui.user.service.*; | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 9 | import com.zhonglai.luhui.user.mapper.UserBaseInfoMapper; | 10 | import com.zhonglai.luhui.user.mapper.UserBaseInfoMapper; |
| 10 | import com.zhonglai.luhui.user.domain.UserBaseInfo; | 11 | import com.zhonglai.luhui.user.domain.UserBaseInfo; |
| 11 | -import com.zhonglai.luhui.user.service.IUserBaseInfoService; | 12 | +import org.springframework.transaction.annotation.Transactional; |
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * 基础用户信息Service业务层处理 | 15 | * 基础用户信息Service业务层处理 |
| @@ -23,6 +24,22 @@ public class UserBaseInfoServiceImpl implements IUserBaseInfoService | @@ -23,6 +24,22 @@ public class UserBaseInfoServiceImpl implements IUserBaseInfoService | ||
| 23 | @Autowired | 24 | @Autowired |
| 24 | private UserBaseInfoMapper userBaseInfoMapper; | 25 | private UserBaseInfoMapper userBaseInfoMapper; |
| 25 | 26 | ||
| 27 | + @Autowired | ||
| 28 | + private IUserAccountInfoService userAccountInfoService; | ||
| 29 | + @Autowired | ||
| 30 | + private IUserAddressInfoService userAddressInfoService; | ||
| 31 | + @Autowired | ||
| 32 | + private IUserAuthInfoService userAuthInfoService; | ||
| 33 | + @Autowired | ||
| 34 | + private IUserExtraInfoService userExtraInfoService; | ||
| 35 | + @Autowired | ||
| 36 | + private IUserLoginInfoService userLoginInfoService; | ||
| 37 | + @Autowired | ||
| 38 | + private IUserLoginService userLoginService; | ||
| 39 | + @Autowired | ||
| 40 | + private IUserOfficialInfoService userOfficialInfoService; | ||
| 41 | + @Autowired | ||
| 42 | + private IUserSocialInfoService userSocialInfoService; | ||
| 26 | /** | 43 | /** |
| 27 | * 查询基础用户信息 | 44 | * 查询基础用户信息 |
| 28 | * | 45 | * |
| @@ -66,6 +83,7 @@ public class UserBaseInfoServiceImpl implements IUserBaseInfoService | @@ -66,6 +83,7 @@ public class UserBaseInfoServiceImpl implements IUserBaseInfoService | ||
| 66 | * @param userBaseInfo 基础用户信息 | 83 | * @param userBaseInfo 基础用户信息 |
| 67 | * @return 结果 | 84 | * @return 结果 |
| 68 | */ | 85 | */ |
| 86 | + @Transactional | ||
| 69 | @Override | 87 | @Override |
| 70 | public int updateUserBaseInfo(UserBaseInfo userBaseInfo) | 88 | public int updateUserBaseInfo(UserBaseInfo userBaseInfo) |
| 71 | { | 89 | { |
| @@ -78,9 +96,18 @@ public class UserBaseInfoServiceImpl implements IUserBaseInfoService | @@ -78,9 +96,18 @@ public class UserBaseInfoServiceImpl implements IUserBaseInfoService | ||
| 78 | * @param ids 需要删除的基础用户信息主键 | 96 | * @param ids 需要删除的基础用户信息主键 |
| 79 | * @return 结果 | 97 | * @return 结果 |
| 80 | */ | 98 | */ |
| 99 | + @Transactional | ||
| 81 | @Override | 100 | @Override |
| 82 | public int deleteUserBaseInfoByIds(Integer[] ids) | 101 | public int deleteUserBaseInfoByIds(Integer[] ids) |
| 83 | { | 102 | { |
| 103 | + userAccountInfoService.deleteUserAccountInfoByIds(ids); | ||
| 104 | + userAddressInfoService.deleteUserAddressInfoByIds(ids); | ||
| 105 | + userAuthInfoService.deleteUserAuthInfoByIds(ids); | ||
| 106 | + userExtraInfoService.deleteUserExtraInfoByIds(ids); | ||
| 107 | + userOfficialInfoService.deleteUserOfficialInfoByIds(ids); | ||
| 108 | + userSocialInfoService.deleteUserSocialInfoByIds(ids); | ||
| 109 | + userLoginInfoService.deleteUserLoginInfoByIds(ids); | ||
| 110 | + userLoginService.deleteUserLoginByIds(ids); | ||
| 84 | return userBaseInfoMapper.deleteUserBaseInfoByIds(ids); | 111 | return userBaseInfoMapper.deleteUserBaseInfoByIds(ids); |
| 85 | } | 112 | } |
| 86 | 113 |
| @@ -24,12 +24,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -24,12 +24,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 24 | <include refid="selectUserBaseInfoVo"/> | 24 | <include refid="selectUserBaseInfoVo"/> |
| 25 | <where> | 25 | <where> |
| 26 | <if test="id != null "> and id = #{id}</if> | 26 | <if test="id != null "> and id = #{id}</if> |
| 27 | - <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | 27 | + <if test="loginName != null "> and login_name like concat('%', #{loginName}, '%')</if> |
| 28 | + <if test="name != null and name != ''"> and `name` like concat('%', #{name}, '%')</if> | ||
| 28 | <if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if> | 29 | <if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if> |
| 29 | <if test="gender != null "> and gender = #{gender}</if> | 30 | <if test="gender != null "> and gender = #{gender}</if> |
| 30 | <if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if> | 31 | <if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if> |
| 31 | <if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if> | 32 | <if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if> |
| 32 | <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if> | 33 | <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if> |
| 34 | + <if test="params.keyValue != null and params.keyValue != ''"> and ( | ||
| 35 | + login_name like concat('%', #{params.keyValue}, '%') | ||
| 36 | + or email like concat('%', #{params.keyValue}, '%') | ||
| 37 | + or nickname like concat('%', #{params.keyValue}, '%') | ||
| 38 | + or phone like concat('%', #{params.keyValue}, '%') | ||
| 39 | + or `name` like concat('%', #{params.keyValue}, '%') | ||
| 40 | + ) | ||
| 41 | + </if> | ||
| 33 | </where> | 42 | </where> |
| 34 | </select> | 43 | </select> |
| 35 | 44 | ||
| @@ -41,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -41,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 41 | <insert id="insertUserBaseInfo" parameterType="UserBaseInfo" useGeneratedKeys="true" keyProperty="id"> | 50 | <insert id="insertUserBaseInfo" parameterType="UserBaseInfo" useGeneratedKeys="true" keyProperty="id"> |
| 42 | insert into user_base_info | 51 | insert into user_base_info |
| 43 | <trim prefix="(" suffix=")" suffixOverrides=","> | 52 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 44 | - <if test="loginName != null">loginName,</if> | 53 | + <if test="loginName != null">login_name,</if> |
| 45 | <if test="name != null">`name`,</if> | 54 | <if test="name != null">`name`,</if> |
| 46 | <if test="nickname != null">nickname,</if> | 55 | <if test="nickname != null">nickname,</if> |
| 47 | <if test="gender != null">gender,</if> | 56 | <if test="gender != null">gender,</if> |
| @@ -78,13 +87,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -78,13 +87,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 78 | </update> | 87 | </update> |
| 79 | 88 | ||
| 80 | <delete id="deleteUserBaseInfoById" parameterType="Integer"> | 89 | <delete id="deleteUserBaseInfoById" parameterType="Integer"> |
| 81 | - delete from user_base_info where id = #{id} | 90 | + <!-- 按删除顺序依赖关系:子表在前,主表在后 --> |
| 91 | + delete from user_account_info where id = #{id}; | ||
| 92 | + delete from user_address_info where id = #{id}; | ||
| 93 | + delete from user_auth_info where id = #{id}; | ||
| 94 | + delete from user_extra_info where id = #{id}; | ||
| 95 | + delete from user_login where user_id = #{id}; | ||
| 96 | + delete from user_login_info where id = #{id}; | ||
| 97 | + delete from user_official_info where id = #{id}; | ||
| 98 | + delete from user_social_info where id = #{id}; | ||
| 99 | + delete from user_base_info where id = #{id}; | ||
| 82 | </delete> | 100 | </delete> |
| 83 | 101 | ||
| 84 | - <delete id="deleteUserBaseInfoByIds" parameterType="String"> | ||
| 85 | - delete from user_base_info where id in | 102 | + <delete id="deleteUserBaseInfoByIds" parameterType="Integer"> |
| 103 | + <!-- 先删关联表,再删主表 --> | ||
| 104 | + delete from user_base_info where id in | ||
| 86 | <foreach item="id" collection="array" open="(" separator="," close=")"> | 105 | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| 87 | #{id} | 106 | #{id} |
| 88 | - </foreach> | 107 | + </foreach>; |
| 89 | </delete> | 108 | </delete> |
| 90 | </mapper> | 109 | </mapper> |
| 1 | -- 菜单 SQL | 1 | -- 菜单 SQL |
| 2 | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) | 2 | insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) |
| 3 | -values('${functionName}', 2006, '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); | 3 | +values('${functionName}', '${parentMenuId}, '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); |
| 4 | 4 | ||
| 5 | -- 按钮父菜单ID | 5 | -- 按钮父菜单ID |
| 6 | SELECT @parentId := LAST_INSERT_ID(); | 6 | SELECT @parentId := LAST_INSERT_ID(); |
lh-jar/lh-jar-device-service/src/main/java/com/zhonglai/luhui/device/domain/IotLsyPlcConfig.java
0 → 100644
| 1 | +package com.zhonglai.luhui.device.domain; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.annotation.PublicSQLConfig; | ||
| 4 | +import org.apache.commons.lang3.builder.ToStringBuilder; | ||
| 5 | +import org.apache.commons.lang3.builder.ToStringStyle; | ||
| 6 | +import io.swagger.annotations.ApiModel; | ||
| 7 | +import io.swagger.annotations.ApiModelProperty; | ||
| 8 | +import com.ruoyi.common.tool.BaseEntity; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 流水鱼plc通讯解析协议配置对象 iot_lsy_plc_config | ||
| 12 | + * | ||
| 13 | + * @author zhonglai | ||
| 14 | + * @date 2025-11-10 | ||
| 15 | + */ | ||
| 16 | +@ApiModel("流水鱼plc通讯解析协议配置") | ||
| 17 | +public class IotLsyPlcConfig extends BaseEntity | ||
| 18 | +{ | ||
| 19 | + @PublicSQLConfig(isSelect=false) | ||
| 20 | + private static final long serialVersionUID = 1L; | ||
| 21 | + | ||
| 22 | + /** 主键 */ | ||
| 23 | + @ApiModelProperty(value="主键") | ||
| 24 | + private Integer id; | ||
| 25 | + | ||
| 26 | + /** 变量名称 */ | ||
| 27 | + @ApiModelProperty(value="变量名称") | ||
| 28 | + private String alterName; | ||
| 29 | + | ||
| 30 | + /** 变量地址 */ | ||
| 31 | + @ApiModelProperty(value="变量地址") | ||
| 32 | + private String alterAddr; | ||
| 33 | + | ||
| 34 | + /** 上传名称 */ | ||
| 35 | + @ApiModelProperty(value="上传名称") | ||
| 36 | + private String upName; | ||
| 37 | + | ||
| 38 | + /** 上传间隔 */ | ||
| 39 | + @ApiModelProperty(value="上传间隔") | ||
| 40 | + private Integer upInterval; | ||
| 41 | + | ||
| 42 | + /** 项目类型(1流水槽,2工厂化,3其它) */ | ||
| 43 | + @ApiModelProperty(value="项目类型",allowableValues="1=流水槽,2工厂化,3其它") | ||
| 44 | + private String prejectType; | ||
| 45 | + | ||
| 46 | + /** 产品id */ | ||
| 47 | + @ApiModelProperty(value="产品id") | ||
| 48 | + private String deviceType; | ||
| 49 | + | ||
| 50 | + public void setId(Integer id) | ||
| 51 | + { | ||
| 52 | + this.id = id; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public Integer getId() | ||
| 56 | + { | ||
| 57 | + return id; | ||
| 58 | + } | ||
| 59 | + public void setAlterName(String alterName) | ||
| 60 | + { | ||
| 61 | + this.alterName = alterName; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public String getAlterName() | ||
| 65 | + { | ||
| 66 | + return alterName; | ||
| 67 | + } | ||
| 68 | + public void setAlterAddr(String alterAddr) | ||
| 69 | + { | ||
| 70 | + this.alterAddr = alterAddr; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public String getAlterAddr() | ||
| 74 | + { | ||
| 75 | + return alterAddr; | ||
| 76 | + } | ||
| 77 | + public void setUpName(String upName) | ||
| 78 | + { | ||
| 79 | + this.upName = upName; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public String getUpName() | ||
| 83 | + { | ||
| 84 | + return upName; | ||
| 85 | + } | ||
| 86 | + public void setUpInterval(Integer upInterval) | ||
| 87 | + { | ||
| 88 | + this.upInterval = upInterval; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public Integer getUpInterval() | ||
| 92 | + { | ||
| 93 | + return upInterval; | ||
| 94 | + } | ||
| 95 | + public void setPrejectType(String prejectType) | ||
| 96 | + { | ||
| 97 | + this.prejectType = prejectType; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public String getPrejectType() | ||
| 101 | + { | ||
| 102 | + return prejectType; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public String getDeviceType() { | ||
| 106 | + return deviceType; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setDeviceType(String deviceType) { | ||
| 110 | + this.deviceType = deviceType; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + @Override | ||
| 114 | + public String toString() { | ||
| 115 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | ||
| 116 | + .append("id", getId()) | ||
| 117 | + .append("alterName", getAlterName()) | ||
| 118 | + .append("alterAddr", getAlterAddr()) | ||
| 119 | + .append("upName", getUpName()) | ||
| 120 | + .append("upInterval", getUpInterval()) | ||
| 121 | + .append("createTime", getCreateTime()) | ||
| 122 | + .append("prejectType", getPrejectType()) | ||
| 123 | + .append("productId", getDeviceType()) | ||
| 124 | + .toString(); | ||
| 125 | + } | ||
| 126 | +} |
| 1 | +package com.zhonglai.luhui.device.mapper; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import com.zhonglai.luhui.device.domain.IotLsyPlcConfig; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 流水鱼plc通讯解析协议配置Mapper接口 | ||
| 8 | + * | ||
| 9 | + * @author zhonglai | ||
| 10 | + * @date 2025-11-10 | ||
| 11 | + */ | ||
| 12 | +public interface IotLsyPlcConfigMapper | ||
| 13 | +{ | ||
| 14 | + /** | ||
| 15 | + * 查询流水鱼plc通讯解析协议配置 | ||
| 16 | + * | ||
| 17 | + * @param id 流水鱼plc通讯解析协议配置主键 | ||
| 18 | + * @return 流水鱼plc通讯解析协议配置 | ||
| 19 | + */ | ||
| 20 | + public IotLsyPlcConfig selectIotLsyPlcConfigById(Integer id); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 查询流水鱼plc通讯解析协议配置列表 | ||
| 24 | + * | ||
| 25 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 26 | + * @return 流水鱼plc通讯解析协议配置集合 | ||
| 27 | + */ | ||
| 28 | + public List<IotLsyPlcConfig> selectIotLsyPlcConfigList(IotLsyPlcConfig iotLsyPlcConfig); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 新增流水鱼plc通讯解析协议配置 | ||
| 32 | + * | ||
| 33 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 34 | + * @return 结果 | ||
| 35 | + */ | ||
| 36 | + public int insertIotLsyPlcConfig(IotLsyPlcConfig iotLsyPlcConfig); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 修改流水鱼plc通讯解析协议配置 | ||
| 40 | + * | ||
| 41 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 42 | + * @return 结果 | ||
| 43 | + */ | ||
| 44 | + public int updateIotLsyPlcConfig(IotLsyPlcConfig iotLsyPlcConfig); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 删除流水鱼plc通讯解析协议配置 | ||
| 48 | + * | ||
| 49 | + * @param id 流水鱼plc通讯解析协议配置主键 | ||
| 50 | + * @return 结果 | ||
| 51 | + */ | ||
| 52 | + public int deleteIotLsyPlcConfigById(Integer id); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 批量删除流水鱼plc通讯解析协议配置 | ||
| 56 | + * | ||
| 57 | + * @param ids 需要删除的数据主键集合 | ||
| 58 | + * @return 结果 | ||
| 59 | + */ | ||
| 60 | + public int deleteIotLsyPlcConfigByIds(Integer[] ids); | ||
| 61 | +} |
| 1 | +package com.zhonglai.luhui.device.service; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import com.zhonglai.luhui.device.domain.IotLsyPlcConfig; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 流水鱼plc通讯解析协议配置Service接口 | ||
| 8 | + * | ||
| 9 | + * @author zhonglai | ||
| 10 | + * @date 2025-11-10 | ||
| 11 | + */ | ||
| 12 | +public interface IIotLsyPlcConfigService | ||
| 13 | +{ | ||
| 14 | + /** | ||
| 15 | + * 查询流水鱼plc通讯解析协议配置 | ||
| 16 | + * | ||
| 17 | + * @param id 流水鱼plc通讯解析协议配置主键 | ||
| 18 | + * @return 流水鱼plc通讯解析协议配置 | ||
| 19 | + */ | ||
| 20 | + public IotLsyPlcConfig selectIotLsyPlcConfigById(Integer id); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 查询流水鱼plc通讯解析协议配置列表 | ||
| 24 | + * | ||
| 25 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 26 | + * @return 流水鱼plc通讯解析协议配置集合 | ||
| 27 | + */ | ||
| 28 | + public List<IotLsyPlcConfig> selectIotLsyPlcConfigList(IotLsyPlcConfig iotLsyPlcConfig); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 新增流水鱼plc通讯解析协议配置 | ||
| 32 | + * | ||
| 33 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 34 | + * @return 结果 | ||
| 35 | + */ | ||
| 36 | + public int insertIotLsyPlcConfig(IotLsyPlcConfig iotLsyPlcConfig); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 修改流水鱼plc通讯解析协议配置 | ||
| 40 | + * | ||
| 41 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 42 | + * @return 结果 | ||
| 43 | + */ | ||
| 44 | + public int updateIotLsyPlcConfig(IotLsyPlcConfig iotLsyPlcConfig); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 批量删除流水鱼plc通讯解析协议配置 | ||
| 48 | + * | ||
| 49 | + * @param ids 需要删除的流水鱼plc通讯解析协议配置主键集合 | ||
| 50 | + * @return 结果 | ||
| 51 | + */ | ||
| 52 | + public int deleteIotLsyPlcConfigByIds(Integer[] ids); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 删除流水鱼plc通讯解析协议配置信息 | ||
| 56 | + * | ||
| 57 | + * @param id 流水鱼plc通讯解析协议配置主键 | ||
| 58 | + * @return 结果 | ||
| 59 | + */ | ||
| 60 | + public int deleteIotLsyPlcConfigById(Integer id); | ||
| 61 | +} |
| 1 | +package com.zhonglai.luhui.device.service.impl; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import com.ruoyi.common.utils.DateUtils; | ||
| 5 | +import com.zhonglai.luhui.device.domain.IotLsyPlcConfig; | ||
| 6 | +import com.zhonglai.luhui.device.mapper.IotLsyPlcConfigMapper; | ||
| 7 | +import com.zhonglai.luhui.device.service.IIotLsyPlcConfigService; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 流水鱼plc通讯解析协议配置Service业务层处理 | ||
| 13 | + * | ||
| 14 | + * @author zhonglai | ||
| 15 | + * @date 2025-11-10 | ||
| 16 | + */ | ||
| 17 | +@Service | ||
| 18 | +public class IotLsyPlcConfigServiceImpl implements IIotLsyPlcConfigService | ||
| 19 | +{ | ||
| 20 | + @Autowired | ||
| 21 | + private IotLsyPlcConfigMapper iotLsyPlcConfigMapper; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 查询流水鱼plc通讯解析协议配置 | ||
| 25 | + * | ||
| 26 | + * @param id 流水鱼plc通讯解析协议配置主键 | ||
| 27 | + * @return 流水鱼plc通讯解析协议配置 | ||
| 28 | + */ | ||
| 29 | + @Override | ||
| 30 | + public IotLsyPlcConfig selectIotLsyPlcConfigById(Integer id) | ||
| 31 | + { | ||
| 32 | + return iotLsyPlcConfigMapper.selectIotLsyPlcConfigById(id); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 查询流水鱼plc通讯解析协议配置列表 | ||
| 37 | + * | ||
| 38 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 39 | + * @return 流水鱼plc通讯解析协议配置 | ||
| 40 | + */ | ||
| 41 | + @Override | ||
| 42 | + public List<IotLsyPlcConfig> selectIotLsyPlcConfigList(IotLsyPlcConfig iotLsyPlcConfig) | ||
| 43 | + { | ||
| 44 | + return iotLsyPlcConfigMapper.selectIotLsyPlcConfigList(iotLsyPlcConfig); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 新增流水鱼plc通讯解析协议配置 | ||
| 49 | + * | ||
| 50 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 51 | + * @return 结果 | ||
| 52 | + */ | ||
| 53 | + @Override | ||
| 54 | + public int insertIotLsyPlcConfig(IotLsyPlcConfig iotLsyPlcConfig) | ||
| 55 | + { | ||
| 56 | + iotLsyPlcConfig.setCreateTime(DateUtils.getNowDate()); | ||
| 57 | + return iotLsyPlcConfigMapper.insertIotLsyPlcConfig(iotLsyPlcConfig); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 修改流水鱼plc通讯解析协议配置 | ||
| 62 | + * | ||
| 63 | + * @param iotLsyPlcConfig 流水鱼plc通讯解析协议配置 | ||
| 64 | + * @return 结果 | ||
| 65 | + */ | ||
| 66 | + @Override | ||
| 67 | + public int updateIotLsyPlcConfig(IotLsyPlcConfig iotLsyPlcConfig) | ||
| 68 | + { | ||
| 69 | + return iotLsyPlcConfigMapper.updateIotLsyPlcConfig(iotLsyPlcConfig); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 批量删除流水鱼plc通讯解析协议配置 | ||
| 74 | + * | ||
| 75 | + * @param ids 需要删除的流水鱼plc通讯解析协议配置主键 | ||
| 76 | + * @return 结果 | ||
| 77 | + */ | ||
| 78 | + @Override | ||
| 79 | + public int deleteIotLsyPlcConfigByIds(Integer[] ids) | ||
| 80 | + { | ||
| 81 | + return iotLsyPlcConfigMapper.deleteIotLsyPlcConfigByIds(ids); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 删除流水鱼plc通讯解析协议配置信息 | ||
| 86 | + * | ||
| 87 | + * @param id 流水鱼plc通讯解析协议配置主键 | ||
| 88 | + * @return 结果 | ||
| 89 | + */ | ||
| 90 | + @Override | ||
| 91 | + public int deleteIotLsyPlcConfigById(Integer id) | ||
| 92 | + { | ||
| 93 | + return iotLsyPlcConfigMapper.deleteIotLsyPlcConfigById(id); | ||
| 94 | + } | ||
| 95 | +} |
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
| 2 | +<!DOCTYPE mapper | ||
| 3 | +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 4 | +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 5 | +<mapper namespace="com.zhonglai.luhui.device.mapper.IotLsyPlcConfigMapper"> | ||
| 6 | + | ||
| 7 | + <resultMap type="IotLsyPlcConfig" id="IotLsyPlcConfigResult"> | ||
| 8 | + <result property="id" column="id" /> | ||
| 9 | + <result property="alterName" column="alter_name" /> | ||
| 10 | + <result property="alterAddr" column="alter_addr" /> | ||
| 11 | + <result property="upName" column="up_name" /> | ||
| 12 | + <result property="upInterval" column="up_interval" /> | ||
| 13 | + <result property="createTime" column="create_time" /> | ||
| 14 | + <result property="prejectType" column="preject_type" /> | ||
| 15 | + <result property="deviceType" column="device_type" /> | ||
| 16 | + </resultMap> | ||
| 17 | + | ||
| 18 | + <sql id="selectIotLsyPlcConfigVo"> | ||
| 19 | + select id, alter_name, alter_addr, up_name, up_interval, create_time, preject_type, device_type from iot_lsy_plc_config | ||
| 20 | + </sql> | ||
| 21 | + | ||
| 22 | + <select id="selectIotLsyPlcConfigList" parameterType="IotLsyPlcConfig" resultMap="IotLsyPlcConfigResult"> | ||
| 23 | + <include refid="selectIotLsyPlcConfigVo"/> | ||
| 24 | + <where> | ||
| 25 | + <if test="id != null "> and id = #{id}</if> | ||
| 26 | + <if test="alterName != null and alterName != ''"> and alter_name like concat('%', #{alterName}, '%')</if> | ||
| 27 | + <if test="alterAddr != null and alterAddr != ''"> and alter_addr = #{alterAddr}</if> | ||
| 28 | + <if test="upName != null and upName != ''"> and up_name like concat('%', #{upName}, '%')</if> | ||
| 29 | + <if test="upInterval != null "> and up_interval = #{upInterval}</if> | ||
| 30 | + <if test="prejectType != null "> and preject_type = #{prejectType}</if> | ||
| 31 | + <if test="deviceType != null "> and device_type = #{deviceType}</if> | ||
| 32 | + </where> | ||
| 33 | + </select> | ||
| 34 | + | ||
| 35 | + <select id="selectIotLsyPlcConfigById" parameterType="Integer" resultMap="IotLsyPlcConfigResult"> | ||
| 36 | + <include refid="selectIotLsyPlcConfigVo"/> | ||
| 37 | + where id = #{id} | ||
| 38 | + </select> | ||
| 39 | + | ||
| 40 | + <insert id="insertIotLsyPlcConfig" parameterType="IotLsyPlcConfig" useGeneratedKeys="true" keyProperty="id"> | ||
| 41 | + insert into iot_lsy_plc_config | ||
| 42 | + <trim prefix="(" suffix=")" suffixOverrides=","> | ||
| 43 | + <if test="alterName != null and alterName != ''">alter_name,</if> | ||
| 44 | + <if test="alterAddr != null and alterAddr != ''">alter_addr,</if> | ||
| 45 | + <if test="upName != null and upName != ''">up_name,</if> | ||
| 46 | + <if test="upInterval != null">up_interval,</if> | ||
| 47 | + <if test="createTime != null">create_time,</if> | ||
| 48 | + <if test="prejectType != null">preject_type,</if> | ||
| 49 | + <if test="deviceType != null">device_type,</if> | ||
| 50 | + </trim> | ||
| 51 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | ||
| 52 | + <if test="alterName != null and alterName != ''">#{alterName},</if> | ||
| 53 | + <if test="alterAddr != null and alterAddr != ''">#{alterAddr},</if> | ||
| 54 | + <if test="upName != null and upName != ''">#{upName},</if> | ||
| 55 | + <if test="upInterval != null">#{upInterval},</if> | ||
| 56 | + <if test="createTime != null">#{createTime},</if> | ||
| 57 | + <if test="prejectType != null">#{prejectType},</if> | ||
| 58 | + <if test="deviceType != null">#{deviceType},</if> | ||
| 59 | + </trim> | ||
| 60 | + </insert> | ||
| 61 | + | ||
| 62 | + <update id="updateIotLsyPlcConfig" parameterType="IotLsyPlcConfig"> | ||
| 63 | + update iot_lsy_plc_config | ||
| 64 | + <trim prefix="SET" suffixOverrides=","> | ||
| 65 | + <if test="alterName != null and alterName != ''">alter_name = #{alterName},</if> | ||
| 66 | + <if test="alterAddr != null and alterAddr != ''">alter_addr = #{alterAddr},</if> | ||
| 67 | + <if test="upName != null and upName != ''">up_name = #{upName},</if> | ||
| 68 | + <if test="upInterval != null">up_interval = #{upInterval},</if> | ||
| 69 | + <if test="createTime != null">create_time = #{createTime},</if> | ||
| 70 | + <if test="prejectType != null">preject_type = #{prejectType},</if> | ||
| 71 | + <if test="deviceType != null">device_type = #{deviceType},</if> | ||
| 72 | + </trim> | ||
| 73 | + where id = #{id} | ||
| 74 | + </update> | ||
| 75 | + | ||
| 76 | + <delete id="deleteIotLsyPlcConfigById" parameterType="Integer"> | ||
| 77 | + delete from iot_lsy_plc_config where id = #{id} | ||
| 78 | + </delete> | ||
| 79 | + | ||
| 80 | + <delete id="deleteIotLsyPlcConfigByIds" parameterType="Integer"> | ||
| 81 | + delete from iot_lsy_plc_config where id in | ||
| 82 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | ||
| 83 | + #{id} | ||
| 84 | + </foreach> | ||
| 85 | + </delete> | ||
| 86 | +</mapper> |
| 1 | +package com.zhonglai.luhui.admin.controller.iot; | ||
| 2 | + | ||
| 3 | +import java.util.ArrayList; | ||
| 4 | +import java.util.List; | ||
| 5 | + | ||
| 6 | +import com.zhonglai.luhui.dao.service.PublicService; | ||
| 7 | +import com.zhonglai.luhui.datasource.enums.DataSource; | ||
| 8 | +import com.zhonglai.luhui.datasource.enums.DataSourceType; | ||
| 9 | +import javax.servlet.http.HttpServletResponse; | ||
| 10 | + | ||
| 11 | +import com.zhonglai.luhui.device.service.IIotLsyPlcConfigService; | ||
| 12 | +import com.zhonglai.luhui.device.service.impl.IotLsyPlcConfigServiceImpl; | ||
| 13 | +import io.swagger.annotations.Api; | ||
| 14 | +import io.swagger.annotations.ApiOperation; | ||
| 15 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 17 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 19 | +import org.springframework.web.bind.annotation.PutMapping; | ||
| 20 | +import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 21 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 22 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 23 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 24 | +import org.springframework.web.bind.annotation.RestController; | ||
| 25 | +import com.ruoyi.common.annotation.Log; | ||
| 26 | +import com.zhonglai.luhui.action.BaseController; | ||
| 27 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 28 | +import com.ruoyi.common.enums.BusinessType; | ||
| 29 | +import com.zhonglai.luhui.dao.service.PublicTemplateService; | ||
| 30 | +import com.zhonglai.luhui.device.domain.IotLsyPlcConfig; | ||
| 31 | +import com.zhonglai.luhui.sys.utils.ExcelUtil; | ||
| 32 | + | ||
| 33 | +import com.ruoyi.common.core.page.TableDataInfo; | ||
| 34 | + | ||
| 35 | +/** | ||
| 36 | + * 流水鱼plc通讯解析协议配置Controller | ||
| 37 | + * | ||
| 38 | + * @author zhonglai | ||
| 39 | + * @date 2025-11-10 | ||
| 40 | + */ | ||
| 41 | +@Api(tags = "流水鱼plc通讯解析协议配置") | ||
| 42 | +@RestController | ||
| 43 | +@RequestMapping("/iot/device/lsy_plc_config") | ||
| 44 | +public class IotLsyPlcConfigController extends BaseController | ||
| 45 | +{ | ||
| 46 | + @Autowired | ||
| 47 | + private IIotLsyPlcConfigService iIotLsyPlcConfigService; | ||
| 48 | + | ||
| 49 | + @Autowired | ||
| 50 | + private PublicTemplateService publicTemplateService; | ||
| 51 | + | ||
| 52 | + @Autowired | ||
| 53 | + private PublicService publicService; | ||
| 54 | + @ApiOperation(value ="查询流水鱼plc通讯解析协议配置列表",notes="\n" + | ||
| 55 | + "公共参数描述:\n" + | ||
| 56 | + "条件参数:\n" + | ||
| 57 | + "timeMap; //时间条件(如:{\"create_time\":[开始时间,结束时间]})\n" + | ||
| 58 | + "keyValue; //模糊匹配的关键字(如:[\"value\",\"name,no\"])\n" + | ||
| 59 | + "queryParams; //字段对应的比较符号(如:{\"id\":\"EQ\"})\n" + | ||
| 60 | + "orderBy; //排序(如:\"id desc,name asc\")\n" + | ||
| 61 | + "\n" + | ||
| 62 | + "分页参数:\n" + | ||
| 63 | + "pageNum; //当前记录起始索引,从1开始\n" + | ||
| 64 | + "pageSize; //每页显示记录数") | ||
| 65 | + @PreAuthorize("@ss.hasPermi('device:lsy_plc_config:list')") | ||
| 66 | + @GetMapping("/list") | ||
| 67 | + public TableDataInfo list(IotLsyPlcConfig iotLsyPlcConfig) | ||
| 68 | + { | ||
| 69 | + startPage(); | ||
| 70 | + List<IotLsyPlcConfig> list = iIotLsyPlcConfigService.selectIotLsyPlcConfigList(iotLsyPlcConfig); | ||
| 71 | + return getDataTable(list); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @ApiOperation("导出流水鱼plc通讯解析协议配置列表") | ||
| 75 | + @PreAuthorize("@ss.hasPermi('device:lsy_plc_config:export')") | ||
| 76 | + @Log(title = "流水鱼plc通讯解析协议配置", businessType = BusinessType.EXPORT) | ||
| 77 | + @PostMapping("/export") | ||
| 78 | + public void export(HttpServletResponse response, IotLsyPlcConfig iotLsyPlcConfig) | ||
| 79 | + { | ||
| 80 | + List<IotLsyPlcConfig> list = publicTemplateService.selectTList(iotLsyPlcConfig); | ||
| 81 | + ExcelUtil<IotLsyPlcConfig> util = new ExcelUtil<IotLsyPlcConfig>(IotLsyPlcConfig.class); | ||
| 82 | + util.exportExcel(response, list, "流水鱼plc通讯解析协议配置数据"); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @ApiOperation("获取流水鱼plc通讯解析协议配置详细信息") | ||
| 86 | + @PreAuthorize("@ss.hasPermi('device:lsy_plc_config:query')") | ||
| 87 | + @GetMapping(value = "/{id}") | ||
| 88 | + public AjaxResult getInfo(@PathVariable("id") Integer id) | ||
| 89 | + { | ||
| 90 | + return success(publicTemplateService.getTById(id, IotLsyPlcConfig.class)); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @ApiOperation("批量添加/修改流水鱼plc通讯解析协议配置") | ||
| 94 | + @PreAuthorize("@ss.hasPermi('device:lsy_plc_config:saveOrUpdateAll')") | ||
| 95 | + @Log(title = "流水鱼plc通讯解析协议配置", businessType = BusinessType.INSERT) | ||
| 96 | + @PostMapping | ||
| 97 | + public AjaxResult saveOrUpdateAll(@RequestBody List<IotLsyPlcConfig> iotLsyPlcConfigList) | ||
| 98 | + { | ||
| 99 | + List<Object> objectList = new ArrayList<>(iotLsyPlcConfigList); | ||
| 100 | + return toAjax(publicService.saveOrUpdateObjectList(objectList)); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @ApiOperation("修改流水鱼plc通讯解析协议配置") | ||
| 104 | + @PreAuthorize("@ss.hasPermi('device:lsy_plc_config:edit')") | ||
| 105 | + @Log(title = "流水鱼plc通讯解析协议配置", businessType = BusinessType.UPDATE) | ||
| 106 | + @PutMapping | ||
| 107 | + public AjaxResult edit(@RequestBody IotLsyPlcConfig iotLsyPlcConfig) | ||
| 108 | + { | ||
| 109 | + return toAjax(publicTemplateService.edit((iotLsyPlcConfig))); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @ApiOperation("删除流水鱼plc通讯解析协议配置") | ||
| 113 | + @PreAuthorize("@ss.hasPermi('device:lsy_plc_config:remove')") | ||
| 114 | + @Log(title = "流水鱼plc通讯解析协议配置", businessType = BusinessType.DELETE) | ||
| 115 | + @DeleteMapping("/{ids}") | ||
| 116 | + public AjaxResult remove(@PathVariable Integer[] ids) | ||
| 117 | + { | ||
| 118 | + return toAjax(iIotLsyPlcConfigService.deleteIotLsyPlcConfigByIds(ids)); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | +} |
| @@ -46,9 +46,6 @@ public class IotThingsModelTemplateController extends BaseController | @@ -46,9 +46,6 @@ public class IotThingsModelTemplateController extends BaseController | ||
| 46 | @Autowired | 46 | @Autowired |
| 47 | private IIotThingsModelTemplateService iotThingsModelTemplateService; | 47 | private IIotThingsModelTemplateService iotThingsModelTemplateService; |
| 48 | 48 | ||
| 49 | - @Autowired | ||
| 50 | - private IIotProductService iIotProductService; | ||
| 51 | - | ||
| 52 | /** | 49 | /** |
| 53 | * 查询物模型模板列表 | 50 | * 查询物模型模板列表 |
| 54 | */ | 51 | */ |
| 1 | package com.zhonglai.luhui.admin.controller.user; | 1 | package com.zhonglai.luhui.admin.controller.user; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | +import java.util.Map; | ||
| 4 | 5 | ||
| 5 | import com.ruoyi.common.utils.DESUtil; | 6 | import com.ruoyi.common.utils.DESUtil; |
| 6 | import com.ruoyi.common.utils.StringUtils; | 7 | import com.ruoyi.common.utils.StringUtils; |
| 7 | import com.zhonglai.luhui.admin.dto.AddAllUserDto; | 8 | import com.zhonglai.luhui.admin.dto.AddAllUserDto; |
| 9 | +import com.zhonglai.luhui.dao.service.PublicService; | ||
| 8 | import com.zhonglai.luhui.datasource.enums.DataSource; | 10 | import com.zhonglai.luhui.datasource.enums.DataSource; |
| 9 | import com.zhonglai.luhui.datasource.enums.DataSourceType; | 11 | import com.zhonglai.luhui.datasource.enums.DataSourceType; |
| 10 | import javax.servlet.http.HttpServletResponse; | 12 | import javax.servlet.http.HttpServletResponse; |
| 11 | 13 | ||
| 12 | import com.zhonglai.luhui.user.domain.*; | 14 | import com.zhonglai.luhui.user.domain.*; |
| 13 | -import com.zhonglai.luhui.user.service.IUserBaseInfoService; | ||
| 14 | -import com.zhonglai.luhui.user.service.IUserLoginService; | 15 | +import com.zhonglai.luhui.user.service.*; |
| 15 | import io.swagger.annotations.Api; | 16 | import io.swagger.annotations.Api; |
| 16 | import io.swagger.annotations.ApiOperation; | 17 | import io.swagger.annotations.ApiOperation; |
| 17 | import org.springframework.security.access.prepost.PreAuthorize; | 18 | import org.springframework.security.access.prepost.PreAuthorize; |
| @@ -47,8 +48,24 @@ public class UserBaseInfoController extends BaseController | @@ -47,8 +48,24 @@ public class UserBaseInfoController extends BaseController | ||
| 47 | @Autowired | 48 | @Autowired |
| 48 | private IUserBaseInfoService userBaseInfoService; | 49 | private IUserBaseInfoService userBaseInfoService; |
| 49 | @Autowired | 50 | @Autowired |
| 50 | - private PublicTemplateService publicTemplateService; | 51 | + private IUserAddressInfoService userAddressInfoService; |
| 52 | + @Autowired | ||
| 53 | + private IUserAccountInfoService userAccountInfoService; | ||
| 54 | + @Autowired | ||
| 55 | + private IUserAuthInfoService userAuthInfoService; | ||
| 56 | + @Autowired | ||
| 57 | + private IUserExtraInfoService userExtraInfoService; | ||
| 58 | + @Autowired | ||
| 59 | + private IUserLoginInfoService userLoginInfoService; | ||
| 60 | + @Autowired | ||
| 61 | + private IUserLoginService userLoginService; | ||
| 62 | + @Autowired | ||
| 63 | + private IUserOfficialInfoService userOfficialInfoService; | ||
| 64 | + @Autowired | ||
| 65 | + private IUserSocialInfoService userSocialInfoService; | ||
| 51 | 66 | ||
| 67 | + @Autowired | ||
| 68 | + private PublicService publicService; | ||
| 52 | @ApiOperation(value ="查询基础用户信息列表",notes="\n" + | 69 | @ApiOperation(value ="查询基础用户信息列表",notes="\n" + |
| 53 | "公共参数描述:\n" + | 70 | "公共参数描述:\n" + |
| 54 | "条件参数:\n" + | 71 | "条件参数:\n" + |
| @@ -118,27 +135,46 @@ public class UserBaseInfoController extends BaseController | @@ -118,27 +135,46 @@ public class UserBaseInfoController extends BaseController | ||
| 118 | @PostMapping | 135 | @PostMapping |
| 119 | public AjaxResult addAll(@RequestBody AddAllUserDto addAllUserDto) | 136 | public AjaxResult addAll(@RequestBody AddAllUserDto addAllUserDto) |
| 120 | { | 137 | { |
| 138 | + StringBuffer sql = new StringBuffer("SELECT COUNT(0) ct FROM user_base_info where 1=2"); | ||
| 121 | UserBaseInfo userBaseInfo = addAllUserDto.getUserBaseInfo(); | 139 | UserBaseInfo userBaseInfo = addAllUserDto.getUserBaseInfo(); |
| 140 | + if(StringUtils.isNotEmpty(userBaseInfo.getEmail())) | ||
| 141 | + { | ||
| 142 | + sql.append(" or email='"+userBaseInfo.getEmail()+"'"); | ||
| 143 | + } | ||
| 144 | + if(StringUtils.isNotEmpty(userBaseInfo.getPhone())) | ||
| 145 | + { | ||
| 146 | + sql.append(" or phone='"+userBaseInfo.getPhone()+"'"); | ||
| 147 | + } | ||
| 148 | + if(StringUtils.isNotEmpty(userBaseInfo.getLoginName())) | ||
| 149 | + { | ||
| 150 | + sql.append(" or login_name='"+userBaseInfo.getLoginName()+"'"); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + List<Map<String,Object>> list = publicService.getObjectListBySQL(sql.toString()); | ||
| 154 | + if(null != list && list.size() !=0 && list.get(0).get("ct") != null && Integer.parseInt(list.get(0).get("ct").toString()) > 0) | ||
| 155 | + { | ||
| 156 | + return error("用户邮箱或者手机或者登录名信息已存在"); | ||
| 157 | + } | ||
| 122 | userBaseInfoService.insertUserBaseInfo(userBaseInfo); | 158 | userBaseInfoService.insertUserBaseInfo(userBaseInfo); |
| 123 | if (null != addAllUserDto.getUserAccountInfo()) | 159 | if (null != addAllUserDto.getUserAccountInfo()) |
| 124 | { | 160 | { |
| 125 | addAllUserDto.getUserAccountInfo().setId(userBaseInfo.getId()); | 161 | addAllUserDto.getUserAccountInfo().setId(userBaseInfo.getId()); |
| 126 | - publicTemplateService.add(addAllUserDto.getUserAccountInfo()); | 162 | + userAccountInfoService.insertUserAccountInfo(addAllUserDto.getUserAccountInfo()); |
| 127 | } | 163 | } |
| 128 | if (null != addAllUserDto.getUserAddressInfo()) | 164 | if (null != addAllUserDto.getUserAddressInfo()) |
| 129 | { | 165 | { |
| 130 | addAllUserDto.getUserAddressInfo().setId(userBaseInfo.getId()); | 166 | addAllUserDto.getUserAddressInfo().setId(userBaseInfo.getId()); |
| 131 | - publicTemplateService.add(addAllUserDto.getUserAddressInfo()); | 167 | + userAddressInfoService.insertUserAddressInfo(addAllUserDto.getUserAddressInfo()); |
| 132 | } | 168 | } |
| 133 | if (null != addAllUserDto.getUserAuthInfo()) | 169 | if (null != addAllUserDto.getUserAuthInfo()) |
| 134 | { | 170 | { |
| 135 | addAllUserDto.getUserAuthInfo().setId(userBaseInfo.getId()); | 171 | addAllUserDto.getUserAuthInfo().setId(userBaseInfo.getId()); |
| 136 | - publicTemplateService.add(addAllUserDto.getUserAuthInfo()); | 172 | + userAuthInfoService.insertUserAuthInfo(addAllUserDto.getUserAuthInfo()); |
| 137 | } | 173 | } |
| 138 | if (null != addAllUserDto.getUserExtraInfo()) | 174 | if (null != addAllUserDto.getUserExtraInfo()) |
| 139 | { | 175 | { |
| 140 | addAllUserDto.getUserExtraInfo().setId(userBaseInfo.getId()); | 176 | addAllUserDto.getUserExtraInfo().setId(userBaseInfo.getId()); |
| 141 | - publicTemplateService.add(addAllUserDto.getUserExtraInfo()); | 177 | + userExtraInfoService.insertUserExtraInfo(addAllUserDto.getUserExtraInfo()); |
| 142 | } | 178 | } |
| 143 | if (null != addAllUserDto.getUserLogin() && StringUtils.isNotEmpty(addAllUserDto.getUserLogin().getLoginPass())) | 179 | if (null != addAllUserDto.getUserLogin() && StringUtils.isNotEmpty(addAllUserDto.getUserLogin().getLoginPass())) |
| 144 | { | 180 | { |
| @@ -146,22 +182,22 @@ public class UserBaseInfoController extends BaseController | @@ -146,22 +182,22 @@ public class UserBaseInfoController extends BaseController | ||
| 146 | String userLoginPassKey = DESUtil.randomString(9); | 182 | String userLoginPassKey = DESUtil.randomString(9); |
| 147 | addAllUserDto.getUserLogin().setLoginPass(DESUtil.encode(addAllUserDto.getUserLogin().getLoginPass(), userLoginPassKey)); | 183 | addAllUserDto.getUserLogin().setLoginPass(DESUtil.encode(addAllUserDto.getUserLogin().getLoginPass(), userLoginPassKey)); |
| 148 | addAllUserDto.getUserLogin().setUserLoginPassKey(userLoginPassKey); | 184 | addAllUserDto.getUserLogin().setUserLoginPassKey(userLoginPassKey); |
| 149 | - publicTemplateService.add(addAllUserDto.getUserLogin()); | 185 | + userLoginService.insertUserLogin(addAllUserDto.getUserLogin()); |
| 150 | } | 186 | } |
| 151 | if (null != addAllUserDto.getUserLoginInfo()) | 187 | if (null != addAllUserDto.getUserLoginInfo()) |
| 152 | { | 188 | { |
| 153 | addAllUserDto.getUserLoginInfo().setId(userBaseInfo.getId()); | 189 | addAllUserDto.getUserLoginInfo().setId(userBaseInfo.getId()); |
| 154 | - publicTemplateService.add(addAllUserDto.getUserLoginInfo()); | 190 | + userLoginInfoService.insertUserLoginInfo(addAllUserDto.getUserLoginInfo()); |
| 155 | } | 191 | } |
| 156 | if (null != addAllUserDto.getUserOfficialInfo()) | 192 | if (null != addAllUserDto.getUserOfficialInfo()) |
| 157 | { | 193 | { |
| 158 | addAllUserDto.getUserOfficialInfo().setId(userBaseInfo.getId()); | 194 | addAllUserDto.getUserOfficialInfo().setId(userBaseInfo.getId()); |
| 159 | - publicTemplateService.add(addAllUserDto.getUserOfficialInfo()); | 195 | + userOfficialInfoService.insertUserOfficialInfo(addAllUserDto.getUserOfficialInfo()); |
| 160 | } | 196 | } |
| 161 | if (null != addAllUserDto.getUserSocialInfo()) | 197 | if (null != addAllUserDto.getUserSocialInfo()) |
| 162 | { | 198 | { |
| 163 | addAllUserDto.getUserSocialInfo().setId(userBaseInfo.getId()); | 199 | addAllUserDto.getUserSocialInfo().setId(userBaseInfo.getId()); |
| 164 | - publicTemplateService.add(addAllUserDto.getUserSocialInfo()); | 200 | + userSocialInfoService.insertUserSocialInfo(addAllUserDto.getUserSocialInfo()); |
| 165 | } | 201 | } |
| 166 | return AjaxResult.success(addAllUserDto); | 202 | return AjaxResult.success(addAllUserDto); |
| 167 | } | 203 | } |
| 1 | +1. 修改 SSH 配置文件 | ||
| 2 | + | ||
| 3 | +打开配置文件: | ||
| 4 | + | ||
| 5 | +sudo nano /etc/ssh/sshd_config | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +找到以下这一行(可能被注释掉了): | ||
| 9 | + | ||
| 10 | +#PermitRootLogin prohibit-password | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +将其修改为: | ||
| 14 | + | ||
| 15 | +PermitRootLogin yes | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +如果你只想允许 root 用密钥登录,使用: | ||
| 19 | + | ||
| 20 | +PermitRootLogin without-password | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +或新版中等价于: | ||
| 24 | + | ||
| 25 | +PermitRootLogin prohibit-password | ||
| 26 | + | ||
| 27 | +2. 设置 root 密码(如果还没有) | ||
| 28 | +sudo passwd root | ||
| 29 | + | ||
| 30 | +3. 重启 SSH 服务 | ||
| 31 | +sudo systemctl restart ssh | ||
| 32 | + | ||
| 33 | +4. 测试远程登录 | ||
| 34 | + | ||
| 35 | +使用 SSH 客户端登录: | ||
| 36 | + | ||
| 37 | +ssh root@your.debian.ip |
| 1 | +#配置网络自动获取 | ||
| 2 | +# 立即验证脚本是否是 Windows 格式,如果出现:CRLF 就是这个问题。 | ||
| 3 | +file setup_network.sh | ||
| 4 | +# 修复方法,安装 dos2unix:: | ||
| 5 | +apt install dos2unix | ||
| 6 | +dos2unix setup_network.sh | ||
| 7 | +# 最后再次执行:如果是root用户需要删除脚本里面sudo | ||
| 8 | +./setup_network.sh | ||
| 9 | + | ||
| 10 | +# 安装1panel | ||
| 11 | +./安装1panel.sh | ||
| 12 | + | ||
| 13 | +# 开机启动ip获取 | ||
| 14 | +chmod +x /root/lh-device-modbus-terminal/bin/write-ip.sh | ||
| 15 | +cp bin/write_ip.service /etc/systemd/system/write_ip.service | ||
| 16 | +systemctl daemon-reload | ||
| 17 | +systemctl enable write_ip.service # 开机自启 | ||
| 18 | +systemctl start write_ip.service # 立即执行 | ||
| 19 | +systemctl status write_ip.service # 查看状态 | ||
| 20 | + | ||
| 21 | +# 创建自定义网络 | ||
| 22 | +docker network create lh-net | ||
| 23 | + | ||
| 24 | +# 安装ZLMediaKit | ||
| 25 | +# 你的镜像文件是 zlmediakit.tar,用以下命令导入: | ||
| 26 | +docker load -i zlmediakit.tar | ||
| 27 | +# 导入后可以查看镜像名: | ||
| 28 | +docker images | ||
| 29 | +# 创建宿主机挂载目录 | ||
| 30 | +mkdir -p /root/lh-device-modbus-terminal/zlmediakit_config | ||
| 31 | +# 启动 ZLMediaKit 容器 + 挂载配置目录 | ||
| 32 | +docker run -d --name zlmediakit --network lh-net --restart always -p 1935:1935 -p 80:80 -p 443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -v /root/lh-device-modbus-terminal/zlmediakit_config:/opt/media/conf 913391c90121 | ||
| 33 | + | ||
| 34 | +# 安装LH设备MODBUS终端 | ||
| 35 | +docker load -i lh-device-modbus-terminal.tar | ||
| 36 | +docker images | ||
| 37 | +docker run -d --name lh-device-modbus-terminal --network lh-net --restart on-failure:5 -e TZ=Asia/Shanghai -v /root/lh-device-modbus-terminal:/app 74a802bd9e47 bash -c "cd /app && java -jar lh-device-modbus-terminal.jar /app/configs" |
| @@ -41,15 +41,20 @@ public class Main { | @@ -41,15 +41,20 @@ public class Main { | ||
| 41 | } | 41 | } |
| 42 | Map<String, List<PlcSystem>> plcsMap = InitPlcConfig.initPlcConfigFromFile(jsonPath); | 42 | Map<String, List<PlcSystem>> plcsMap = InitPlcConfig.initPlcConfigFromFile(jsonPath); |
| 43 | 43 | ||
| 44 | + if(null != plcsMap && plcsMap.size()>0) | ||
| 45 | + { | ||
| 46 | + CollectPlcDataTask collectPlcDataTask = new CollectPlcDataTask(); | ||
| 47 | + collectPlcDataTask.collect(mqttService); | ||
| 48 | + }else { | ||
| 49 | + log.warn("找不到plc配置不执行plc逻辑"); | ||
| 50 | + } | ||
| 51 | + | ||
| 44 | String camerapath = Main.class.getClassLoader().getResource("configs/camera.properties").getPath();; | 52 | String camerapath = Main.class.getClassLoader().getResource("configs/camera.properties").getPath();; |
| 45 | if (null != configPath) | 53 | if (null != configPath) |
| 46 | { | 54 | { |
| 47 | camerapath = configPath+"/camera.properties"; | 55 | camerapath = configPath+"/camera.properties"; |
| 48 | } | 56 | } |
| 49 | - CameraConfig.init(camerapath,plcsMap.get("cameras")); | ||
| 50 | - | ||
| 51 | - CollectPlcDataTask collectPlcDataTask = new CollectPlcDataTask(); | ||
| 52 | - collectPlcDataTask.collect(mqttService); | 57 | + CameraConfig.init(camerapath); |
| 53 | 58 | ||
| 54 | CameraDataTask cameraDataTask = new CameraDataTask(); | 59 | CameraDataTask cameraDataTask = new CameraDataTask(); |
| 55 | cameraDataTask.collect(mqttService); | 60 | cameraDataTask.collect(mqttService); |
| @@ -7,6 +7,7 @@ import java.util.regex.Matcher; | @@ -7,6 +7,7 @@ import java.util.regex.Matcher; | ||
| 7 | import java.util.regex.Pattern; | 7 | import java.util.regex.Pattern; |
| 8 | import cn.hutool.http.HttpUtil; | 8 | import cn.hutool.http.HttpUtil; |
| 9 | import com.alibaba.fastjson.JSON; | 9 | import com.alibaba.fastjson.JSON; |
| 10 | +import com.alibaba.fastjson.JSONArray; | ||
| 10 | import com.alibaba.fastjson.JSONObject; | 11 | import com.alibaba.fastjson.JSONObject; |
| 11 | import com.zhonglai.luhui.device.modbus.terminal.camera.Camera; | 12 | import com.zhonglai.luhui.device.modbus.terminal.camera.Camera; |
| 12 | import com.zhonglai.luhui.device.modbus.terminal.camera.WebRtcService; | 13 | import com.zhonglai.luhui.device.modbus.terminal.camera.WebRtcService; |
| @@ -47,7 +48,7 @@ public class CameraConfig { | @@ -47,7 +48,7 @@ public class CameraConfig { | ||
| 47 | 48 | ||
| 48 | public static final List<Camera> cameraList = new ArrayList<>(); | 49 | public static final List<Camera> cameraList = new ArrayList<>(); |
| 49 | 50 | ||
| 50 | - public static void init(String configPath, List<PlcSystem> list) { | 51 | + public static void init(String configPath) { |
| 51 | Properties properties = loadProperties(configPath); | 52 | Properties properties = loadProperties(configPath); |
| 52 | 53 | ||
| 53 | yuerleApiUrl = properties.getProperty("yuerleApiUrl"); | 54 | yuerleApiUrl = properties.getProperty("yuerleApiUrl"); |
| @@ -56,9 +57,10 @@ public class CameraConfig { | @@ -56,9 +57,10 @@ public class CameraConfig { | ||
| 56 | webrtcSecret = StringUtils.defaultIfBlank(properties.getProperty("webrtcSecret"), getWebrtcSecret()); | 57 | webrtcSecret = StringUtils.defaultIfBlank(properties.getProperty("webrtcSecret"), getWebrtcSecret()); |
| 57 | 58 | ||
| 58 | localIp = Optional.ofNullable(getLocalIp()).orElseGet(CameraConfig::getLocalIpAddress); | 59 | localIp = Optional.ofNullable(getLocalIp()).orElseGet(CameraConfig::getLocalIpAddress); |
| 59 | - | ||
| 60 | - if (WebRtcService.isWebrtcOnline()) | 60 | + String cameras = properties.getProperty("cameras"); |
| 61 | + if (WebRtcService.isWebrtcOnline() && StringUtils.isNotEmpty(cameras)) | ||
| 61 | { | 62 | { |
| 63 | + List<PlcSystem> list = JSONArray.parseArray(cameras,PlcSystem.class); | ||
| 62 | addCamera(list); | 64 | addCamera(list); |
| 63 | } | 65 | } |
| 64 | } | 66 | } |
| @@ -24,10 +24,19 @@ public class InitPlcConfig { | @@ -24,10 +24,19 @@ public class InitPlcConfig { | ||
| 24 | * @throws IOException | 24 | * @throws IOException |
| 25 | */ | 25 | */ |
| 26 | public static Map<String, List<PlcSystem>> initPlcConfigFromFile(String jsonPath) throws IOException { | 26 | public static Map<String, List<PlcSystem>> initPlcConfigFromFile(String jsonPath) throws IOException { |
| 27 | + File configFile = new File(jsonPath); | ||
| 28 | + if (!configFile.exists()) | ||
| 29 | + { | ||
| 30 | + return null; | ||
| 31 | + } | ||
| 27 | ObjectMapper mapper = new ObjectMapper(); | 32 | ObjectMapper mapper = new ObjectMapper(); |
| 28 | - Map<String, List<PlcSystem>> plcsMap = mapper.readValue(new File(jsonPath), | 33 | + Map<String, List<PlcSystem>> plcsMap = mapper.readValue(configFile, |
| 29 | new TypeReference<Map<String, List<PlcSystem>>>() {}); | 34 | new TypeReference<Map<String, List<PlcSystem>>>() {}); |
| 30 | List<PlcSystem> plcSystems = plcsMap.get("plcs"); | 35 | List<PlcSystem> plcSystems = plcsMap.get("plcs"); |
| 36 | + if (plcSystems == null || plcSystems.size() == 0) | ||
| 37 | + { | ||
| 38 | + return null; | ||
| 39 | + } | ||
| 31 | for (PlcSystem plc : plcSystems) | 40 | for (PlcSystem plc : plcSystems) |
| 32 | { | 41 | { |
| 33 | CachPlcConfig cachPlcConfig = plcsConfigMap.get(plc.getId()); | 42 | CachPlcConfig cachPlcConfig = plcsConfigMap.get(plc.getId()); |
| @@ -89,9 +89,16 @@ public class ModbusMasterMessage { | @@ -89,9 +89,16 @@ public class ModbusMasterMessage { | ||
| 89 | * 关闭所有 Master | 89 | * 关闭所有 Master |
| 90 | */ | 90 | */ |
| 91 | public static void closeAll() { | 91 | public static void closeAll() { |
| 92 | - masterCache.values().forEach(ModbusMaster::destroy); | ||
| 93 | - masterCache.clear(); | ||
| 94 | - lockMap.clear(); | 92 | + if(null != masterCache) |
| 93 | + { | ||
| 94 | + masterCache.values().forEach(ModbusMaster::destroy); | ||
| 95 | + masterCache.clear(); | ||
| 96 | + } | ||
| 97 | + if (null != lockMap) | ||
| 98 | + { | ||
| 99 | + lockMap.clear(); | ||
| 100 | + } | ||
| 101 | + | ||
| 95 | } | 102 | } |
| 96 | } | 103 | } |
| 97 | 104 |
| @@ -32,9 +32,12 @@ public class CameraDataTask { | @@ -32,9 +32,12 @@ public class CameraDataTask { | ||
| 32 | public void collect(MqttService mqttService) { | 32 | public void collect(MqttService mqttService) { |
| 33 | ScheduledThreadPool.scheduler.scheduleAtFixedRate(() -> { | 33 | ScheduledThreadPool.scheduler.scheduleAtFixedRate(() -> { |
| 34 | try { | 34 | try { |
| 35 | - if (WebRtcService.isWebrtcOnline()) | 35 | + boolean isWebrtcOnline = WebRtcService.isWebrtcOnline(); |
| 36 | + if (isWebrtcOnline) | ||
| 36 | { | 37 | { |
| 37 | pubMqttData(mqttService); | 38 | pubMqttData(mqttService); |
| 39 | + }else { | ||
| 40 | + logger.info("webrtc服务未启动"); | ||
| 38 | } | 41 | } |
| 39 | 42 | ||
| 40 | }catch (Exception e) | 43 | }catch (Exception e) |
| 1 | +; auto-generated by mINI class { | ||
| 2 | + | ||
| 3 | +[api] | ||
| 4 | +apiDebug=1 | ||
| 5 | +defaultSnap=./www/logo.png | ||
| 6 | +downloadRoot=./www | ||
| 7 | +secret=nkgs0WLCCZsmQU50hpMi7ibtFEJEq3bF | ||
| 8 | +snapRoot=./www/snap/ | ||
| 9 | + | ||
| 10 | +[cluster] | ||
| 11 | +origin_url= | ||
| 12 | +retry_count=3 | ||
| 13 | +timeout_sec=15 | ||
| 14 | + | ||
| 15 | +[ffmpeg] | ||
| 16 | +bin=/usr/bin/ffmpeg | ||
| 17 | +cmd=%s -re -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s | ||
| 18 | +log=./ffmpeg/ffmpeg.log | ||
| 19 | +restart_sec=0 | ||
| 20 | +snap=%s -i %s -y -f mjpeg -frames:v 1 -an %s | ||
| 21 | + | ||
| 22 | +[general] | ||
| 23 | +broadcast_player_count_changed=0 | ||
| 24 | +check_nvidia_dev=1 | ||
| 25 | +enableVhost=0 | ||
| 26 | +enable_ffmpeg_log=0 | ||
| 27 | +flowThreshold=1024 | ||
| 28 | +listen_ip=:: | ||
| 29 | +maxStreamWaitMS=15000 | ||
| 30 | +mediaServerId=your_server_id | ||
| 31 | +mergeWriteMS=0 | ||
| 32 | +resetWhenRePlay=1 | ||
| 33 | +streamNoneReaderDelayMS=20000 | ||
| 34 | +unready_frame_cache=100 | ||
| 35 | +wait_add_track_ms=3000 | ||
| 36 | +wait_audio_track_data_ms=1000 | ||
| 37 | +wait_track_ready_ms=10000 | ||
| 38 | + | ||
| 39 | +[hls] | ||
| 40 | +broadcastRecordTs=0 | ||
| 41 | +deleteDelaySec=10 | ||
| 42 | +fastRegister=0 | ||
| 43 | +fileBufSize=65536 | ||
| 44 | +segDelay=0 | ||
| 45 | +segDur=2 | ||
| 46 | +segKeep=0 | ||
| 47 | +segNum=3 | ||
| 48 | +segRetain=5 | ||
| 49 | + | ||
| 50 | +[hook] | ||
| 51 | +alive_interval=10.0 | ||
| 52 | +enable=0 | ||
| 53 | +on_flow_report= | ||
| 54 | +on_http_access= | ||
| 55 | +on_play= | ||
| 56 | +on_publish= | ||
| 57 | +on_record_mp4= | ||
| 58 | +on_record_ts= | ||
| 59 | +on_rtp_server_timeout= | ||
| 60 | +on_rtsp_auth= | ||
| 61 | +on_rtsp_realm= | ||
| 62 | +on_send_rtp_stopped= | ||
| 63 | +on_server_exited= | ||
| 64 | +on_server_keepalive= | ||
| 65 | +on_server_started= | ||
| 66 | +on_shell_login= | ||
| 67 | +on_stream_changed= | ||
| 68 | +on_stream_none_reader= | ||
| 69 | +on_stream_not_found= | ||
| 70 | +retry=1 | ||
| 71 | +retry_delay=3.0 | ||
| 72 | +stream_changed_schemas=rtsp/rtmp/fmp4/ts/hls/hls.fmp4 | ||
| 73 | +timeoutSec=10 | ||
| 74 | + | ||
| 75 | +[http] | ||
| 76 | +allow_cross_domains=1 | ||
| 77 | +allow_ip_range=::1,127.0.0.1,172.16.0.0-172.31.255.255,192.168.0.0-192.168.255.255,10.0.0.0-10.255.255.255 | ||
| 78 | +charSet=utf-8 | ||
| 79 | +dirMenu=1 | ||
| 80 | +forbidCacheSuffix= | ||
| 81 | +forwarded_ip_header= | ||
| 82 | +keepAliveSecond=30 | ||
| 83 | +maxReqSize=40960 | ||
| 84 | +notFound=<html><head><title>404 Not Found</title></head><body bgcolor="white"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit(git hash:7b1f8fe/2025-05-02T16:23:25+08:00,branch:master,build time:2025-05-02T08:24:31)</center></body></html> | ||
| 85 | +port=80 | ||
| 86 | +rootPath=./www | ||
| 87 | +sendBufSize=65536 | ||
| 88 | +sslport=443 | ||
| 89 | +virtualPath= | ||
| 90 | + | ||
| 91 | +[multicast] | ||
| 92 | +addrMax=239.255.255.255 | ||
| 93 | +addrMin=239.0.0.0 | ||
| 94 | +udpTTL=64 | ||
| 95 | + | ||
| 96 | +[protocol] | ||
| 97 | +add_mute_audio=1 | ||
| 98 | +auto_close=0 | ||
| 99 | +continue_push_ms=15000 | ||
| 100 | +enable_audio=1 | ||
| 101 | +enable_fmp4=1 | ||
| 102 | +enable_hls=1 | ||
| 103 | +enable_hls_fmp4=0 | ||
| 104 | +enable_mp4=0 | ||
| 105 | +enable_rtmp=1 | ||
| 106 | +enable_rtsp=1 | ||
| 107 | +enable_ts=1 | ||
| 108 | +fmp4_demand=0 | ||
| 109 | +hls_demand=0 | ||
| 110 | +hls_save_path=./www | ||
| 111 | +modify_stamp=2 | ||
| 112 | +mp4_as_player=0 | ||
| 113 | +mp4_max_second=3600 | ||
| 114 | +mp4_save_path=./www | ||
| 115 | +paced_sender_ms=0 | ||
| 116 | +rtmp_demand=0 | ||
| 117 | +rtsp_demand=0 | ||
| 118 | +ts_demand=0 | ||
| 119 | + | ||
| 120 | +[record] | ||
| 121 | +appName=record | ||
| 122 | +enableFmp4=0 | ||
| 123 | +fastStart=0 | ||
| 124 | +fileBufSize=65536 | ||
| 125 | +fileRepeat=0 | ||
| 126 | +sampleMS=500 | ||
| 127 | + | ||
| 128 | +[rtc] | ||
| 129 | +bfilter=0 | ||
| 130 | +datachannel_echo=1 | ||
| 131 | +externIP= | ||
| 132 | +maxRtpCacheMS=5000 | ||
| 133 | +maxRtpCacheSize=2048 | ||
| 134 | +max_bitrate=0 | ||
| 135 | +min_bitrate=0 | ||
| 136 | +nackIntervalRatio=1.0 | ||
| 137 | +nackMaxCount=15 | ||
| 138 | +nackMaxMS=3000 | ||
| 139 | +nackMaxSize=2048 | ||
| 140 | +nackRtpSize=8 | ||
| 141 | +port=8000 | ||
| 142 | +preferredCodecA=PCMA,PCMU,opus,mpeg4-generic | ||
| 143 | +preferredCodecV=H264,H265,AV1,VP9,VP8 | ||
| 144 | +rembBitRate=0 | ||
| 145 | +start_bitrate=0 | ||
| 146 | +tcpPort=8000 | ||
| 147 | +timeoutSec=15 | ||
| 148 | + | ||
| 149 | +[rtmp] | ||
| 150 | +directProxy=1 | ||
| 151 | +enhanced=0 | ||
| 152 | +handshakeSecond=15 | ||
| 153 | +keepAliveSecond=15 | ||
| 154 | +port=1935 | ||
| 155 | +sslport=0 | ||
| 156 | + | ||
| 157 | +[rtp] | ||
| 158 | +audioMtuSize=600 | ||
| 159 | +h264_stap_a=1 | ||
| 160 | +lowLatency=0 | ||
| 161 | +rtpMaxSize=10 | ||
| 162 | +videoMtuSize=1400 | ||
| 163 | + | ||
| 164 | +[rtp_proxy] | ||
| 165 | +dumpDir= | ||
| 166 | +gop_cache=1 | ||
| 167 | +h264_pt=98 | ||
| 168 | +h265_pt=99 | ||
| 169 | +opus_pt=100 | ||
| 170 | +port=10000 | ||
| 171 | +port_range=30000-35000 | ||
| 172 | +ps_pt=96 | ||
| 173 | +rtp_g711_dur_ms=100 | ||
| 174 | +timeoutSec=15 | ||
| 175 | +udp_recv_socket_buffer=4194304 | ||
| 176 | + | ||
| 177 | +[rtsp] | ||
| 178 | +authBasic=0 | ||
| 179 | +directProxy=1 | ||
| 180 | +handshakeSecond=15 | ||
| 181 | +keepAliveSecond=15 | ||
| 182 | +lowLatency=0 | ||
| 183 | +port=554 | ||
| 184 | +rtpTransportType=-1 | ||
| 185 | +sslport=0 | ||
| 186 | + | ||
| 187 | +[shell] | ||
| 188 | +maxReqSize=1024 | ||
| 189 | +port=0 | ||
| 190 | + | ||
| 191 | +[srt] | ||
| 192 | +latencyMul=4 | ||
| 193 | +passPhrase= | ||
| 194 | +pktBufSize=8192 | ||
| 195 | +port=9000 | ||
| 196 | +timeoutSec=5 | ||
| 197 | + | ||
| 198 | +; } --- |
-
请 注册 或 登录 后发表评论