完善领料申请修改逻辑
This commit is contained in:
parent
d51ec0bbf3
commit
04d79ac8b0
|
|
@ -95,7 +95,7 @@ public class LeaseApplyDetails implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "更新时间")
|
@ApiModelProperty(value = "更新时间 ")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -275,14 +275,32 @@ public class TmTaskController extends BaseController {
|
||||||
try {
|
try {
|
||||||
int taskResult = tmTaskService.updateByPrimaryKeySelective(task);
|
int taskResult = tmTaskService.updateByPrimaryKeySelective(task);
|
||||||
if (taskResult > 0) {
|
if (taskResult > 0) {
|
||||||
if (CollUtil.isNotEmpty(task.getLeaseApplyDetails())) {
|
if (CollUtil.isEmpty(task.getLeaseApplyInfoList())){
|
||||||
for (LeaseApplyDetails leaseApplyDetails : task.getLeaseApplyDetails()) {
|
return AjaxResult.error("任务表修改完成,但领料任务明细为空,执行失败!");
|
||||||
leaseApplyDetailsService.updateByPrimaryKeySelective(leaseApplyDetails);
|
|
||||||
}
|
|
||||||
return AjaxResult.success("修改成功");
|
|
||||||
} else {
|
|
||||||
return AjaxResult.error("任务表修改成功,但领料任务明细修改信息为空");
|
|
||||||
}
|
}
|
||||||
|
// 先删除原有的领料任务明细
|
||||||
|
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()) {
|
||||||
|
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 {
|
} else {
|
||||||
return AjaxResult.error("任务表修改失败");
|
return AjaxResult.error("任务表修改失败");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ import java.util.List;
|
||||||
public interface LeaseApplyDetailsMapper {
|
public interface LeaseApplyDetailsMapper {
|
||||||
int deleteByPrimaryKey(Integer id);
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int deleteByParentId(String parentId);
|
||||||
|
|
||||||
int insert(LeaseApplyDetails record);
|
int insert(LeaseApplyDetails record);
|
||||||
|
|
||||||
int insertOrUpdate(LeaseApplyDetails record);
|
int insertOrUpdate(LeaseApplyDetails record);
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ public interface TmTaskMapper {
|
||||||
|
|
||||||
int deleteDetailsByTaskId(@Param("id") String id);
|
int deleteDetailsByTaskId(@Param("id") String id);
|
||||||
|
|
||||||
|
int deleteDetailsByParentId(String parentId);
|
||||||
|
|
||||||
int insert(TmTask record);
|
int insert(TmTask record);
|
||||||
|
|
||||||
int insertOrUpdate(TmTask record);
|
int insertOrUpdate(TmTask record);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package com.bonus.sgzb.app.service;
|
package com.bonus.sgzb.app.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* @Author 阮世耀
|
* @Author 阮世耀
|
||||||
|
|
@ -11,6 +12,7 @@ import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
||||||
|
|
||||||
public interface LeaseApplyDetailsService{
|
public interface LeaseApplyDetailsService{
|
||||||
|
|
||||||
|
int deleteByParentId(String parentId);
|
||||||
|
|
||||||
int deleteByPrimaryKey(Integer id);
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ public interface TmTaskService{
|
||||||
|
|
||||||
int deleteDetailsByTaskId(@Param("id") String id);
|
int deleteDetailsByTaskId(@Param("id") String id);
|
||||||
|
|
||||||
|
int deleteDetailsByParentId(String parentId);
|
||||||
|
|
||||||
int createTask(TmTask record);
|
int createTask(TmTask record);
|
||||||
|
|
||||||
int insertOrUpdate(TmTask record);
|
int insertOrUpdate(TmTask record);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
package com.bonus.sgzb.app.service.impl;
|
package com.bonus.sgzb.app.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper;
|
||||||
|
import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
|
||||||
|
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper;
|
|
||||||
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
|
||||||
import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* @Author 阮世耀
|
* @Author 阮世耀
|
||||||
|
|
@ -24,6 +25,11 @@ public class LeaseApplyDetailsServiceImpl implements LeaseApplyDetailsService{
|
||||||
return leaseApplyDetailsMapper.deleteByPrimaryKey(id);
|
return leaseApplyDetailsMapper.deleteByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByParentId(String id) {
|
||||||
|
return leaseApplyDetailsMapper.deleteByParentId(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insert(LeaseApplyDetails record) {
|
public int insert(LeaseApplyDetails record) {
|
||||||
return leaseApplyDetailsMapper.insert(record);
|
return leaseApplyDetailsMapper.insert(record);
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,16 @@ public class TmTaskServiceImpl implements TmTaskService{
|
||||||
return tmTaskMapper.deleteDetailsByTaskId(id);
|
return tmTaskMapper.deleteDetailsByTaskId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据parentID删除详情表配置的设备
|
||||||
|
* @param parentId 所属ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDetailsByParentId(String parentId) {
|
||||||
|
return tmTaskMapper.deleteDetailsByParentId(parentId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int createTask(TmTask record) {
|
public int createTask(TmTask record) {
|
||||||
return tmTaskMapper.insert(record);
|
return tmTaskMapper.insert(record);
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,17 @@
|
||||||
from lease_apply_details
|
from lease_apply_details
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
<!--@mbg.generated-->
|
|
||||||
delete from lease_apply_details
|
delete from lease_apply_details
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteByParentId" parameterType="java.lang.Integer">
|
||||||
|
delete from lease_apply_details
|
||||||
|
where parennt_id = #{parentId,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails" useGeneratedKeys="true">
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails" useGeneratedKeys="true">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
insert into lease_apply_details (parennt_id, type_id, pre_num,
|
insert into lease_apply_details (parennt_id, type_id, pre_num,
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,10 @@
|
||||||
delete from lease_apply_details where id = #{id}
|
delete from lease_apply_details where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDetailsByParentId" parameterType="java.lang.String">
|
||||||
|
delete from lease_apply_details where parennt_id = #{parentId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<insert id="insert" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
|
<insert id="insert" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
|
||||||
insert into tm_task (task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id)
|
insert into tm_task (task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id)
|
||||||
values (#{taskType,jdbcType=INTEGER}, #{taskStatus,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
|
values (#{taskType,jdbcType=INTEGER}, #{taskStatus,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue