Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
isoft_psa
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王飞
isoft_psa
Commits
24268682
Commit
24268682
authored
Mar 21, 2025
by
ZhangRunSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:借用申请
parent
a41d1072
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
951 additions
and
11 deletions
+951
-11
AttendanceClockServiceImpl.java
...i/attendance/service/impl/AttendanceClockServiceImpl.java
+8
-0
PsaMaterialMapper.java
...ain/java/com/ruoyi/material/mapper/PsaMaterialMapper.java
+2
-0
PsaMaterialApplyController.java
.../materialapply/controller/PsaMaterialApplyController.java
+114
-0
ProjectUser.java
...main/java/com/ruoyi/materialapply/domain/ProjectUser.java
+9
-0
PsaMaterialApply.java
...java/com/ruoyi/materialapply/domain/PsaMaterialApply.java
+169
-0
PsaMaterialApplyDetail.java
...om/ruoyi/materialapply/domain/PsaMaterialApplyDetail.java
+97
-0
MaterialApplyStatus.java
...va/com/ruoyi/materialapply/enums/MaterialApplyStatus.java
+28
-0
PsaMaterialApplyMapper.java
...om/ruoyi/materialapply/mapper/PsaMaterialApplyMapper.java
+96
-0
IPsaMaterialApplyService.java
...ruoyi/materialapply/service/IPsaMaterialApplyService.java
+66
-0
PsaMaterialApplyServiceImpl.java
...terialapply/service/impl/PsaMaterialApplyServiceImpl.java
+151
-0
PsaMaterialEntryController.java
.../materialentry/controller/PsaMaterialEntryController.java
+3
-3
PsaMaterialEntryServiceImpl.java
...terialentry/service/impl/PsaMaterialEntryServiceImpl.java
+7
-0
AttendanceClockMapper.xml
...src/main/resources/mapper/clock/AttendanceClockMapper.xml
+13
-6
PsaMaterialApplyMapper.xml
...main/resources/mapper/material/PsaMaterialApplyMapper.xml
+181
-0
PsaMaterialMapper.xml
.../src/main/resources/mapper/material/PsaMaterialMapper.xml
+7
-2
No files found.
ruoyi-psa/src/main/java/com/ruoyi/attendance/service/impl/AttendanceClockServiceImpl.java
View file @
24268682
...
...
@@ -63,6 +63,7 @@ public class AttendanceClockServiceImpl implements IAttendanceClockService
@Override
public
List
<
AttendanceClock
>
selectAttendanceClockList
(
AttendanceClock
attendanceClock
)
{
attendanceClock
.
setDelFlag
(
AttendanceDelFlag
.
EXIST
.
getValue
());
attendanceClock
.
setDraft
(
AttendanceDraft
.
NO
.
getValue
());
return
attendanceClockMapper
.
selectAttendanceClockList
(
attendanceClock
);
}
...
...
@@ -74,6 +75,7 @@ public class AttendanceClockServiceImpl implements IAttendanceClockService
*/
@Override
public
List
<
AttendanceClock
>
selectAttendanceClockDraftList
(
AttendanceClock
attendanceClock
)
{
attendanceClock
.
setDelFlag
(
AttendanceDelFlag
.
EXIST
.
getValue
());
attendanceClock
.
setDraft
(
AttendanceDraft
.
YES
.
getValue
());
return
attendanceClockMapper
.
selectAttendanceClockList
(
attendanceClock
);
}
...
...
@@ -103,6 +105,9 @@ public class AttendanceClockServiceImpl implements IAttendanceClockService
*/
@Override
public
int
insertAttendanceClockDraft
(
AttendanceClock
attendanceClock
)
{
attendanceClock
.
setCreatBy
(
SecurityUtils
.
getLoginUser
().
getUsername
());
attendanceClock
.
setCreatTime
(
LocalDateTime
.
now
());
attendanceClock
.
setDelFlag
(
AttendanceDelFlag
.
EXIST
.
getValue
());
attendanceClock
.
setDraft
(
AttendanceDraft
.
YES
.
getValue
());
attendanceClock
.
setCheckInStatus
(
isStatus
(
attendanceClock
.
getIsClock
(),
attendanceClock
.
getClockTime
()));
return
attendanceClockMapper
.
insertAttendanceClock
(
attendanceClock
);
...
...
@@ -118,6 +123,9 @@ public class AttendanceClockServiceImpl implements IAttendanceClockService
@Override
public
int
updateAttendanceClock
(
AttendanceClock
attendanceClock
)
{
if
(
attendanceClock
.
getDraft
().
equals
(
AttendanceDraft
.
YES
.
getValue
())){
attendanceClock
.
setDraft
(
AttendanceDraft
.
NO
.
getValue
());
}
attendanceClock
.
setUpdateTime
(
DateUtils
.
getNowDate
());
attendanceClock
.
setCheckInStatus
(
isStatus
(
attendanceClock
.
getIsClock
(),
attendanceClock
.
getClockTime
()));
return
attendanceClockMapper
.
updateAttendanceClock
(
attendanceClock
);
...
...
ruoyi-psa/src/main/java/com/ruoyi/material/mapper/PsaMaterialMapper.java
View file @
24268682
...
...
@@ -96,4 +96,6 @@ public interface PsaMaterialMapper
List
<
PsaMaterial
>
selectPsaMaterialQueryList
(
MaterialQueryDTO
materialQueryDTO
);
void
addStock
(
@Param
(
"materialId"
)
Long
materialId
,
@Param
(
"entryQuantity"
)
Long
entryQuantity
);
void
minusStock
(
@Param
(
"materialId"
)
Long
materialId
,
@Param
(
"minusQuantity"
)
Long
minusQuantity
);
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/controller/PsaMaterialApplyController.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
controller
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
com.ruoyi.materialapply.domain.ProjectUser
;
import
com.ruoyi.materialapply.domain.PsaMaterialApply
;
import
com.ruoyi.materialapply.service.IPsaMaterialApplyService
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.core.page.TableDataInfo
;
/**
* 物品借用申请Controller
*
* @author ruoyi
* @date 2025-03-18
*/
@RestController
@RequestMapping
(
"/material/apply"
)
public
class
PsaMaterialApplyController
extends
BaseController
{
@Autowired
private
IPsaMaterialApplyService
psaMaterialApplyService
;
/**
* 查询物品借用申请列表
*/
@PreAuthorize
(
"@ss.hasPermi('material:apply:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
PsaMaterialApply
psaMaterialApply
)
{
startPage
();
List
<
PsaMaterialApply
>
list
=
psaMaterialApplyService
.
selectPsaMaterialApplyList
(
psaMaterialApply
);
return
getDataTable
(
list
);
}
/**
* 导出物品借用申请列表
*/
@PreAuthorize
(
"@ss.hasPermi('material:apply:export')"
)
@Log
(
title
=
"物品借用申请"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
PsaMaterialApply
psaMaterialApply
)
{
List
<
PsaMaterialApply
>
list
=
psaMaterialApplyService
.
selectPsaMaterialApplyList
(
psaMaterialApply
);
ExcelUtil
<
PsaMaterialApply
>
util
=
new
ExcelUtil
<
PsaMaterialApply
>(
PsaMaterialApply
.
class
);
util
.
exportExcel
(
response
,
list
,
"物品借用申请数据"
);
}
/**
* 获取物品借用申请详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('material:apply:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
psaMaterialApplyService
.
selectPsaMaterialApplyById
(
id
));
}
/**
* 新增物品借用申请
*/
@PreAuthorize
(
"@ss.hasPermi('material:apply:add')"
)
@Log
(
title
=
"物品借用申请"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
PsaMaterialApply
psaMaterialApply
)
{
return
toAjax
(
psaMaterialApplyService
.
insertPsaMaterialApply
(
psaMaterialApply
));
}
/**
* 修改物品借用申请
*/
@PreAuthorize
(
"@ss.hasPermi('material:apply:edit')"
)
@Log
(
title
=
"物品借用申请"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
PsaMaterialApply
psaMaterialApply
)
{
return
toAjax
(
psaMaterialApplyService
.
updatePsaMaterialApply
(
psaMaterialApply
));
}
/**
* 删除物品借用申请
*/
@PreAuthorize
(
"@ss.hasPermi('material:apply:remove')"
)
@Log
(
title
=
"物品借用申请"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
psaMaterialApplyService
.
deletePsaMaterialApplyByIds
(
ids
));
}
/**
* 查项目和用户中间表
*/
@PreAuthorize
(
"@ss.hasPermi('material:apply:select')"
)
@GetMapping
(
"/selectuser"
)
public
AjaxResult
select
()
{
List
<
ProjectUser
>
p
=
psaMaterialApplyService
.
selectPorjectUser
();
return
success
(
p
);
}
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/domain/ProjectUser.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
domain
;
import
lombok.Data
;
@Data
public
class
ProjectUser
{
private
Long
projectId
;
private
Long
userId
;
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/domain/PsaMaterialApply.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
domain
;
import
java.util.List
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
/**
* 物品借用申请对象 psa_material_apply
*
* @author ruoyi
* @date 2025-03-18
*/
public
class
PsaMaterialApply
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 申请ID */
private
Long
id
;
/** 项目ID */
@Excel
(
name
=
"项目ID"
)
private
Long
projectId
;
/** 申请人userID */
private
Long
userId
;
/** 申请人姓名 */
@Excel
(
name
=
"申请人姓名"
)
private
String
userName
;
/** 审批状态 */
@Excel
(
name
=
"审批状态"
)
private
String
checkStatus
;
/** 审批时间 */
private
Date
approvalDate
;
/** 审批意见 */
private
String
approvalAdvice
;
/** 草稿箱 */
private
String
draft
;
/** 删除 */
private
String
delFlag
;
/** 物品借用细节信息 */
@JsonProperty
(
"items"
)
private
List
<
PsaMaterialApplyDetail
>
psaMaterialApplyDetailList
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setProjectId
(
Long
projectId
)
{
this
.
projectId
=
projectId
;
}
public
Long
getProjectId
()
{
return
projectId
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
public
Long
getUserId
()
{
return
userId
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setCheckStatus
(
String
checkStatus
)
{
this
.
checkStatus
=
checkStatus
;
}
public
String
getCheckStatus
()
{
return
checkStatus
;
}
public
void
setApprovalDate
(
Date
approvalDate
)
{
this
.
approvalDate
=
approvalDate
;
}
public
Date
getApprovalDate
()
{
return
approvalDate
;
}
public
void
setApprovalAdvice
(
String
approvalAdvice
)
{
this
.
approvalAdvice
=
approvalAdvice
;
}
public
String
getApprovalAdvice
()
{
return
approvalAdvice
;
}
public
void
setDraft
(
String
draft
)
{
this
.
draft
=
draft
;
}
public
String
getDraft
()
{
return
draft
;
}
public
void
setDelFlag
(
String
delFlag
)
{
this
.
delFlag
=
delFlag
;
}
public
String
getDelFlag
()
{
return
delFlag
;
}
public
List
<
PsaMaterialApplyDetail
>
getPsaMaterialApplyDetailList
()
{
return
psaMaterialApplyDetailList
;
}
public
void
setPsaMaterialApplyDetailList
(
List
<
PsaMaterialApplyDetail
>
psaMaterialApplyDetailList
)
{
this
.
psaMaterialApplyDetailList
=
psaMaterialApplyDetailList
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"projectId"
,
getProjectId
())
.
append
(
"userId"
,
getUserId
())
.
append
(
"userName"
,
getUserName
())
.
append
(
"remark"
,
getRemark
())
.
append
(
"checkStatus"
,
getCheckStatus
())
.
append
(
"approvalDate"
,
getApprovalDate
())
.
append
(
"approvalAdvice"
,
getApprovalAdvice
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"draft"
,
getDraft
())
.
append
(
"delFlag"
,
getDelFlag
())
.
append
(
"psaMaterialApplyDetailList"
,
getPsaMaterialApplyDetailList
())
.
toString
();
}
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/domain/PsaMaterialApplyDetail.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
domain
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
/**
* 物品借用细节对象 psa_material_apply_detail
*
* @author ruoyi
* @date 2025-03-18
*/
public
class
PsaMaterialApplyDetail
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
private
Long
id
;
/** 申请表ID */
@Excel
(
name
=
"申请表ID"
)
private
Long
applyId
;
/** 类型ID */
@Excel
(
name
=
"类型ID"
)
@JsonProperty
(
"type"
)
private
Long
materialTypeId
;
/** 物品ID */
@JsonProperty
(
"material_detail"
)
@Excel
(
name
=
"物品ID"
)
private
Long
materialTypeDetailId
;
/** 申请个数 */
@Excel
(
name
=
"申请个数"
)
@JsonProperty
(
"quantity"
)
private
Long
applyNumber
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setApplyId
(
Long
applyId
)
{
this
.
applyId
=
applyId
;
}
public
Long
getApplyId
()
{
return
applyId
;
}
public
void
setMaterialTypeId
(
Long
materialTypeId
)
{
this
.
materialTypeId
=
materialTypeId
;
}
public
Long
getMaterialTypeId
()
{
return
materialTypeId
;
}
public
void
setMaterialTypeDetailId
(
Long
materialTypeDetailId
)
{
this
.
materialTypeDetailId
=
materialTypeDetailId
;
}
public
Long
getMaterialTypeDetailId
()
{
return
materialTypeDetailId
;
}
public
void
setApplyNumber
(
Long
applyNumber
)
{
this
.
applyNumber
=
applyNumber
;
}
public
Long
getApplyNumber
()
{
return
applyNumber
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"applyId"
,
getApplyId
())
.
append
(
"materialTypeId"
,
getMaterialTypeId
())
.
append
(
"materialTypeDetailId"
,
getMaterialTypeDetailId
())
.
append
(
"applyNumber"
,
getApplyNumber
())
.
toString
();
}
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/enums/MaterialApplyStatus.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
enums
;
import
lombok.Getter
;
@Getter
public
enum
MaterialApplyStatus
{
/**
* 待审核
*/
DSH
(
"0"
),
/**
* 通过
*/
TG
(
"1"
),
/**
* 驳回
*/
BH
(
"2"
);
private
final
String
value
;
MaterialApplyStatus
(
String
value
)
{
this
.
value
=
value
;
}
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/mapper/PsaMaterialApplyMapper.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
mapper
;
import
com.ruoyi.materialapply.domain.ProjectUser
;
import
com.ruoyi.materialapply.domain.PsaMaterialApply
;
import
com.ruoyi.materialapply.domain.PsaMaterialApplyDetail
;
import
java.util.List
;
/**
* 物品借用申请Mapper接口
*
* @author ruoyi
* @date 2025-03-18
*/
public
interface
PsaMaterialApplyMapper
{
/**
* 查询物品借用申请
*
* @param id 物品借用申请主键
* @return 物品借用申请
*/
public
PsaMaterialApply
selectPsaMaterialApplyById
(
Long
id
);
/**
* 查询物品借用申请列表
*
* @param psaMaterialApply 物品借用申请
* @return 物品借用申请集合
*/
public
List
<
PsaMaterialApply
>
selectPsaMaterialApplyList
(
PsaMaterialApply
psaMaterialApply
);
/**
* 新增物品借用申请
*
* @param psaMaterialApply 物品借用申请
* @return 结果
*/
public
int
insertPsaMaterialApply
(
PsaMaterialApply
psaMaterialApply
);
/**
* 修改物品借用申请
*
* @param psaMaterialApply 物品借用申请
* @return 结果
*/
public
int
updatePsaMaterialApply
(
PsaMaterialApply
psaMaterialApply
);
/**
* 删除物品借用申请
*
* @param id 物品借用申请主键
* @return 结果
*/
public
int
deletePsaMaterialApplyById
(
Long
id
);
/**
* 批量删除物品借用申请
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deletePsaMaterialApplyByIds
(
Long
[]
ids
);
/**
* 批量删除物品借用细节
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deletePsaMaterialApplyDetailByApplyIds
(
Long
[]
ids
);
/**
* 批量新增物品借用细节
*
* @param psaMaterialApplyDetailList 物品借用细节列表
* @return 结果
*/
public
int
batchPsaMaterialApplyDetail
(
List
<
PsaMaterialApplyDetail
>
psaMaterialApplyDetailList
);
/**
* 通过物品借用申请主键删除物品借用细节信息
*
* @param id 物品借用申请ID
* @return 结果
*/
public
int
deletePsaMaterialApplyDetailByApplyId
(
Long
id
);
/**
* 查项目和用户的中间表
* @return
*/
List
<
ProjectUser
>
selectProjectUser
();
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/service/IPsaMaterialApplyService.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
service
;
import
com.ruoyi.materialapply.domain.ProjectUser
;
import
com.ruoyi.materialapply.domain.PsaMaterialApply
;
import
java.util.List
;
/**
* 物品借用申请Service接口
*
* @author ruoyi
* @date 2025-03-18
*/
public
interface
IPsaMaterialApplyService
{
/**
* 查询物品借用申请
*
* @param id 物品借用申请主键
* @return 物品借用申请
*/
public
PsaMaterialApply
selectPsaMaterialApplyById
(
Long
id
);
/**
* 查询物品借用申请列表
*
* @param psaMaterialApply 物品借用申请
* @return 物品借用申请集合
*/
public
List
<
PsaMaterialApply
>
selectPsaMaterialApplyList
(
PsaMaterialApply
psaMaterialApply
);
/**
* 新增物品借用申请
*
* @param psaMaterialApply 物品借用申请
* @return 结果
*/
public
int
insertPsaMaterialApply
(
PsaMaterialApply
psaMaterialApply
);
/**
* 修改物品借用申请
*
* @param psaMaterialApply 物品借用申请
* @return 结果
*/
public
int
updatePsaMaterialApply
(
PsaMaterialApply
psaMaterialApply
);
/**
* 批量删除物品借用申请
*
* @param ids 需要删除的物品借用申请主键集合
* @return 结果
*/
public
int
deletePsaMaterialApplyByIds
(
Long
[]
ids
);
/**
* 删除物品借用申请信息
*
* @param id 物品借用申请主键
* @return 结果
*/
public
int
deletePsaMaterialApplyById
(
Long
id
);
List
<
ProjectUser
>
selectPorjectUser
();
}
ruoyi-psa/src/main/java/com/ruoyi/materialapply/service/impl/PsaMaterialApplyServiceImpl.java
0 → 100644
View file @
24268682
package
com
.
ruoyi
.
materialapply
.
service
.
impl
;
import
java.security.Security
;
import
java.util.List
;
import
com.ruoyi.attendance.enums.AttendanceDelFlag
;
import
com.ruoyi.attendance.enums.AttendanceDraft
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.materialapply.domain.ProjectUser
;
import
com.ruoyi.materialapply.domain.PsaMaterialApply
;
import
com.ruoyi.materialapply.domain.PsaMaterialApplyDetail
;
import
com.ruoyi.materialapply.enums.MaterialApplyStatus
;
import
com.ruoyi.materialapply.mapper.PsaMaterialApplyMapper
;
import
com.ruoyi.materialapply.service.IPsaMaterialApplyService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
com.ruoyi.common.utils.StringUtils
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 物品借用申请Service业务层处理
*
* @author ruoyi
* @date 2025-03-18
*/
@Service
public
class
PsaMaterialApplyServiceImpl
implements
IPsaMaterialApplyService
{
@Autowired
private
PsaMaterialApplyMapper
psaMaterialApplyMapper
;
/**
* 查询物品借用申请
*
* @param id 物品借用申请主键
* @return 物品借用申请
*/
@Override
public
PsaMaterialApply
selectPsaMaterialApplyById
(
Long
id
)
{
return
psaMaterialApplyMapper
.
selectPsaMaterialApplyById
(
id
);
}
/**
* 查询物品借用申请列表
*
* @param psaMaterialApply 物品借用申请
* @return 物品借用申请
*/
@Override
public
List
<
PsaMaterialApply
>
selectPsaMaterialApplyList
(
PsaMaterialApply
psaMaterialApply
)
{
return
psaMaterialApplyMapper
.
selectPsaMaterialApplyList
(
psaMaterialApply
);
}
/**
* 新增物品借用申请
*
* @param psaMaterialApply 物品借用申请
* @return 结果
*/
@Transactional
@Override
public
int
insertPsaMaterialApply
(
PsaMaterialApply
psaMaterialApply
)
{
psaMaterialApply
.
setCheckStatus
(
MaterialApplyStatus
.
DSH
.
getValue
());
psaMaterialApply
.
setCreateBy
(
SecurityUtils
.
getUsername
());
psaMaterialApply
.
setCreateTime
(
DateUtils
.
getNowDate
());
psaMaterialApply
.
setDraft
(
AttendanceDraft
.
NO
.
getValue
());
psaMaterialApply
.
setDelFlag
(
AttendanceDelFlag
.
EXIST
.
getValue
());
int
rows
=
psaMaterialApplyMapper
.
insertPsaMaterialApply
(
psaMaterialApply
);
insertPsaMaterialApplyDetail
(
psaMaterialApply
);
return
rows
;
}
/**
* 修改物品借用申请
*
* @param psaMaterialApply 物品借用申请
* @return 结果
*/
@Transactional
@Override
public
int
updatePsaMaterialApply
(
PsaMaterialApply
psaMaterialApply
)
{
psaMaterialApply
.
setUpdateTime
(
DateUtils
.
getNowDate
());
psaMaterialApplyMapper
.
deletePsaMaterialApplyDetailByApplyId
(
psaMaterialApply
.
getId
());
insertPsaMaterialApplyDetail
(
psaMaterialApply
);
return
psaMaterialApplyMapper
.
updatePsaMaterialApply
(
psaMaterialApply
);
}
/**
* 批量删除物品借用申请
*
* @param ids 需要删除的物品借用申请主键
* @return 结果
*/
@Transactional
@Override
public
int
deletePsaMaterialApplyByIds
(
Long
[]
ids
)
{
psaMaterialApplyMapper
.
deletePsaMaterialApplyDetailByApplyIds
(
ids
);
return
psaMaterialApplyMapper
.
deletePsaMaterialApplyByIds
(
ids
);
}
/**
* 删除物品借用申请信息
*
* @param id 物品借用申请主键
* @return 结果
*/
@Transactional
@Override
public
int
deletePsaMaterialApplyById
(
Long
id
)
{
psaMaterialApplyMapper
.
deletePsaMaterialApplyDetailByApplyId
(
id
);
return
psaMaterialApplyMapper
.
deletePsaMaterialApplyById
(
id
);
}
@Override
public
List
<
ProjectUser
>
selectPorjectUser
()
{
return
psaMaterialApplyMapper
.
selectProjectUser
();
}
/**
* 新增物品借用细节信息
*
* @param psaMaterialApply 物品借用申请对象
*/
public
void
insertPsaMaterialApplyDetail
(
PsaMaterialApply
psaMaterialApply
)
{
List
<
PsaMaterialApplyDetail
>
psaMaterialApplyDetailList
=
psaMaterialApply
.
getPsaMaterialApplyDetailList
();
Long
id
=
psaMaterialApply
.
getId
();
if
(
StringUtils
.
isNotNull
(
psaMaterialApplyDetailList
))
{
List
<
PsaMaterialApplyDetail
>
list
=
new
ArrayList
<
PsaMaterialApplyDetail
>();
for
(
PsaMaterialApplyDetail
psaMaterialApplyDetail
:
psaMaterialApplyDetailList
)
{
psaMaterialApplyDetail
.
setApplyId
(
id
);
list
.
add
(
psaMaterialApplyDetail
);
}
if
(
list
.
size
()
>
0
)
{
psaMaterialApplyMapper
.
batchPsaMaterialApplyDetail
(
list
);
}
}
}
}
ruoyi-psa/src/main/java/com/ruoyi/materialentry/controller/PsaMaterialEntryController.java
View file @
24268682
...
...
@@ -98,9 +98,9 @@ public class PsaMaterialEntryController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('psa:entry:remove')"
)
@Log
(
title
=
"物品入库信息"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{id
s
}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
@DeleteMapping
(
"/{id}"
)
public
AjaxResult
remove
(
@PathVariable
Long
id
)
{
return
toAjax
(
psaMaterialEntryService
.
deletePsaMaterialEntryById
s
(
ids
));
return
toAjax
(
psaMaterialEntryService
.
deletePsaMaterialEntryById
(
id
));
}
}
ruoyi-psa/src/main/java/com/ruoyi/materialentry/service/impl/PsaMaterialEntryServiceImpl.java
View file @
24268682
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.materialentry.service.impl;
import
java.util.List
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.material.domain.PsaMaterial
;
import
com.ruoyi.material.mapper.PsaMaterialMapper
;
import
com.ruoyi.materialentry.domain.PsaMaterialEntry
;
import
com.ruoyi.materialentry.mapper.PsaMaterialEntryMapper
;
...
...
@@ -102,6 +103,12 @@ public class PsaMaterialEntryServiceImpl implements IPsaMaterialEntryService
@Override
public
int
deletePsaMaterialEntryById
(
Long
id
)
{
PsaMaterialEntry
psaMaterialEntry
=
psaMaterialEntryMapper
.
selectPsaMaterialEntryById
(
id
);
PsaMaterial
psaMaterial
=
psaMaterialMapper
.
selectPsaMaterialByMaterialId
(
psaMaterialEntry
.
getMaterialId
());
if
(
psaMaterial
.
getStock
()<
psaMaterialEntry
.
getEntryQuantity
())
{
return
0
;
}
psaMaterialMapper
.
minusStock
(
psaMaterialEntry
.
getMaterialId
(),
psaMaterialEntry
.
getEntryQuantity
());
return
psaMaterialEntryMapper
.
deletePsaMaterialEntryById
(
id
);
}
}
ruoyi-psa/src/main/resources/mapper/clock/AttendanceClockMapper.xml
View file @
24268682
...
...
@@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"isClock != null and isClock != ''"
>
and is_clock = #{isClock}
</if>
<if
test=
"checkInStatus != null and checkInStatus != ''"
>
and check_in_status = #{checkInStatus}
</if>
<if
test=
"draft != null and draft != ''"
>
and draft = #{draft}
</if>
<if
test=
"delFlag != null and delFlag != ''"
>
and del_flag = #{delFlag}
</if>
</where>
</select>
...
...
@@ -105,16 +106,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete
id=
"deleteAttendanceClockById"
parameterType=
"Long"
>
delete from attendance_clock where id = #{id}
</delete>
<delete
id=
"deleteAttendanceClockByIds"
parameterType=
"String"
>
delete from attendance_clock where id in
<update
id=
"deleteAttendanceClockById"
parameterType=
"Long"
>
update attendance_clock
set del_flag = 1
where id = #{id}
</update>
<update
id=
"deleteAttendanceClockByIds"
parameterType=
"String"
>
update attendance_clock
set del_flag = 1
where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</
dele
te>
</
upda
te>
<insert
id=
"batchInsertAttendanceClock"
parameterType=
"java.util.List"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into attendance_clock (
...
...
ruoyi-psa/src/main/resources/mapper/material/PsaMaterialApplyMapper.xml
0 → 100644
View file @
24268682
<?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.materialapply.mapper.PsaMaterialApplyMapper"
>
<resultMap
type=
"PsaMaterialApply"
id=
"PsaMaterialApplyResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"projectId"
column=
"project_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"userName"
column=
"user_name"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"checkStatus"
column=
"check_status"
/>
<result
property=
"approvalDate"
column=
"approval_date"
/>
<result
property=
"approvalAdvice"
column=
"approval_advice"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"draft"
column=
"draft"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<!-- 子表集合映射 -->
<collection
property=
"psaMaterialApplyDetailList"
ofType=
"PsaMaterialApplyDetail"
>
<id
property=
"id"
column=
"detail_id"
/>
<result
property=
"applyId"
column=
"apply_id"
/>
<result
property=
"materialTypeId"
column=
"type"
/>
<result
property=
"materialTypeDetailId"
column=
"material_detail"
/>
<result
property=
"applyNumber"
column=
"quantity"
/>
</collection>
</resultMap>
<resultMap
id=
"PsaMaterialApplyPsaMaterialApplyDetailResult"
type=
"PsaMaterialApply"
extends=
"PsaMaterialApplyResult"
>
<collection
property=
"psaMaterialApplyDetailList"
ofType=
"PsaMaterialApplyDetail"
column=
"id"
select=
"selectPsaMaterialApplyDetailList"
/>
</resultMap>
<resultMap
type=
"PsaMaterialApplyDetail"
id=
"PsaMaterialApplyDetailResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"applyId"
column=
"apply_id"
/>
<result
property=
"materialTypeId"
column=
"material_type_id"
/>
<result
property=
"materialTypeDetailId"
column=
"material_type_detail_id"
/>
<result
property=
"applyNumber"
column=
"apply_number"
/>
</resultMap>
<resultMap
type=
"ProjectUser"
id=
"ProjectUserResult"
>
<result
property=
"projectId"
column=
"project_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
</resultMap>
<sql
id=
"selectPsaMaterialApplyVo"
>
SELECT
a.id,
a.project_id,
a.user_id,
a.user_name,
a.remark,
a.check_status,
a.approval_date,
a.approval_advice,
a.create_time,
a.update_time,
a.create_by,
a.update_by,
a.draft,
a.del_flag,
d.id AS detail_id,
d.apply_id,
d.material_type_id AS type,
d.material_type_detail_id AS material_detail,
d.apply_number AS quantity
FROM psa_material_apply a
LEFT JOIN psa_material_apply_detail d ON a.id = d.apply_id
</sql>
<select
id=
"selectPsaMaterialApplyList"
parameterType=
"PsaMaterialApply"
resultMap=
"PsaMaterialApplyResult"
>
<include
refid=
"selectPsaMaterialApplyVo"
/>
<where>
<if
test=
"projectId != null "
>
and project_id = #{projectId}
</if>
<if
test=
"userName != null and userName != ''"
>
and user_name like concat('%', #{userName}, '%')
</if>
<if
test=
"checkStatus != null and checkStatus != ''"
>
and check_status = #{checkStatus}
</if>
<if
test=
"createTime != null "
>
and date(create_time) = #{createTime}
</if>
</where>
</select>
<select
id=
"selectPsaMaterialApplyById"
parameterType=
"Long"
resultMap=
"PsaMaterialApplyPsaMaterialApplyDetailResult"
>
select id, project_id, user_id, user_name, remark, check_status, approval_date, approval_advice, create_time, update_time, create_by, update_by, draft, del_flag
from psa_material_apply
where id = #{id}
</select>
<select
id=
"selectPsaMaterialApplyDetailList"
resultMap=
"PsaMaterialApplyDetailResult"
>
select id, apply_id, material_type_id, material_type_detail_id, apply_number
from psa_material_apply_detail
where apply_id = #{apply_id}
</select>
<select
id=
"selectProjectUser"
resultType=
"com.ruoyi.materialapply.domain.ProjectUser"
resultMap=
"ProjectUserResult"
>
select project_id,user_id from project_member
</select>
<insert
id=
"insertPsaMaterialApply"
parameterType=
"PsaMaterialApply"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into psa_material_apply
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"projectId != null"
>
project_id,
</if>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"userName != null"
>
user_name,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"checkStatus != null"
>
check_status,
</if>
<if
test=
"approvalDate != null"
>
approval_date,
</if>
<if
test=
"approvalAdvice != null"
>
approval_advice,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"draft != null"
>
draft,
</if>
<if
test=
"delFlag != null"
>
del_flag,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"projectId != null"
>
#{projectId},
</if>
<if
test=
"userId != null"
>
#{userId},
</if>
<if
test=
"userName != null"
>
#{userName},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"checkStatus != null"
>
#{checkStatus},
</if>
<if
test=
"approvalDate != null"
>
#{approvalDate},
</if>
<if
test=
"approvalAdvice != null"
>
#{approvalAdvice},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"draft != null"
>
#{draft},
</if>
<if
test=
"delFlag != null"
>
#{delFlag},
</if>
</trim>
</insert>
<update
id=
"updatePsaMaterialApply"
parameterType=
"PsaMaterialApply"
>
update psa_material_apply
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"projectId != null"
>
project_id = #{projectId},
</if>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"userName != null"
>
user_name = #{userName},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"checkStatus != null"
>
check_status = #{checkStatus},
</if>
<if
test=
"approvalDate != null"
>
approval_date = #{approvalDate},
</if>
<if
test=
"approvalAdvice != null"
>
approval_advice = #{approvalAdvice},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"draft != null"
>
draft = #{draft},
</if>
<if
test=
"delFlag != null"
>
del_flag = #{delFlag},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deletePsaMaterialApplyById"
parameterType=
"Long"
>
delete from psa_material_apply where id = #{id}
</delete>
<delete
id=
"deletePsaMaterialApplyByIds"
parameterType=
"String"
>
delete from psa_material_apply where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<delete
id=
"deletePsaMaterialApplyDetailByApplyIds"
parameterType=
"String"
>
delete from psa_material_apply_detail where apply_id in
<foreach
item=
"applyId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{applyId}
</foreach>
</delete>
<delete
id=
"deletePsaMaterialApplyDetailByApplyId"
parameterType=
"Long"
>
delete from psa_material_apply_detail where apply_id = #{applyId}
</delete>
<insert
id=
"batchPsaMaterialApplyDetail"
>
insert into psa_material_apply_detail( id, apply_id, material_type_id, material_type_detail_id, apply_number) values
<foreach
item=
"item"
index=
"index"
collection=
"list"
separator=
","
>
( #{item.id}, #{item.applyId}, #{item.materialTypeId}, #{item.materialTypeDetailId}, #{item.applyNumber})
</foreach>
</insert>
</mapper>
\ No newline at end of file
ruoyi-psa/src/main/resources/mapper/material/PsaMaterialMapper.xml
View file @
24268682
...
...
@@ -138,11 +138,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INSERT INTO psa_material_type_detail (type_id, material_name)
VALUES (#{typeId}, #{materialName})
</insert>
<
insert
id=
"addStock"
>
<
update
id=
"addStock"
>
UPDATE psa_material
SET stock = stock + #{entryQuantity}
WHERE material_id = #{materialId};
</insert>
</update>
<update
id=
"minusStock"
>
UPDATE psa_material
SET stock = stock - #{minusQuantity}
WHERE material_id = #{materialId};
</update>
<update
id=
"updatePsaMaterial"
parameterType=
"PsaMaterial"
>
update psa_material
...
...
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