领料申请通过流程

This commit is contained in:
liang.chao 2024-02-21 19:24:08 +08:00
parent 51d2ae84ca
commit fc31e413c9
8 changed files with 177 additions and 42 deletions

View File

@ -124,7 +124,7 @@ public class TokenController {
@PostMapping("register")
public R<?> register(@RequestBody RegisterBody registerBody) {
// 用户注册
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
sysLoginService.register(registerBody);
return R.ok();
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.auth.service;
import com.bonus.sgzb.auth.form.RegisterBody;
import com.bonus.sgzb.common.core.constant.CacheConstants;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.constant.SecurityConstants;
@ -199,7 +200,10 @@ public class SysLoginService {
/**
* 注册
*/
public void register(String username, String password) {
public void register(RegisterBody registerBody) {
String username = registerBody.getUsername();
String password = registerBody.getPassword();
String phone = registerBody.getPhone();
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) {
throw new ServiceException("用户/密码必须填写");
@ -218,6 +222,7 @@ public class SysLoginService {
sysUser.setUserName(username);
sysUser.setNickName(username);
sysUser.setPassword(SecurityUtils.encryptPassword(password));
sysUser.setPhonenumber(phone);
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
if (R.FAIL == registerResult.getCode()) {

View File

@ -334,7 +334,8 @@ public class TmTaskController extends BaseController {
util.exportExcel(response, leaseAuditList, "领料申请数据");
} else {
//领料管理的数据
List<TmTaskDto> tmTaskDtos = Convert.toList(TmTaskDto.class, leaseAuditList);
List<TmTask> leaseAuditManageList = tmTaskService.getLeaseAuditManageList(task);
List<TmTaskDto> tmTaskDtos = Convert.toList(TmTaskDto.class, leaseAuditManageList);
ExcelUtil<TmTaskDto> util = new ExcelUtil<TmTaskDto>(TmTaskDto.class);
util.exportExcel(response, tmTaskDtos, "领料管理数据");
}
@ -356,7 +357,7 @@ public class TmTaskController extends BaseController {
if (StringUtils.isNotBlank(role)) {
if (role.contains("admin")) {
//如果是管理员可以看到所有的审核列表
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditList(task);
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditListByAdmin(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}
String[] split = role.split(",");
@ -416,7 +417,7 @@ public class TmTaskController extends BaseController {
return AjaxResult.error("参数错误");
}
startPage();
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditList(task);
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditListByOne(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}

View File

@ -41,6 +41,8 @@ public interface TmTaskMapper {
/** 更新LeaseApplyInfo审批信息 */
int updateLeaseApplyInfoAuditInfo(@Param("record") LeaseApplyInfo record);
List<LeaseApplyInfo> getLeaseApplyInfo(Integer taskId);
/** 更新LeaseApplyInfo驳回信息 */
int updateLeaseApplyInfoRejectInfo(@Param("record") LeaseApplyInfo record);

View File

@ -18,6 +18,9 @@ import java.util.List;
public interface TmTaskService{
List<TmTask> getLeaseAuditList(TmTask record);
List<TmTask> getLeaseAuditListByOne(TmTask record);
List<TmTask> getLeaseAuditListByAdmin(TmTask record);
List<TmTask> getLeaseAuditManageList(TmTask record);

View File

@ -6,12 +6,10 @@ import com.bonus.sgzb.app.domain.LeaseApplyInfo;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.mapper.TmTaskMapper;
import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.base.domain.MaintenanceGang;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.system.api.domain.SysUser;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -21,6 +19,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -46,9 +45,9 @@ public class TmTaskServiceImpl implements TmTaskService {
@Transactional
public int updateLeaseTaskAuditInfo(TmTask record) {
int result = 0;
int taskId = 0;
int num = 0;
if (StringUtils.isNotNull(record)) {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 内部审核
if (record.getTaskStatus() == 33) {
Integer companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue();
@ -58,12 +57,24 @@ public class TmTaskServiceImpl implements TmTaskService {
List<LeaseApplyInfo> applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId)).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().equals("1") || applyInfo.getStatus().equals("3")) {
num++;
}
}
//说明全部审核完成
if (num == leaseApplyInfo.size()) {
// 再审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
}
}
// 再审核领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = record.getLeaseApplyDetails();
@ -78,6 +89,8 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
} else {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 分公司和分管审核
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
@ -110,6 +123,46 @@ public class TmTaskServiceImpl implements TmTaskService {
* 获取领料申请列表
*/
@Override
public List<TmTask> getLeaseAuditListByOne(TmTask record) {
List<TmTask> tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
for (TmTask tmTask : tmTaskList) {
int count = 0;
if (tmTask != null) {
// 去查询任务分单表
List<LeaseApplyInfo> auditListByLeaseInfo = tmTaskMapper.getAuditListByLeaseInfo(tmTask);
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
if (leaseApplyDetail != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
}
}
}
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
}
// 塞入预领的合计数量
tmTask.setPreCountNum(count);
}
}
return tmTaskList;
}
/**
* 获取单个申请列表
*/
@Override
public List<TmTask> getLeaseAuditList(TmTask record) {
List<TmTask> collect = tmTaskMapper.getAuditListByLeaseTmTask(record);
String username = SecurityUtils.getLoginUser().getUsername();
@ -148,6 +201,46 @@ public class TmTaskServiceImpl implements TmTaskService {
return tmTaskList;
}
/**
* 获取领料申请列表
*/
@Override
public List<TmTask> getLeaseAuditListByAdmin(TmTask record) {
List<TmTask> tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
for (TmTask tmTask : tmTaskList) {
int count = 0;
if (tmTask != null) {
// 去查询任务分单表
List<LeaseApplyInfo> auditListByLeaseInfo = tmTaskMapper.getAuditListByLeaseInfo(tmTask);
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
if (leaseApplyDetail != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
}
}
}
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
}
// 塞入预领的合计数量
tmTask.setPreCountNum(count);
}
}
return tmTaskList;
}
/**
* 获取领料管理列表
*/
@ -160,6 +253,28 @@ public class TmTaskServiceImpl implements TmTaskService {
if (tmTask != null) {
// 去查询任务分单表
List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask);
//管理员可以看到所有数据
if (roles.contains("admin")) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : collect) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
if (leaseApplyDetail != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
}
}
}
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(collect);
}
//施管部只能看到机具分公司101的数据
if (roles.contains("sgb")) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
@ -214,7 +329,8 @@ public class TmTaskServiceImpl implements TmTaskService {
tmTask.setPreCountNum(count);
}
}
return tmTaskList;
List<TmTask> tmTasks = tmTaskList.stream().filter(t -> t.getLeaseApplyInfoList() != null).collect(Collectors.toList());
return tmTasks;
}
/**
@ -482,9 +598,9 @@ public class TmTaskServiceImpl implements TmTaskService {
List<LeaseApplyDetails> listLeaseDetails = new ArrayList<>();
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) {
if (leaseApplyInfo != null) {
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
/* SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
//获取当前用户所属公司id
Long companyId = sysUser.getCompanyId();
Long companyId = sysUser.getCompanyId();*/
//获取当前用户的角色
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
StringBuilder sb = new StringBuilder();
@ -493,8 +609,12 @@ public class TmTaskServiceImpl implements TmTaskService {
}
String rolesStr = sb.toString();
//如果是内部人员加上所属公司
if ((rolesStr.contains("jjfgs") && !rolesStr.contains("admin")) || (rolesStr.contains("tsfgs") && !rolesStr.contains("admin"))) {
leaseApplyInfo.setCompanyId(Integer.parseInt(companyId.toString()));
if ((rolesStr.contains("jjfgs") && !rolesStr.contains("admin"))) {
leaseApplyInfo.setCompanyId(101);
}
//如果是内部人员加上所属公司
if ((rolesStr.contains("tsfgs") && !rolesStr.contains("admin"))) {
leaseApplyInfo.setCompanyId(102);
}
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);

View File

@ -643,7 +643,7 @@
LEFT JOIN sys_user su2 ON lai.company_audit_by = su2.user_id
LEFT JOIN sys_user su3 ON lai.dept_audit_by = su3.user_id
LEFT JOIN sys_user su4 ON lai.direct_audit_by = su4.user_id
WHERE tt.task_id = #{taskId}
WHERE tt.task_id = #{taskId} limit 1
</select>
<select id="getLeaseListByLeaseInfo" resultType="com.bonus.sgzb.app.domain.LeaseApplyInfo">
@ -695,7 +695,7 @@
</if>
</trim>
WHERE
task_id = #{record.taskId}
task_id = #{record.taskId} and company_id = #{record.companyId}
</update>
<update id="updateLeaseApplyInfoRejectInfo">
@ -795,5 +795,9 @@
from ma_type_keeper mtk
where mtk.type_id = #{typeId}
</select>
<select id="getLeaseApplyInfo" resultType="com.bonus.sgzb.app.domain.LeaseApplyInfo">
SELECT * FROM `lease_apply_info`
WHERE task_id = #{taskId} AND `status` ='1'
</select>
</mapper>

View File

@ -189,7 +189,7 @@ public class SysUserController extends BaseController
* 根据用户编号获取详细信息
*/
@RequiresPermissions("system:user:query")
@GetMapping(value = { "/", "/{userId}" })
@GetMapping(value = { "", "/{userId}" })
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{
userService.checkUserDataScope(userId);