作者 钟来

模块整理

正在显示 38 个修改的文件 包含 1389 行增加379 行删除
package com.ruoyi.system.domain.fish;
import com.ruoyi.common.tool.BaseEntity;
public class FishPriceCollection extends BaseEntity {
private Integer id; // INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
private String province; // VARCHAR(100) NOT NULL COMMENT '省',
private String city; // VARCHAR(100) NOT NULL COMMENT '市',
private String fish_species; // VARCHAR(100) NOT NULL COMMENT '鱼种',
private String specification; // VARCHAR(100) NOT NULL COMMENT '规格',
private Double price; // DECIMAL(10,2) NOT NULL COMMENT '价格',
private String publish_time; // DATETIME NOT NULL COMMENT '发布时间',
private String collection_time; // DATETIME NOT NULL COMMENT '采集时间',
private String collection_source; // VARCHAR(255) NOT NULL COMMENT '采集源',
private String collection_data; // TEXT NOT NULL COMMENT '采集数据',
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public String getCollection_time() {
return collection_time;
}
public void setCollection_time(String collection_time) {
this.collection_time = collection_time;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getFish_species() {
return fish_species;
}
public void setFish_species(String fish_species) {
this.fish_species = fish_species;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
public String getPublish_time() {
return publish_time;
}
public void setPublish_time(String publish_time) {
this.publish_time = publish_time;
}
public String getCollection_source() {
return collection_source;
}
public void setCollection_source(String collection_source) {
this.collection_source = collection_source;
}
public String getCollection_data() {
return collection_data;
}
public void setCollection_data(String collection_data) {
this.collection_data = collection_data;
}
}
... ...
... ... @@ -38,7 +38,14 @@
<groupId>com.zhonglai.luhui</groupId>
<artifactId>lh-jar-action</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
package com.ruoyi.quartz.controller;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.quartz.task.YudadaGrabTask;
import com.zhonglai.luhui.action.BaseController;
import com.zhonglai.luhui.security.utils.SecurityUtils;
import com.zhonglai.luhui.sys.utils.ExcelUtil;
... ... @@ -186,4 +189,13 @@ public class SysJobController extends BaseController
jobService.deleteJobByIds(jobIds);
return AjaxResult.success();
}
@ApiOperation("执行指定任务")
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@PostMapping("/exeTask")
public AjaxResult exeTask(String beanname,String fondname) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Object beanobject = SpringUtils.getBean(beanname);
beanobject.getClass().getMethod(fondname).invoke(beanobject);
return AjaxResult.success();
}
}
... ...
... ... @@ -99,4 +99,6 @@ public interface ISysJobService
* @return 结果
*/
public boolean checkCronExpressionIsValid(String cronExpression);
}
... ...
package com.zhonglai.luhui.admin.task;
package com.ruoyi.quartz.task;
import org.springframework.stereotype.Component;
... ...
package com.zhonglai.luhui.admin.task;
package com.ruoyi.quartz.task;
import com.ruoyi.common.utils.DateUtils;
import com.zhonglai.luhui.dao.service.PublicService;
... ...
package com.zhonglai.luhui.admin.task;
package com.ruoyi.quartz.task;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.StrUtil;
... ...
package com.zhonglai.luhui.admin.task;
package com.ruoyi.quartz.task;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ReUtil;
... ...
package com.ruoyi.quartz.task;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.GsonConstructor;
import com.ruoyi.system.domain.fish.FishPriceCollection;
import com.zhonglai.luhui.dao.service.PublicService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 鱼大大抓取
*/
@Component("yudadaGrabTask")
public class YudadaGrabTask {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private PublicService publicService;
public void gatherSalesList()
{
long maxTime = getMaxTime();
int pageNo = 1;
while (pageNo != -1)
{
try {
Thread.sleep(new Double(Math.random()*10000).longValue());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
String str = getSalesList(pageNo++);
JsonObject jsonObject = GsonConstructor.get().fromJson(str, JsonObject.class);
if (jsonObject.has("code") && jsonObject.get("code").getAsInt()==1)
{
if(jsonObject.has("data") && null != jsonObject.get("code") && !jsonObject.get("data").isJsonNull())
{
JsonArray jsonArray = jsonObject.get("data").getAsJsonArray();
if(null != jsonArray && jsonArray.size() != 0)
{
List<FishPriceCollection> fishPriceCollectionList = new ArrayList<>();
for(int i=0;i<jsonArray.size();i++)
{
try {
JsonObject fishObject = jsonArray.get(i).getAsJsonObject();
FishPriceCollection fishPriceCollection = new FishPriceCollection();
fishPriceCollection.setProvince(fishObject.get("provinceName").getAsString());
fishPriceCollection.setCity(fishObject.get("cityName").getAsString());
fishPriceCollection.setFish_species(fishObject.get("fishTypeName").getAsString());
if(fishObject.has("specifications") && !fishObject.get("specifications").isJsonNull() && !"".equals(fishObject.get("specifications").getAsString()))
{
fishPriceCollection.setSpecification(fishObject.get("specifications").getAsString());
}else {
fishPriceCollection.setSpecification(fishObject.get("quantityTagList").getAsJsonArray().get(0).getAsJsonObject().get("tagName").getAsString());
}
if(fishObject.has("demandInfoSale"))
{
JsonObject demandInfoSale = fishObject.get("demandInfoSale").getAsJsonObject();
String lowerPrice = null;
if(demandInfoSale.has("lowerPrice") && !demandInfoSale.get("lowerPrice").isJsonNull())
{
lowerPrice =demandInfoSale.get("lowerPrice").getAsString();
}else {
lowerPrice = demandInfoSale.get("expectedPrice").getAsString();
}
fishPriceCollection.setPrice(getAsDouble(lowerPrice));
}
long time = fishObject.get("sort").getAsInt()*1000l;
fishPriceCollection.setPublish_time(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,new Date(time)));
fishPriceCollection.setCollection_time(DateUtils.parseDateToStr(DateUtils.getTime(),new Date()));
fishPriceCollection.setCollection_source("鱼大大");
fishPriceCollection.setCollection_data(fishObject.toString());
if(maxTime>time)
{
pageNo = -1;
break;
}
fishPriceCollectionList.add(fishPriceCollection);
}catch (Exception e)
{
logger.error("数据解析错误:"+jsonArray.get(i).toString(),e);
}
}
publicService.insertAll(fishPriceCollectionList);
}
}
else {
pageNo = -1;
}
}else {
pageNo = -1;
}
}
}
private long getMaxTime()
{
List<Map<String,Object>> list = publicService.getObjectListBySQL("SELECT MAX(publish_time) m_publish_time FROM fish_price_collection WHERE collection_source='鱼大大'");
if(null != list && list.size() != 0 && list.get(0).containsKey("m_publish_time"))
{
return DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,String.valueOf(list.get(0).get("m_publish_time"))).getTime();
}
return 0;
}
/**
* 从一个字符串中提取出所有类型的数字
* @return
*/
private double getAsDouble(String input)
{
// 使用正则表达式匹配所有类型的数字
String regex = "-?\\d+(\\.\\d+)?|0[xX][0-9a-fA-F]+";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
// 提取所有类型的数字并打印
while (matcher.find()) {
String match = matcher.group();
if (match.contains(".")) {
double number = Double.parseDouble(match);
return number;
} else if (match.startsWith("0x") || match.startsWith("0X")) {
int number = Integer.parseInt(match.substring(2), 16);
return number;
} else {
int number = Integer.parseInt(match);
return number;
}
}
return 0;
}
private String getSalesList(Integer pageNo)
{
String url = "http://api.yudada.com/demandInfo/list";
HttpRequest httpRequest = HttpUtil.createGet(url);
httpRequest = httpRequest
.form("type",2).
form("pageSize",20).
form("pageNo",pageNo).
form("hasTop",false).
form("fishStage",0).
form("topStrategy",1)
.headerMap(empower(),true);
String str = httpRequest.timeout(15000).execute().body();
return str;
}
private static Map<String,String> empower()
{
Map<String,String> headers = new HashMap<>();
headers.put("device-id","C3A70374-DD06-4C01-B35C-E8F9FC69F1D9");
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");
headers.put("access-token","88832b9fe8514362b2be081de4ede250");
headers.put("client-type","iOS");
headers.put("client-version","1.26");
headers.put("device-model","iPhone11,6");
headers.put("Content-Type","application/json");
return headers;
}
}
... ...
... ... @@ -15,6 +15,8 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import java.util.Set;
/**
* 用户验证处理
*
... ... @@ -50,6 +52,8 @@ public abstract class AdminDetailsService implements UserDetailsService
public UserDetails createLoginUser(SysUser user)
{
return new SysLoginUser(user.getUserId(), user.getDeptId(), user,null).setSysLogininforType(SysLogininforType.lhAdmin);
return new SysLoginUser(user.getUserId(), user.getDeptId(), user,getMenuPermission(user)).setSysLogininforType(SysLogininforType.lhAdmin);
}
public abstract Set<String> getMenuPermission(SysUser user);
}
... ...
... ... @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.zhonglai.luhui.security.dto.BaseLoginUser;
import com.zhonglai.luhui.redis.service.RedisCache;
import com.zhonglai.luhui.security.dto.SysLoginUser;
import eu.bitwalker.useragentutils.UserAgent;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
... ... @@ -78,8 +79,11 @@ public class TokenService
String userKey = getTokenKey(uuid);
Collection<String> keys = redisCache.keys(userKey);
BaseLoginUser user = redisCache.getCacheObject(keys.stream().findFirst().get());
return user;
if(null != keys && keys.size() != 0)
{
SysLoginUser user = redisCache.getCacheObject(keys.stream().findFirst().get());
return user;
}
}
catch (Exception e)
{
... ...
... ... @@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">`$column.columnName`,</if>
#end
#end
</trim>
... ... @@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">`$column.columnName` = #{$column.javaField},</if>
#end
#end
</trim>
... ...
package com.zhonglai.luhui.central.control;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.Message;
import com.ruoyi.common.core.domain.MessageCode;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.html.HttpUtils;
import com.zhonglai.luhui.device.domain.IotDevice;
import com.zhonglai.luhui.redis.service.RedisCache;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@Service
public class DeviceControlService {
@Autowired
private RedisCache redisCache;
private String redisHostPath = "luhui:mqttservice:device:device:";
@Autowired
private DeviceDBOperationService deviceDBOperationService;
private IotDevice getRedisIotDevice(String imei)
{
return (IotDevice)redisCache.getCacheObject(redisHostPath+imei);
}
/**
* 固件版本更新
* @param imei 主机imei
* @param firmwareVersion 版本号
* @param code 版本码
* @return
*/
public Message firmwareUp(String imei,String firmwareVersion,Integer code)
{
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
Map<String,Object> valueMap = new HashMap<>();
valueMap.put("firmwareVersion",firmwareVersion);
valueMap.put("code",code);
return post(url, jsonObject -> jsonObject.put("0",valueMap));
}
/**
* 设备重启
* @param imei 主机imei
* @param restart 1重启,2复位,3恢复出厂值
* @return
*/
public Message restart(String imei ,Integer restart)
{
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
Map<String,Object> map = new HashMap<>();
Map<String,Object> valueMap = new HashMap<>();
valueMap.put("restart",restart);
return post(url, jsonObject -> jsonObject.put("0",valueMap));
}
/**
* 获取指定设备版本信息
* @param imei 主机imei
* @return
* @throws IOException
*/
public Message getFirmwareVersion(String imei) throws IOException {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/getFirmwareVersion/"+iotDevice.getMqtt_username();
return postFrom(url, formBody -> {
});
}
/**
* 强行断开链接
* @param imei 主机imei
* @return
* @throws IOException
*/
public Message closeSession(String imei) {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/closeSession/"+imei;
return postFrom(url, formBody -> {
});
}
/**
* 删除主机
* @param imei 主机imei
* @return
*/
public Message delIotDevice(String imei) {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
deviceDBOperationService.deleteIotDeviceByClient_id(imei);
deviceDBOperationService.deleteIotTerminalByDeviceId(imei);
if(StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"删除成功");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/delIotDevice/"+imei;
return postFrom(url, formBody -> {
});
}
/**
* 删除终端
* @param imei 主机imei
* @param number 终端编号
* @return
*/
public Message delIotTerminal(String imei,String number) {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
deviceDBOperationService.deleteIotTerminalById(imei+"_"+number);
if(StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"删除成功");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/delIotTerminal/"+imei+"/"+number;
return postFrom(url, formBody -> {
});
}
/**
* 读取属性
* @param imei 主机imei
* @param sensor_number 传感器编号(0,1_1,10_1)
* @param attributes 属性集合(id1,id2,id3)
* @return
* @throws IOException
*/
public Message readAttribute(String imei,String sensor_number,String attributes) throws IOException {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/read/"+imei;
return post(url, jsonObject -> jsonObject.put(sensor_number,attributes));
}
/**
* 设置主机自定义参数
* @param imei 主机imei
* @param summary 自定义数据json字符串
* @return
* @throws IOException
*/
public Message upSummary(String imei,String summary) {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
Map<String,Object> valueMap = new HashMap<>();
valueMap.put("summary",JSONObject.parseObject(summary));
return post(url, jsonObject -> jsonObject.put("0",valueMap));
}
/**
* 修改指定终端属性
* @param imei 主机imei
* @param number 终端编号(如:1_1)
* @param config 配置参数json字符串
* @return
* @throws IOException
*/
public Message upTerminalConfig(String imei,String number,@RequestBody Map<String,Object> config) throws IOException {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
return post(url, jsonObject -> jsonObject.put(number,config));
}
/**
* 批量修改终端属性
* @param imei 主机imei
* @param map 批量数据json字符串
* @return
* @throws IOException
*/
public Message batchUpTerminalConfig(String imei,@RequestBody Map<String,Object> map) {
IotDevice iotDevice = getRedisIotDevice(imei);
if(null == iotDevice || StringUtils.isEmpty(iotDevice.getListen_service_ip()))
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"设备不在线");
}
String url = "http://"+iotDevice.getListen_service_ip()+"device/control/"+imei;
return post(url, jsonObject -> {
for (String key:map.keySet())
{
jsonObject.put(key, map.get(key));
}
});
}
private Message post(String url, HttpUtils.JsonBody jsonBody)
{
Response response = null;
try {
response = HttpUtils.postJsonBody(url, jsonBody);
if(null != response.body() && StringUtils.isNotEmpty(response.body().string()))
{
Message message = com.alibaba.fastjson.JSONObject.parseObject(response.body().string(),Message.class);
return message;
}
} catch (IOException e) {
return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令转发失败请联系管理员");
}
return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令执行失败请稍后重试");
}
private Message postFrom(String url,HttpUtils.FromBody fromBody )
{
Response response1 = null;
try {
response1 = HttpUtils.postFromBody(url, builder -> {
}, fromBody);
if(null != response1.body() && StringUtils.isNotEmpty(response1.body().string()))
{
Message message = com.alibaba.fastjson.JSONObject.parseObject(response1.body().string(),Message.class);
return message;
}
} catch (IOException e) {
return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令转发失败请联系管理员");
}
return new Message(MessageCode.DEFAULT_FAIL_CODE,"指令执行失败请稍后重试");
}
}
package com.zhonglai.luhui.central.control;
public interface DeviceDBOperationService {
int deleteIotDeviceByClient_id(String imei);
int deleteIotTerminalByDeviceId(String imei);
int deleteIotTerminalById(String id);
}
... ... @@ -67,7 +67,9 @@ public class ContentGroupManagementController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody ContentGroupManagement contentGroupManagement)
{
contentGroupManagement.setCreate_time(DateUtils.getNowTimeMilly());
contentGroupManagement.setUpdate_time(contentGroupManagement.getCreate_time());
return toAjax(contentGroupManagementService.insertContentGroupManagement(contentGroupManagement));
}
... ... @@ -79,6 +81,7 @@ public class ContentGroupManagementController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody ContentGroupManagement contentGroupManagement)
{
contentGroupManagement.setUpdate_time(DateUtils.getNowTimeMilly());
return toAjax(contentGroupManagementService.updateContentGroupManagement(contentGroupManagement));
}
... ...
package com.zhonglai.luhui.order.service.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.DateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.zhonglai.luhui.action.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
import com.zhonglai.luhui.order.service.service.IContentGroupManagementDescribeService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 分组内容管理描述表Controller
*
* @author 钟来
* @date 2023-09-26
*/
@Api(tags = "分组内容管理描述表")
@RestController
@RequestMapping("/content/ContentGroupManagementDescribe")
public class ContentGroupManagementDescribeController extends BaseController
{
@Autowired
private IContentGroupManagementDescribeService contentGroupManagementDescribeService;
/**
* 查询分组内容管理描述表列表
*/
@ApiOperation("查询分组内容管理描述表列表")
@GetMapping("/list")
public TableDataInfo list(ContentGroupManagementDescribe contentGroupManagementDescribe)
{
startPage();
List<ContentGroupManagementDescribe> list = contentGroupManagementDescribeService.selectContentGroupManagementDescribeList(contentGroupManagementDescribe);
return getDataTable(list);
}
/**
* 获取分组内容管理描述表详细信息
*/
@ApiOperation("获取分组内容管理描述表详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return AjaxResult.success(contentGroupManagementDescribeService.selectContentGroupManagementDescribeById(id));
}
/**
* 新增分组内容管理描述表
*/
@ApiOperation("新增分组内容管理描述表")
@Log(title = "分组内容管理描述表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ContentGroupManagementDescribe contentGroupManagementDescribe)
{
contentGroupManagementDescribe.setCreate_time(DateUtils.getNowTimeMilly());
contentGroupManagementDescribe.setUpdate_time(contentGroupManagementDescribe.getCreate_time());
return toAjax(contentGroupManagementDescribeService.insertContentGroupManagementDescribe(contentGroupManagementDescribe));
}
/**
* 修改分组内容管理描述表
*/
@ApiOperation("修改分组内容管理描述表")
@Log(title = "分组内容管理描述表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ContentGroupManagementDescribe contentGroupManagementDescribe)
{
contentGroupManagementDescribe.setUpdate_time(DateUtils.getNowTimeMilly());
return toAjax(contentGroupManagementDescribeService.updateContentGroupManagementDescribe(contentGroupManagementDescribe));
}
/**
* 删除分组内容管理描述表
*/
@ApiOperation("删除分组内容管理描述表")
@Log(title = "分组内容管理描述表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids)
{
return toAjax(contentGroupManagementDescribeService.deleteContentGroupManagementDescribeByIds(ids));
}
}
... ...
package com.zhonglai.luhui.order.service.controller;
import java.util.List;
import com.ruoyi.system.domain.fish.FishPriceCollection;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.zhonglai.luhui.action.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zhonglai.luhui.order.service.service.IFishPriceCollectionService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 鱼价采集表Controller
*
* @author 钟来
* @date 2023-09-25
*/
@Api(tags = "鱼价采集表")
@RestController
@RequestMapping("/fish/FishPriceCollection")
public class FishPriceCollectionController extends BaseController
{
@Autowired
private IFishPriceCollectionService fishPriceCollectionService;
/**
* 查询鱼价采集表列表
*/
@ApiOperation("查询鱼价采集表列表")
@GetMapping("/list")
public TableDataInfo list(FishPriceCollection fishPriceCollection)
{
startPage();
List<FishPriceCollection> list = fishPriceCollectionService.selectFishPriceCollectionList(fishPriceCollection);
return getDataTable(list);
}
/**
* 获取鱼价采集表详细信息
*/
@ApiOperation("获取鱼价采集表详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return AjaxResult.success(fishPriceCollectionService.selectFishPriceCollectionById(id));
}
/**
* 新增鱼价采集表
*/
@ApiOperation("新增鱼价采集表")
@Log(title = "鱼价采集表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FishPriceCollection fishPriceCollection)
{
return toAjax(fishPriceCollectionService.insertFishPriceCollection(fishPriceCollection));
}
/**
* 修改鱼价采集表
*/
@ApiOperation("修改鱼价采集表")
@Log(title = "鱼价采集表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FishPriceCollection fishPriceCollection)
{
return toAjax(fishPriceCollectionService.updateFishPriceCollection(fishPriceCollection));
}
/**
* 删除鱼价采集表
*/
@ApiOperation("删除鱼价采集表")
@Log(title = "鱼价采集表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids)
{
return toAjax(fishPriceCollectionService.deleteFishPriceCollectionByIds(ids));
}
}
... ...
... ... @@ -40,7 +40,18 @@ public class ContentGroupManagement extends BaseEntity
@ApiModelProperty("排序")
private Integer sort;
public void setContent(String content)
@ApiModelProperty("更新时间")
private Integer update_time;
public Integer getUpdate_time() {
return update_time;
}
public void setUpdate_time(Integer update_time) {
this.update_time = update_time;
}
public void setContent(String content)
{
this.content = content;
}
... ...
package com.zhonglai.luhui.order.service.domain;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.ruoyi.common.annotation.PublicSQLConfig;
import com.ruoyi.common.tool.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 分组内容管理描述表对象 content_group_management_describe
*
* @author 钟来
* @date 2023-09-26
*/
@ApiModel("分组内容管理描述表")
public class ContentGroupManagementDescribe extends BaseEntity
{
@PublicSQLConfig(isSelect=false)
private static final long serialVersionUID = 1L;
/** 分组内容管理表id */
@ApiModelProperty("分组内容管理表id")
private Integer content_group_management_id;
/** 创建时间 */
@ApiModelProperty("创建时间")
private Integer create_time;
/** 描述 */
@ApiModelProperty("描述")
private String describe;
/** 主键 */
@ApiModelProperty("主键")
private Integer id;
/** 更新时间 */
@ApiModelProperty("更新时间")
private Integer update_time;
public void setContent_group_management_id(Integer content_group_management_id)
{
this.content_group_management_id = content_group_management_id;
}
public Integer getContent_group_management_id()
{
return content_group_management_id;
}
public void setCreate_time(Integer create_time)
{
this.create_time = create_time;
}
public Integer getCreate_time()
{
return create_time;
}
public void setDescribe(String describe)
{
this.describe = describe;
}
public String getDescribe()
{
return describe;
}
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setUpdate_time(Integer update_time)
{
this.update_time = update_time;
}
public Integer getUpdate_time()
{
return update_time;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("content_group_management_id", getContent_group_management_id())
.append("create_time", getCreate_time())
.append("describe", getDescribe())
.append("id", getId())
.append("update_time", getUpdate_time())
.toString();
}
}
... ...
package com.zhonglai.luhui.order.service.mapper;
import java.util.List;
import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
/**
* 分组内容管理描述表Mapper接口
*
* @author 钟来
* @date 2023-09-26
*/
public interface ContentGroupManagementDescribeMapper
{
/**
* 查询分组内容管理描述表
*
* @param id 分组内容管理描述表主键
* @return 分组内容管理描述表
*/
public ContentGroupManagementDescribe selectContentGroupManagementDescribeById(Integer id);
/**
* 查询分组内容管理描述表列表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 分组内容管理描述表集合
*/
public List<ContentGroupManagementDescribe> selectContentGroupManagementDescribeList(ContentGroupManagementDescribe contentGroupManagementDescribe);
/**
* 新增分组内容管理描述表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 结果
*/
public int insertContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
/**
* 修改分组内容管理描述表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 结果
*/
public int updateContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
/**
* 删除分组内容管理描述表
*
* @param id 分组内容管理描述表主键
* @return 结果
*/
public int deleteContentGroupManagementDescribeById(Integer id);
/**
* 批量删除分组内容管理描述表
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteContentGroupManagementDescribeByIds(Integer[] ids);
}
... ...
package com.zhonglai.luhui.order.service.mapper;
import com.ruoyi.system.domain.fish.FishPriceCollection;
import java.util.List;
/**
* 鱼价采集表Mapper接口
*
* @author 钟来
* @date 2023-09-25
*/
public interface FishPriceCollectionMapper
{
/**
* 查询鱼价采集表
*
* @param id 鱼价采集表主键
* @return 鱼价采集表
*/
public FishPriceCollection selectFishPriceCollectionById(Integer id);
/**
* 查询鱼价采集表列表
*
* @param fishPriceCollection 鱼价采集表
* @return 鱼价采集表集合
*/
public List<FishPriceCollection> selectFishPriceCollectionList(FishPriceCollection fishPriceCollection);
/**
* 新增鱼价采集表
*
* @param fishPriceCollection 鱼价采集表
* @return 结果
*/
public int insertFishPriceCollection(FishPriceCollection fishPriceCollection);
/**
* 修改鱼价采集表
*
* @param fishPriceCollection 鱼价采集表
* @return 结果
*/
public int updateFishPriceCollection(FishPriceCollection fishPriceCollection);
/**
* 删除鱼价采集表
*
* @param id 鱼价采集表主键
* @return 结果
*/
public int deleteFishPriceCollectionById(Integer id);
/**
* 批量删除鱼价采集表
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteFishPriceCollectionByIds(Integer[] ids);
}
... ...
package com.zhonglai.luhui.order.service.service;
import java.util.List;
import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
/**
* 分组内容管理描述表Service接口
*
* @author 钟来
* @date 2023-09-26
*/
public interface IContentGroupManagementDescribeService
{
/**
* 查询分组内容管理描述表
*
* @param id 分组内容管理描述表主键
* @return 分组内容管理描述表
*/
public ContentGroupManagementDescribe selectContentGroupManagementDescribeById(Integer id);
/**
* 查询分组内容管理描述表列表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 分组内容管理描述表集合
*/
public List<ContentGroupManagementDescribe> selectContentGroupManagementDescribeList(ContentGroupManagementDescribe contentGroupManagementDescribe);
/**
* 新增分组内容管理描述表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 结果
*/
public int insertContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
/**
* 修改分组内容管理描述表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 结果
*/
public int updateContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe);
/**
* 批量删除分组内容管理描述表
*
* @param ids 需要删除的分组内容管理描述表主键集合
* @return 结果
*/
public int deleteContentGroupManagementDescribeByIds(Integer[] ids);
/**
* 删除分组内容管理描述表信息
*
* @param id 分组内容管理描述表主键
* @return 结果
*/
public int deleteContentGroupManagementDescribeById(Integer id);
}
... ...
package com.zhonglai.luhui.order.service.service;
import com.ruoyi.system.domain.fish.FishPriceCollection;
import java.util.List;
/**
* 鱼价采集表Service接口
*
* @author 钟来
* @date 2023-09-25
*/
public interface IFishPriceCollectionService
{
/**
* 查询鱼价采集表
*
* @param id 鱼价采集表主键
* @return 鱼价采集表
*/
public FishPriceCollection selectFishPriceCollectionById(Integer id);
/**
* 查询鱼价采集表列表
*
* @param fishPriceCollection 鱼价采集表
* @return 鱼价采集表集合
*/
public List<FishPriceCollection> selectFishPriceCollectionList(FishPriceCollection fishPriceCollection);
/**
* 新增鱼价采集表
*
* @param fishPriceCollection 鱼价采集表
* @return 结果
*/
public int insertFishPriceCollection(FishPriceCollection fishPriceCollection);
/**
* 修改鱼价采集表
*
* @param fishPriceCollection 鱼价采集表
* @return 结果
*/
public int updateFishPriceCollection(FishPriceCollection fishPriceCollection);
/**
* 批量删除鱼价采集表
*
* @param ids 需要删除的鱼价采集表主键集合
* @return 结果
*/
public int deleteFishPriceCollectionByIds(Integer[] ids);
/**
* 删除鱼价采集表信息
*
* @param id 鱼价采集表主键
* @return 结果
*/
public int deleteFishPriceCollectionById(Integer id);
}
... ...
package com.zhonglai.luhui.order.service.service.impl;
import java.util.List;
import com.zhonglai.luhui.datasource.enums.DataSource;
import com.zhonglai.luhui.datasource.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhonglai.luhui.order.service.mapper.ContentGroupManagementDescribeMapper;
import com.zhonglai.luhui.order.service.domain.ContentGroupManagementDescribe;
import com.zhonglai.luhui.order.service.service.IContentGroupManagementDescribeService;
/**
* 分组内容管理描述表Service业务层处理
*
* @author 钟来
* @date 2023-09-26
*/
@Service
public class ContentGroupManagementDescribeServiceImpl implements IContentGroupManagementDescribeService
{
@Autowired
private ContentGroupManagementDescribeMapper contentGroupManagementDescribeMapper;
/**
* 查询分组内容管理描述表
*
* @param id 分组内容管理描述表主键
* @return 分组内容管理描述表
*/
@DataSource(DataSourceType.MASTER)
@Override
public ContentGroupManagementDescribe selectContentGroupManagementDescribeById(Integer id)
{
return contentGroupManagementDescribeMapper.selectContentGroupManagementDescribeById(id);
}
/**
* 查询分组内容管理描述表列表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 分组内容管理描述表
*/
@DataSource(DataSourceType.MASTER)
@Override
public List<ContentGroupManagementDescribe> selectContentGroupManagementDescribeList(ContentGroupManagementDescribe contentGroupManagementDescribe)
{
return contentGroupManagementDescribeMapper.selectContentGroupManagementDescribeList(contentGroupManagementDescribe);
}
/**
* 新增分组内容管理描述表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int insertContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe)
{
return contentGroupManagementDescribeMapper.insertContentGroupManagementDescribe(contentGroupManagementDescribe);
}
/**
* 修改分组内容管理描述表
*
* @param contentGroupManagementDescribe 分组内容管理描述表
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int updateContentGroupManagementDescribe(ContentGroupManagementDescribe contentGroupManagementDescribe)
{
return contentGroupManagementDescribeMapper.updateContentGroupManagementDescribe(contentGroupManagementDescribe);
}
/**
* 批量删除分组内容管理描述表
*
* @param ids 需要删除的分组内容管理描述表主键
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int deleteContentGroupManagementDescribeByIds(Integer[] ids)
{
return contentGroupManagementDescribeMapper.deleteContentGroupManagementDescribeByIds(ids);
}
/**
* 删除分组内容管理描述表信息
*
* @param id 分组内容管理描述表主键
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int deleteContentGroupManagementDescribeById(Integer id)
{
return contentGroupManagementDescribeMapper.deleteContentGroupManagementDescribeById(id);
}
}
... ...
package com.zhonglai.luhui.order.service.service.impl;
import java.util.List;
import com.ruoyi.system.domain.fish.FishPriceCollection;
import com.zhonglai.luhui.datasource.enums.DataSource;
import com.zhonglai.luhui.datasource.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhonglai.luhui.order.service.mapper.FishPriceCollectionMapper;
import com.zhonglai.luhui.order.service.service.IFishPriceCollectionService;
/**
* 鱼价采集表Service业务层处理
*
* @author 钟来
* @date 2023-09-25
*/
@Service
public class FishPriceCollectionServiceImpl implements IFishPriceCollectionService
{
@Autowired
private FishPriceCollectionMapper fishPriceCollectionMapper;
/**
* 查询鱼价采集表
*
* @param id 鱼价采集表主键
* @return 鱼价采集表
*/
@DataSource(DataSourceType.MASTER)
@Override
public FishPriceCollection selectFishPriceCollectionById(Integer id)
{
return fishPriceCollectionMapper.selectFishPriceCollectionById(id);
}
/**
* 查询鱼价采集表列表
*
* @param fishPriceCollection 鱼价采集表
* @return 鱼价采集表
*/
@DataSource(DataSourceType.MASTER)
@Override
public List<FishPriceCollection> selectFishPriceCollectionList(FishPriceCollection fishPriceCollection)
{
return fishPriceCollectionMapper.selectFishPriceCollectionList(fishPriceCollection);
}
/**
* 新增鱼价采集表
*
* @param fishPriceCollection 鱼价采集表
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int insertFishPriceCollection(FishPriceCollection fishPriceCollection)
{
return fishPriceCollectionMapper.insertFishPriceCollection(fishPriceCollection);
}
/**
* 修改鱼价采集表
*
* @param fishPriceCollection 鱼价采集表
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int updateFishPriceCollection(FishPriceCollection fishPriceCollection)
{
return fishPriceCollectionMapper.updateFishPriceCollection(fishPriceCollection);
}
/**
* 批量删除鱼价采集表
*
* @param ids 需要删除的鱼价采集表主键
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int deleteFishPriceCollectionByIds(Integer[] ids)
{
return fishPriceCollectionMapper.deleteFishPriceCollectionByIds(ids);
}
/**
* 删除鱼价采集表信息
*
* @param id 鱼价采集表主键
* @return 结果
*/
@DataSource(DataSourceType.MASTER)
@Override
public int deleteFishPriceCollectionById(Integer id)
{
return fishPriceCollectionMapper.deleteFishPriceCollectionById(id);
}
}
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhonglai.luhui.order.service.mapper.ContentGroupManagementDescribeMapper">
<resultMap type="ContentGroupManagementDescribe" id="ContentGroupManagementDescribeResult">
<result property="content_group_management_id" column="content_group_management_id" />
<result property="create_time" column="create_time" />
<result property="describe" column="describe" />
<result property="id" column="id" />
<result property="update_time" column="update_time" />
</resultMap>
<sql id="selectContentGroupManagementDescribeVo">
select `content_group_management_id`, `create_time`, `describe`, `id`, `update_time` from content_group_management_describe
</sql>
<select id="selectContentGroupManagementDescribeList" parameterType="ContentGroupManagementDescribe" resultMap="ContentGroupManagementDescribeResult">
<include refid="selectContentGroupManagementDescribeVo"/>
<where>
<if test="content_group_management_id != null "> and content_group_management_id = #{content_group_management_id}</if>
<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>
<if test="id != null "> and id = #{id}</if>
<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>
</where>
</select>
<select id="selectContentGroupManagementDescribeById" parameterType="Integer" resultMap="ContentGroupManagementDescribeResult">
<include refid="selectContentGroupManagementDescribeVo"/>
where id = #{id}
</select>
<insert id="insertContentGroupManagementDescribe" parameterType="ContentGroupManagementDescribe" useGeneratedKeys="true" keyProperty="id">
insert into content_group_management_describe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="content_group_management_id != null">`content_group_management_id`,</if>
<if test="create_time != null">`create_time`,</if>
<if test="describe != null and describe != ''">`describe`,</if>
<if test="update_time != null">`update_time`,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="content_group_management_id != null">#{content_group_management_id},</if>
<if test="create_time != null">#{create_time},</if>
<if test="describe != null and describe != ''">#{describe},</if>
<if test="update_time != null">#{update_time},</if>
</trim>
</insert>
<update id="updateContentGroupManagementDescribe" parameterType="ContentGroupManagementDescribe">
update content_group_management_describe
<trim prefix="SET" suffixOverrides=",">
<if test="content_group_management_id != null">`content_group_management_id` = #{content_group_management_id},</if>
<if test="create_time != null">`create_time` = #{create_time},</if>
<if test="describe != null and describe != ''">`describe` = #{describe},</if>
<if test="update_time != null">`update_time` = #{update_time},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteContentGroupManagementDescribeById" parameterType="Integer">
delete from content_group_management_describe where id = #{id}
</delete>
<delete id="deleteContentGroupManagementDescribeByIds" parameterType="String">
delete from content_group_management_describe where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
... ...
... ... @@ -10,10 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="group_name" column="group_name" />
<result property="id" column="id" />
<result property="sort" column="sort" />
<result property="update_time" column="update_time" />
</resultMap>
<sql id="selectContentGroupManagementVo">
select `content`, `create_time`, `group_name`, `id`, `sort` from content_group_management
select `content`, `create_time`, `group_name`, `id`, `sort`,`update_time` from content_group_management
</sql>
<select id="selectContentGroupManagementList" parameterType="ContentGroupManagement" resultMap="ContentGroupManagementResult">
... ... @@ -22,8 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
<if test="group_name != null and group_name != ''"> and group_name like concat('%', #{group_name}, '%')</if>
<if test="id != null "> and id = #{id}</if>
<if test="sort != null "> and sort = #{sort}</if>
</where>
order by `sort` desc
</select>
<select id="selectContentGroupManagementById" parameterType="Integer" resultMap="ContentGroupManagementResult">
... ... @@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="create_time != null">create_time = #{create_time},</if>
<if test="group_name != null and group_name != ''">group_name = #{group_name},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="update_time != null">update_time = #{update_time},</if>
</trim>
where id = #{id}
</update>
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhonglai.luhui.order.service.mapper.FishPriceCollectionMapper">
<resultMap type="FishPriceCollection" id="FishPriceCollectionResult">
<result property="city" column="city" />
<result property="collection_data" column="collection_data" />
<result property="collection_source" column="collection_source" />
<result property="collection_time" column="collection_time" />
<result property="fish_species" column="fish_species" />
<result property="id" column="id" />
<result property="price" column="price" />
<result property="province" column="province" />
<result property="publish_time" column="publish_time" />
<result property="specification" column="specification" />
</resultMap>
<sql id="selectFishPriceCollectionVo">
select `city`, `collection_data`, `collection_source`, `collection_time`, `fish_species`, `id`, `price`, `province`, `publish_time`, `specification` from fish_price_collection
</sql>
<select id="selectFishPriceCollectionList" parameterType="FishPriceCollection" resultMap="FishPriceCollectionResult">
<include refid="selectFishPriceCollectionVo"/>
<where>
<if test="city != null and city != ''"> and city like concat('%', #{city}, '%')</if>
<if test="collection_source != null and collection_source != ''"> and collection_source like concat('%', #{collection_source}, '%')</if>
<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>
<if test="fish_species != null and fish_species != ''"> and fish_species like concat('%', #{fish_species}, '%')</if>
<if test="id != null "> and id = #{id}</if>
<if test="province != null and province != ''"> and province like concat('%', #{province}, '%')</if>
<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>
<if test="specification != null and specification != ''"> and specification like concat('%', #{specification}, '%')</if>
</where>
order by publish_time desc
</select>
<select id="selectFishPriceCollectionById" parameterType="Integer" resultMap="FishPriceCollectionResult">
<include refid="selectFishPriceCollectionVo"/>
where id = #{id}
</select>
<insert id="insertFishPriceCollection" parameterType="FishPriceCollection" useGeneratedKeys="true" keyProperty="id">
insert into fish_price_collection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="city != null and city != ''">city,</if>
<if test="collection_data != null and collection_data != ''">collection_data,</if>
<if test="collection_source != null and collection_source != ''">collection_source,</if>
<if test="collection_time != null">collection_time,</if>
<if test="fish_species != null and fish_species != ''">fish_species,</if>
<if test="price != null">price,</if>
<if test="province != null and province != ''">province,</if>
<if test="publish_time != null">publish_time,</if>
<if test="specification != null and specification != ''">specification,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="city != null and city != ''">#{city},</if>
<if test="collection_data != null and collection_data != ''">#{collection_data},</if>
<if test="collection_source != null and collection_source != ''">#{collection_source},</if>
<if test="collection_time != null">#{collection_time},</if>
<if test="fish_species != null and fish_species != ''">#{fish_species},</if>
<if test="price != null">#{price},</if>
<if test="province != null and province != ''">#{province},</if>
<if test="publish_time != null">#{publish_time},</if>
<if test="specification != null and specification != ''">#{specification},</if>
</trim>
</insert>
<update id="updateFishPriceCollection" parameterType="FishPriceCollection">
update fish_price_collection
<trim prefix="SET" suffixOverrides=",">
<if test="city != null and city != ''">city = #{city},</if>
<if test="collection_data != null and collection_data != ''">collection_data = #{collection_data},</if>
<if test="collection_source != null and collection_source != ''">collection_source = #{collection_source},</if>
<if test="collection_time != null">collection_time = #{collection_time},</if>
<if test="fish_species != null and fish_species != ''">fish_species = #{fish_species},</if>
<if test="price != null">price = #{price},</if>
<if test="province != null and province != ''">province = #{province},</if>
<if test="publish_time != null">publish_time = #{publish_time},</if>
<if test="specification != null and specification != ''">specification = #{specification},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFishPriceCollectionById" parameterType="Integer">
delete from fish_price_collection where id = #{id}
</delete>
<delete id="deleteFishPriceCollectionByIds" parameterType="String">
delete from fish_price_collection where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
... ...
package com.zhonglai.luhui.admin.service;
import com.ruoyi.system.domain.entity.SysUser;
import com.zhonglai.luhui.security.service.AdminDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Set;
@Service
public class AdminDetailsServiceImpl extends AdminDetailsService {
@Autowired
private SysPermissionService permissionService;
@Override
public Set<String> getMenuPermission(SysUser user) {
return permissionService.getMenuPermission(user);
}
}
... ...
package com.zhonglai.luhui.admin.service;
import com.ruoyi.system.domain.entity.SysUser;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.zhonglai.luhui.security.dto.SysLoginUser;
import com.zhonglai.luhui.sys.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
/**
* 用户验证处理
*
* @author ruoyi
*/
@Service
public class SysUserDetailsServiceImpl implements UserDetailsService
{
private static final Logger log = LoggerFactory.getLogger(SysUserDetailsServiceImpl.class);
@Autowired
private ISysUserService userService;
@Autowired
private SysPermissionService permissionService;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException
{
SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user))
{
log.info("登录用户:{} 不存在.", username);
throw new ServiceException("登录用户:" + username + " 不存在");
}
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
log.info("登录用户:{} 已被删除.", username);
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
}
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{
log.info("登录用户:{} 已被停用.", username);
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
}
return createLoginUser(user);
}
public UserDetails createLoginUser(SysUser user)
{
return new SysLoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
}
}
package com.zhonglai.luhui.afms.service.impl;
import com.ruoyi.system.domain.entity.SysUser;
import com.zhonglai.luhui.security.service.AdminDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.Set;
@Service
public class AdminDetailsServiceImpl extends AdminDetailsService {
@Override
public Set<String> getMenuPermission(SysUser user) {
Set<String> set = new HashSet<>();
set.add("*:*:*");
return set;
}
}
... ...
# 项目相关配置 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
\ No newline at end of file
# 项目相关配置 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
\ No newline at end of file
... ...
... ... @@ -48,6 +48,11 @@
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
<build>
... ... @@ -73,7 +78,7 @@
生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/
-->
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.zhonglai.luhui.http.service.LhHttpServiceApplication</mainClass>
<mainClass>com.zhonglai.luhui.login.LhLoginApplication</mainClass>
</manifest>
</archive>
</configuration>
... ...
package com.zhonglai.luhui.login.service;
import com.ruoyi.system.domain.entity.SysUser;
import com.zhonglai.luhui.security.service.AdminDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.Set;
@Service
public class AdminDetailsServiceImpl extends AdminDetailsService {
@Override
public Set<String> getMenuPermission(SysUser user) {
Set<String> set = new HashSet<>();
set.add("*:*:*");
return set;
}
}
... ...
package com.zhonglai.luhui.smart.feeder.pureness;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
\ No newline at end of file
... ...
package com.zhonglai.luhui.smart.feeder.pureness.service;
import cn.hutool.json.JSONObject;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TerminalService {
private static final Logger log = LoggerFactory.getLogger(TerminalService.class);
private MqttClient mqttclient;
private MqttConnectOptions options;
private MqttCallback mqttCallback;
private String broker;
private String clientId;
private List<String> topics;
private List<String> mqtt_usernames;
private String username;
private String password;
public void startMqttListenerService() throws MqttException {
log.info("-----------开始启动mqtt监听服务--------------------");
init();
connect();
subscribe();
Map<String,Object> dmap = new HashMap<>();
Map<String,Object> map = new HashMap<>();
dmap.put("summary",map);
// map.put("localhostIp",IpUtils.getLocalHost());
JSONObject jsonObject = new JSONObject();
jsonObject.put("0",dmap);
String topic = "ADD_POST";
// publish(topic,jsonObject.toJSONString());
}
public void init() throws MqttException {
if(null == mqttclient)
{
mqttclient = new MqttClient(broker, clientId, new MemoryPersistence());
}
options = new MqttConnectOptions();
options.setCleanSession(true);
options.setConnectionTimeout(15);
//设置断开后重新连接
options.setAutomaticReconnect(true);
mqttclient.setCallback(mqttCallback);
}
private void connect() throws MqttException {
options.setUserName(username);
options.setPassword(password.toCharArray());
mqttclient.connect(options);
}
public void subscribe() throws MqttException {
mqttclient.subscribe(topics.toArray(new String[topics.size()]));
}
public void publish(String topic, MqttMessage message) throws MqttException {
mqttclient.publish(topic,message);
}
public void publish(String topic, String messageStr) throws MqttException {
MqttMessage message = new MqttMessage();
message.setPayload(messageStr.getBytes());
mqttclient.publish(topic,message);
}
public void scheduledSubmissionData(String messageStr) throws MqttException {
String topic = "ALL_POST";
publish(topic,messageStr);
}
public void close()
{
try {
options.setAutomaticReconnect(false);
if(null != mqttclient && mqttclient.isConnected())
{
mqttclient.disconnect();
mqttclient.close();
}
} catch (MqttException e) {
log.error("关闭失败",e);
}
}
}
... ...
... ... @@ -91,7 +91,7 @@ public class OpenCVUtil {
logger.info("打开化摄像头"+i+"失败");
}
}
return null;
throw new RuntimeException("未检测到摄像头");
}
public static VideoCapture readVideoCaptureForVideo(String videoPath )
... ...
... ... @@ -8,7 +8,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
... ... @@ -37,43 +36,12 @@ public class CameraService {
*/
private void openCapture()
{
// videoCapture = OpenCVUtil.readVideoCaptureForVideo((Integer) configurationParameterService.getConfig(ConfigurationParameter.captureNumber));
videoCapture = OpenCVUtil.openCapture();
if(null == videoCapture)
{
return;
}
monitorCapture();
// if (!videoIsOpen)
// {
// logger.info("摄像头打开失败尝试自动识别流程");
// int i=0;
// int j =0;
// while (!videoIsOpen && i<10)
// {
// logger.info("等待3秒");
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
// logger.info("开始尝试:"+i);
// videoCapture = OpenCVUtil.readVideoCaptureForVideo(i);
// monitorCapture();
// if(!videoIsOpen && j>=3)
// {
// j=0;
// i++;
// }
// j++;
// }
// if(!videoIsOpen)
// {
// logger.info("尝试0-10都没有成功退出尝试");
// }
//
// }
}
... ...