领料接口优化
This commit is contained in:
parent
8cdbb77ab2
commit
a24d84e624
|
|
@ -52,4 +52,7 @@ public class MaterialConstants {
|
||||||
/** 协议号的开头字母 */
|
/** 协议号的开头字母 */
|
||||||
public static final String AGREEMENT_PREFIX = "H";
|
public static final String AGREEMENT_PREFIX = "H";
|
||||||
|
|
||||||
|
/** 领料单号的开头字母 */
|
||||||
|
public static final String LEASE_TASK_TYPE_LABEL = "L";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.lease.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.constant.MaterialConstants;
|
||||||
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
import com.bonus.common.biz.enums.PurchaseTaskStatusEnum;
|
||||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
|
|
@ -15,7 +16,9 @@ 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.TmTaskAgreement;
|
||||||
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
|
import com.bonus.material.task.domain.vo.TmTaskRequestVo;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||||
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;
|
||||||
|
|
@ -44,7 +47,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
@Resource
|
@Resource
|
||||||
private TmTaskMapper tmTaskMapper;
|
private TmTaskMapper tmTaskMapper;
|
||||||
|
|
||||||
public static final String LEASE_TASK_TYPE_LABEL = "L";
|
@Resource
|
||||||
|
TmTaskAgreementMapper tmTaskAgreementMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询领料任务
|
* 查询领料任务
|
||||||
|
|
@ -86,11 +90,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
tmTaskRequestVo.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();
|
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), tmTaskRequestVo.getAgreementId());
|
||||||
tmTaskRequestVo.getLeaseApplyInfo().setTaskId(taskId);
|
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||||
|
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
tmTaskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||||
|
tmTaskRequestVo.getLeaseApplyInfo().setTaskId(tmTask.getTaskId());
|
||||||
int count = leaseApplyInfoMapper.insertLeaseApplyInfo(tmTaskRequestVo.getLeaseApplyInfo());
|
int count = leaseApplyInfoMapper.insertLeaseApplyInfo(tmTaskRequestVo.getLeaseApplyInfo());
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), taskId);
|
return insertPurchaseCheckDetails(tmTaskRequestVo.getLeaseApplyDetailsList(), tmTask.getTaskId());
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("新增任务失败,lease_apply_info表插入0条");
|
return AjaxResult.error("新增任务失败,lease_apply_info表插入0条");
|
||||||
}
|
}
|
||||||
|
|
@ -127,7 +134,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
* @return 任务对象
|
* @return 任务对象
|
||||||
*/
|
*/
|
||||||
private static String genderTaskCode(Integer thisMonthMaxOrder) {
|
private static String genderTaskCode(Integer thisMonthMaxOrder) {
|
||||||
return LEASE_TASK_TYPE_LABEL + DateUtils.getCurrentYear() + DateUtils.getCurrentMonth() + String.format("%06d", thisMonthMaxOrder + 1);
|
return MaterialConstants.LEASE_TASK_TYPE_LABEL + DateUtils.getCurrentYear() + DateUtils.getCurrentMonth() + String.format("%06d", thisMonthMaxOrder + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务对象 tm_task_agreement
|
* 任务对象 tm_task_agreement
|
||||||
*
|
*
|
||||||
|
|
@ -32,5 +34,8 @@ public class TmTaskAgreement extends BaseEntity {
|
||||||
@ApiModelProperty(value = "数据所属组织")
|
@ApiModelProperty(value = "数据所属组织")
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
public TmTaskAgreement(Long taskId, Long agreementId) {
|
||||||
|
this.taskId = taskId;
|
||||||
|
this.agreementId = agreementId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class TmTaskRequestVo extends BaseEntity {
|
||||||
private List<LeaseApplyDetails> leaseApplyDetailsList;
|
private List<LeaseApplyDetails> leaseApplyDetailsList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "协议id")
|
@ApiModelProperty(value = "协议id")
|
||||||
private Integer agreementId;
|
private Long agreementId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "协议编号")
|
@ApiModelProperty(value = "协议编号")
|
||||||
@Excel(name = "协议号", sort = 4)
|
@Excel(name = "协议号", sort = 4)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue