Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
44201a83
Commit
44201a83
authored
Jul 21, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、小程序获取登录token接口修改
2、修改批量导出监管码
parent
6eeed5b9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
221 additions
and
141 deletions
+221
-141
EquipmentCategoryMapper.java
...s/boot/module/ymt/api/mapper/EquipmentCategoryMapper.java
+3
-0
EquipmentCategoryMapper.xml
...api/src/main/resources/mapper/EquipmentCategoryMapper.xml
+40
-0
EquipmentCategoryController.java
...odule/ymt/biz/controller/EquipmentCategoryController.java
+59
-36
LoginController.java
.../amos/boot/module/ymt/biz/controller/LoginController.java
+83
-97
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+28
-0
ImageUtils.java
...om/yeejoin/amos/boot/module/ymt/biz/utils/ImageUtils.java
+3
-3
application-dev3.properties
...le-ymt-biz/src/main/resources/application-dev3.properties
+5
-5
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/EquipmentCategoryMapper.java
View file @
44201a83
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipExportDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.UseUnitCreditCodeCategoryDto
;
...
...
@@ -50,4 +51,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List
<
EquipExportVo
>
getEquipExportData
(
@Param
(
"dto"
)
EquipExportDto
dto
);
Page
<
EquipExportVo
>
exportImageZip
(
@Param
(
"page"
)
Page
<
EquipExportVo
>
page
,
@Param
(
"dto"
)
EquipExportDto
dto
);
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/resources/mapper/EquipmentCategoryMapper.xml
View file @
44201a83
...
...
@@ -362,4 +362,44 @@
</where>
</select>
<select
id=
"exportImageZip"
resultType=
"com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo"
>
select ORG_BRANCH_NAME as orgBranchName,
USE_UNIT_NAME as useUnitName,
EQU_LIST as equList,
EQU_CATEGORY as equCategory,
USE_ORG_CODE as useOrgCode,
CODE96333 as code96333,
SUPERVISORY_CODE as supervisoryCode,
USE_PLACE as usePlace,
EQU_CODE as equCode,
CASE when EQU_STATE = 0 then '未登记'
when EQU_STATE = 1 then '在用'
when EQU_STATE = 2 then '停用'
when EQU_STATE = 3 then '报废'
when EQU_STATE = 4 then '注销'
ELSE EQU_STATE
END as equState
from ${dto.tableName}
<where>
<if
test=
"dto.CODE96333 != '' and dto.CODE96333 != null"
>
CODE96333 like concat('%', #{dto.CODE96333},'%')
</if>
<if
test=
"dto.EQU_CODE != '' and dto.EQU_CODE != null"
>
and EQU_CODE like concat('%', #{dto.EQU_CODE},'%')
</if>
<if
test=
"dto.SUPERVISORY_CODE != '' and dto.SUPERVISORY_CODE != null"
>
and SUPERVISORY_CODE like concat('%', #{dto.SUPERVISORY_CODE},'%')
</if>
<if
test=
"dto.USE_UNIT_NAME != '' and dto.USE_UNIT_NAME != null"
>
and USE_UNIT_NAME like concat('%', #{dto.USE_UNIT_NAME},'%')
</if>
<if
test=
"dto.USE_ORG_CODE != '' and dto.USE_ORG_CODE != null"
>
and USE_ORG_CODE like concat('%', #{dto.USE_ORG_CODE},'%')
</if>
<if
test=
"dto.EQU_LIST_CODE != '' and dto.EQU_LIST_CODE != null"
>
and EQU_LIST_CODE = #{dto.EQU_LIST_CODE}
</if>
<if
test=
"dto.EQU_STATE != '' and dto.EQU_STATE != null"
>
and EQU_STATE = #{dto.EQU_STATE}
</if>
<if
test=
"dto.ORG_BRANCH_NAME != '' and dto.ORG_BRANCH_NAME != null"
>
and ORG_BRANCH_NAME = #{dto.ORG_BRANCH_NAME}
</if>
<if
test=
"dto.USE_PLACE != '' and dto.USE_PLACE != null"
>
and USE_PLACE = #{dto.USE_PLACE}
</if>
<if
test=
"dto.STATUS != '' and dto.STATUS != null"
>
and STATUS = #{dto.STATUS}
</if>
<if
test=
"dto.EQU_CATEGORY != '' and dto.EQU_CATEGORY != null"
>
and EQU_CATEGORY = #{dto.EQU_CATEGORY}
</if>
<if
test=
"dto.USE_UNIT_CREDIT_CODE != '' and dto.USE_UNIT_CREDIT_CODE != null"
>
and USE_UNIT_CREDIT_CODE like concat('%', #{dto.USE_UNIT_CREDIT_CODE},'%')
</if>
<if
test=
"dto.ORG_BRANCH_CODE != '' and dto.ORG_BRANCH_CODE != null"
>
and ORG_BRANCH_CODE like concat('%', #{dto.ORG_BRANCH_CODE},'%')
</if>
<if
test=
'dto.ids != null'
>
and SEQUENCE_NBR in
<foreach
collection=
"dto.ids"
item=
"id"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</if>
</where>
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/controller/EquipmentCategoryController.java
View file @
44201a83
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.ymt.api.service.IEquipmentCategoryService;
import
com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo
;
import
com.yeejoin.amos.boot.module.ymt.biz.service.impl.EquipmentCategoryServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.ImageUtils
;
import
com.yeejoin.amos.component.robot.BadRequest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -49,7 +51,7 @@ import java.util.stream.Collectors;
public
class
EquipmentCategoryController
extends
BaseController
{
@Autowired
EquipmentCategoryServiceImpl
equipmentCategoryServiceImpl
;
EquipmentCategoryServiceImpl
equipmentCategoryServiceImpl
;
@Autowired
IEquipmentCategoryService
equipmentCategoryService
;
...
...
@@ -84,7 +86,7 @@ public class EquipmentCategoryController extends BaseController {
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除装备分类"
,
notes
=
"根据sequenceNbr删除装备分类"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryServiceImpl
.
removeById
(
sequenceNbr
));
}
...
...
@@ -112,7 +114,7 @@ public class EquipmentCategoryController extends BaseController {
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"装备分类分页查询"
,
notes
=
"装备分类分页查询"
)
public
ResponseModel
<
Page
<
EquipmentCategoryDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
EquipmentCategoryDto
>
page
=
new
Page
<
EquipmentCategoryDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
...
...
@@ -174,17 +176,17 @@ public class EquipmentCategoryController extends BaseController {
return
ResponseHelper
.
buildResponse
(
jsonArray
);
}
/**
* 设备八大类列表树
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备八大类列表树"
,
notes
=
"设备八大类列表树"
)
@GetMapping
(
value
=
"/equipTree"
)
public
ResponseModel
<
Object
>
equipTree
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryService
.
equipTree
(
type
));
}
/**
* 设备八大类列表树
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备八大类列表树"
,
notes
=
"设备八大类列表树"
)
@GetMapping
(
value
=
"/equipTree"
)
public
ResponseModel
<
Object
>
equipTree
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryService
.
equipTree
(
type
));
}
/**
* 设备认领总览
...
...
@@ -310,6 +312,11 @@ public class EquipmentCategoryController extends BaseController {
@GetMapping
(
value
=
"/exportData"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备信息导出"
,
notes
=
"设备信息导出"
)
public
void
exportData
(
HttpServletResponse
response
,
EquipExportDto
dto
)
{
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getUSE_PLACE
()))
{
String
address
=
dto
.
getUSE_PLACE
().
substring
(
1
,
dto
.
getUSE_PLACE
().
length
()
-
1
);
address
=
address
.
replace
(
", "
,
"/"
);
dto
.
setUSE_PLACE
(
address
);
}
List
<
EquipExportVo
>
equipExportData
=
equipmentCategoryServiceImpl
.
getEquipExportData
(
dto
);
ExcelUtil
.
createTemplate
(
response
,
"设备信息"
,
"设备信息"
,
equipExportData
,
EquipExportVo
.
class
,
null
,
false
);
}
...
...
@@ -334,18 +341,18 @@ public class EquipmentCategoryController extends BaseController {
/**
* 获取行政区划
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"getRegion"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取行政区划"
,
notes
=
"获取行政区划"
)
public
ResponseModel
<
Object
>
getRegion
(
@RequestParam
(
value
=
"level"
,
required
=
false
)
String
level
,
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
String
parentId
)
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryService
.
getRegion
(
level
,
parentId
));
}
/**
* 获取行政区划
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"getRegion"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取行政区划"
,
notes
=
"获取行政区划"
)
public
ResponseModel
<
Object
>
getRegion
(
@RequestParam
(
value
=
"level"
,
required
=
false
)
String
level
,
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
String
parentId
)
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryService
.
getRegion
(
level
,
parentId
));
}
/**
...
...
@@ -396,20 +403,36 @@ public class EquipmentCategoryController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/exportImageZip"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备监管码、电梯码批量导出压缩包"
,
notes
=
"设备监管码、电梯码批量导出压缩包"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
EquipExportDto
dto
,
@RequestParam
(
"type"
)
String
type
)
throws
IOException
{
public
void
exportImageZip
(
HttpServletResponse
response
,
EquipExportDto
dto
,
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
"pageNum"
)
Long
pageNum
,
@RequestParam
(
"size"
)
Long
size
)
throws
IOException
{
ImageSizeEnums
imageSizeEnums
=
ImageSizeEnums
.
getEnumByCode
(
type
);
//创建list 存放图片
List
<
File
>
fileList
=
new
ArrayList
<>();
List
<
EquipExportVo
>
equipExportData
=
equipmentCategoryServiceImpl
.
getEquipExportData
(
dto
);
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getUSE_PLACE
()))
{
String
address
=
dto
.
getUSE_PLACE
().
substring
(
1
,
dto
.
getUSE_PLACE
().
length
()
-
1
);
address
=
address
.
replace
(
", "
,
"/"
);
dto
.
setUSE_PLACE
(
address
);
}
List
<
EquipExportVo
>
equipExportData
=
equipmentCategoryServiceImpl
.
exportImageZip
(
dto
,
pageNum
,
size
);
List
<
EquipExportVo
>
unique
=
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
getSupervisoryCode
())).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
EquipExportVo:
:
getSupervisoryCode
))),
ArrayList:
:
new
)
);
List
<
EquipExportVo
>
collect
=
unique
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
getCode96333
())).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
EquipExportVo:
:
getCode96333
))),
ArrayList:
:
new
)
);
for
(
EquipExportVo
equipExportDatum
:
collect
)
{
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
)){
unique
=
unique
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
getCode96333
())).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
EquipExportVo:
:
getCode96333
))),
ArrayList:
:
new
)
);
}
if
(
ObjectUtils
.
isEmpty
(
unique
)){
File
zipFile
=
File
.
createTempFile
(
"设备码信息"
,
".zip"
);
File
nullFile
=
File
.
createTempFile
(
"当前导出数据为空+"
,
".txt"
);
fileList
.
add
(
nullFile
);
// 调用压缩方法
ImageUtils
.
zipFiles
(
fileList
,
zipFile
,
".txt"
);
ImageUtils
.
downloadResourceZip
(
"设备码信息.zip"
,
zipFile
.
getAbsolutePath
(),
response
);
zipFile
.
delete
();
}
for
(
EquipExportVo
equipExportDatum
:
unique
)
{
InputStream
bgImgFile
=
getClass
().
getClassLoader
().
getResourceAsStream
(
"temp/"
+
imageSizeEnums
.
getBgPath
());
if
(
"DT"
.
equals
(
type
)
&&
!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getCode96333
()))
{
File
QrCodeFile
=
File
.
createTempFile
(
equipExportDatum
.
getCode96333
()
+
"+"
,
".png"
);
...
...
@@ -422,10 +445,10 @@ public class EquipmentCategoryController extends BaseController {
}
bgImgFile
.
close
();
}
File
zipFile
=
File
.
createTempFile
(
"
imageZip
"
,
".zip"
);
File
zipFile
=
File
.
createTempFile
(
"
设备码信息
"
,
".zip"
);
// 调用压缩方法
ImageUtils
.
zipFiles
(
fileList
,
zipFile
);
ImageUtils
.
downloadResourceZip
(
"
imageZip
.zip"
,
zipFile
.
getAbsolutePath
(),
response
);
ImageUtils
.
zipFiles
(
fileList
,
zipFile
,
".png"
);
ImageUtils
.
downloadResourceZip
(
"
设备码信息
.zip"
,
zipFile
.
getAbsolutePath
(),
response
);
zipFile
.
delete
();
}
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/controller/LoginController.java
View file @
44201a83
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.component.feign.config.TokenOperation
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.ApplicationModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
* @author zjw
* @date 2020-03-30
*/
@RestController
@RequestMapping
(
value
=
"/
api/loginBytoken
"
)
@Api
(
tags
=
"
通过userName登录A
pi"
)
@RequestMapping
(
value
=
"/
weapp/api
"
)
@Api
(
tags
=
"
小程序登录a
pi"
)
public
class
LoginController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LoginController
.
class
);
// @Autowired
// private RedisTemplate<String, String> redisTemplate;
//
// @Value("${outSystem.user.password}")
// private String password;
//
// @Value("${amos.system.user.product}")
// private String product;
//
// @Value("${amos.system.user.app-key}")
// private String appKey;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@Value
(
"${outSystem.user.password}"
)
private
String
password
;
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
AmosRequestContext
amosRequestContext
;
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "通过userId登录", notes = "查询设备指标")
// @GetMapping(value = "/{userId}")
// synchronized public ReginParams getBindEquipment(@PathVariable("userId") String userId) throws Exception {
//
// if (ObjectUtils.isEmpty(userId)){
// throw new Exception("用户信息不存在");
// }
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
// .getRequestAttributes()).getRequest();
// String token = "wxxcxdl";
// ReginParams reginParams;
// reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userId, token)), ReginParams.class);
// if(reginParams == null){
// reginParams = getLogin(userId, token);
// }else{
// RequestContext.setProduct(product);
// if (!TokenOperation.refresh(reginParams.getToken())) {
// reginParams = getLogin(userId, token);
// }
// }
// return reginParams;
// }
//
// private ReginParams getLogin(String userId, String token) throws Exception{
// ReginParams reginParams = new ReginParams();
// IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
// dPasswordAuthModel.setLoginId(userId);
// dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
// RequestContext.setProduct(product);
// FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
// if (ObjectUtils.isEmpty(feignClientResult.getResult())){
// throw new Exception("缺失登录信息");
// }
// // 调用平台授权接口
// Map<String ,String > re = (Map<String, String>) feignClientResult.getResult();
// String amosToken = re.get("token");
//
// logger.info("应用授权开始======================================"+amosToken);
// RequestContext.setToken(amosToken);
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
//
// List<ApplicationModel> fd = Privilege.applicationClient.queryUserService().getResult();
//
// logger.info("应用授权结束======================================"+JSON.toJSONString(fd)+amosToken);
//
// AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult();
// CompanyModel companyModel = userModel.getCompanys().get(0);
//
// reginParams.setToken(amosToken);
// reginParams.setUserModel(userModel);
// redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams),28, TimeUnit.DAYS);
// return reginParams;
// }
//
//
// private String buildKey(String userId, String token) {
// return "region_" + userId + "_" + token;
// }
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"通过userId登录"
,
notes
=
"查询设备指标"
)
@GetMapping
(
value
=
"/{userId}"
)
synchronized
public
ReginParams
getBindEquipment
(
@PathVariable
(
"userId"
)
String
userId
)
throws
Exception
{
if
(
ObjectUtils
.
isEmpty
(
userId
)){
throw
new
Exception
(
"用户信息不存在"
);
}
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
token
=
"wxxcxdl"
;
ReginParams
reginParams
;
reginParams
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
userId
,
token
)),
ReginParams
.
class
);
if
(
reginParams
==
null
){
reginParams
=
getLogin
(
userId
,
token
);
}
else
{
RequestContext
.
setProduct
(
product
);
if
(!
TokenOperation
.
refresh
(
reginParams
.
getToken
()))
{
reginParams
=
getLogin
(
userId
,
token
);
}
}
return
reginParams
;
}
private
ReginParams
getLogin
(
String
userId
,
String
token
)
throws
Exception
{
ReginParams
reginParams
=
new
ReginParams
();
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
userId
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
RequestContext
.
setProduct
(
product
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
if
(
ObjectUtils
.
isEmpty
(
feignClientResult
.
getResult
())){
throw
new
Exception
(
"缺失登录信息"
);
}
// 调用平台授权接口
Map
<
String
,
String
>
re
=
(
Map
<
String
,
String
>)
feignClientResult
.
getResult
();
String
amosToken
=
re
.
get
(
"token"
);
logger
.
info
(
"应用授权开始======================================"
+
amosToken
);
RequestContext
.
setToken
(
amosToken
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
List
<
ApplicationModel
>
fd
=
Privilege
.
applicationClient
.
queryUserService
().
getResult
();
logger
.
info
(
"应用授权结束======================================"
+
JSON
.
toJSONString
(
fd
)+
amosToken
);
AgencyUserModel
userModel
=
(
AgencyUserModel
)
Privilege
.
agencyUserClient
.
getme
().
getResult
();
CompanyModel
companyModel
=
userModel
.
getCompanys
().
get
(
0
);
reginParams
.
setToken
(
amosToken
);
reginParams
.
setUserModel
(
userModel
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
reginParams
),
28
,
TimeUnit
.
DAYS
);
return
reginParams
;
}
private
String
buildKey
(
String
userId
,
String
token
)
{
return
"region_"
+
userId
+
"_"
+
token
;
@ApiOperation
(
value
=
"获取机器人登录token"
,
notes
=
"获取机器人登录token"
)
@GetMapping
(
value
=
"/acquireToken"
)
synchronized
public
String
getRobotLoginToken
()
{
return
amosRequestContext
.
getToken
();
}
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
44201a83
...
...
@@ -799,6 +799,34 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return
list
;
}
public
List
<
EquipExportVo
>
exportImageZip
(
EquipExportDto
dto
,
Long
pageNum
,
Long
size
)
{
ArrayList
<
EquipExportVo
>
list
=
new
ArrayList
<>();
List
<
JSONObject
>
objectList
=
getCompanyType
();
if
(!
ValidationUtil
.
isEmpty
(
dto
.
getEQU_STATE
()))
{
dto
.
setEQU_STATE
(
EquimentEnum
.
getCode
.
get
(
dto
.
getEQU_STATE
()).
toString
());
}
for
(
JSONObject
object
:
objectList
)
{
String
level
=
object
.
getString
(
"level"
);
String
orgCode
=
object
.
getString
(
"orgCode"
);
String
companyCode
=
object
.
getString
(
"companyCode"
);
if
(!
ValidationUtil
.
isEmpty
(
level
))
{
Page
<
EquipExportVo
>
equipExportVoPage
=
new
Page
<>(
pageNum
,
size
);
if
(
LEVEL
.
equals
(
level
))
{
//企业
dto
.
setUSE_UNIT_CREDIT_CODE
(
companyCode
);
}
else
{
//监管单位
dto
.
setORG_BRANCH_CODE
(
orgCode
);
}
Page
<
EquipExportVo
>
equipExportData
=
equipmentCategoryMapper
.
exportImageZip
(
equipExportVoPage
,
dto
);
if
(!
ObjectUtils
.
isEmpty
(
equipExportData
)
&&
!
ObjectUtils
.
isEmpty
(
equipExportData
.
getRecords
()))
{
list
.
addAll
(
equipExportData
.
getRecords
());
}
}
}
return
list
;
}
/**
* 设备字典,通过设备父类code,获得子类
*/
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/utils/ImageUtils.java
View file @
44201a83
...
...
@@ -169,7 +169,7 @@ public class ImageUtils {
OutputStream
out
=
null
;
InputStream
fileInputStream
=
null
;
try
{
response
.
reset
();
//
response.reset();
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"content-Type"
,
"application/zip"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
...
...
@@ -218,7 +218,7 @@ public class ImageUtils {
* @param srcFiles
* @param zipFile
*/
public
static
void
zipFiles
(
List
<
File
>
srcFiles
,
File
zipFile
)
{
public
static
void
zipFiles
(
List
<
File
>
srcFiles
,
File
zipFile
,
String
fileType
)
{
try
{
if
(
srcFiles
.
size
()
!=
0
)
{
// 判断压缩后的文件存在不,不存在则创建
...
...
@@ -255,7 +255,7 @@ public class ImageUtils {
for
(
File
srcFile
:
srcFiles
)
{
fileInputStream
=
new
FileInputStream
(
srcFile
);
// 实例化 ZipEntry 对象,源文件数组中的当前文件
zipEntry
=
new
ZipEntry
(
StringUtils
.
substringBefore
(
srcFile
.
getName
(),
"+"
)
+
".png"
);
zipEntry
=
new
ZipEntry
(
StringUtils
.
substringBefore
(
srcFile
.
getName
(),
"+"
)
+
fileType
);
zipOutputStream
.
putNextEntry
(
zipEntry
);
// 该变量记录每次真正读的字节个数
int
len
;
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/resources/application-dev3.properties
View file @
44201a83
...
...
@@ -154,9 +154,9 @@ tzs.cylinder.info.cron=0 0 1 * * ?
minio.url.path
=
http://172.16.10.230:9000/
## ɼǰ
regulatory_code_prefix
=
https://
nav.sspai.top
/tzs?code=
regulatory_code_prefix
=
https://
sxtzsb.sxsei.com:9435
/tzs?code=
outSystem.user.password
=
a1234560
amos.system.user.app-key
=
AMOS_STUDIO
amos.system.user.product
=
STUDIO_APP_WEB
\ No newline at end of file
#outSystem.user.password=a1234560
#amos.system.user.app-key=AMOS_STUDIO
#
amos.system.user.product
=
STUDIO_APP_WEB
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment