退料申请表数据问题修改

This commit is contained in:
liang.chao 2024-02-27 13:20:31 +08:00
parent f77902ad2c
commit 747640caba
5 changed files with 188 additions and 29 deletions

View File

@ -473,7 +473,7 @@ public class TmTaskController extends BaseController {
//先判断 目前数据库有几个公司
List<LeaseApplyInfo> list = tmTaskService.getListSome(task.getTaskId());
LeaseApplyInfo infoAdd = new LeaseApplyInfo();
if (list.size() < 2) {
/* if (list.size() < 2) {
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId");
infoAdd.setTaskId(task.getTaskId().intValue());
infoAdd.setCode(task.getLeaseApplyInfoList().get(0).getCode());
@ -492,7 +492,7 @@ public class TmTaskController extends BaseController {
}
}
}
}
}*/
LeaseApplyInfo bean = new LeaseApplyInfo();
bean.setTaskId(task.getTaskId().intValue());
bean.setLeasePerson(task.getLeaseApplyInfo().getLeasePerson());
@ -547,7 +547,7 @@ public class TmTaskController extends BaseController {
}
@Log(title = "获取领料申请-详情列表", businessType = BusinessType.QUERY)
@Log(title = "获取领料管理-详情列表", businessType = BusinessType.QUERY)
@GetMapping("/getLeaseListAll")
public TableDataInfo getLeaseListAll(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId) {
TmTask task = new TmTask();
@ -556,4 +556,13 @@ public class TmTaskController extends BaseController {
return getDataTable(leaseAuditList);
}
@Log(title = "获取领料申请-详情列表", businessType = BusinessType.QUERY)
@GetMapping("/getLeaseApplyListAll")
public TableDataInfo getLeaseApplyListAll(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId) {
TmTask task = new TmTask();
task.setTaskId(Long.parseLong(taskId));
List<TmTask> leaseAuditList = tmTaskService.getLeaseApplyListAll(task);
return getDataTable(leaseAuditList);
}
}

View File

@ -99,6 +99,7 @@ public interface TmTaskMapper {
Integer getAgreementIdByUnit(TmTask task);
List<LeaseApplyInfo> getLeaseListByLeaseInfo(TmTask task);
List<LeaseApplyDetails> getLeaseApplyDetailsByApply(@Param("record") LeaseApplyInfo record);
void updateLeaseInfo(LeaseApplyInfo task);

View File

@ -68,6 +68,7 @@ public interface TmTaskService{
int insertAgreement(TmTask record);
List<TmTask> getLeaseListAll(TmTask task);
List<TmTask> getLeaseApplyListAll(TmTask task);
void updateLeaseInfo(LeaseApplyInfo task);

View File

@ -50,14 +50,14 @@ public class TmTaskServiceImpl implements TmTaskService {
int result = 0;
int taskId = 0;
int num = 0;
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
if (StringUtils.isNotNull(record)) {
// 内部审核
if (record.getTaskStatus() == 33) {
Integer companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue();
if (record.getTaskStatus() == 33 && companyId != null) {
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
List<LeaseApplyInfo> applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId)).collect(Collectors.toList());
List<LeaseApplyInfo> applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId.intValue())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(applyInfoList)) {
for (LeaseApplyInfo leaseApplyInfo : applyInfoList) {
taskId = leaseApplyInfo.getTaskId();
@ -84,7 +84,47 @@ public class TmTaskServiceImpl implements TmTaskService {
// 再审核领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = record.getLeaseApplyDetails();
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
List<LeaseApplyDetails> collect = leaseApplyDetails.stream().filter(d -> d.getCompanyId().equals(companyId)).collect(Collectors.toList());
List<LeaseApplyDetails> collect = leaseApplyDetails.stream().filter(d -> d.getCompanyId().equals(companyId.intValue())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
for (LeaseApplyDetails details : collect) {
if (StringUtils.isNotNull(details)) {
result += tmTaskMapper.updateLeaseApplyDetailsAuditInfo(details);
}
}
}
}
} else if (record.getTaskStatus() == 32 && companyId != null) {
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
List<LeaseApplyInfo> applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId.intValue())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(applyInfoList)) {
for (LeaseApplyInfo leaseApplyInfo : applyInfoList) {
taskId = leaseApplyInfo.getTaskId();
if (leaseApplyInfo != null) {
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
result += tmTaskMapper.updateLeaseApplyInfoAuditInfo(leaseApplyInfo);
}
}
}
List<LeaseApplyInfo> leaseApplyInfo = tmTaskMapper.getLeaseApplyInfo(taskId);
for (LeaseApplyInfo applyInfo : leaseApplyInfo) {
if (applyInfo.getStatus() != null) {
if (applyInfo.getStatus().equals("5") || applyInfo.getStatus().equals("7")) {
num++;
}
}
}
//说明全部审核完成
if (num == leaseApplyInfo.size()) {
// 再审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
}
}
// 再审核领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = record.getLeaseApplyDetails();
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
List<LeaseApplyDetails> collect = leaseApplyDetails.stream().filter(d -> d.getCompanyId().equals(companyId.intValue())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
for (LeaseApplyDetails details : collect) {
if (StringUtils.isNotNull(details)) {
@ -96,7 +136,7 @@ public class TmTaskServiceImpl implements TmTaskService {
} else {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 分公司和分管审核
// 分公司审核
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
@ -293,14 +333,15 @@ public class TmTaskServiceImpl implements TmTaskService {
@Override
public List<TmTask> getLeaseAuditManageList(TmTask record) {
List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
for (TmTask tmTask : tmTaskList) {
int count = 0;
if (tmTask != null) {
// 去查询任务分单表
List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask);
//管理员可以看到所有数据
if (roles.contains("admin")) {
//没有companyId的用户可以看到所有数据
if (companyId == null) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : collect) {
if (leaseApplyInfo != null) {
@ -322,8 +363,8 @@ public class TmTaskServiceImpl implements TmTaskService {
tmTask.setLeaseApplyInfoList(collect);
}
//施管部只能看到机具分公司101的数据
if (roles.contains("sgb")) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
if ((roles.contains("jjfgs") || roles.contains("sgb")) && companyId != null) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() == companyId.intValue()).collect(Collectors.toList());
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
@ -347,8 +388,8 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
//安监部只能看到设备分公司102的数据
if (roles.contains("ajb")) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() == 102).collect(Collectors.toList());
if ((roles.contains("tsfgs") || roles.contains("ajb")) && companyId != null) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() == companyId.intValue()).collect(Collectors.toList());
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
@ -434,18 +475,20 @@ public class TmTaskServiceImpl implements TmTaskService {
@Transactional
public int updateLeaseTaskRejectInfo(TmTask record) {
int result = 0;
int taskId = 0;
int num = 0;
Integer companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue();
if (StringUtils.isNotNull(record)) {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 内部审核驳回
if (record.getTaskStatus() == 100) {
Integer companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue();
if (record.getTaskStatus() == 100 && companyId != null) {
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
List<LeaseApplyInfo> applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(applyInfoList)) {
for (LeaseApplyInfo leaseApplyInfo : record.getLeaseApplyInfoList()) {
for (LeaseApplyInfo leaseApplyInfo : applyInfoList) {
if (leaseApplyInfo != null) {
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
result += tmTaskMapper.updateLeaseApplyInfoRejectInfo(leaseApplyInfo);
@ -453,6 +496,59 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
}
List<LeaseApplyInfo> leaseApplyInfo = tmTaskMapper.getLeaseApplyInfo(taskId);
for (LeaseApplyInfo applyInfo : leaseApplyInfo) {
if (applyInfo.getStatus() != null) {
if (applyInfo.getStatus().equals("2") || applyInfo.getStatus().equals("4")) {
num++;
}
}
}
//说明全部审核完成
if (num == leaseApplyInfo.size()) {
// 再审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
}
}
// 再审核领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = record.getLeaseApplyDetails();
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
List<LeaseApplyDetails> collect = leaseApplyDetails.stream().filter(d -> d.getCompanyId().equals(companyId)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
for (LeaseApplyDetails details : collect) {
if (StringUtils.isNotNull(details)) {
result += tmTaskMapper.updateLeaseApplyDetailsRejectInfo(details);
}
}
}
}
} else if (record.getTaskStatus() == 99 && companyId != null) {
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
List<LeaseApplyInfo> applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(applyInfoList)) {
for (LeaseApplyInfo leaseApplyInfo : applyInfoList) {
if (leaseApplyInfo != null) {
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
result += tmTaskMapper.updateLeaseApplyInfoRejectInfo(leaseApplyInfo);
}
}
}
List<LeaseApplyInfo> leaseApplyInfo = tmTaskMapper.getLeaseApplyInfo(taskId);
for (LeaseApplyInfo applyInfo : leaseApplyInfo) {
if (applyInfo.getStatus() != null) {
if (applyInfo.getStatus().equals("6") || applyInfo.getStatus().equals("8")) {
num++;
}
}
}
//说明全部审核完成
if (num == leaseApplyInfo.size()) {
// 再审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
}
}
// 再审核领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = record.getLeaseApplyDetails();
@ -467,7 +563,9 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
} else {
// 分公司和分管驳回
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 分公司驳回
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
@ -488,7 +586,6 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
}
} else {
return 0;
}
@ -637,6 +734,7 @@ public class TmTaskServiceImpl implements TmTaskService {
public List<TmTask> getLeaseListAll(TmTask task) {
List<TmTask> tmTaskList = new ArrayList<>();
TmTask tmTask = tmTaskMapper.getLeaseListTmTask(task);
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
if (tmTask != null) {
List<LeaseApplyInfo> leaseApplyInfoList = tmTaskMapper.getLeaseListByLeaseInfo(task);
List<LeaseApplyInfo> leaseApplyInfoList2 = tmTaskMapper.getLeaseListByLeaseInfo(task);
@ -647,19 +745,19 @@ public class TmTaskServiceImpl implements TmTaskService {
List<LeaseApplyDetails> listLeaseDetails = new ArrayList<>();
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList2) {
if (leaseApplyInfo != null) {
/* SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
//获取当前用户所属公司id
Long companyId = sysUser.getCompanyId();*/
//获取当前用户的角色
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
//如果是内部人员加上所属公司
if ((roles.contains("jjfgs") && !roles.contains("admin"))) {
leaseApplyInfo.setCompanyId(101);
if (roles.contains("jjfgs") || roles.contains("sgb")) {
if (companyId != null) {
leaseApplyInfo.setCompanyId(companyId.intValue());
}
}
//如果是内部人员加上所属公司
if ((roles.contains("tsfgs") && !roles.contains("admin"))) {
leaseApplyInfo.setCompanyId(102);
if (roles.contains("tsfgs") || roles.contains("ajb")) {
if (companyId != null) {
leaseApplyInfo.setCompanyId(companyId.intValue());
}
}
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
@ -675,6 +773,37 @@ public class TmTaskServiceImpl implements TmTaskService {
return tmTaskList;
}
@Override
public List<TmTask> getLeaseApplyListAll(TmTask task) {
List<TmTask> tmTaskList = new ArrayList<>();
TmTask tmTask = tmTaskMapper.getLeaseListTmTask(task);
List<LeaseApplyInfo> leaseApplyInfos = new ArrayList<>();
if (tmTask != null) {
List<LeaseApplyInfo> leaseApplyInfoList = tmTaskMapper.getLeaseListByLeaseInfo(task);
for (LeaseApplyInfo applyInfo : leaseApplyInfoList) {
if ("2".equals(applyInfo.getStatus()) || "4".equals(applyInfo.getStatus()) || "6".equals(applyInfo.getStatus()) || "8".equals(applyInfo.getStatus())) {
leaseApplyInfos.add(applyInfo);
}
}
tmTask.setLeaseApplyInfoList(leaseApplyInfoList);
List<LeaseApplyDetails> listLeaseDetails = new ArrayList<>();
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfos) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsByApply(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
listLeaseDetails.addAll(leaseApplyDetails);
}
}
}
// 塞入领料任务详情的集合中
tmTask.setLeaseApplyDetails(listLeaseDetails);
}
tmTaskList.add(tmTask);
return tmTaskList;
}
@Override
public void updateLeaseInfo(LeaseApplyInfo task) {
tmTaskMapper.updateLeaseInfo(task);

View File

@ -550,6 +550,7 @@
<if test="record.keyWord != null and record.keyWord != ''">
AND bai.agreement_code like concat('%', #{record.keyWord}, '%')
</if>
GROUP BY tt.task_id
ORDER BY tt.update_time DESC
</select>
@ -674,6 +675,7 @@
dept_audit_by = #{record.companyAuditBy},
dept_audit_time = now(),
dept_audit_remark = #{record.companyAuditRemark},
status = #{record.status},
</if>
<if test="record.examineStatusId == 32 and record.examineStatusId == '32'">
direct_audit_by = #{record.companyAuditBy},
@ -712,6 +714,7 @@
dept_audit_by = #{record.companyAuditBy},
dept_audit_time = now(),
dept_audit_remark = #{record.companyAuditRemark},
status = #{record.status},
</if>
<if test="record.examineStatusId == 100 and record.examineStatusId == '100'">
direct_audit_by = #{record.companyAuditBy},
@ -782,7 +785,7 @@
<select id="getListSome" resultType="com.bonus.sgzb.app.domain.LeaseApplyInfo">
SELECT * FROM `lease_apply_info`
WHERE task_id = #{taskId} AND `status` ='1'
WHERE task_id = #{taskId}
</select>
<select id="getListSomeol" resultType="com.bonus.sgzb.app.domain.LeaseApplyInfo">
@ -848,5 +851,21 @@
</if>
ORDER BY tt.update_time DESC
</select>
<select id="getLeaseApplyDetailsByApply" resultType="com.bonus.sgzb.app.domain.LeaseApplyDetails">
SELECT
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName, mt.manage_type as manageType,
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
mt.num, (lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum,mm.ma_code as maCode
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ma_machine mm ON lad.type_id = mm.type_id
WHERE
lad.parennt_id = #{record.id}
GROUP BY
lad.id
</select>
</mapper>