作者 钟来

模块整理

正在显示 38 个修改的文件 包含 1389 行增加379 行删除
  1 +package com.ruoyi.system.domain.fish;
  2 +
  3 +import com.ruoyi.common.tool.BaseEntity;
  4 +
  5 +public class FishPriceCollection extends BaseEntity {
  6 + private Integer id; // INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  7 + private String province; // VARCHAR(100) NOT NULL COMMENT '省',
  8 + private String city; // VARCHAR(100) NOT NULL COMMENT '市',
  9 + private String fish_species; // VARCHAR(100) NOT NULL COMMENT '鱼种',
  10 + private String specification; // VARCHAR(100) NOT NULL COMMENT '规格',
  11 + private Double price; // DECIMAL(10,2) NOT NULL COMMENT '价格',
  12 + private String publish_time; // DATETIME NOT NULL COMMENT '发布时间',
  13 + private String collection_time; // DATETIME NOT NULL COMMENT '采集时间',
  14 + private String collection_source; // VARCHAR(255) NOT NULL COMMENT '采集源',
  15 + private String collection_data; // TEXT NOT NULL COMMENT '采集数据',
  16 +
  17 + public Integer getId() {
  18 + return id;
  19 + }
  20 +
  21 + public void setId(Integer id) {
  22 + this.id = id;
  23 + }
  24 +
  25 + public Double getPrice() {
  26 + return price;
  27 + }
  28 +
  29 + public void setPrice(Double price) {
  30 + this.price = price;
  31 + }
  32 +
  33 + public String getCollection_time() {
  34 + return collection_time;
  35 + }
  36 +
  37 + public void setCollection_time(String collection_time) {
  38 + this.collection_time = collection_time;
  39 + }
  40 +
  41 + public String getProvince() {
  42 + return province;
  43 + }
  44 +
  45 + public void setProvince(String province) {
  46 + this.province = province;
  47 + }
  48 +
  49 + public String getCity() {
  50 + return city;
  51 + }
  52 +
  53 + public void setCity(String city) {
  54 + this.city = city;
  55 + }
  56 +
  57 + public String getFish_species() {
  58 + return fish_species;
  59 + }
  60 +
  61 + public void setFish_species(String fish_species) {
  62 + this.fish_species = fish_species;
  63 + }
  64 +
  65 + public String getSpecification() {
  66 + return specification;
  67 + }
  68 +
  69 + public void setSpecification(String specification) {
  70 + this.specification = specification;
  71 + }
  72 +
  73 +
  74 + public String getPublish_time() {
  75 + return publish_time;
  76 + }
  77 +
  78 + public void setPublish_time(String publish_time) {
  79 + this.publish_time = publish_time;
  80 + }
  81 +
  82 +
  83 + public String getCollection_source() {
  84 + return collection_source;
  85 + }
  86 +
  87 + public void setCollection_source(String collection_source) {
  88 + this.collection_source = collection_source;
  89 + }
  90 +
  91 + public String getCollection_data() {
  92 + return collection_data;
  93 + }
  94 +
  95 + public void setCollection_data(String collection_data) {
  96 + this.collection_data = collection_data;
  97 + }
  98 +}
@@ -38,7 +38,14 @@ @@ -38,7 +38,14 @@
38 <groupId>com.zhonglai.luhui</groupId> 38 <groupId>com.zhonglai.luhui</groupId>
39 <artifactId>lh-jar-action</artifactId> 39 <artifactId>lh-jar-action</artifactId>
40 </dependency> 40 </dependency>
41 - 41 + <dependency>
  42 + <groupId>cn.hutool</groupId>
  43 + <artifactId>hutool-all</artifactId>
  44 + </dependency>
  45 + <dependency>
  46 + <groupId>com.jcraft</groupId>
  47 + <artifactId>jsch</artifactId>
  48 + </dependency>
42 </dependencies> 49 </dependencies>
43 50
44 </project> 51 </project>
1 package com.ruoyi.quartz.controller; 1 package com.ruoyi.quartz.controller;
2 2
  3 +import java.lang.reflect.InvocationTargetException;
3 import java.util.List; 4 import java.util.List;
4 import javax.servlet.http.HttpServletResponse; 5 import javax.servlet.http.HttpServletResponse;
5 6
  7 +import com.ruoyi.common.utils.spring.SpringUtils;
  8 +import com.ruoyi.quartz.task.YudadaGrabTask;
6 import com.zhonglai.luhui.action.BaseController; 9 import com.zhonglai.luhui.action.BaseController;
7 import com.zhonglai.luhui.security.utils.SecurityUtils; 10 import com.zhonglai.luhui.security.utils.SecurityUtils;
8 import com.zhonglai.luhui.sys.utils.ExcelUtil; 11 import com.zhonglai.luhui.sys.utils.ExcelUtil;
@@ -186,4 +189,13 @@ public class SysJobController extends BaseController @@ -186,4 +189,13 @@ public class SysJobController extends BaseController
186 jobService.deleteJobByIds(jobIds); 189 jobService.deleteJobByIds(jobIds);
187 return AjaxResult.success(); 190 return AjaxResult.success();
188 } 191 }
  192 +
  193 + @ApiOperation("执行指定任务")
  194 + @Log(title = "定时任务", businessType = BusinessType.UPDATE)
  195 + @PostMapping("/exeTask")
  196 + public AjaxResult exeTask(String beanname,String fondname) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
  197 + Object beanobject = SpringUtils.getBean(beanname);
  198 + beanobject.getClass().getMethod(fondname).invoke(beanobject);
  199 + return AjaxResult.success();
  200 + }
189 } 201 }
@@ -99,4 +99,6 @@ public interface ISysJobService @@ -99,4 +99,6 @@ public interface ISysJobService
99 * @return 结果 99 * @return 结果
100 */ 100 */
101 public boolean checkCronExpressionIsValid(String cronExpression); 101 public boolean checkCronExpressionIsValid(String cronExpression);
  102 +
  103 +
102 } 104 }
1 -package com.zhonglai.luhui.admin.task; 1 +package com.ruoyi.quartz.task;
2 2
3 import org.springframework.stereotype.Component; 3 import org.springframework.stereotype.Component;
4 4
1 -package com.zhonglai.luhui.admin.task; 1 +package com.ruoyi.quartz.task;
2 2
3 import com.ruoyi.common.utils.DateUtils; 3 import com.ruoyi.common.utils.DateUtils;
4 import com.zhonglai.luhui.dao.service.PublicService; 4 import com.zhonglai.luhui.dao.service.PublicService;
1 -package com.zhonglai.luhui.admin.task; 1 +package com.ruoyi.quartz.task;
2 2
3 import cn.hutool.core.util.CharsetUtil; 3 import cn.hutool.core.util.CharsetUtil;
4 import cn.hutool.core.util.StrUtil; 4 import cn.hutool.core.util.StrUtil;
1 -package com.zhonglai.luhui.admin.task; 1 +package com.ruoyi.quartz.task;
2 2
3 import cn.hutool.core.util.CharsetUtil; 3 import cn.hutool.core.util.CharsetUtil;
4 import cn.hutool.core.util.ReUtil; 4 import cn.hutool.core.util.ReUtil;
  1 +package com.ruoyi.quartz.task;
  2 +
  3 +import cn.hutool.http.HttpRequest;
  4 +import cn.hutool.http.HttpUtil;
  5 +import com.google.gson.JsonArray;
  6 +import com.google.gson.JsonObject;
  7 +import com.ruoyi.common.utils.DateUtils;
  8 +import com.ruoyi.common.utils.GsonConstructor;
  9 +import com.ruoyi.system.domain.fish.FishPriceCollection;
  10 +import com.zhonglai.luhui.dao.service.PublicService;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import java.util.*;
  17 +import java.util.regex.Matcher;
  18 +import java.util.regex.Pattern;
  19 +
  20 +/**
  21 + * 鱼大大抓取
  22 + */
  23 +@Component("yudadaGrabTask")
  24 +public class YudadaGrabTask {
  25 + protected final Logger logger = LoggerFactory.getLogger(this.getClass());
  26 + @Autowired
  27 + private PublicService publicService;
  28 +
  29 + public void gatherSalesList()
  30 + {
  31 + long maxTime = getMaxTime();
  32 +
  33 + int pageNo = 1;
  34 + while (pageNo != -1)
  35 + {
  36 + try {
  37 + Thread.sleep(new Double(Math.random()*10000).longValue());
  38 + } catch (InterruptedException e) {
  39 + throw new RuntimeException(e);
  40 + }
  41 + String str = getSalesList(pageNo++);
  42 + JsonObject jsonObject = GsonConstructor.get().fromJson(str, JsonObject.class);
  43 + if (jsonObject.has("code") && jsonObject.get("code").getAsInt()==1)
  44 + {
  45 + if(jsonObject.has("data") && null != jsonObject.get("code") && !jsonObject.get("data").isJsonNull())
  46 + {
  47 + JsonArray jsonArray = jsonObject.get("data").getAsJsonArray();
  48 + if(null != jsonArray && jsonArray.size() != 0)
  49 + {
  50 + List<FishPriceCollection> fishPriceCollectionList = new ArrayList<>();
  51 + for(int i=0;i<jsonArray.size();i++)
  52 + {
  53 + try {
  54 + JsonObject fishObject = jsonArray.get(i).getAsJsonObject();
  55 + FishPriceCollection fishPriceCollection = new FishPriceCollection();
  56 + fishPriceCollection.setProvince(fishObject.get("provinceName").getAsString());
  57 + fishPriceCollection.setCity(fishObject.get("cityName").getAsString());
  58 + fishPriceCollection.setFish_species(fishObject.get("fishTypeName").getAsString());
  59 + if(fishObject.has("specifications") && !fishObject.get("specifications").isJsonNull() && !"".equals(fishObject.get("specifications").getAsString()))
  60 + {
  61 + fishPriceCollection.setSpecification(fishObject.get("specifications").getAsString());
  62 + }else {
  63 + fishPriceCollection.setSpecification(fishObject.get("quantityTagList").getAsJsonArray().get(0).getAsJsonObject().get("tagName").getAsString());
  64 + }
  65 + if(fishObject.has("demandInfoSale"))
  66 + {
  67 + JsonObject demandInfoSale = fishObject.get("demandInfoSale").getAsJsonObject();
  68 +
  69 + String lowerPrice = null;
  70 + if(demandInfoSale.has("lowerPrice") && !demandInfoSale.get("lowerPrice").isJsonNull())
  71 + {
  72 + lowerPrice =demandInfoSale.get("lowerPrice").getAsString();
  73 + }else {
  74 + lowerPrice = demandInfoSale.get("expectedPrice").getAsString();
  75 + }
  76 + fishPriceCollection.setPrice(getAsDouble(lowerPrice));
  77 + }
  78 + long time = fishObject.get("sort").getAsInt()*1000l;
  79 + fishPriceCollection.setPublish_time(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,new Date(time)));
  80 + fishPriceCollection.setCollection_time(DateUtils.parseDateToStr(DateUtils.getTime(),new Date()));
  81 + fishPriceCollection.setCollection_source("鱼大大");
  82 + fishPriceCollection.setCollection_data(fishObject.toString());
  83 +
  84 + if(maxTime>time)
  85 + {
  86 + pageNo = -1;
  87 + break;
  88 + }
  89 + fishPriceCollectionList.add(fishPriceCollection);
  90 + }catch (Exception e)
  91 + {
  92 + logger.error("数据解析错误:"+jsonArray.get(i).toString(),e);
  93 + }
  94 + }
  95 + publicService.insertAll(fishPriceCollectionList);
  96 +
  97 + }
  98 + }
  99 + else {
  100 + pageNo = -1;
  101 + }
  102 + }else {
  103 + pageNo = -1;
  104 + }
  105 +
  106 + }
  107 +
  108 + }
  109 +
  110 + private long getMaxTime()
  111 + {
  112 + List<Map<String,Object>> list = publicService.getObjectListBySQL("SELECT MAX(publish_time) m_publish_time FROM fish_price_collection WHERE collection_source='鱼大大'");
  113 + if(null != list && list.size() != 0 && list.get(0).containsKey("m_publish_time"))
  114 + {
  115 + return DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,String.valueOf(list.get(0).get("m_publish_time"))).getTime();
  116 + }
  117 + return 0;
  118 + }
  119 +
  120 + /**
  121 + * 从一个字符串中提取出所有类型的数字
  122 + * @return
  123 + */
  124 + private double getAsDouble(String input)
  125 + {
  126 + // 使用正则表达式匹配所有类型的数字
  127 + String regex = "-?\\d+(\\.\\d+)?|0[xX][0-9a-fA-F]+";
  128 + Pattern pattern = Pattern.compile(regex);
  129 + Matcher matcher = pattern.matcher(input);
  130 +
  131 + // 提取所有类型的数字并打印
  132 + while (matcher.find()) {
  133 + String match = matcher.group();
  134 +
  135 + if (match.contains(".")) {
  136 + double number = Double.parseDouble(match);
  137 + return number;
  138 + } else if (match.startsWith("0x") || match.startsWith("0X")) {
  139 + int number = Integer.parseInt(match.substring(2), 16);
  140 + return number;
  141 + } else {
  142 + int number = Integer.parseInt(match);
  143 + return number;
  144 + }
  145 + }
  146 + return 0;
  147 + }
  148 +
  149 + private String getSalesList(Integer pageNo)
  150 + {
  151 + String url = "http://api.yudada.com/demandInfo/list";
  152 + HttpRequest httpRequest = HttpUtil.createGet(url);
  153 + httpRequest = httpRequest
  154 + .form("type",2).
  155 + form("pageSize",20).
  156 + form("pageNo",pageNo).
  157 + form("hasTop",false).
  158 + form("fishStage",0).
  159 + form("topStrategy",1)
  160 + .headerMap(empower(),true);
  161 + String str = httpRequest.timeout(15000).execute().body();
  162 + return str;
  163 + }
  164 +
  165 + private static Map<String,String> empower()
  166 + {
  167 + Map<String,String> headers = new HashMap<>();
  168 + headers.put("device-id","C3A70374-DD06-4C01-B35C-E8F9FC69F1D9");
  169 + headers.put("User-Agent","Mozilla/5.0 (iPhone; CPU iPhone OS 15_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148");
  170 + headers.put("access-token","88832b9fe8514362b2be081de4ede250");
  171 + headers.put("client-type","iOS");
  172 + headers.put("client-version","1.26");
  173 + headers.put("device-model","iPhone11,6");
  174 + headers.put("Content-Type","application/json");
  175 + return headers;
  176 + }
  177 +}
@@ -15,6 +15,8 @@ import org.springframework.security.core.userdetails.UserDetails; @@ -15,6 +15,8 @@ import org.springframework.security.core.userdetails.UserDetails;
15 import org.springframework.security.core.userdetails.UserDetailsService; 15 import org.springframework.security.core.userdetails.UserDetailsService;
16 import org.springframework.security.core.userdetails.UsernameNotFoundException; 16 import org.springframework.security.core.userdetails.UsernameNotFoundException;
17 17
  18 +import java.util.Set;
  19 +
18 /** 20 /**
19 * 用户验证处理 21 * 用户验证处理
20 * 22 *
@@ -50,6 +52,8 @@ public abstract class AdminDetailsService implements UserDetailsService @@ -50,6 +52,8 @@ public abstract class AdminDetailsService implements UserDetailsService
50 52
51 public UserDetails createLoginUser(SysUser user) 53 public UserDetails createLoginUser(SysUser user)
52 { 54 {
53 - return new SysLoginUser(user.getUserId(), user.getDeptId(), user,null).setSysLogininforType(SysLogininforType.lhAdmin); 55 + return new SysLoginUser(user.getUserId(), user.getDeptId(), user,getMenuPermission(user)).setSysLogininforType(SysLogininforType.lhAdmin);
54 } 56 }
  57 +
  58 + public abstract Set<String> getMenuPermission(SysUser user);
55 } 59 }
@@ -9,6 +9,7 @@ import com.ruoyi.common.utils.ip.IpUtils; @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.ip.IpUtils;
9 import com.ruoyi.common.utils.uuid.IdUtils; 9 import com.ruoyi.common.utils.uuid.IdUtils;
10 import com.zhonglai.luhui.security.dto.BaseLoginUser; 10 import com.zhonglai.luhui.security.dto.BaseLoginUser;
11 import com.zhonglai.luhui.redis.service.RedisCache; 11 import com.zhonglai.luhui.redis.service.RedisCache;
  12 +import com.zhonglai.luhui.security.dto.SysLoginUser;
12 import eu.bitwalker.useragentutils.UserAgent; 13 import eu.bitwalker.useragentutils.UserAgent;
13 import io.jsonwebtoken.Claims; 14 import io.jsonwebtoken.Claims;
14 import io.jsonwebtoken.Jwts; 15 import io.jsonwebtoken.Jwts;
@@ -78,8 +79,11 @@ public class TokenService @@ -78,8 +79,11 @@ public class TokenService
78 String userKey = getTokenKey(uuid); 79 String userKey = getTokenKey(uuid);
79 80
80 Collection<String> keys = redisCache.keys(userKey); 81 Collection<String> keys = redisCache.keys(userKey);
81 - BaseLoginUser user = redisCache.getCacheObject(keys.stream().findFirst().get());  
82 - return user; 82 + if(null != keys && keys.size() != 0)
  83 + {
  84 + SysLoginUser user = redisCache.getCacheObject(keys.stream().findFirst().get());
  85 + return user;
  86 + }
83 } 87 }
84 catch (Exception e) 88 catch (Exception e)
85 { 89 {
@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
77 <trim prefix="(" suffix=")" suffixOverrides=","> 77 <trim prefix="(" suffix=")" suffixOverrides=",">
78 #foreach($column in $columns) 78 #foreach($column in $columns)
79 #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) 79 #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
80 - <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if> 80 + <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">`$column.columnName`,</if>
81 #end 81 #end
82 #end 82 #end
83 </trim> 83 </trim>
@@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
95 <trim prefix="SET" suffixOverrides=","> 95 <trim prefix="SET" suffixOverrides=",">
96 #foreach($column in $columns) 96 #foreach($column in $columns)
97 #if($column.columnName != $pkColumn.columnName) 97 #if($column.columnName != $pkColumn.columnName)
98 - <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> 98 + <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">`$column.columnName` = #{$column.javaField},</if>
99 #end 99 #end
100 #end 100 #end
101 </trim> 101 </trim>
1 -package com.zhonglai.luhui.central.control;  
2 -  
3 -import com.alibaba.fastjson.JSONObject;  
4 -import com.ruoyi.common.core.domain.Message;  
5 -import com.ruoyi.common.core.domain.MessageCode;  
6 -import com.ruoyi.common.utils.StringUtils;  
7 -import com.ruoyi.common.utils.html.HttpUtils;  
8 -import com.zhonglai.luhui.device.domain.IotDevice;  
9 -import com.zhonglai.luhui.redis.service.RedisCache;  
10 -import okhttp3.Response;  
11 -import org.springframework.beans.factory.annotation.Autowired;  
12 -import org.springframework.stereotype.Service;  
13 -import org.springframework.web.bind.annotation.RequestBody;  
14 -  
15 -import java.io.IOException;  
16 -import java.util.HashMap;  
17 -import java.util.Map;  
18 -  
19 -@Service  
20 -public class DeviceControlService {  
21 - @Autowired  
22 - private RedisCache redisCache;  
23 - private String redisHostPath = "luhui:mqttservice:device:device:";  
24 -  
25 - @Autowired  
26 - private DeviceDBOperationService deviceDBOperationService;  
27 -  
28 - private IotDevice getRedisIotDevice(String imei)  
29 - {  
30 - return (IotDevice)redisCache.getCacheObject(redisHostPath+imei);  
31 - }  
32 -  
33 - /**  
34 - * 固件版本更新  
35 - * @param imei 主机imei  
36 - * @param firmwareVersion 版本号  
37 - * @param code 版本码  
38 - * @return  
39 - */  
40 - public Message firmwareUp(String imei,String firmwareVersion,Integer code)  
41 - {  
42 - IotDevice iotDevice = getRedisIotDevice(imei);  
43 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
44 - {  
45 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
46 - }  
47 - String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;  
48 - Map<String,Object> valueMap = new HashMap<>();  
49 - valueMap.put("firmwareVersion",firmwareVersion);  
50 - valueMap.put("code",code);  
51 - return post(url, jsonObject -> jsonObject.put("0",valueMap));  
52 - }  
53 -  
54 - /**  
55 - * 设备重启  
56 - * @param imei 主机imei  
57 - * @param restart 1重启,2复位,3恢复出厂值  
58 - * @return  
59 - */  
60 - public Message restart(String imei ,Integer restart)  
61 - {  
62 - IotDevice iotDevice = getRedisIotDevice(imei);  
63 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
64 - {  
65 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
66 - }  
67 - String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;  
68 - Map<String,Object> map = new HashMap<>();  
69 - Map<String,Object> valueMap = new HashMap<>();  
70 - valueMap.put("restart",restart);  
71 - return post(url, jsonObject -> jsonObject.put("0",valueMap));  
72 - }  
73 -  
74 - /**  
75 - * 获取指定设备版本信息  
76 - * @param imei 主机imei  
77 - * @return  
78 - * @throws IOException  
79 - */  
80 - public Message getFirmwareVersion(String imei) throws IOException {  
81 - IotDevice iotDevice = getRedisIotDevice(imei);  
82 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
83 - {  
84 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
85 - }  
86 - String url = "http://"+iotDevice.getListen_service_ip()+"device/getFirmwareVersion/"+iotDevice.getMqtt_username();  
87 - return postFrom(url, formBody -> {  
88 - });  
89 - }  
90 -  
91 - /**  
92 - * 强行断开链接  
93 - * @param imei 主机imei  
94 - * @return  
95 - * @throws IOException  
96 - */  
97 - public Message closeSession(String imei) {  
98 - IotDevice iotDevice = getRedisIotDevice(imei);  
99 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
100 - {  
101 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
102 - }  
103 - String url = "http://"+iotDevice.getListen_service_ip()+"device/closeSession/"+imei;  
104 - return postFrom(url, formBody -> {  
105 - });  
106 - }  
107 -  
108 - /**  
109 - * 删除主机  
110 - * @param imei 主机imei  
111 - * @return  
112 - */  
113 - public Message delIotDevice(String imei) {  
114 - IotDevice iotDevice = getRedisIotDevice(imei);  
115 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
116 - {  
117 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
118 - }  
119 - deviceDBOperationService.deleteIotDeviceByClient_id(imei);  
120 - deviceDBOperationService.deleteIotTerminalByDeviceId(imei);  
121 - if(StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
122 - {  
123 - return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"删除成功");  
124 - }  
125 - String url = "http://"+iotDevice.getListen_service_ip()+"device/delIotDevice/"+imei;  
126 -  
127 - return postFrom(url, formBody -> {  
128 - });  
129 - }  
130 -  
131 - /**  
132 - * 删除终端  
133 - * @param imei 主机imei  
134 - * @param number 终端编号  
135 - * @return  
136 - */  
137 - public Message delIotTerminal(String imei,String number) {  
138 - IotDevice iotDevice = getRedisIotDevice(imei);  
139 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
140 - {  
141 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
142 - }  
143 - deviceDBOperationService.deleteIotTerminalById(imei+"_"+number);  
144 - if(StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
145 - {  
146 - return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"删除成功");  
147 - }  
148 - String url = "http://"+iotDevice.getListen_service_ip()+"device/delIotTerminal/"+imei+"/"+number;  
149 -  
150 - return postFrom(url, formBody -> {  
151 - });  
152 - }  
153 -  
154 - /**  
155 - * 读取属性  
156 - * @param imei 主机imei  
157 - * @param sensor_number 传感器编号(0,1_1,10_1)  
158 - * @param attributes 属性集合(id1,id2,id3)  
159 - * @return  
160 - * @throws IOException  
161 - */  
162 - public Message readAttribute(String imei,String sensor_number,String attributes) throws IOException {  
163 - IotDevice iotDevice = getRedisIotDevice(imei);  
164 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
165 - {  
166 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
167 - }  
168 - String url = "http://"+iotDevice.getListen_service_ip()+"device/read/"+imei;  
169 - return post(url, jsonObject -> jsonObject.put(sensor_number,attributes));  
170 - }  
171 -  
172 - /**  
173 - * 设置主机自定义参数  
174 - * @param imei 主机imei  
175 - * @param summary 自定义数据json字符串  
176 - * @return  
177 - * @throws IOException  
178 - */  
179 - public Message upSummary(String imei,String summary) {  
180 - IotDevice iotDevice = getRedisIotDevice(imei);  
181 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
182 - {  
183 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
184 - }  
185 - String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;  
186 - Map<String,Object> valueMap = new HashMap<>();  
187 - valueMap.put("summary",JSONObject.parseObject(summary));  
188 - return post(url, jsonObject -> jsonObject.put("0",valueMap));  
189 - }  
190 -  
191 - /**  
192 - * 修改指定终端属性  
193 - * @param imei 主机imei  
194 - * @param number 终端编号(如:1_1)  
195 - * @param config 配置参数json字符串  
196 - * @return  
197 - * @throws IOException  
198 - */  
199 - public Message upTerminalConfig(String imei,String number,@RequestBody Map<String,Object> config) throws IOException {  
200 - IotDevice iotDevice = getRedisIotDevice(imei);  
201 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
202 - {  
203 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
204 - }  
205 - String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;  
206 - return post(url, jsonObject -> jsonObject.put(number,config));  
207 - }  
208 -  
209 - /**  
210 - * 批量修改终端属性  
211 - * @param imei 主机imei  
212 - * @param map 批量数据json字符串  
213 - * @return  
214 - * @throws IOException  
215 - */  
216 - public Message batchUpTerminalConfig(String imei,@RequestBody Map<String,Object> map) {  
217 - IotDevice iotDevice = getRedisIotDevice(imei);  
218 - if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))  
219 - {  
220 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");  
221 - }  
222 - String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;  
223 - return post(url, jsonObject -> {  
224 - for (String key:map.keySet())  
225 - {  
226 - jsonObject.put(key, map.get(key));  
227 - }  
228 - });  
229 - }  
230 -  
231 -  
232 - private Message post(String url, HttpUtils.JsonBody jsonBody)  
233 - {  
234 - Response response = null;  
235 - try {  
236 - response = HttpUtils.postJsonBody(url, jsonBody);  
237 - if(null != response.body() && StringUtils.isNotEmpty(response.body().string()))  
238 - {  
239 - Message message = com.alibaba.fastjson.JSONObject.parseObject(response.body().string(),Message.class);  
240 - return message;  
241 - }  
242 - } catch (IOException e) {  
243 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令转发失败请联系管理员");  
244 - }  
245 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令执行失败请稍后重试");  
246 - }  
247 - private Message postFrom(String url,HttpUtils.FromBody fromBody )  
248 - {  
249 - Response response1 = null;  
250 - try {  
251 - response1 = HttpUtils.postFromBody(url, builder -> {  
252 - }, fromBody);  
253 - if(null != response1.body() && StringUtils.isNotEmpty(response1.body().string()))  
254 - {  
255 - Message message = com.alibaba.fastjson.JSONObject.parseObject(response1.body().string(),Message.class);  
256 - return message;  
257 - }  
258 - } catch (IOException e) {  
259 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令转发失败请联系管理员");  
260 - }  
261 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令执行失败请稍后重试");  
262 - }  
263 -  
264 -}  
1 -package com.zhonglai.luhui.central.control;  
2 -  
3 -public interface DeviceDBOperationService {  
4 - int deleteIotDeviceByClient_id(String imei);  
5 - int deleteIotTerminalByDeviceId(String imei);  
6 - int deleteIotTerminalById(String id);  
7 -}  
@@ -67,7 +67,9 @@ public class ContentGroupManagementController extends BaseController @@ -67,7 +67,9 @@ public class ContentGroupManagementController extends BaseController
67 @PostMapping 67 @PostMapping
68 public AjaxResult add(@RequestBody ContentGroupManagement contentGroupManagement) 68 public AjaxResult add(@RequestBody ContentGroupManagement contentGroupManagement)
69 { 69 {
  70 +
70 contentGroupManagement.setCreate_time(DateUtils.getNowTimeMilly()); 71 contentGroupManagement.setCreate_time(DateUtils.getNowTimeMilly());
  72 + contentGroupManagement.setUpdate_time(contentGroupManagement.getCreate_time());
71 return toAjax(contentGroupManagementService.insertContentGroupManagement(contentGroupManagement)); 73 return toAjax(contentGroupManagementService.insertContentGroupManagement(contentGroupManagement));
72 } 74 }
73 75
@@ -79,6 +81,7 @@ public class ContentGroupManagementController extends BaseController @@ -79,6 +81,7 @@ public class ContentGroupManagementController extends BaseController
79 @PutMapping 81 @PutMapping
80 public AjaxResult edit(@RequestBody ContentGroupManagement contentGroupManagement) 82 public AjaxResult edit(@RequestBody ContentGroupManagement contentGroupManagement)
81 { 83 {
  84 + contentGroupManagement.setUpdate_time(DateUtils.getNowTimeMilly());
82 return toAjax(contentGroupManagementService.updateContentGroupManagement(contentGroupManagement)); 85 return toAjax(contentGroupManagementService.updateContentGroupManagement(contentGroupManagement));
83 } 86 }
84 87
  1 +package com.zhonglai.luhui.order.service.controller;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +
  6 +import com.ruoyi.common.utils.DateUtils;
  7 +import io.swagger.annotations.Api;
  8 +import io.swagger.annotations.ApiOperation;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.PutMapping;
  13 +import org.springframework.web.bind.annotation.DeleteMapping;
  14 +import org.springframework.web.bind.annotation.PathVariable;
  15 +import org.springframework.web.bind.annotation.RequestBody;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RestController;
  18 +import com.ruoyi.common.annotation.Log;
  19 +import com.zhonglai.luhui.action.BaseController;
  20 +import com.ruoyi.common.core.domain.AjaxResult;
  21 +import com.ruoyi.common.enums.BusinessType;
  22 +import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
  23 +import com.zhonglai.luhui.order.service.service.IContentGroupManagementDescribeService;
  24 +import com.ruoyi.common.core.page.TableDataInfo;
  25 +
  26 +/**
  27 + * 分组内容管理描述表Controller
  28 + *
  29 + * @author 钟来
  30 + * @date 2023-09-26
  31 + */
  32 +@Api(tags = "分组内容管理描述表")
  33 +@RestController
  34 +@RequestMapping("/content/ContentGroupManagementDescribe")
  35 +public class ContentGroupManagementDescribeController extends BaseController
  36 +{
  37 + @Autowired
  38 + private IContentGroupManagementDescribeService contentGroupManagementDescribeService;
  39 +
  40 + /**
  41 + * 查询分组内容管理描述表列表
  42 + */
  43 + @ApiOperation("查询分组内容管理描述表列表")
  44 + @GetMapping("/list")
  45 + public TableDataInfo list(ContentGroupManagementDescribe contentGroupManagementDescribe)
  46 + {
  47 + startPage();
  48 + List<ContentGroupManagementDescribe> list = contentGroupManagementDescribeService.selectContentGroupManagementDescribeList(contentGroupManagementDescribe);
  49 + return getDataTable(list);
  50 + }
  51 +
  52 +
  53 + /**
  54 + * 获取分组内容管理描述表详细信息
  55 + */
  56 + @ApiOperation("获取分组内容管理描述表详细信息")
  57 + @GetMapping(value = "/{id}")
  58 + public AjaxResult getInfo(@PathVariable("id") Integer id)
  59 + {
  60 + return AjaxResult.success(contentGroupManagementDescribeService.selectContentGroupManagementDescribeById(id));
  61 + }
  62 +
  63 + /**
  64 + * 新增分组内容管理描述表
  65 + */
  66 + @ApiOperation("新增分组内容管理描述表")
  67 + @Log(title = "分组内容管理描述表", businessType = BusinessType.INSERT)
  68 + @PostMapping
  69 + public AjaxResult add(@RequestBody ContentGroupManagementDescribe contentGroupManagementDescribe)
  70 + {
  71 + contentGroupManagementDescribe.setCreate_time(DateUtils.getNowTimeMilly());
  72 + contentGroupManagementDescribe.setUpdate_time(contentGroupManagementDescribe.getCreate_time());
  73 + return toAjax(contentGroupManagementDescribeService.insertContentGroupManagementDescribe(contentGroupManagementDescribe));
  74 + }
  75 +
  76 + /**
  77 + * 修改分组内容管理描述表
  78 + */
  79 + @ApiOperation("修改分组内容管理描述表")
  80 + @Log(title = "分组内容管理描述表", businessType = BusinessType.UPDATE)
  81 + @PutMapping
  82 + public AjaxResult edit(@RequestBody ContentGroupManagementDescribe contentGroupManagementDescribe)
  83 + {
  84 + contentGroupManagementDescribe.setUpdate_time(DateUtils.getNowTimeMilly());
  85 + return toAjax(contentGroupManagementDescribeService.updateContentGroupManagementDescribe(contentGroupManagementDescribe));
  86 + }
  87 +
  88 + /**
  89 + * 删除分组内容管理描述表
  90 + */
  91 + @ApiOperation("删除分组内容管理描述表")
  92 + @Log(title = "分组内容管理描述表", businessType = BusinessType.DELETE)
  93 + @DeleteMapping("/{ids}")
  94 + public AjaxResult remove(@PathVariable Integer[] ids)
  95 + {
  96 + return toAjax(contentGroupManagementDescribeService.deleteContentGroupManagementDescribeByIds(ids));
  97 + }
  98 +}
  1 +package com.zhonglai.luhui.order.service.controller;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.ruoyi.system.domain.fish.FishPriceCollection;
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.GetMapping;
  10 +import org.springframework.web.bind.annotation.PostMapping;
  11 +import org.springframework.web.bind.annotation.PutMapping;
  12 +import org.springframework.web.bind.annotation.DeleteMapping;
  13 +import org.springframework.web.bind.annotation.PathVariable;
  14 +import org.springframework.web.bind.annotation.RequestBody;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RestController;
  17 +import com.ruoyi.common.annotation.Log;
  18 +import com.zhonglai.luhui.action.BaseController;
  19 +import com.ruoyi.common.core.domain.AjaxResult;
  20 +import com.ruoyi.common.enums.BusinessType;
  21 +import com.zhonglai.luhui.order.service.service.IFishPriceCollectionService;
  22 +import com.ruoyi.common.core.page.TableDataInfo;
  23 +
  24 +/**
  25 + * 鱼价采集表Controller
  26 + *
  27 + * @author 钟来
  28 + * @date 2023-09-25
  29 + */
  30 +@Api(tags = "鱼价采集表")
  31 +@RestController
  32 +@RequestMapping("/fish/FishPriceCollection")
  33 +public class FishPriceCollectionController extends BaseController
  34 +{
  35 + @Autowired
  36 + private IFishPriceCollectionService fishPriceCollectionService;
  37 +
  38 + /**
  39 + * 查询鱼价采集表列表
  40 + */
  41 + @ApiOperation("查询鱼价采集表列表")
  42 + @GetMapping("/list")
  43 + public TableDataInfo list(FishPriceCollection fishPriceCollection)
  44 + {
  45 + startPage();
  46 + List<FishPriceCollection> list = fishPriceCollectionService.selectFishPriceCollectionList(fishPriceCollection);
  47 + return getDataTable(list);
  48 + }
  49 +
  50 +
  51 + /**
  52 + * 获取鱼价采集表详细信息
  53 + */
  54 + @ApiOperation("获取鱼价采集表详细信息")
  55 + @GetMapping(value = "/{id}")
  56 + public AjaxResult getInfo(@PathVariable("id") Integer id)
  57 + {
  58 + return AjaxResult.success(fishPriceCollectionService.selectFishPriceCollectionById(id));
  59 + }
  60 +
  61 + /**
  62 + * 新增鱼价采集表
  63 + */
  64 + @ApiOperation("新增鱼价采集表")
  65 + @Log(title = "鱼价采集表", businessType = BusinessType.INSERT)
  66 + @PostMapping
  67 + public AjaxResult add(@RequestBody FishPriceCollection fishPriceCollection)
  68 + {
  69 + return toAjax(fishPriceCollectionService.insertFishPriceCollection(fishPriceCollection));
  70 + }
  71 +
  72 + /**
  73 + * 修改鱼价采集表
  74 + */
  75 + @ApiOperation("修改鱼价采集表")
  76 + @Log(title = "鱼价采集表", businessType = BusinessType.UPDATE)
  77 + @PutMapping
  78 + public AjaxResult edit(@RequestBody FishPriceCollection fishPriceCollection)
  79 + {
  80 + return toAjax(fishPriceCollectionService.updateFishPriceCollection(fishPriceCollection));
  81 + }
  82 +
  83 + /**
  84 + * 删除鱼价采集表
  85 + */
  86 + @ApiOperation("删除鱼价采集表")
  87 + @Log(title = "鱼价采集表", businessType = BusinessType.DELETE)
  88 + @DeleteMapping("/{ids}")
  89 + public AjaxResult remove(@PathVariable Integer[] ids)
  90 + {
  91 + return toAjax(fishPriceCollectionService.deleteFishPriceCollectionByIds(ids));
  92 + }
  93 +}
@@ -40,7 +40,18 @@ public class ContentGroupManagement extends BaseEntity @@ -40,7 +40,18 @@ public class ContentGroupManagement extends BaseEntity
40 @ApiModelProperty("排序") 40 @ApiModelProperty("排序")
41 private Integer sort; 41 private Integer sort;
42 42
43 - public void setContent(String content) 43 + @ApiModelProperty("更新时间")
  44 + private Integer update_time;
  45 +
  46 + public Integer getUpdate_time() {
  47 + return update_time;
  48 + }
  49 +
  50 + public void setUpdate_time(Integer update_time) {
  51 + this.update_time = update_time;
  52 + }
  53 +
  54 + public void setContent(String content)
44 { 55 {
45 this.content = content; 56 this.content = content;
46 } 57 }
  1 +package com.zhonglai.luhui.order.service.domain;
  2 +
  3 +import com.ruoyi.common.annotation.Excel;
  4 +import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import com.ruoyi.common.annotation.PublicSQLConfig;
  7 +import com.ruoyi.common.tool.BaseEntity;
  8 +import org.apache.commons.lang3.builder.ToStringBuilder;
  9 +import org.apache.commons.lang3.builder.ToStringStyle;
  10 +
  11 +/**
  12 + * 分组内容管理描述表对象 content_group_management_describe
  13 + *
  14 + * @author 钟来
  15 + * @date 2023-09-26
  16 + */
  17 +@ApiModel("分组内容管理描述表")
  18 +public class ContentGroupManagementDescribe extends BaseEntity
  19 +{
  20 + @PublicSQLConfig(isSelect=false)
  21 + private static final long serialVersionUID = 1L;
  22 +
  23 + /** 分组内容管理表id */
  24 + @ApiModelProperty("分组内容管理表id")
  25 + private Integer content_group_management_id;
  26 +
  27 + /** 创建时间 */
  28 + @ApiModelProperty("创建时间")
  29 + private Integer create_time;
  30 +
  31 + /** 描述 */
  32 + @ApiModelProperty("描述")
  33 + private String describe;
  34 +
  35 + /** 主键 */
  36 + @ApiModelProperty("主键")
  37 + private Integer id;
  38 +
  39 + /** 更新时间 */
  40 + @ApiModelProperty("更新时间")
  41 + private Integer update_time;
  42 +
  43 + public void setContent_group_management_id(Integer content_group_management_id)
  44 + {
  45 + this.content_group_management_id = content_group_management_id;
  46 + }
  47 +
  48 + public Integer getContent_group_management_id()
  49 + {
  50 + return content_group_management_id;
  51 + }
  52 + public void setCreate_time(Integer create_time)
  53 + {
  54 + this.create_time = create_time;
  55 + }
  56 +
  57 + public Integer getCreate_time()
  58 + {
  59 + return create_time;
  60 + }
  61 + public void setDescribe(String describe)
  62 + {
  63 + this.describe = describe;
  64 + }
  65 +
  66 + public String getDescribe()
  67 + {
  68 + return describe;
  69 + }
  70 + public void setId(Integer id)
  71 + {
  72 + this.id = id;
  73 + }
  74 +
  75 + public Integer getId()
  76 + {
  77 + return id;
  78 + }
  79 + public void setUpdate_time(Integer update_time)
  80 + {
  81 + this.update_time = update_time;
  82 + }
  83 +
  84 + public Integer getUpdate_time()
  85 + {
  86 + return update_time;
  87 + }
  88 +
  89 + @Override
  90 + public String toString() {
  91 + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  92 + .append("content_group_management_id", getContent_group_management_id())
  93 + .append("create_time", getCreate_time())
  94 + .append("describe", getDescribe())
  95 + .append("id", getId())
  96 + .append("update_time", getUpdate_time())
  97 + .toString();
  98 + }
  99 +}
  1 +package com.zhonglai.luhui.order.service.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
  5 +
  6 +/**
  7 + * 分组内容管理描述表Mapper接口
  8 + *
  9 + * @author 钟来
  10 + * @date 2023-09-26
  11 + */
  12 +public interface ContentGroupManagementDescribeMapper
  13 +{
  14 + /**
  15 + * 查询分组内容管理描述表
  16 + *
  17 + * @param id 分组内容管理描述表主键
  18 + * @return 分组内容管理描述表
  19 + */
  20 + public ContentGroupManagementDescribe selectContentGroupManagementDescribeById(Integer id);
  21 +
  22 + /**
  23 + * 查询分组内容管理描述表列表
  24 + *
  25 + * @param contentGroupManagementDescribe 分组内容管理描述表
  26 + * @return 分组内容管理描述表集合
  27 + */
  28 + public List<ContentGroupManagementDescribe> selectContentGroupManagementDescribeList(ContentGroupManagementDescribe contentGroupManagementDescribe);
  29 +
  30 + /**
  31 + * 新增分组内容管理描述表
  32 + *
  33 + * @param contentGroupManagementDescribe 分组内容管理描述表
  34 + * @return 结果
  35 + */
  36 + public int insertContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
  37 +
  38 + /**
  39 + * 修改分组内容管理描述表
  40 + *
  41 + * @param contentGroupManagementDescribe 分组内容管理描述表
  42 + * @return 结果
  43 + */
  44 + public int updateContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
  45 +
  46 + /**
  47 + * 删除分组内容管理描述表
  48 + *
  49 + * @param id 分组内容管理描述表主键
  50 + * @return 结果
  51 + */
  52 + public int deleteContentGroupManagementDescribeById(Integer id);
  53 +
  54 + /**
  55 + * 批量删除分组内容管理描述表
  56 + *
  57 + * @param ids 需要删除的数据主键集合
  58 + * @return 结果
  59 + */
  60 + public int deleteContentGroupManagementDescribeByIds(Integer[] ids);
  61 +}
  1 +package com.zhonglai.luhui.order.service.mapper;
  2 +
  3 +import com.ruoyi.system.domain.fish.FishPriceCollection;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 鱼价采集表Mapper接口
  9 + *
  10 + * @author 钟来
  11 + * @date 2023-09-25
  12 + */
  13 +public interface FishPriceCollectionMapper
  14 +{
  15 + /**
  16 + * 查询鱼价采集表
  17 + *
  18 + * @param id 鱼价采集表主键
  19 + * @return 鱼价采集表
  20 + */
  21 + public FishPriceCollection selectFishPriceCollectionById(Integer id);
  22 +
  23 + /**
  24 + * 查询鱼价采集表列表
  25 + *
  26 + * @param fishPriceCollection 鱼价采集表
  27 + * @return 鱼价采集表集合
  28 + */
  29 + public List<FishPriceCollection> selectFishPriceCollectionList(FishPriceCollection fishPriceCollection);
  30 +
  31 + /**
  32 + * 新增鱼价采集表
  33 + *
  34 + * @param fishPriceCollection 鱼价采集表
  35 + * @return 结果
  36 + */
  37 + public int insertFishPriceCollection(FishPriceCollection fishPriceCollection);
  38 +
  39 + /**
  40 + * 修改鱼价采集表
  41 + *
  42 + * @param fishPriceCollection 鱼价采集表
  43 + * @return 结果
  44 + */
  45 + public int updateFishPriceCollection(FishPriceCollection fishPriceCollection);
  46 +
  47 + /**
  48 + * 删除鱼价采集表
  49 + *
  50 + * @param id 鱼价采集表主键
  51 + * @return 结果
  52 + */
  53 + public int deleteFishPriceCollectionById(Integer id);
  54 +
  55 + /**
  56 + * 批量删除鱼价采集表
  57 + *
  58 + * @param ids 需要删除的数据主键集合
  59 + * @return 结果
  60 + */
  61 + public int deleteFishPriceCollectionByIds(Integer[] ids);
  62 +}
  1 +package com.zhonglai.luhui.order.service.service;
  2 +
  3 +import java.util.List;
  4 +import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
  5 +
  6 +/**
  7 + * 分组内容管理描述表Service接口
  8 + *
  9 + * @author 钟来
  10 + * @date 2023-09-26
  11 + */
  12 +public interface IContentGroupManagementDescribeService
  13 +{
  14 + /**
  15 + * 查询分组内容管理描述表
  16 + *
  17 + * @param id 分组内容管理描述表主键
  18 + * @return 分组内容管理描述表
  19 + */
  20 + public ContentGroupManagementDescribe selectContentGroupManagementDescribeById(Integer id);
  21 +
  22 + /**
  23 + * 查询分组内容管理描述表列表
  24 + *
  25 + * @param contentGroupManagementDescribe 分组内容管理描述表
  26 + * @return 分组内容管理描述表集合
  27 + */
  28 + public List<ContentGroupManagementDescribe> selectContentGroupManagementDescribeList(ContentGroupManagementDescribe contentGroupManagementDescribe);
  29 +
  30 + /**
  31 + * 新增分组内容管理描述表
  32 + *
  33 + * @param contentGroupManagementDescribe 分组内容管理描述表
  34 + * @return 结果
  35 + */
  36 + public int insertContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
  37 +
  38 + /**
  39 + * 修改分组内容管理描述表
  40 + *
  41 + * @param contentGroupManagementDescribe 分组内容管理描述表
  42 + * @return 结果
  43 + */
  44 + public int updateContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
  45 +
  46 + /**
  47 + * 批量删除分组内容管理描述表
  48 + *
  49 + * @param ids 需要删除的分组内容管理描述表主键集合
  50 + * @return 结果
  51 + */
  52 + public int deleteContentGroupManagementDescribeByIds(Integer[] ids);
  53 +
  54 + /**
  55 + * 删除分组内容管理描述表信息
  56 + *
  57 + * @param id 分组内容管理描述表主键
  58 + * @return 结果
  59 + */
  60 + public int deleteContentGroupManagementDescribeById(Integer id);
  61 +}
  1 +package com.zhonglai.luhui.order.service.service;
  2 +
  3 +import com.ruoyi.system.domain.fish.FishPriceCollection;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 鱼价采集表Service接口
  9 + *
  10 + * @author 钟来
  11 + * @date 2023-09-25
  12 + */
  13 +public interface IFishPriceCollectionService
  14 +{
  15 + /**
  16 + * 查询鱼价采集表
  17 + *
  18 + * @param id 鱼价采集表主键
  19 + * @return 鱼价采集表
  20 + */
  21 + public FishPriceCollection selectFishPriceCollectionById(Integer id);
  22 +
  23 + /**
  24 + * 查询鱼价采集表列表
  25 + *
  26 + * @param fishPriceCollection 鱼价采集表
  27 + * @return 鱼价采集表集合
  28 + */
  29 + public List<FishPriceCollection> selectFishPriceCollectionList(FishPriceCollection fishPriceCollection);
  30 +
  31 + /**
  32 + * 新增鱼价采集表
  33 + *
  34 + * @param fishPriceCollection 鱼价采集表
  35 + * @return 结果
  36 + */
  37 + public int insertFishPriceCollection(FishPriceCollection fishPriceCollection);
  38 +
  39 + /**
  40 + * 修改鱼价采集表
  41 + *
  42 + * @param fishPriceCollection 鱼价采集表
  43 + * @return 结果
  44 + */
  45 + public int updateFishPriceCollection(FishPriceCollection fishPriceCollection);
  46 +
  47 + /**
  48 + * 批量删除鱼价采集表
  49 + *
  50 + * @param ids 需要删除的鱼价采集表主键集合
  51 + * @return 结果
  52 + */
  53 + public int deleteFishPriceCollectionByIds(Integer[] ids);
  54 +
  55 + /**
  56 + * 删除鱼价采集表信息
  57 + *
  58 + * @param id 鱼价采集表主键
  59 + * @return 结果
  60 + */
  61 + public int deleteFishPriceCollectionById(Integer id);
  62 +}
  1 +package com.zhonglai.luhui.order.service.service.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.zhonglai.luhui.datasource.enums.DataSource;
  6 +import com.zhonglai.luhui.datasource.enums.DataSourceType;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +import com.zhonglai.luhui.order.service.mapper.ContentGroupManagementDescribeMapper;
  10 +import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
  11 +import com.zhonglai.luhui.order.service.service.IContentGroupManagementDescribeService;
  12 +
  13 +/**
  14 + * 分组内容管理描述表Service业务层处理
  15 + *
  16 + * @author 钟来
  17 + * @date 2023-09-26
  18 + */
  19 +@Service
  20 +public class ContentGroupManagementDescribeServiceImpl implements IContentGroupManagementDescribeService
  21 +{
  22 + @Autowired
  23 + private ContentGroupManagementDescribeMapper contentGroupManagementDescribeMapper;
  24 +
  25 + /**
  26 + * 查询分组内容管理描述表
  27 + *
  28 + * @param id 分组内容管理描述表主键
  29 + * @return 分组内容管理描述表
  30 + */
  31 + @DataSource(DataSourceType.MASTER)
  32 + @Override
  33 + public ContentGroupManagementDescribe selectContentGroupManagementDescribeById(Integer id)
  34 + {
  35 + return contentGroupManagementDescribeMapper.selectContentGroupManagementDescribeById(id);
  36 + }
  37 +
  38 + /**
  39 + * 查询分组内容管理描述表列表
  40 + *
  41 + * @param contentGroupManagementDescribe 分组内容管理描述表
  42 + * @return 分组内容管理描述表
  43 + */
  44 + @DataSource(DataSourceType.MASTER)
  45 + @Override
  46 + public List<ContentGroupManagementDescribe> selectContentGroupManagementDescribeList(ContentGroupManagementDescribe contentGroupManagementDescribe)
  47 + {
  48 + return contentGroupManagementDescribeMapper.selectContentGroupManagementDescribeList(contentGroupManagementDescribe);
  49 + }
  50 +
  51 + /**
  52 + * 新增分组内容管理描述表
  53 + *
  54 + * @param contentGroupManagementDescribe 分组内容管理描述表
  55 + * @return 结果
  56 + */
  57 + @DataSource(DataSourceType.MASTER)
  58 + @Override
  59 + public int insertContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe)
  60 + {
  61 + return contentGroupManagementDescribeMapper.insertContentGroupManagementDescribe(contentGroupManagementDescribe);
  62 + }
  63 +
  64 + /**
  65 + * 修改分组内容管理描述表
  66 + *
  67 + * @param contentGroupManagementDescribe 分组内容管理描述表
  68 + * @return 结果
  69 + */
  70 + @DataSource(DataSourceType.MASTER)
  71 + @Override
  72 + public int updateContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe)
  73 + {
  74 + return contentGroupManagementDescribeMapper.updateContentGroupManagementDescribe(contentGroupManagementDescribe);
  75 + }
  76 +
  77 + /**
  78 + * 批量删除分组内容管理描述表
  79 + *
  80 + * @param ids 需要删除的分组内容管理描述表主键
  81 + * @return 结果
  82 + */
  83 + @DataSource(DataSourceType.MASTER)
  84 + @Override
  85 + public int deleteContentGroupManagementDescribeByIds(Integer[] ids)
  86 + {
  87 + return contentGroupManagementDescribeMapper.deleteContentGroupManagementDescribeByIds(ids);
  88 + }
  89 +
  90 + /**
  91 + * 删除分组内容管理描述表信息
  92 + *
  93 + * @param id 分组内容管理描述表主键
  94 + * @return 结果
  95 + */
  96 + @DataSource(DataSourceType.MASTER)
  97 + @Override
  98 + public int deleteContentGroupManagementDescribeById(Integer id)
  99 + {
  100 + return contentGroupManagementDescribeMapper.deleteContentGroupManagementDescribeById(id);
  101 + }
  102 +}
  1 +package com.zhonglai.luhui.order.service.service.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.ruoyi.system.domain.fish.FishPriceCollection;
  6 +import com.zhonglai.luhui.datasource.enums.DataSource;
  7 +import com.zhonglai.luhui.datasource.enums.DataSourceType;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import com.zhonglai.luhui.order.service.mapper.FishPriceCollectionMapper;
  11 +import com.zhonglai.luhui.order.service.service.IFishPriceCollectionService;
  12 +
  13 +/**
  14 + * 鱼价采集表Service业务层处理
  15 + *
  16 + * @author 钟来
  17 + * @date 2023-09-25
  18 + */
  19 +@Service
  20 +public class FishPriceCollectionServiceImpl implements IFishPriceCollectionService
  21 +{
  22 + @Autowired
  23 + private FishPriceCollectionMapper fishPriceCollectionMapper;
  24 +
  25 + /**
  26 + * 查询鱼价采集表
  27 + *
  28 + * @param id 鱼价采集表主键
  29 + * @return 鱼价采集表
  30 + */
  31 + @DataSource(DataSourceType.MASTER)
  32 + @Override
  33 + public FishPriceCollection selectFishPriceCollectionById(Integer id)
  34 + {
  35 + return fishPriceCollectionMapper.selectFishPriceCollectionById(id);
  36 + }
  37 +
  38 + /**
  39 + * 查询鱼价采集表列表
  40 + *
  41 + * @param fishPriceCollection 鱼价采集表
  42 + * @return 鱼价采集表
  43 + */
  44 + @DataSource(DataSourceType.MASTER)
  45 + @Override
  46 + public List<FishPriceCollection> selectFishPriceCollectionList(FishPriceCollection fishPriceCollection)
  47 + {
  48 + return fishPriceCollectionMapper.selectFishPriceCollectionList(fishPriceCollection);
  49 + }
  50 +
  51 + /**
  52 + * 新增鱼价采集表
  53 + *
  54 + * @param fishPriceCollection 鱼价采集表
  55 + * @return 结果
  56 + */
  57 + @DataSource(DataSourceType.MASTER)
  58 + @Override
  59 + public int insertFishPriceCollection(FishPriceCollection fishPriceCollection)
  60 + {
  61 + return fishPriceCollectionMapper.insertFishPriceCollection(fishPriceCollection);
  62 + }
  63 +
  64 + /**
  65 + * 修改鱼价采集表
  66 + *
  67 + * @param fishPriceCollection 鱼价采集表
  68 + * @return 结果
  69 + */
  70 + @DataSource(DataSourceType.MASTER)
  71 + @Override
  72 + public int updateFishPriceCollection(FishPriceCollection fishPriceCollection)
  73 + {
  74 + return fishPriceCollectionMapper.updateFishPriceCollection(fishPriceCollection);
  75 + }
  76 +
  77 + /**
  78 + * 批量删除鱼价采集表
  79 + *
  80 + * @param ids 需要删除的鱼价采集表主键
  81 + * @return 结果
  82 + */
  83 + @DataSource(DataSourceType.MASTER)
  84 + @Override
  85 + public int deleteFishPriceCollectionByIds(Integer[] ids)
  86 + {
  87 + return fishPriceCollectionMapper.deleteFishPriceCollectionByIds(ids);
  88 + }
  89 +
  90 + /**
  91 + * 删除鱼价采集表信息
  92 + *
  93 + * @param id 鱼价采集表主键
  94 + * @return 结果
  95 + */
  96 + @DataSource(DataSourceType.MASTER)
  97 + @Override
  98 + public int deleteFishPriceCollectionById(Integer id)
  99 + {
  100 + return fishPriceCollectionMapper.deleteFishPriceCollectionById(id);
  101 + }
  102 +}
  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.order.service.mapper.ContentGroupManagementDescribeMapper">
  6 +
  7 + <resultMap type="ContentGroupManagementDescribe" id="ContentGroupManagementDescribeResult">
  8 + <result property="content_group_management_id" column="content_group_management_id" />
  9 + <result property="create_time" column="create_time" />
  10 + <result property="describe" column="describe" />
  11 + <result property="id" column="id" />
  12 + <result property="update_time" column="update_time" />
  13 + </resultMap>
  14 +
  15 + <sql id="selectContentGroupManagementDescribeVo">
  16 + select `content_group_management_id`, `create_time`, `describe`, `id`, `update_time` from content_group_management_describe
  17 + </sql>
  18 +
  19 + <select id="selectContentGroupManagementDescribeList" parameterType="ContentGroupManagementDescribe" resultMap="ContentGroupManagementDescribeResult">
  20 + <include refid="selectContentGroupManagementDescribeVo"/>
  21 + <where>
  22 + <if test="content_group_management_id != null "> and content_group_management_id = #{content_group_management_id}</if>
  23 + <if test="params.beginCreate_time != null and params.beginCreate_time != '' and params.endCreate_time != null and params.endCreate_time != ''"> and create_time between #{params.beginCreate_time} and #{params.endCreate_time}</if>
  24 + <if test="id != null "> and id = #{id}</if>
  25 + <if test="params.beginUpdate_time != null and params.beginUpdate_time != '' and params.endUpdate_time != null and params.endUpdate_time != ''"> and update_time between #{params.beginUpdate_time} and #{params.endUpdate_time}</if>
  26 + </where>
  27 + </select>
  28 +
  29 + <select id="selectContentGroupManagementDescribeById" parameterType="Integer" resultMap="ContentGroupManagementDescribeResult">
  30 + <include refid="selectContentGroupManagementDescribeVo"/>
  31 + where id = #{id}
  32 + </select>
  33 +
  34 + <insert id="insertContentGroupManagementDescribe" parameterType="ContentGroupManagementDescribe" useGeneratedKeys="true" keyProperty="id">
  35 + insert into content_group_management_describe
  36 + <trim prefix="(" suffix=")" suffixOverrides=",">
  37 + <if test="content_group_management_id != null">`content_group_management_id`,</if>
  38 + <if test="create_time != null">`create_time`,</if>
  39 + <if test="describe != null and describe != ''">`describe`,</if>
  40 + <if test="update_time != null">`update_time`,</if>
  41 + </trim>
  42 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  43 + <if test="content_group_management_id != null">#{content_group_management_id},</if>
  44 + <if test="create_time != null">#{create_time},</if>
  45 + <if test="describe != null and describe != ''">#{describe},</if>
  46 + <if test="update_time != null">#{update_time},</if>
  47 + </trim>
  48 + </insert>
  49 +
  50 + <update id="updateContentGroupManagementDescribe" parameterType="ContentGroupManagementDescribe">
  51 + update content_group_management_describe
  52 + <trim prefix="SET" suffixOverrides=",">
  53 + <if test="content_group_management_id != null">`content_group_management_id` = #{content_group_management_id},</if>
  54 + <if test="create_time != null">`create_time` = #{create_time},</if>
  55 + <if test="describe != null and describe != ''">`describe` = #{describe},</if>
  56 + <if test="update_time != null">`update_time` = #{update_time},</if>
  57 + </trim>
  58 + where id = #{id}
  59 + </update>
  60 +
  61 + <delete id="deleteContentGroupManagementDescribeById" parameterType="Integer">
  62 + delete from content_group_management_describe where id = #{id}
  63 + </delete>
  64 +
  65 + <delete id="deleteContentGroupManagementDescribeByIds" parameterType="String">
  66 + delete from content_group_management_describe where id in
  67 + <foreach item="id" collection="array" open="(" separator="," close=")">
  68 + #{id}
  69 + </foreach>
  70 + </delete>
  71 +</mapper>
@@ -10,10 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -10,10 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
10 <result property="group_name" column="group_name" /> 10 <result property="group_name" column="group_name" />
11 <result property="id" column="id" /> 11 <result property="id" column="id" />
12 <result property="sort" column="sort" /> 12 <result property="sort" column="sort" />
  13 + <result property="update_time" column="update_time" />
13 </resultMap> 14 </resultMap>
14 15
15 <sql id="selectContentGroupManagementVo"> 16 <sql id="selectContentGroupManagementVo">
16 - select `content`, `create_time`, `group_name`, `id`, `sort` from content_group_management 17 + select `content`, `create_time`, `group_name`, `id`, `sort`,`update_time` from content_group_management
17 </sql> 18 </sql>
18 19
19 <select id="selectContentGroupManagementList" parameterType="ContentGroupManagement" resultMap="ContentGroupManagementResult"> 20 <select id="selectContentGroupManagementList" parameterType="ContentGroupManagement" resultMap="ContentGroupManagementResult">
@@ -22,8 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -22,8 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
22 <if test="params.beginCreate_time != null and params.beginCreate_time != '' and params.endCreate_time != null and params.endCreate_time != ''"> and create_time between #{params.beginCreate_time} and #{params.endCreate_time}</if> 23 <if test="params.beginCreate_time != null and params.beginCreate_time != '' and params.endCreate_time != null and params.endCreate_time != ''"> and create_time between #{params.beginCreate_time} and #{params.endCreate_time}</if>
23 <if test="group_name != null and group_name != ''"> and group_name like concat('%', #{group_name}, '%')</if> 24 <if test="group_name != null and group_name != ''"> and group_name like concat('%', #{group_name}, '%')</if>
24 <if test="id != null "> and id = #{id}</if> 25 <if test="id != null "> and id = #{id}</if>
25 - <if test="sort != null "> and sort = #{sort}</if>  
26 </where> 26 </where>
  27 + order by `sort` desc
27 </select> 28 </select>
28 29
29 <select id="selectContentGroupManagementById" parameterType="Integer" resultMap="ContentGroupManagementResult"> 30 <select id="selectContentGroupManagementById" parameterType="Integer" resultMap="ContentGroupManagementResult">
@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
54 <if test="create_time != null">create_time = #{create_time},</if> 55 <if test="create_time != null">create_time = #{create_time},</if>
55 <if test="group_name != null and group_name != ''">group_name = #{group_name},</if> 56 <if test="group_name != null and group_name != ''">group_name = #{group_name},</if>
56 <if test="sort != null">sort = #{sort},</if> 57 <if test="sort != null">sort = #{sort},</if>
  58 + <if test="update_time != null">update_time = #{update_time},</if>
57 </trim> 59 </trim>
58 where id = #{id} 60 where id = #{id}
59 </update> 61 </update>
  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.order.service.mapper.FishPriceCollectionMapper">
  6 +
  7 + <resultMap type="FishPriceCollection" id="FishPriceCollectionResult">
  8 + <result property="city" column="city" />
  9 + <result property="collection_data" column="collection_data" />
  10 + <result property="collection_source" column="collection_source" />
  11 + <result property="collection_time" column="collection_time" />
  12 + <result property="fish_species" column="fish_species" />
  13 + <result property="id" column="id" />
  14 + <result property="price" column="price" />
  15 + <result property="province" column="province" />
  16 + <result property="publish_time" column="publish_time" />
  17 + <result property="specification" column="specification" />
  18 + </resultMap>
  19 +
  20 + <sql id="selectFishPriceCollectionVo">
  21 + select `city`, `collection_data`, `collection_source`, `collection_time`, `fish_species`, `id`, `price`, `province`, `publish_time`, `specification` from fish_price_collection
  22 + </sql>
  23 +
  24 + <select id="selectFishPriceCollectionList" parameterType="FishPriceCollection" resultMap="FishPriceCollectionResult">
  25 + <include refid="selectFishPriceCollectionVo"/>
  26 + <where>
  27 + <if test="city != null and city != ''"> and city like concat('%', #{city}, '%')</if>
  28 + <if test="collection_source != null and collection_source != ''"> and collection_source like concat('%', #{collection_source}, '%')</if>
  29 + <if test="params.beginCollection_time != null and params.beginCollection_time != '' and params.endCollection_time != null and params.endCollection_time != ''"> and collection_time between #{params.beginCollection_time} and #{params.endCollection_time}</if>
  30 + <if test="fish_species != null and fish_species != ''"> and fish_species like concat('%', #{fish_species}, '%')</if>
  31 + <if test="id != null "> and id = #{id}</if>
  32 + <if test="province != null and province != ''"> and province like concat('%', #{province}, '%')</if>
  33 + <if test="params.beginPublish_time != null and params.beginPublish_time != '' and params.endPublish_time != null and params.endPublish_time != ''"> and publish_time between #{params.beginPublish_time} and #{params.endPublish_time}</if>
  34 + <if test="specification != null and specification != ''"> and specification like concat('%', #{specification}, '%')</if>
  35 + </where>
  36 + order by publish_time desc
  37 + </select>
  38 +
  39 + <select id="selectFishPriceCollectionById" parameterType="Integer" resultMap="FishPriceCollectionResult">
  40 + <include refid="selectFishPriceCollectionVo"/>
  41 + where id = #{id}
  42 + </select>
  43 +
  44 + <insert id="insertFishPriceCollection" parameterType="FishPriceCollection" useGeneratedKeys="true" keyProperty="id">
  45 + insert into fish_price_collection
  46 + <trim prefix="(" suffix=")" suffixOverrides=",">
  47 + <if test="city != null and city != ''">city,</if>
  48 + <if test="collection_data != null and collection_data != ''">collection_data,</if>
  49 + <if test="collection_source != null and collection_source != ''">collection_source,</if>
  50 + <if test="collection_time != null">collection_time,</if>
  51 + <if test="fish_species != null and fish_species != ''">fish_species,</if>
  52 + <if test="price != null">price,</if>
  53 + <if test="province != null and province != ''">province,</if>
  54 + <if test="publish_time != null">publish_time,</if>
  55 + <if test="specification != null and specification != ''">specification,</if>
  56 + </trim>
  57 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  58 + <if test="city != null and city != ''">#{city},</if>
  59 + <if test="collection_data != null and collection_data != ''">#{collection_data},</if>
  60 + <if test="collection_source != null and collection_source != ''">#{collection_source},</if>
  61 + <if test="collection_time != null">#{collection_time},</if>
  62 + <if test="fish_species != null and fish_species != ''">#{fish_species},</if>
  63 + <if test="price != null">#{price},</if>
  64 + <if test="province != null and province != ''">#{province},</if>
  65 + <if test="publish_time != null">#{publish_time},</if>
  66 + <if test="specification != null and specification != ''">#{specification},</if>
  67 + </trim>
  68 + </insert>
  69 +
  70 + <update id="updateFishPriceCollection" parameterType="FishPriceCollection">
  71 + update fish_price_collection
  72 + <trim prefix="SET" suffixOverrides=",">
  73 + <if test="city != null and city != ''">city = #{city},</if>
  74 + <if test="collection_data != null and collection_data != ''">collection_data = #{collection_data},</if>
  75 + <if test="collection_source != null and collection_source != ''">collection_source = #{collection_source},</if>
  76 + <if test="collection_time != null">collection_time = #{collection_time},</if>
  77 + <if test="fish_species != null and fish_species != ''">fish_species = #{fish_species},</if>
  78 + <if test="price != null">price = #{price},</if>
  79 + <if test="province != null and province != ''">province = #{province},</if>
  80 + <if test="publish_time != null">publish_time = #{publish_time},</if>
  81 + <if test="specification != null and specification != ''">specification = #{specification},</if>
  82 + </trim>
  83 + where id = #{id}
  84 + </update>
  85 +
  86 + <delete id="deleteFishPriceCollectionById" parameterType="Integer">
  87 + delete from fish_price_collection where id = #{id}
  88 + </delete>
  89 +
  90 + <delete id="deleteFishPriceCollectionByIds" parameterType="String">
  91 + delete from fish_price_collection where id in
  92 + <foreach item="id" collection="array" open="(" separator="," close=")">
  93 + #{id}
  94 + </foreach>
  95 + </delete>
  96 +</mapper>
1 package com.zhonglai.luhui.admin.service; 1 package com.zhonglai.luhui.admin.service;
2 2
  3 +import com.ruoyi.system.domain.entity.SysUser;
3 import com.zhonglai.luhui.security.service.AdminDetailsService; 4 import com.zhonglai.luhui.security.service.AdminDetailsService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.stereotype.Service; 6 import org.springframework.stereotype.Service;
5 7
  8 +import java.util.Set;
  9 +
6 @Service 10 @Service
7 public class AdminDetailsServiceImpl extends AdminDetailsService { 11 public class AdminDetailsServiceImpl extends AdminDetailsService {
  12 + @Autowired
  13 + private SysPermissionService permissionService;
  14 + @Override
  15 + public Set<String> getMenuPermission(SysUser user) {
  16 + return permissionService.getMenuPermission(user);
  17 + }
8 } 18 }
1 -package com.zhonglai.luhui.admin.service;  
2 -  
3 -import com.ruoyi.system.domain.entity.SysUser;  
4 -import com.ruoyi.common.enums.UserStatus;  
5 -import com.ruoyi.common.exception.ServiceException;  
6 -import com.ruoyi.common.utils.StringUtils;  
7 -import com.zhonglai.luhui.security.dto.SysLoginUser;  
8 -import com.zhonglai.luhui.sys.service.ISysUserService;  
9 -import org.slf4j.Logger;  
10 -import org.slf4j.LoggerFactory;  
11 -import org.springframework.beans.factory.annotation.Autowired;  
12 -import org.springframework.security.core.userdetails.UserDetails;  
13 -import org.springframework.security.core.userdetails.UserDetailsService;  
14 -import org.springframework.security.core.userdetails.UsernameNotFoundException;  
15 -import org.springframework.stereotype.Service;  
16 -  
17 -/**  
18 - * 用户验证处理  
19 - *  
20 - * @author ruoyi  
21 - */  
22 -@Service  
23 -public class SysUserDetailsServiceImpl implements UserDetailsService  
24 -{  
25 - private static final Logger log = LoggerFactory.getLogger(SysUserDetailsServiceImpl.class);  
26 -  
27 - @Autowired  
28 - private ISysUserService userService;  
29 -  
30 - @Autowired  
31 - private SysPermissionService permissionService;  
32 -  
33 - @Override  
34 - public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException  
35 - {  
36 - SysUser user = userService.selectUserByUserName(username);  
37 - if (StringUtils.isNull(user))  
38 - {  
39 - log.info("登录用户:{} 不存在.", username);  
40 - throw new ServiceException("登录用户:" + username + " 不存在");  
41 - }  
42 - else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))  
43 - {  
44 - log.info("登录用户:{} 已被删除.", username);  
45 - throw new ServiceException("对不起,您的账号:" + username + " 已被删除");  
46 - }  
47 - else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))  
48 - {  
49 - log.info("登录用户:{} 已被停用.", username);  
50 - throw new ServiceException("对不起,您的账号:" + username + " 已停用");  
51 - }  
52 -  
53 - return createLoginUser(user);  
54 - }  
55 -  
56 - public UserDetails createLoginUser(SysUser user)  
57 - {  
58 - return new SysLoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));  
59 - }  
60 -}  
1 package com.zhonglai.luhui.afms.service.impl; 1 package com.zhonglai.luhui.afms.service.impl;
2 2
  3 +import com.ruoyi.system.domain.entity.SysUser;
3 import com.zhonglai.luhui.security.service.AdminDetailsService; 4 import com.zhonglai.luhui.security.service.AdminDetailsService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.stereotype.Service; 6 import org.springframework.stereotype.Service;
5 7
  8 +import java.util.HashSet;
  9 +import java.util.Set;
  10 +
6 @Service 11 @Service
7 public class AdminDetailsServiceImpl extends AdminDetailsService { 12 public class AdminDetailsServiceImpl extends AdminDetailsService {
  13 + @Override
  14 + public Set<String> getMenuPermission(SysUser user) {
  15 + Set<String> set = new HashSet<>();
  16 + set.add("*:*:*");
  17 + return set;
  18 + }
8 } 19 }
1 -# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 18080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 47.112.163.61 # 端口,默认为6379 port: 9527 # 数据库索引 database: 1 # 密码 password: Luhui586 # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 rediskey: lh-api # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain,com.zhonglai.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login/ApiLogin/*,/content/**,/test/** # NameServer地址 rocketmq: name-server: 47.115.144.179:9876 # 默认的消息组 producer: group: deviceCommand send-message-timeout: 30000 send-topic: lh-mqtt-service-deviceCommand-test send-tags: 1  
  1 +# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 18080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 47.112.163.61 # 端口,默认为6379 port: 9527 # 数据库索引 database: 1 # 密码 password: Luhui586 # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 rediskey: lh-api # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain,com.zhonglai.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login/ApiLogin/*,/content/**,/test/**,/fish/FishPriceCollection/* # NameServer地址 rocketmq: name-server: 47.115.144.179:9876 # 默认的消息组 producer: group: deviceCommand send-message-timeout: 30000 send-topic: lh-mqtt-service-deviceCommand-test send-tags: 1
@@ -48,6 +48,11 @@ @@ -48,6 +48,11 @@
48 <groupId>org.aspectj</groupId> 48 <groupId>org.aspectj</groupId>
49 <artifactId>aspectjrt</artifactId> 49 <artifactId>aspectjrt</artifactId>
50 </dependency> 50 </dependency>
  51 + <!-- Mysql驱动包 -->
  52 + <dependency>
  53 + <groupId>mysql</groupId>
  54 + <artifactId>mysql-connector-java</artifactId>
  55 + </dependency>
51 </dependencies> 56 </dependencies>
52 57
53 <build> 58 <build>
@@ -73,7 +78,7 @@ @@ -73,7 +78,7 @@
73 生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/ 78 生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/
74 --> 79 -->
75 <classpathPrefix>lib/</classpathPrefix> 80 <classpathPrefix>lib/</classpathPrefix>
76 - <mainClass>com.zhonglai.luhui.http.service.LhHttpServiceApplication</mainClass> 81 + <mainClass>com.zhonglai.luhui.login.LhLoginApplication</mainClass>
77 </manifest> 82 </manifest>
78 </archive> 83 </archive>
79 </configuration> 84 </configuration>
1 package com.zhonglai.luhui.login.service; 1 package com.zhonglai.luhui.login.service;
2 2
  3 +import com.ruoyi.system.domain.entity.SysUser;
3 import com.zhonglai.luhui.security.service.AdminDetailsService; 4 import com.zhonglai.luhui.security.service.AdminDetailsService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.stereotype.Service; 6 import org.springframework.stereotype.Service;
5 7
  8 +import java.util.HashSet;
  9 +import java.util.Set;
  10 +
6 @Service 11 @Service
7 public class AdminDetailsServiceImpl extends AdminDetailsService { 12 public class AdminDetailsServiceImpl extends AdminDetailsService {
  13 + @Override
  14 + public Set<String> getMenuPermission(SysUser user) {
  15 + Set<String> set = new HashSet<>();
  16 + set.add("*:*:*");
  17 + return set;
  18 + }
8 } 19 }
  1 +package com.zhonglai.luhui.smart.feeder.pureness;
  2 +
  3 +public class Main {
  4 + public static void main(String[] args) {
  5 + System.out.println("Hello world!");
  6 + }
  7 +}
  1 +package com.zhonglai.luhui.smart.feeder.pureness.service;
  2 +
  3 +import cn.hutool.json.JSONObject;
  4 +import org.eclipse.paho.client.mqttv3.*;
  5 +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
  6 +
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +
  10 +import java.util.HashMap;
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +
  14 +public class TerminalService {
  15 + private static final Logger log = LoggerFactory.getLogger(TerminalService.class);
  16 +
  17 + private MqttClient mqttclient;
  18 + private MqttConnectOptions options;
  19 +
  20 + private MqttCallback mqttCallback;
  21 +
  22 + private String broker;
  23 + private String clientId;
  24 +
  25 + private List<String> topics;
  26 +
  27 +
  28 + private List<String> mqtt_usernames;
  29 +
  30 + private String username;
  31 + private String password;
  32 +
  33 + public void startMqttListenerService() throws MqttException {
  34 + log.info("-----------开始启动mqtt监听服务--------------------");
  35 + init();
  36 + connect();
  37 + subscribe();
  38 +
  39 + Map<String,Object> dmap = new HashMap<>();
  40 + Map<String,Object> map = new HashMap<>();
  41 + dmap.put("summary",map);
  42 +// map.put("localhostIp",IpUtils.getLocalHost());
  43 + JSONObject jsonObject = new JSONObject();
  44 + jsonObject.put("0",dmap);
  45 + String topic = "ADD_POST";
  46 +// publish(topic,jsonObject.toJSONString());
  47 + }
  48 +
  49 +
  50 + public void init() throws MqttException {
  51 + if(null == mqttclient)
  52 + {
  53 + mqttclient = new MqttClient(broker, clientId, new MemoryPersistence());
  54 + }
  55 + options = new MqttConnectOptions();
  56 + options.setCleanSession(true);
  57 + options.setConnectionTimeout(15);
  58 + //设置断开后重新连接
  59 + options.setAutomaticReconnect(true);
  60 + mqttclient.setCallback(mqttCallback);
  61 + }
  62 +
  63 + private void connect() throws MqttException {
  64 + options.setUserName(username);
  65 + options.setPassword(password.toCharArray());
  66 + mqttclient.connect(options);
  67 + }
  68 +
  69 + public void subscribe() throws MqttException {
  70 + mqttclient.subscribe(topics.toArray(new String[topics.size()]));
  71 + }
  72 +
  73 + public void publish(String topic, MqttMessage message) throws MqttException {
  74 + mqttclient.publish(topic,message);
  75 + }
  76 +
  77 + public void publish(String topic, String messageStr) throws MqttException {
  78 + MqttMessage message = new MqttMessage();
  79 + message.setPayload(messageStr.getBytes());
  80 + mqttclient.publish(topic,message);
  81 + }
  82 +
  83 + public void scheduledSubmissionData(String messageStr) throws MqttException {
  84 + String topic = "ALL_POST";
  85 + publish(topic,messageStr);
  86 + }
  87 +
  88 + public void close()
  89 + {
  90 + try {
  91 + options.setAutomaticReconnect(false);
  92 + if(null != mqttclient && mqttclient.isConnected())
  93 + {
  94 + mqttclient.disconnect();
  95 + mqttclient.close();
  96 + }
  97 +
  98 + } catch (MqttException e) {
  99 + log.error("关闭失败",e);
  100 + }
  101 + }
  102 +}
@@ -91,7 +91,7 @@ public class OpenCVUtil { @@ -91,7 +91,7 @@ public class OpenCVUtil {
91 logger.info("打开化摄像头"+i+"失败"); 91 logger.info("打开化摄像头"+i+"失败");
92 } 92 }
93 } 93 }
94 - return null; 94 + throw new RuntimeException("未检测到摄像头");
95 } 95 }
96 96
97 public static VideoCapture readVideoCaptureForVideo(String videoPath ) 97 public static VideoCapture readVideoCaptureForVideo(String videoPath )
@@ -8,7 +8,6 @@ import org.slf4j.LoggerFactory; @@ -8,7 +8,6 @@ import org.slf4j.LoggerFactory;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
10 10
11 -import javax.annotation.PostConstruct;  
12 import java.util.concurrent.ScheduledExecutorService; 11 import java.util.concurrent.ScheduledExecutorService;
13 import java.util.concurrent.ScheduledFuture; 12 import java.util.concurrent.ScheduledFuture;
14 import java.util.concurrent.TimeUnit; 13 import java.util.concurrent.TimeUnit;
@@ -37,43 +36,12 @@ public class CameraService { @@ -37,43 +36,12 @@ public class CameraService {
37 */ 36 */
38 private void openCapture() 37 private void openCapture()
39 { 38 {
40 -// videoCapture = OpenCVUtil.readVideoCaptureForVideo((Integer) configurationParameterService.getConfig(ConfigurationParameter.captureNumber));  
41 videoCapture = OpenCVUtil.openCapture(); 39 videoCapture = OpenCVUtil.openCapture();
42 if(null == videoCapture) 40 if(null == videoCapture)
43 { 41 {
44 return; 42 return;
45 } 43 }
46 monitorCapture(); 44 monitorCapture();
47 -  
48 -// if (!videoIsOpen)  
49 -// {  
50 -// logger.info("摄像头打开失败尝试自动识别流程");  
51 -// int i=0;  
52 -// int j =0;  
53 -// while (!videoIsOpen && i<10)  
54 -// {  
55 -// logger.info("等待3秒");  
56 -// try {  
57 -// Thread.sleep(1000);  
58 -// } catch (InterruptedException e) {  
59 -// throw new RuntimeException(e);  
60 -// }  
61 -// logger.info("开始尝试:"+i);  
62 -// videoCapture = OpenCVUtil.readVideoCaptureForVideo(i);  
63 -// monitorCapture();  
64 -// if(!videoIsOpen && j>=3)  
65 -// {  
66 -// j=0;  
67 -// i++;  
68 -// }  
69 -// j++;  
70 -// }  
71 -// if(!videoIsOpen)  
72 -// {  
73 -// logger.info("尝试0-10都没有成功退出尝试");  
74 -// }  
75 -//  
76 -// }  
77 } 45 }
78 46
79 47