Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
7a610143
由
康伟
编写于
2024-10-08 18:36:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
kangwei : 修改计划采购的统计方法以及查询方法
1 个父辈
47cbed7d
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
121 行增加
和
60 行删除
sk-module-biz/src/main/java/com/skua/modules/erp/controller/PurchasePlanController.java
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/PurchasePlanMapper.java
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/xml/PurchasePlanMapper.xml
sk-module-biz/src/main/java/com/skua/modules/erp/service/IPurchasePlanService.java
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/PurchasePlanServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/erp/vo/PurchasePlanStatisticsVO.java
sk-module-biz/src/main/java/com/skua/modules/erp/controller/PurchasePlanController.java
查看文件 @
7a61014
...
...
@@ -22,10 +22,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.skua.modules.erp.vo.PurchasePlanSearchVO
;
import
com.skua.modules.erp.vo.PurchasePlanStatisticsVO
;
import
com.skua.modules.erp.vo.PurchasePlanVO
;
import
com.skua.modules.guest.util.DateUtil
;
import
com.skua.modules.supplies.service.IEquipmentSparepartTypeService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jeecgframework.poi.excel.ExcelImportUtil
;
import
org.jeecgframework.poi.excel.def.NormalExcelConstants
;
import
org.jeecgframework.poi.excel.entity.ExportParams
;
...
...
@@ -55,6 +58,8 @@ import io.swagger.annotations.ApiOperation;
public
class
PurchasePlanController
{
@Autowired
private
IPurchasePlanService
purchasePlanService
;
@Autowired
private
IEquipmentSparepartTypeService
equipmentSparepartTypeService
;
@AutoLog
(
value
=
"erp采购计划表-分页列表查询"
)
@ApiOperation
(
value
=
"erp采购计划表-分页列表查询"
,
notes
=
"erp采购计划表-分页列表查询"
)
...
...
@@ -66,22 +71,20 @@ public class PurchasePlanController {
Result
<
IPage
<
PurchasePlan
>>
result
=
new
Result
<
IPage
<
PurchasePlan
>>();
QueryWrapper
<
PurchasePlan
>
queryWrapper
=
QueryGenerator
.
initQueryWrapper
(
purchasePlan
,
req
.
getParameterMap
());
Page
<
PurchasePlan
>
page
=
new
Page
<
PurchasePlan
>(
pageNo
,
pageSize
);
/*if(purchasePlanVO.getDepartId() != null
){
queryWrapper.eq("depart_id", purchasePlan
VO
.getDepartId());
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getDepartId
()
)
){
queryWrapper
.
eq
(
"depart_id"
,
purchasePlan
.
getDepartId
());
}
if(
purchasePlanVO.getStatus() != null
){
queryWrapper.eq("status", purchasePlan
VO
.getStatus());
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getStatus
()
)
){
queryWrapper
.
eq
(
"status"
,
purchasePlan
.
getStatus
());
}
if(
purchasePlanVO.getApplyYear() != null
){
queryWrapper.eq("apply_year", purchasePlan
VO
.getApplyYear());
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getApplyYear
()
)
){
queryWrapper
.
eq
(
"apply_year"
,
purchasePlan
.
getApplyYear
());
}
if(purchasePlanVO.getApplyYear() != null ){
queryWrapper.eq("apply_year", purchasePlanVO.getApplyYear());
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getApplyUser
())
){
queryWrapper
.
like
(
"apply_user"
,
purchasePlan
.
getApplyUser
());
}
if(purchasePlanVO.getApplyUser() != null ){
queryWrapper.like("apply_user", purchasePlanVO.getApplyUser());
}*/
queryWrapper
.
orderByDesc
(
"create_time"
);
IPage
<
PurchasePlan
>
pageList
=
purchasePlanService
.
page
(
page
,
queryWrapper
);
...
...
@@ -102,24 +105,28 @@ public class PurchasePlanController {
QueryWrapper
<
PurchasePlan
>
queryWrapper
=
QueryGenerator
.
initQueryWrapper
(
purchasePlan
,
req
.
getParameterMap
());
Page
<
PurchasePlan
>
page
=
new
Page
<
PurchasePlan
>(
pageNo
,
pageSize
);
/* queryWrapper.in("depart_id", BaseContextHandler.getDeparts().split(","));
if(purchasePlan.getStatus() != null ){
queryWrapper.eq("status", purchasePlan.getStatus());
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getDepartId
()
)
){
queryWrapper
.
eq
(
"depart_id"
,
purchasePlan
.
getDepartId
());
}
else
{
//如果为管理员,则跳过权限
if
(!
"1"
.
equals
(
BaseContextHandler
.
get
(
"userType"
)))
{
queryWrapper
.
in
(
"depart_id"
,
BaseContextHandler
.
getDeparts
().
split
(
","
));
}
}
if(purchasePlan.getApplyYear() != null ){
queryWrapper.eq("apply_year", purchasePlan.getApplyYear());
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getStatus
()
)
){
queryWrapper
.
eq
(
"status"
,
purchasePlan
.
getStatus
());
}
else
{
queryWrapper
.
gt
(
"status"
,
"0"
);
// >0
queryWrapper
.
ne
(
"status"
,
"2"
);
// 不等于2
}
if(
purchasePlan.getApplyYear() != null
){
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getApplyYear
())
){
queryWrapper
.
eq
(
"apply_year"
,
purchasePlan
.
getApplyYear
());
}
if(
purchasePlan.getApplyUser() != null
){
if
(
StringUtils
.
isNotEmpty
(
purchasePlan
.
getApplyUser
()
)
){
queryWrapper
.
like
(
"apply_user"
,
purchasePlan
.
getApplyUser
());
}*/
queryWrapper
.
in
(
"depart_id"
,
BaseContextHandler
.
getDeparts
().
split
(
","
));
queryWrapper
.
gt
(
"status"
,
"0"
);
// >0
queryWrapper
.
ne
(
"status"
,
"2"
);
// 不等于2
}
queryWrapper
.
orderByDesc
(
"create_time"
);
IPage
<
PurchasePlan
>
pageList
=
purchasePlanService
.
page
(
page
,
queryWrapper
);
result
.
setSuccess
(
true
);
...
...
@@ -292,6 +299,20 @@ public class PurchasePlanController {
Page
<
PurchasePlanItem
>
page
=
new
Page
<
PurchasePlanItem
>(
pageNo
,
pageSize
);
//purchasePlanSearchVO.setDepats();
purchasePlanSearchVO
.
setDeparts
(
BaseContextHandler
.
getDeparts
());
Set
<
String
>
sparepartTypeSet
=
new
HashSet
<>();
String
sparepartTypeStr
=
""
;
if
(
StringUtils
.
isNotEmpty
(
purchasePlanSearchVO
.
getSparepartType
()))
{
// 查询子集
sparepartTypeSet
=
equipmentSparepartTypeService
.
getAllChildrenSparepartTypeIds
(
purchasePlanSearchVO
.
getSparepartType
()
);
if
(
sparepartTypeSet
.
size
()
>
0
){
// 使用String.join()方法转换Set为字符串,以逗号分隔
sparepartTypeStr
=
String
.
join
(
","
,
sparepartTypeSet
);
}
purchasePlanSearchVO
.
setSparepartType
(
sparepartTypeStr
);
}
IPage
<
PurchasePlanItem
>
pageList
=
purchasePlanService
.
statisticsPage
(
page
,
purchasePlanSearchVO
);
result
.
setSuccess
(
true
);
result
.
setResult
(
pageList
);
...
...
@@ -301,15 +322,15 @@ public class PurchasePlanController {
@AutoLog
(
value
=
"erp采购计划表-统计详情"
)
@ApiOperation
(
value
=
"erp采购计划表-统计详情"
,
notes
=
"erp采购计划表-统计详情"
)
@GetMapping
(
value
=
"/statisticsDetail"
)
public
Result
<
IPage
<
PurchasePlan
Item
>>
statisticsDetail
(
PurchasePlanSearchVO
purchasePlanSearchVO
,
@RequestParam
(
name
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
HttpServletRequest
req
)
{
Result
<
IPage
<
PurchasePlan
Item
>>
result
=
new
Result
<
IPage
<
PurchasePlanItem
>>();
public
Result
<
IPage
<
PurchasePlan
StatisticsVO
>>
statisticsDetail
(
PurchasePlanSearchVO
purchasePlanSearchVO
,
@RequestParam
(
name
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
HttpServletRequest
req
)
{
Result
<
IPage
<
PurchasePlan
StatisticsVO
>>
result
=
new
Result
<
IPage
<
PurchasePlanStatisticsVO
>>();
Page
<
PurchasePlan
Item
>
page
=
new
Page
<
PurchasePlanItem
>(
pageNo
,
pageSize
);
purchasePlanSearchVO
.
setDeparts
(
BaseContextHandler
.
getDeparts
());
IPage
<
PurchasePlan
Item
>
pageList
=
purchasePlanService
.
statisticsPageBySparepartId
(
page
,
purchasePlanSearchVO
);
Page
<
PurchasePlan
StatisticsVO
>
page
=
new
Page
<
PurchasePlanStatisticsVO
>(
pageNo
,
pageSize
);
//
purchasePlanSearchVO.setDeparts(BaseContextHandler.getDeparts());
IPage
<
PurchasePlan
StatisticsVO
>
pageList
=
purchasePlanService
.
statisticsPageBySparepartId
(
page
,
purchasePlanSearchVO
);
result
.
setSuccess
(
true
);
result
.
setResult
(
pageList
);
return
result
;
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/PurchasePlanMapper.java
查看文件 @
7a61014
...
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.skua.modules.erp.entity.PurchaseMaterial
;
import
com.skua.modules.erp.entity.PurchasePlanItem
;
import
com.skua.modules.erp.vo.PurchasePlanSearchVO
;
import
com.skua.modules.erp.vo.PurchasePlanStatisticsVO
;
import
org.apache.ibatis.annotations.Param
;
import
com.skua.modules.erp.entity.PurchasePlan
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
...
@@ -30,6 +31,6 @@ public interface PurchasePlanMapper extends BaseMapper<PurchasePlan> {
* @param page
* @return
*/
IPage
<
PurchasePlan
Item
>
statisticsPageBySparepartId
(
Page
<
PurchasePlanItem
>
page
,
@Param
(
"ev"
)
PurchasePlanSearchVO
purchasePlanSearchVO
);
IPage
<
PurchasePlan
StatisticsVO
>
statisticsPageBySparepartId
(
Page
<
PurchasePlanStatisticsVO
>
page
,
@Param
(
"ev"
)
PurchasePlanSearchVO
purchasePlanSearchVO
);
}
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/mapper/xml/PurchasePlanMapper.xml
查看文件 @
7a61014
...
...
@@ -3,13 +3,13 @@
<mapper
namespace=
"com.skua.modules.erp.mapper.PurchasePlanMapper"
>
<!-- 统计查询-->
<select
id=
"statisticsPage"
resultType=
"com.skua.modules.erp.entity.PurchasePlanItem"
>
select ss.id, ss.sparepart_name,ss.sparepart_type, st.item_text as 'sparepart_type_name' ,ss.sparepart_code, ss.specification,ss.measuring_unit, aaa.* from (
select ss.id, ss.sparepart_name,ss.sparepart_type, st.item_text
statisticsPage
as 'sparepart_type_name' ,ss.sparepart_code, ss.specification,ss.measuring_unit, aaa.* from (
select pi.sparepart_id,sum(pi.purchase_num ) as 'purchase_num' , sum(pi.total_price) 'total_price'
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where
pp.id = pi.plan_id
<if
test=
"ev.sparepartType != null and ev.sparepartType != '' "
>
and pi.sparepart_type
= #{ev.sparepartType}
and pi.sparepart_type
in ( ${ev.sparepartType})
</if>
<if
test=
"ev.sparepartCode != null and ev.sparepartCode != '' "
>
AND pi.sparepart_code like concat('%', #{ev.sparepartCode}, '%')
...
...
@@ -21,7 +21,7 @@
and pp.apply_year = #{ev.applyYear}
</if>
<if
test=
"ev.departId != null and ev.departId!= ''"
>
and pp.depart_id
= #{ev.departId}
and pp.depart_id
in ( ${ev.departId} )
</if>
<if
test=
"ev.startTime != null and ev.startTime!= ''"
>
and pp.apply_time
>
= #{ev.startTime}
...
...
@@ -36,33 +36,32 @@
</select>
<select
id=
"statisticsPageBySparepartId"
resultType=
"com.skua.modules.erp.entity.PurchasePlanItem"
>
select st.item_text as 'sparepart_type_name' , d.depart_name , aaa.*
from (
select pi.* ,pp.depart_id
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where pp.id = pi.plan_id and pi.sparepart_id=#{ev.sparepartId}
<if
test=
"ev.sparepartType != null and ev.sparepartType != '' "
>
and pi.sparepart_type = #{ev.sparepartType}
</if>
<if
test=
"ev.sparepartName != null and ev.sparepartName != '' "
>
AND pi.sparepart_name like concat('%', #{ev.sparepartName}, '%')
</if>
<if
test=
"ev.applyYear != null and ev.applyYear != '' "
>
and pp.apply_year = #{ev.applyYear}
</if>
<if
test=
"ev.departId != null and ev.departId!= ''"
>
and pp.depart_id = #{ev.departId}
</if>
<if
test=
"ev.startTime != null and ev.startTime!= ''"
>
and pp.apply_time
>
= #{ev.startTime}
</if>
<if
test=
"ev.endTime != null and ev.endTime != ''"
>
and pp.apply_time
<
= #{ev.endTime}
</if>
<select
id=
"statisticsPageBySparepartId"
resultType=
"com.skua.modules.erp.vo.PurchasePlanStatisticsVO"
>
select u.realname 'apply_user_name', aaa.* from (
select pi.purchase_num ,pi.measuring_unit,pi.sparepart_name, pi.unit_price , pi.total_price , pp.*
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where pp.id = pi.plan_id and pi.sparepart_id=#{ev.sparepartId}
<if
test=
"ev.sparepartType != null and ev.sparepartType != '' "
>
and pi.sparepart_type = #{ev.sparepartType}
</if>
<if
test=
"ev.sparepartName != null and ev.sparepartName != '' "
>
AND pi.sparepart_name like concat('%', #{ev.sparepartName}, '%')
</if>
<if
test=
"ev.applyYear != null and ev.applyYear != '' "
>
and pp.apply_year = #{ev.applyYear}
</if>
<if
test=
"ev.departId != null and ev.departId!= ''"
>
and pp.depart_id = #{ev.departId}
</if>
<if
test=
"ev.startTime != null and ev.startTime!= ''"
>
and pp.apply_time
>
= #{ev.startTime}
</if>
<if
test=
"ev.endTime != null and ev.endTime != ''"
>
and pp.apply_time
<
= #{ev.endTime}
</if>
)aaa
left join equipment_sparepart_type st on st.id = aaa.sparepart_type
left join sys_depart d on d.id = aaa.depart_id
left join sys_user u on u.id = aaa.apply_user
</select>
<!-- and pp.depart_id in (#{ev.departs})-->
</mapper>
\ No newline at end of file
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/service/IPurchasePlanService.java
查看文件 @
7a61014
...
...
@@ -6,6 +6,7 @@ import com.skua.modules.erp.entity.PurchasePlan;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.skua.modules.erp.entity.PurchasePlanItem
;
import
com.skua.modules.erp.vo.PurchasePlanSearchVO
;
import
com.skua.modules.erp.vo.PurchasePlanStatisticsVO
;
import
com.skua.modules.erp.vo.PurchasePlanVO
;
import
java.util.List
;
...
...
@@ -69,6 +70,6 @@ public interface IPurchasePlanService extends IService<PurchasePlan> {
* @param page
* @return
*/
IPage
<
PurchasePlan
Item
>
statisticsPageBySparepartId
(
Page
<
PurchasePlanItem
>
page
,
PurchasePlanSearchVO
purchasePlanSearchVO
);
IPage
<
PurchasePlan
StatisticsVO
>
statisticsPageBySparepartId
(
Page
<
PurchasePlanStatisticsVO
>
page
,
PurchasePlanSearchVO
purchasePlanSearchVO
);
}
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/service/impl/PurchasePlanServiceImpl.java
查看文件 @
7a61014
...
...
@@ -12,6 +12,7 @@ import com.skua.modules.erp.mapper.PurchasePlanItemMapper;
import
com.skua.modules.erp.mapper.PurchasePlanMapper
;
import
com.skua.modules.erp.service.IPurchasePlanService
;
import
com.skua.modules.erp.vo.PurchasePlanSearchVO
;
import
com.skua.modules.erp.vo.PurchasePlanStatisticsVO
;
import
com.skua.modules.erp.vo.PurchasePlanVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -167,7 +168,7 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur
* @param page
* @return
*/
public
IPage
<
PurchasePlan
Item
>
statisticsPageBySparepartId
(
Page
<
PurchasePlanItem
>
page
,
PurchasePlanSearchVO
purchasePlanSearchVO
){
public
IPage
<
PurchasePlan
StatisticsVO
>
statisticsPageBySparepartId
(
Page
<
PurchasePlanStatisticsVO
>
page
,
PurchasePlanSearchVO
purchasePlanSearchVO
){
return
this
.
baseMapper
.
statisticsPageBySparepartId
(
page
,
purchasePlanSearchVO
);
}
}
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/vo/PurchasePlanStatisticsVO.java
0 → 100644
查看文件 @
7a61014
package
com
.
skua
.
modules
.
erp
.
vo
;
import
com.skua.modules.erp.entity.PurchasePlan
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.jeecgframework.poi.excel.annotation.Excel
;
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"PurchasePlan统计对象"
,
description
=
"PurchasePlan统计对象"
)
public
class
PurchasePlanStatisticsVO
extends
PurchasePlan
{
/**物料编号*/
@Excel
(
name
=
"物料编号"
,
width
=
15
)
@ApiModelProperty
(
value
=
"物料名称"
)
private
String
sparepartName
;
@ApiModelProperty
(
value
=
"物料名称"
)
private
String
applyUserName
;
/**计划采购数量*/
@Excel
(
name
=
"计划采购数量"
,
width
=
15
)
@ApiModelProperty
(
value
=
"计划采购数量"
)
private
String
purchaseNum
;
/**单价*/
@Excel
(
name
=
"单价"
,
width
=
15
)
@ApiModelProperty
(
value
=
"单价"
)
private
String
unitPrice
;
@Excel
(
name
=
"总价"
,
width
=
15
)
@ApiModelProperty
(
value
=
"总价"
)
private
String
totalPrice
;
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论