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
54d1749b
Commit
54d1749b
authored
Jul 08, 2024
by
刘_震
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据编码找到对应的一级,二级分类名称的后端代码优化
parent
a4fb04dd
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
236 additions
and
26 deletions
+236
-26
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesMaterialController.java
...uoyi/system/controller/ActSuppliesMaterialController.java
+29
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/domain/ActSupplies.java
...es/src/main/java/com/ruoyi/system/domain/ActSupplies.java
+10
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/domain/ActSuppliesMaterialInfo.java
...java/com/ruoyi/system/domain/ActSuppliesMaterialInfo.java
+46
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesMaterialMapper.java
...va/com/ruoyi/system/mapper/ActSuppliesMaterialMapper.java
+11
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/service/ActSuppliesMaterialService.java
.../com/ruoyi/system/service/ActSuppliesMaterialService.java
+12
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesMaterialServiceImpl.java
...i/system/service/impl/ActSuppliesMaterialServiceImpl.java
+24
-0
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesMaterialMapper.xml
...ain/resources/mapper/system/ActSuppliesMaterialMapper.xml
+23
-0
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/AsiccSuppliesMapper.java
...ain/java/com/ruoyi/system/mapper/AsiccSuppliesMapper.java
+8
-1
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/AsiccSuppliesServiceImpl.java
...m/ruoyi/system/service/impl/AsiccSuppliesServiceImpl.java
+33
-21
ruoyi-wages/src/main/resources/mapper/system/AsiccSuppliesMapper.xml
.../src/main/resources/mapper/system/AsiccSuppliesMapper.xml
+40
-4
No files found.
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesMaterialController.java
0 → 100644
View file @
54d1749b
package
com.ruoyi.system.controller
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.domain.ActSuppliesMaterialInfo
;
import
com.ruoyi.system.service.ActSuppliesMaterialService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author haiwe
* @date 2024/7/8
*/
@RestController
@RequestMapping
(
"/asmInfo"
)
@RequiredArgsConstructor
public
class
ActSuppliesMaterialController
{
private
final
ActSuppliesMaterialService
actSuppliesMaterialService
;
@PostMapping
(
"/save"
)
public
AjaxResult
saveInfo
(
@RequestBody
ActSuppliesMaterialInfo
actSuppliesMaterialInfo
){
actSuppliesMaterialService
.
save
(
actSuppliesMaterialInfo
);
return
AjaxResult
.
success
();
}
}
ruoyi-supplies/src/main/java/com/ruoyi/system/domain/ActSupplies.java
View file @
54d1749b
...
@@ -64,6 +64,8 @@ public class ActSupplies extends BaseEntity {
...
@@ -64,6 +64,8 @@ public class ActSupplies extends BaseEntity {
@Excel
(
name
=
"物料编码"
)
@Excel
(
name
=
"物料编码"
)
private
String
codes
;
private
String
codes
;
private
String
codeColumn
;
public
String
getCode
()
{
public
String
getCode
()
{
return
codes
;
return
codes
;
...
@@ -73,7 +75,13 @@ public class ActSupplies extends BaseEntity {
...
@@ -73,7 +75,13 @@ public class ActSupplies extends BaseEntity {
this
.
codes
=
code
;
this
.
codes
=
code
;
}
}
public
String
getCodeColumn
()
{
return
codeColumn
;
}
public
void
setCodeColumn
(
String
codeColumn
)
{
this
.
codeColumn
=
codeColumn
;
}
public
Long
getOrderNum
()
{
public
Long
getOrderNum
()
{
return
orderNum
;
return
orderNum
;
...
@@ -145,9 +153,11 @@ public class ActSupplies extends BaseEntity {
...
@@ -145,9 +153,11 @@ public class ActSupplies extends BaseEntity {
.
append
(
"id"
,
getId
())
.
append
(
"id"
,
getId
())
.
append
(
"oneLevel"
,
getOneLevel
())
.
append
(
"oneLevel"
,
getOneLevel
())
.
append
(
"twoLevel"
,
getTwoLevel
())
.
append
(
"twoLevel"
,
getTwoLevel
())
.
append
(
"level"
,
getLevel
())
.
append
(
"threeLevel"
,
getThreeLevel
())
.
append
(
"threeLevel"
,
getThreeLevel
())
.
append
(
"suppliesName"
,
getSuppliesName
())
.
append
(
"suppliesName"
,
getSuppliesName
())
.
append
(
"status"
,
getStatus
())
.
append
(
"status"
,
getStatus
())
.
append
(
"codeColumn"
,
getCodeColumn
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateBy"
,
getUpdateBy
())
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/domain/ActSuppliesMaterialInfo.java
0 → 100644
View file @
54d1749b
package
com.ruoyi.system.domain
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.apache.poi.hpsf.Decimal
;
/**
* @author haiwe
* @date 2024/7/8
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
ActSuppliesMaterialInfo
{
//id
private
String
id
;
//物料名称
private
String
nameColumn
;
//材料编码
private
String
codeColumn
;
//部门
private
String
departmentColumn
;
//数量
private
Long
numberColumn
;
//单价
private
Decimal
moneyColumn
;
//总额
private
Decimal
money
;
//计量单位
private
String
unit
;
//型号
private
String
model
;
//所属矿名
private
String
mineName
;
//费用来源
private
String
sourceColumn
;
//一级材料类别
private
String
oneLevel
;
//二级材料类别
private
String
twoLevel
;
//日期
private
String
dateColumn
;
}
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesMaterialMapper.java
0 → 100644
View file @
54d1749b
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.domain.ActSuppliesMaterialInfo
;
/**
* @author haiwe
* @date 2024/7/8
*/
public
interface
ActSuppliesMaterialMapper
{
void
save
(
ActSuppliesMaterialInfo
actSuppliesMaterialInfo
);
}
ruoyi-supplies/src/main/java/com/ruoyi/system/service/ActSuppliesMaterialService.java
0 → 100644
View file @
54d1749b
package
com.ruoyi.system.service
;
import
com.ruoyi.system.domain.ActSuppliesMaterialInfo
;
/**
* @author haiwe
* @date 2024/7/8
*/
public
interface
ActSuppliesMaterialService
{
void
save
(
ActSuppliesMaterialInfo
actSuppliesMaterialInfo
);
}
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesMaterialServiceImpl.java
0 → 100644
View file @
54d1749b
package
com.ruoyi.system.service.impl
;
import
com.ruoyi.system.domain.ActSuppliesMaterialInfo
;
import
com.ruoyi.system.mapper.ActSuppliesMaterialMapper
;
import
com.ruoyi.system.service.ActMaterialService
;
import
com.ruoyi.system.service.ActSuppliesMaterialService
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.RequestBody
;
/**
* @author haiwe
* @date 2024/7/8
*/
@Service
@RequiredArgsConstructor
public
class
ActSuppliesMaterialServiceImpl
implements
ActSuppliesMaterialService
{
private
final
ActSuppliesMaterialMapper
actSuppliesMaterialMapper
;
@Override
public
void
save
(
ActSuppliesMaterialInfo
actSuppliesMaterialInfo
)
{
actSuppliesMaterialMapper
.
save
(
actSuppliesMaterialInfo
);
}
}
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesMaterialMapper.xml
0 → 100644
View file @
54d1749b
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.system.mapper.ActSuppliesMaterialMapper"
>
<resultMap
type=
"com.ruoyi.system.domain.ActSuppliesMaterialInfo"
id=
"ActSuppliesResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"oneLevel"
column=
"one_level"
/>
<result
property=
"twoLevel"
column=
"two_level"
/>
<result
property=
"threeLevel"
column=
"three_level"
/>
<result
property=
"suppliesName"
column=
"supplies_name"
/>
<result
property=
"orderNum"
column=
"order_num"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<insert
id=
"save"
parameterType=
"com.ruoyi.system.domain.ActSuppliesMaterialInfo"
>
</insert>
</mapper>
\ No newline at end of file
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/AsiccSuppliesMapper.java
View file @
54d1749b
...
@@ -5,6 +5,7 @@ import com.ruoyi.system.domain.ActSuppliesImportCleaningAcc;
...
@@ -5,6 +5,7 @@ import com.ruoyi.system.domain.ActSuppliesImportCleaningAcc;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author haiwe
* @author haiwe
...
@@ -12,9 +13,15 @@ import java.util.List;
...
@@ -12,9 +13,15 @@ import java.util.List;
*/
*/
public
interface
AsiccSuppliesMapper
{
public
interface
AsiccSuppliesMapper
{
List
<
ActSupplies
ImportCleaningAcc
>
selectByCodeAndMineId
(
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"code"
)
String
code
);
List
<
ActSupplies
>
selectByCodeAndMineId
(
@Param
(
"mineId"
)
String
mineId
,
@Param
(
"codes"
)
Set
<
String
>
codes
);
ActSupplies
selectByCodes
(
@Param
(
"codes"
)
String
codes
);
ActSupplies
selectByCodes
(
@Param
(
"codes"
)
String
codes
);
ActSupplies
selectByOneLevel
(
@Param
(
"oneLevel"
)
String
oneLevel
);
ActSupplies
selectByOneLevel
(
@Param
(
"oneLevel"
)
String
oneLevel
);
List
<
ActSuppliesImportCleaningAcc
>
selectByMineId
(
@Param
(
"mineId"
)
String
mineId
);
void
selectByCode
(
@Param
(
"code"
)
String
code
);
List
<
ActSupplies
>
select
();
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/AsiccSuppliesServiceImpl.java
View file @
54d1749b
...
@@ -9,7 +9,9 @@ import com.ruoyi.system.service.AsiccSuppliesService;
...
@@ -9,7 +9,9 @@ import com.ruoyi.system.service.AsiccSuppliesService;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.xml.bind.SchemaOutputResolver
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* @author haiwe
* @author haiwe
...
@@ -23,34 +25,44 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
...
@@ -23,34 +25,44 @@ public class AsiccSuppliesServiceImpl implements AsiccSuppliesService {
@Override
@Override
public
Map
<
String
,
Object
>
getData
(
AsiccDAO
asiccDAO
)
{
public
Map
<
String
,
Object
>
getData
(
AsiccDAO
asiccDAO
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//建立一个map集合用于存储返回的数据
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
String
>
codesList
=
asiccDAO
.
getCodes
();
List
<
String
>
codesList
=
asiccDAO
.
getCodes
();
String
mineId
=
asiccDAO
.
getMineId
();
String
mineId
=
asiccDAO
.
getMineId
();
for
(
String
code
:
codesList
)
{
List
<
ActSuppliesImportCleaningAcc
>
list
=
asiccSuppliesMapper
.
selectByMineId
(
mineId
);
// 将 list 转换为一个 code 的 Set 集合以加速查找
Set
<
String
>
validCodes
=
list
.
stream
()
.
map
(
ActSuppliesImportCleaningAcc:
:
getCodeColumn
)
.
collect
(
Collectors
.
toSet
());
// 使用 Stream API 过滤 codesList 中的有效 code
Set
<
String
>
filteredCodes
=
codesList
.
stream
()
.
filter
(
validCodes:
:
contains
)
.
collect
(
Collectors
.
toSet
());
List
<
ActSupplies
>
suppliesList
=
asiccSuppliesMapper
.
select
();
List
<
ActSupplies
>
accInfos
=
asiccSuppliesMapper
.
selectByCodeAndMineId
(
mineId
,
filteredCodes
);
for
(
ActSupplies
accInfo
:
accInfos
)
{
List
<
String
>
voList
=
new
ArrayList
<>();
List
<
String
>
voList
=
new
ArrayList
<>();
List
<
ActSuppliesImportCleaningAcc
>
accList
=
asiccSuppliesMapper
.
selectByCodeAndMineId
(
mineId
,
code
);
Long
level
=
accInfo
.
getLevel
();
accList
.
forEach
(
acc
->
{
if
(
level
==
1
)
{
String
codes
=
acc
.
getCategories
();
String
suppliesName
=
accInfo
.
getSuppliesName
();
ActSupplies
supplies
=
asiccSuppliesMapper
.
selectByCodes
(
codes
);
Long
level
=
supplies
.
getLevel
();
if
(
level
==
1
)
{
String
suppliesName
=
supplies
.
getSuppliesName
();
voList
.
add
(
suppliesName
);
voList
.
add
(
suppliesName
);
voList
.
add
(
null
);
voList
.
add
(
"null"
);
// 添加一个 null,可能需要根据需求调整
map
.
put
(
code
,
voList
);
}
else
if
(
level
==
2
)
{
}
else
if
(
level
==
2
){
for
(
ActSupplies
supplies
:
suppliesList
)
{
//此时为二级分类名称
String
twoSupplies
=
supplies
.
getSuppliesName
();
//获取对应的一级分类
String
oneLevel
=
supplies
.
getOneLevel
();
String
oneLevel
=
supplies
.
getOneLevel
();
ActSupplies
suppliesInfo
=
asiccSuppliesMapper
.
selectByOneLevel
(
oneLevel
);
if
(
oneLevel
.
equals
(
accInfo
.
getOneLevel
()))
{
String
oneSupplies
=
suppliesInfo
.
getSuppliesName
();
String
oneSupplies
=
supplies
.
getSuppliesName
();
voList
.
add
(
oneSupplies
);
String
twoSupplies
=
accInfo
.
getSuppliesName
();
voList
.
add
(
twoSupplies
);
voList
.
add
(
oneSupplies
);
map
.
put
(
code
,
voList
);
voList
.
add
(
twoSupplies
);
}
}
}
});
}
map
.
put
(
accInfo
.
getCodeColumn
(),
voList
);
}
}
return
map
;
return
map
;
}
}
...
...
ruoyi-wages/src/main/resources/mapper/system/AsiccSuppliesMapper.xml
View file @
54d1749b
...
@@ -17,12 +17,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -17,12 +17,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"codeColumn"
column=
"code_column"
/>
</resultMap>
</resultMap>
<select
id=
"selectByCodeAndMineId"
resultType=
"com.ruoyi.system.domain.ActSuppliesImportCleaningAcc"
>
<resultMap
type=
"com.ruoyi.system.domain.ActSuppliesImportCleaningAcc"
id=
"ActSuppliesImportCleaningResultAcc"
>
select distinct(categories)
<result
property=
"id"
column=
"id"
/>
from act_supplies_import_cleaning_copy1
<result
property=
"hId"
column=
"h_id"
/>
where ssk_id = #{mineId} and code_column = #{code}
<result
property=
"sskId"
column=
"ssk_id"
/>
<result
property=
"hdate"
column=
"hdate"
/>
<result
property=
"kmCode"
column=
"km_code"
/>
<result
property=
"nameColumn"
column=
"name_column"
/>
<result
property=
"codeColumn"
column=
"code_column"
/>
<result
property=
"departmentColumn"
column=
"department_column"
/>
<result
property=
"numberColumn"
column=
"number_column"
/>
<result
property=
"moneyColumn"
column=
"money_column"
/>
<result
property=
"moneyColumns"
column=
"money_columns"
/>
<result
property=
"dateColumn"
column=
"date_column"
/>
<result
property=
"sOfExpenses"
column=
"source_of_expenses"
/>
<result
property=
"categories"
column=
"categories"
/>
</resultMap>
<select
id=
"selectByCodeAndMineId"
resultMap=
"ActSuppliesResult"
>
select distinct (act.one_level) as `one_level`, act.two_level as `two_level` , act.level `level`, act.supplies_name as supplies_name,
asicc1.code_column as code_column
from act_supplies_import_cleaning_copy1 asicc1
LEFT JOIN act_supplies act on codes = asicc1.categories
where ssk_id = #{mineId} and code_column in
<foreach
collection=
"codes"
item=
"code"
separator=
","
open=
"("
close=
")"
>
#{code}
</foreach>
</select>
</select>
<select
id=
"selectByCodes"
resultMap=
"ActSuppliesResult"
>
<select
id=
"selectByCodes"
resultMap=
"ActSuppliesResult"
>
select one_level, two_level, three_level, codes, supplies_name, level, status
select one_level, two_level, three_level, codes, supplies_name, level, status
...
@@ -34,4 +57,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -34,4 +57,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from act_supplies
from act_supplies
where one_level = #{oneLevel} and level = 1
where one_level = #{oneLevel} and level = 1
</select>
</select>
<select
id=
"selectByMineId"
resultMap=
"ActSuppliesImportCleaningResultAcc"
>
select distinct(categories) as categories,code_column
from act_supplies_import_cleaning_copy1
where ssk_id = #{mineId}
</select>
<select
id=
"selectByCode"
parameterType=
"java.lang.String"
>
</select>
<select
id=
"select"
resultMap=
"ActSuppliesResult"
>
select one_level, two_level, three_level, codes, supplies_name, level, status
from act_supplies
where level = 1
</select>
</mapper>
</mapper>
\ 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