Browse Source

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

jz.kai 5 years ago
parent
commit
a77f78835f

+ 1 - 0
common/src/main/java/com/jpsoft/smart/modules/base/dao/PersonDeviceRelationDAO.java

@@ -15,5 +15,6 @@ public interface PersonDeviceRelationDAO {
 	int delete(String id);
 	List<PersonDeviceRelation> list();
 	List<PersonDeviceRelation> findByPersonId(String personId);
+    List<PersonDeviceRelation> findByDeviceId(String eviceId);
 	List<PersonDeviceRelation> search(Map<String, Object> searchParams, List<Sort> sortList);
 }

+ 19 - 0
common/src/main/java/com/jpsoft/smart/modules/base/entity/DeviceInfo.java

@@ -91,6 +91,14 @@ public class DeviceInfo {
 	 */
 	@ApiModelProperty(value = "类型")
 	private String typeN;
+	/**
+	 *是否开启自动更新
+	 */
+	@ApiModelProperty(value = "是否开启自动更新")
+	private Boolean isAutoUpdate;
+
+	@ApiModelProperty(value = "是否开启自动更新")
+	private String isAutoUpdateN;
 	/**
 	 *是否删除
 	 */
@@ -132,4 +140,15 @@ public class DeviceInfo {
 		return isOnlineN;
 	}
 
+	public String getIsAutoUpdateN() {
+		if(isAutoUpdate!=null) {
+			if (isAutoUpdate) {
+				isAutoUpdateN = "是";
+			} else {
+				isAutoUpdateN = "否";
+			}
+		}
+		return isAutoUpdateN;
+	}
+
 }

+ 1 - 0
common/src/main/java/com/jpsoft/smart/modules/base/service/PersonDeviceRelationService.java

@@ -14,5 +14,6 @@ public interface PersonDeviceRelationService {
 	int delete(String id);
 	List<PersonDeviceRelation> list();
 	List<PersonDeviceRelation> findByPersonId(String personId);
+	List<PersonDeviceRelation> findByDeviceId(String deviceId);
 	Page<PersonDeviceRelation> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize,boolean count, List<Sort> sortList);
 }

+ 7 - 0
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceRelationServiceImpl.java

@@ -63,6 +63,13 @@ public class PersonDeviceRelationServiceImpl implements PersonDeviceRelationServ
 	public List<PersonDeviceRelation> findByPersonId(String personId){
 		return personDeviceRelationDAO.findByPersonId(personId);
 	}
+
+	@Override
+	public List<PersonDeviceRelation> findByDeviceId(String deviceId){
+		return personDeviceRelationDAO.findByDeviceId(deviceId);
+	}
+
+
 		
 	@Override
 	public Page<PersonDeviceRelation> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {

+ 5 - 1
common/src/main/java/com/jpsoft/smart/modules/sys/dao/DataDictionaryDAO.java

@@ -18,7 +18,11 @@ public interface DataDictionaryDAO {
 	String getName(String id);
 	String getValue(String id);
 	List<DataDictionary> list();
-	List<Map<String, Object>> queryChildren(String parentId);
 	String findParentId(String parentId,String value);
+	List<Map<String, Object>> queryChildren(String parentId);
 	List<DataDictionary> search(Map<String, Object> searchParams, List<Sort> sortList);
+
+	List<DataDictionary> findByCatalogName(String catalogName);
+
+	String findNameByCatalogNameAndValue(String catalogName,String value);
 }

+ 3 - 1
common/src/main/java/com/jpsoft/smart/modules/sys/service/DataDictionaryService.java

@@ -1,8 +1,8 @@
 package com.jpsoft.smart.modules.sys.service;
 
 import com.github.pagehelper.Page;
-import com.jpsoft.smart.modules.common.dto.Sort;
 import com.jpsoft.smart.modules.sys.entity.DataDictionary;
+import com.jpsoft.smart.modules.common.dto.Sort;
 
 import java.util.List;
 import java.util.Map;
@@ -19,4 +19,6 @@ public interface DataDictionaryService {
 	String findParentId(String parentId,String value);
 	List<Map<String, Object>> queryChildren(String parentId);
 	Page<DataDictionary> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, List<Sort> sortList);
+	List<DataDictionary> findByCatalogName(String catalogName);
+	String findNameByCatalogNameAndValue(String catalogName,String value);
 }

+ 30 - 15
common/src/main/java/com/jpsoft/smart/modules/sys/service/impl/DataDictionaryServiceImpl.java

@@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -29,14 +30,14 @@ public class DataDictionaryServiceImpl implements DataDictionaryService {
 	public int insert(DataDictionary model) {
 		// TODO Auto-generated method stub
 		//model.setId(UUID.randomUUID().toString());
-		
+
 		return dataDictionaryDAO.insert(model);
 	}
 
 	@Override
 	public int update(DataDictionary model) {
 		// TODO Auto-generated method stub
-		return dataDictionaryDAO.update(model);		
+		return dataDictionaryDAO.update(model);
 	}
 
 	@Override
@@ -49,7 +50,7 @@ public class DataDictionaryServiceImpl implements DataDictionaryService {
 	public boolean exist(String id) {
 		// TODO Auto-generated method stub
 		int count = dataDictionaryDAO.exist(id);
-		
+
 		return count > 0 ? true : false;
 	}
 
@@ -61,29 +62,43 @@ public class DataDictionaryServiceImpl implements DataDictionaryService {
 	public String getValue(String id){
 		return dataDictionaryDAO.getValue(id);
 	}
-	
-	@Override
-	public List<DataDictionary> list() {
-		// TODO Auto-generated method stub
-		return dataDictionaryDAO.list();
-	}
 
 	@Override
 	public String findParentId(String parentId,String value){
 		return dataDictionaryDAO.findParentId(parentId,value);
 	}
 
+	@Override
+	public List<DataDictionary> list() {
+		// TODO Auto-generated method stub
+		return dataDictionaryDAO.list();
+	}
+
 	@Override
 	public List<Map<String, Object>> queryChildren(String parentId){
 		return dataDictionaryDAO.queryChildren(parentId);
 	}
-		
+
 	@Override
 	public Page<DataDictionary> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,List<Sort> sortList) {
-        Page<DataDictionary> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
-            dataDictionaryDAO.search(searchParams,sortList);
-        });
-        
-        return page;
+		Page<DataDictionary> page = PageHelper.startPage(pageNumber,pageSize).doSelectPage(()->{
+			dataDictionaryDAO.search(searchParams,sortList);
+		});
+
+		return page;
+	}
+
+	@Override
+	public List<DataDictionary> findByCatalogName(String catalogName) {
+		return dataDictionaryDAO.findByCatalogName(catalogName);
+	}
+
+	@Override
+	public String findNameByCatalogNameAndValue(String catalogName,String value) {
+//		Map<String,Object> map = new HashMap<>();
+//		map.put("catalogName",catalogName);
+//		map.put("value",value);
+
+		return dataDictionaryDAO.findNameByCatalogNameAndValue(catalogName,value);
 	}
 }

+ 7 - 2
common/src/main/resources/mapper/base/DeviceInfo.xml

@@ -15,6 +15,7 @@
 			<result property="ipAddress" column="ip_address" />
 			<result property="port" column="port_" />
 			<result property="type" column="type_" />
+			<result property="isAutoUpdate" column="is_auto_update" />
 			<result property="delFlag" column="del_flag" />
 			<result property="createBy" column="create_by" />
 			<result property="createTime" column="create_time" />
@@ -29,7 +30,7 @@
 	-->
 	<![CDATA[
 		insert into base_device_info
-	    (id_,header_,device_no,alias_name,address_,is_online,unlock_password,code_address,ip_address,port_,type_,del_flag,create_by,create_time,update_by,update_time)
+	    (id_,header_,device_no,alias_name,address_,is_online,unlock_password,code_address,ip_address,port_,type_,is_auto_update,del_flag,create_by,create_time,update_by,update_time)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -43,6 +44,7 @@
 ,#{ipAddress,jdbcType=VARCHAR}
 ,#{port,jdbcType=VARCHAR}
 ,#{type,jdbcType=VARCHAR}
+,#{isAutoUpdate,jdbcType=NUMERIC}
 ,#{delFlag,jdbcType= NUMERIC }
 ,#{createBy,jdbcType=VARCHAR}
 ,#{createTime,jdbcType= TIMESTAMP }
@@ -87,6 +89,9 @@
 				<if test="type!=null">
 		type_=#{type,jdbcType=VARCHAR},
 		</if>
+			<if test="isAutoUpdate!=null">
+				is_auto_update=#{isAutoUpdate,jdbcType= NUMERIC },
+			</if>
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
@@ -107,7 +112,7 @@
 	</update>
 	<select id="get" parameterType="string" resultMap="DeviceInfoMap">
 		select 
-id_, header_,device_no,alias_name,address_,is_online,unlock_password,code_address,ip_address,port_,type_,del_flag,create_by,create_time,update_by,update_time		from base_device_info where id_=#{0}
+id_, header_,device_no,alias_name,address_,is_online,unlock_password,code_address,ip_address,port_,type_,is_auto_update,del_flag,create_by,create_time,update_by,update_time		from base_device_info where id_=#{0}
 	</select>
 	<select id="exist" parameterType="string" resultType="int">
 		select count(*) from base_device_info where id_=#{0} and  del_flag=false

+ 3 - 0
common/src/main/resources/mapper/base/PersonDeviceRelation.xml

@@ -82,6 +82,9 @@ id_,device_id,person_id,del_flag,create_by,create_time,update_by,update_time		fr
 	<select id="findByPersonId" parameterType="string" resultMap="PersonDeviceRelationMap">
 		select * from base_person_device_relation where person_id=#{personId} and del_flag=false
 	</select>
+	<select id="findByDeviceId" parameterType="string" resultMap="PersonDeviceRelationMap">
+		select * from base_person_device_relation where device_id=#{deviceId} and del_flag=false
+	</select>
 	<select id="search" parameterType="hashmap" resultMap="PersonDeviceRelationMap">
 		<![CDATA[
 			select * from base_person_device_relation

+ 16 - 0
common/src/main/resources/mapper/sys/DataDictionary.xml

@@ -158,4 +158,20 @@
         from sys_data_dictionary a
         where a.id_=#{0} and a.del_flag = 0
     </select>
+    <select id="findByCatalogName" resultMap="DataDictionaryMap">
+        select a.*
+        from sys_data_dictionary a,sys_data_dictionary b
+        where a.parent_id =b.id_ and b.name_=#{0}
+        and a.del_flag = 0
+        order by a.sort_no asc
+    </select>
+    <select id="findNameByCatalogNameAndValue" parameterType="map" resultType="string">
+        select a.name_
+        from sys_data_dictionary a,sys_data_dictionary b
+        where a.parent_id =b.id_ and b.name_=#{catalogName}
+        and a.del_flag = 0
+        and a.value_=#{value}
+        order by a.sort_no asc
+        limit 1
+    </select>
 </mapper>

+ 23 - 0
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonDeviceRelationController.java

@@ -238,4 +238,27 @@ public class PersonDeviceRelationController {
 
         return msgResult;
     }
+
+
+
+    @ApiOperation(value="根据设备ID查询人员列表")
+    @RequestMapping(value = "listByDeviceId",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "deviceId",value = "设备ID",paramType = "query")
+    })
+    public MessageResult<List<PersonDeviceRelation>> listByDeviceId(String deviceId){
+
+        MessageResult<List<PersonDeviceRelation>> msgResult = new MessageResult<>();
+
+        List<PersonDeviceRelation> personDeviceRelationList = personDeviceRelationService.findByDeviceId(deviceId);
+
+        msgResult.setResult(true);
+        msgResult.setData(personDeviceRelationList);
+
+        return msgResult;
+    }
+
+
+
+
 }

+ 25 - 0
web/src/main/java/com/jpsoft/smart/modules/sys/controller/DataDictionaryController.java

@@ -7,6 +7,8 @@ import com.jpsoft.smart.modules.common.utils.PojoUtils;
 import com.jpsoft.smart.modules.sys.entity.DataDictionary;
 import com.jpsoft.smart.modules.sys.service.DataDictionaryService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -281,4 +283,27 @@ public class DataDictionaryController {
         msgResult.setData(dataDictionaryList);
         return msgResult;
     }
+
+    @PostMapping("findByCatalogName")
+    @ApiOperation(value = "根据目录名称查询数据列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "catalogName",value = "数据目录名称", required = true, paramType = "form",dataType = "String"),
+    })
+    public MessageResult<List> findByCatalogName(String catalogName){
+        MessageResult<List> messageResult = new MessageResult<>();
+
+        try {
+            //todo
+            List<DataDictionary> list = dataDictionaryService.findByCatalogName(catalogName);
+            messageResult.setData(list);
+
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
 }