Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
klck
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
位宇华
klck
Commits
1189d67e
Commit
1189d67e
authored
9 months ago
by
Fuzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正
parent
09fcce65
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
53 deletions
+72
-53
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActHistoryDataMapper.java
...in/java/com/ruoyi/system/mapper/ActHistoryDataMapper.java
+10
-1
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActHistoryDataServiceImpl.java
.../ruoyi/system/service/impl/ActHistoryDataServiceImpl.java
+34
-45
ruoyi-supplies/src/main/resources/mapper/system/ActHistoryDataMapper.xml
...src/main/resources/mapper/system/ActHistoryDataMapper.xml
+28
-7
No files found.
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActHistoryDataMapper.java
View file @
1189d67e
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.domain.ActHistoryData
;
import
com.ruoyi.system.domain.ActHistoryDataDAO
;
import
com.ruoyi.system.dto.Pagination
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
/**
* @author haiwe
* @date 2024/7/24
*/
public
interface
ActHistoryDataMapper
{
void
insert
(
ActHistoryData
actHistoryData
);
void
insert
(
@Param
(
"act"
)
ActHistoryDataDAO
actHistoryData
);
ActHistoryData
getById
(
Integer
id
);
void
removeDuplicates
(
@Param
(
"type"
)
Long
type
,
@Param
(
"mId"
)
String
mineId
,
@Param
(
"date"
)
String
dateColumn
);
List
<
ActHistoryData
>
paginatedQueries
(
@Param
(
"mId"
)
String
mineId
,
@Param
(
"pag"
)
int
pag
,
@Param
(
"type"
)
String
type
,
@Param
(
"date"
)
String
wageMonth
,
@Param
(
"size"
)
int
pageSize
);
}
This diff is collapsed.
Click to expand it.
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActHistoryDataServiceImpl.java
View file @
1189d67e
package
com.ruoyi.system.service.impl
;
import
com.
alibaba.excel.EasyExcel
;
import
com.
alibaba.fastjson.JSON
;
import
com.
fasterxml.jackson.databind.JsonNode
;
import
com.
ruoyi.common.core.domain.entity.SysRole
;
import
com.
ruoyi.common.core.domain.entity.SysUser
;
import
com.
ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.system.domain.ActHistoryData
;
import
com.ruoyi.system.domain.ActHistoryDataDAO
;
import
com.ruoyi.system.dto.Pagination
;
import
com.ruoyi.system.mapper.ActHistoryDataMapper
;
import
com.ruoyi.system.service.IActHistoryDataService
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.sql.rowset.serial.SerialBlob
;
import
java.io.*
;
import
java.nio.file.Files
;
import
java.sql.Blob
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -33,44 +26,40 @@ import java.util.Map;
public
class
ActHistoryDataServiceImpl
implements
IActHistoryDataService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ActHistoryDataServiceImpl
.
class
);
private
final
ActHistoryDataMapper
actHistoryDataMapper
;
@Override
public
void
insert
(
MultipartFile
file
,
String
mineId
,
String
date
)
{
try
{
//处理历史数据
ActHistoryData
actHistoryData
=
new
ActHistoryData
();
InputStream
fileInputStream
=
file
.
getInputStream
();
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
bytesRead
;
while
((
bytesRead
=
fileInputStream
.
read
(
buffer
))
!=
-
1
)
{
baos
.
write
(
buffer
,
0
,
bytesRead
);
private
static
Map
<
String
,
String
>
roleIdMap
=
new
HashMap
<>();
static
{
roleIdMap
.
put
(
"10"
,
"010101"
);
roleIdMap
.
put
(
"11"
,
"011704"
);
roleIdMap
.
put
(
"12"
,
"011204"
);
roleIdMap
.
put
(
"13"
,
"011702"
);
roleIdMap
.
put
(
"14"
,
"011701"
);
roleIdMap
.
put
(
"15"
,
"011502"
);
roleIdMap
.
put
(
"16"
,
"010102"
);
}
byte
[]
fileData
=
baos
.
toByteArray
();
log
.
error
(
"------:{}"
,
fileData
);
actHistoryData
.
setMineId
(
mineId
);
actHistoryData
.
setContent
(
fileData
);
actHistoryData
.
setDateColumn
(
date
);
actHistoryData
.
setType
(
3L
);
actHistoryDataMapper
.
insert
(
actHistoryData
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
@Override
public
ActHistoryData
getById
(
Integer
id
)
{
return
actHistoryDataMapper
.
getById
(
id
);
}
@Override
public
void
insert
(
ActHistoryDataDAO
actHistoryDataDAO
)
{
actHistoryDataMapper
.
removeDuplicates
(
actHistoryDataDAO
.
getType
(),
actHistoryDataDAO
.
getMineId
(),
actHistoryDataDAO
.
getDateColumn
());
actHistoryDataMapper
.
insert
(
actHistoryDataDAO
);
}
@Override
public
ActHistoryData
getById
(
Integer
id
)
{
return
actHistoryDataMapper
.
getById
(
id
);
public
List
<
ActHistoryData
>
getData
(
Pagination
pagination
)
{
SysUser
user
=
SecurityUtils
.
getLoginUser
().
getUser
();
if
(
user
.
getRoles
().
size
()
!=
0
)
{
SysRole
sysRole
=
user
.
getRoles
().
get
(
0
);
String
roleSort
=
sysRole
.
getRoleSort
();
pagination
.
setMineId
(
roleIdMap
.
getOrDefault
(
roleSort
,
"0"
));
}
int
pag
=
(
Integer
.
parseInt
(
pagination
.
getPageNum
())
-
1
)
*
Integer
.
parseInt
(
pagination
.
getPageSize
());
return
actHistoryDataMapper
.
paginatedQueries
(
pagination
.
getMineId
(),
pag
,
pagination
.
getType
(),
pagination
.
getWageMonth
(),
Integer
.
parseInt
(
pagination
.
getPageSize
()));
}
...
...
This diff is collapsed.
Click to expand it.
ruoyi-supplies/src/main/resources/mapper/system/ActHistoryDataMapper.xml
View file @
1189d67e
...
...
@@ -5,22 +5,43 @@
<mapper
namespace=
"com.ruoyi.system.mapper.ActHistoryDataMapper"
>
<resultMap
type=
"com.ruoyi.system.domain.ActHistoryData"
id=
"ActHistoryDataResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"dateColumn"
column=
"date_column"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"mineId"
column=
"mine_id"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"dateColumn"
column=
"date_column"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"mineId"
column=
"mine_id"
/>
<result
property=
"content"
column=
"content"
/>
</resultMap>
<insert
id=
"insert"
>
insert into act_history_data
(date_column, type, mine_id, content)
VALUES (#{
dateColumn},#{type},#{mineId},#{
content})
VALUES (#{
act.dateColumn}, #{act.type}, #{act.mineId}, #{act.
content})
</insert>
<delete
id=
"removeDuplicates"
>
delete
from act_history_data
where type = #{type}
and date_column = #{date}
and mine_id = #{mId}
</delete>
<select
id=
"getById"
resultMap=
"ActHistoryDataResult"
>
select mine_id,
date_column,type,
content
select mine_id,
date_column, type,
content
from act_history_data
where id = #{id};
</select>
<select
id=
"paginatedQueries"
resultType=
"com.ruoyi.system.domain.ActHistoryData"
>
select `ry-vue`.act_history_data.id, date_column as dateColumn, type, mine_id mineId from act_history_data
where 1 = 1
<if
test=
"mId != null and mId != ''"
>
and mine_id = #{mId}
</if>
<if
test=
"type != null and type != ''"
>
and type = #{type}
</if>
<if
test=
"date != null and date != ''"
>
and date_column = #{date}
</if>
limit #{pag}, #{size}
</select>
</mapper>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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