Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
relation
Commits
62029305
Commit
62029305
authored
Jul 31, 2025
by
zhuxiang
Browse files
案件相关接口
parent
703fa13c
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/platform/controller/CaseController.java
View file @
62029305
package
com.platform.controller
;
package
com.platform.controller
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.resp.Result
;
import
com.platform.service.CaseService
;
import
com.platform.service.CaseService
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.
RestController
;
import
org.springframework.web.bind.annotation.
*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
@RestController
@RestController
@RequestMapping
(
"/case"
)
@RequestMapping
(
"/case"
)
public
class
CaseController
extends
BaseController
{
public
class
CaseController
extends
BaseController
{
@Resource
@Resource
private
CaseService
caseService
;
private
CaseService
caseService
;
@ApiOperation
(
value
=
"案件详情-数据列表"
)
@GetMapping
(
"/detail/dataList/{id}"
)
public
Result
dataList
(
@PathVariable
String
id
)
{
return
Result
.
data
(
caseService
.
queryDataList
(
id
));
}
@ApiOperation
(
value
=
"案件详情-数据更新所属人"
)
@PutMapping
(
"/detail/updatePayUser"
)
public
Result
updatePayUser
(
@RequestBody
ExcelDataDTO
excelDataDTO
)
{
return
Result
.
data
(
caseService
.
updatePayUser
(
excelDataDTO
));
}
@ApiOperation
(
value
=
"案件详情-删除文件数据"
)
@DeleteMapping
(
"/detail/deleteExcel/{fileId}"
)
public
Result
deleteExcel
(
@PathVariable
String
fileId
)
{
return
toAjax
(
caseService
.
deleteExcel
(
fileId
));
}
@ApiOperation
(
value
=
"更新是否使用"
)
@PutMapping
(
"/detail/updateExcelUse"
)
public
Result
updateExcelUse
(
@RequestBody
ExcelDataDTO
excelDataDTO
)
{
return
toAjax
(
caseService
.
updateExcelUse
(
excelDataDTO
));
}
@ApiOperation
(
value
=
"合并人员"
)
@PutMapping
(
"/detail/mergeUser"
)
public
Result
mergeUser
(
@RequestBody
ExcelDataDTO
excelDataDTO
){
return
toAjax
(
caseService
.
mergeUser
(
excelDataDTO
));
}
}
}
src/main/java/com/platform/mapper/ExcelDataMapper.java
View file @
62029305
...
@@ -2,8 +2,11 @@ package com.platform.mapper;
...
@@ -2,8 +2,11 @@ package com.platform.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.ExcelDataVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
/**
* @author : wujipeng
* @author : wujipeng
* @date : 2025/7/30 14:14
* @date : 2025/7/30 14:14
...
@@ -12,4 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -12,4 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
ExcelDataMapper
extends
BaseMapper
<
ExcelDataEntity
>
{
public
interface
ExcelDataMapper
extends
BaseMapper
<
ExcelDataEntity
>
{
List
<
ExcelDataVO
>
queryByCaseId
(
String
id
);
}
}
src/main/java/com/platform/model/dto/CaseDTO.java
0 → 100644
View file @
62029305
package
com.platform.model.dto
;
import
lombok.Data
;
@Data
public
class
CaseDTO
{
private
String
payUserName
;
private
String
fileId
;
}
src/main/java/com/platform/model/dto/ExcelDataDTO.java
0 → 100644
View file @
62029305
package
com.platform.model.dto
;
import
com.platform.model.entity.ExcelDataEntity
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
ExcelDataDTO
extends
ExcelDataEntity
{
private
List
<
String
>
oldPayUserName
;
private
String
newPayUserName
;
}
src/main/java/com/platform/model/entity/ExcelDataEntity.java
View file @
62029305
...
@@ -94,9 +94,6 @@ public class ExcelDataEntity {
...
@@ -94,9 +94,6 @@ public class ExcelDataEntity {
@TableField
(
"pay_user_name"
)
@TableField
(
"pay_user_name"
)
private
String
payUserName
;
private
String
payUserName
;
@TableField
(
"status"
)
private
String
status
;
@TableField
(
"file_id"
)
@TableField
(
"file_id"
)
private
String
fileId
;
private
String
fileId
;
...
...
src/main/java/com/platform/model/vo/CaseVO.java
0 → 100644
View file @
62029305
package
com.platform.model.vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.platform.model.entity.CaseEntity
;
import
lombok.*
;
import
java.util.List
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
CaseVO
extends
CaseEntity
{
private
String
payUserName
;
private
List
<
ExcelDataVO
>
excelDataList
;
}
src/main/java/com/platform/model/vo/ExcelDataVO.java
0 → 100644
View file @
62029305
package
com.platform.model.vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.platform.model.entity.ExcelDataEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
ExcelDataVO
extends
ExcelDataEntity
{
private
String
fileName
;
private
String
filePath
;
}
src/main/java/com/platform/service/CaseService.java
View file @
62029305
package
com.platform.service
;
package
com.platform.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.vo.CaseVO
;
import
java.util.List
;
public
interface
CaseService
extends
IService
<
CaseEntity
>
{
public
interface
CaseService
extends
IService
<
CaseEntity
>
{
List
<
CaseVO
>
queryDataList
(
String
id
);
/**
* 数据更新所属人
*
* @param excelDataDTO excelDataDTO
* @return boolean
*/
boolean
updatePayUser
(
ExcelDataDTO
excelDataDTO
);
/**
* @param fileId
* @return
*/
boolean
deleteExcel
(
String
fileId
);
/**
* 更新是否使用
* @param excelDataDTO
* @return
*/
boolean
updateExcelUse
(
ExcelDataDTO
excelDataDTO
);
/**
*
* @param excelDataDTO
* @return
*/
boolean
mergeUser
(
ExcelDataDTO
excelDataDTO
);
}
}
src/main/java/com/platform/service/ExcelDataService.java
View file @
62029305
package
com.platform.service
;
package
com.platform.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.ExcelDataVO
;
import
java.util.List
;
/**
/**
* @author : wujipeng
* @author : wujipeng
...
@@ -10,4 +14,26 @@ import com.platform.model.entity.ExcelDataEntity;
...
@@ -10,4 +14,26 @@ import com.platform.model.entity.ExcelDataEntity;
* @Desc : 描述信息
* @Desc : 描述信息
*/
*/
public
interface
ExcelDataService
extends
IService
<
ExcelDataEntity
>
{
public
interface
ExcelDataService
extends
IService
<
ExcelDataEntity
>
{
List
<
ExcelDataVO
>
queryByCaseId
(
String
id
);
/**
*
* @param fileId
* @return
*/
List
<
ExcelDataEntity
>
queryListByFileId
(
String
fileId
,
String
caseId
);
/**
*
* @param fileId
* @return
*/
boolean
deleteByFileId
(
String
fileId
);
/**
*
* @param
* @return
*/
List
<
ExcelDataEntity
>
queryListByCaseIdAndPayUserName
(
String
caseId
,
String
payUserName
);
}
}
src/main/java/com/platform/service/impl/CaseServiceImpl.java
View file @
62029305
package
com.platform.service.impl
;
package
com.platform.service.impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.platform.mapper.CaseMapper
;
import
com.platform.mapper.CaseMapper
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.CaseVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.service.CaseService
;
import
com.platform.service.CaseService
;
import
com.platform.service.ExcelDataService
;
import
com.platform.utils.StringUtils
;
import
org.apache.commons.compress.utils.Lists
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Service
public
class
CaseServiceImpl
extends
ServiceImpl
<
CaseMapper
,
CaseEntity
>
implements
CaseService
{
public
class
CaseServiceImpl
extends
ServiceImpl
<
CaseMapper
,
CaseEntity
>
implements
CaseService
{
@Resource
private
ExcelDataService
excelDataService
;
@Override
public
List
<
CaseVO
>
queryDataList
(
String
id
)
{
//查看案件所有的excelData
List
<
ExcelDataVO
>
excelDataEntityList
=
excelDataService
.
queryByCaseId
(
id
);
excelDataEntityList
.
forEach
(
excelDataEntity
->
{
if
(
StringUtils
.
isNull
(
excelDataEntity
.
getPayUserName
()))
{
excelDataEntity
.
setPayUserName
(
"无对应人员的数据"
);
}
});
// 调用分组方法
Map
<
String
,
List
<
ExcelDataVO
>>
groupedMap
=
groupByPayUserName
(
excelDataEntityList
);
//初始化集合
List
<
CaseVO
>
caseVOList
=
Lists
.
newArrayList
();
//遍历groupedMap
for
(
Map
.
Entry
<
String
,
List
<
ExcelDataVO
>>
entry
:
groupedMap
.
entrySet
())
{
System
.
out
.
println
(
"Key: "
+
entry
.
getKey
()
+
", Values: "
+
entry
.
getValue
());
caseVOList
.
add
(
CaseVO
.
builder
().
excelDataList
(
entry
.
getValue
())
.
payUserName
(
entry
.
getKey
())
.
build
());
}
return
caseVOList
;
}
@Override
public
boolean
updatePayUser
(
ExcelDataDTO
excelDataDTO
)
{
//查看fileId线管的excelData数据
List
<
ExcelDataEntity
>
excelDataEntityList
=
excelDataService
.
queryListByFileId
(
excelDataDTO
.
getFileId
(),
excelDataDTO
.
getCaseId
());
if
(
CollUtil
.
isNotEmpty
(
excelDataEntityList
))
{
excelDataEntityList
.
forEach
(
excelDataEntity
->
excelDataEntity
.
setPayUserName
(
excelDataDTO
.
getPayUserName
()));
}
return
excelDataService
.
updateBatchById
(
excelDataEntityList
);
}
@Override
public
boolean
deleteExcel
(
String
fileId
)
{
return
excelDataService
.
deleteByFileId
(
fileId
);
}
@Override
public
boolean
updateExcelUse
(
ExcelDataDTO
excelDataDTO
)
{
//查看数据
List
<
ExcelDataEntity
>
excelDataEntityList
=
excelDataService
.
queryListByFileId
(
excelDataDTO
.
getFileId
(),
excelDataDTO
.
getCaseId
());
if
(
CollUtil
.
isNotEmpty
(
excelDataEntityList
))
{
excelDataEntityList
.
forEach
(
excelDataEntity
->
excelDataEntity
.
setUseFlag
(
excelDataDTO
.
getUseFlag
()));
}
return
excelDataService
.
updateBatchById
(
excelDataEntityList
);
}
@Override
public
boolean
mergeUser
(
ExcelDataDTO
excelDataDTO
)
{
//查看合并之前的人员数据
//初始化合并后的集合
List
<
ExcelDataEntity
>
mergeList
=
Lists
.
newArrayList
();
excelDataDTO
.
getOldPayUserName
().
forEach
(
payUserName
->
{
List
<
ExcelDataEntity
>
excelDataEntityList
=
excelDataService
.
queryListByCaseIdAndPayUserName
(
excelDataDTO
.
getCaseId
(),
payUserName
);
if
(
CollUtil
.
isNotEmpty
(
excelDataEntityList
))
{
mergeList
.
addAll
(
excelDataEntityList
);
}
});
if
(
CollUtil
.
isNotEmpty
(
mergeList
))
{
mergeList
.
forEach
(
excelDataEntity
->
excelDataEntity
.
setPayUserName
(
excelDataDTO
.
getNewPayUserName
()));
excelDataService
.
updateBatchById
(
mergeList
);
}
return
Boolean
.
TRUE
;
}
private
Map
<
String
,
List
<
ExcelDataVO
>>
groupByPayUserName
(
List
<
ExcelDataVO
>
excelDataVOList
)
{
Map
<
String
,
List
<
ExcelDataVO
>>
groupedMap
=
new
HashMap
<>();
for
(
ExcelDataVO
obj
:
excelDataVOList
)
{
String
key
=
obj
.
getPayUserName
();
// 获取A字段的值作为键
if
(!
groupedMap
.
containsKey
(
key
))
{
groupedMap
.
put
(
key
,
new
ArrayList
<>());
// 如果键不存在,创建一个新的List
}
groupedMap
.
get
(
key
).
add
(
obj
);
// 将对象添加到对应的List中
}
return
groupedMap
;
}
}
}
src/main/java/com/platform/service/impl/ExcelDataServiceImpl.java
View file @
62029305
package
com.platform.service.impl
;
package
com.platform.service.impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.platform.mapper.ExcelDataMapper
;
import
com.platform.mapper.ExcelDataMapper
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.service.ExcelDataService
;
import
com.platform.service.ExcelDataService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* @author : wujipeng
* @author : wujipeng
* @date : 2025/7/30 14:15
* @date : 2025/7/30 14:15
...
@@ -14,4 +19,32 @@ import org.springframework.stereotype.Service;
...
@@ -14,4 +19,32 @@ import org.springframework.stereotype.Service;
*/
*/
@Service
@Service
public
class
ExcelDataServiceImpl
extends
ServiceImpl
<
ExcelDataMapper
,
ExcelDataEntity
>
implements
ExcelDataService
{
public
class
ExcelDataServiceImpl
extends
ServiceImpl
<
ExcelDataMapper
,
ExcelDataEntity
>
implements
ExcelDataService
{
@Override
public
List
<
ExcelDataVO
>
queryByCaseId
(
String
id
)
{
return
baseMapper
.
queryByCaseId
(
id
);
}
@Override
public
List
<
ExcelDataEntity
>
queryListByFileId
(
String
fileId
,
String
caseId
)
{
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
ExcelDataEntity
>()
.
eq
(
ExcelDataEntity:
:
getFileId
,
fileId
)
.
eq
(
ExcelDataEntity:
:
getCaseId
,
caseId
));
}
@Override
public
boolean
deleteByFileId
(
String
fileId
)
{
int
i
=
baseMapper
.
delete
(
new
LambdaQueryWrapper
<
ExcelDataEntity
>()
.
eq
(
ExcelDataEntity:
:
getFileId
,
fileId
));
if
(
i
>
0
)
{
return
Boolean
.
TRUE
;
}
return
Boolean
.
FALSE
;
}
@Override
public
List
<
ExcelDataEntity
>
queryListByCaseIdAndPayUserName
(
String
caseId
,
String
payUserName
)
{
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
ExcelDataEntity
>()
.
eq
(
ExcelDataEntity:
:
getCaseId
,
caseId
)
.
eq
(
ExcelDataEntity:
:
getPayUserName
,
payUserName
));
}
}
}
src/main/resources/com/platform/mapper/ExcelDataMapper.xml
View file @
62029305
...
@@ -3,4 +3,20 @@
...
@@ -3,4 +3,20 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.platform.mapper.ExcelDataMapper"
>
<mapper
namespace=
"com.platform.mapper.ExcelDataMapper"
>
<select
id=
"queryByCaseId"
resultType=
"com.platform.model.vo.ExcelDataVO"
>
select
ed.pay_user_name,
ed.use_flag,
fu.file_name,
fu.path,
ed.file_id
from
excel_data ed
left join
file_upload fu
on
ed.file_id = fu.id
group by
ed.file_id,ed.pay_user_name,fu.file_name,fu.path,ed.use_flag
</select>
</mapper>
</mapper>
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