Commit d85a8053 authored by chenying's avatar chenying

6.6修改分配公司接口,修改用户接口,添加仓库数据下载接口

parent ce7d2c94
This diff is collapsed.
package com.example.tdl.domain.vo;
public class UpdateTDLCompanyVo {
private String TDLSN;
private String companyNo;
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
public String getCompanyNo() {
return companyNo;
}
public void setCompanyNo(String companyNo) {
this.companyNo = companyNo;
}
}
......@@ -8,13 +8,35 @@ public class UserNameVo {
private String ipAddress;
private String companyImg;
private String companyAlias;
public UserNameVo() {
}
public UserNameVo(String userName, String time, String ipAddress) {
public UserNameVo(String userName, String time, String ipAddress,String companyImg,String companyAlias) {
UserName = userName;
this.time = time;
this.ipAddress = ipAddress;
this.companyImg = companyImg;
this.companyAlias = companyAlias;
}
public String getCompanyAlias() {
return companyAlias;
}
public void setCompanyAlias(String companyAlias) {
this.companyAlias = companyAlias;
}
public String getCompanyImg() {
return companyImg;
}
public void setCompanyImg(String companyImg) {
this.companyImg = companyImg;
}
public String getUserName() {
......
......@@ -36,10 +36,10 @@ public class AliyunOSSClientUtil {
private static String FOLDER4;
private static String FOLDER5;
private static CannedAccessControlList acl_pub_readwrite = CannedAccessControlList.PublicReadWrite;
//初始化属性
static {
ENDPOINT = OSSClientConstants.ENDPOINT;
......@@ -50,7 +50,7 @@ public class AliyunOSSClientUtil {
FOLDER2 = OSSClientConstants.FOLDER2;
FOLDER3 = OSSClientConstants.FOLDER3;
FOLDER4 = OSSClientConstants.FOLDER4;
FOLDER5 = OSSClientConstants.FOLDER5;
}
public static String getENDPOINT() {
......@@ -151,7 +151,6 @@ public class AliyunOSSClientUtil {
logger.info("删除" + bucketName + "Bucket成功");
}
/**
* 上传图片
*
......@@ -170,7 +169,6 @@ public class AliyunOSSClientUtil {
}
}
public static String uploadImg2Oss(OSSClient ossClient, MultipartFile file, String number,String imageType ) {
String originalFilename = file.getOriginalFilename();
......@@ -233,7 +231,6 @@ public class AliyunOSSClientUtil {
return ret;
}
public static String uploadFile2OSS(OSSClient ossClient,InputStream instream, String fileName,String imageType ) {
String ret = "";
try {
......@@ -361,6 +358,8 @@ public class AliyunOSSClientUtil {
putResult = ossClient.putObject(BACKET_NAME, FOLDER3+ fileName, is, metadata);
} else if(fileName.contains("CHN")){
putResult = ossClient.putObject(BACKET_NAME, FOLDER4+ fileName, is, metadata);
} else if(fileName.contains("仓库温湿度观测记录表")){
putResult = ossClient.putObject(BACKET_NAME, FOLDER5+ fileName, is, metadata);
} else {
putResult = ossClient.putObject(BACKET_NAME, FOLDER1+ fileName, is, metadata);
}
......
......@@ -26,6 +26,8 @@ public class OSSClientConstants {
public static final String FOLDER4="pic/wareHouseImage/";//仓库图片
public static final String FOLDER5="warehouse/";//仓库数据下载
//公共读写
private static final CannedAccessControlList acl_pub_readwrite = CannedAccessControlList.PublicReadWrite;
......
This diff is collapsed.
......@@ -225,18 +225,21 @@ public class TDLDeviceController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value = "/updateCompany",method = RequestMethod.POST)
public Object updateCompany(@RequestBody String TDLSN, HttpServletRequest request){
public Object updateCompany(@RequestBody UpdateTDLCompanyVo updateTDLCompanyVo, HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
JSONObject jsonObject=JSON.parseObject(TDLSN);
TDLSN=(String) jsonObject.get("TDLSN");
if(StringUtils.isEmpty(TDLSN)){
if(StringUtils.isEmpty(updateTDLCompanyVo.getTDLSN())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"TDLSN"));
return gson.toJson(fb);
}
int a=tdlDeviceService.updateCompany(TDLSN,user.getCompanyNo());
if (StringUtils.isEmpty(updateTDLCompanyVo.getCompanyNo())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"companyNo"));
return gson.toJson(fb);
}
int a=tdlDeviceService.updateCompany(updateTDLCompanyVo.getTDLSN(),user.getCompanyNo());
if (a>=0){
fb.setCode(1);
fb.setMessage(i18n.getMessage(request,"updateTDLCompanySuccess"));
......
......@@ -414,9 +414,11 @@ public class UserController {
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" + token);
UserRedisVo userRedisVo = gson.fromJson(datum,UserRedisVo.class);
//获取当前登录者的天气
String ip = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getRemoteAddr();
return new UserNameVo(userRedisVo.getUserName(),System.currentTimeMillis() +"",ip);
ResultCompanyVo resultCompanyVo=companyService.getByCompanyNo(userRedisVo.getCompanyNo());
String img=resultCompanyVo.getImg();
String companyAlias=resultCompanyVo.getAlias();
return new UserNameVo(userRedisVo.getUserName(),System.currentTimeMillis() +"",ip,img,companyAlias);
}
}
......@@ -67,6 +67,7 @@ public class WarehouseController {
@Autowired
private InfluxDBTemplate influxDBTemplate;
@Autowired
private TDLLogService tdlLogService;
private final static String database ="original";
......
spring.datasource.url=jdbc:mysql://192.168.1.53:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.url=jdbc:mysql://192.168.1.16:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
threadpool.corepoolsize = 30
threadpool.maxpoolsize = 50
server.port=8099
server.port=8092
management.security.enabled=false
......
......@@ -44,7 +44,7 @@
<select id="getByWarehouse" parameterType="String" resultType="com.example.tdl.domain.vo.WarehouseLogVo">
select DISTINCT CONCAT( gatewaytype,"_",gatewaySN) device, tgl.gatewaySN SN,gatewaytype type, w.warehouseNo
select DISTINCT CONCAT( gatewaytype,"_",gatewaySN) device, tgl.gatewaySN SN,gatewaytype type,w.warehouseNo
from tdl_gateway_log tgl,warehouse w
where tgl.warehouseNo = w.warehouseNo
and w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment