重庆机具退料新接口,优化代码结构
This commit is contained in:
parent
18b0804b2c
commit
5a01e0bb4d
|
|
@ -6,9 +6,10 @@ import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||||
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
|
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
|
||||||
import com.bonus.sgzb.app.domain.TmTask;
|
import com.bonus.sgzb.app.domain.TmTask;
|
||||||
import com.bonus.sgzb.app.domain.TmTaskDto;
|
import com.bonus.sgzb.app.domain.TmTaskDto;
|
||||||
import com.bonus.sgzb.app.service.*;
|
import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
|
||||||
import com.bonus.sgzb.base.api.domain.BmFlowRecord;
|
import com.bonus.sgzb.app.service.LeaseApplyInfoService;
|
||||||
import com.bonus.sgzb.base.api.domain.BmFlowRelation;
|
import com.bonus.sgzb.app.service.LeaseUserBookService;
|
||||||
|
import com.bonus.sgzb.app.service.TmTaskService;
|
||||||
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
|
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
|
||||||
import com.bonus.sgzb.common.core.utils.ServletUtils;
|
import com.bonus.sgzb.common.core.utils.ServletUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
|
|
@ -27,7 +28,6 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -44,26 +44,20 @@ import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE;
|
||||||
public class TmTaskController extends BaseController {
|
public class TmTaskController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务对象
|
* 任务表Service
|
||||||
*/
|
*/
|
||||||
// 任务表Service
|
|
||||||
@Resource
|
@Resource
|
||||||
private TmTaskService tmTaskService;
|
private TmTaskService tmTaskService;
|
||||||
|
|
||||||
// 领料申请表Service
|
/**
|
||||||
|
* 领料申请信息表service
|
||||||
|
*/
|
||||||
@Resource
|
@Resource
|
||||||
private LeaseApplyInfoService leaseApplyInfoService;
|
private LeaseApplyInfoService leaseApplyInfoService;
|
||||||
|
|
||||||
// 领料申请明细表Service
|
|
||||||
@Resource
|
@Resource
|
||||||
private LeaseApplyDetailsService leaseApplyDetailsService;
|
private LeaseApplyDetailsService leaseApplyDetailsService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private BmFlowRelationService bmFlowRelationService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private BmFlowRecordService bmFlowRecordService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LeaseUserBookService leaseUserBookService;
|
private LeaseUserBookService leaseUserBookService;
|
||||||
|
|
||||||
|
|
@ -95,8 +89,7 @@ public class TmTaskController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领料审核驳回,分公司,分管,机具分公司统一接口
|
* 领料审核驳回,分公司,分管,机具分公司统一接口
|
||||||
*
|
* @param task 任务信息
|
||||||
* @param task
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Log(title = "宁夏领料审核驳回", businessType = BusinessType.UPDATE)
|
@Log(title = "宁夏领料审核驳回", businessType = BusinessType.UPDATE)
|
||||||
|
|
@ -108,8 +101,8 @@ public class TmTaskController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 领料审核驳回,分公司,分管,机具分公司统一接口
|
* 领料审核驳回,分公司,分管,机具分公司统一接口
|
||||||
*
|
*
|
||||||
* @param task
|
* @param task 任务信息表
|
||||||
* @return
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Log(title = "重庆领料审核驳回", businessType = BusinessType.UPDATE)
|
@Log(title = "重庆领料审核驳回", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("rejectLeaseByCompanyCq")
|
@PostMapping("rejectLeaseByCompanyCq")
|
||||||
|
|
@ -158,105 +151,8 @@ public class TmTaskController extends BaseController {
|
||||||
if (CollUtil.isEmpty(task.getLeaseApplyDetails())) {
|
if (CollUtil.isEmpty(task.getLeaseApplyDetails())) {
|
||||||
return AjaxResult.error("领料设备明细为空,请重新选择后上传!");
|
return AjaxResult.error("领料设备明细为空,请重新选择后上传!");
|
||||||
}
|
}
|
||||||
|
// ------校验结束--执行service-------
|
||||||
// ---------审批流校验---------
|
return tmTaskService.createFlowLeaseApply(task);
|
||||||
// 查询当前任务类型的审批流配置
|
|
||||||
BmFlowRelation bmFlowRelation = new BmFlowRelation();
|
|
||||||
// 赋值任务类型
|
|
||||||
bmFlowRelation.setTaskType(29);
|
|
||||||
// 赋值组织机构
|
|
||||||
bmFlowRelation.setCompanyId(task.getCompanyId());
|
|
||||||
List<BmFlowRelation> bmFlowRelationList = bmFlowRelationService.selectAllByPrimaryKey(bmFlowRelation);
|
|
||||||
// 校验审批流配置
|
|
||||||
if (CollUtil.isEmpty(bmFlowRelationList)) {
|
|
||||||
return AjaxResult.error("当前任务类型审批流配置为空,请联系管理员");
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------开始处理审批流 -------------
|
|
||||||
|
|
||||||
// 使用lambda表达式 按order字段从小到大进行排序
|
|
||||||
try {
|
|
||||||
bmFlowRelationList.sort(Comparator.comparingInt(BmFlowRelation::getOrder));
|
|
||||||
} catch (Exception e) {
|
|
||||||
return AjaxResult.error("处理审批流排序失败,请联系运维人员:" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取起始节点状态
|
|
||||||
String flowStartTaskStatus = bmFlowRelationList.get(0).getTaskStatus();
|
|
||||||
// 设置任务状态为审批流的起点状态
|
|
||||||
task.setTaskStatus(Integer.valueOf(flowStartTaskStatus));
|
|
||||||
// -----------审批流处理结束 -------------
|
|
||||||
|
|
||||||
// 生成领料编码
|
|
||||||
String code = tmTaskService.genderLeaseCode();
|
|
||||||
if (StringUtils.isEmpty(code)) { return AjaxResult.error("后台生成CODE编号异常,请重试!"); }
|
|
||||||
task.setCode(code);
|
|
||||||
|
|
||||||
// 创建任务
|
|
||||||
if (tmTaskService.insertSelective(task) < 1) { return AjaxResult.error("创建领料任务失败,请重试!"); }
|
|
||||||
//任务与协议建立关联关系
|
|
||||||
if (tmTaskService.insertAgreement(task) < 1) { return AjaxResult.error("领料任务与协议建立关联关系失败,请重试!"); }
|
|
||||||
|
|
||||||
// 获取任务编号
|
|
||||||
String taskId = task.getId();
|
|
||||||
if (StringUtils.isEmpty(taskId)) {return AjaxResult.error("任务编号为空,创建失败");}
|
|
||||||
|
|
||||||
// -----------数据处理开始start ---------------
|
|
||||||
|
|
||||||
// 根据设备所属分公司拆分集合
|
|
||||||
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId");
|
|
||||||
|
|
||||||
// 对拆分后的集合进行each遍历
|
|
||||||
for (List<LeaseApplyDetails> leaseApplyDetailsList : deviceByCompanyList) {
|
|
||||||
// 判断拆分后的集合内是否有数据
|
|
||||||
if (CollUtil.isNotEmpty(leaseApplyDetailsList)) {
|
|
||||||
// 对领料任务表的对象做数据处理
|
|
||||||
LeaseApplyInfo leaseApplyInfo = task.getLeaseApplyInfo();
|
|
||||||
leaseApplyInfo.setCode(code);
|
|
||||||
leaseApplyInfo.setTaskId(Integer.valueOf(taskId));
|
|
||||||
// 设置设备所属分公司,用于交给哪家审核
|
|
||||||
leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId());
|
|
||||||
// 设置审批层级,根据已启用的审批流进行赋值层数
|
|
||||||
leaseApplyInfo.setType(String.valueOf(bmFlowRelationList.size()));
|
|
||||||
|
|
||||||
// 创建领料任务,返回领料任务编号
|
|
||||||
if (leaseApplyInfoService.genderLeaseCode(leaseApplyInfo) < 1) { return AjaxResult.error("创建领料任务失败,或领料明细为空"); }
|
|
||||||
|
|
||||||
// 领料任务创建完成,进行领料任务明细插入
|
|
||||||
ArrayList<Integer> ids = new ArrayList<>();
|
|
||||||
if (StringUtils.isNotNull(leaseApplyInfo.getId())) {
|
|
||||||
for (LeaseApplyDetails leaseApplyDetails : leaseApplyDetailsList) {
|
|
||||||
// 设置领料任务ID
|
|
||||||
leaseApplyDetails.setParenntId(leaseApplyInfo.getId());
|
|
||||||
ids.add(leaseApplyDetails.getId());
|
|
||||||
}
|
|
||||||
// 插入领料任务明细
|
|
||||||
if (leaseApplyDetailsService.batchInsert(leaseApplyDetailsList) > 0) {
|
|
||||||
leaseUserBookService.batchDel(ids);
|
|
||||||
} else {
|
|
||||||
System.out.println(("领料任务明细插入失败,请重试"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return AjaxResult.error("领料任务编号为空");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// -----------数据处理结束end ---------------
|
|
||||||
|
|
||||||
// 数据处理成功后增加审批流记录
|
|
||||||
BmFlowRecord bmFlowRecord = new BmFlowRecord();
|
|
||||||
try {
|
|
||||||
bmFlowRecord.setTaskId(Integer.valueOf(taskId));
|
|
||||||
bmFlowRecord.setFlowId(bmFlowRelationList.get(0).getFlowId());
|
|
||||||
if (bmFlowRelationList.size() > 1) { bmFlowRecord.setNextFlowId(bmFlowRelationList.get(1).getFlowId());}
|
|
||||||
// String loginUserName = SecurityUtils.getLoginUser().getSysUser().getUserName();
|
|
||||||
// bmFlowRecord.setCreator(loginUserName == null ? "" : loginUserName);
|
|
||||||
bmFlowRecordService.insertSelective(bmFlowRecord);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return AjaxResult.error("数据处理完成,但审批流记录失败,请联系运维人员:" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return AjaxResult.success("任务创建成功,已完成");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -228,8 +228,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TmTask> getLeaseAuditListByOne(TmTask record) {
|
public List<TmTask> getLeaseAuditListByOne(TmTask record) {
|
||||||
List<TmTask> tmTaskList = tmTaskMapper.getLeaseDetailByParentId(record);
|
return tmTaskMapper.getLeaseDetailByParentId(record);
|
||||||
return tmTaskList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -373,7 +372,6 @@ public class TmTaskServiceImpl implements TmTaskService {
|
||||||
* @return 审批流数据集合
|
* @return 审批流数据集合
|
||||||
*/
|
*/
|
||||||
private List<BmFlowRelation> leaseExamFlowParamCheck(TmTask task) {
|
private List<BmFlowRelation> leaseExamFlowParamCheck(TmTask task) {
|
||||||
// ---------审批流校验---------
|
|
||||||
// 查询当前任务类型的审批流配置
|
// 查询当前任务类型的审批流配置
|
||||||
BmFlowRelation bmFlowRelation = new BmFlowRelation();
|
BmFlowRelation bmFlowRelation = new BmFlowRelation();
|
||||||
// 赋值任务类型
|
// 赋值任务类型
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.material.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
|
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
|
||||||
import com.bonus.sgzb.common.core.utils.ServletUtils;
|
import com.bonus.sgzb.common.core.utils.ServletUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
|
|
@ -11,10 +12,8 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.sgzb.common.log.annotation.Log;
|
import com.bonus.sgzb.common.log.annotation.Log;
|
||||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
||||||
import com.bonus.sgzb.material.mapper.TaskMapper;
|
|
||||||
import com.bonus.sgzb.material.service.BackApplyService;
|
import com.bonus.sgzb.material.service.BackApplyService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
@ -23,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_NUM;
|
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_NUM;
|
||||||
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE;
|
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE;
|
||||||
|
|
@ -231,6 +229,102 @@ public class BackApplyController extends BaseController {
|
||||||
return AjaxResult.success("退料任务创建成功");
|
return AjaxResult.success("退料任务创建成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "退料申请提交--by重庆", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/submitBackApplyByCq")
|
||||||
|
public AjaxResult submitBackApplyByCq(@RequestBody BackApplyInfo bean) {
|
||||||
|
boolean addLeaseTaskResult;
|
||||||
|
Long backApplyInfoId;
|
||||||
|
if (StringUtils.isNull(bean)) {
|
||||||
|
return AjaxResult.error("参数错误");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//生成退料编码
|
||||||
|
String code = backApplyService.genderBackCode();
|
||||||
|
if (StringUtils.isEmpty(code)) {
|
||||||
|
return AjaxResult.error("后台退料编号生成异常,请重试!");
|
||||||
|
}
|
||||||
|
bean.setCode(code);
|
||||||
|
bean.setTaskType(36);
|
||||||
|
bean.setTaskStatus("38");
|
||||||
|
// 创建任务
|
||||||
|
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
||||||
|
if (addTaskResult && bean.getTaskId() != null) {
|
||||||
|
//任务协议表(tm_task_agreement)
|
||||||
|
boolean addTaskAgreementRes = backApplyService.insertTaskAgreement(bean) > 0;
|
||||||
|
if (addTaskAgreementRes && bean.getBackApplyInfo() != null) {
|
||||||
|
if (CollUtil.isEmpty(bean.getBackApplyDetails())) {
|
||||||
|
return AjaxResult.error("退料设备明细为空,请重新选择后上传!");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNull(bean.getBackApplyInfo())) {
|
||||||
|
return AjaxResult.error("退料任务信息为空,请重新选择后上传!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer taskId = bean.getTaskId();
|
||||||
|
// 根据设备所属分公司拆分集合
|
||||||
|
List<List<BackApplyInfo>> backApplyInfoList = CollUtil.groupByField(bean.getBackApplyDetails(), "companyId");
|
||||||
|
// 判断拆分后的集合内是否有数据
|
||||||
|
if (CollUtil.isNotEmpty(backApplyInfoList)) {
|
||||||
|
// 对拆分后的集合进行each遍历
|
||||||
|
for (List<BackApplyInfo> leaseApplyDetailsList : backApplyInfoList) {
|
||||||
|
BackApplyInfo backApplyInfo1 = leaseApplyDetailsList.get(0);
|
||||||
|
// 对领料任务表的对象做数据处理
|
||||||
|
BackApplyInfo backApplyInfo = bean.getBackApplyInfo();
|
||||||
|
/* 创建领料单号*/
|
||||||
|
backApplyInfo.setCode(code);
|
||||||
|
// -----重庆机具专属-----
|
||||||
|
backApplyInfo.setStatus("1");
|
||||||
|
backApplyInfo.setDirectAuditBy(1);
|
||||||
|
backApplyInfo.setDirectAuditTime(DateUtils.getTime());
|
||||||
|
backApplyInfo.setDirectAuditRemark("系统自动审批");
|
||||||
|
/*设置任务ID*/
|
||||||
|
backApplyInfo.setTaskId(taskId);
|
||||||
|
/*设置设备所属分公司,用于交给哪家审核*/
|
||||||
|
backApplyInfo.setCompanyId(backApplyInfo1.getCompanyId());
|
||||||
|
// 创建领料任务,返回领料任务编号
|
||||||
|
addLeaseTaskResult = backApplyService.insertBackApply(backApplyInfo) > 0;
|
||||||
|
// 领料任务编号
|
||||||
|
backApplyInfoId = backApplyInfo.getId();
|
||||||
|
|
||||||
|
// 领料任务创建完成,进行领料任务明细插入
|
||||||
|
if (addLeaseTaskResult) {
|
||||||
|
if (StringUtils.isNotNull(backApplyInfoId)) {
|
||||||
|
for (BackApplyInfo leaseApplyDetails : leaseApplyDetailsList) {
|
||||||
|
/* 设置领料任务ID*/
|
||||||
|
leaseApplyDetails.setId(backApplyInfoId);
|
||||||
|
leaseApplyDetails.setUpdateBy("admin");
|
||||||
|
leaseApplyDetails.setRemark("系统自动审核");
|
||||||
|
// 插入领料任务明细
|
||||||
|
boolean addLeaseTaskDetailsResult = backApplyService.uploadByCq(leaseApplyDetails) > 0;
|
||||||
|
if (!addLeaseTaskDetailsResult) {
|
||||||
|
return AjaxResult.error("退料任务创建成功,但退料任务明细插入失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("退料任务编号为空");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建退料任务失败,或退料明细为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败,缺少数据");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("创建任务失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("创建任务失败," + e.getCause().toString() + "," + e.getMessage());
|
||||||
|
}
|
||||||
|
// 重庆无需审批,创建成功后自动调用审核通过service
|
||||||
|
// backApplyService.audit(bean);
|
||||||
|
|
||||||
|
return AjaxResult.success("退料任务创建成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "退料申请提交", businessType = BusinessType.INSERT)
|
@Log(title = "退料申请提交", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/submitRefuseBackApply")
|
@PostMapping("/submitRefuseBackApply")
|
||||||
public AjaxResult submitRefuseBackApply(@RequestBody BackApplyInfo bean) {
|
public AjaxResult submitRefuseBackApply(@RequestBody BackApplyInfo bean) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.bonus.sgzb.material.mapper;
|
package com.bonus.sgzb.material.mapper;
|
||||||
|
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
import com.bonus.sgzb.material.domain.TmTask;
|
|
||||||
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -68,6 +67,8 @@ public interface BackApplyMapper {
|
||||||
*/
|
*/
|
||||||
int upload(BackApplyInfo bean);
|
int upload(BackApplyInfo bean);
|
||||||
|
|
||||||
|
int uploadByCq(BackApplyInfo bean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询
|
* 查询
|
||||||
* @param bean
|
* @param bean
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package com.bonus.sgzb.material.service;
|
package com.bonus.sgzb.material.service;
|
||||||
|
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -65,6 +63,9 @@ public interface BackApplyService {
|
||||||
*/
|
*/
|
||||||
int upload(BackApplyInfo bean);
|
int upload(BackApplyInfo bean);
|
||||||
|
|
||||||
|
|
||||||
|
int uploadByCq(BackApplyInfo bean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退料申请详情
|
* 退料申请详情
|
||||||
* @param bean
|
* @param bean
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
import com.bonus.sgzb.material.domain.TmTask;
|
|
||||||
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
||||||
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
||||||
import com.bonus.sgzb.material.mapper.TaskMapper;
|
import com.bonus.sgzb.material.mapper.TaskMapper;
|
||||||
|
|
@ -124,6 +123,11 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
return backApplyMapper.upload(bean);
|
return backApplyMapper.upload(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int uploadByCq(BackApplyInfo bean) {
|
||||||
|
return backApplyMapper.uploadByCq(bean);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BackApplyInfo> getView(BackApplyInfo bean) {
|
public List<BackApplyInfo> getView(BackApplyInfo bean) {
|
||||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||||
|
|
@ -189,35 +193,54 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult audit(BackApplyInfo bean) {
|
public AjaxResult audit(BackApplyInfo bean) {
|
||||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
Set<String> roles = null;
|
||||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
Long userid = null;
|
||||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
Long companyId = null;
|
||||||
|
try {
|
||||||
|
roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
|
userid = SecurityUtils.getLoginUser().getUserid();
|
||||||
|
companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return AjaxResult.error("获取用户信息失败:{}", e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
int num = 0;
|
int num = 0;
|
||||||
if (!StringUtils.isEmpty(bean.getIds())) {
|
if (!StringUtils.isEmpty(bean.getIds())) {
|
||||||
String[] ids = bean.getIds().split(",");
|
String[] ids = bean.getIds().split(",");
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (String id : ids) {
|
||||||
String id = ids[i];
|
|
||||||
bean.setId(Long.valueOf(id));
|
bean.setId(Long.valueOf(id));
|
||||||
if (roles.contains("admin")) {
|
if (roles != null && roles.contains("admin")) {
|
||||||
|
if (userid != null) {
|
||||||
bean.setCreateBy(userid.toString());
|
bean.setCreateBy(userid.toString());
|
||||||
|
}
|
||||||
bean.setStatus("1");
|
bean.setStatus("1");
|
||||||
int re = backApplyMapper.audit(bean);
|
int re = backApplyMapper.audit(bean);
|
||||||
if (re < 1) {
|
if (re < 1) {
|
||||||
return AjaxResult.error("审核失败");
|
return AjaxResult.error("审核失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (roles.contains("jjfgs")) {
|
if (roles != null && roles.contains("jjfgs")) {
|
||||||
|
if (companyId != null) {
|
||||||
bean.setCompanyId(companyId.toString());
|
bean.setCompanyId(companyId.toString());
|
||||||
|
}
|
||||||
|
if (userid != null) {
|
||||||
bean.setCreateBy(userid.toString());
|
bean.setCreateBy(userid.toString());
|
||||||
|
}
|
||||||
bean.setStatus("1");
|
bean.setStatus("1");
|
||||||
int re = backApplyMapper.audit(bean);
|
int re = backApplyMapper.audit(bean);
|
||||||
if (re < 1) {
|
if (re < 1) {
|
||||||
return AjaxResult.error("审核失败");
|
return AjaxResult.error("审核失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (roles.contains("tsfgs")) {
|
if (roles != null && roles.contains("tsfgs")) {
|
||||||
|
if (companyId != null) {
|
||||||
bean.setCompanyId(companyId.toString());
|
bean.setCompanyId(companyId.toString());
|
||||||
|
}
|
||||||
|
if (userid != null) {
|
||||||
bean.setCreateBy(userid.toString());
|
bean.setCreateBy(userid.toString());
|
||||||
|
}
|
||||||
bean.setStatus("3");
|
bean.setStatus("3");
|
||||||
int re = backApplyMapper.audit(bean);
|
int re = backApplyMapper.audit(bean);
|
||||||
if (re < 1) {
|
if (re < 1) {
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="companyId != null">
|
<if test="companyId != null">
|
||||||
company_id,
|
company_id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
status,
|
||||||
|
</if>
|
||||||
create_time
|
create_time
|
||||||
) values (
|
) values (
|
||||||
<if test="code != null">
|
<if test="code != null">
|
||||||
|
|
@ -183,6 +186,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="companyId != null">
|
<if test="companyId != null">
|
||||||
#{companyId},
|
#{companyId},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
#{status},
|
||||||
|
</if>
|
||||||
NOW()
|
NOW()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
@ -203,9 +209,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createBy != null and createBy != ''">
|
<if test="createBy != null and createBy != ''">
|
||||||
create_by,
|
create_by,
|
||||||
</if>
|
</if>
|
||||||
<if test="createBy != null and createBy != ''">
|
|
||||||
update_by,
|
|
||||||
</if>
|
|
||||||
update_time,
|
update_time,
|
||||||
<if test="remark != null and remark != ''">
|
<if test="remark != null and remark != ''">
|
||||||
remark,
|
remark,
|
||||||
|
|
@ -229,6 +232,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createBy != null and createBy != ''">
|
<if test="createBy != null and createBy != ''">
|
||||||
#{createBy},
|
#{createBy},
|
||||||
</if>
|
</if>
|
||||||
|
NOW(),
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
#{remark},
|
||||||
|
</if>
|
||||||
|
<if test="companyId != null">
|
||||||
|
#{companyId},
|
||||||
|
</if>
|
||||||
|
NOW()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="uploadByCq" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||||
|
insert into back_apply_details
|
||||||
|
(
|
||||||
|
<if test="id != null">
|
||||||
|
parent_id,
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null">
|
||||||
|
type_id,
|
||||||
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
pre_num,audit_num,
|
||||||
|
</if>
|
||||||
|
status,
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
create_by,
|
||||||
|
</if>
|
||||||
|
update_time,
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
remark,
|
||||||
|
</if>
|
||||||
|
<if test="companyId != null">
|
||||||
|
company_id,
|
||||||
|
</if>
|
||||||
|
create_time
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
<if test="id != null">
|
||||||
|
#{id},
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null">
|
||||||
|
#{typeId},
|
||||||
|
</if>
|
||||||
|
<if test="num != null">
|
||||||
|
#{num},#{num},
|
||||||
|
</if>
|
||||||
|
'0',
|
||||||
<if test="createBy != null and createBy != ''">
|
<if test="createBy != null and createBy != ''">
|
||||||
#{createBy},
|
#{createBy},
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue