领料申请代码codeview
This commit is contained in:
parent
ecdacc0143
commit
2c14888e0d
|
|
@ -62,7 +62,6 @@ public class TmTaskController extends BaseController {
|
|||
@Resource
|
||||
private ITypeService iTypeService;
|
||||
|
||||
private final static String STRING_ADMIN = "admin";
|
||||
|
||||
/**
|
||||
* 领料审核通过,分公司,分管,机具分公司统一接口
|
||||
|
|
@ -238,7 +237,7 @@ public class TmTaskController extends BaseController {
|
|||
System.out.println("领料任务创建成功");
|
||||
leaseUserBookService.batchDel(ids);
|
||||
} else {
|
||||
System.out.println("领料任务创建成功,但领料任务明细插入失败");
|
||||
logger.error("领料任务创建成功,但领料任务明细插入失败");
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("领料任务编号为空");
|
||||
|
|
@ -358,24 +357,15 @@ public class TmTaskController extends BaseController {
|
|||
if (StringUtils.isNull(task)) {
|
||||
return AjaxResult.error("参数错误");
|
||||
}
|
||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||
List<TmTask> leaseAuditList;
|
||||
if (souceBy != null && souceBy == 1) {
|
||||
if (roles.contains(STRING_ADMIN)) {
|
||||
leaseAuditList = tmTaskService.getLeaseAuditList(task);
|
||||
return AjaxResult.success(leaseAuditList);
|
||||
} else {
|
||||
leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task);
|
||||
}
|
||||
return AjaxResult.success(getDataTable(leaseAuditList));
|
||||
}
|
||||
startPage();
|
||||
if (roles.contains(STRING_ADMIN)) {
|
||||
leaseAuditList = tmTaskService.getLeaseAuditList(task);
|
||||
} else {
|
||||
leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task);
|
||||
}
|
||||
return AjaxResult.success(getDataTable(leaseAuditList));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -438,14 +428,9 @@ public class TmTaskController extends BaseController {
|
|||
@PostMapping("/applyExport")
|
||||
public void applyExport(HttpServletResponse response, TmTask task) {
|
||||
List<TmTask> leaseAuditList = new ArrayList<>();
|
||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 领料申请导出
|
||||
if (task.getTypes() == 1) {
|
||||
if (roles.contains(STRING_ADMIN)) {
|
||||
leaseAuditList = tmTaskService.getLeaseAuditList(task);
|
||||
} else {
|
||||
leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task);
|
||||
}
|
||||
ExcelUtil<TmTask> util = new ExcelUtil<TmTask>(TmTask.class);
|
||||
util.exportExcel(response, leaseAuditList, "领料申请数据");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -96,8 +96,6 @@ public interface TmTaskService{
|
|||
|
||||
LeaseApplyInfo getListSomeol(LeaseApplyInfo info);
|
||||
|
||||
List<TmTask> getLeaseAuditListByPeople(TmTask task);
|
||||
|
||||
List<TmTask> getLeaseAuditManageListCq(TmTask task);
|
||||
|
||||
List<TmTask> getLeaseListAllCq(TmTask task);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
@Resource
|
||||
private BmFlowRecordService bmFlowRecordService;
|
||||
|
||||
private final static String STRING_ADMIN = "admin";
|
||||
|
||||
/**
|
||||
* 领料任务审核状态
|
||||
*
|
||||
|
|
@ -418,7 +420,15 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
*/
|
||||
@Override
|
||||
public List<TmTask> getLeaseAuditList(TmTask record) {
|
||||
List<TmTask> tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
|
||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||
List<TmTask> tmTaskList;
|
||||
if (roles.contains(STRING_ADMIN)) {
|
||||
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
|
||||
} else {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
record.setCreateBy(username);
|
||||
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(record);
|
||||
}
|
||||
for (TmTask tmTask : tmTaskList) {
|
||||
int count = 0;
|
||||
if (tmTask != null) {
|
||||
|
|
@ -454,49 +464,6 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
return tmTaskList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人申请列表
|
||||
*/
|
||||
@Override
|
||||
public List<TmTask> getLeaseAuditListByPeople(TmTask record) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
record.setCreateBy(username);
|
||||
List<TmTask> tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(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.setRemark(auditListByLeaseInfo.get(0).getRemark());
|
||||
}
|
||||
// 塞入预领的合计数量
|
||||
tmTask.setPreCountNum(count);
|
||||
}
|
||||
}
|
||||
|
||||
return tmTaskList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TmTask> getLeaseAuditManageListCq(TmTask record) {
|
||||
List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 新购验收任务Service业务层处理
|
||||
|
|
@ -121,18 +120,25 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
@Override
|
||||
public List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo) {
|
||||
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfo);
|
||||
Map<Long, PurchaseCheckInfo> taskIdInfoMap = new HashMap<>(); // 缓存查询结果,避免重复查询
|
||||
for (PurchaseCheckInfo checkInfo : purchaseCheckInfos) {
|
||||
String typeName = "";
|
||||
List<PurchaseCheckInfo> list = purchaseCheckInfoMapper.selectTypeNameAndManageTypeByTaskId(checkInfo.getTaskId());
|
||||
if (list.size() > 0) {
|
||||
typeName = list.get(0).getPurchasingTypeName();
|
||||
if (list.get(0).getManageType().contains("0")) {
|
||||
checkInfo.setManageType("0");
|
||||
} else {
|
||||
checkInfo.setManageType("1");
|
||||
// 判断是否已经查询过该taskId的结果,如果没有,进行查询并缓存
|
||||
if (!taskIdInfoMap.containsKey(checkInfo.getTaskId())) {
|
||||
List<PurchaseCheckInfo> taskInfoList = purchaseCheckInfoMapper.selectTypeNameAndManageTypeByTaskId(checkInfo.getTaskId());
|
||||
if (!taskInfoList.isEmpty()) {
|
||||
taskIdInfoMap.put(checkInfo.getTaskId(), taskInfoList.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
// 获取缓存中的查询结果,进行处理
|
||||
Optional<PurchaseCheckInfo> optionalInfo = Optional.ofNullable(taskIdInfoMap.get(checkInfo.getTaskId()));
|
||||
if (optionalInfo.isPresent()) {
|
||||
PurchaseCheckInfo taskInfo = optionalInfo.get();
|
||||
String typeName = taskInfo.getPurchasingTypeName();
|
||||
String manageType = taskInfo.getManageType().contains("0") ? "0" : "1";
|
||||
checkInfo.setPurchasingTypeName(typeName);
|
||||
checkInfo.setManageType(manageType);
|
||||
}
|
||||
}
|
||||
return purchaseCheckInfos;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue