--正式版 v2.0.0
1.修复小程删除人员报错问题 2.车辆图片大小限制1024以内 3.设备记录通过sn查找 4.门禁卡号逻辑改为一张卡只能用一次 5.数据库版本 cell_db_v1.0.sql
This commit is contained in:
parent
8c3b244542
commit
09d8da3c43
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,7 @@
|
||||||
package net.shapelight.common.utils;
|
package net.shapelight.common.utils;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -72,6 +75,32 @@ public class ImageUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过BufferedImage图片流调整图片大小
|
||||||
|
*/
|
||||||
|
public static BufferedImage resizeImage(BufferedImage originalImage, int targetWidth, int targetHeight) throws IOException {
|
||||||
|
Image resultingImage = originalImage.getScaledInstance(targetWidth, targetHeight, Image.SCALE_DEFAULT);
|
||||||
|
BufferedImage outputImage = new BufferedImage(targetWidth, targetHeight, BufferedImage.TYPE_INT_RGB);
|
||||||
|
outputImage.getGraphics().drawImage(resultingImage, 0, 0, null);
|
||||||
|
return outputImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BufferedImage图片流转byte[]数组
|
||||||
|
*/
|
||||||
|
public static byte[] imageToBytes(BufferedImage bImage) {
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
ImageIO.write(bImage, "jpg", out);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return out.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
// String imageStr = GetImageBase64Str("d:/3.jpg");
|
// String imageStr = GetImageBase64Str("d:/3.jpg");
|
||||||
// System.out.println(imageStr);
|
// System.out.println(imageStr);
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package net.shapelight.common.utils;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.coobird.thumbnailator.Thumbnails;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ThumbnailsUtils{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过BufferedImage图片流调整图片大小
|
||||||
|
*/
|
||||||
|
public static BufferedImage resizeImageOne(BufferedImage originalImage, int targetWidth, int targetHeight) throws Exception {
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
Thumbnails.of(originalImage)
|
||||||
|
.size(targetWidth, targetHeight)
|
||||||
|
.outputFormat("JPEG")
|
||||||
|
.outputQuality(1)
|
||||||
|
.toOutputStream(outputStream);
|
||||||
|
byte[] data = outputStream.toByteArray();
|
||||||
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
|
||||||
|
return ImageIO.read(inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BufferedImage图片流转byte[]数组
|
||||||
|
*/
|
||||||
|
public static byte[] imageToBytes(BufferedImage bImage) {
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
ImageIO.write(bImage, "jpg", out);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("错误信息: ", e);
|
||||||
|
}
|
||||||
|
return out.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte[]数组转BufferedImage图片流
|
||||||
|
*/
|
||||||
|
private static BufferedImage bytesToBufferedImage(byte[] ImageByte) {
|
||||||
|
ByteArrayInputStream in = new ByteArrayInputStream(ImageByte);
|
||||||
|
BufferedImage image = null;
|
||||||
|
try {
|
||||||
|
image = ImageIO.read(in);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("错误信息: ", e);
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,6 +80,9 @@ public class AppApiController {
|
||||||
@GetMapping("systeminfo")
|
@GetMapping("systeminfo")
|
||||||
// @ApiOperation("获取系统消息")
|
// @ApiOperation("获取系统消息")
|
||||||
public R systeminfo(@LoginUser AppUserEntity user) {
|
public R systeminfo(@LoginUser AppUserEntity user) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
List<AppUserEntity> list = appUserService.list();
|
List<AppUserEntity> list = appUserService.list();
|
||||||
return R.ok().put("data", list);
|
return R.ok().put("data", list);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +152,9 @@ public class AppApiController {
|
||||||
@PostMapping("/addUserRoom")
|
@PostMapping("/addUserRoom")
|
||||||
@ApiOperation("添加账号房产信息")
|
@ApiOperation("添加账号房产信息")
|
||||||
public R addUserRoom(@LoginUser AppUserEntity user,@RequestBody TenPersonEntity tenPerson) {
|
public R addUserRoom(@LoginUser AppUserEntity user,@RequestBody TenPersonEntity tenPerson) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
TenCellEntity cell = tenCellService.getById(tenPerson.getCellId());
|
TenCellEntity cell = tenCellService.getById(tenPerson.getCellId());
|
||||||
long id = new SnowflakeIdWorker().nextId();
|
long id = new SnowflakeIdWorker().nextId();
|
||||||
tenPerson.setPersonId(id);
|
tenPerson.setPersonId(id);
|
||||||
|
@ -161,7 +167,7 @@ public class AppApiController {
|
||||||
tenPerson.setLastUpdateTime(now);
|
tenPerson.setLastUpdateTime(now);
|
||||||
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_APP);
|
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_APP);
|
||||||
tenPerson.setAppFlag(Constant.APP_LOGIN_YES);
|
tenPerson.setAppFlag(Constant.APP_LOGIN_YES);
|
||||||
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
|
tenPerson.setStatus(Constant.PESON_SUATUS_WAITREVIEW);
|
||||||
|
|
||||||
tenPerson.setUsername(user.getUsername());
|
tenPerson.setUsername(user.getUsername());
|
||||||
|
|
||||||
|
@ -296,14 +302,34 @@ public class AppApiController {
|
||||||
@PostMapping("getCurrentScope")
|
@PostMapping("getCurrentScope")
|
||||||
@ApiOperation("获取当前管理房间")
|
@ApiOperation("获取当前管理房间")
|
||||||
public R getCurrentScope(@LoginUser AppUserEntity user) {
|
public R getCurrentScope(@LoginUser AppUserEntity user) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = new AppUserScopeEntity();
|
AppUserScopeEntity scope = new AppUserScopeEntity();
|
||||||
//有当前登录
|
//有当前登录
|
||||||
if (user.getCurrentScopeId() != null) {
|
if (user.getCurrentScopeId() != null) {
|
||||||
scope = appUserScopeService.getById(user.getCurrentScopeId());
|
scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
|
//记录的当前登录已经不存在了
|
||||||
|
if(scope==null){
|
||||||
|
//没有当前登录,重新找
|
||||||
|
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
|
||||||
|
.eq("user_id", user.getUserId()));
|
||||||
|
if (scopes.size() != 0) {
|
||||||
|
scope = scopes.get(0);
|
||||||
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
|
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
|
||||||
scope.setPerson(personEntity);
|
scope.setPerson(personEntity);
|
||||||
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
|
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
|
||||||
|
|
||||||
|
user.setCurrentScopeId(scope.getUserScopeId());
|
||||||
|
appUserService.updateById(user);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
|
||||||
|
scope.setPerson(personEntity);
|
||||||
|
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//没有当前登录
|
//没有当前登录
|
||||||
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
|
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
|
||||||
|
@ -313,6 +339,9 @@ public class AppApiController {
|
||||||
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
|
TenPersonEntity personEntity = tenPersonService.getById(scope.getPersonId(), scope.getCellId());
|
||||||
scope.setPerson(personEntity);
|
scope.setPerson(personEntity);
|
||||||
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
|
scope.setCellName(tenCellService.getCellName(scope.getCellId().toString()));
|
||||||
|
|
||||||
|
user.setCurrentScopeId(scope.getUserScopeId());
|
||||||
|
appUserService.updateById(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(scope.getPerson()==null){
|
if(scope.getPerson()==null){
|
||||||
|
@ -333,6 +362,9 @@ public class AppApiController {
|
||||||
@PostMapping("getAllScope")
|
@PostMapping("getAllScope")
|
||||||
@ApiOperation("获取所有管理房间")
|
@ApiOperation("获取所有管理房间")
|
||||||
public R getAllScope(@LoginUser AppUserEntity user) {
|
public R getAllScope(@LoginUser AppUserEntity user) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
|
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
|
||||||
.eq("user_id", user.getUserId()));
|
.eq("user_id", user.getUserId()));
|
||||||
for (AppUserScopeEntity scope : scopes) {
|
for (AppUserScopeEntity scope : scopes) {
|
||||||
|
@ -350,6 +382,9 @@ public class AppApiController {
|
||||||
@ApiImplicitParam(name = "userScopeId", value = "userScopeId", paramType = "query", dataType = "String", required = true),
|
@ApiImplicitParam(name = "userScopeId", value = "userScopeId", paramType = "query", dataType = "String", required = true),
|
||||||
})
|
})
|
||||||
public R changeScope(@LoginUser AppUserEntity user, @RequestBody Map params) {
|
public R changeScope(@LoginUser AppUserEntity user, @RequestBody Map params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
long scopeId = Long.parseLong((String) params.get("userScopeId"));
|
long scopeId = Long.parseLong((String) params.get("userScopeId"));
|
||||||
user.setCurrentScopeId(scopeId);
|
user.setCurrentScopeId(scopeId);
|
||||||
appUserService.updateById(user);
|
appUserService.updateById(user);
|
||||||
|
@ -364,6 +399,9 @@ public class AppApiController {
|
||||||
@ApiImplicitParam(name = "personId", value = "人员ID", paramType = "query", dataType = "String", required = true),
|
@ApiImplicitParam(name = "personId", value = "人员ID", paramType = "query", dataType = "String", required = true),
|
||||||
})
|
})
|
||||||
public R remoteOpenDoor(@LoginUser AppUserEntity user, @RequestBody Map params) {
|
public R remoteOpenDoor(@LoginUser AppUserEntity user, @RequestBody Map params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
TenPersonEntity loginPerson = tenPersonService.getById(scope.getPersonId(),scope.getCellId());
|
TenPersonEntity loginPerson = tenPersonService.getById(scope.getPersonId(),scope.getCellId());
|
||||||
Long personId = loginPerson.getPersonId(); //.toString();
|
Long personId = loginPerson.getPersonId(); //.toString();
|
||||||
|
@ -393,6 +431,9 @@ public class AppApiController {
|
||||||
@ApiImplicitParam(name = "cellId", value = "设备ID", paramType = "query", dataType = "String", required = true),
|
@ApiImplicitParam(name = "cellId", value = "设备ID", paramType = "query", dataType = "String", required = true),
|
||||||
})
|
})
|
||||||
public R getDevice(@LoginUser AppUserEntity user, @RequestBody Map params) {
|
public R getDevice(@LoginUser AppUserEntity user, @RequestBody Map params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
long cellId = Long.parseLong((String) params.get("cellId"));
|
long cellId = Long.parseLong((String) params.get("cellId"));
|
||||||
List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId);
|
List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId);
|
||||||
return R.ok().put("data",devList);
|
return R.ok().put("data",devList);
|
||||||
|
@ -406,6 +447,9 @@ public class AppApiController {
|
||||||
@PostMapping("addPerson")
|
@PostMapping("addPerson")
|
||||||
@ApiOperation("管理员添加人员")
|
@ApiOperation("管理员添加人员")
|
||||||
public R addPerson(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) {
|
public R addPerson(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
// public static final int PERSON_TYPE_OWNER = 5000; //业主
|
// public static final int PERSON_TYPE_OWNER = 5000; //业主
|
||||||
// public static final int PERSON_TYPE_MEMBER = 5001; //家属住户
|
// public static final int PERSON_TYPE_MEMBER = 5001; //家属住户
|
||||||
|
@ -456,6 +500,9 @@ public class AppApiController {
|
||||||
@PostMapping("addMember")
|
@PostMapping("addMember")
|
||||||
@ApiOperation("业主添加成员")
|
@ApiOperation("业主添加成员")
|
||||||
public R addMember(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) {
|
public R addMember(@LoginUser AppUserEntity user, @RequestBody TenPersonEntity tenPerson) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
// public static final int PERSON_TYPE_OWNER = 5000; //业主
|
// public static final int PERSON_TYPE_OWNER = 5000; //业主
|
||||||
// public static final int PERSON_TYPE_MEMBER = 5001; //家属住户
|
// public static final int PERSON_TYPE_MEMBER = 5001; //家属住户
|
||||||
|
@ -517,6 +564,9 @@ public class AppApiController {
|
||||||
})
|
})
|
||||||
|
|
||||||
public R getPersons(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
public R getPersons(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
String key = (String)params.get("key");
|
String key = (String)params.get("key");
|
||||||
|
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
|
@ -558,6 +608,9 @@ public class AppApiController {
|
||||||
})
|
})
|
||||||
|
|
||||||
public R getGuest(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
public R getGuest(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
String key = (String)params.get("key");
|
String key = (String)params.get("key");
|
||||||
|
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
|
@ -586,15 +639,20 @@ public class AppApiController {
|
||||||
@ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
@ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
})
|
})
|
||||||
public R deletePerson(@LoginUser AppUserEntity user, @RequestBody List<Map<String, String>> params) {
|
public R deletePerson(@LoginUser AppUserEntity user, @RequestBody List<Map<String, String>> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
//业主,不能删除自己
|
//不能删除自己
|
||||||
if(scope.getRoleId()==Constant.PERSON_TYPE_OWNER){
|
|
||||||
for (Map<String, String> param : params) {
|
for (Map<String, String> param : params) {
|
||||||
Long personId = Long.parseLong(param.get("personId"));
|
Long personId = Long.parseLong(param.get("personId"));
|
||||||
Long cellId = Long.parseLong(param.get("cellId"));
|
Long cellId = Long.parseLong(param.get("cellId"));
|
||||||
if(scope.getPersonId().longValue() == personId.longValue()){
|
if(scope.getPersonId().longValue() == personId.longValue()){
|
||||||
return R.error("不能删除自己");
|
return R.error("不能删除自己");
|
||||||
}
|
}
|
||||||
|
TenPersonEntity personEntity = tenPersonService.getById(personId,cellId);
|
||||||
|
if(scope.getRoleId().intValue()>personEntity.getPersonType().intValue()){
|
||||||
|
return R.error("您无权删除"+personEntity.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tenPersonService.removeByIdList(params);
|
tenPersonService.removeByIdList(params);
|
||||||
|
@ -615,6 +673,9 @@ public class AppApiController {
|
||||||
@ApiImplicitParam(name = "idCard", value = "证件号", paramType = "query", dataType = "String", required = true)
|
@ApiImplicitParam(name = "idCard", value = "证件号", paramType = "query", dataType = "String", required = true)
|
||||||
})
|
})
|
||||||
public R listReview(@LoginUser AppUserEntity user,@RequestBody Map<String, Object> params) {
|
public R listReview(@LoginUser AppUserEntity user,@RequestBody Map<String, Object> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
String tenantId = user.getTenantId().toString();
|
String tenantId = user.getTenantId().toString();
|
||||||
params.put("tenantId", tenantId + "");
|
params.put("tenantId", tenantId + "");
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
|
@ -634,6 +695,9 @@ public class AppApiController {
|
||||||
@ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
@ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
})
|
})
|
||||||
public R reviewPerson(@LoginUser AppUserEntity user, @RequestBody List<Map<String, String>> params) {
|
public R reviewPerson(@LoginUser AppUserEntity user, @RequestBody List<Map<String, String>> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
tenPersonService.reviewByIdList(params);
|
tenPersonService.reviewByIdList(params);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
@ -644,6 +708,9 @@ public class AppApiController {
|
||||||
@PostMapping("/uploadPublicImage")
|
@PostMapping("/uploadPublicImage")
|
||||||
@ApiOperation("上传公共照片")
|
@ApiOperation("上传公共照片")
|
||||||
public R uploadImage(@LoginUser AppUserEntity user,@RequestParam("file") MultipartFile file) {
|
public R uploadImage(@LoginUser AppUserEntity user,@RequestParam("file") MultipartFile file) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
//String tenantId = getUser().getTenantId()+"";
|
//String tenantId = getUser().getTenantId()+"";
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
|
|
|
@ -73,6 +73,9 @@ public class AppInfoApiController {
|
||||||
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
// })
|
// })
|
||||||
public R listNotice(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
public R listNotice(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
params.put("cellId",cellId);
|
params.put("cellId",cellId);
|
||||||
|
@ -100,6 +103,9 @@ public class AppInfoApiController {
|
||||||
@PostMapping("listNoticeTop")
|
@PostMapping("listNoticeTop")
|
||||||
@ApiOperation(value = "查看公告一条",response = TenNoticeEntity.class)
|
@ApiOperation(value = "查看公告一条",response = TenNoticeEntity.class)
|
||||||
public R listNoticeTop(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
public R listNoticeTop(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
params.put("cellId",cellId);
|
params.put("cellId",cellId);
|
||||||
|
@ -121,6 +127,9 @@ public class AppInfoApiController {
|
||||||
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
})
|
})
|
||||||
public R listFeedback(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
public R listFeedback(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
params.put("cellId",cellId);
|
params.put("cellId",cellId);
|
||||||
|
@ -144,6 +153,9 @@ public class AppInfoApiController {
|
||||||
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
})
|
})
|
||||||
public R listRepair(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
public R listRepair(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> params) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
params.put("cellId",cellId);
|
params.put("cellId",cellId);
|
||||||
|
@ -162,6 +174,9 @@ public class AppInfoApiController {
|
||||||
@PostMapping("/addNotice")
|
@PostMapping("/addNotice")
|
||||||
@ApiOperation("添加公告")
|
@ApiOperation("添加公告")
|
||||||
public R addNotice(@LoginUser AppUserEntity user,@RequestBody TenNoticeEntity tenNotice) {
|
public R addNotice(@LoginUser AppUserEntity user,@RequestBody TenNoticeEntity tenNotice) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
tenNotice.setCellId(cellId);
|
tenNotice.setCellId(cellId);
|
||||||
|
@ -181,6 +196,9 @@ public class AppInfoApiController {
|
||||||
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
// })
|
// })
|
||||||
public R addFeedback(@LoginUser AppUserEntity user, @RequestBody TenFeedbackEntity feedback) {
|
public R addFeedback(@LoginUser AppUserEntity user, @RequestBody TenFeedbackEntity feedback) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
feedback.setCellId(cellId);
|
feedback.setCellId(cellId);
|
||||||
|
@ -197,6 +215,9 @@ public class AppInfoApiController {
|
||||||
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
// })
|
// })
|
||||||
public R reviewFeedback(@LoginUser AppUserEntity user, @RequestBody TenFeedbackEntity feedback) {
|
public R reviewFeedback(@LoginUser AppUserEntity user, @RequestBody TenFeedbackEntity feedback) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
feedback.setCellId(cellId);
|
feedback.setCellId(cellId);
|
||||||
|
@ -213,6 +234,9 @@ public class AppInfoApiController {
|
||||||
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
// @ApiImplicitParam(name="cellId",value = "小区",paramType = "query",dataType = "String",required = true)
|
||||||
// })
|
// })
|
||||||
public R addRepair(@LoginUser AppUserEntity user, @RequestBody TenRepairEntity repair) {
|
public R addRepair(@LoginUser AppUserEntity user, @RequestBody TenRepairEntity repair) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
repair.setCellId(cellId);
|
repair.setCellId(cellId);
|
||||||
|
@ -226,6 +250,9 @@ public class AppInfoApiController {
|
||||||
@PostMapping("reviewRepair")
|
@PostMapping("reviewRepair")
|
||||||
@ApiOperation("管理员审批房屋报修")
|
@ApiOperation("管理员审批房屋报修")
|
||||||
public R reviewRepair(@LoginUser AppUserEntity user, @RequestBody TenRepairEntity repair) {
|
public R reviewRepair(@LoginUser AppUserEntity user, @RequestBody TenRepairEntity repair) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
Long cellId = scope.getCellId();
|
Long cellId = scope.getCellId();
|
||||||
repair.setCellId(cellId);
|
repair.setCellId(cellId);
|
||||||
|
@ -248,6 +275,9 @@ public class AppInfoApiController {
|
||||||
// @ApiImplicitParam(name="recordTimeEnd",value = "结束时间",paramType = "query",dataType = "String",required = true),
|
// @ApiImplicitParam(name="recordTimeEnd",value = "结束时间",paramType = "query",dataType = "String",required = true),
|
||||||
})
|
})
|
||||||
public R openDoorRecordList(@LoginUser AppUserEntity user,@RequestBody Map<String, Object> params){
|
public R openDoorRecordList(@LoginUser AppUserEntity user,@RequestBody Map<String, Object> params){
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
|
||||||
params.put("tenantId",user.getTenantId());
|
params.put("tenantId",user.getTenantId());
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class AppRegisterController {
|
||||||
Map<String, Object> resMap = new HashMap<>();
|
Map<String, Object> resMap = new HashMap<>();
|
||||||
resMap.put("result", result);
|
resMap.put("result", result);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return R.error().put("data", resMap);
|
return R.error(result+"");
|
||||||
}
|
}
|
||||||
redisUtils.set(mobile,verifyCode,120L);
|
redisUtils.set(mobile,verifyCode,120L);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
@ -190,6 +190,9 @@ public class AppRegisterController {
|
||||||
})
|
})
|
||||||
//public R updatePassword(@LoginUser UserEntity user, String oldPassword,String newPassword){
|
//public R updatePassword(@LoginUser UserEntity user, String oldPassword,String newPassword){
|
||||||
public R updatePassword(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> map) {
|
public R updatePassword(@LoginUser AppUserEntity user, @RequestBody Map<String, Object> map) {
|
||||||
|
if(user == null){
|
||||||
|
return R.error("用户不存在");
|
||||||
|
}
|
||||||
String oldPassword = (String) map.get("oldPassword");
|
String oldPassword = (String) map.get("oldPassword");
|
||||||
String newPassword = (String) map.get("newPassword");
|
String newPassword = (String) map.get("newPassword");
|
||||||
if (user.getPassword().equals(DigestUtils.sha256Hex(oldPassword))) {
|
if (user.getPassword().equals(DigestUtils.sha256Hex(oldPassword))) {
|
||||||
|
|
|
@ -8,10 +8,13 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -19,9 +22,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import net.shapelight.common.config.GlobalValue;
|
import net.shapelight.common.config.GlobalValue;
|
||||||
import net.shapelight.common.config.MinioConfig;
|
import net.shapelight.common.config.MinioConfig;
|
||||||
import net.shapelight.common.utils.R;
|
import net.shapelight.common.utils.*;
|
||||||
import net.shapelight.common.utils.StringUtils;
|
|
||||||
import net.shapelight.common.utils.UUIDUtil;
|
|
||||||
import net.shapelight.modules.ten.entity.TenCarEntity;
|
import net.shapelight.modules.ten.entity.TenCarEntity;
|
||||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||||
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
|
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
|
||||||
|
@ -40,6 +41,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping({"/api/car/v1"})
|
@RequestMapping({"/api/car/v1"})
|
||||||
@Api("停车接口")
|
@Api("停车接口")
|
||||||
|
@ -142,6 +145,10 @@ public class CarOpenApi {
|
||||||
int type = bizContent.getIntValue("type");
|
int type = bizContent.getIntValue("type");
|
||||||
int carType = bizContent.getIntValue("carType");
|
int carType = bizContent.getIntValue("carType");
|
||||||
String imgUrl = bizContent.getString("imgUrl");
|
String imgUrl = bizContent.getString("imgUrl");
|
||||||
|
|
||||||
|
//去掉 amp;
|
||||||
|
imgUrl = imgUrl.replace("amp;", "");
|
||||||
|
|
||||||
TenPackRecordEnterEntity enter = new TenPackRecordEnterEntity();
|
TenPackRecordEnterEntity enter = new TenPackRecordEnterEntity();
|
||||||
enter.setParkCode(parkCode);
|
enter.setParkCode(parkCode);
|
||||||
enter.setParkName(parkName);
|
enter.setParkName(parkName);
|
||||||
|
@ -157,15 +164,37 @@ public class CarOpenApi {
|
||||||
HttpURLConnection httpUrl = null;
|
HttpURLConnection httpUrl = null;
|
||||||
try {
|
try {
|
||||||
url = new URL(imgUrl);
|
url = new URL(imgUrl);
|
||||||
httpUrl = (HttpURLConnection) url.openConnection();
|
|
||||||
httpUrl.connect();
|
BufferedImage image = ImageIO.read(url);
|
||||||
httpUrl.getInputStream();
|
//获取图片的宽、高
|
||||||
is = httpUrl.getInputStream();
|
System.out.println("Width: " + image.getWidth());
|
||||||
|
System.out.println("Height: " + image.getHeight());
|
||||||
|
int w = image.getWidth();
|
||||||
|
int h = image.getHeight();
|
||||||
|
//调整尺寸不能大于1024
|
||||||
|
if(w>1024 || h>1024){
|
||||||
|
image = ThumbnailsUtils.resizeImageOne(image,1024,1024);
|
||||||
|
}
|
||||||
|
|
||||||
String fileName = "car/" + enter.getParkCode() + "/" + UUIDUtil.uuid() + ".jpg";
|
String fileName = "car/" + enter.getParkCode() + "/" + UUIDUtil.uuid() + ".jpg";
|
||||||
PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L);
|
|
||||||
|
byte[] data = ImageUtils.imageToBytes(image);
|
||||||
|
is = new ByteArrayInputStream(data);
|
||||||
|
int rl = is.available();
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(rl, -1L);
|
||||||
putObjectOptions.setContentType("image/jpeg");
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
this.minioClient.putObject(this.minioConfig
|
this.minioClient.putObject(this.minioConfig
|
||||||
.getBucketName(), fileName, is, putObjectOptions);
|
.getBucketName(), fileName, is, putObjectOptions);
|
||||||
|
|
||||||
|
// httpUrl = (HttpURLConnection) url.openConnection();
|
||||||
|
// httpUrl.connect();
|
||||||
|
// httpUrl.getInputStream();
|
||||||
|
// is = httpUrl.getInputStream();
|
||||||
|
// String fileName = "car/" + enter.getParkCode() + "/" + UUIDUtil.uuid() + ".jpg";
|
||||||
|
// PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L);
|
||||||
|
// putObjectOptions.setContentType("image/jpeg");
|
||||||
|
// this.minioClient.putObject(this.minioConfig
|
||||||
|
// .getBucketName(), fileName, is, putObjectOptions);
|
||||||
enter.setImage(fileName);
|
enter.setImage(fileName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -254,6 +283,27 @@ public class CarOpenApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"pid": "xarl",
|
||||||
|
"serviceName": "enter",
|
||||||
|
"sign": "C06475C554464BCAA729BCFDEB1A8192",
|
||||||
|
"timestamp": 1619172845,
|
||||||
|
"bizContent": {
|
||||||
|
"carType": 1,
|
||||||
|
"channelName": "大白杨南路4号",
|
||||||
|
"enterTime": 1619172693,
|
||||||
|
"orderNum": "21042318113249091556",
|
||||||
|
"parkCode": "P1610092525",
|
||||||
|
"parkName": "昌合公司",
|
||||||
|
"plateNum": "陕UC8874",
|
||||||
|
"imgUrl": "http://icecloud-prod.oss-cn-shenzhen.aliyuncs.com/P1610092525/image/202104/23/%E9%99%95UC8874_in_2_0708.jpg?Expires=1619174645&OSSAccessKeyId=LTAI4Furp7fmTGDMRhJ95jaX&Signature=2448%2FwUWP9IbjSF%2BafAD1JNV%2BFQ%3D",
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
@PostMapping({"/pushCarRecord"})
|
@PostMapping({"/pushCarRecord"})
|
||||||
@ApiOperation("第三方推送")
|
@ApiOperation("第三方推送")
|
||||||
public Map pushCarRecord(@RequestBody Object object) {
|
public Map pushCarRecord(@RequestBody Object object) {
|
||||||
|
@ -275,6 +325,9 @@ public class CarOpenApi {
|
||||||
int type = bizContent.getIntValue("type");
|
int type = bizContent.getIntValue("type");
|
||||||
int carType = bizContent.getIntValue("carType");
|
int carType = bizContent.getIntValue("carType");
|
||||||
String imgUrl = bizContent.getString("imgUrl");
|
String imgUrl = bizContent.getString("imgUrl");
|
||||||
|
//去掉 amp;
|
||||||
|
imgUrl = imgUrl.replace("amp;", "");
|
||||||
|
|
||||||
String fileName = "car/" + parkCode + "/" + UUIDUtil.uuid() + ".jpg";
|
String fileName = "car/" + parkCode + "/" + UUIDUtil.uuid() + ".jpg";
|
||||||
if (!StringUtils.isEmpty(imgUrl)) {
|
if (!StringUtils.isEmpty(imgUrl)) {
|
||||||
URL url = null;
|
URL url = null;
|
||||||
|
@ -282,16 +335,36 @@ public class CarOpenApi {
|
||||||
HttpURLConnection httpUrl = null;
|
HttpURLConnection httpUrl = null;
|
||||||
try {
|
try {
|
||||||
url = new URL(imgUrl);
|
url = new URL(imgUrl);
|
||||||
httpUrl = (HttpURLConnection) url.openConnection();
|
|
||||||
httpUrl.connect();
|
BufferedImage image = ImageIO.read(url);
|
||||||
httpUrl.getInputStream();
|
//获取图片的宽、高
|
||||||
is = httpUrl.getInputStream();
|
System.out.println("Width: " + image.getWidth());
|
||||||
PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L);
|
System.out.println("Height: " + image.getHeight());
|
||||||
|
int w = image.getWidth();
|
||||||
|
int h = image.getHeight();
|
||||||
|
//调整尺寸不能大于1024
|
||||||
|
if(w>1024 || h>1024){
|
||||||
|
image = ThumbnailsUtils.resizeImageOne(image,1024,1024);
|
||||||
|
}
|
||||||
|
byte[] data = ImageUtils.imageToBytes(image);
|
||||||
|
is = new ByteArrayInputStream(data);
|
||||||
|
int rl = is.available();
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(rl, -1L);
|
||||||
putObjectOptions.setContentType("image/jpeg");
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
this.minioClient.putObject(this.minioConfig
|
this.minioClient.putObject(this.minioConfig
|
||||||
.getBucketName(), fileName, is, putObjectOptions);
|
.getBucketName(), fileName, is, putObjectOptions);
|
||||||
|
|
||||||
|
|
||||||
|
// httpUrl = (HttpURLConnection) url.openConnection();
|
||||||
|
// httpUrl.connect();
|
||||||
|
//// httpUrl.getInputStream();
|
||||||
|
// is = httpUrl.getInputStream();
|
||||||
|
// PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L);
|
||||||
|
// putObjectOptions.setContentType("image/jpeg");
|
||||||
|
// this.minioClient.putObject(this.minioConfig
|
||||||
|
// .getBucketName(), fileName, is, putObjectOptions);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
fileName = "";
|
fileName = "";
|
||||||
} finally {
|
} finally {
|
||||||
if (is != null)
|
if (is != null)
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class MyMessageDecoder extends ByteToMessageDecoder {
|
||||||
final int dataLength = in.readInt();
|
final int dataLength = in.readInt();
|
||||||
|
|
||||||
|
|
||||||
log.debug(String.format("verson:is 0x%x,datatype:0x%x,cmd:0x%x,lenth:%d",version,dataType,cmd,dataLength));
|
// log.debug(String.format("verson:is 0x%x,datatype:0x%x,cmd:0x%x,lenth:%d",version,dataType,cmd,dataLength));
|
||||||
|
|
||||||
if(in.readableBytes()<dataLength){
|
if(in.readableBytes()<dataLength){
|
||||||
in.resetReaderIndex();
|
in.resetReaderIndex();
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class MessageServiceImpl implements MessageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
case CmdConstant.CMD_UPRECORD: {
|
case CmdConstant.CMD_UPRECORD: {
|
||||||
// log.debug("收到上传记录:" + msg.cmd);
|
log.debug("收到上传记录:" + msg.cmd);
|
||||||
if(!clientMap.hasUser(channel)){
|
if(!clientMap.hasUser(channel)){
|
||||||
Result res = Result.error(403,"No permission");
|
Result res = Result.error(403,"No permission");
|
||||||
String resContent = JSONObject.toJSONString(res);
|
String resContent = JSONObject.toJSONString(res);
|
||||||
|
@ -96,7 +96,7 @@ public class MessageServiceImpl implements MessageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
case CmdConstant.CMD_EXTRACT: {
|
case CmdConstant.CMD_EXTRACT: {
|
||||||
// log.debug("提取失败log:" + msg.cmd);
|
log.debug("提取失败log:" + msg.cmd);
|
||||||
if(!clientMap.hasUser(channel)){
|
if(!clientMap.hasUser(channel)){
|
||||||
Result res = Result.error(403,"No permission");
|
Result res = Result.error(403,"No permission");
|
||||||
String resContent = JSONObject.toJSONString(res);
|
String resContent = JSONObject.toJSONString(res);
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class SysTenUserController extends AbstractController {
|
||||||
@RequiresPermissions("systen:user:save")
|
@RequiresPermissions("systen:user:save")
|
||||||
@ApiOperation("保存用户")
|
@ApiOperation("保存用户")
|
||||||
public R save(@RequestBody SysUserEntity user){
|
public R save(@RequestBody SysUserEntity user){
|
||||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
// ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||||
if(user.getPassword().trim().length() == 0){
|
if(user.getPassword().trim().length() == 0){
|
||||||
return R.error("密码不能为空");
|
return R.error("密码不能为空");
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class SysTenUserController extends AbstractController {
|
||||||
@RequiresPermissions("systen:user:update")
|
@RequiresPermissions("systen:user:update")
|
||||||
@ApiOperation("修改用户")
|
@ApiOperation("修改用户")
|
||||||
public R update(@RequestBody SysUserEntity user){
|
public R update(@RequestBody SysUserEntity user){
|
||||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
// ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||||
sysUserService.update(user);
|
sysUserService.update(user);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,7 @@ public class TenAreaController extends AbstractController {
|
||||||
}else{
|
}else{
|
||||||
//判断是否有已经过添加小区
|
//判断是否有已经过添加小区
|
||||||
List<TenCellEntity> cellList = tenCellService.list(new QueryWrapper<TenCellEntity>()
|
List<TenCellEntity> cellList = tenCellService.list(new QueryWrapper<TenCellEntity>()
|
||||||
.eq("area_id",areaId));
|
.in("area_id",areaId));
|
||||||
if(cellList.size()>0){
|
if(cellList.size()>0){
|
||||||
return R.error("请先删除此区域下的小区");
|
return R.error("请先删除此区域下的小区");
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||||
import net.shapelight.modules.vo.TenAppVerison;
|
import net.shapelight.modules.vo.TenAppVerison;
|
||||||
import net.shapelight.modules.vo.TenDeviceConfig;
|
import net.shapelight.modules.vo.TenDeviceConfig;
|
||||||
import net.shapelight.modules.vo.TenDeviceParamVo;
|
import net.shapelight.modules.vo.TenDeviceParamVo;
|
||||||
|
import net.shapelight.modules.vo.TenDeviceVo;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -421,4 +422,16 @@ public class TenDeviceController extends AbstractController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectByCell/{cellId}")
|
||||||
|
@ApiOperation(value = "通过小区id查询设备列表",response = TenDeviceVo.class)
|
||||||
|
public R selectByCell(@PathVariable("cellId") Long cellId){
|
||||||
|
List<TenDeviceVo> dl = tenDeviceService.findByCellId(cellId);
|
||||||
|
return R.ok().put("data", dl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,9 +333,10 @@ public class TenPersonController extends AbstractController {
|
||||||
if(tenPerson.getDoorCardEntity()!=null && !tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){
|
if(tenPerson.getDoorCardEntity()!=null && !tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){
|
||||||
//1. 检查当前钥匙是否已经使用
|
//1. 检查当前钥匙是否已经使用
|
||||||
TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
.eq("door_card",tenPerson.getDoorCardEntity().getDoorCard()));
|
.eq("door_card",tenPerson.getDoorCardEntity().getDoorCard())
|
||||||
|
.eq("cell_id",tenPerson.getCellId()));
|
||||||
if(card!=null){
|
if(card!=null){
|
||||||
return R.error("卡号已使用");
|
return R.error("卡号已录入");
|
||||||
}
|
}
|
||||||
// tenDoorCardService.save(tenPerson);
|
// tenDoorCardService.save(tenPerson);
|
||||||
}
|
}
|
||||||
|
@ -387,6 +388,56 @@ public class TenPersonController extends AbstractController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//验证卡号
|
||||||
|
if(tenPerson.getDoorCardEntity()!=null){
|
||||||
|
TenDoorCardEntity oldDoorCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
.eq("person_id",tenPerson.getPersonId()));
|
||||||
|
if (oldDoorCard!=null) {
|
||||||
|
if(oldDoorCard.getDoorCard().equals(tenPerson.getDoorCardEntity().getDoorCard())){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
.eq("door_card",tenPerson.getDoorCardEntity().getDoorCard())
|
||||||
|
.eq("cell_id",tenPerson.getCellId()));
|
||||||
|
if(card!=null){
|
||||||
|
return R.error("卡号已录入");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
.eq("door_card",tenPerson.getDoorCardEntity().getDoorCard())
|
||||||
|
.eq("cell_id",tenPerson.getCellId()));
|
||||||
|
if(card!=null){
|
||||||
|
return R.error("卡号已录入");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if(tenPerson.getDoorCardEntity()!=null && !tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){
|
||||||
|
// //1. 检查当前钥匙是否已经使用
|
||||||
|
// TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
// .eq("door_card",tenPerson.getDoorCardEntity().getDoorCard())
|
||||||
|
// .eq("cell_id",tenPerson.getCellId()));
|
||||||
|
// if(card!=null){
|
||||||
|
// Long personId = card.getPersonId();
|
||||||
|
// Long roomId = card.getRoomId();
|
||||||
|
// if(personId!=null){
|
||||||
|
// if(personId.longValue() != tenPerson.getPersonId().longValue())
|
||||||
|
// return R.error("卡号已录入");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(roomId!=null){
|
||||||
|
// return R.error("卡号已录入");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//// tenDoorCardService.save(tenPerson);
|
||||||
|
// }
|
||||||
|
|
||||||
String resStr = tenPersonService.updateById(tenPerson);
|
String resStr = tenPersonService.updateById(tenPerson);
|
||||||
if(resStr.equals("OK")){
|
if(resStr.equals("OK")){
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class TenRecordController extends AbstractController {
|
||||||
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
||||||
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
||||||
@ApiImplicitParam(name="cellId",value = "小区ID",paramType = "query",dataType = "String",required = true),
|
@ApiImplicitParam(name="cellId",value = "小区ID",paramType = "query",dataType = "String",required = true),
|
||||||
|
@ApiImplicitParam(name="sn",value = "设备sn",paramType = "query",dataType = "String",required = true),
|
||||||
@ApiImplicitParam(name="name",value = "姓名",paramType = "query",dataType = "String",required = true),
|
@ApiImplicitParam(name="name",value = "姓名",paramType = "query",dataType = "String",required = true),
|
||||||
@ApiImplicitParam(name="recordTimeStart",value = "开始时间",paramType = "query",dataType = "String",required = true),
|
@ApiImplicitParam(name="recordTimeStart",value = "开始时间",paramType = "query",dataType = "String",required = true),
|
||||||
@ApiImplicitParam(name="recordTimeEnd",value = "结束时间",paramType = "query",dataType = "String",required = true),
|
@ApiImplicitParam(name="recordTimeEnd",value = "结束时间",paramType = "query",dataType = "String",required = true),
|
||||||
|
|
|
@ -8,11 +8,13 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import net.shapelight.common.utils.*;
|
import net.shapelight.common.utils.*;
|
||||||
|
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
||||||
import net.shapelight.modules.sys.controller.AbstractController;
|
import net.shapelight.modules.sys.controller.AbstractController;
|
||||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||||
import net.shapelight.modules.sys.service.SysUserRoleService;
|
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||||
import net.shapelight.modules.ten.entity.*;
|
import net.shapelight.modules.ten.entity.*;
|
||||||
import net.shapelight.modules.ten.service.*;
|
import net.shapelight.modules.ten.service.*;
|
||||||
|
import net.shapelight.modules.vo.TenPersonOperationVo;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -40,6 +42,10 @@ public class TenRoomController extends AbstractController {
|
||||||
private TenDoorCardService tenDoorCardService;
|
private TenDoorCardService tenDoorCardService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenAddressService tenAddressService;
|
private TenAddressService tenAddressService;
|
||||||
|
@Autowired
|
||||||
|
private TenPersonSyncService tenPersonSyncService;
|
||||||
|
@Autowired
|
||||||
|
private ServerApiService serverApiService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
|
@ -161,11 +167,16 @@ public class TenRoomController extends AbstractController {
|
||||||
@RequiresPermissions("ten:room")
|
@RequiresPermissions("ten:room")
|
||||||
@ApiOperation(value = "对房发卡")
|
@ApiOperation(value = "对房发卡")
|
||||||
public R addDoorCar(@RequestBody TenDoorCardEntity doorCardEntity){
|
public R addDoorCar(@RequestBody TenDoorCardEntity doorCardEntity){
|
||||||
|
|
||||||
|
tenDoorCardService.remove(new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
.eq("room_id",doorCardEntity.getRoomId())
|
||||||
|
.eq("cell_id",doorCardEntity.getCellId()));
|
||||||
//1. 检查当前钥匙是否已经使用
|
//1. 检查当前钥匙是否已经使用
|
||||||
TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
.eq("door_card",doorCardEntity.getDoorCard()));
|
.eq("door_card",doorCardEntity.getDoorCard())
|
||||||
|
.eq("cell_id",doorCardEntity.getCellId()));
|
||||||
if(card!=null){
|
if(card!=null){
|
||||||
return R.error("卡号已使用");
|
return R.error("卡号已录入");
|
||||||
}
|
}
|
||||||
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
@ -173,6 +184,32 @@ public class TenRoomController extends AbstractController {
|
||||||
doorCardEntity.setCreateTime(now);
|
doorCardEntity.setCreateTime(now);
|
||||||
doorCardEntity.setLastUpdateTime(now);
|
doorCardEntity.setLastUpdateTime(now);
|
||||||
tenDoorCardService.save(doorCardEntity);
|
tenDoorCardService.save(doorCardEntity);
|
||||||
|
|
||||||
|
//修改此房间下人员的修改时间,通知设备跟新人员信息
|
||||||
|
|
||||||
|
List<TenPersonEntity> roomPersonList = tenPersonService.getByRoomId(doorCardEntity.getRoomId(),doorCardEntity.getCellId(),null);
|
||||||
|
for(TenPersonEntity personEntity: roomPersonList){
|
||||||
|
personEntity.setLastUpdateTime(new Date());
|
||||||
|
}
|
||||||
|
tenPersonService.updateStatusByIds(roomPersonList);
|
||||||
|
|
||||||
|
//配置同步数据
|
||||||
|
for(TenPersonEntity entity: roomPersonList){
|
||||||
|
List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId());
|
||||||
|
for (TenPersonSyncEntity syncEn : syncEntitys) {
|
||||||
|
syncEn.setLastUpdateTime(entity.getLastUpdateTime());
|
||||||
|
syncEn.setState(Constant.PERSON_SYNC_MODIFY);
|
||||||
|
tenPersonSyncService.updateById(syncEn);
|
||||||
|
//下发通知
|
||||||
|
List<TenPersonOperationVo> list = new ArrayList<>();
|
||||||
|
TenPersonOperationVo vo = new TenPersonOperationVo();
|
||||||
|
vo.setUid(entity.getPersonId());
|
||||||
|
vo.setOperation(Constant.PERSON_SYNC_MODIFY);
|
||||||
|
vo.setLast_update_stamp(entity.getLastUpdateTime());
|
||||||
|
list.add(vo);
|
||||||
|
serverApiService.personOperation(syncEn.getDeviceSn(), list);
|
||||||
|
}
|
||||||
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public interface TenPersonService {
|
||||||
|
|
||||||
String updateById(TenPersonEntity entity);
|
String updateById(TenPersonEntity entity);
|
||||||
boolean updateStatusById(TenPersonEntity entity);
|
boolean updateStatusById(TenPersonEntity entity);
|
||||||
void updateStatusByIds(TenPersonEntity[] entity);
|
void updateStatusByIds(List<TenPersonEntity> entitys);
|
||||||
boolean updateLabelById(TenPersonEntity entity);
|
boolean updateLabelById(TenPersonEntity entity);
|
||||||
boolean updateFaceFailure(TenPersonEntity entity);
|
boolean updateFaceFailure(TenPersonEntity entity);
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,8 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
|
||||||
for(Long devId: (List<Long>)idList){
|
for(Long devId: (List<Long>)idList){
|
||||||
TenDeviceEntity deviceEntity = this.getById(devId);
|
TenDeviceEntity deviceEntity = this.getById(devId);
|
||||||
tenPersonSyncService.removeByDeviceId(devId,deviceEntity.getTenantId());
|
tenPersonSyncService.removeByDeviceId(devId,deviceEntity.getTenantId());
|
||||||
|
//清除通知:
|
||||||
|
serverApiService.cleanData(deviceEntity.getSn());
|
||||||
}
|
}
|
||||||
|
|
||||||
return removeByIds(idList);
|
return removeByIds(idList);
|
||||||
|
|
|
@ -446,6 +446,7 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
//添加多个房产
|
//添加多个房产
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@CacheEvict(value = "TenPerson", allEntries = true)
|
||||||
public boolean saveOtherRoom(TenPersonEntity entity) {
|
public boolean saveOtherRoom(TenPersonEntity entity) {
|
||||||
String userFileUrl = globalValue.getImagesDir() + "/" +
|
String userFileUrl = globalValue.getImagesDir() + "/" +
|
||||||
entity.getCellId().toString() + "/" +
|
entity.getCellId().toString() + "/" +
|
||||||
|
@ -584,7 +585,7 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
}
|
}
|
||||||
// String password = entity.getPassword();
|
// String password = entity.getPassword();
|
||||||
// entity.setPassword("");
|
// entity.setPassword("");
|
||||||
entity.setStatus(Constant.PESON_SUATUS_NOMOR);
|
// entity.setStatus(Constant.PESON_SUATUS_WAITREVIEW);
|
||||||
int flag = tenPersonDao.insert(entity);
|
int flag = tenPersonDao.insert(entity);
|
||||||
if (flag == 1) {
|
if (flag == 1) {
|
||||||
//保存App用户
|
//保存App用户
|
||||||
|
@ -687,11 +688,16 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
appUserScopeService.removeById(as.getUserScopeId());
|
appUserScopeService.removeById(as.getUserScopeId());
|
||||||
}
|
}
|
||||||
//删除卡号
|
//删除卡号
|
||||||
// TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
|
||||||
// .eq("person_id",entity.getPersonId()));
|
List<TenDoorCardEntity> pcl = tenDoorCardService.list(new QueryWrapper<TenDoorCardEntity>()
|
||||||
// if(card!=null){
|
.eq("person_id",entity.getPersonId()));
|
||||||
// tenDoorCardService.removeById(card);
|
for(TenDoorCardEntity cardEntity: pcl){
|
||||||
// }
|
tenDoorCardService.removeById(cardEntity.getDoorCardId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//删除人员
|
//删除人员
|
||||||
tenPersonDao.logicDeleteById(personId, cellId);
|
tenPersonDao.logicDeleteById(personId, cellId);
|
||||||
|
|
||||||
|
@ -1093,62 +1099,22 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getDoorCardEntity() != null) {
|
if (entity.getDoorCardEntity() != null) {
|
||||||
|
// TenDoorCardEntity oldCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
// .eq("person_id", entity.getPersonId()));
|
||||||
|
|
||||||
|
List<TenDoorCardEntity> personDoorCardList = tenDoorCardService.list(
|
||||||
|
new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
.eq("person_id",entity.getPersonId())
|
||||||
|
);
|
||||||
|
for(TenDoorCardEntity cardEntity: personDoorCardList){
|
||||||
|
tenDoorCardService.removeById(cardEntity.getDoorCardId());
|
||||||
|
}
|
||||||
|
|
||||||
TenDoorCardEntity oldCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
TenDoorCardEntity oldCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
.eq("person_id", entity.getPersonId()));
|
.eq("door_card",entity.getDoorCardEntity().getDoorCard())
|
||||||
if (oldCard != null) {
|
.eq("cell_id",entity.getCellId()));
|
||||||
//修改 ,卡号为空,删除记录
|
if(oldCard==null){
|
||||||
if (entity.getDoorCardEntity().getDoorCard() == null || entity.getDoorCardEntity().getDoorCard().isEmpty()) {
|
// //增加
|
||||||
tenDoorCardService.removeById(oldCard);
|
|
||||||
} else {
|
|
||||||
//修改
|
|
||||||
if (!entity.getDoorCardEntity().getDoorCard().equals(oldCard.getDoorCard())) {
|
|
||||||
TenDoorCardEntity newCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
|
||||||
.eq("door_card", entity.getDoorCardEntity().getDoorCard()));
|
|
||||||
if (newCard != null) {
|
|
||||||
return "卡号已经使用";
|
|
||||||
} else {
|
|
||||||
if (entity.getDoorCardEntity().getValidBegin() == null) {
|
|
||||||
oldCard.setValidBegin(new Date());
|
|
||||||
} else {
|
|
||||||
oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
|
|
||||||
}
|
|
||||||
if (entity.getDoorCardEntity().getValidEnd() == null) {
|
|
||||||
Date date = new Date();
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTime(date);//设置起时间
|
|
||||||
cal.add(Calendar.YEAR, 10);//增加一年
|
|
||||||
// System.out.println("输出::"+cal.getTime());
|
|
||||||
oldCard.setValidEnd(cal.getTime());
|
|
||||||
} else {
|
|
||||||
oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
|
||||||
}
|
|
||||||
oldCard.setDoorCard(entity.getDoorCardEntity().getDoorCard());
|
|
||||||
oldCard.setLastUpdateTime(new Date());
|
|
||||||
tenDoorCardService.updateById(oldCard);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (entity.getDoorCardEntity().getValidBegin() == null) {
|
|
||||||
oldCard.setValidBegin(new Date());
|
|
||||||
} else {
|
|
||||||
oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
|
|
||||||
}
|
|
||||||
if (entity.getDoorCardEntity().getValidEnd() == null) {
|
|
||||||
Date date = new Date();
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTime(date);//设置起时间
|
|
||||||
cal.add(Calendar.YEAR, 20);//增加一年
|
|
||||||
// System.out.println("输出::"+cal.getTime());
|
|
||||||
oldCard.setValidEnd(cal.getTime());
|
|
||||||
} else {
|
|
||||||
oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
|
||||||
}
|
|
||||||
// oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
|
||||||
oldCard.setLastUpdateTime(new Date());
|
|
||||||
tenDoorCardService.updateById(oldCard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//增加
|
|
||||||
TenDoorCardEntity newCard = new TenDoorCardEntity();
|
TenDoorCardEntity newCard = new TenDoorCardEntity();
|
||||||
newCard.setPersonId(entity.getPersonId());
|
newCard.setPersonId(entity.getPersonId());
|
||||||
if (entity.getDoorCardEntity().getValidBegin() == null) {
|
if (entity.getDoorCardEntity().getValidBegin() == null) {
|
||||||
|
@ -1174,7 +1140,90 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
newCard.setCreateTime(now);
|
newCard.setCreateTime(now);
|
||||||
newCard.setLastUpdateTime(now);
|
newCard.setLastUpdateTime(now);
|
||||||
tenDoorCardService.save(newCard);
|
tenDoorCardService.save(newCard);
|
||||||
|
}else{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (oldCard != null) {
|
||||||
|
// //修改 ,卡号为空,删除记录
|
||||||
|
// if (entity.getDoorCardEntity().getDoorCard() == null || entity.getDoorCardEntity().getDoorCard().isEmpty()) {
|
||||||
|
// tenDoorCardService.removeById(oldCard);
|
||||||
|
// } else {
|
||||||
|
// //修改
|
||||||
|
// if (!entity.getDoorCardEntity().getDoorCard().equals(oldCard.getDoorCard())) {
|
||||||
|
// TenDoorCardEntity newCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
|
||||||
|
// .eq("door_card", entity.getDoorCardEntity().getDoorCard()));
|
||||||
|
// if (newCard != null) {
|
||||||
|
// return "卡号已经使用";
|
||||||
|
// } else {
|
||||||
|
// if (entity.getDoorCardEntity().getValidBegin() == null) {
|
||||||
|
// oldCard.setValidBegin(new Date());
|
||||||
|
// } else {
|
||||||
|
// oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
|
||||||
|
// }
|
||||||
|
// if (entity.getDoorCardEntity().getValidEnd() == null) {
|
||||||
|
// Date date = new Date();
|
||||||
|
// Calendar cal = Calendar.getInstance();
|
||||||
|
// cal.setTime(date);//设置起时间
|
||||||
|
// cal.add(Calendar.YEAR, 10);//增加一年
|
||||||
|
//// System.out.println("输出::"+cal.getTime());
|
||||||
|
// oldCard.setValidEnd(cal.getTime());
|
||||||
|
// } else {
|
||||||
|
// oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
||||||
|
// }
|
||||||
|
// oldCard.setDoorCard(entity.getDoorCardEntity().getDoorCard());
|
||||||
|
// oldCard.setLastUpdateTime(new Date());
|
||||||
|
// tenDoorCardService.updateById(oldCard);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (entity.getDoorCardEntity().getValidBegin() == null) {
|
||||||
|
// oldCard.setValidBegin(new Date());
|
||||||
|
// } else {
|
||||||
|
// oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
|
||||||
|
// }
|
||||||
|
// if (entity.getDoorCardEntity().getValidEnd() == null) {
|
||||||
|
// Date date = new Date();
|
||||||
|
// Calendar cal = Calendar.getInstance();
|
||||||
|
// cal.setTime(date);//设置起时间
|
||||||
|
// cal.add(Calendar.YEAR, 20);//增加一年
|
||||||
|
//// System.out.println("输出::"+cal.getTime());
|
||||||
|
// oldCard.setValidEnd(cal.getTime());
|
||||||
|
// } else {
|
||||||
|
// oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
||||||
|
// }
|
||||||
|
//// oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
||||||
|
// oldCard.setLastUpdateTime(new Date());
|
||||||
|
// tenDoorCardService.updateById(oldCard);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// //增加
|
||||||
|
// TenDoorCardEntity newCard = new TenDoorCardEntity();
|
||||||
|
// newCard.setPersonId(entity.getPersonId());
|
||||||
|
// if (entity.getDoorCardEntity().getValidBegin() == null) {
|
||||||
|
// newCard.setValidBegin(new Date());
|
||||||
|
// } else {
|
||||||
|
// newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
|
||||||
|
// }
|
||||||
|
// if (entity.getDoorCardEntity().getValidEnd() == null) {
|
||||||
|
// Date date = new Date();
|
||||||
|
// Calendar cal = Calendar.getInstance();
|
||||||
|
// cal.setTime(date);//设置起时间
|
||||||
|
// cal.add(Calendar.YEAR, 10);//增加一年
|
||||||
|
//// System.out.println("输出::"+cal.getTime());
|
||||||
|
// newCard.setValidEnd(cal.getTime());
|
||||||
|
// } else {
|
||||||
|
// newCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
||||||
|
// }
|
||||||
|
//// newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
|
||||||
|
//// newCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
|
||||||
|
// newCard.setCellId(entity.getCellId());
|
||||||
|
// newCard.setDoorCard(entity.getDoorCardEntity().getDoorCard());
|
||||||
|
// Date now = new Date();
|
||||||
|
// newCard.setCreateTime(now);
|
||||||
|
// newCard.setLastUpdateTime(now);
|
||||||
|
// tenDoorCardService.save(newCard);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
tenPersonDao.updateById(entity);
|
tenPersonDao.updateById(entity);
|
||||||
|
@ -1238,8 +1287,8 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@CacheEvict(value = "TenPerson", allEntries = true)
|
@CacheEvict(value = "TenPerson", allEntries = true)
|
||||||
public void updateStatusByIds(TenPersonEntity[] entity) {
|
public void updateStatusByIds(List<TenPersonEntity> entitys) {
|
||||||
for (TenPersonEntity personEntity : entity) {
|
for (TenPersonEntity personEntity : entitys) {
|
||||||
updateStatusById(personEntity);
|
updateStatusById(personEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1844,31 +1893,64 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
// tenPerson.setFaceImage(orgImageFileName);
|
// tenPerson.setFaceImage(orgImageFileName);
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
//--------------------------------处理图片大小流的方式------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------处理图片大小------------------------------------------------------
|
|
||||||
if (tenPerson.getOrgImage() != null && !tenPerson.getOrgImage().isEmpty()) {
|
if (tenPerson.getOrgImage() != null && !tenPerson.getOrgImage().isEmpty()) {
|
||||||
String orgFileStr = "/root/minio/data/cell/" + tenPerson.getOrgImage();
|
// String orgFileStr = "/root/minio/data/cell/" + tenPerson.getOrgImage();
|
||||||
// String orgFileStr = "/home/server001/minio/data/cell/"+ tenPerson.getOrgImage();
|
// String orgFileStr = "/home/server001/minio/data/cell/"+ tenPerson.getOrgImage();
|
||||||
|
InputStream is = null;
|
||||||
|
InputStream orgInputStream = null;
|
||||||
try {
|
try {
|
||||||
File picture = new File(orgFileStr);
|
orgInputStream = minioClient.getObject(minioConfig.getBucketName(), tenPerson.getOrgImage());
|
||||||
BufferedImage sourceImg = ImageIO.read(new FileInputStream(picture));
|
BufferedImage sourceImg = ImageIO.read(orgInputStream);
|
||||||
int w = sourceImg.getWidth();
|
int w = sourceImg.getWidth();
|
||||||
int h = sourceImg.getHeight();
|
int h = sourceImg.getHeight();
|
||||||
if (w > 1080 || h > 1080) {
|
if (w > 1080 || h > 1080) {
|
||||||
Thumbnails.of(orgFileStr)
|
sourceImg = ThumbnailsUtils.resizeImageOne(sourceImg,1080,1080);
|
||||||
.size(1080, 1080)
|
byte[] data = ImageUtils.imageToBytes(sourceImg);
|
||||||
.toFile(orgFileStr);
|
is = new ByteArrayInputStream(data);
|
||||||
|
int rl = is.available();
|
||||||
|
PutObjectOptions putObjectOptionsResize = new PutObjectOptions(rl, -1L);
|
||||||
|
putObjectOptionsResize.setContentType("image/jpeg");
|
||||||
|
this.minioClient.putObject(this.minioConfig
|
||||||
|
.getBucketName(), tenPerson.getOrgImage(), is, putObjectOptionsResize);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if(is!=null){
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
if(orgInputStream!=null){
|
||||||
|
orgInputStream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//--------------------------------处理图片大小------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------处理图片大小------------------------------------------------------
|
||||||
|
// if (tenPerson.getOrgImage() != null && !tenPerson.getOrgImage().isEmpty()) {
|
||||||
|
// String orgFileStr = "/root/minio/data/cell/" + tenPerson.getOrgImage();
|
||||||
|
//// String orgFileStr = "/home/server001/minio/data/cell/"+ tenPerson.getOrgImage();
|
||||||
|
// try {
|
||||||
|
// File picture = new File(orgFileStr);
|
||||||
|
// BufferedImage sourceImg = ImageIO.read(new FileInputStream(picture));
|
||||||
|
// int w = sourceImg.getWidth();
|
||||||
|
// int h = sourceImg.getHeight();
|
||||||
|
// if (w > 1080 || h > 1080) {
|
||||||
|
// Thumbnails.of(orgFileStr)
|
||||||
|
// .size(1080, 1080)
|
||||||
|
// .toFile(orgFileStr);
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error(e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
//--------------------------------处理图片大小------------------------------------------------------
|
//--------------------------------处理图片大小------------------------------------------------------
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
tenPerson.setStatus(0);
|
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
|
||||||
log.error("上传图片失败" + e.getMessage());
|
log.error("上传图片失败" + e.getMessage());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,16 +11,18 @@ import java.net.URLDecoder;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import net.shapelight.common.utils.DateUtils;
|
import net.shapelight.common.utils.DateUtils;
|
||||||
import net.shapelight.common.utils.MD5Utils;
|
import net.shapelight.common.utils.MD5Utils;
|
||||||
import net.shapelight.common.utils.UUIDUtil;
|
import net.shapelight.common.utils.UUIDUtil;
|
||||||
|
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
|
||||||
|
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||||
|
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||||
|
import net.shapelight.modules.ten.entity.TenTranEntity;
|
||||||
import net.shapelight.modules.xian.utils.AESUtils;
|
import net.shapelight.modules.xian.utils.AESUtils;
|
||||||
import net.shapelight.modules.xian.utils.XaHttpUtils;
|
import net.shapelight.modules.xian.utils.XaHttpUtils;
|
||||||
import net.shapelight.modules.xian.utils.XaUtils;
|
import net.shapelight.modules.xian.utils.XaUtils;
|
||||||
import net.shapelight.modules.xian.vo.XaData;
|
import net.shapelight.modules.xian.vo.*;
|
||||||
import net.shapelight.modules.xian.vo.XaPages;
|
|
||||||
import net.shapelight.modules.xian.vo.XaSYFW;
|
|
||||||
import net.shapelight.modules.xian.vo.XaSYRK;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -313,6 +315,72 @@ public class XaApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 欧风园
|
||||||
|
* 停车场名称:欧风园小区(610113100000000000267)
|
||||||
|
* 设备名称:停车场设备
|
||||||
|
* 设备编号: 61011310001000000267
|
||||||
|
*/
|
||||||
|
private static void processRecordCarEnter() {
|
||||||
|
|
||||||
|
String appid = "1297164778041095";
|
||||||
|
String appsecret = "22971647780410956329716477804109";
|
||||||
|
String xqid = "610113600000000004538";
|
||||||
|
|
||||||
|
String apiUrl = getFwikUrl(appid, appsecret);
|
||||||
|
System.out.println(apiUrl);
|
||||||
|
|
||||||
|
List<XaTCCTCSBXX> syncRecords = new ArrayList();
|
||||||
|
XaTCCTCSBXX syncRecord = new XaTCCTCSBXX();
|
||||||
|
|
||||||
|
|
||||||
|
syncRecord.setLV_TCCBH("610113100000000000267");
|
||||||
|
syncRecord.setLV_CPHM("陕A66GB0");
|
||||||
|
syncRecord.setLV_CPLX("03");//01 大型汽车号牌 2 小型汽车号牌 03 使馆汽车号牌 04 领馆汽车号牌
|
||||||
|
syncRecord.setLV_GCSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
|
||||||
|
syncRecord.setLV_GCLX("1");//1进场2出场
|
||||||
|
syncRecord.setLV_JKBM("101");
|
||||||
|
syncRecord.setLV_SBXT("10");//申报系统,默认10
|
||||||
|
syncRecord.setLV_KKSBBH("61011310001000000267");
|
||||||
|
syncRecord.setLV_PROCMODE("PMINSERT");
|
||||||
|
|
||||||
|
syncRecords.add(syncRecord);
|
||||||
|
|
||||||
|
|
||||||
|
XaData jsonData = new XaData();
|
||||||
|
jsonData.setDatas(syncRecords);
|
||||||
|
|
||||||
|
List<XaPages> listPages = new ArrayList<>();
|
||||||
|
XaPages pages = new XaPages();
|
||||||
|
pages.setPno("1");
|
||||||
|
pages.setPsize("1");
|
||||||
|
// pages.setTcount("1");
|
||||||
|
listPages.add(pages);
|
||||||
|
jsonData.setPages(listPages);
|
||||||
|
|
||||||
|
String json = JSONObject.toJSONString(jsonData);
|
||||||
|
|
||||||
|
String b = XaUtils.encryptStr(json.trim(), appsecret);
|
||||||
|
// String c = XaUtils.decodeStr(b,appsecret);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// String b = AESUtils.encrypt(json.trim(), appsecret);
|
||||||
|
String c = AESUtils.decrypt(b, appsecret);
|
||||||
|
System.out.println(c);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
{"sta":{"code":"9999","des":"失败","ErrorLineParameter": "1 " },"datas":[{"Result":"第1条记录出错储过程出错ORA-20001 停车场不存在!lv_tccbh"}],"pages":[{"psize":"1","tcount":"1","pno":"1","tsize":"0"}]}
|
||||||
|
*/
|
||||||
|
|
||||||
|
String resJson = XaApi.httpPOSTJson(apiUrl, b, "TCCTCSBXX", "TCCTCSBXX", appid, appsecret,"202104140025");
|
||||||
|
System.out.println(resJson);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
/**
|
/**
|
||||||
* appid: 1297164778041095
|
* appid: 1297164778041095
|
||||||
|
@ -334,10 +402,22 @@ public class XaApi {
|
||||||
// System.out.println(address);
|
// System.out.println(address);
|
||||||
//6.3.1 实有房屋信息----------------------------------------------------------------------------
|
//6.3.1 实有房屋信息----------------------------------------------------------------------------
|
||||||
// 1820591355 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号4栋1单元3层4131号 长安南路 108.942481 34.207741 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000013000001000003000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
// 1820591355 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号4栋1单元3层4131号 长安南路 108.942481 34.207741 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000013000001000003000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
/*
|
||||||
// syncRoom();
|
1820580961 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元1层1111号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000001000001 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820580962 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元1层1112号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000001000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820580963 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元2层1121号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000002000001 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820580964 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元2层1122号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000002000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820580967 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元3层1131号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000003000001 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820580968 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元3层1132号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000003000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820580969 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元4层1141号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000004000001 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820580970 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元4层1142号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000004000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
1820581243 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元5层1152号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000005000001 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
|
*/
|
||||||
|
syncRoom();
|
||||||
//6.3.2 实有人口信息----------------------------------------------------------------------------
|
//6.3.2 实有人口信息----------------------------------------------------------------------------
|
||||||
// syncPerson();
|
// syncPerson();
|
||||||
|
//6.3.9 车辆出入记录-------------------------------------------------------------
|
||||||
|
processRecordCarEnter();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,9 @@
|
||||||
<if test="params.cellId != null and params.cellId!=''">
|
<if test="params.cellId != null and params.cellId!=''">
|
||||||
and r.cell_id = #{params.cellId}
|
and r.cell_id = #{params.cellId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="params.sn != null and params.sn!=''">
|
||||||
|
and r.device_sn = #{params.sn}
|
||||||
|
</if>
|
||||||
<if test="params.name != null and params.name!=''">
|
<if test="params.name != null and params.name!=''">
|
||||||
and `name` like CONCAT('%', '${params.name}', '%')
|
and `name` like CONCAT('%', '${params.name}', '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
package gb;
|
||||||
|
|
||||||
|
import io.minio.MinioClient;
|
||||||
|
import io.minio.PutObjectOptions;
|
||||||
|
import net.coobird.thumbnailator.Thumbnails;
|
||||||
|
import net.shapelight.AdminApplication;
|
||||||
|
import net.shapelight.common.config.MinioConfig;
|
||||||
|
import net.shapelight.common.utils.ImageUtils;
|
||||||
|
import net.shapelight.common.utils.StringUtils;
|
||||||
|
import net.shapelight.common.utils.ThumbnailsUtils;
|
||||||
|
import net.shapelight.common.utils.UUIDUtil;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = AdminApplication.class)
|
||||||
|
public class CarImageTest {
|
||||||
|
@Autowired
|
||||||
|
private MinioClient minioClient;
|
||||||
|
@Autowired
|
||||||
|
private MinioConfig minioConfig;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void ossTest() {
|
||||||
|
|
||||||
|
String imgUrl = "http://icecloud-prod.oss-cn-shenzhen.aliyuncs.com/P1610092525/image/202104/25/%E9%99%95A207AY_out_2_5802.jpg?Expires=1619330640&OSSAccessKeyId=LTAI4Furp7fmTGDMRhJ95jaX&Signature=2xS3T%2FlK9LMe%2FjAOotCEvIlCOmU%3D";
|
||||||
|
imgUrl = imgUrl.replace("amp;", "");
|
||||||
|
String fileName = "car/" + 222 + "/" + UUIDUtil.uuid() + ".jpg";
|
||||||
|
if (!StringUtils.isEmpty(imgUrl)) {
|
||||||
|
URL url = null;
|
||||||
|
InputStream is = null;
|
||||||
|
HttpURLConnection httpUrl = null;
|
||||||
|
try {
|
||||||
|
url = new URL(imgUrl);
|
||||||
|
|
||||||
|
|
||||||
|
BufferedImage image = ImageIO.read(url);
|
||||||
|
//获取图片的宽、高
|
||||||
|
System.out.println("Width: " + image.getWidth());
|
||||||
|
System.out.println("Height: " + image.getHeight());
|
||||||
|
//调整图片大小为 400X400尺寸
|
||||||
|
// BufferedImage newImage = ImageUtils.resizeImage(image,400,400);
|
||||||
|
int w = image.getWidth();
|
||||||
|
int h = image.getHeight();
|
||||||
|
if(w>1024 || h>1024){
|
||||||
|
image = ThumbnailsUtils.resizeImageOne(image,1024,1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// BufferedImage resizeBuff = ThumbnailsUtils.resizeImageOne(image,1024,1024);
|
||||||
|
|
||||||
|
|
||||||
|
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
// if (w > 1024 || h > 1024) {
|
||||||
|
// Thumbnails.of(image)
|
||||||
|
// .size(1024, 1024)
|
||||||
|
//// .outputFormat("JPEG")
|
||||||
|
//// .outputQuality(1)
|
||||||
|
// .toOutputStream(outputStream);
|
||||||
|
// }
|
||||||
|
|
||||||
|
byte[] data = ImageUtils.imageToBytes(image);
|
||||||
|
// ByteArrayInputStream
|
||||||
|
is = new ByteArrayInputStream(data);
|
||||||
|
int rl = is.available();
|
||||||
|
|
||||||
|
|
||||||
|
// httpUrl = (HttpURLConnection) url.openConnection();
|
||||||
|
// httpUrl.connect();
|
||||||
|
//// httpUrl.getInputStream();
|
||||||
|
// is = httpUrl.getInputStream();
|
||||||
|
// int rl = httpUrl.getContentLength();
|
||||||
|
// int l = is.available();
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(rl, -1L);
|
||||||
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
|
this.minioClient.putObject(this.minioConfig
|
||||||
|
.getBucketName(), fileName, is, putObjectOptions);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
fileName = "";
|
||||||
|
} finally {
|
||||||
|
if (is != null)
|
||||||
|
try {
|
||||||
|
is.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (httpUrl != null)
|
||||||
|
httpUrl.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package gb;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
|
||||||
|
|
||||||
|
public class DownloadImage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
download("http://icecloud-prod.oss-cn-shenzhen.aliyuncs.com/P1613901148/image/202104/25/%E9%99%95A93S1Z_out_2_3624.jpg?Expires=1619319421&OSSAccessKeyId=LTAI4Furp7fmTGDMRhJ95jaX&Signature=ud%2F7WaYM7%2FC%2BSizTHUk639twGTY%3D", "1_li1325169021.jpg","/home/huangyifang/tempFiles");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void download(String urlString, String filename,String savePath) throws Exception {
|
||||||
|
// 构造URL
|
||||||
|
URL url = new URL(urlString);
|
||||||
|
// 打开连接
|
||||||
|
URLConnection con = url.openConnection();
|
||||||
|
//设置请求超时为5s
|
||||||
|
con.setConnectTimeout(5*1000);
|
||||||
|
// 输入流
|
||||||
|
InputStream is = con.getInputStream();
|
||||||
|
|
||||||
|
// 1K的数据缓冲
|
||||||
|
byte[] bs = new byte[1024];
|
||||||
|
// 读取到的数据长度
|
||||||
|
int len;
|
||||||
|
// 输出的文件流
|
||||||
|
File sf=new File(savePath);
|
||||||
|
if(!sf.exists()){
|
||||||
|
sf.mkdirs();
|
||||||
|
}
|
||||||
|
// 获取图片的扩展名
|
||||||
|
String extensionName = "jpg";
|
||||||
|
// 新的图片文件名 = 编号 +"."图片扩展名
|
||||||
|
String newFileName = "aaaaa.jpg";
|
||||||
|
OutputStream os = new FileOutputStream(sf.getPath()+"//"+filename);
|
||||||
|
// 开始读取
|
||||||
|
while ((len = is.read(bs)) != -1) {
|
||||||
|
os.write(bs, 0, len);
|
||||||
|
}
|
||||||
|
// 完毕,关闭所有链接
|
||||||
|
os.close();
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue