Browse Source

优化

platform-api
4670101279 2 years ago
parent
commit
3af9394c99
  1. 7
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java
  2. 2
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraNetFtpServiceImpl.java
  3. 9
      ruoyi-code/src/main/java/utils/run_device_cfg.java

7
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java

@ -261,5 +261,10 @@ public class CameraController extends BaseController @@ -261,5 +261,10 @@ public class CameraController extends BaseController
return R.error();
}
@RequestMapping("/setNowTime/{id}")
public R setNowTime(@PathVariable("id")Long id){
Camera camera = cameraService.getById(id);
CameraUtil.setNowTime(new NativeLong(Long.parseLong(camera.getLoginId())));
return R.ok();
}
}

2
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraNetFtpServiceImpl.java

@ -59,7 +59,7 @@ public class CameraNetFtpServiceImpl extends ServiceImpl<CameraNetFtpMapper, Cam @@ -59,7 +59,7 @@ public class CameraNetFtpServiceImpl extends ServiceImpl<CameraNetFtpMapper, Cam
int bOfflineEnable = netFtp.getIsEnable().intValue();
boolean result = cfg.setDeviceFtpCfg(new NativeLong(Long.parseLong(netFtp.getLoginId())), netFtp.getIsEnable().intValue(), bOfflineEnable, netFtp.getAddress(),
netFtp.getPort().intValue(), netFtp.getUsername(), netFtp.getPassword());
netFtp.getPort().intValue(), netFtp.getUsername(), netFtp.getPassword(),netFtp.getPathRule());
if(!result){
return R.error();

9
ruoyi-code/src/main/java/utils/run_device_cfg.java

@ -3,6 +3,7 @@ package utils; @@ -3,6 +3,7 @@ package utils;
import com.alibaba.fastjson.JSON;
import com.ruoyi.code.camera.domain.CameraNetFtp;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.StringUtils;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
@ -3451,7 +3452,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3451,7 +3452,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
int uFtpPort = 22;
String szUserName = "test";
String szPassword = "test123";
boolean result = setDeviceFtpCfg(loginID, bRealtimeEnable, bOfflineEnable, szAddress, uFtpPort, szUserName, szPassword);
boolean result = setDeviceFtpCfg(loginID, bRealtimeEnable, bOfflineEnable, szAddress, uFtpPort, szUserName, szPassword,"");
System.out.println("result = " + result);
}
@ -3625,9 +3626,11 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3625,9 +3626,11 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
* @param szPassword 密码
* @return
*/
public boolean setDeviceFtpCfg(NativeLong loginID, int bRealtimeEnable,int bOfflineEnable,String szAddress,int uFtpPort,String szUserName,String szPassword){
public boolean setDeviceFtpCfg(NativeLong loginID, int bRealtimeEnable,int bOfflineEnable,String szAddress,int uFtpPort,String szUserName,String szPassword,String szPathRule){
//上传图片路径规则
String szPathRule = "/%n/%Y/%M/%D/%Y_%M_%D_%h_%m_%s.jpg";
if(StringUtils.isBlank(szPathRule)) {
szPathRule = "/%n/%Y-%M-%D/%Y_%M_%D_%h_%m_%s.jpg";
}
byte[] szPathRuleBytes = getNewArray(160,DataUtils.sdk_data_stringToByteArray(szPathRule,GlobalTool.getEncodeType()));
//路径编码类型
int emPathEncodeType = 0;

Loading…
Cancel
Save