领料接口优化
This commit is contained in:
parent
aec9b5b3f6
commit
21249c4d74
|
|
@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||||
|
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -82,9 +83,9 @@ public class LeaseApplyInfoController extends BaseController {
|
||||||
//@RequiresPermissions("lease:info:add")
|
//@RequiresPermissions("lease:info:add")
|
||||||
@SysLog(title = "领料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务")
|
@SysLog(title = "领料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody LeaseApplyRequestVo leaseApplyRequestVo) {
|
public AjaxResult add(@RequestBody TmTaskRequestVo tmTaskRequestVo) {
|
||||||
try {
|
try {
|
||||||
return leaseApplyInfoService.insertLeaseApplyInfo(leaseApplyRequestVo);
|
return leaseApplyInfoService.insertLeaseApplyInfo(tmTaskRequestVo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return error("系统错误, " + e.getMessage());
|
return error("系统错误, " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -98,9 +99,9 @@ public class LeaseApplyInfoController extends BaseController {
|
||||||
//@RequiresPermissions("lease:info:edit")
|
//@RequiresPermissions("lease:info:edit")
|
||||||
@SysLog(title = "领料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料任务")
|
@SysLog(title = "领料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料任务")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody LeaseApplyRequestVo leaseApplyRequestVo) {
|
public AjaxResult edit(@RequestBody TmTaskRequestVo tmTaskRequestVo) {
|
||||||
try {
|
try {
|
||||||
return toAjax(leaseApplyInfoService.updateLeaseApplyInfo(leaseApplyRequestVo));
|
return toAjax(leaseApplyInfoService.updateLeaseApplyInfo(tmTaskRequestVo));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return error("系统错误, " + e.getMessage());
|
return error("系统错误, " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.lease.domain.LeaseApplyInfo;
|
import com.bonus.material.lease.domain.LeaseApplyInfo;
|
||||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||||
|
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领料任务Service接口
|
* 领料任务Service接口
|
||||||
|
|
@ -35,15 +36,15 @@ public interface ILeaseApplyInfoService {
|
||||||
* @param leaseApplyRequestVo 领料任务
|
* @param leaseApplyRequestVo 领料任务
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo);
|
public AjaxResult insertLeaseApplyInfo(TmTaskRequestVo leaseApplyRequestVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改领料任务
|
* 修改领料任务
|
||||||
*
|
*
|
||||||
* @param leaseApplyRequestVo 领料任务
|
* @param tmTaskRequestVo 领料任务
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo);
|
public boolean updateLeaseApplyInfo(TmTaskRequestVo tmTaskRequestVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除领料任务
|
* 批量删除领料任务
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
|
||||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||||
import com.bonus.material.purchase.domain.dto.PurchaseCheckDto;
|
import com.bonus.material.purchase.domain.dto.PurchaseCheckDto;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
|
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
|
||||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
|
|
@ -70,26 +71,26 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
/**
|
/**
|
||||||
* 新增领料任务
|
* 新增领料任务
|
||||||
*
|
*
|
||||||
* @param leaseApplyRequestVo 领料任务
|
* @param tmTaskRequestVo 领料任务
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
|
public AjaxResult insertLeaseApplyInfo(TmTaskRequestVo tmTaskRequestVo) {
|
||||||
leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
|
tmTaskRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate());
|
||||||
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername());
|
tmTaskRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername());
|
||||||
try {
|
try {
|
||||||
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
||||||
String taskCode = genderTaskCode(thisMonthMaxOrder);
|
String taskCode = genderTaskCode(thisMonthMaxOrder);
|
||||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(),
|
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(),
|
||||||
PurchaseTaskStatusEnum.TO_NOTICE.getStatus(),
|
PurchaseTaskStatusEnum.TO_NOTICE.getStatus(),
|
||||||
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode);
|
tmTaskRequestVo.getLeaseApplyInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode);
|
||||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||||
tmTaskMapper.insertTmTask(tmTask);
|
tmTaskMapper.insertTmTask(tmTask);
|
||||||
Long taskId = tmTask.getTaskId();
|
Long taskId = tmTask.getTaskId();
|
||||||
leaseApplyRequestVo.getLeaseApplyInfo().setTaskId(taskId);
|
tmTaskRequestVo.getLeaseApplyInfo().setTaskId(taskId);
|
||||||
int count = leaseApplyInfoMapper.insertLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo());
|
int count = leaseApplyInfoMapper.insertLeaseApplyInfo(tmTaskRequestVo.getLeaseApplyInfo());
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return insertPurchaseCheckDetails(leaseApplyRequestVo.getLeaseApplyDetailsList(), taskId);
|
return insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), taskId);
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("新增任务失败,lease_apply_info表插入0条");
|
return AjaxResult.error("新增任务失败,lease_apply_info表插入0条");
|
||||||
}
|
}
|
||||||
|
|
@ -132,18 +133,18 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
/**
|
/**
|
||||||
* 修改领料任务
|
* 修改领料任务
|
||||||
*
|
*
|
||||||
* @param leaseApplyRequestVo 领料任务
|
* @param tmTaskRequestVo 领料任务
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) {
|
public boolean updateLeaseApplyInfo(TmTaskRequestVo tmTaskRequestVo) {
|
||||||
leaseApplyRequestVo.getLeaseApplyInfo().setUpdateTime(DateUtils.getNowDate());
|
tmTaskRequestVo.getLeaseApplyInfo().setUpdateTime(DateUtils.getNowDate());
|
||||||
leaseApplyRequestVo.getLeaseApplyInfo().setUpdateBy(SecurityUtils.getUsername());
|
tmTaskRequestVo.getLeaseApplyInfo().setUpdateBy(SecurityUtils.getUsername());
|
||||||
try {
|
try {
|
||||||
Long[] ids = new Long[]{leaseApplyRequestVo.getLeaseApplyInfo().getId()};
|
Long[] ids = new Long[]{tmTaskRequestVo.getLeaseApplyInfo().getId()};
|
||||||
leaseApplyDetailsMapper.deleteLeaseApplyDetailsByParentIds(ids);
|
leaseApplyDetailsMapper.deleteLeaseApplyDetailsByParentIds(ids);
|
||||||
insertPurchaseCheckDetails(leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getTaskId());
|
insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), tmTaskRequestVo.getLeaseApplyInfo().getTaskId());
|
||||||
leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo());
|
leaseApplyInfoMapper.updateLeaseApplyInfo(tmTaskRequestVo.getLeaseApplyInfo());
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException("错误信息描述");
|
throw new ServiceException("错误信息描述");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.bonus.material.task.domain.vo;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||||
|
import com.bonus.material.lease.domain.LeaseApplyInfo;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TmTaskRequestVo extends BaseEntity {
|
||||||
|
|
||||||
|
/** 任务ID */
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
/** 任务类型(定义数据字典) */
|
||||||
|
@Excel(name = "任务类型(定义数据字典)")
|
||||||
|
@ApiModelProperty(value = "任务类型(定义数据字典)")
|
||||||
|
private Integer taskType;
|
||||||
|
|
||||||
|
/** 任务状态(定义数据字典) */
|
||||||
|
@Excel(name = "任务状态(定义数据字典)")
|
||||||
|
@ApiModelProperty(value = "任务状态(定义数据字典)")
|
||||||
|
private Integer taskStatus;
|
||||||
|
|
||||||
|
/** 编号 */
|
||||||
|
@Excel(name = "编号")
|
||||||
|
@ApiModelProperty(value = "编号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/** 数据所属组织 */
|
||||||
|
@Excel(name = "数据所属组织")
|
||||||
|
@ApiModelProperty(value = "数据所属组织")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/** 0不启用 1启用 */
|
||||||
|
@Excel(name = "0不启用 1启用")
|
||||||
|
@ApiModelProperty(value = "0不启用 1启用")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型")
|
||||||
|
private Integer monthOrder;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料任务汇总")
|
||||||
|
private LeaseApplyInfo leaseApplyInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料任务物资列表")
|
||||||
|
private List<LeaseApplyDetails> leaseApplyDetailsList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "协议id")
|
||||||
|
private Integer agreementId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "协议编号")
|
||||||
|
@Excel(name = "协议号", sort = 4)
|
||||||
|
private String agreementCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料人")
|
||||||
|
//@Excel(name = "领料人", sort = 5)
|
||||||
|
private String leasePerson;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料人手机号")
|
||||||
|
//@Excel(name = "联系电话", sort = 6)
|
||||||
|
private String leasePhone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "往来单位id")
|
||||||
|
private Long unitId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工程id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue