Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
fb8d2656
Commit
fb8d2656
authored
Feb 02, 2023
by
YIyiyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.scsmile.cn/zxf/smart_gov_platform
parents
50a0bf8d
7b06f27e
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
402 additions
and
74 deletions
+402
-74
base-manager-ui/admin/src/pages/basicset/addmatter/components/question.vue
...dmin/src/pages/basicset/addmatter/components/question.vue
+1
-1
base-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppServiceImpl.java
...m/mortals/xhx/module/app/service/impl/AppServiceImpl.java
+16
-2
base-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppVersionServiceImpl.java
...ls/xhx/module/app/service/impl/AppVersionServiceImpl.java
+9
-1
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
...mortals/xhx/module/site/service/impl/SiteServiceImpl.java
+58
-38
base-manager/src/main/java/com/mortals/xhx/module/skin/model/vo/SkinFieldVo.java
...ava/com/mortals/xhx/module/skin/model/vo/SkinFieldVo.java
+4
-0
base-manager/src/main/java/com/mortals/xhx/module/skin/service/impl/SkinBaseServiceImpl.java
...als/xhx/module/skin/service/impl/SkinBaseServiceImpl.java
+11
-5
base-manager/src/main/java/com/mortals/xhx/module/window/service/impl/WindowBusinessServiceImpl.java
...module/window/service/impl/WindowBusinessServiceImpl.java
+28
-13
base-manager/src/main/java/com/mortals/xhx/module/window/service/impl/WindowMatterServiceImpl.java
...x/module/window/service/impl/WindowMatterServiceImpl.java
+27
-0
base-manager/src/main/java/com/mortals/xhx/module/window/service/impl/WindowServiceImpl.java
...als/xhx/module/window/service/impl/WindowServiceImpl.java
+12
-8
base-manager/src/main/java/com/mortals/xhx/module/window/web/WindowMatterController.java
...mortals/xhx/module/window/web/WindowMatterController.java
+12
-1
base-manager/src/main/java/com/mortals/xhx/module/workman/service/impl/WorkmanServiceImpl.java
...s/xhx/module/workman/service/impl/WorkmanServiceImpl.java
+10
-4
base-manager/src/main/java/com/mortals/xhx/module/workman/web/WorkmanController.java
...com/mortals/xhx/module/workman/web/WorkmanController.java
+9
-1
base-manager/src/main/resources/sqlmap/module/matter/MatterMapperExt.xml
...c/main/resources/sqlmap/module/matter/MatterMapperExt.xml
+6
-0
common-lib/src/main/java/com/mortals/xhx/utils/EncodeUtil.java
...n-lib/src/main/java/com/mortals/xhx/utils/EncodeUtil.java
+199
-0
No files found.
base-manager-ui/admin/src/pages/basicset/addmatter/components/question.vue
View file @
fb8d2656
...
...
@@ -185,7 +185,7 @@ export default {
this
.
form
.
id
&&
this
.
$delete
(
this
.
form
,
"
id
"
);
},
// 分页
handle
C
hange
(
num
)
{
handle
c
hange
(
num
)
{
this
.
current
=
num
;
this
.
getMatterquestionData
();
},
...
...
base-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppServiceImpl.java
View file @
fb8d2656
...
...
@@ -23,6 +23,7 @@ import com.mortals.xhx.module.app.model.*;
import
com.mortals.xhx.module.app.service.*
;
import
com.mortals.xhx.module.site.model.SiteEntity
;
import
com.mortals.xhx.module.site.service.SiteService
;
import
com.mortals.xhx.utils.EncodeUtil
;
import
com.mortals.xhx.version.model.VersionEntity
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -34,6 +35,7 @@ import com.mortals.xhx.module.app.dao.AppDao;
import
org.springframework.util.ObjectUtils
;
import
java.io.File
;
import
java.nio.charset.Charset
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -130,7 +132,13 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
FileUtil
.
del
(
disPath
);
}
//ZipUtils.unzip(new File(targetFilePath), disPath);
ZipUtil
.
unzip
(
targetFilePath
,
disPath
);
String
fileEncode
=
"UTF-8"
;
try
{
fileEncode
=
EncodeUtil
.
getEncode
(
targetFilePath
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
//更新
appEntity
.
setDistributeFilePath
(
disPath
);
appEntity
.
setDistribute
(
YesNoEnum
.
YES
.
getValue
());
...
...
@@ -158,7 +166,13 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
FileUtil
.
del
(
disPath
);
}
// ZipUtils.unzip(new File(targetFilePath), disPath);
ZipUtil
.
unzip
(
targetFilePath
,
disPath
);
String
fileEncode
=
"UTF-8"
;
try
{
fileEncode
=
EncodeUtil
.
getEncode
(
targetFilePath
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
return
Rest
.
ok
(
"基础应用部署成功!"
);
}
...
...
base-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppVersionServiceImpl.java
View file @
fb8d2656
...
...
@@ -14,6 +14,7 @@ import com.mortals.xhx.module.app.model.AppVersionQuery;
import
com.mortals.xhx.module.app.service.AppService
;
import
com.mortals.xhx.module.site.model.SiteEntity
;
import
com.mortals.xhx.module.site.service.SiteService
;
import
com.mortals.xhx.utils.EncodeUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
...
...
@@ -23,6 +24,7 @@ import com.mortals.xhx.module.app.model.AppVersionEntity;
import
com.mortals.xhx.module.app.service.AppVersionService
;
import
java.io.File
;
import
java.nio.charset.Charset
;
import
java.util.Date
;
...
...
@@ -71,8 +73,14 @@ public class AppVersionServiceImpl extends AbstractCRUDServiceImpl<AppVersionDao
if
(
FileUtil
.
isDirectory
(
disPath
))
{
FileUtil
.
del
(
disPath
);
}
String
fileEncode
=
"UTF-8"
;
try
{
fileEncode
=
EncodeUtil
.
getEncode
(
targetFilePath
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
// ZipUtils.unzip(new File(targetFilePath), disPath);
ZipUtil
.
unzip
(
targetFilePath
,
disPath
);
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
)
);
return
disPath
;
}
...
...
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
View file @
fb8d2656
...
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.module.site.service.impl;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
...
...
@@ -56,6 +57,7 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
PARAM_SERVER_HTTP_IMAGE_URL
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
PARAM_SERVER_HTTP_URL
;
/**
* SiteService
...
...
@@ -99,54 +101,61 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Autowired
private
IDeviceFeign
deviceFeign
;
private
volatile
Boolean
refresh
=
false
;
@Override
protected
void
updateBefore
(
SiteEntity
entity
,
Context
context
)
throws
AppException
{
//校验下前后名称是否一直 如果不一致 同步修改所以关联
SiteEntity
oldSite
=
this
.
get
(
entity
.
getId
(),
context
);
if
(!
oldSite
.
getSiteName
().
equals
(
entity
.
getSiteName
()))
{
if
(!
oldSite
.
getSiteName
().
equals
(
entity
.
getSiteName
()))
{
//todo
//更新关联站点名称
updateAssociateSiteName
(
oldSite
,
entity
,
context
);
//通知设备更新站点信息
DevicePdu
devicePdu
=
new
DevicePdu
();
devicePdu
.
setSiteId
(
entity
.
getId
());
deviceFeign
.
refreshMessage
(
devicePdu
);
updateAssociateSiteName
(
oldSite
,
entity
,
context
);
refresh
=
true
;
}
super
.
updateBefore
(
entity
,
context
);
}
private
void
updateAssociateSiteName
(
SiteEntity
oldSite
,
SiteEntity
newSite
,
Context
context
)
{
private
void
updateAssociateSiteName
(
SiteEntity
oldSite
,
SiteEntity
newSite
,
Context
context
)
{
//更新窗口站点名称
WindowEntity
windowEntity
=
new
WindowEntity
();
windowEntity
.
setSiteName
(
newSite
.
getSiteName
());
WindowEntity
condition
=
new
WindowEntity
();
condition
.
setSiteName
(
oldSite
.
getSiteName
());
windowService
.
updateBatch
(
windowEntity
,
condition
,
context
);
/* List<WindowEntity> windowEntityList = windowService.find(new WindowQuery().siteId(entity.getId()));
windowEntityList.forEach(item->item.setSiteName(entity.getSiteName()));
windowService.update(windowEntityList, context);
windowService
.
updateBatch
(
windowEntity
,
condition
,
context
);
//更新站点业务名称
List<SiteBusinessEntity> siteBusinessEntities = siteBusinessService.find(new SiteBusinessQuery().siteId(entity.getId()));
siteBusinessEntities.forEach(item->item.setSiteName(entity.getSiteName()));
siteBusinessService.update(siteBusinessEntities, context);
SiteBusinessEntity
siteBusinessEntity
=
new
SiteBusinessEntity
();
siteBusinessEntity
.
setSiteName
(
newSite
.
getSiteName
());
SiteBusinessEntity
siteBusinessCondition
=
new
SiteBusinessEntity
();
siteBusinessCondition
.
setSiteName
(
oldSite
.
getSiteName
());
siteBusinessService
.
updateBatch
(
siteBusinessEntity
,
siteBusinessCondition
,
context
);
//更新站点事项名称
SiteMatterEntity
siteMatterEntity
=
new
SiteMatterEntity
();
siteMatterEntity
.
setSiteName
(
newSite
.
getSiteName
());
SiteMatterEntity
siteMatterCondition
=
new
SiteMatterEntity
();
siteMatterCondition
.
setSiteName
(
oldSite
.
getSiteName
());
siteMatterService
.
updateBatch
(
siteMatterEntity
,
siteMatterCondition
,
context
);
//更新站点主题事项名称
List<SiteMatterEntity> siteMatterEntities = siteMatterService.find(new SiteMatterQuery().siteId(entity.getId()));
siteMatterEntities.forEach(item->item.setSiteName(entity.getSiteName()));
siteMatterService.update(siteMatterEntities, context);
//更新站点主题事项名称
List<SiteThemeMatterEntity> siteThemeMatterEntities = siteThemeMatterService.find(new SiteThemeMatterQuery().siteId(entity.getId()));
siteThemeMatterEntities.forEach(item->item.setSiteName(entity.getSiteName()));
siteThemeMatterService.update(siteThemeMatterEntities, context);
SiteThemeMatterEntity
siteThemeMatterEntity
=
new
SiteThemeMatterEntity
();
siteThemeMatterEntity
.
setSiteName
(
newSite
.
getSiteName
());
SiteThemeMatterEntity
siteThemeMatterCondition
=
new
SiteThemeMatterEntity
();
siteThemeMatterCondition
.
setSiteName
(
oldSite
.
getSiteName
());
siteThemeMatterService
.
updateBatch
(
siteThemeMatterEntity
,
siteThemeMatterCondition
,
context
);
//更新工作人员站点
List<WorkmanEntity> workmanEntities = workmanService.find(new WorkmanQuery().siteId(entity.getId()));
workmanEntities.forEach(item->item.setSiteName(entity.getSiteName()));
workmanService.update(workmanEntities, context);*/
WorkmanEntity
workmanEntity
=
new
WorkmanEntity
();
workmanEntity
.
setSiteName
(
newSite
.
getSiteName
());
WorkmanEntity
workmanEntityCondition
=
new
WorkmanEntity
();
workmanEntityCondition
.
setSiteName
(
oldSite
.
getSiteName
());
workmanService
.
updateBatch
(
workmanEntity
,
workmanEntityCondition
,
context
);
}
@Override
...
...
@@ -165,14 +174,18 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
protected
void
saveBefore
(
SiteEntity
entity
,
Context
context
)
throws
AppException
{
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
new
SiteQuery
().
areaCode
(
entity
.
getAreaCode
()));
entity
.
setSiteCode
(
entity
.
getAreaCode
()
+
Constant
.
SITE_SPLIT_MARK
+
StringUtils
.
lpad
(
siteEntities
.
size
()
+
1
,
Constant
.
SITE_CODE_NUM
));
super
.
saveBefore
(
entity
,
context
);
}
@Override
protected
void
saveAfter
(
SiteEntity
entity
,
Context
context
)
throws
AppException
{
//刷新站点树
//ThreadPool.getInstance().execute(new SyncTreeSiteThread(this,context));
Rest
<
String
>
rest
=
userFeign
.
synchSiteAuth
();
if
(
rest
.
getCode
().
equals
(
YesNoEnum
.
YES
.
getValue
()))
{
UserPdu
userPdu
=
new
UserPdu
();
...
...
@@ -181,14 +194,14 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
Rest
<
RespData
<
List
<
UserPdu
>>>
list
=
userFeign
.
list
(
userPdu
);
userService
.
updateUserList
(
list
.
getData
().
getData
());
}
//更新同步部门相关
deptService
.
syncDeptBySiteId
(
entity
,
context
);
super
.
saveAfter
(
entity
,
context
);
}
@Override
public
List
<
SiteTreeSelect
>
siteTree
(
Context
context
)
{
Map
<
String
,
AreaEntity
>
areaMap
=
new
HashMap
<>();
...
...
@@ -310,7 +323,14 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
Rest
<
RespData
<
List
<
UserPdu
>>>
list
=
userFeign
.
list
(
userPdu
);
userService
.
updateUserList
(
list
.
getData
().
getData
());
}
if
(
refresh
)
{
//通知设备更新站点信息
DevicePdu
devicePdu
=
new
DevicePdu
();
devicePdu
.
setSiteId
(
entity
.
getId
());
Rest
<
Void
>
rest1
=
deviceFeign
.
refreshMessage
(
devicePdu
);
log
.
info
(
"调用刷新结果:{}"
,
JSON
.
toJSONString
(
rest1
));
refresh
=
false
;
}
super
.
updateAfter
(
entity
,
context
);
}
...
...
@@ -388,15 +408,15 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
}
@Override
public
Rest
<
List
<
SiteAreaVo
>>
getAreaSitesBySite
(
SiteQuery
query
,
Context
context
)
{
List
<
SiteAreaVo
>
list
=
new
ArrayList
<>();
public
Rest
<
List
<
SiteAreaVo
>>
getAreaSitesBySite
(
SiteQuery
query
,
Context
context
)
{
List
<
SiteAreaVo
>
list
=
new
ArrayList
<>();
//获取当前节点的第一层子节点
if
(
ObjectUtils
.
isEmpty
(
query
.
getAreaName
()))
{
throw
new
AppException
(
"区域名称查询参数不能为空!"
);
if
(
ObjectUtils
.
isEmpty
(
query
.
getAreaName
()))
{
throw
new
AppException
(
"区域名称查询参数不能为空!"
);
}
//SiteEntity siteCache = this.getCache(query.getId().toString());
AreaEntity
areaEntity
=
areaService
.
selectOne
(
new
AreaQuery
().
name
(
query
.
getAreaName
()),
context
);
if
(
ObjectUtils
.
isEmpty
(
areaEntity
))
{
AreaEntity
areaEntity
=
areaService
.
selectOne
(
new
AreaQuery
().
name
(
query
.
getAreaName
()),
context
);
if
(
ObjectUtils
.
isEmpty
(
areaEntity
))
{
throw
new
AppException
(
"区域名称不存在!"
);
}
if
(
"False"
.
equalsIgnoreCase
(
areaEntity
.
getHaveSonArea
()))
{
...
...
@@ -412,7 +432,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
String
matchCode
=
child
.
getAreaCode
().
replaceAll
(
"(0)+$"
,
""
);
SiteQuery
siteQuery
=
new
SiteQuery
();
siteQuery
.
setAreaCode
(
matchCode
+
"%"
);
if
(!
ObjectUtils
.
isEmpty
(
query
.
getSiteName
()))
{
if
(!
ObjectUtils
.
isEmpty
(
query
.
getSiteName
()))
{
siteQuery
.
setSiteName
(
query
.
getSiteName
());
}
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
siteQuery
);
...
...
@@ -486,7 +506,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Override
public
void
changeUrlPath
(
SiteEntity
siteEntity
)
{
if
(!
ObjectUtils
.
isEmpty
(
siteEntity
)
&&
!
ObjectUtils
.
isEmpty
(
siteEntity
.
getLogoPath
()))
{
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_
IMAGE_
URL
,
"http://192.168.0.98:11091"
);
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11091"
);
String
fullPath
=
URLUtil
.
completeUrl
(
domain
,
siteEntity
.
getLogoPath
());
siteEntity
.
setLogoFullPath
(
fullPath
);
}
...
...
base-manager/src/main/java/com/mortals/xhx/module/skin/model/vo/SkinFieldVo.java
View file @
fb8d2656
...
...
@@ -19,4 +19,8 @@ public class SkinFieldVo extends BaseEntityLong {
/** 结束 皮肤id */
private
Long
skinIdEnd
;
//附件图片访问实际地址
private
String
fieldValueUrl
;
}
\ No newline at end of file
base-manager/src/main/java/com/mortals/xhx/module/skin/service/impl/SkinBaseServiceImpl.java
View file @
fb8d2656
...
...
@@ -11,6 +11,7 @@ import com.mortals.framework.model.PageInfo;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.FiletypeEnum
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.common.utils.FreeMarkerUtils
;
...
...
@@ -79,22 +80,27 @@ public class SkinBaseServiceImpl extends AbstractCRUDServiceImpl<SkinBaseDao, Sk
Map
<
String
,
String
>
imageResolutionMap
=
paramService
.
getParamBySecondOrganize
(
"SkinBase"
,
"imageResolution"
);
list
.
stream
().
forEach
(
item
->
{
List
<
SkinFieldEntity
>
skinFieldEntities
=
skinFieldService
.
find
(
new
SkinFieldQuery
().
skinId
(
item
.
getId
()));
String
domain
=
GlobalSysInfo
.
getParamValue
(
Constant
.
DOMAIN
,
"http://192.168.0.98:11071/"
);
skinFieldEntities
.
forEach
(
field
->
{
if
(
"2"
.
equals
(
field
.
getFieldType
()))
{
UrlBuilder
builder
=
UrlBuilder
.
ofHttp
(
domain
,
CharsetUtil
.
CHARSET_UTF_8
).
addPath
(
field
.
getFieldValue
());
field
.
setFieldValueUrl
(
builder
.
build
());
}
});
ProductEntity
productEntity
=
productService
.
get
(
item
.
getProductId
());
item
.
setProductCode
(
productEntity
==
null
?
""
:
productEntity
.
getProductCode
());
item
.
setImageResolutionValue
(
imageResolutionMap
.
get
(
entity
.
getImageResolution
()
==
null
?
"1"
:
entity
.
getImageResolution
()));
item
.
setSkinFieldList
(
skinFieldEntities
);
String
domain
=
GlobalSysInfo
.
getParamValue
(
Constant
.
DOMAIN
,
"http://192.168.0.98:11071/"
);
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPreviewImagePath
()))
{
UrlBuilder
builder
=
UrlBuilder
.
ofHttp
(
domain
,
CharsetUtil
.
CHARSET_UTF_8
).
addPath
(
item
.
getPreviewImagePath
());
item
.
setPreviewImagePath
(
builder
.
build
());
log
.
info
(
"cssUrl:"
+
URLDecoder
.
decode
(
item
.
getPreviewImagePath
(),
CharsetUtil
.
CHARSET_UTF_8
));
//log.info("cssUrl:" + URLDecoder.decode(item.getPreviewImagePath(), CharsetUtil.CHARSET_UTF_8));
}
if
(!
ObjectUtils
.
isEmpty
(
item
.
getCssFilePath
()))
{
UrlBuilder
builder
=
UrlBuilder
.
ofHttp
(
domain
,
CharsetUtil
.
CHARSET_UTF_8
).
addPath
(
item
.
getCssFilePath
());
item
.
setCssFilePath
(
builder
.
build
());
log
.
info
(
"cssUrl:"
+
URLDecoder
.
decode
(
item
.
getCssFilePath
(),
CharsetUtil
.
CHARSET_UTF_8
));
//log.info("cssUrl:" + URLDecoder.decode(item.getCssFilePath(), CharsetUtil.CHARSET_UTF_8));
}
});
super
.
findAfter
(
entity
,
pageInfo
,
context
,
list
);
...
...
base-manager/src/main/java/com/mortals/xhx/module/window/service/impl/WindowBusinessServiceImpl.java
View file @
fb8d2656
package
com.mortals.xhx.module.window.service.impl
;
import
cn.hutool.core.collection.ListUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
...
...
@@ -34,12 +35,12 @@ import static com.mortals.framework.util.HttpUtil.HEADER_CONTENT_TYPE;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
PARAM_SERVER_PHP_HTTP_URL
;
/**
* WindowBusinessService
* 窗口业务 service实现
*
* @author zxfei
* @date 2022-01-12
*/
* WindowBusinessService
* 窗口业务 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service
(
"windowBusinessService"
)
@Slf4j
public
class
WindowBusinessServiceImpl
extends
AbstractCRUDServiceImpl
<
WindowBusinessDao
,
WindowBusinessEntity
,
Long
>
implements
WindowBusinessService
{
...
...
@@ -50,11 +51,11 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
protected
void
findAfter
(
WindowBusinessEntity
entity
,
PageInfo
pageInfo
,
Context
context
,
List
<
WindowBusinessEntity
>
list
)
throws
AppException
{
Map
<
Long
,
WindowEntity
>
collect
=
windowService
.
findToMap
(
new
WindowQuery
(),
context
);
Iterator
iterator
=
list
.
iterator
();
while
(
iterator
.
hasNext
()){
while
(
iterator
.
hasNext
())
{
WindowBusinessEntity
item
=
(
WindowBusinessEntity
)
iterator
.
next
();
if
(!
ObjectUtils
.
isEmpty
(
item
.
getWindowId
())&&!
ObjectUtils
.
isEmpty
(
collect
.
get
(
item
.
getWindowId
())))
{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getWindowId
())
&&
!
ObjectUtils
.
isEmpty
(
collect
.
get
(
item
.
getWindowId
())))
{
item
.
setFromnum
(
collect
.
get
(
item
.
getWindowId
()).
getFromnum
());
}
else
{
}
else
{
iterator
.
remove
();
}
}
...
...
@@ -62,6 +63,21 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
}
/**
* @param ids
* @param context
* @throws AppException
*/
@Override
protected
void
removeBefore
(
Long
[]
ids
,
Context
context
)
throws
AppException
{
Arrays
.
asList
(
ids
).
forEach
(
id
->
{
WindowBusinessEntity
windowBusinessEntity
=
this
.
get
(
id
,
context
);
pushChangeMsg
(
windowBusinessEntity
);
});
super
.
removeBefore
(
ids
,
context
);
}
/**
* @param entity
* @param context
...
...
@@ -75,7 +91,6 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
}
/**
* @param entity
* @param context
...
...
@@ -87,12 +102,12 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
super
.
updateAfter
(
entity
,
context
);
}
private
void
pushChangeMsg
(
WindowBusinessEntity
entity
)
{
private
void
pushChangeMsg
(
WindowBusinessEntity
entity
)
{
String
phpUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_HTTP_URL
,
"http://172.15.28.116:8090"
);
phpUrl
+=
"/api/window/winNameChange"
;
phpUrl
+=
"/api/window/winNameChange"
;
HashMap
<
String
,
Object
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"windowid"
,
entity
.
getWindowId
());
paramsMap
.
put
(
"typeinfo"
,
1
);
paramsMap
.
put
(
"typeinfo"
,
1
);
String
resp
=
null
;
try
{
Map
<
String
,
String
>
header
=
new
HashMap
<>();
...
...
base-manager/src/main/java/com/mortals/xhx/module/window/service/impl/WindowMatterServiceImpl.java
View file @
fb8d2656
...
...
@@ -13,6 +13,7 @@ import com.mortals.xhx.module.window.dao.WindowMatterDao;
import
com.mortals.xhx.module.window.model.WindowMatterEntity
;
import
com.mortals.xhx.module.window.service.WindowMatterService
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -40,6 +41,32 @@ public class WindowMatterServiceImpl extends AbstractCRUDServiceImpl<WindowMatte
super
.
saveAfter
(
entity
,
context
);
}
/**
* @param id
* @param context
* @throws AppException
*/
@Override
protected
void
removeBefore
(
Long
id
,
Context
context
)
throws
AppException
{
WindowMatterEntity
windowMatterEntity
=
this
.
get
(
id
,
context
);
pushChangeMsg
(
windowMatterEntity
);
super
.
removeBefore
(
id
,
context
);
}
/**
* @param ids
* @param context
* @throws AppException
*/
@Override
protected
void
removeBefore
(
Long
[]
ids
,
Context
context
)
throws
AppException
{
Arrays
.
asList
(
ids
).
forEach
(
id
->{
WindowMatterEntity
windowMatterEntity
=
this
.
get
(
id
,
context
);
pushChangeMsg
(
windowMatterEntity
);
});
super
.
removeBefore
(
ids
,
context
);
}
/**
* @param entity
* @param context
...
...
base-manager/src/main/java/com/mortals/xhx/module/window/service/impl/WindowServiceImpl.java
View file @
fb8d2656
...
...
@@ -142,6 +142,10 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
List
<
WindowMatterEntity
>
windowMatterEntities
=
windowMatterService
.
find
(
windowMatterQuery
);
windowMatterService
.
removeList
(
windowMatterEntities
,
context
);
}
Arrays
.
asList
(
ids
).
forEach
(
id
->
{
pushChangeMsg
(
id
);
});
super
.
removeAfter
(
ids
,
context
,
result
);
}
...
...
@@ -154,7 +158,7 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
@Override
protected
void
updateAfter
(
WindowEntity
entity
,
Context
context
)
throws
AppException
{
super
.
updateAfter
(
entity
,
context
);
pushChangeMsg
(
entity
);
pushChangeMsg
(
entity
.
getId
()
);
}
/**
...
...
@@ -165,18 +169,18 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
@Override
protected
void
saveAfter
(
WindowEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveAfter
(
entity
,
context
);
pushChangeMsg
(
entity
);
pushChangeMsg
(
entity
.
getId
()
);
}
private
void
pushChangeMsg
(
WindowEntity
entity
)
{
log
.
info
(
"pushChangeMsg:{}"
,
JSON
.
toJSONString
(
entity
));
private
void
pushChangeMsg
(
Long
windowId
)
{
log
.
info
(
"pushChangeMsg:{}"
,
JSON
.
toJSONString
(
windowId
));
String
phpUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_HTTP_URL
,
"http://172.15.28.116:8090"
);
phpUrl
+=
"/api/window/winNameChange"
;
phpUrl
+=
"/api/window/winNameChange"
;
HashMap
<
String
,
Object
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"windowid"
,
entity
.
getId
()
);
paramsMap
.
put
(
"typeinfo"
,
1
);
paramsMap
.
put
(
"windowid"
,
windowId
);
paramsMap
.
put
(
"typeinfo"
,
1
);
phpUrl
+=
"/api/window/winNameChange"
;
phpUrl
+=
"/api/window/winNameChange"
;
String
resp
=
null
;
try
{
Map
<
String
,
String
>
header
=
new
HashMap
<>();
...
...
base-manager/src/main/java/com/mortals/xhx/module/window/web/WindowMatterController.java
View file @
fb8d2656
...
...
@@ -66,7 +66,7 @@ public class WindowMatterController extends BaseCRUDJsonBodyMappingController<Wi
*/
@Override
protected
int
saveAfter
(
WindowMatterEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
String
phpUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_HTTP_URL
,
"http://1
0.12.185.213
:8090"
);
String
phpUrl
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_PHP_HTTP_URL
,
"http://1
72.15.28.116
:8090"
);
HashMap
<
String
,
Object
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"windowid"
,
entity
.
getWindowId
());
String
resp
=
null
;
...
...
@@ -81,4 +81,15 @@ public class WindowMatterController extends BaseCRUDJsonBodyMappingController<Wi
}
return
super
.
saveAfter
(
entity
,
model
,
context
);
}
/**
* @param ids
* @param context
* @throws AppException
*/
@Override
protected
void
deleteBefore
(
Long
[]
ids
,
Context
context
)
throws
AppException
{
super
.
deleteBefore
(
ids
,
context
);
}
}
\ No newline at end of file
base-manager/src/main/java/com/mortals/xhx/module/workman/service/impl/WorkmanServiceImpl.java
View file @
fb8d2656
...
...
@@ -15,6 +15,7 @@ import com.mortals.xhx.module.workman.dao.WorkmanDao;
import
com.mortals.xhx.module.workman.model.WorkmanEntity
;
import
com.mortals.xhx.module.workman.model.WorkmanQuery
;
import
com.mortals.xhx.module.workman.service.WorkmanService
;
import
com.mortals.xhx.utils.EncodeUtil
;
import
lombok.Getter
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.poi.ss.formula.functions.T
;
...
...
@@ -53,7 +54,6 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
@Override
protected
void
saveBefore
(
WorkmanEntity
entity
,
Context
context
)
throws
AppException
{
if
(
StringUtils
.
isNull
(
entity
.
getLoginName
()))
{
throw
new
AppException
(
"账号不能为空!"
);
}
...
...
@@ -61,8 +61,8 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
if
(
StringUtils
.
isNull
(
entity
.
getLoginPwd
()))
{
throw
new
AppException
(
"密码不能为空!"
);
}
List
<
WorkmanEntity
>
list
=
this
.
find
(
new
WorkmanQuery
().
loginName
(
entity
.
getLoginName
())
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)
)
{
int
count
=
this
.
count
(
new
WorkmanQuery
().
loginName
(
entity
.
getLoginName
()),
context
);
if
(
count
>
0
)
{
throw
new
AppException
(
"账号已存在!"
);
}
...
...
@@ -152,7 +152,13 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
throw
new
AppException
(
"文件不存在!"
);
}
//解压图片
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
"GBK"
));
String
fileEncode
=
"UTF-8"
;
try
{
fileEncode
=
EncodeUtil
.
getEncode
(
targetFilePath
,
true
);
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
ZipUtil
.
unzip
(
targetFilePath
,
disPath
,
Charset
.
forName
(
fileEncode
));
//读取目录下的所有图片
File
[]
files
=
FileUtil
.
ls
(
disPath
);
for
(
File
file
:
files
)
{
...
...
base-manager/src/main/java/com/mortals/xhx/module/workman/web/WorkmanController.java
View file @
fb8d2656
package
com.mortals.xhx.module.workman.web
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.extra.pinyin.PinyinUtil
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -187,7 +188,8 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
workmanEntity
.
setLoginName
(
loginName
);
}
if
(
ObjectUtils
.
isEmpty
(
workmanEntity
.
getLoginPwd
()))
{
log
.
info
(
"loginPwd:"
+
workmanEntity
.
getLoginPwd
());
if
(
ObjectUtils
.
isEmpty
(
workmanEntity
.
getLoginPwd
())||
""
.
equals
(
workmanEntity
.
getLoginPwd
().
trim
()))
{
workmanEntity
.
setLoginPwd
(
"123"
);
}
...
...
@@ -222,6 +224,12 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
StrUtil
.
cleanBlank
(
PinyinUtil
.
getPinyin
(
"张 三"
,
""
)));
//
// System.out.println(Base64.encode(new JSONObject().toJSONString()));
// System.out.println( com.mortals.framework.util.Base64.encode(new JSONObject().toJSONString().getBytes()));
//
//
System
.
out
.
println
(
Base64
.
encode
(
"[]"
));
}
...
...
base-manager/src/main/resources/sqlmap/module/matter/MatterMapperExt.xml
View file @
fb8d2656
...
...
@@ -26,6 +26,9 @@
<if
test=
"condition.matterName != null and condition.matterName != ''"
>
and a.matterName like #{condition.matterName}
</if>
<if
test=
"condition.source!=null and condition.source!=''"
>
and a.source = #{condition.source,jdbcType=VARCHAR}
</if>
</trim>
</trim>
</select>
...
...
@@ -55,6 +58,9 @@
<if
test=
"condition.matterName != null and condition.matterName != ''"
>
and a.matterName like #{condition.matterName}
</if>
<if
test=
"condition.source!=null and condition.source!=''"
>
and a.source = #{condition.source,jdbcType=VARCHAR}
</if>
</trim>
</trim>
</select>
...
...
common-lib/src/main/java/com/mortals/xhx/utils/EncodeUtil.java
0 → 100644
View file @
fb8d2656
package
com.mortals.xhx.utils
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.io.Writer
;
import
java.util.BitSet
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author 自动识别文件编码格式
*/
public
class
EncodeUtil
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
EncodeUtil
.
class
);
private
static
int
BYTE_SIZE
=
8
;
public
static
String
CODE_UTF8
=
"UTF-8"
;
public
static
String
CODE_UTF8_BOM
=
"UTF-8_BOM"
;
public
static
String
CODE_GBK
=
"GBK"
;
/**
* 通过文件全名称获取编码集名称
*
* @param fullFileName
* @param ignoreBom
* @return
* @throws Exception
*/
public
static
String
getEncode
(
String
fullFileName
,
boolean
ignoreBom
)
throws
Exception
{
logger
.
debug
(
"fullFileName ; {}"
,
fullFileName
);
BufferedInputStream
bis
=
new
BufferedInputStream
(
new
FileInputStream
(
fullFileName
));
return
getEncode
(
bis
,
ignoreBom
);
}
/**
* 通过文件缓存流获取编码集名称,文件流必须为未曾
*
* @param bis
* @param ignoreBom 是否忽略utf-8 bom
* @return
* @throws Exception
*/
public
static
String
getEncode
(
BufferedInputStream
bis
,
boolean
ignoreBom
)
throws
Exception
{
bis
.
mark
(
0
);
String
encodeType
=
"未识别"
;
byte
[]
head
=
new
byte
[
3
];
bis
.
read
(
head
);
if
(
head
[
0
]
==
-
1
&&
head
[
1
]
==
-
2
)
{
encodeType
=
"UTF-16"
;
}
else
if
(
head
[
0
]
==
-
2
&&
head
[
1
]
==
-
1
)
{
encodeType
=
"Unicode"
;
}
else
if
(
head
[
0
]
==
-
17
&&
head
[
1
]
==
-
69
&&
head
[
2
]
==
-
65
)
{
//带BOM
if
(
ignoreBom
)
{
encodeType
=
CODE_UTF8
;
}
else
{
encodeType
=
CODE_UTF8_BOM
;
}
}
else
if
(
"Unicode"
.
equals
(
encodeType
))
{
encodeType
=
"UTF-16"
;
}
else
if
(
isUTF8
(
bis
))
{
encodeType
=
CODE_UTF8
;
}
else
{
encodeType
=
CODE_GBK
;
}
logger
.
info
(
"result encode type : "
+
encodeType
);
return
encodeType
;
}
/**
* 是否是无BOM的UTF8格式,不判断常规场景,只区分无BOM UTF8和GBK
*
* @param bis
* @return
*/
private
static
boolean
isUTF8
(
BufferedInputStream
bis
)
throws
Exception
{
bis
.
reset
();
//读取第一个字节
int
code
=
bis
.
read
();
do
{
BitSet
bitSet
=
convert2BitSet
(
code
);
//判断是否为单字节
if
(
bitSet
.
get
(
0
))
{
//多字节时,再读取N个字节
if
(!
checkMultiByte
(
bis
,
bitSet
))
{
//未检测通过,直接返回
return
false
;
}
}
else
{
//单字节时什么都不用做,再次读取字节
}
code
=
bis
.
read
();
}
while
(
code
!=
-
1
);
return
true
;
}
/**
* 检测多字节,判断是否为utf8,已经读取了一个字节
*
* @param bis
* @param bitSet
* @return
*/
private
static
boolean
checkMultiByte
(
BufferedInputStream
bis
,
BitSet
bitSet
)
throws
Exception
{
int
count
=
getCountOfSequential
(
bitSet
);
byte
[]
bytes
=
new
byte
[
count
-
1
];
//已经读取了一个字节,不能再读取
bis
.
read
(
bytes
);
for
(
byte
b
:
bytes
)
{
if
(!
checkUtf8Byte
(
b
))
{
return
false
;
}
}
return
true
;
}
/**
* 检测单字节,判断是否为utf8
*
* @param b
* @return
*/
private
static
boolean
checkUtf8Byte
(
byte
b
)
throws
Exception
{
BitSet
bitSet
=
convert2BitSet
(
b
);
return
bitSet
.
get
(
0
)
&&
!
bitSet
.
get
(
1
);
}
/**
* 检测bitSet中从开始有多少个连续的1
*
* @param bitSet
* @return
*/
private
static
int
getCountOfSequential
(
BitSet
bitSet
)
{
int
count
=
0
;
for
(
int
i
=
0
;
i
<
BYTE_SIZE
;
i
++)
{
if
(
bitSet
.
get
(
i
))
{
count
++;
}
else
{
break
;
}
}
return
count
;
}
/**
* 将整形转为BitSet
*
* @param code
* @return
*/
private
static
BitSet
convert2BitSet
(
int
code
)
{
BitSet
bitSet
=
new
BitSet
(
BYTE_SIZE
);
for
(
int
i
=
0
;
i
<
BYTE_SIZE
;
i
++)
{
int
tmp3
=
code
>>
(
BYTE_SIZE
-
i
-
1
);
int
tmp2
=
0x1
&
tmp3
;
if
(
tmp2
==
1
)
{
bitSet
.
set
(
i
);
}
}
return
bitSet
;
}
/**
* 将一指定编码的文件转换为另一编码的文件
*
* @param oldFullFileName
* @param oldCharsetName
* @param newFullFileName
* @param newCharsetName
*/
public
static
void
convert
(
String
oldFullFileName
,
String
oldCharsetName
,
String
newFullFileName
,
String
newCharsetName
)
throws
Exception
{
logger
.
info
(
"the old file name is : {}, The oldCharsetName is : {}"
,
oldFullFileName
,
oldCharsetName
);
logger
.
info
(
"the new file name is : {}, The newCharsetName is : {}"
,
newFullFileName
,
newCharsetName
);
StringBuffer
content
=
new
StringBuffer
();
BufferedReader
bin
=
new
BufferedReader
(
new
InputStreamReader
(
new
FileInputStream
(
oldFullFileName
),
oldCharsetName
));
String
line
;
while
((
line
=
bin
.
readLine
())
!=
null
)
{
content
.
append
(
line
);
content
.
append
(
System
.
getProperty
(
"line.separator"
));
}
newFullFileName
=
newFullFileName
.
replace
(
"\\"
,
"/"
);
File
dir
=
new
File
(
newFullFileName
.
substring
(
0
,
newFullFileName
.
lastIndexOf
(
"/"
)));
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
}
Writer
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
newFullFileName
),
newCharsetName
);
out
.
write
(
content
.
toString
());
}
}
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