对接西安接口
This commit is contained in:
parent
ba35f83af0
commit
c1532ee4c9
|
@ -54,6 +54,29 @@ public class MD5Utils {
|
|||
return md5StrBuff.toString();
|
||||
}
|
||||
|
||||
public static String md5Str(String str) {
|
||||
MessageDigest messageDigest = null;
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.reset();
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
}catch (Exception e) {
|
||||
return str;
|
||||
}
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
return md5StrBuff.toString().toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
private static byte[] md5(String s)
|
||||
{
|
||||
|
|
|
@ -1,63 +1,78 @@
|
|||
package net.shapelight.modules.car.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.PutObjectOptions;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.utils.R;
|
||||
import net.shapelight.modules.ten.entity.TenCarEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRecordEntity;
|
||||
import net.shapelight.modules.ten.service.TenCarService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordService;
|
||||
import net.shapelight.modules.ten.service.TenRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 停车接口
|
||||
*/
|
||||
|
||||
import net.shapelight.common.config.GlobalValue;
|
||||
import net.shapelight.common.config.MinioConfig;
|
||||
import net.shapelight.common.utils.R;
|
||||
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.TenPackRecordEnterEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
|
||||
import net.shapelight.modules.ten.service.TenCarService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordEnterService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordExitService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/car/v1")
|
||||
@RequestMapping({"/api/car/v1"})
|
||||
@Api("停车接口")
|
||||
@Slf4j
|
||||
public class CarOpenApi {
|
||||
private static final Logger log = LoggerFactory.getLogger(net.shapelight.modules.car.controller.CarOpenApi.class);
|
||||
|
||||
@Autowired
|
||||
private TenCarService tenCarService;
|
||||
|
||||
@Autowired
|
||||
private TenPackRecordService tenPackRecordService;
|
||||
|
||||
@PostMapping("/getMsg/{cellId}")
|
||||
@ApiOperation(value = "获取Msg")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "sn", value = "设备SN", paramType = "query", dataType = "String", required = true),
|
||||
})
|
||||
public R getMsg(@PathVariable("cellId") Long cellId, @RequestParam Map<String, Object> params) {
|
||||
@Autowired
|
||||
private GlobalValue globalValue;
|
||||
|
||||
@Autowired
|
||||
private MinioClient minioClient;
|
||||
|
||||
@Autowired
|
||||
private MinioConfig minioConfig;
|
||||
|
||||
@Autowired
|
||||
private TenPackRecordEnterService tenPackRecordEnterService;
|
||||
|
||||
@Autowired
|
||||
private TenPackRecordExitService tenPackRecordExitService;
|
||||
|
||||
@PostMapping({"/getMsg/{cellId}"})
|
||||
@ApiOperation("获取MSG")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "sn", value = "设备sn", paramType = "query", dataType = "String", required = true)})
|
||||
public R getMsg(@PathVariable("cellId") Long cellId, @RequestParam Map<String, Object> params) {
|
||||
JSONObject msgJson = JSONObject.parseObject((String) params.get("Msg"));
|
||||
int cmd = msgJson.getInteger("command");
|
||||
/*
|
||||
Msg='{"workstationid":1,
|
||||
"message":"",
|
||||
"VLP":"粤B66666",
|
||||
"position":"0","method":"","username":"test",
|
||||
"Ctypename":"月租车","model":"MAGOTAN","balance":"0.05",
|
||||
"registertime":"2017-05-25","status":1,"vehiclename":"张三",
|
||||
"parkid":1, "vehiclenumber":"1234567890123456789012",
|
||||
"certificate":"12345678901234567","Vtypename":"小型车",
|
||||
"result":0,"cardsn":"12","telephone":"13800000000",
|
||||
"Vtype":1,"address":"深圳市龙华区民治街道","receivablefee":"0.00",
|
||||
"password":"d41d8cd98f00b204e9800998ecf8427e","endtime":
|
||||
"2017-06-24","command":13,"deposit":"0","mode":0,"color":"黑色","code":0,
|
||||
"recordid":0,"Ctype":2,"starttime":"2017-05-25","actualfee":"0.00"}'
|
||||
*/
|
||||
int cmd = msgJson.getInteger("command").intValue();
|
||||
if (cmd == 13 || cmd == 19 || cmd == 20) {
|
||||
TenCarEntity car = new TenCarEntity();
|
||||
car.setCellId(cellId);
|
||||
|
@ -72,24 +87,11 @@ public class CarOpenApi {
|
|||
car.setEndTime(msgJson.getDate("endtime"));
|
||||
car.setParkName(msgJson.getString("parkname"));
|
||||
car.setTelephone(msgJson.getString("telephone"));
|
||||
tenCarService.saveOrUpdate(car);
|
||||
}
|
||||
/*
|
||||
Msg= '{"outtime":"2017-04-19 23:21:45","workstationid":1,
|
||||
VLP":"粤B12345"," username ":"test","method":"","Ctypename":"临时车","channeltype":0,
|
||||
"operator":"管理员","inpicture1":"","direction":0,"password":"d41d8cd98f00b204e9800998ecf8427e",
|
||||
"parkid":1,"inVLP":"","remainspace":100,"outchannel":2,"Vtypename":"小型车","cardsn":"116021386901",
|
||||
"inchannelname":"停车场入口","outchannelname":"停车场入口","Vtype":1,"receivablefee":"5.00","command":1,
|
||||
"outpicture":"","inchannel":1,"totalspace":100,"intime":"2017-04-19 23:21:45","mode":0,"code":1,
|
||||
"recordid":70,"Ctype":3,"inpicture":"","actualfee":"5.00","consumefee":"0.00",
|
||||
"consumetime":"2017-04-19 23:21:45","consumecode":"0","consumename":""} '
|
||||
*/
|
||||
else if (cmd == 1 || cmd == 2) { //识别记录
|
||||
this.tenCarService.saveOrUpdate(car);
|
||||
} else if (cmd == 1 || cmd == 2) {
|
||||
TenPackRecordEntity record = new TenPackRecordEntity();
|
||||
|
||||
record.setParkId(msgJson.getString("parkid"));
|
||||
record.setRecordId(msgJson.getString("recordid"));
|
||||
|
||||
record.setCellId(cellId);
|
||||
record.setVlp(msgJson.getString("VLP"));
|
||||
record.setCTypeName(msgJson.getString("Ctypename"));
|
||||
|
@ -103,7 +105,6 @@ public class CarOpenApi {
|
|||
record.setInPictureBase64(msgJson.getString("inpicturedata"));
|
||||
record.setInPicturePlate(msgJson.getString("inpicture1"));
|
||||
record.setInPicturePlateBase64(msgJson.getString("inpicturedata1"));
|
||||
|
||||
}
|
||||
record.setOutChannelName(msgJson.getString("outchannelname"));
|
||||
record.setOutTime(msgJson.getDate("outtime"));
|
||||
|
@ -111,18 +112,144 @@ public class CarOpenApi {
|
|||
record.setOutPictureBase64(msgJson.getString("outpicturedata"));
|
||||
record.setOutPicturePlate(msgJson.getString("outpicture1"));
|
||||
record.setOutPicturePlateBase64(msgJson.getString("outpicturedata1"));
|
||||
|
||||
record.setInVlp(msgJson.getString("inVLP"));
|
||||
record.setParkName(msgJson.getString("parkname"));
|
||||
|
||||
record.setReceivableFee(msgJson.getString("receivablefee"));
|
||||
record.setActualFee(msgJson.getString("actualfee"));
|
||||
|
||||
tenPackRecordService.saveOrUpdateByRecordId(record);
|
||||
|
||||
|
||||
this.tenPackRecordService.saveOrUpdateByRecordId(record);
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/pushEnterRecord"})
|
||||
@ApiOperation("第三方推送入场记录")
|
||||
public Map pushEnterRecord(@RequestBody Object object) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
res.put("code", "401");
|
||||
res.put("msg", "签名结果不一致");
|
||||
JSONObject msgJson = (JSONObject) JSONObject.toJSON(object);
|
||||
String sign = msgJson.getString("sign");
|
||||
String appKey = msgJson.getString("appKey");
|
||||
Long timestamp = msgJson.getLong("timestamp");
|
||||
JSONObject bizContent = msgJson.getJSONObject("bizContent");
|
||||
String parkCode = bizContent.getString("parkCode");
|
||||
String parkName = bizContent.getString("parkName");
|
||||
String orderNum = bizContent.getString("orderNum");
|
||||
String plateNum = bizContent.getString("plateNum");
|
||||
String channelName = bizContent.getString("channelName");
|
||||
long enterTimeLong = bizContent.getLongValue("enterTime");
|
||||
Date enterTime = new Date(enterTimeLong * 1000L);
|
||||
int type = bizContent.getIntValue("type");
|
||||
int carType = bizContent.getIntValue("carType");
|
||||
String imgUrl = bizContent.getString("imgUrl");
|
||||
TenPackRecordEnterEntity enter = new TenPackRecordEnterEntity();
|
||||
enter.setParkCode(parkCode);
|
||||
enter.setParkName(parkName);
|
||||
enter.setOrderNumber(orderNum);
|
||||
enter.setPlateNumber(plateNum);
|
||||
enter.setChannelName(channelName);
|
||||
enter.setType(Integer.valueOf(type));
|
||||
enter.setCarType(Integer.valueOf(carType));
|
||||
enter.setEnterTime(enterTime);
|
||||
if (!StringUtils.isEmpty(imgUrl)) {
|
||||
URL url = null;
|
||||
InputStream is = null;
|
||||
HttpURLConnection httpUrl = null;
|
||||
try {
|
||||
url = new URL(imgUrl);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (is != null)
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (httpUrl != null)
|
||||
httpUrl.disconnect();
|
||||
}
|
||||
}
|
||||
this.tenPackRecordEnterService.save(enter);
|
||||
res.put("code", "200");
|
||||
res.put("msg", "成功");
|
||||
return res;
|
||||
}
|
||||
|
||||
@PostMapping({"/pushExitRecord"})
|
||||
@ApiOperation("第三方推送出场记录")
|
||||
public Map pushExitRecord(@RequestBody Object object) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
res.put("code", "401");
|
||||
res.put("msg", "签名结果不一致");
|
||||
JSONObject msgJson = (JSONObject) JSONObject.toJSON(object);
|
||||
String sign = msgJson.getString("sign");
|
||||
String appKey = msgJson.getString("appKey");
|
||||
Long timestamp = msgJson.getLong("timestamp");
|
||||
JSONObject bizContent = msgJson.getJSONObject("bizContent");
|
||||
String parkCode = bizContent.getString("parkCode");
|
||||
String parkName = bizContent.getString("parkName");
|
||||
String orderNum = bizContent.getString("orderNum");
|
||||
String plateNum = bizContent.getString("plateNum");
|
||||
String channelName = bizContent.getString("channelName");
|
||||
long exitTimeLong = bizContent.getLongValue("exitTime");
|
||||
Date exitTime = new Date(exitTimeLong * 1000L);
|
||||
int type = bizContent.getIntValue("type");
|
||||
int carType = bizContent.getIntValue("carType");
|
||||
long parkTime = bizContent.getLongValue("parkTime");
|
||||
String imgUrl = bizContent.getString("imgUrl");
|
||||
TenPackRecordExitEntity enter = new TenPackRecordExitEntity();
|
||||
enter.setParkCode(parkCode);
|
||||
enter.setParkName(parkName);
|
||||
enter.setOrderNumber(orderNum);
|
||||
enter.setPlateNumber(plateNum);
|
||||
enter.setChannelName(channelName);
|
||||
enter.setType(Integer.valueOf(type));
|
||||
enter.setCarType(Integer.valueOf(carType));
|
||||
enter.setExitTime(exitTime);
|
||||
enter.setPackTime(Long.valueOf(parkTime));
|
||||
if (!StringUtils.isEmpty(imgUrl)) {
|
||||
URL url = null;
|
||||
InputStream is = null;
|
||||
HttpURLConnection httpUrl = null;
|
||||
try {
|
||||
url = new URL(imgUrl);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (is != null)
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (httpUrl != null)
|
||||
httpUrl.disconnect();
|
||||
}
|
||||
}
|
||||
this.tenPackRecordExitService.save(enter);
|
||||
res.put("code", "200");
|
||||
res.put("msg", "成功");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package net.shapelight.modules.car.utils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import net.shapelight.common.utils.MD5Utils;
|
||||
|
||||
public class SignUtil {
|
||||
public static int compareSign(String appKey, long timestamp, String sign) {
|
||||
long nowLong = (new Date()).getTime() / 1000L;
|
||||
if (timestamp < nowLong - 300L || timestamp > nowLong + 300L)
|
||||
return 2;
|
||||
String signMd5 = MD5Utils.getMD5Str(appKey + timestamp);
|
||||
if (!signMd5.equalsIgnoreCase(signMd5))
|
||||
return 3;
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package net.shapelight.modules.job.task;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserService;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("xaAddressTask")
|
||||
@Slf4j
|
||||
public class XaAddressTask implements ITask {
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
|
||||
public void run(String params) {
|
||||
log.debug("xaApiTask定时任务正在执行", params);
|
||||
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
|
||||
for (SysUserEntity sysTenUser : allSysTenUser) {
|
||||
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
|
||||
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
|
||||
Integer type = object.getInteger("type");
|
||||
if (type.intValue() == 1) {
|
||||
String appId = object.getString("appId");
|
||||
String appSecret = object.getString("appSecret");
|
||||
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper) (new QueryWrapper())
|
||||
.eq("tenant_id", sysTenUser.getTenantId()));
|
||||
for (TenCellEntity cellEntity : allCells) {
|
||||
String xqid = cellEntity.getThirdId();
|
||||
if (xqid == null || xqid.length() > 0) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("xaApiTask定时任务执行完毕");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
package net.shapelight.modules.job.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.minio.MinioClient;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.config.MinioConfig;
|
||||
import net.shapelight.common.utils.DateUtils;
|
||||
import net.shapelight.modules.job.task.ITask;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserService;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRecordEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import net.shapelight.modules.ten.service.TenDeviceService;
|
||||
import net.shapelight.modules.ten.service.TenDoorCardService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordService;
|
||||
import net.shapelight.modules.ten.service.TenPersonService;
|
||||
import net.shapelight.modules.ten.service.TenRecordService;
|
||||
import net.shapelight.modules.ten.service.TenRoomService;
|
||||
import net.shapelight.modules.xian.service.XaApi;
|
||||
import net.shapelight.modules.xian.vo.XaRYJCZPXX;
|
||||
import net.shapelight.modules.xian.vo.XaRYRKPHOTO;
|
||||
import net.shapelight.modules.xian.vo.XaTCCTCSBZPXX;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component("xaImageTask")
|
||||
public class XaImageTask implements ITask {
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
@Autowired
|
||||
private TenRoomService tenRoomService;
|
||||
@Autowired
|
||||
private TenPersonService tenPersonService;
|
||||
@Autowired
|
||||
private TenDoorCardService tenDoorCardService;
|
||||
@Autowired
|
||||
private TenDeviceService tenDeviceService;
|
||||
@Autowired
|
||||
private TenRecordService tenRecordService;
|
||||
@Autowired
|
||||
private TenPackRecordService tenPackRecordService;
|
||||
@Autowired
|
||||
private MinioConfig minioConfig;
|
||||
@Autowired
|
||||
private MinioClient minioClient;
|
||||
|
||||
public void run(String params) {
|
||||
log.debug("xaImageTask定时任务正在执行", params);
|
||||
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
|
||||
for (SysUserEntity sysTenUser : allSysTenUser) {
|
||||
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
|
||||
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
|
||||
Integer type = object.getInteger("type");
|
||||
if (type.intValue() == 1) {
|
||||
String appId = object.getString("appId");
|
||||
String appSecret = object.getString("appSecret");
|
||||
String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
|
||||
if (fwikUrl != null) {
|
||||
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper)(new QueryWrapper())
|
||||
|
||||
.eq("tenant_id", sysTenUser.getTenantId()));
|
||||
Long tenantId = sysTenUser.getTenantId();
|
||||
for (TenCellEntity cellEntity : allCells) {
|
||||
String xqid = cellEntity.getThirdId();
|
||||
Long cellId = cellEntity.getCellId();
|
||||
if (xqid == null || xqid.length() > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("xaImageTask定时任务执行完毕");
|
||||
}
|
||||
|
||||
private void processRecordPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId, Long tenantId) {
|
||||
List<TenRecordEntity> records = this.tenRecordService.getNotSyncImage(cellId, tenantId);
|
||||
List<XaRYJCZPXX> syncrecords = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenRecordEntity record : records) {
|
||||
XaRYJCZPXX syncRecord = new XaRYJCZPXX();
|
||||
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMdd24HHmmss"));
|
||||
syncRecord.setLV_MJXTWYBM(record.getRecordId().toString());
|
||||
String faceUrl = record.getRecordFace();
|
||||
if (faceUrl != null && !faceUrl.isEmpty()) {
|
||||
String encode = "";
|
||||
InputStream inStream = null;
|
||||
ByteArrayOutputStream outStream = null;
|
||||
try {
|
||||
this.minioClient.statObject(this.minioConfig.getBucketName(), faceUrl);
|
||||
inStream = this.minioClient.getObject(this.minioConfig.getBucketName(), faceUrl);
|
||||
outStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = inStream.read(buffer)) != -1)
|
||||
outStream.write(buffer, 0, length);
|
||||
encode = Base64.getEncoder().encodeToString(outStream.toByteArray());
|
||||
syncRecord.setLV_ZPSJ(encode);
|
||||
} catch (Exception e) {
|
||||
log.error("底库不存在"+ faceUrl);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inStream != null)
|
||||
try {
|
||||
inStream.close();
|
||||
} catch (IOException e) {
|
||||
log.debug("inputStream close IOException:" + e.getMessage());
|
||||
}
|
||||
if (outStream != null)
|
||||
try {
|
||||
outStream.close();
|
||||
} catch (IOException e) {
|
||||
log.debug("outStream close IOException:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
syncrecords.add(syncRecord);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processRecordCar(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
|
||||
List<TenPackRecordEntity> records = this.tenPackRecordService.getNotSync(cellId);
|
||||
List<XaTCCTCSBZPXX> syncrecords = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenPackRecordEntity record : records) {
|
||||
XaTCCTCSBZPXX syncRecord = new XaTCCTCSBZPXX();
|
||||
syncRecord.setLV_ZPSJ(DateUtils.format(record.getInTime(), "yyyyMMdd24HHmmss"));
|
||||
syncrecords.add(syncRecord);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
|
||||
List<TenPersonEntity> persons = this.tenPersonService.getNotSyncImage(cellId);
|
||||
List<XaRYRKPHOTO> syncPersons = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenPersonEntity person : persons) {
|
||||
XaRYRKPHOTO syncPerson = new XaRYRKPHOTO();
|
||||
syncPerson.setLV_GMSFHM(person.getIdCard());
|
||||
syncPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMdd24HHmmss"));
|
||||
String faceUrl = person.getFaceImage();
|
||||
if (faceUrl != null && !faceUrl.isEmpty()) {
|
||||
String encode = "";
|
||||
InputStream inStream = null;
|
||||
ByteArrayOutputStream outStream = null;
|
||||
try {
|
||||
this.minioClient.statObject(this.minioConfig.getBucketName(), faceUrl);
|
||||
inStream = this.minioClient.getObject(this.minioConfig.getBucketName(), faceUrl);
|
||||
outStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = inStream.read(buffer)) != -1)
|
||||
outStream.write(buffer, 0, length);
|
||||
encode = Base64.getEncoder().encodeToString(outStream.toByteArray());
|
||||
syncPerson.setLV_ZP(encode);
|
||||
} catch (Exception e) {
|
||||
log.error("底库不存在"+ faceUrl);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inStream != null)
|
||||
try {
|
||||
inStream.close();
|
||||
} catch (IOException e) {
|
||||
log.debug("inputStream close IOException:" + e.getMessage());
|
||||
}
|
||||
if (outStream != null)
|
||||
try {
|
||||
outStream.close();
|
||||
} catch (IOException e) {
|
||||
log.debug("outStream close IOException:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
package net.shapelight.modules.job.task;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.utils.DateUtils;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserService;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.entity.TenDeviceEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRoomEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import net.shapelight.modules.ten.service.TenDeviceService;
|
||||
import net.shapelight.modules.ten.service.TenDoorCardService;
|
||||
import net.shapelight.modules.ten.service.TenPersonService;
|
||||
import net.shapelight.modules.ten.service.TenRoomService;
|
||||
import net.shapelight.modules.xian.service.XaApi;
|
||||
import net.shapelight.modules.xian.vo.XaMJKXX;
|
||||
import net.shapelight.modules.xian.vo.XaMJSBXX;
|
||||
import net.shapelight.modules.xian.vo.XaPages;
|
||||
import net.shapelight.modules.xian.vo.XaSYFW;
|
||||
import net.shapelight.modules.xian.vo.XaSYRK;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component("xaRealDataTask")
|
||||
public class XaRealDataTask implements ITask {
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
@Autowired
|
||||
private TenRoomService tenRoomService;
|
||||
@Autowired
|
||||
private TenPersonService tenPersonService;
|
||||
@Autowired
|
||||
private TenDoorCardService tenDoorCardService;
|
||||
@Autowired
|
||||
private TenDeviceService tenDeviceService;
|
||||
public void run(String params) {
|
||||
log.debug("xaApiTask定时任务正在执行", params);
|
||||
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
|
||||
for (SysUserEntity sysTenUser : allSysTenUser) {
|
||||
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
|
||||
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
|
||||
Integer type = object.getInteger("type");
|
||||
if (type.intValue() == 1) {
|
||||
String appId = object.getString("appId");
|
||||
String appSecret = object.getString("appSecret");
|
||||
String fwikUrl = "http://";
|
||||
if (fwikUrl != null) {
|
||||
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper)(new QueryWrapper())
|
||||
|
||||
.eq("tenant_id", sysTenUser.getTenantId()));
|
||||
for (TenCellEntity cellEntity : allCells) {
|
||||
String xqid = cellEntity.getThirdId();
|
||||
Long cellId = cellEntity.getCellId();
|
||||
if (xqid != null && xqid.length() > 0) {
|
||||
processRealRoom(appId, appSecret, xqid, fwikUrl, cellId);
|
||||
processRealPerson(appId, appSecret, xqid, fwikUrl, cellId);
|
||||
processDoorCard(appId, appSecret, xqid, fwikUrl, cellId);
|
||||
processDevice(appId, appSecret, xqid, fwikUrl, cellId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("xaApiTask定时任务执行完毕");
|
||||
}
|
||||
|
||||
private void processRealRoom(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
|
||||
List<TenRoomEntity> rooms = this.tenRoomService.getNotSync(cellId);
|
||||
List<XaSYFW> syncRooms = new ArrayList();
|
||||
int count = 0;
|
||||
for (TenRoomEntity room : rooms) {
|
||||
TenPersonEntity owner = this.tenPersonService.getOwner(room.getRoomId());
|
||||
if (owner != null) {
|
||||
XaSYFW realRoom = new XaSYFW();
|
||||
realRoom.setLV_FWLB("1");
|
||||
realRoom.setLV_FWXZ("2");
|
||||
realRoom.setLV_FWYT("4");
|
||||
realRoom.setLV_SFCZF("否");
|
||||
realRoom.setLV_FZ_GMSFHM(owner.getIdCard());
|
||||
realRoom.setLV_FZ_XM(owner.getName());
|
||||
realRoom.setLV_FZ_ZJZL("10");
|
||||
realRoom.setLV_FZ_ZJHM(owner.getIdCard());
|
||||
realRoom.setLV_FZ_LXDH(owner.getMobile());
|
||||
realRoom.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
|
||||
realRoom.setLV_FWXZZ("1000");
|
||||
realRoom.setLV_FWJG("1");
|
||||
realRoom.setLV_COMPUTERID(xqid);
|
||||
realRoom.setLV_PROCMODE("PMINSERT");
|
||||
syncRooms.add(realRoom);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Map<String, Object> xaData = new HashMap<>();
|
||||
if (syncRooms.size() > 0)
|
||||
xaData.put("datas", syncRooms);
|
||||
XaPages xapage = new XaPages();
|
||||
xapage.setPno("1");
|
||||
xapage.setPsize(count);
|
||||
xapage.setTcount(0);
|
||||
xapage.setTsize(0);
|
||||
String realRoomRes = XaApi.postData(fwikUrl, appId, appSecret, "1", "SYFW", "SYFW", xaData);
|
||||
}
|
||||
|
||||
private void processRealPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
|
||||
List<TenPersonEntity> realPersons = this.tenPersonService.getNotSync(cellId);
|
||||
List<XaSYRK> syncPersons = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenPersonEntity person : realPersons) {
|
||||
TenRoomEntity room = this.tenRoomService.getById(person.getRoomId(), person.getCellId());
|
||||
XaSYRK realPerson = new XaSYRK();
|
||||
realPerson.setLV_GMSFHM(person.getIdCard());
|
||||
realPerson.setLV_XM(person.getName());
|
||||
realPerson.setLV_ZJZL("10");
|
||||
realPerson.setLV_ZJHM(person.getIdCard());
|
||||
realPerson.setLV_JZDZ_DZBM(room.getDzbm());
|
||||
realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
|
||||
realPerson.setLV_COMPUTERID(xqid);
|
||||
realPerson.setLV_PROCMODE("PMINSERT");
|
||||
syncPersons.add(realPerson);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processDoorCard(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
|
||||
List<TenPersonEntity> realPersons = this.tenPersonService.getNotSyncCard(cellId);
|
||||
List<XaMJKXX> syncDoorCard = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenPersonEntity person : realPersons) {
|
||||
XaMJKXX realCard = new XaMJKXX();
|
||||
realCard.setLV_MJKLX("4");
|
||||
realCard.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
|
||||
realCard.setLV_SBXT("10");
|
||||
realCard.setLV_CKR(person.getIdCard());
|
||||
realCard.setLV_BH(person.getPersonId().toString());
|
||||
realCard.setLV_PROCMODE("PMINSERT");
|
||||
syncDoorCard.add(realCard);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processDevice(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
|
||||
List<TenDeviceEntity> realDevices = this.tenDeviceService.getNotSync(cellId);
|
||||
List<XaMJSBXX> syncDevices = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenDeviceEntity device : realDevices) {
|
||||
XaMJSBXX realDevice = new XaMJSBXX();
|
||||
realDevice.setLV_MJMC(device.getName());
|
||||
realDevice.setLV_WZMS("1");
|
||||
realDevice.setLV_SFYSXT("1");
|
||||
realDevice.setLV_SBXT("10");
|
||||
realDevice.setLV_MJXTWYBM(device.getSn());
|
||||
realDevice.setLV_PROCMODE("PMINSERT");
|
||||
syncDevices.add(realDevice);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package net.shapelight.modules.job.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.utils.DateUtils;
|
||||
import net.shapelight.modules.job.task.ITask;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserService;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
|
||||
import net.shapelight.modules.ten.entity.TenRecordEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import net.shapelight.modules.ten.service.TenDeviceService;
|
||||
import net.shapelight.modules.ten.service.TenDoorCardService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordService;
|
||||
import net.shapelight.modules.ten.service.TenPersonService;
|
||||
import net.shapelight.modules.ten.service.TenRecordService;
|
||||
import net.shapelight.modules.ten.service.TenRoomService;
|
||||
import net.shapelight.modules.xian.service.XaApi;
|
||||
import net.shapelight.modules.xian.vo.XaRYSKZPXX;
|
||||
import net.shapelight.modules.xian.vo.XaTCCTCSBXX;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component("xaRecordTask")
|
||||
public class XaRecordTask implements ITask {
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
@Autowired
|
||||
private TenRecordService tenRecordService;
|
||||
@Autowired
|
||||
private TenPackRecordService tenPackRecordService;
|
||||
|
||||
public void run(String params) {
|
||||
log.debug("xaRecordTask{}", params);
|
||||
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
|
||||
for (SysUserEntity sysTenUser : allSysTenUser) {
|
||||
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
|
||||
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
|
||||
Integer type = object.getInteger("type");
|
||||
if (type.intValue() == 1) {
|
||||
String appId = object.getString("appId");
|
||||
String appSecret = object.getString("appSecret");
|
||||
String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
|
||||
if (fwikUrl != null) {
|
||||
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper)(new QueryWrapper())
|
||||
|
||||
.eq("tenant_id", sysTenUser.getTenantId()));
|
||||
Long tenantId = sysTenUser.getTenantId();
|
||||
for (TenCellEntity cellEntity : allCells) {
|
||||
String xqid = cellEntity.getThirdId();
|
||||
Long cellId = cellEntity.getCellId();
|
||||
if (xqid == null || xqid.length() > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("xaRecordTask定时任务执行完毕");
|
||||
}
|
||||
|
||||
private void processRecordPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId, Long tenantId) {
|
||||
List<TenRecordEntity> records = this.tenRecordService.getNotSync(cellId, tenantId);
|
||||
List<XaRYSKZPXX> syncrecords = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenRecordEntity record : records) {
|
||||
XaRYSKZPXX syncRecord = new XaRYSKZPXX();
|
||||
syncRecord.setLV_MJBH(record.getDeviceSn());
|
||||
syncRecord.setLV_CRLB("1");
|
||||
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMdd24HHmmss"));
|
||||
syncRecord.setLV_SBXT("10");
|
||||
syncRecord.setLV_MJXTWYBM(record.getRecordId().toString());
|
||||
syncRecord.setLV_RY_ID(record.getPersonId().toString());
|
||||
syncRecord.setLV_FFMS("1");
|
||||
syncRecord.setLV_PROCMODE("PMINSERT");
|
||||
syncrecords.add(syncRecord);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processRecordCar(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
|
||||
List<TenPackRecordEntity> records = this.tenPackRecordService.getNotSync(cellId);
|
||||
List<XaTCCTCSBXX> syncrecords = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenPackRecordEntity record : records) {
|
||||
XaTCCTCSBXX syncRecord = new XaTCCTCSBXX();
|
||||
syncRecord.setLV_CPHM(record.getVlp());
|
||||
syncRecord.setLV_CPLX(record.getVTypeName());
|
||||
syncRecord.setLV_GCSJ(DateUtils.format(record.getInTime(), "YYYYMMDDHHMMSS"));
|
||||
syncRecord.setLV_GCLX("1");
|
||||
syncRecord.setLV_SBXT("10");
|
||||
syncRecord.setLV_PROCMODE("PMINSERT");
|
||||
syncrecords.add(syncRecord);
|
||||
count++;
|
||||
if (count >= 60)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.shapelight.common.utils.StringUtils;
|
||||
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
||||
import net.shapelight.modules.sys.entity.SysDeviceEntity;
|
||||
import net.shapelight.modules.sys.service.SysDeviceService;
|
||||
|
@ -72,8 +73,11 @@ public class SysDeviceController {
|
|||
@RequiresPermissions("sys:device")
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@RequestBody SysDeviceEntity sysDevice){
|
||||
sysDeviceService.save(sysDevice);
|
||||
|
||||
if (sysDevice.getDeviceTypeId() == null)
|
||||
return R.error("设备类型不能为空");
|
||||
if (StringUtils.isEmpty(sysDevice.getSn()))
|
||||
return R.error("设备sn不能为空");
|
||||
this.sysDeviceService.save(sysDevice);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,7 @@ import org.apache.shiro.crypto.hash.Sha256Hash;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 系统用户
|
||||
|
@ -137,15 +134,17 @@ public class SysUserController extends AbstractController {
|
|||
@RequiresPermissions("sys:user:save")
|
||||
@ApiOperation("保存用户")
|
||||
public R save(@RequestBody SysUserEntity user){
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
long id = new SnowflakeIdWorker().nextId();
|
||||
user.setUserId(id);
|
||||
ValidatorUtils.validateEntity(user, new Class[] { AddGroup.class });
|
||||
long id = (new SnowflakeIdWorker()).nextId();
|
||||
user.setUserId(Long.valueOf(id));
|
||||
user.setCreateBy(getUser().getUsername());
|
||||
user.setCreateTime(new Date());
|
||||
//user.setUserType(Constant.SYSTEM_USER);
|
||||
user.setUserType(Constant.SYSTEM_USER);
|
||||
//user.setStatus(1);
|
||||
sysUserService.saveUser(user);
|
||||
user.setUserType(Integer.valueOf(1));
|
||||
List<Long> roleIdList = new ArrayList<>();
|
||||
Long role = Long.valueOf(100L);
|
||||
roleIdList.add(role);
|
||||
user.setRoleIdList(roleIdList);
|
||||
this.sysUserService.saveUser(user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -96,11 +96,15 @@ public class SysTenUserController extends AbstractController {
|
|||
public R save(@RequestBody SysUserEntity user){
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
long id = new SnowflakeIdWorker().nextId();
|
||||
user.setUserId(id);
|
||||
user.setUserId(Long.valueOf(id));
|
||||
user.setCreateBy(getUser().getNickName());
|
||||
user.setCreateTime(new Date());
|
||||
user.setUserType(Constant.TENANT_ADMIN);
|
||||
user.setTenantId(id);
|
||||
user.setUserType(Integer.valueOf(2));
|
||||
user.setTenantId(Long.valueOf(id));
|
||||
List<Long> roleIdList = new ArrayList<>();
|
||||
Long role = Long.valueOf(1000L);
|
||||
roleIdList.add(role);
|
||||
user.setRoleIdList(roleIdList);
|
||||
try {
|
||||
sysUserService.saveUserSysTen(user);
|
||||
}catch (DuplicateKeyException e){
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
package net.shapelight.modules.ten.controller;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.shapelight.common.utils.Constant;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.R;
|
||||
import net.shapelight.modules.sys.controller.AbstractController;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
|
||||
import net.shapelight.modules.ten.service.TenPackChannalService;
|
||||
import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"ten/packchannal"})
|
||||
@Api(value="停车场通道管理",tags="停车场通道管理")
|
||||
public class TenPackChannalController extends AbstractController {
|
||||
@Autowired
|
||||
private TenPackChannalService tenPackChannalService;
|
||||
@Autowired
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private TenUserScopeService tenUserScopeService;
|
||||
|
||||
@GetMapping({"/list"})
|
||||
@RequiresPermissions({"ten:packchannal"})
|
||||
@ApiOperation(value = "列表",response = TenPackChannalEntity.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
String tenantId = getUser().getTenantId()+"";
|
||||
params.put("tenantId",tenantId+"");
|
||||
SysUserEntity user = getUser();
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
//小区管理员
|
||||
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
|
||||
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
|
||||
params.put("cellId",scope.getCellId().toString());
|
||||
}
|
||||
PageUtils page = this.tenPackChannalService.queryPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
@GetMapping({"/info/{parkChannalId}"})
|
||||
@RequiresPermissions({"ten:packchannal"})
|
||||
@ApiOperation(value = "详细信息",response = TenPackChannalEntity.class)
|
||||
public R info(@PathVariable("parkChannalId") Long parkChannalId) {
|
||||
TenPackChannalEntity tenPackChannal = (TenPackChannalEntity)this.tenPackChannalService.getById(parkChannalId);
|
||||
return R.ok().put("data", tenPackChannal);
|
||||
}
|
||||
|
||||
@PostMapping({"/save"})
|
||||
@RequiresPermissions({"ten:packchannal"})
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@RequestBody TenPackChannalEntity tenPackChannal) {
|
||||
tenPackChannal.setTenantId(getUser().getTenantId());
|
||||
this.tenPackChannalService.save(tenPackChannal);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/update"})
|
||||
@RequiresPermissions({"ten:packchannal"})
|
||||
@ApiOperation(value = "修改")
|
||||
public R update(@RequestBody TenPackChannalEntity tenPackChannal) {
|
||||
this.tenPackChannalService.updateById(tenPackChannal);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
@RequiresPermissions({"ten:packchannal"})
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@RequestBody Long[] parkChannalIds) {
|
||||
this.tenPackChannalService.removeByIds(Arrays.asList(parkChannalIds));
|
||||
return R.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package net.shapelight.modules.ten.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.shapelight.common.utils.Constant;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.R;
|
||||
import net.shapelight.modules.sys.controller.AbstractController;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||
import net.shapelight.modules.ten.entity.TenNoticeEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
|
||||
import net.shapelight.modules.ten.service.TenPackService;
|
||||
import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@RequestMapping({"ten/pack"})
|
||||
@Api(value="停车场管理",tags="停车场管理")
|
||||
public class TenPackController extends AbstractController {
|
||||
@Autowired
|
||||
private TenPackService tenPackService;
|
||||
@Autowired
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private TenUserScopeService tenUserScopeService;
|
||||
|
||||
@GetMapping({"/list"})
|
||||
@RequiresPermissions({"ten:pack"})
|
||||
@ApiOperation(value = "列表",response = TenPackEntity.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
||||
})
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
String tenantId = getUser().getTenantId()+"";
|
||||
params.put("tenantId",tenantId+"");
|
||||
SysUserEntity user = getUser();
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
//小区管理员
|
||||
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
|
||||
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
|
||||
params.put("cellId",scope.getCellId().toString());
|
||||
}
|
||||
PageUtils page = this.tenPackService.queryPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
@GetMapping({"/info/{parkId}"})
|
||||
@RequiresPermissions({"ten:pack"})
|
||||
@ApiOperation(value = "详细信息",response = TenPackEntity.class)
|
||||
public R info(@PathVariable("parkId") Long parkId) {
|
||||
TenPackEntity tenPack = (TenPackEntity)this.tenPackService.getById(parkId);
|
||||
return R.ok().put("data", tenPack);
|
||||
}
|
||||
|
||||
@PostMapping({"/save"})
|
||||
@ApiOperation(value = "保存")
|
||||
@RequiresPermissions({"ten:pack"})
|
||||
public R save(@RequestBody TenPackEntity tenPack) {
|
||||
tenPack.setTenantId(getUser().getTenantId());
|
||||
this.tenPackService.save(tenPack);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperation(value = "修改")
|
||||
@RequiresPermissions({"ten:pack"})
|
||||
public R update(@RequestBody TenPackEntity tenPack) {
|
||||
this.tenPackService.updateById(tenPack);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
@RequiresPermissions({"ten:pack"})
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@RequestBody Long[] parkIds) {
|
||||
this.tenPackService.removeByIds(Arrays.asList(parkIds));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping({"/selectByCellId/{cellId}"})
|
||||
@ApiOperation(value = "通过小区id选择停车场",response = TenPackEntity.class)
|
||||
public R selectByCellId(@PathVariable("cellId") Long cellId) {
|
||||
List<TenPackEntity> tenPacks = this.tenPackService.list(new QueryWrapper<TenPackEntity>()
|
||||
.eq("cell_id",cellId));
|
||||
return R.ok().put("data", tenPacks);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package net.shapelight.modules.ten.controller;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.shapelight.common.utils.Constant;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.R;
|
||||
import net.shapelight.modules.sys.controller.AbstractController;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordEnterService;
|
||||
import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"ten/packrecordenter"})
|
||||
@Api(value="车辆进场记录",tags="车辆进场记录")
|
||||
public class TenPackRecordEnterController extends AbstractController {
|
||||
@Autowired
|
||||
private TenPackRecordEnterService tenPackRecordEnterService;
|
||||
@Autowired
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private TenUserScopeService tenUserScopeService;
|
||||
|
||||
@GetMapping({"/list"})
|
||||
@RequiresPermissions({"ten:packrecordenter"})
|
||||
@ApiOperation(value = "列表",response = TenPackRecordEnterEntity.class)
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
String tenantId = getUser().getTenantId()+"";
|
||||
params.put("tenantId",tenantId+"");
|
||||
SysUserEntity user = getUser();
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
//小区管理员
|
||||
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
|
||||
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
|
||||
params.put("cellId",scope.getCellId().toString());
|
||||
}
|
||||
PageUtils page = this.tenPackRecordEnterService.queryPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
@GetMapping({"/info/{recordEnterId}"})
|
||||
@RequiresPermissions({"ten:packrecordenter"})
|
||||
public R info(@PathVariable("recordEnterId") Long recordEnterId) {
|
||||
TenPackRecordEnterEntity tenPackRecordEnter = (TenPackRecordEnterEntity)this.tenPackRecordEnterService.getById(recordEnterId);
|
||||
return R.ok().put("data", tenPackRecordEnter);
|
||||
}
|
||||
|
||||
@PostMapping({"/save"})
|
||||
@RequiresPermissions({"ten:packrecordenter"})
|
||||
public R save(@RequestBody TenPackRecordEnterEntity tenPackRecordEnter) {
|
||||
this.tenPackRecordEnterService.save(tenPackRecordEnter);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/update"})
|
||||
@RequiresPermissions({"ten:packrecordenter"})
|
||||
public R update(@RequestBody TenPackRecordEnterEntity tenPackRecordEnter) {
|
||||
this.tenPackRecordEnterService.updateById(tenPackRecordEnter);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
@RequiresPermissions({"ten:packrecordenter"})
|
||||
public R delete(@RequestBody Long[] recordEnterIds) {
|
||||
this.tenPackRecordEnterService.removeByIds(Arrays.asList(recordEnterIds));
|
||||
return R.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package net.shapelight.modules.ten.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.shapelight.common.utils.Constant;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.R;
|
||||
import net.shapelight.modules.sys.controller.AbstractController;
|
||||
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
|
||||
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordExitService;
|
||||
import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"ten/packrecordexit"})
|
||||
@Api(value="车辆离场记录",tags="车辆离场记录")
|
||||
public class TenPackRecordExitController extends AbstractController {
|
||||
@Autowired
|
||||
private TenPackRecordExitService tenPackRecordExitService;
|
||||
@Autowired
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private TenUserScopeService tenUserScopeService;
|
||||
|
||||
@GetMapping({"/list"})
|
||||
@RequiresPermissions({"ten:packrecordexit"})
|
||||
@ApiOperation(value = "列表",response = TenPackRecordExitEntity.class)
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
String tenantId = getUser().getTenantId()+"";
|
||||
params.put("tenantId",tenantId+"");
|
||||
SysUserEntity user = getUser();
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||
//小区管理员
|
||||
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
|
||||
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
|
||||
params.put("cellId",scope.getCellId().toString());
|
||||
}
|
||||
PageUtils page = this.tenPackRecordExitService.queryPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
@GetMapping({"/info/{recordEnterId}"})
|
||||
@RequiresPermissions({"ten:packrecordexit"})
|
||||
@ApiOperation(value = "详细",response = TenPackRecordExitEntity.class)
|
||||
public R info(@PathVariable("recordEnterId") Long recordEnterId) {
|
||||
TenPackRecordExitEntity tenPackRecordExit = (TenPackRecordExitEntity)this.tenPackRecordExitService.getById(recordEnterId);
|
||||
return R.ok().put("data", tenPackRecordExit);
|
||||
}
|
||||
|
||||
@PostMapping({"/save"})
|
||||
@RequiresPermissions({"ten:packrecordexit"})
|
||||
public R save(@RequestBody TenPackRecordExitEntity tenPackRecordExit) {
|
||||
this.tenPackRecordExitService.save(tenPackRecordExit);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/update"})
|
||||
@RequiresPermissions({"ten:packrecordexit"})
|
||||
public R update(@RequestBody TenPackRecordExitEntity tenPackRecordExit) {
|
||||
this.tenPackRecordExitService.updateById(tenPackRecordExit);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/delete"})
|
||||
@RequiresPermissions({"ten:packrecordexit"})
|
||||
public R delete(@RequestBody Long[] recordEnterIds) {
|
||||
this.tenPackRecordExitService.removeByIds(Arrays.asList(recordEnterIds));
|
||||
return R.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TenPackChannalDao extends BaseMapper<TenPackChannalEntity> {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TenPackDao extends BaseMapper<TenPackEntity> {
|
||||
}
|
|
@ -24,4 +24,8 @@ public interface TenPackRecordDao {
|
|||
TenPackRecordEntity selectByRecordIdAndPackId(@Param("recordId")String recordId, @Param("parkId")String parkId,@Param("cellId")Long cellId);
|
||||
IPage<TenPackRecordEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params);
|
||||
|
||||
List<TenPackRecordEntity> getNotSync(@Param("cellId") Long paramLong);
|
||||
|
||||
List<TenPackRecordEntity> getNotSyncImage(@Param("cellId") Long paramLong);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TenPackRecordEnterDao extends BaseMapper<TenPackRecordEnterEntity> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package net.shapelight.modules.ten.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TenPackRecordExitDao extends BaseMapper<TenPackRecordExitEntity> {
|
||||
}
|
|
@ -80,6 +80,14 @@ public interface TenPersonDao {
|
|||
|
||||
List<TenPersonEntity> getAllExpireGuest();
|
||||
|
||||
TenPersonEntity getOwner(@Param("roomId") Long paramLong);
|
||||
|
||||
List<TenPersonEntity> getNotSync(@Param("cellId") Long paramLong);
|
||||
|
||||
List<TenPersonEntity> getNotSyncCard(@Param("cellId") Long paramLong);
|
||||
|
||||
List<TenPersonEntity> getNotSyncImage(@Param("cellId") Long paramLong);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,15 +11,18 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Mapper
|
||||
public interface TenRecordDao {
|
||||
int insert(TenRecordEntity tenRecordEntity);
|
||||
|
||||
int deleteById(@Param("recordId") Long id, @Param("tenantId") Long tenantId);
|
||||
|
||||
boolean updateById(TenRecordEntity entity);
|
||||
|
||||
TenRecordEntity selectById(@Param("recordId") Long recordId, @Param("tenantId") Long tenantId);
|
||||
|
||||
IPage<TenRecordEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params);
|
||||
|
||||
List<TenRecordEntity> findAll(@Param("cellIds") List<Long> cellIds, @Param("params") Map params);
|
||||
|
@ -32,5 +35,8 @@ public interface TenRecordDao{
|
|||
|
||||
String findLastRecordTime(@Param("personId") Long personId, @Param("tenantId") Long tenantId);
|
||||
|
||||
List<TenRecordEntity> getNotSync(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2);
|
||||
|
||||
List<TenRecordEntity> getNotSyncImage(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2);
|
||||
|
||||
}
|
||||
|
|
|
@ -45,5 +45,7 @@ public interface TenRoomDao {
|
|||
@Param("buildId")Long buildId,
|
||||
@Param("cellId")Long cellId);
|
||||
|
||||
List<TenRoomEntity> getNotSync(@Param("cellId") Long paramLong);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.shapelight.common.base.BaseEntity;
|
|||
|
||||
/**
|
||||
* 设备表
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@TableName("ten_device")
|
||||
|
@ -225,7 +224,8 @@ public class TenDeviceEntity extends BaseEntity implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String scope;
|
||||
|
||||
|
||||
@ApiModelProperty("是否同步")
|
||||
private Integer xaSync;
|
||||
|
||||
|
||||
// @TableField(exist=false)
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("ten_pack_channal")
|
||||
public class TenPackChannalEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty("通道ID")
|
||||
private Long parkChannalId;
|
||||
|
||||
@ApiModelProperty("停车场ID")
|
||||
private Long packId;
|
||||
|
||||
@ApiModelProperty("通道名称")
|
||||
private String channalName;
|
||||
|
||||
@ApiModelProperty("通道编码")
|
||||
private String channalCode;
|
||||
|
||||
@ApiModelProperty("通道西安编码")
|
||||
private String channalCodeXa;
|
||||
|
||||
@ApiModelProperty("方向")
|
||||
private String direction;
|
||||
|
||||
@ApiModelProperty("小区id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
@ApiModelProperty("小区名称")
|
||||
@TableField(exist=false)
|
||||
private String cellName;
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("ten_pack")
|
||||
public class TenPackEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty("ID")
|
||||
private Long parkId;
|
||||
|
||||
@ApiModelProperty("停车场编码")
|
||||
private String parkCode;
|
||||
|
||||
@ApiModelProperty("停车场西安对接变价")
|
||||
private String parkCodeXa;
|
||||
|
||||
@ApiModelProperty("停车场名称")
|
||||
private String parkName;
|
||||
|
||||
@ApiModelProperty("小区id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
|
||||
@ApiModelProperty("运营商id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
@ApiModelProperty("小区名称")
|
||||
@TableField(exist=false)
|
||||
private String cellName;
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("ten_pack_record_enter")
|
||||
public class TenPackRecordEnterEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty("入场记录id")
|
||||
private Long recordEnterId;
|
||||
|
||||
@ApiModelProperty("停车场编码")
|
||||
private String parkCode;
|
||||
|
||||
@ApiModelProperty("停车场名称")
|
||||
private String parkName;
|
||||
|
||||
@ApiModelProperty("订单号")
|
||||
private String orderNumber;
|
||||
|
||||
@ApiModelProperty("车牌号")
|
||||
private String plateNumber;
|
||||
|
||||
@ApiModelProperty("通道名称")
|
||||
private String channelName;
|
||||
|
||||
@ApiModelProperty("进入时间")
|
||||
private Date enterTime;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("车辆类型")
|
||||
private Integer carType;
|
||||
|
||||
@ApiModelProperty("图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty("小区id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
private Integer xaSync;
|
||||
|
||||
private Integer xaSyncImage;
|
||||
|
||||
@ApiModelProperty("小区名称")
|
||||
@TableField(exist=false)
|
||||
private String cellName;
|
||||
}
|
|
@ -107,12 +107,8 @@ import lombok.Data;
|
|||
// private Long cellId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 停车记录表
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@TableName("ten_pack_record")
|
||||
|
@ -242,6 +238,11 @@ public class TenPackRecordEntity implements Serializable {
|
|||
@ApiModelProperty("小区名称")
|
||||
private String cellName;
|
||||
|
||||
private Integer xaSync;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private Integer xaSyncImage;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
package net.shapelight.modules.ten.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("ten_pack_record_exit")
|
||||
public class TenPackRecordExitEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty("出厂记录id")
|
||||
private Long recordExitId;
|
||||
|
||||
@ApiModelProperty("停车场编码")
|
||||
private String parkCode;
|
||||
|
||||
@ApiModelProperty("停车场名称")
|
||||
private String parkName;
|
||||
|
||||
@ApiModelProperty("订单编码")
|
||||
private String orderNumber;
|
||||
|
||||
@ApiModelProperty("车牌号")
|
||||
private String plateNumber;
|
||||
|
||||
@ApiModelProperty("通道名称")
|
||||
private String channelName;
|
||||
|
||||
@ApiModelProperty("出场时间")
|
||||
private Date exitTime;
|
||||
|
||||
@ApiModelProperty("停车时间")
|
||||
private Long packTime;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("车辆类型")
|
||||
private Integer carType;
|
||||
|
||||
@ApiModelProperty("图片")
|
||||
private String image;
|
||||
|
||||
|
||||
private Double totalAmount;
|
||||
|
||||
private Double paidAmount;
|
||||
|
||||
private Double discountAmount;
|
||||
|
||||
private Double outDiscAmount;
|
||||
|
||||
private Double outPaidAmount;
|
||||
|
||||
private Double inDiscAmount;
|
||||
|
||||
private Double inPaidAmount;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
|
||||
private Integer xaSync;
|
||||
|
||||
private Integer xaSyncImage;
|
||||
|
||||
@ApiModelProperty("小区名称")
|
||||
@TableField(exist=false)
|
||||
private String cellName;
|
||||
}
|
|
@ -324,6 +324,14 @@ public class TenPersonEntity extends BaseEntity implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private List<TenPersonExtractEntity> extractList;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private Integer xaSync;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private Integer xaSyncCard;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private Integer xaSyncImage;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
|
@ -154,4 +153,10 @@ public class TenRecordEntity implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private Integer memberId;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private Integer xaSync;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private Integer xaSyncImage;
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.shapelight.common.base.BaseEntity;
|
|||
|
||||
/**
|
||||
* 户室表
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@TableName("ten_room")
|
||||
|
@ -133,4 +132,13 @@ public class TenRoomEntity extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty("小区名称")
|
||||
private String cellName;
|
||||
|
||||
@ApiModelProperty("是否同步")
|
||||
private Integer xaSync;
|
||||
|
||||
@ApiModelProperty("地址序号")
|
||||
private String pId;
|
||||
|
||||
@ApiModelProperty("地址编码")
|
||||
private String dzbm;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import io.swagger.models.auth.In;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenDeviceAlertEntity;
|
||||
import net.shapelight.modules.ten.entity.TenDeviceEntity;
|
||||
|
@ -10,7 +9,6 @@ import net.shapelight.modules.ten.entity.TenRecordEntity;
|
|||
import net.shapelight.modules.vo.TenDeviceVo;
|
||||
import net.shapelight.modules.vo.TenPersonIdUpdateVo;
|
||||
import net.shapelight.modules.vo.TenPersonVo;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
@ -57,7 +55,7 @@ public interface TenDeviceService extends IService<TenDeviceEntity> {
|
|||
|
||||
boolean evictRemoveByIds(Collection<? extends Serializable> idList);
|
||||
|
||||
public boolean evictRemoveByCellIds(Long[] idList);
|
||||
boolean evictRemoveByCellIds(Long[] idList);
|
||||
|
||||
int getDeviceCount(Map<String, Object> params);
|
||||
|
||||
|
@ -67,7 +65,7 @@ public interface TenDeviceService extends IService<TenDeviceEntity> {
|
|||
|
||||
void evictupdateById(TenDeviceEntity tenDevice);
|
||||
|
||||
|
||||
List<TenDeviceEntity> getNotSync(Long paramLong);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Map;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
|
||||
|
||||
public interface TenPackChannalService extends IService<TenPackChannalEntity> {
|
||||
PageUtils queryPage(Map<String, Object> paramMap);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||
|
||||
public interface TenPackRecordEnterService extends IService<TenPackRecordEnterEntity> {
|
||||
PageUtils queryPage(Map<String, Object> paramMap);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
|
||||
|
||||
public interface TenPackRecordExitService extends IService<TenPackRecordExitEntity> {
|
||||
PageUtils queryPage(Map<String, Object> paramMap);
|
||||
}
|
|
@ -28,5 +28,9 @@ public interface TenPackRecordService {
|
|||
|
||||
boolean saveOrUpdateByRecordId(TenPackRecordEntity entity);
|
||||
|
||||
List<TenPackRecordEntity> getNotSync(Long paramLong);
|
||||
|
||||
List<TenPackRecordEntity> getNotSyncImage(Long paramLong);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package net.shapelight.modules.ten.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Map;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
|
||||
public interface TenPackService extends IService<TenPackEntity> {
|
||||
PageUtils queryPage(Map<String, Object> paramMap);
|
||||
}
|
|
@ -110,6 +110,14 @@ public interface TenPersonService {
|
|||
|
||||
List<TenPersonEntity> getAllExpireGuest();
|
||||
|
||||
TenPersonEntity getOwner(Long paramLong);
|
||||
|
||||
List<TenPersonEntity> getNotSync(Long paramLong);
|
||||
|
||||
List<TenPersonEntity> getNotSyncCard(Long paramLong);
|
||||
|
||||
List<TenPersonEntity> getNotSyncImage(Long paramLong);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -34,5 +34,9 @@ public interface TenRecordService {
|
|||
|
||||
List<TenRecordEntity> getLastRecord(Map<String, Object> params);
|
||||
|
||||
List<TenRecordEntity> getNotSync(Long paramLong1, Long paramLong2);
|
||||
|
||||
List<TenRecordEntity> getNotSyncImage(Long paramLong1, Long paramLong2);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* 户室表
|
||||
*
|
||||
*/
|
||||
public interface TenRoomService {
|
||||
|
||||
|
@ -18,7 +17,9 @@ public interface TenRoomService {
|
|||
boolean save(TenRoomEntity entity);
|
||||
|
||||
boolean removeById(Long roomId, Long cellId);
|
||||
|
||||
boolean removeByBuildId(Long build, Long cellId);
|
||||
|
||||
boolean removeByCellId(Long cellId);
|
||||
|
||||
boolean removeByIdList(List<Map<String, String>> roomIdList);
|
||||
|
@ -37,7 +38,6 @@ public interface TenRoomService {
|
|||
Long cellId);
|
||||
|
||||
|
||||
|
||||
String getRoomName(Long id, Long cellId);
|
||||
|
||||
|
||||
|
@ -46,5 +46,7 @@ public interface TenRoomService {
|
|||
Long cellId);
|
||||
|
||||
int getAllCount(Map params);
|
||||
|
||||
List<TenRoomEntity> getNotSync(Long paramLong);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ package net.shapelight.modules.ten.service.impl;
|
|||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.utils.*;
|
||||
//import net.shapelight.modules.dev.mqtt.CmdProcess;
|
||||
//import net.shapelight.modules.dev.mqtt.EmqHttpApi;
|
||||
import net.shapelight.modules.nettyapi.service.DeviceApiService;
|
||||
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
||||
import net.shapelight.modules.ten.entity.*;
|
||||
|
@ -45,8 +43,6 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
|
|||
@Autowired
|
||||
private TenRoomService tenRoomService;
|
||||
@Autowired
|
||||
private TenDeviceDao tenDeviceDao;
|
||||
@Autowired
|
||||
private TenPersonService tenPersonService;
|
||||
@Autowired
|
||||
private TenRecordService tenRecordService;
|
||||
|
@ -197,7 +193,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
|
|||
|
||||
@Override
|
||||
public List<String> findAllSn() {
|
||||
return tenDeviceDao.findAllSn();
|
||||
return baseMapper.findAllSn();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -267,6 +263,12 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
|
|||
|
||||
@CacheEvict(value="TenDevice",allEntries = true)
|
||||
public boolean evictRemoveByIds(Collection<? extends Serializable> idList) {
|
||||
//删除同步人员
|
||||
for(Long devId: (List<Long>)idList){
|
||||
TenDeviceEntity deviceEntity = this.getById(devId);
|
||||
tenPersonSyncService.removeByDeviceId(devId,deviceEntity.getTenantId());
|
||||
}
|
||||
|
||||
return removeByIds(idList);
|
||||
}
|
||||
|
||||
|
@ -349,4 +351,11 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
|
|||
public void evictupdateById(TenDeviceEntity tenDevice) {
|
||||
this.updateById(tenDevice);
|
||||
}
|
||||
|
||||
public List<TenDeviceEntity> getNotSync(Long cellId) {
|
||||
return list(new QueryWrapper<TenDeviceEntity>()
|
||||
.eq("cell_id", cellId)
|
||||
.eq("xa_sync", 0)
|
||||
.eq("delete_flag", 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.Query;
|
||||
import net.shapelight.modules.ten.dao.TenPackChannalDao;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import net.shapelight.modules.ten.service.TenPackChannalService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("tenPackChannalService")
|
||||
public class TenPackChannalServiceImpl extends ServiceImpl<TenPackChannalDao, TenPackChannalEntity> implements TenPackChannalService {
|
||||
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
|
||||
List<Long> cellIds = new ArrayList<>();
|
||||
// cellIds.add(709832651506188289L);
|
||||
String cellId = (String)params.get("cellId");
|
||||
if (cellId!=null && !cellId.isEmpty()){
|
||||
Long cellLong = Long.parseLong(cellId);
|
||||
cellIds.add(cellLong);
|
||||
}else {
|
||||
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||
for (TenCellEntity cell : cells) {
|
||||
cellIds.add(cell.getCellId());
|
||||
}
|
||||
}
|
||||
if (cellIds.size() == 0) {
|
||||
return new PageUtils(new ArrayList<>(),0,0,0);
|
||||
}
|
||||
|
||||
IPage<TenPackChannalEntity> page = this.page(
|
||||
new Query<TenPackChannalEntity>().getPage(params),
|
||||
new QueryWrapper<TenPackChannalEntity>()
|
||||
.eq("tenant_id",params.get("tenantId"))
|
||||
.in("cell_id",cellIds)
|
||||
);
|
||||
|
||||
for(TenPackChannalEntity entity: page.getRecords()){
|
||||
TenCellEntity cell = tenCellService.getById(entity.getCellId());
|
||||
entity.setCellName(cell.getName());
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.Query;
|
||||
import net.shapelight.modules.ten.dao.TenPackRecordEnterDao;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordEnterService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("tenPackRecordEnterService")
|
||||
public class TenPackRecordEnterServiceImpl extends ServiceImpl<TenPackRecordEnterDao, TenPackRecordEnterEntity> implements TenPackRecordEnterService {
|
||||
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
List<Long> cellIds = new ArrayList<>();
|
||||
// cellIds.add(709832651506188289L);
|
||||
String cellId = (String)params.get("cellId");
|
||||
if (cellId!=null && !cellId.isEmpty()){
|
||||
Long cellLong = Long.parseLong(cellId);
|
||||
cellIds.add(cellLong);
|
||||
}else {
|
||||
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||
for (TenCellEntity cell : cells) {
|
||||
cellIds.add(cell.getCellId());
|
||||
}
|
||||
}
|
||||
if (cellIds.size() == 0) {
|
||||
return new PageUtils(new ArrayList<>(),0,0,0);
|
||||
}
|
||||
|
||||
IPage<TenPackRecordEnterEntity> page = this.page(
|
||||
new Query<TenPackRecordEnterEntity>().getPage(params),
|
||||
new QueryWrapper<TenPackRecordEnterEntity>()
|
||||
.eq("tenant_id",params.get("tenantId"))
|
||||
.in("cell_id",cellIds)
|
||||
);
|
||||
|
||||
for(TenPackRecordEnterEntity entity: page.getRecords()){
|
||||
TenCellEntity cell = tenCellService.getById(entity.getCellId());
|
||||
entity.setCellName(cell.getName());
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.Query;
|
||||
import net.shapelight.modules.ten.dao.TenPackRecordExitDao;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import net.shapelight.modules.ten.service.TenPackRecordExitService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("tenPackRecordExitService")
|
||||
public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitDao, TenPackRecordExitEntity> implements TenPackRecordExitService {
|
||||
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
List<Long> cellIds = new ArrayList<>();
|
||||
// cellIds.add(709832651506188289L);
|
||||
String cellId = (String)params.get("cellId");
|
||||
if (cellId!=null && !cellId.isEmpty()){
|
||||
Long cellLong = Long.parseLong(cellId);
|
||||
cellIds.add(cellLong);
|
||||
}else {
|
||||
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||
for (TenCellEntity cell : cells) {
|
||||
cellIds.add(cell.getCellId());
|
||||
}
|
||||
}
|
||||
if (cellIds.size() == 0) {
|
||||
return new PageUtils(new ArrayList<>(),0,0,0);
|
||||
}
|
||||
|
||||
IPage<TenPackRecordExitEntity> page = this.page(
|
||||
new Query<TenPackRecordExitEntity>().getPage(params),
|
||||
new QueryWrapper<TenPackRecordExitEntity>()
|
||||
.eq("tenant_id",params.get("tenantId"))
|
||||
.in("cell_id",cellIds)
|
||||
);
|
||||
|
||||
for(TenPackRecordExitEntity entity: page.getRecords()){
|
||||
TenCellEntity cell = tenCellService.getById(entity.getCellId());
|
||||
entity.setCellName(cell.getName());
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
}
|
|
@ -213,6 +213,14 @@ public class TenPackRecordServiceImpl implements TenPackRecordService {
|
|||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
@Override
|
||||
public List<TenPackRecordEntity> getNotSync(Long cellId) {
|
||||
return this.tenPackRecordDao.getNotSync(cellId);
|
||||
}
|
||||
@Override
|
||||
public List<TenPackRecordEntity> getNotSyncImage(Long cellId) {
|
||||
return this.tenPackRecordDao.getNotSyncImage(cellId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package net.shapelight.modules.ten.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.shapelight.common.utils.PageUtils;
|
||||
import net.shapelight.common.utils.Query;
|
||||
import net.shapelight.modules.ten.dao.TenPackDao;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import net.shapelight.modules.ten.entity.TenDeviceEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
import net.shapelight.modules.ten.service.TenCellService;
|
||||
import net.shapelight.modules.ten.service.TenPackService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("tenPackService")
|
||||
public class TenPackServiceImpl extends ServiceImpl<TenPackDao, TenPackEntity> implements TenPackService {
|
||||
@Autowired
|
||||
private TenCellService tenCellService;
|
||||
|
||||
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
|
||||
List<Long> cellIds = new ArrayList<>();
|
||||
// cellIds.add(709832651506188289L);
|
||||
String cellId = (String)params.get("cellId");
|
||||
if (cellId!=null && !cellId.isEmpty()){
|
||||
Long cellLong = Long.parseLong(cellId);
|
||||
cellIds.add(cellLong);
|
||||
}else {
|
||||
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||
for (TenCellEntity cell : cells) {
|
||||
cellIds.add(cell.getCellId());
|
||||
}
|
||||
}
|
||||
if (cellIds.size() == 0) {
|
||||
return new PageUtils(new ArrayList<>(),0,0,0);
|
||||
}
|
||||
|
||||
IPage<TenPackEntity> page = this.page(
|
||||
new Query<TenPackEntity>().getPage(params),
|
||||
new QueryWrapper<TenPackEntity>()
|
||||
.eq("tenant_id",params.get("tenantId"))
|
||||
.in("cell_id",cellIds)
|
||||
);
|
||||
|
||||
for(TenPackEntity tenPackEntity: page.getRecords()){
|
||||
TenCellEntity cell = tenCellService.getById(tenPackEntity.getCellId());
|
||||
tenPackEntity.setCellName(cell.getName());
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
}
|
|
@ -704,6 +704,9 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
for (Map<String, String> snPersons : snPersonsList) {
|
||||
String sn = snPersons.get("deviceSn");
|
||||
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
|
||||
if(deviceEntity==null){
|
||||
continue;
|
||||
}
|
||||
String[] persons = snPersons.get("plist").split(",");
|
||||
List<TenPersonOperationVo> list = new ArrayList<>();
|
||||
for (String personStr : persons) {
|
||||
|
@ -782,9 +785,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1199,9 +1199,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
|
@ -1361,7 +1358,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
// }
|
||||
|
||||
|
||||
|
||||
// for (TenPersonVo vo : list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TenPersonVo vo = list.get(i);
|
||||
|
@ -1438,7 +1434,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//删除最后时间重复的项
|
||||
|
@ -1507,7 +1502,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TenPersonVo> findAllPerson(Long cellId, Long buildId, Long roomId, String lastUpdateTime) {
|
||||
//升序排列
|
||||
|
@ -1600,7 +1594,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TenPersonIdUpdateVo> findAllPersonIdUpdate(Long cellId, Long buildId, Long roomId) {
|
||||
//升序排列
|
||||
|
@ -1617,9 +1610,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TenPersonVo> findAllByCellId(Long cellId) {
|
||||
return tenPersonDao.findAllByCellId(cellId);
|
||||
|
@ -1790,7 +1780,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
// log.info("原图"+tenPerson.getOrgImage()+"-"+personModel.getOrgImage());
|
||||
|
||||
|
||||
|
||||
//2. 截取人脸图片
|
||||
//检测图片人脸
|
||||
|
||||
|
@ -1826,7 +1815,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// int res = PicSDK.getFace(personModel.getOrgImage(), tempFaceFilePath);
|
||||
// if (res != 0) {
|
||||
// return;
|
||||
|
@ -1852,13 +1840,11 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
// tenPerson.setFaceImage(faceImageFileName);
|
||||
|
||||
|
||||
|
||||
// tenPerson.setFaceImage(orgImageFileName);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
//--------------------------------处理图片大小------------------------------------------------------
|
||||
if (tenPerson.getOrgImage() != null && !tenPerson.getOrgImage().isEmpty()) {
|
||||
String orgFileStr = "/root/minio/data/cell/" + tenPerson.getOrgImage();
|
||||
|
@ -1934,7 +1920,6 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getAllCount(Map<String, Object> params) {
|
||||
List<Long> cellIds = new ArrayList<>();
|
||||
|
@ -1973,4 +1958,21 @@ public class TenPersonServiceImpl implements TenPersonService {
|
|||
public List<TenPersonEntity> getAllExpireGuest() {
|
||||
return tenPersonDao.getAllExpireGuest();
|
||||
}
|
||||
|
||||
public TenPersonEntity getOwner(Long roomId) {
|
||||
return this.tenPersonDao.getOwner(roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenPersonEntity> getNotSync(Long cellId) {
|
||||
return this.tenPersonDao.getNotSync(cellId);
|
||||
}
|
||||
@Override
|
||||
public List<TenPersonEntity> getNotSyncCard(Long cellId) {
|
||||
return this.tenPersonDao.getNotSyncCard(cellId);
|
||||
}
|
||||
@Override
|
||||
public List<TenPersonEntity> getNotSyncImage(Long cellId) {
|
||||
return this.tenPersonDao.getNotSyncImage(cellId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,4 +360,13 @@ public class TenRecordServiceImpl implements TenRecordService {
|
|||
}
|
||||
return page.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenRecordEntity> getNotSync(Long cellId, Long tenantId) {
|
||||
return this.tenRecordDao.getNotSync(cellId, tenantId);
|
||||
}
|
||||
@Override
|
||||
public List<TenRecordEntity> getNotSyncImage(Long cellId, Long tenantId) {
|
||||
return this.tenRecordDao.getNotSyncImage(cellId, tenantId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,4 +182,11 @@ public class TenRoomServiceImpl implements TenRoomService {
|
|||
}
|
||||
return tenRoomDao.getAllCount(cellIds,params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenRoomEntity> getNotSync(Long cellId) {
|
||||
return this.tenRoomDao.getNotSync(cellId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,23 +19,54 @@ public class XaApi {
|
|||
|
||||
private static final String getFwikUrl = "http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp";
|
||||
|
||||
/**
|
||||
* appid: 1297164778041095
|
||||
* appsecret: 22971647780410956329716477804109
|
||||
* xqid: 610113600000000004538
|
||||
*/
|
||||
|
||||
public static String getAddress(String xqid, String appId, String appSecret) {
|
||||
Map<String, String> postParameters = new HashMap<>();
|
||||
// Map<String, String> postParameters = new HashMap<>();
|
||||
// String appsecretMd5 = MD5Utils.getMD5Str(appSecret);
|
||||
// postParameters.put("xqid", xqid);
|
||||
// postParameters.put("appid", appId);
|
||||
// postParameters.put("appsecret", appsecretMd5);
|
||||
|
||||
JSONObject postParameters = new JSONObject();
|
||||
String appsecretMd5 = MD5Utils.getMD5Str(appSecret);
|
||||
postParameters.put("xqid", xqid);
|
||||
postParameters.put("appid", appId);
|
||||
postParameters.put("appsecret", appsecretMd5);
|
||||
return XaHttpUtils.postHttp("http://117.34.12.66:10011/zhxqgl/interface/get_xq_addr.jsp", postParameters);
|
||||
|
||||
Map<String,String> headersMap = new HashMap<>();
|
||||
headersMap.put("appId",appId);
|
||||
String token = XaHttpUtils.getToken(appId,appSecret,"");
|
||||
headersMap.put("token",token);
|
||||
headersMap.put("tranId","202103310952250000000000000001");
|
||||
|
||||
|
||||
|
||||
return XaHttpUtils.postHttpEncryption("http://117.34.12.66:10011/zhxqgl/interface/get_xq_addr.jsp", headersMap,postParameters);
|
||||
|
||||
}
|
||||
|
||||
public static String getFwikUrl(String appId, String appSecret) {
|
||||
Map<String, String> postParameters = new HashMap<>();
|
||||
String appsecretMd5 = MD5Utils.getMD5Str(appSecret);
|
||||
JSONObject postParameters = new JSONObject();
|
||||
String appsecretMd5 = MD5Utils.md5Str(appSecret);
|
||||
// postParameters.put("xqid", xqid);
|
||||
postParameters.put("appid", appId);
|
||||
postParameters.put("appsecret", appsecretMd5);
|
||||
String res = XaHttpUtils.postHttp("http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp", postParameters);
|
||||
|
||||
Map<String,String> headersMap = new HashMap<>();
|
||||
headersMap.put("appId",appId);
|
||||
String token = XaHttpUtils.getToken(appId,appSecret,"");
|
||||
headersMap.put("token",token);
|
||||
headersMap.put("tranId","202103310952250000000000000001");
|
||||
|
||||
String res = XaHttpUtils.postHttpEncryption("http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp", headersMap, postParameters);
|
||||
JSONObject resObject = JSONObject.parseObject(res);
|
||||
if (resObject != null) {
|
||||
log.debug(resObject.toJSONString());
|
||||
JSONObject xmlObject = resObject.getJSONObject("xml");
|
||||
String code = xmlObject.getString("code");
|
||||
if (code != null && code.equals("0000"))
|
||||
|
@ -58,7 +89,7 @@ public class XaApi {
|
|||
String tokenStr = appId + appSecret + DateUtils.format(new Date(), "YYYYMMDD") + dataMiWen;
|
||||
String token = MD5Utils.getMD5Str(tokenStr);
|
||||
Map<String, String> headerMaps = new HashMap<>();
|
||||
headerMaps.put("appID", appId);
|
||||
headerMaps.put("appId", appId);
|
||||
headerMaps.put("token", token);
|
||||
headerMaps.put("tranId", tranId);
|
||||
headerMaps.put("serviceId", serviceId);
|
||||
|
@ -70,4 +101,23 @@ public class XaApi {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void main(String args[]){
|
||||
/**
|
||||
* appid: 1297164778041095
|
||||
* appsecret: 22971647780410956329716477804109
|
||||
* xqid: 610113600000000004538
|
||||
*/
|
||||
String appid = "1297164778041095";
|
||||
String appsecret = "22971647780410956329716477804109";
|
||||
String xqid = "610113600000000004538";
|
||||
// String address = getAddress(xqid,appid,appsecret);
|
||||
// System.out.println(address);
|
||||
|
||||
String apiUrl = getFwikUrl(appid,appsecret);
|
||||
System.out.println(apiUrl);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,190 @@
|
|||
<%@ page language="java" import="java.util.*,java.net.*,java.text.*,java.io.*" pageEncoding="utf-8"%>
|
||||
<%@page import="javax.crypto.KeyGenerator"%>
|
||||
<%@page import="java.security.SecureRandom"%>
|
||||
<%@page import="java.security.MessageDigest"%>
|
||||
<%@page import="javax.crypto.SecretKey"%>
|
||||
<%@page import="javax.crypto.spec.SecretKeySpec"%>
|
||||
<%@page import="javax.crypto.Cipher"%>
|
||||
<%@page import="org.apache.axis.encoding.Base64"%>
|
||||
|
||||
<title>返回数据页面</title>
|
||||
<%!
|
||||
protected static MessageDigest messageDigest = null;
|
||||
public static String md5(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.reset();
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
}catch (Exception e) {
|
||||
return str;
|
||||
}
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
return md5StrBuff.toString().toUpperCase();
|
||||
}
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param content
|
||||
* 需要加密的内容
|
||||
* @param password
|
||||
* 加密密码
|
||||
* @return
|
||||
*/
|
||||
private static byte[] encryptData_AES(String content, String password) {
|
||||
try {
|
||||
//SecretKey secretKey = getKey(password);
|
||||
//byte[] enCodeFormat = secretKey.getEncoded();
|
||||
byte[] enCodeFormat = parseHexStr2Byte(password);
|
||||
|
||||
//System.out.println("*-*-*-*-*-*-*-*"+enCodeFormat.toString);
|
||||
|
||||
|
||||
/*MessageDigest md = MessageDigest.getInstance("MD5"); //lxl
|
||||
byte[] enCodeFormat=md.digest(password.getBytes("utf-8"));//lxl*/
|
||||
|
||||
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES");// 创建密码器
|
||||
byte[] byteContent = content.getBytes("utf-8");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化
|
||||
byte[] result = cipher.doFinal(byteContent);
|
||||
return result; // 加密
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将16进制转换为二进制
|
||||
*
|
||||
* @param hexStr
|
||||
* @return
|
||||
*/
|
||||
private static byte[] parseHexStr2Byte(String hexStr) {
|
||||
if (hexStr.length() < 1)
|
||||
return null;
|
||||
byte[] result = new byte[hexStr.length() / 2];
|
||||
for (int i = 0; i < hexStr.length() / 2; i++) {
|
||||
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
|
||||
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2),
|
||||
16);
|
||||
result[i] = (byte) (high * 16 + low);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将二进制转换成16进制
|
||||
*
|
||||
* @param buf
|
||||
* @return
|
||||
*/
|
||||
private static String parseByte2HexStr(byte buf[]) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < buf.length; i++) {
|
||||
String hex = Integer.toHexString(buf[i] & 0xFF);
|
||||
if (hex.length() == 1) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
sb.append(hex.toUpperCase());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
/**
|
||||
* 字符串加密
|
||||
*
|
||||
* @param srcStr
|
||||
* 加密字符串
|
||||
* @param password
|
||||
* 加密密钥
|
||||
* */
|
||||
public static String encryptStr(String srcStr, String password) {
|
||||
|
||||
byte[] encryptResult = encryptData_AES(srcStr, password);
|
||||
|
||||
String encryptResultStr = parseByte2HexStr(encryptResult);
|
||||
|
||||
return encryptResultStr;
|
||||
}
|
||||
|
||||
public static String httpPOST(String url, String json,String serviceId,String serviceValue,String appid,String secre){
|
||||
String data = "";
|
||||
try {
|
||||
URL dataurl = new URL(url);
|
||||
|
||||
HttpURLConnection conn = (HttpURLConnection)dataurl.openConnection();
|
||||
try{
|
||||
conn.setRequestMethod("POST");
|
||||
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String token = md5(appid+secre+currdate+json.replaceAll("\r\n", ""));
|
||||
System.out.println("json****"+json);
|
||||
System.out.println("333appid***"+appid);
|
||||
System.out.println("333token***"+token);
|
||||
System.out.println("333serviceId***"+serviceId);
|
||||
System.out.println("333serviceValue***"+serviceValue);
|
||||
|
||||
conn.setRequestProperty("appid", appid);
|
||||
conn.setRequestProperty("token", token);
|
||||
conn.setRequestProperty("tranId", "12312321312321321321312");//可固定这么写
|
||||
conn.setRequestProperty("serviceId", serviceId);
|
||||
conn.setRequestProperty("serviceValue", serviceValue);
|
||||
conn.setRequestProperty("versionCode", "");
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
|
||||
OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||
os.write(json);
|
||||
|
||||
os.flush();
|
||||
os.close();
|
||||
//conn.setConnectTimeout(10000);
|
||||
}catch(Exception ex){
|
||||
System.out.println("errir="+ex.getMessage());
|
||||
conn.disconnect();
|
||||
return "";
|
||||
}
|
||||
InputStream is = conn.getInputStream();
|
||||
DataInputStream dis = new DataInputStream(is);
|
||||
byte bt[] = new byte[dis.available()];
|
||||
dis.read(bt);
|
||||
data = URLDecoder.decode(new String(bt,"UTF-8"),"UTF-8");
|
||||
conn.disconnect();
|
||||
is.close();
|
||||
dis.close();
|
||||
} catch (Exception e) {
|
||||
data ="";
|
||||
}
|
||||
return data;
|
||||
}
|
||||
%>
|
||||
<%
|
||||
String name = "测试";
|
||||
request.setCharacterEncoding("utf-8");
|
||||
String url=request.getParameter("url");//http://117.34.12.66:10011/ywxzservice/dbClient.do
|
||||
String json=request.getParameter("jsondata");//json字符串(未加密的数据,不同接口不同数据)
|
||||
//{"datas": [{数据填写地方}],"pages": [{"psize": "10","tcount": "","pno": "1","tsize": ""}]}
|
||||
String serviceId=request.getParameter("serviceId");//调用的接口名称
|
||||
String serviceValue=request.getParameter("serviceValue");//调用的接个名称(同上)
|
||||
String appid=request.getParameter("appid");//appid 由天创公司提供
|
||||
String secre=request.getParameter("secre");//APPSECRET 由天创公司提供
|
||||
String aes=request.getParameter("aes");//APPSECRET 由天创公司提供
|
||||
|
||||
String b = encryptStr(json.trim(), aes);//数据的aes加密
|
||||
|
||||
String result = httpPOST(url,b,serviceId,serviceValue,appid,secre);//发送
|
||||
out.println("result="+result);//返回结果
|
||||
%>
|
||||
|
||||
|
||||
|
|
@ -2,25 +2,36 @@ package net.shapelight.modules.xian.utils;
|
|||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.shapelight.common.utils.DateUtils;
|
||||
import net.shapelight.common.utils.MD5Utils;
|
||||
import net.shapelight.common.utils.RestTemplateUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.DefaultResponseErrorHandler;
|
||||
import org.springframework.web.client.ResponseErrorHandler;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
public class XaHttpUtils {
|
||||
|
||||
|
@ -30,7 +41,7 @@ public class XaHttpUtils {
|
|||
|
||||
private static final String appSecret = "22971647780410956329716477804109";
|
||||
|
||||
public static String postHttp(String url, Map<String, String> postParameters) {
|
||||
public static String postHttp(String url, MultiValueMap<String, String> postParameters) {
|
||||
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
||||
requestFactory.setConnectTimeout(180000);
|
||||
requestFactory.setReadTimeout(180000);
|
||||
|
@ -53,33 +64,130 @@ public class XaHttpUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static String postHttp(String url, Map<String, String> postParameters, Map<String, String> headerMaps) {
|
||||
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
||||
|
||||
|
||||
/**
|
||||
* 加密参数类型请求 application/x-www-form-urlencoded
|
||||
* MultiValueMap<String, Object>
|
||||
* 采用 HttpEntity<MultiValueMap<String, Object>> 构造
|
||||
* http 请求 post
|
||||
* @param url 地址
|
||||
* @param
|
||||
// * @param headersMap header
|
||||
// * @param connecTimeout 连接时间
|
||||
// * @param readTimeout 读取时间
|
||||
// * @param retryCount 重试机制
|
||||
* @return String 类型
|
||||
*/
|
||||
public static String postHttpEncryption(String url, Map headersMap, JSONObject postParametersJson) {
|
||||
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); // 时间函数
|
||||
requestFactory.setConnectTimeout(180000);
|
||||
requestFactory.setReadTimeout(180000);
|
||||
RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)requestFactory);
|
||||
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||
restTemplate.setErrorHandler((ResponseErrorHandler)new DefaultResponseErrorHandler());
|
||||
//内部实际实现为 HttpClient
|
||||
RestTemplate restTemplate = new RestTemplate(requestFactory);
|
||||
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); // 设置编码集
|
||||
restTemplate.setErrorHandler(new XaHttpUtils.DefaultResponseErrorHandler()); // 异常处理的headers error 处理
|
||||
// 设置·header信息
|
||||
// HttpHeaders requestHeaders = new HttpHeaders();
|
||||
// requestHeaders.setAll(headersMap);
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.setAll(headersMap);
|
||||
requestHeaders.add("Content-Type", "application/x-www-form-urlencoded");
|
||||
for (String key : headerMaps.keySet()) {
|
||||
System.out.print(key + "-" + (String)headerMaps.get(key) + "\t");
|
||||
requestHeaders.add("key", headerMaps.get(key));
|
||||
}
|
||||
HttpEntity<Map<String, String>> requestEntity = new HttpEntity(postParameters, (MultiValueMap)requestHeaders);
|
||||
String result = null;
|
||||
MultiValueMap<String, String> postParameters = createMultiValueMap(postParametersJson);
|
||||
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(postParameters, requestHeaders);
|
||||
String result = null; // 返回值类型;
|
||||
for (int i = 1; i <= 3; i++){
|
||||
try {
|
||||
result = (String)restTemplate.postForObject(url, requestEntity, String.class, new Object[0]);
|
||||
result = restTemplate.postForObject(url, requestEntity, String.class);
|
||||
return result;
|
||||
} catch (RestClientException e) {
|
||||
System.out.println("-----------" + i);
|
||||
System.out.println("-----------开始-----------重试count: "+i);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName: DefaultResponseErrorHandler
|
||||
* @Description: TODO
|
||||
* @author:
|
||||
* @date: 2
|
||||
*/
|
||||
private static class DefaultResponseErrorHandler implements ResponseErrorHandler {
|
||||
|
||||
/** 对response进行判断,如果是异常情况,返回true */
|
||||
@Override
|
||||
public boolean hasError(ClientHttpResponse response) throws IOException {
|
||||
return response.getStatusCode().value() != HttpServletResponse.SC_OK;
|
||||
}
|
||||
|
||||
/** 异常情况时的处理方法 */
|
||||
@Override
|
||||
public void handleError(ClientHttpResponse response) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(response.getBody()));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String str = null;
|
||||
while ((str = br.readLine()) != null) {
|
||||
sb.append(str);
|
||||
}
|
||||
try {
|
||||
throw new Exception(sb.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static MultiValueMap<String, String> createMultiValueMap(JSONObject params) {
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
for (String key : params.keySet()) {
|
||||
if (params.get(key) instanceof List) {
|
||||
for (Iterator<String> it = ((List<String>) params.get(key)).iterator(); it.hasNext(); ) {
|
||||
String value = it.next();
|
||||
map.add(key, value);
|
||||
}
|
||||
} else {
|
||||
map.add(key, params.getString(key));
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// public static String postHttp(String url, Map<String, String> postParameters, Map<String, String> headerMaps) {
|
||||
// SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
||||
// requestFactory.setConnectTimeout(180000);
|
||||
// requestFactory.setReadTimeout(180000);
|
||||
// RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)requestFactory);
|
||||
// restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||
// restTemplate.setErrorHandler((ResponseErrorHandler)new DefaultResponseErrorHandler());
|
||||
// HttpHeaders requestHeaders = new HttpHeaders();
|
||||
// requestHeaders.add("Content-Type", "application/x-www-form-urlencoded");
|
||||
// for (String key : headerMaps.keySet()) {
|
||||
// System.out.print(key + "-" + (String)headerMaps.get(key) + "\t");
|
||||
// requestHeaders.add("key", headerMaps.get(key));
|
||||
// }
|
||||
// HttpEntity<Map<String, String>> requestEntity = new HttpEntity(postParameters, (MultiValueMap)requestHeaders);
|
||||
// String result = null;
|
||||
// for (int i = 1; i <= 3; i++) {
|
||||
// try {
|
||||
// result = (String)restTemplate.postForObject(url, requestEntity, String.class, new Object[0]);
|
||||
// return result;
|
||||
// } catch (RestClientException e) {
|
||||
// System.out.println("-----------" + i);
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
public static String postHttp(String url, JSONObject params) {
|
||||
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
||||
requestFactory.setConnectTimeout(180000);
|
||||
|
@ -103,13 +211,13 @@ public class XaHttpUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
public String getToken(String appId, String appSecret, String requestPackage) {
|
||||
public static String getToken(String appId, String appSecret, String requestPackage) {
|
||||
return MD5Utils.getMD5Str(appId + appSecret +
|
||||
|
||||
DateUtils.format(new Date(), "YYYYMMDD") + requestPackage);
|
||||
}
|
||||
|
||||
public String packageEncode(String appSecret, String packageString) {
|
||||
public static String packageEncode(String appSecret, String packageString) {
|
||||
try {
|
||||
String res = AESUtils.encrypt(packageString, appSecret);
|
||||
return res;
|
||||
|
@ -119,7 +227,7 @@ public class XaHttpUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public String packageDecode(String appSecret, String packageString) {
|
||||
public static String packageDecode(String appSecret, String packageString) {
|
||||
try {
|
||||
String res = AESUtils.decrypt(packageString, appSecret);
|
||||
return res;
|
||||
|
@ -129,4 +237,6 @@ public class XaHttpUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,363 @@
|
|||
package net.shapelight.modules.xian.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class XaUtils {
|
||||
protected static MessageDigest messageDigest = null;
|
||||
|
||||
public static String md5(String str) {
|
||||
// MessageDigest messageDigest = null;
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.reset();
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (Exception e) {
|
||||
return str;
|
||||
}
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
return md5StrBuff.toString().toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*
|
||||
* @param content 需要加密的内容
|
||||
* @param password 加密密码
|
||||
* @return
|
||||
*/
|
||||
private static byte[] encryptData_AES(String content, String password) {
|
||||
try {
|
||||
//SecretKey secretKey = getKey(password);
|
||||
//byte[] enCodeFormat = secretKey.getEncoded();
|
||||
byte[] enCodeFormat = parseHexStr2Byte(password);
|
||||
|
||||
//System.out.println("*-*-*-*-*-*-*-*"+enCodeFormat.toString);
|
||||
|
||||
|
||||
/*MessageDigest md = MessageDigest.getInstance("MD5"); //lxl
|
||||
byte[] enCodeFormat=md.digest(password.getBytes("utf-8"));//lxl*/
|
||||
|
||||
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES");// 创建密码器
|
||||
byte[] byteContent = content.getBytes("utf-8");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化
|
||||
byte[] result = cipher.doFinal(byteContent);
|
||||
return result; // 加密
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将16进制转换为二进制
|
||||
*
|
||||
* @param hexStr
|
||||
* @return
|
||||
*/
|
||||
private static byte[] parseHexStr2Byte(String hexStr) {
|
||||
if (hexStr.length() < 1)
|
||||
return null;
|
||||
byte[] result = new byte[hexStr.length() / 2];
|
||||
for (int i = 0; i < hexStr.length() / 2; i++) {
|
||||
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
|
||||
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2),
|
||||
16);
|
||||
result[i] = (byte) (high * 16 + low);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将二进制转换成16进制
|
||||
*
|
||||
* @param buf
|
||||
* @return
|
||||
*/
|
||||
private static String parseByte2HexStr(byte buf[]) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < buf.length; i++) {
|
||||
String hex = Integer.toHexString(buf[i] & 0xFF);
|
||||
if (hex.length() == 1) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
sb.append(hex.toUpperCase());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串加密
|
||||
*
|
||||
* @param srcStr 加密字符串
|
||||
* @param password 加密密钥
|
||||
*/
|
||||
public static String encryptStr(String srcStr, String password) {
|
||||
|
||||
byte[] encryptResult = encryptData_AES(srcStr, password);
|
||||
|
||||
String encryptResultStr = parseByte2HexStr(encryptResult);
|
||||
|
||||
return encryptResultStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url
|
||||
* @param json 加密后的json
|
||||
* @param serviceId
|
||||
* @param serviceValue
|
||||
* @param appid
|
||||
* @param secre
|
||||
* @return
|
||||
*/
|
||||
public static String httpPOSTJson(String url, String json, String serviceId, String serviceValue, String appid, String secre) {
|
||||
String data = "";
|
||||
try {
|
||||
URL dataurl = new URL(url);
|
||||
|
||||
HttpURLConnection conn = (HttpURLConnection) dataurl.openConnection();
|
||||
try {
|
||||
conn.setRequestMethod("POST");
|
||||
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String token = md5(appid + secre + currdate + json.replaceAll("\r\n", ""));
|
||||
System.out.println("json****" + json);
|
||||
System.out.println("333appid***" + appid);
|
||||
System.out.println("333token***" + token);
|
||||
System.out.println("333serviceId***" + serviceId);
|
||||
System.out.println("333serviceValue***" + serviceValue);
|
||||
|
||||
conn.setRequestProperty("appid", appid);
|
||||
conn.setRequestProperty("token", token);
|
||||
conn.setRequestProperty("tranId", "12312321312321321321312");//可固定这么写
|
||||
conn.setRequestProperty("serviceId", serviceId);
|
||||
conn.setRequestProperty("serviceValue", serviceValue);
|
||||
conn.setRequestProperty("versionCode", "");
|
||||
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
|
||||
// String params = "appid=" + URLEncoder.encode(appid, "UTF-8") + "&appsecret=" + URLEncoder.encode(secre, "UTF-8");
|
||||
// OutputStream outputStream = conn.getOutputStream();
|
||||
// outputStream.write(params.getBytes());
|
||||
// outputStream.flush();
|
||||
// outputStream.close();
|
||||
|
||||
OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||
os.write(json);
|
||||
os.flush();
|
||||
os.close();
|
||||
//conn.setConnectTimeout(10000);
|
||||
} catch (Exception ex) {
|
||||
System.out.println("errir=" + ex.getMessage());
|
||||
conn.disconnect();
|
||||
return "";
|
||||
}
|
||||
InputStream is = conn.getInputStream();
|
||||
DataInputStream dis = new DataInputStream(is);
|
||||
byte bt[] = new byte[dis.available()];
|
||||
dis.read(bt);
|
||||
data = URLDecoder.decode(new String(bt, "UTF-8"), "UTF-8");
|
||||
conn.disconnect();
|
||||
is.close();
|
||||
dis.close();
|
||||
} catch (Exception e) {
|
||||
data = "";
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url
|
||||
// * @param json 加密后的json
|
||||
// * @param serviceId
|
||||
// * @param serviceValue
|
||||
* @param appid
|
||||
* @param secre
|
||||
* @return
|
||||
*/
|
||||
public static String httpPOSTParam(String url, String appid, String secre, Map<String,String> mapParams) {
|
||||
String data = "";
|
||||
try {
|
||||
URL dataurl = new URL(url);
|
||||
|
||||
HttpURLConnection conn = (HttpURLConnection) dataurl.openConnection();
|
||||
try {
|
||||
conn.setRequestMethod("POST");
|
||||
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String token = md5(appid + secre + currdate);
|
||||
// System.out.println("json****" + json);
|
||||
System.out.println("appid***" + appid);
|
||||
System.out.println("token***" + token);
|
||||
// System.out.println("333serviceId***" + serviceId);
|
||||
// System.out.println("333serviceValue***" + serviceValue);
|
||||
|
||||
conn.setRequestProperty("appid", appid);
|
||||
conn.setRequestProperty("token", token);
|
||||
conn.setRequestProperty("tranId", "12312321312321321321312");//可固定这么写
|
||||
// conn.setRequestProperty("serviceId", "");
|
||||
// conn.setRequestProperty("serviceValue", "");
|
||||
// conn.setRequestProperty("versionCode", "");
|
||||
|
||||
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
|
||||
StringBuffer paramsBuffer = new StringBuffer();
|
||||
|
||||
|
||||
mapParams.forEach((key,value)->{
|
||||
paramsBuffer.append("&"+key+"=");
|
||||
try {
|
||||
paramsBuffer.append(URLEncoder.encode(value, "UTF-8"));
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
// System.out.println(key);
|
||||
// System.out.println(value);
|
||||
});
|
||||
|
||||
|
||||
String params = paramsBuffer.toString().substring(1);
|
||||
System.out.println(params);
|
||||
// String s = "appid=" + URLEncoder.encode(appid, "UTF-8") + "&appsecret=" + URLEncoder.encode(secre, "UTF-8");
|
||||
OutputStream outputStream = conn.getOutputStream();
|
||||
outputStream.write(params.getBytes());
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
|
||||
// OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||
// os.write(json);
|
||||
// os.flush();
|
||||
// os.close();
|
||||
//conn.setConnectTimeout(10000);
|
||||
} catch (Exception ex) {
|
||||
System.out.println("errir=" + ex.getMessage());
|
||||
conn.disconnect();
|
||||
return "";
|
||||
}
|
||||
InputStream is = conn.getInputStream();
|
||||
DataInputStream dis = new DataInputStream(is);
|
||||
byte bt[] = new byte[dis.available()];
|
||||
dis.read(bt);
|
||||
data = URLDecoder.decode(new String(bt, "UTF-8"), "UTF-8");
|
||||
conn.disconnect();
|
||||
is.close();
|
||||
dis.close();
|
||||
} catch (Exception e) {
|
||||
data = "";
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String args[]){
|
||||
/**
|
||||
* appid: 1297164778041095
|
||||
* appsecret: 22971647780410956329716477804109
|
||||
* xqid: 610113600000000004538
|
||||
*/
|
||||
|
||||
/*
|
||||
String name = "测试";
|
||||
request.setCharacterEncoding("utf-8");
|
||||
String url=request.getParameter("url");//http://117.34.12.66:10011/ywxzservice/dbClient.do
|
||||
String json=request.getParameter("jsondata");//json字符串(未加密的数据,不同接口不同数据)
|
||||
//{"datas": [{数据填写地方}],"pages": [{"psize": "10","tcount": "","pno": "1","tsize": ""}]}
|
||||
String serviceId=request.getParameter("serviceId");//调用的接口名称
|
||||
String serviceValue=request.getParameter("serviceValue");//调用的接个名称(同上)
|
||||
String appid=request.getParameter("appid");//appid 由天创公司提供
|
||||
String secre=request.getParameter("secre");//APPSECRET 由天创公司提供
|
||||
String aes=request.getParameter("aes");//APPSECRET 由天创公司提供
|
||||
|
||||
String b = encryptStr(json.trim(), aes);//数据的aes加密
|
||||
|
||||
String result = httpPOST(url,b,serviceId,serviceValue,appid,secre);//发送
|
||||
out.println("result="+result);//返回结果
|
||||
|
||||
*/
|
||||
|
||||
//获取借口接口地址
|
||||
String appid = "1297164778041095";
|
||||
String secre = "22971647780410956329716477804109";
|
||||
// String secreMd5 = md5("22971647780410956329716477804109");
|
||||
// System.out.println("secretMd5:"+secreMd5);
|
||||
Map<String,String> paramMap = new HashMap<>();
|
||||
paramMap.put("appid",appid);
|
||||
paramMap.put("appsecret",md5(secre));
|
||||
String FwjkUrl = httpPOSTParam("http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp",
|
||||
appid,secre,paramMap);
|
||||
System.out.println("FwjkUrl:"+FwjkUrl);
|
||||
|
||||
|
||||
//获取标准地址
|
||||
|
||||
String xqid = "610113600000000004538";
|
||||
Map<String,String> addressMap = new HashMap<>();
|
||||
addressMap.put("appid",appid);
|
||||
addressMap.put("appsecret",md5(secre));
|
||||
addressMap.put("xqid",xqid);
|
||||
String address = httpPOSTParam("http://117.34.12.66:10011/zhxqgl/interface/get_xq_addr.jsp",
|
||||
appid,secre,addressMap);
|
||||
|
||||
System.out.println("Address:"+address);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// String url = "http://117.34.12.66:10011/ywxzservice/dbClient.do";
|
||||
// String appid = "1297164778041095";
|
||||
// String secret = "22971647780410956329716477804109";
|
||||
// String serviceId = "SYFW";
|
||||
// String serviceValue = "SYFW";
|
||||
// String dataMing = "";
|
||||
//
|
||||
// String dataMi = encryptStr(dataMing.trim(), secret);//数据的aes加密
|
||||
//
|
||||
// String result = httpPOSTJson(url,dataMi,serviceId,serviceValue,appid,secret);//发送
|
||||
// System.out.println(result);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package net.shapelight.modules.xian.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class XaPages {
|
||||
/**
|
||||
* pages 否 对象 4.1查询接口时需要
|
||||
|
|
|
@ -4,17 +4,9 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class XaRYRKPHOTO {
|
||||
|
||||
|
||||
private String LV_CASE_ID;
|
||||
|
||||
private String LV_SSXQBM;
|
||||
|
||||
private String LV_ZP;
|
||||
|
||||
private String LV_DJSJ;
|
||||
|
||||
private String LV_GMSFHM;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.shapelight.modules.xian.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class XaSYRK {
|
||||
/**
|
||||
* 6.3.1 实有人口信息数据项
|
||||
|
@ -110,5 +113,7 @@ public class XaSYRK {
|
|||
*/
|
||||
private String LV_PROCMODE = "PMINSERT";
|
||||
|
||||
private String LV_ZJZL = "10";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<mapper namespace="net.shapelight.modules.ten.dao.TenCellDao">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<!-- -->
|
||||
<resultMap type="net.shapelight.modules.ten.entity.TenCellEntity" id="tenCellMap">
|
||||
<result property="cellId" column="cell_id"/>
|
||||
<result property="areaId" column="area_id"/>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<result property="temperatureAlert" column="temperature_alert"/>
|
||||
<result property="healthCodeFlag" column="health_code_flag"/>
|
||||
|
||||
<result column="xa_sync" property="xaSync"/>
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?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="net.shapelight.modules.ten.dao.TenPackChannalDao">
|
||||
|
||||
<!-- -->
|
||||
<resultMap type="net.shapelight.modules.ten.entity.TenPackChannalEntity" id="tenPackChannalMap">
|
||||
<result property="parkChannalId" column="park_channal_id"/>
|
||||
<result property="packId" column="pack_id"/>
|
||||
<result property="channalName" column="channal_name"/>
|
||||
<result property="channalCode" column="channal_code"/>
|
||||
<result property="channalCodeXa" column="channal_code_xa"/>
|
||||
<result property="direction" column="direction"/>
|
||||
<result property="cellId" column="cell_id"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<mapper namespace="net.shapelight.modules.ten.dao.TenPackRecordDao">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<!-- -->
|
||||
<resultMap type="net.shapelight.modules.ten.entity.TenPackRecordEntity" id="tenPackRecordMap">
|
||||
<result property="recordId" column="record_id"/>
|
||||
<result property="parkId" column="park_id"/>
|
||||
|
@ -25,6 +25,8 @@
|
|||
<result property="actualFee" column="actual_fee"/>
|
||||
<result property="operator" column="operator"/>
|
||||
<result property="cellId" column="cell_id"/>
|
||||
<result property="xaSync" column="xa_sync"/>
|
||||
<result property="xaSyncImage" column="xa_sync_iamge"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
@ -92,6 +94,12 @@
|
|||
<if test="cellId != null">
|
||||
cell_id,
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync,
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
xa_sync_image,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="recordId != null">
|
||||
|
@ -154,6 +162,12 @@
|
|||
<if test="cellId != null">
|
||||
#{cellId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
#{xaSync},
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
#{xaSyncImage},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -225,6 +239,12 @@
|
|||
<if test="cellId != null">
|
||||
cell_id = #{cellId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync = #{xaSync},
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
xa_sync_image = #{xaSyncImage},
|
||||
</if>
|
||||
</set>
|
||||
where record_id = #{recordId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -260,5 +280,15 @@
|
|||
order by in_time desc
|
||||
</select>
|
||||
|
||||
<select id="getNotSync" resultMap="tenPackRecordMap">
|
||||
select * from ten_pack_record
|
||||
where xa_sync = 0 and cell_id = #{cellId}
|
||||
</select>
|
||||
|
||||
<select id="getNotSyncImage" resultMap="tenPackRecordMap">
|
||||
select * from ten_pack_record
|
||||
where xa_sync_image = 0 and cell_id = #{cellId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?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="net.shapelight.modules.ten.dao.TenPackRecordEnterDao">
|
||||
|
||||
<!-- -->
|
||||
<resultMap type="net.shapelight.modules.ten.entity.TenPackRecordEnterEntity" id="tenPackRecordEnterMap">
|
||||
<result property="recordEnterId" column="record_enter_id"/>
|
||||
<result property="parkCode" column="park_code"/>
|
||||
<result property="parkName" column="park_name"/>
|
||||
<result property="orderNumber" column="order_number"/>
|
||||
<result property="plateNumber" column="plate_number"/>
|
||||
<result property="channelName" column="channel_name"/>
|
||||
<result property="enterTime" column="enter_time"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="carType" column="car_type"/>
|
||||
<result property="image" column="image"/>
|
||||
<result property="cellId" column="cell_id"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="xaSync" column="xa_sync"/>
|
||||
<result property="xaSyncImage" column="xa_sync_image"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,24 @@
|
|||
<?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="net.shapelight.modules.ten.dao.TenPackRecordExitDao">
|
||||
|
||||
<!-- -->
|
||||
<resultMap type="net.shapelight.modules.ten.entity.TenPackRecordExitEntity" id="tenPackRecordExitMap">
|
||||
<result property="recordExitId" column="record_exit_id"/>
|
||||
<result property="parkCode" column="park_code"/>
|
||||
<result property="parkName" column="park_name"/>
|
||||
<result property="orderNumber" column="order_number"/>
|
||||
<result property="plateNumber" column="plate_number"/>
|
||||
<result property="channelName" column="channel_name"/>
|
||||
<result property="exitTime" column="exit_time"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="carType" column="car_type"/>
|
||||
<result property="image" column="image"/>
|
||||
<result property="cellId" column="cell_id"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="xaSync" column="xa_sync"/>
|
||||
<result property="xaSyncImage" column="xa_sync_image"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -44,6 +44,9 @@
|
|||
<result column="register_type" jdbcType="TINYINT" property="registerType"/>
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
|
||||
<result column="face_failure" jdbcType="TINYINT" property="faceFailure"/>
|
||||
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
|
||||
<result column="xa_sync_card" jdbcType="TINYINT" property="xaSyncCard" />
|
||||
<result column="xa_sync_image" jdbcType="TINYINT" property="xaSyncImage" />
|
||||
<association property="cellName" javaType="String"
|
||||
select="net.shapelight.modules.ten.dao.TenCellDao.getCellName"
|
||||
column="cellId=cell_id">
|
||||
|
@ -218,6 +221,15 @@
|
|||
<if test="faceFailure != null">
|
||||
face_failure,
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync,
|
||||
</if>
|
||||
<if test="xaSyncCard != null">
|
||||
xa_sync_card,
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
xa_sync_image,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="personId != null">
|
||||
|
@ -337,6 +349,15 @@
|
|||
<if test="faceFailure != null">
|
||||
#{faceFailure,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
#{xaSync,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="xaSyncCard != null">
|
||||
#{xaSyncCard,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
#{xaSyncImage,jdbcType=TINYINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -461,6 +482,15 @@
|
|||
<if test="faceFailure != null">
|
||||
face_failure = #{faceFailure,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync = #{xaSync,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="xaSyncCard != null">
|
||||
xa_sync_card = #{xaSyncCard,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
xa_sync_image = #{xaSyncImage,jdbcType=TINYINT},
|
||||
</if>
|
||||
</set>
|
||||
where person_id = #{personId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
@ -869,4 +899,37 @@
|
|||
and delete_flag = 0
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getOwner" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
||||
select * from ten_person
|
||||
where room_id = #{roomId}
|
||||
and delete_flag = 0 and person_type = 5000
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
||||
select * from ten_person
|
||||
where cell_id = #{cellId}
|
||||
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
|
||||
and xa_sync = 0
|
||||
</select>
|
||||
|
||||
<select id="getNotSyncCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
||||
select * from ten_person
|
||||
where cell_id = #{cellId}
|
||||
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
|
||||
and xa_sync_card = 0
|
||||
</select>
|
||||
|
||||
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
||||
select * from ten_person
|
||||
where cell_id = #{cellId}
|
||||
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
|
||||
and xa_sync_image = 0
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<mapper namespace="net.shapelight.modules.ten.dao.TenRecordDao">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<!-- -->
|
||||
<resultMap type="net.shapelight.modules.ten.entity.TenRecordEntity" id="tenRecordMap">
|
||||
<result property="recordId" column="record_id"/>
|
||||
<result property="cellId" column="cell_id"/>
|
||||
|
@ -17,6 +17,8 @@
|
|||
<result property="recordTime" column="record_time"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
|
||||
<result column="xa_sync_image" jdbcType="TINYINT" property="xaSyncImage" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
@ -59,6 +61,12 @@
|
|||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync,
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
xa_sync_image,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="recordId != null">
|
||||
|
@ -97,6 +105,12 @@
|
|||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
#{xaSync},
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
#{xaSyncImage},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -140,6 +154,12 @@
|
|||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync = #{xaSync,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="xaSyncImage != null">
|
||||
xa_sync_image = #{xaSyncImage,jdbcType=TINYINT},
|
||||
</if>
|
||||
</set>
|
||||
where record_id = #{recordId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
@ -384,5 +404,17 @@
|
|||
order by record_time desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
|
||||
select * from ten_record_${tenantId}
|
||||
where cell_id = #{cellId}
|
||||
and xa_sync = 0
|
||||
</select>
|
||||
|
||||
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
|
||||
select * from ten_record_${tenantId}
|
||||
where cell_id = #{cellId}
|
||||
and xa_sync_image = 0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="delete_flag" jdbcType="TINYINT" property="deleteFlag" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
|
||||
<result column="p_id" jdbcType="VARCHAR" property="pId" />
|
||||
<result column="dzbm" jdbcType="VARCHAR" property="dzbm" />
|
||||
<association property="buildName" javaType="String"
|
||||
select="net.shapelight.modules.ten.dao.TenBuildDao.getBuildName"
|
||||
column="buildId=build_id,cellId=cell_id">
|
||||
|
@ -113,6 +116,15 @@
|
|||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync,
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
p_id,
|
||||
</if>
|
||||
<if test="dzbm != null">
|
||||
dzbm,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="roomId != null">
|
||||
|
@ -184,6 +196,15 @@
|
|||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
#{xaSync,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
#{pId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dzbm != null">
|
||||
#{dzbm,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -261,6 +282,15 @@
|
|||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="xaSync != null">
|
||||
xa_sync = #{xaSync,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
p_id = #{pId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dzbm != null">
|
||||
dabm = #{dzbm,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where room_id = #{roomId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
@ -276,7 +306,7 @@
|
|||
</delete>
|
||||
|
||||
<delete id="logicDeleteById">
|
||||
update ten_room_$ set delete_flag = 1
|
||||
update ten_room set delete_flag = 1
|
||||
where room_id = #{roomId,jdbcType=BIGINT}
|
||||
</delete>
|
||||
|
||||
|
@ -384,4 +414,13 @@
|
|||
</select>
|
||||
|
||||
|
||||
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
|
||||
select * from ten_room where delete_flag = 0
|
||||
and xa_sync = 0
|
||||
and cell_id = #{cellId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue