退料申请表数据问题修改

This commit is contained in:
liang.chao 2024-03-07 16:30:39 +08:00
parent 01106d4c5b
commit f26108e284
17 changed files with 493 additions and 91 deletions

View File

@ -295,19 +295,19 @@ public class TmTaskController extends BaseController {
Set<String> roles = SecurityUtils.getLoginUser().getRoles(); Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<TmTask> leaseAuditList = new ArrayList<>(); List<TmTask> leaseAuditList = new ArrayList<>();
if (souceBy == 1) { if (souceBy == 1) {
if (roles.contains("admin")){ if (roles.contains("admin")) {
leaseAuditList = tmTaskService.getLeaseAuditList(task); leaseAuditList = tmTaskService.getLeaseAuditList(task);
return AjaxResult.success(getDataTable(leaseAuditList)); return AjaxResult.success(getDataTable(leaseAuditList));
}else { } else {
leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task); leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task);
return AjaxResult.success(getDataTable(leaseAuditList)); return AjaxResult.success(getDataTable(leaseAuditList));
} }
} }
startPage(); startPage();
if (roles.contains("admin")){ if (roles.contains("admin")) {
leaseAuditList = tmTaskService.getLeaseAuditList(task); leaseAuditList = tmTaskService.getLeaseAuditList(task);
return AjaxResult.success(getDataTable(leaseAuditList)); return AjaxResult.success(getDataTable(leaseAuditList));
}else { } else {
leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task); leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task);
return AjaxResult.success(getDataTable(leaseAuditList)); return AjaxResult.success(getDataTable(leaseAuditList));
} }
@ -336,7 +336,7 @@ public class TmTaskController extends BaseController {
leaseAuditList = tmTaskService.getLeaseAuditManageList(task); leaseAuditList = tmTaskService.getLeaseAuditManageList(task);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, leaseAuditList)); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, leaseAuditList));
} }
/** /**
@ -351,9 +351,9 @@ public class TmTaskController extends BaseController {
Set<String> roles = SecurityUtils.getLoginUser().getRoles(); Set<String> roles = SecurityUtils.getLoginUser().getRoles();
// 领料申请导出 // 领料申请导出
if (task.getTypes() == 1) { if (task.getTypes() == 1) {
if (roles.contains("admin")){ if (roles.contains("admin")) {
leaseAuditList = tmTaskService.getLeaseAuditList(task); leaseAuditList = tmTaskService.getLeaseAuditList(task);
}else { } else {
leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task); leaseAuditList = tmTaskService.getLeaseAuditListByPeople(task);
} }
ExcelUtil<TmTask> util = new ExcelUtil<TmTask>(TmTask.class); ExcelUtil<TmTask> util = new ExcelUtil<TmTask>(TmTask.class);
@ -460,81 +460,11 @@ public class TmTaskController extends BaseController {
if (StringUtils.isNull(task)) { if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误,传入信息为空!"); return AjaxResult.error("参数错误,传入信息为空!");
} }
try { int edit = tmTaskService.edit(task);
int taskResult = tmTaskService.updateByPrimaryKeySelective(task); return AjaxResult.success("修改成功");
if (taskResult > 0) {
if (CollUtil.isEmpty(task.getLeaseApplyInfoList())) {
return AjaxResult.error("任务表修改完成,但领料任务明细为空,执行失败!");
}
// 修改任务关联的协议
tmTaskService.updateAgreementByTask(task);
//修改领料任务表信息
//先判断 目前数据库有几个公司
// List<LeaseApplyInfo> list = tmTaskService.getListSome(task.getTaskId());
LeaseApplyInfo infoAdd = new LeaseApplyInfo();
/* 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());
infoAdd.setLeasePerson(task.getLeaseApplyInfoList().get(0).getLeasePerson());
infoAdd.setPhone(task.getLeaseApplyInfoList().get(0).getPhone());
infoAdd.setRemark(task.getLeaseApplyInfoList().get(0).getRemark());
infoAdd.setType(task.getLeaseApplyInfoList().get(0).getType());
for (List<LeaseApplyDetails> leaseApplyDetailsList : deviceByCompanyList) {
if (leaseApplyDetailsList.get(0).getParenntId() == null) {
if (leaseApplyDetailsList.get(0).getCompanyId() == 101) {
infoAdd.setCompanyId(101);
leaseApplyInfoService.genderLeaseCode(infoAdd);
} else if (leaseApplyDetailsList.get(0).getCompanyId() == 102) {
infoAdd.setCompanyId(102);
leaseApplyInfoService.genderLeaseCode(infoAdd);
}
}
}
}*/
LeaseApplyInfo bean = new LeaseApplyInfo();
bean.setTaskId(task.getTaskId().intValue());
bean.setLeasePerson(task.getLeaseApplyInfo().getLeasePerson());
bean.setPhone(task.getLeaseApplyInfo().getPhone());
bean.setRemark(task.getLeaseApplyInfo().getRemark());
tmTaskService.updateLeaseInfo(bean);
for (LeaseApplyInfo leaseApplyInfo : task.getLeaseApplyInfoList()) {
if (leaseApplyInfo == null || leaseApplyInfo.getId() == null) {
continue;
}
if (StringUtils.isEmpty(leaseApplyInfo.getLeaseApplyDetails())) {
continue;
}
// 先删除之前的领料明细
tmTaskService.deleteDetailsByParentId(String.valueOf(leaseApplyInfo.getId()));
// 删除后,插入新地领料任务明细
if (StringUtils.isNotNull(leaseApplyInfo.getId())) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyInfo.getLeaseApplyDetails()) {
if (leaseApplyDetails.getParenntId() == null) {
leaseApplyDetails.setParenntId(infoAdd.getId());
} else {
leaseApplyDetails.setParenntId(leaseApplyInfo.getId()); // 设置领料任务ID
}
}
// 插入领料任务明细
boolean addLeaseTaskDetailsResult = leaseApplyDetailsService.batchInsert(leaseApplyInfo.getLeaseApplyDetails()) > 0;
System.out.println(addLeaseTaskDetailsResult ? "领料任务明细插入成功" : "领料任务明细插入失败");
} else {
return AjaxResult.error("领料任务ID为空,修改失败!");
}
}
return AjaxResult.success("修改成功");
} else {
return AjaxResult.error("任务表修改失败");
}
} catch (Exception e) {
return AjaxResult.error("修改失败,异常信息:" + e.getMessage());
}
} }
/** /**
* 通过主键查询单条数据 * 通过主键查询单条数据
* *

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.LeaseApplyDetails; 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 org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -19,6 +20,7 @@ public interface LeaseApplyDetailsMapper {
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
int deleteByParentId(String parentId); int deleteByParentId(String parentId);
List<LeaseApplyDetails> selectByTaskId(TmTask tmTask);
int insert(LeaseApplyDetails record); int insert(LeaseApplyDetails record);

View File

@ -18,6 +18,7 @@ public interface LeaseApplyInfoMapper {
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
int insert(LeaseApplyInfo record); int insert(LeaseApplyInfo record);
LeaseApplyInfo selectByTaskIdAndCompId(@Param("taskId") String taskId, @Param("companyId") String companyId);
int insertOrUpdate(LeaseApplyInfo record); int insertOrUpdate(LeaseApplyInfo record);

View File

@ -34,6 +34,7 @@ public interface TmTaskService{
String genderLeaseCode(); String genderLeaseCode();
AjaxResult deleteByPrimaryKey(String taskId); AjaxResult deleteByPrimaryKey(String taskId);
int deleteLeaseInfoByTaskId(String taskId);
int deleteDetailsByTaskId(@Param("id") String id); int deleteDetailsByTaskId(@Param("id") String id);
@ -51,6 +52,8 @@ public interface TmTaskService{
int updateByPrimaryKeySelective(TmTask record); int updateByPrimaryKeySelective(TmTask record);
int edit(TmTask tmTask);
Integer getAgreementIdByUnit(TmTask task); Integer getAgreementIdByUnit(TmTask task);
int updateAgreementByTask(TmTask record); int updateAgreementByTask(TmTask record);

View File

@ -7,12 +7,15 @@ 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.mapper.LeaseApplyDetailsMapper;
import com.bonus.sgzb.app.mapper.LeaseApplyInfoMapper;
import com.bonus.sgzb.app.mapper.TmTaskMapper; import com.bonus.sgzb.app.mapper.TmTaskMapper;
import com.bonus.sgzb.app.service.TmTaskService; import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils; 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 net.sf.jsqlparser.expression.TryCastExpression;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -39,6 +42,12 @@ public class TmTaskServiceImpl implements TmTaskService {
@Resource @Resource
private TmTaskMapper tmTaskMapper; private TmTaskMapper tmTaskMapper;
@Resource
private LeaseApplyInfoMapper leaseApplyInfoMapper;
@Resource
private LeaseApplyDetailsMapper leaseApplyDetailsMapper;
/** /**
* 领料任务审核状态 * 领料任务审核状态
* *
@ -632,6 +641,12 @@ public class TmTaskServiceImpl implements TmTaskService {
} }
} }
@Override
public int deleteLeaseInfoByTaskId(String taskId) {
int i = tmTaskMapper.deleteTaskInfoByTaskId(taskId);
return i;
}
/** /**
* 根据id删除详情表配置的设备 * 根据id删除详情表配置的设备
* *
@ -684,6 +699,113 @@ public class TmTaskServiceImpl implements TmTaskService {
return tmTaskMapper.updateByPrimaryKeySelective(record); return tmTaskMapper.updateByPrimaryKeySelective(record);
} }
@Override
@Transactional
public int edit(TmTask tmTask) {
int flag = 0;
int res = 0;
int taskResult = this.updateByPrimaryKeySelective(tmTask);
try {
if (CollUtil.isEmpty(tmTask.getLeaseApplyInfoList())) {
flag = 1;
}
// 修改任务关联的协议
this.updateAgreementByTask(tmTask);
res = deletePreDetailData(tmTask);
if (res == 0) {
throw new RuntimeException("删除leaseApplyDetail异常");
}
//先删除leaseApplyInfo
res = deletePreData(tmTask);
if (res == 0) {
throw new RuntimeException("删除leaseApplyInfo异常");
}
// 先查询lease apply info根据task id,company id,不存在则插入领料任务领料单号领料人联系电话备注存在则不插入
res = insertNewData(tmTask);
if (res == 0) {
throw new RuntimeException("insertNewData异常");
}
res = insertNewDetailData(tmTask);
if (res == 0) {
throw new RuntimeException("insertNewDetailData异常");
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
private int deletePreDetailData(TmTask tmTask) {
int res = 0;
List<LeaseApplyDetails> leaseApplyDetails = leaseApplyDetailsMapper.selectByTaskId(tmTask);
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
res = leaseApplyDetailsMapper.deleteByPrimaryKey(leaseApplyDetail.getId());
}
return res;
}
private int insertNewData(TmTask task) {
int res = 0;
LeaseApplyInfo leaseApplyInfo1 = task.getLeaseApplyInfo();
String leasePerson = "";
String remark = "";
String phone = "";
if (leaseApplyInfo1 != null) {
leasePerson = leaseApplyInfo1.getLeasePerson();
remark = leaseApplyInfo1.getRemark();
phone = leaseApplyInfo1.getPhone();
}
List<LeaseApplyDetails> leaseApplyDetails = task.getLeaseApplyDetails();
Long taskId = task.getTaskId();
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
LeaseApplyInfo leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), String.valueOf(leaseApplyDetail.getCompanyId()));
if (leaseApplyInfos == null) {
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
String code = this.genderLeaseCode();
leaseApplyInfo.setCode(code);
leaseApplyInfo.setTaskId(task.getTaskId().intValue());
leaseApplyInfo.setCode(task.getLeaseApplyInfoList().get(0).getCode());
leaseApplyInfo.setLeasePerson(leasePerson);
leaseApplyInfo.setPhone(phone);
leaseApplyInfo.setRemark(remark);
leaseApplyInfo.setType(task.getLeaseApplyInfoList().get(0).getType());
leaseApplyInfo.setCompanyId(leaseApplyDetail.getCompanyId());
res = leaseApplyInfoMapper.insert(leaseApplyInfo);
}
}
return res;
} else {
return res;
}
}
private int insertNewDetailData(TmTask task) {
int res = 0;
List<LeaseApplyDetails> leaseApplyDetails = task.getLeaseApplyDetails();
Long taskId = task.getTaskId();
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
LeaseApplyInfo leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), String.valueOf(leaseApplyDetail.getCompanyId()));
Integer id = leaseApplyInfos.getId();
if (leaseApplyDetail.getCompanyId() == leaseApplyInfos.getCompanyId()) {
leaseApplyDetail.setParenntId(id);
res = leaseApplyDetailsMapper.insert(leaseApplyDetail);
}
}
return res;
} else {
return res;
}
}
private int deletePreData(TmTask task) {
Long taskId = task.getTaskId();
return this.deleteLeaseInfoByTaskId(String.valueOf(taskId));
}
/** /**
* @param task 查询条件 * @param task 查询条件
* @return 协议的id * @return 协议的id

View File

@ -36,6 +36,10 @@
from lease_apply_details from lease_apply_details
where parennt_id = #{parentId} where parennt_id = #{parentId}
</select> </select>
<select id="selectByTaskId" resultType="com.bonus.sgzb.app.domain.LeaseApplyDetails">
select lai.id from lease_apply_details lad left join lease_apply_info lai on lad.parennt_id = lai.id
where lai.task_id = #{taskId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from lease_apply_details delete from lease_apply_details

View File

@ -38,6 +38,12 @@
from lease_apply_info from lease_apply_info
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="selectByTaskIdAndCompId" resultType="com.bonus.sgzb.app.domain.LeaseApplyInfo">
select *
from lease_apply_info
where task_id = #{taskId}
and company_id = #{companyId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated--> <!--@mbg.generated-->

View File

@ -38,7 +38,7 @@
</update> </update>
<update id="deleteTaskInfoByTaskId" > <update id="deleteTaskInfoByTaskId" >
update lease_apply_info set `status` = '0' delete from lease_apply_info
where task_id = #{taskId} where task_id = #{taskId}
</update> </update>

View File

@ -4,10 +4,15 @@ import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.base.api.domain.DirectApplyDetails; import com.bonus.sgzb.base.api.domain.DirectApplyDetails;
import com.bonus.sgzb.base.api.domain.DirectApplyInfo; import com.bonus.sgzb.base.api.domain.DirectApplyInfo;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo; import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; 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.material.domain.DirectApplyInfoDetails; import com.bonus.sgzb.material.domain.DirectApplyInfoDetails;
import com.bonus.sgzb.material.domain.LeaseApplyDetails;
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
import com.bonus.sgzb.material.domain.TmTask;
import com.bonus.sgzb.material.service.ApplyInfoService;
import com.bonus.sgzb.material.service.TaskService; import com.bonus.sgzb.material.service.TaskService;
import com.bonus.sgzb.material.service.WorkSiteDirectManageService; import com.bonus.sgzb.material.service.WorkSiteDirectManageService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -15,6 +20,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -31,6 +37,11 @@ public class WorkSiteDirectManageController extends BaseController {
@Resource @Resource
private WorkSiteDirectManageService workSiteDirectManageService; private WorkSiteDirectManageService workSiteDirectManageService;
@Resource
private ApplyInfoService leaseApplyInfoService;
/* @Resource
private LeaseApplyDetailsService leaseApplyDetailsService;*/
@Resource @Resource
private TaskService tmTaskService; private TaskService tmTaskService;
@ -60,7 +71,7 @@ public class WorkSiteDirectManageController extends BaseController {
/** /**
* 存储退料领料数据 * 存储退料领料数据
*/ */
@ApiOperation(value = "保存直转方和接收方数据(提交)") @ApiOperation(value = "保存直转方和接收方数据")
@PostMapping("/submit") @PostMapping("/submit")
public AjaxResult submit(@RequestBody List<DirectApplyInfoDetails> directApplyInfoDetails) { public AjaxResult submit(@RequestBody List<DirectApplyInfoDetails> directApplyInfoDetails) {
if (CollUtil.isNotEmpty(directApplyInfoDetails)) { if (CollUtil.isNotEmpty(directApplyInfoDetails)) {
@ -85,20 +96,99 @@ public class WorkSiteDirectManageController extends BaseController {
return AjaxResult.success("保存成功"); return AjaxResult.success("保存成功");
} }
/*@ApiOperation(value = "通过")
/**
* 通过
*/
@ApiOperation(value = "通过")
@PostMapping("/pass") @PostMapping("/pass")
public AjaxResult pass(@RequestBody DirectApplyInfoDetails directApplyInfoDetails) { public AjaxResult pass(@RequestBody DirectApplyInfoDetails directApplyInfoDetails) {
if (directApplyInfoDetails.getDirectApplyInfos() != null) { if (directApplyInfoDetails.getDirectApplyInfos() != null) {
DirectApplyInfo directApplyInfos = directApplyInfoDetails.getDirectApplyInfos(); DirectApplyInfo directApplyInfos = directApplyInfoDetails.getDirectApplyInfos();
directApplyInfos.setStatus("1"); directApplyInfos.setStatus("1");
workSiteDirectManageService.refuseDirectApplyInfo(directApplyInfos); workSiteDirectManageService.refuseDirectApplyInfo(directApplyInfos);
} else {
return AjaxResult.error("直转信息为空,未通过");
} }
return AjaxResult.success("审核未通过"); //创建领料任务
} try {
TmTask task = directApplyInfoDetails.getTask();
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
}
String code = tmTaskService.genderLeaseCode();
if (StringUtils.isEmpty(code)) {
return AjaxResult.error("后台生成CODE编号异常请重试!");
}
task.setCode(code);
// 创建任务
boolean addTaskResult = tmTaskService.insertSelective(task) > 0;
//任务与协议建立关联关系
boolean i = tmTaskService.insertAgreement(task) > 0;
if (addTaskResult && task.getLeaseApplyInfo() != null) {
if (CollUtil.isEmpty(task.getLeaseApplyDetails())) {
return AjaxResult.error("领料设备明细为空,请重新选择后上传!");
}
if (StringUtils.isNull(task.getLeaseApplyInfo())) {
return AjaxResult.error("领料任务信息为空,请重新选择后上传!");
}
// 获取任务编号
String taskId = task.getId();
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)); // 设置任务ID
leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
leaseApplyInfo.setType("2"); // 设置审批层级先固定2层后期根据接口传入Type区分来源设定
// 创建领料任务返回领料任务编号
boolean addLeaseTaskResult = leaseApplyInfoService.genderLeaseCode(leaseApplyInfo) > 0;
// 领料任务创建完成进行领料任务明细插入
if (addLeaseTaskResult) {
// 领料任务编号
Integer leaseTaskId = leaseApplyInfo.getId();
ArrayList<Integer> ids = new ArrayList();
if (StringUtils.isNotNull(leaseTaskId)) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyDetailsList) {
leaseApplyDetails.setParenntId(leaseTaskId); // 设置领料任务ID
ids.add(leaseApplyDetails.getId());
}
// 插入领料任务明细
boolean addLeaseTaskDetailsResult = leaseApplyDetailsService.batchInsert(leaseApplyDetailsList) > 0;
if (addLeaseTaskDetailsResult) {
System.out.println("领料任务创建成功");
leaseUserBookService.batchDel(ids);
} else {
System.out.println("领料任务创建成功,但领料任务明细插入失败");
}
} else {
return AjaxResult.error("领料任务编号为空");
}
} else {
return AjaxResult.error("创建领料任务失败,或领料明细为空");
}
}
}
if (StringUtils.isEmpty(taskId)) {
return AjaxResult.error("任务编号为空,创建失败");
}
} else {
return AjaxResult.error("创建任务失败");
}
} catch (Exception e) {
return AjaxResult.error("创建任务失败," + e.getCause().toString() + "," + e.getMessage());
}
//创建退料任务
return AjaxResult.success();
}*/
/** /**
* 不通过 * 不通过
*/ */
@ -108,10 +198,10 @@ public class WorkSiteDirectManageController extends BaseController {
if (directApplyInfo != null) { if (directApplyInfo != null) {
directApplyInfo.setStatus("2"); directApplyInfo.setStatus("2");
workSiteDirectManageService.refuseDirectApplyInfo(directApplyInfo); workSiteDirectManageService.refuseDirectApplyInfo(directApplyInfo);
}else { } else {
return AjaxResult.error("参数为空,审核失败"); return AjaxResult.error("参数为空,审核失败");
} }
return AjaxResult.success("审核通过"); return AjaxResult.success();
} }
} }

View File

@ -0,0 +1,17 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.AgreementInfo;
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
/**
* @author lsun
*/
@Mapper
public interface ApplyInfoMapper {
int insertSelective(LeaseApplyInfo record);
}

View File

@ -71,4 +71,8 @@ public interface TaskMapper {
* @return * @return
*/ */
int selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType); int selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType);
int insertSelective(TmTask task);
int insertAgreement(TmTask task);
} }

View File

@ -0,0 +1,11 @@
package com.bonus.sgzb.material.service;
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
/**
* @Author梁超
* @date2024/3/6 - 17:41
*/
public interface ApplyInfoService {
int genderLeaseCode(LeaseApplyInfo record);
}

View File

@ -62,4 +62,8 @@ public interface TaskService
public int deleteTmTaskByTaskId(Long taskId); public int deleteTmTaskByTaskId(Long taskId);
String genderLeaseCode(); String genderLeaseCode();
int insertSelective(TmTask task);
int insertAgreement(TmTask task);
} }

View File

@ -0,0 +1,25 @@
package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
import com.bonus.sgzb.material.mapper.ApplyInfoMapper;
import com.bonus.sgzb.material.service.ApplyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Author梁超
* @date2024/3/6 - 17:42
*/
@Service
public class ApplyInfoServiceImpl implements ApplyInfoService {
@Resource
private ApplyInfoMapper leaseApplyInfoMapper;
@Override
public int genderLeaseCode(LeaseApplyInfo record) {
return leaseApplyInfoMapper.insertSelective(record);
}
}

View File

@ -115,4 +115,14 @@ public class TaskServiceImpl implements TaskService
} }
return code; return code;
} }
@Override
public int insertSelective(TmTask task) {
return tmTaskMapper.insertSelective(task);
}
@Override
public int insertAgreement(TmTask task) {
return tmTaskMapper.insertAgreement(task);
}
} }

View File

@ -0,0 +1,116 @@
<?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.bonus.sgzb.material.mapper.ApplyInfoMapper">
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.material.domain.LeaseApplyInfo" useGeneratedKeys="true">
insert into lease_apply_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">
code,
</if>
<if test="taskId != null">
task_id,
</if>
<if test="leasePerson != null and leasePerson != ''">
lease_person,
</if>
<if test="phone != null and phone != ''">
phone,
</if>
<if test="type != null and type != ''">
`type`,
</if>
<if test="companyAuditBy != null">
company_audit_by,
</if>
<if test="companyAuditTime != null and companyAuditTime != ''">
company_audit_time,
</if>
<if test="companyAuditRemark != null and companyAuditRemark != ''">
company_audit_remark,
</if>
<if test="deptAuditBy != null">
dept_audit_by,
</if>
<if test="deptAuditTime != null and deptAuditTime != ''">
dept_audit_time,
</if>
<if test="deptAuditRemark != null and deptAuditRemark != ''">
dept_audit_remark,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="taskId != null">
#{taskId,jdbcType=INTEGER},
</if>
<if test="leasePerson != null and leasePerson != ''">
#{leasePerson,jdbcType=VARCHAR},
</if>
<if test="phone != null and phone != ''">
#{phone,jdbcType=VARCHAR},
</if>
<if test="type != null and type != ''">
#{type,jdbcType=VARCHAR},
</if>
<if test="companyAuditBy != null">
#{companyAuditBy,jdbcType=INTEGER},
</if>
<if test="companyAuditTime != null and companyAuditTime != ''">
#{companyAuditTime,jdbcType=VARCHAR},
</if>
<if test="companyAuditRemark != null and companyAuditRemark != ''">
#{companyAuditRemark,jdbcType=VARCHAR},
</if>
<if test="deptAuditBy != null">
#{deptAuditBy,jdbcType=INTEGER},
</if>
<if test="deptAuditTime != null and deptAuditTime != ''">
#{deptAuditTime,jdbcType=VARCHAR},
</if>
<if test="deptAuditRemark != null and deptAuditRemark != ''">
#{deptAuditRemark,jdbcType=VARCHAR},
</if>
<if test="createBy != null and createBy != ''">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
</mapper>

View File

@ -60,6 +60,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId != null">#{companyId},</if> <if test="companyId != null">#{companyId},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertSelective" keyColumn="task_id" keyProperty="id" parameterType="com.bonus.sgzb.material.domain.TmTask" useGeneratedKeys="true">
insert into tm_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskType != null">
task_type,
</if>
<if test="taskStatus != null">
task_status,
</if>
<if test="code != null and code != ''">
code,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
create_time,
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
update_time,
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskType != null">
#{taskType,jdbcType=INTEGER},
</if>
<if test="taskStatus != null">
#{taskStatus,jdbcType=INTEGER},
</if>
<if test="code != null and code != ''">
#{code,jdbcType=VARCHAR},
</if>
<if test="createBy != null and createBy != ''">
#{createBy,jdbcType=VARCHAR},
</if>
now(),
<if test="updateBy != null and updateBy != ''">
#{updateBy,jdbcType=VARCHAR},
</if>
now(),
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<insert id="insertAgreement">
INSERT INTO tm_task_agreement ( `task_id`, `agreement_id`, `create_by`, `create_time`, `company_id` )
VALUES(#{id},#{agreementId},#{createBy},NOW(),#{companyId})
</insert>
<update id="updateTmTask" parameterType="com.bonus.sgzb.material.domain.TmTask"> <update id="updateTmTask" parameterType="com.bonus.sgzb.material.domain.TmTask">
update tm_task update tm_task