Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
e9f290b5
由
张雷
编写于
2024-11-11 15:28:19 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加初始化用户方法
1 个父辈
07dd7323
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
192 行增加
和
18 行删除
sk-base-common/pom.xml
sk-base-common/src/main/java/com/skua/modules/alarmtmp/mapper/xml/FactoryOffLineMapper.xml
sk-base-common/src/main/java/com/skua/tool/util/ChineseToPinyin.java
sk-module-alarm/src/main/java/com/skua/modules/quartz/RealTimeAlarmJob.java
sk-module-biz/src/main/java/com/skua/modules/material/mapper/xml/MaterialInformationMapper.xml
sk-module-datafill/src/main/java/com/skua/modules/custom/mapper/xml/FCustomReportDatasetMapper.xml
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportDatasetServiceImpl.java
sk-module-system/src/main/java/com/skua/config/ShiroConfig.java
sk-module-system/src/main/java/com/skua/modules/system/controller/LoginController.java
sk-module-system/src/main/java/com/skua/modules/system/controller/TestController.java
sk-module-system/src/main/java/com/skua/modules/system/service/ITestService.java
sk-module-system/src/main/java/com/skua/modules/system/service/impl/TestServiceImpl.java
sk-base-common/pom.xml
查看文件 @
e9f290b
...
...
@@ -17,8 +17,14 @@
<artifactId>
javassist
</artifactId>
<version>
3.21.0-GA
</version>
</dependency>
<!-- 汉字转拼音 -->
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
2.5.1
</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>
aliyun
</id>
...
...
@@ -37,5 +43,5 @@
</snapshots>
</repository>
</repositories>
</project>
\ No newline at end of file
</project>
...
...
sk-base-common/src/main/java/com/skua/modules/alarmtmp/mapper/xml/FactoryOffLineMapper.xml
查看文件 @
e9f290b
...
...
@@ -30,7 +30,7 @@
inner join sys_factory_device sfd on sfi.depart_id = sfd.depart_id
WHERE
1=1
and sd.depart_type in(3,4,5)
and sd.depart_type in(
1,
3,4,5)
<if
test=
"departId!=null and departId!='' "
>
and sfi.depart_id = #{departId}
</if>
...
...
sk-base-common/src/main/java/com/skua/tool/util/ChineseToPinyin.java
0 → 100644
查看文件 @
e9f290b
package
com
.
skua
.
tool
.
util
;
import
net.sourceforge.pinyin4j.PinyinHelper
;
import
net.sourceforge.pinyin4j.format.HanyuPinyinCaseType
;
import
net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat
;
import
net.sourceforge.pinyin4j.format.HanyuPinyinToneType
;
import
net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination
;
public
class
ChineseToPinyin
{
public
static
String
toPinyin
(
String
chinese
)
{
HanyuPinyinOutputFormat
format
=
new
HanyuPinyinOutputFormat
();
format
.
setCaseType
(
HanyuPinyinCaseType
.
LOWERCASE
);
format
.
setToneType
(
HanyuPinyinToneType
.
WITHOUT_TONE
);
StringBuilder
sb
=
new
StringBuilder
();
char
[]
chars
=
chinese
.
toCharArray
();
for
(
char
ch
:
chars
)
{
if
(
Character
.
isWhitespace
(
ch
))
{
continue
;
}
if
(
ch
>
128
)
{
try
{
String
[]
pinyinArray
=
PinyinHelper
.
toHanyuPinyinStringArray
(
ch
,
format
);
if
(
pinyinArray
!=
null
)
{
sb
.
append
(
pinyinArray
[
0
]);
}
else
{
sb
.
append
(
ch
);
}
}
catch
(
BadHanyuPinyinOutputFormatCombination
e
)
{
e
.
printStackTrace
();
}
}
else
{
sb
.
append
(
ch
);
}
}
return
sb
.
toString
();
}
public
static
void
main
(
String
[]
args
)
{
String
chinese
=
"中文"
;
String
pinyin
=
toPinyin
(
chinese
);
System
.
out
.
println
(
pinyin
);
// zhongwen 或者 zhong wen 取决于HanyuPinyinToneType设置
}
}
sk-module-alarm/src/main/java/com/skua/modules/quartz/RealTimeAlarmJob.java
查看文件 @
e9f290b
...
...
@@ -37,7 +37,6 @@ import com.google.common.collect.Sets;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.core.util.DateUtils
;
import
com.skua.core.util.chuanglan.HttpSenderMsg
;
import
com.skua.core.util.push.IPushService
;
import
com.skua.core.util.push.MessageEntity
;
import
com.skua.core.util.push.PushMessageFactory
;
...
...
@@ -581,7 +580,7 @@ public class RealTimeAlarmJob implements Job {
aliAlarm
.
setTime
(
date
);
aliAlarm
.
setPhone
(
phone1
);
//发送短信
HttpSenderMsg
.
sendMsg
(
prefix
+
date
+
"时"
+
departName
+
"采集数据"
+
content
+
suffix
,
phone1
);
//
HttpSenderMsg.sendMsg(prefix + date + "时" + departName + "采集数据" + content + suffix, phone1);
AliSmsUtil
.
sendLimitAlarmMsg
(
aliAlarm
);
//新版短息发送工具
log
.
info
(
"短信发送成功手机号:"
+
phone1
+
",内容:"
+
content
);
}
...
...
sk-module-biz/src/main/java/com/skua/modules/material/mapper/xml/MaterialInformationMapper.xml
查看文件 @
e9f290b
...
...
@@ -17,7 +17,7 @@
ifnull(a.cou,0) count,
b.item_text NAME
FROM
( SELECT item_text, item_value FROM sys_dict_item
( SELECT item_text, item_value
, sort_order
FROM sys_dict_item
WHERE dict_id = ( SELECT id FROM sys_dict WHERE dict_code = 'information_type' )
) b
left join
...
...
@@ -31,7 +31,7 @@
GROUP BY fac_informationtype
) a
ON a.fac_informationtype = b.item_value
ORDER BY b.sort_order
</select>
<select
id=
"flowStatistics"
resultType=
"java.util.Map"
>
SELECT
...
...
@@ -53,5 +53,5 @@
GROUP BY
b.create_time,b.handle_type
</select>
</mapper>
\ No newline at end of file
</mapper>
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/mapper/xml/FCustomReportDatasetMapper.xml
查看文件 @
e9f290b
...
...
@@ -370,7 +370,15 @@
ROUND( SUM( v.GFCZL ), 2 ) AS ybagfczl,
ROUND( SUM( v.WNL )*(1-AVG( v.WNHSL ))) AS jgnl,
ROUND( SUM( v.WFCSL ), 2 ) AS wxfwcsl,
ROUND( SUM( v.WFCZL ), 2 ) AS wxfwczl
ROUND( SUM( v.WFCZL ), 2 ) AS wxfwczl,
v2.jscodl,
v2.cscodl,
v2.jsadl,
v2.csadl,
v2.jstpl,
v2.cstpl,
v2.jstnl,
v2.cstnl
FROM
${dataViewName3} v
LEFT JOIN (
...
...
@@ -378,6 +386,14 @@
LEFT ( v.time, 7 ) AS time,
ROUND( SUM( v.CSL )/10000, 2 ) AS sjwscll,
ROUND( AVG( v.CSL )/10000, 2 ) AS rwscll,
ROUND( SUM( IFNULL(v.JSCOD*v.JSL,0)/1000000 ), 2 ) AS jscodl,
ROUND( SUM( IFNULL(v.CSCOD*v.CSL,0)/1000000 ), 2 ) AS cscodl,
ROUND( SUM( IFNULL(v.CSTN*v.CSL,0)/1000000 ), 2 ) AS cstnl,
ROUND( SUM( IFNULL(v.JSZD*v.JSL,0)/1000000 ), 2 ) AS jstnl,
ROUND( SUM( IFNULL(v.JSZL*v.JSL,0)/1000000 ), 2 ) AS jstpl,
ROUND( SUM( IFNULL(v.CSZL*v.CSL,0)/1000000 ), 2 ) AS cstpl,
ROUND( SUM( IFNULL(v.JSAD*v.JSL,0)/1000000 ), 2 ) AS jsadl,
ROUND( SUM( IFNULL(v.CSAD*v.CSL,0)/1000000 ), 2 ) AS csadl,
count( v.id ) AS scsj
FROM
${dataViewName2} v
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportDatasetServiceImpl.java
查看文件 @
e9f290b
...
...
@@ -235,7 +235,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
List
<
JnhbReportDetailsJs
>
jsList
=
new
ArrayList
<>();
List
<
JnhbReportDetailsHj
>
hjList
=
new
ArrayList
<>();
String
year
=
month
.
substring
(
0
,
4
);
String
dataViewName2
=
ReportViewUtil
.
buildViewLike
(
ReportConstant
.
view2119
,
"CSL,JSZL,CSZL,JSCOD,CSCOD,JSAD,CSAD,JSZD,CSTN"
,
departId
,
year
);
String
dataViewName2
=
ReportViewUtil
.
buildViewLike
(
ReportConstant
.
view2119
,
"CSL,JS
L,JS
ZL,CSZL,JSCOD,CSCOD,JSAD,CSAD,JSZD,CSTN"
,
departId
,
year
);
String
dataViewName3
=
ReportViewUtil
.
buildViewLike
(
ReportConstant
.
view3a24
,
""
,
departId
,
year
);
dyList
=
mapper
.
getDyList
(
dataViewName2
,
dataViewName3
,
departId
,
year
);
jsList
=
mapper
.
getJsList
(
dataViewName2
,
dataViewName3
,
departId
,
year
);
...
...
sk-module-system/src/main/java/com/skua/config/ShiroConfig.java
查看文件 @
e9f290b
...
...
@@ -56,7 +56,7 @@ public class ShiroConfig {
filterChainDefinitionMap
.
put
(
"/sys/user/register"
,
"anon"
);
//用户注册
filterChainDefinitionMap
.
put
(
"/sys/user/querySysUser"
,
"anon"
);
//根据手机号获取用户信息
filterChainDefinitionMap
.
put
(
"/sys/user/phoneVerification"
,
"anon"
);
//用户忘记密码验证手机号
filterChainDefinitionMap
.
put
(
"/sys/user/passwordChange"
,
"anon"
);
//用户更改密码
//
filterChainDefinitionMap.put("/sys/user/passwordChange", "anon");//用户更改密码
filterChainDefinitionMap
.
put
(
"/auth/2step-code"
,
"anon"
);
//登录验证码
filterChainDefinitionMap
.
put
(
"/sys/common/view/**"
,
"anon"
);
//图片预览不限制token
filterChainDefinitionMap
.
put
(
"/sys/common/download/**"
,
"anon"
);
//文件下载不限制token
...
...
@@ -87,6 +87,7 @@ public class ShiroConfig {
filterChainDefinitionMap
.
put
(
"/swagger**/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/webjars/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/v2/**"
,
"anon"
);
filterChainDefinitionMap
.
put
(
"/sys/init/**"
,
"anon"
);
//暂时放开表维护的shiro权限
filterChainDefinitionMap
.
put
(
"/v1/expert/expertInitConfig/**"
,
"anon"
);
...
...
sk-module-system/src/main/java/com/skua/modules/system/controller/LoginController.java
查看文件 @
e9f290b
...
...
@@ -38,7 +38,6 @@ import com.skua.core.util.ConvertUtils;
import
com.skua.core.util.DateUtils
;
import
com.skua.core.util.JwtUtil
;
import
com.skua.core.util.PasswordUtil
;
import
com.skua.core.util.chuanglan.HttpSenderMsg
;
import
com.skua.core.util.encryption.AesEncryptUtil
;
import
com.skua.core.util.encryption.EncryptedString
;
import
com.skua.modules.shiro.vo.DefContants
;
...
...
@@ -494,7 +493,6 @@ public class LoginController {
return
result
;
}
aliCode
.
setType
(
"register"
);
// b = HttpSenderMsg.sendMsg("注册验证码为:" + captcha, mobile);
}
else
{
//登录模式,校验用户有效性
SysUser
sysUser
=
sysUserService
.
getUserByPhone
(
mobile
);
...
...
@@ -509,11 +507,9 @@ public class LoginController {
if
(
CommonConstant
.
SMS_TPL_TYPE_0
.
equals
(
smsmode
))
{
//登录模板
aliCode
.
setType
(
"login"
);
// b = HttpSenderMsg.sendMsg("登录验证码为:" + captcha, mobile);
}
else
if
(
CommonConstant
.
SMS_TPL_TYPE_2
.
equals
(
smsmode
))
{
aliCode
.
setType
(
"update"
);
//忘记密码模板
// b = HttpSenderMsg.sendMsg("验证码为:" + captcha, mobile
);
aliCode
.
setType
(
"update"
);
}
}
b
=
AliSmsUtil
.
sendCodeMsg
(
aliCode
);
...
...
sk-module-system/src/main/java/com/skua/modules/system/controller/TestController.java
0 → 100644
查看文件 @
e9f290b
package
com
.
skua
.
modules
.
system
.
controller
;
import
com.skua.core.api.vo.Result
;
import
com.skua.modules.system.service.ITestService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
@Api
(
tags
=
"初始化用户"
)
@Slf4j
@RestController
@RequestMapping
(
"/sys/init"
)
public
class
TestController
{
@Resource
private
ITestService
testService
;
@GetMapping
(
"/user"
)
@ApiOperation
(
value
=
"初始化用户"
)
public
Result
<?>
batchInitUser
(){
Result
<?>
result
=
new
Result
<>();
boolean
ok
=
testService
.
batchInitUser
();
result
.
setSuccess
(
ok
);
return
result
;
}
}
sk-module-system/src/main/java/com/skua/modules/system/service/ITestService.java
0 → 100644
查看文件 @
e9f290b
package
com
.
skua
.
modules
.
system
.
service
;
public
interface
ITestService
{
boolean
batchInitUser
();
}
sk-module-system/src/main/java/com/skua/modules/system/service/impl/TestServiceImpl.java
0 → 100644
查看文件 @
e9f290b
package
com
.
skua
.
modules
.
system
.
service
.
impl
;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.core.util.DateUtils
;
import
com.skua.core.util.PasswordUtil
;
import
com.skua.modules.system.service.ITestService
;
import
com.skua.tool.util.ChineseToPinyin
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
@Service
@Slf4j
public
class
TestServiceImpl
implements
ITestService
{
@Override
public
boolean
batchInitUser
()
{
JdbcTemplate
jdbcTemplate
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
String
sql
=
"select * from sys_user_init "
;
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
sql
);
if
(
list
.
size
()
>
0
){
for
(
Map
<
String
,
Object
>
map
:
list
)
{
String
departId
=
map
.
get
(
"depart_id"
).
toString
();
String
realName
=
map
.
get
(
"user_name"
).
toString
();
String
userName
=
ChineseToPinyin
.
toPinyin
(
realName
);
String
phone
=
map
.
get
(
"user_phone"
).
toString
();
String
role
=
map
.
get
(
"roles"
).
toString
();
String
roles
=
""
;
if
(
map
.
get
(
"remark"
)!=
null
){
roles
=
map
.
get
(
"remark"
).
toString
();
role
=
role
+
","
+
roles
;
}
role
=
"8cc3cf58677fc68e42e9e46ae2462a17,"
+
role
;
String
userId
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
String
salt
=
ConvertUtils
.
randomGen
(
8
);
String
password
=
PasswordUtil
.
encrypt
(
userName
,
"zhongye123."
,
salt
);
String
insertUserSql
=
"INSERT INTO sys_user_bak "
+
"(id, username, realname, password, salt, phone, status, "
+
"del_flag, activiti_sync, create_by, create_time, is_system_user,user_type) "
+
"VALUES "
+
"('"
+
userId
+
"', '"
+
userName
+
"', '"
+
realName
+
"', '"
+
password
+
"', '"
+
salt
+
"', '"
+
phone
+
"', 1, "
+
"1, 1, 'admin', '"
+
DateUtils
.
getDate
(
"yyyy-MM-dd HH:mm:ss"
)+
"', '0', '2')"
;
jdbcTemplate
.
execute
(
insertUserSql
);
List
<
String
>
roleIdArray
=
Arrays
.
asList
(
role
.
split
(
","
));
for
(
String
roleId
:
roleIdArray
)
{
String
uuid
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
String
insertRoleSql
=
"INSERT INTO sys_user_role "
+
"(id, user_id, role_id) "
+
"VALUES "
+
"('"
+
uuid
+
"', '"
+
userId
+
"', '"
+
roleId
+
"')"
;
jdbcTemplate
.
execute
(
insertRoleSql
);
}
String
departUuid
=
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
String
insertDepartSql
=
"INSERT INTO sys_user_depart "
+
"(id, user_id, dep_id, dep_ids) "
+
"VALUES "
+
"('"
+
departUuid
+
"', '"
+
userId
+
"', '"
+
departId
+
"', '"
+
departId
+
"')"
;
jdbcTemplate
.
execute
(
insertDepartSql
);
}
}
return
false
;
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论