Merge remote-tracking branch 'origin/master'

This commit is contained in:
jjLv 2024-11-12 14:53:00 +08:00
commit 2ea0463cc7
7 changed files with 130 additions and 14 deletions

View File

@ -1,6 +1,8 @@
package com.bonus.material.basic.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@ -119,4 +121,7 @@ public class BmAgreementInfo extends BaseEntity
@ApiModelProperty(value = "关键词")
private String keyWord;
@ApiModelProperty(value = "附件列表")
private List<BmFileInfo> bmFileInfos;
}

View File

@ -3,11 +3,13 @@ package com.bonus.material.basic.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
@ -15,6 +17,8 @@ import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.service.IBmAgreementInfoService;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
/**
* 协议管理Service业务层处理
*
@ -27,6 +31,9 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
@Autowired
private BmAgreementInfoMapper bmAgreementInfoMapper;
@Resource
private BmFileInfoMapper bmFileInfoMapper;
/**
* 查询协议管理
*
@ -68,7 +75,21 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
bmAgreementInfo.setCreateTime(DateUtils.getNowDate());
bmAgreementInfo.setCreateBy(SecurityUtils.getUsername());
bmAgreementInfo.setAgreementCode(getAgreementCode());
return AjaxResult.success(bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo));
int count = bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo);
if (count > 0) {
if (CollectionUtils.isEmpty(bmAgreementInfo.getBmFileInfos())) {
return AjaxResult.success("新增任务成功,无营业执照附件");
}
AtomicBoolean addFileInfoResult = new AtomicBoolean(false);
bmAgreementInfo.getBmFileInfos().forEach(bmFileInfo -> {
bmFileInfo.setModelId(bmAgreementInfo.getAgreementId());
bmFileInfo.setCreateTime(DateUtils.getNowDate());
addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0);
});
return addFileInfoResult.get() ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,附件表插入0条");
} else {
return AjaxResult.error("新建任务失败,插入0条");
}
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}

View File

@ -81,9 +81,9 @@ public class LeaseOutDetailsController extends BaseController {
@RequiresPermissions("lease:details:add")
@SysLog(title = "领料出库详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料出库详细")
@PostMapping
public AjaxResult add(@RequestBody LeaseOutDetails leaseOutDetails) {
public AjaxResult add(@RequestBody List<LeaseOutDetails> leaseOutDetailsList) {
try {
return toAjax(leaseOutDetailsService.insertLeaseOutDetails(leaseOutDetails));
return leaseOutDetailsService.insertLeaseOutDetails(leaseOutDetailsList);
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}

View File

@ -62,5 +62,7 @@ public class LeaseOutDetails extends BaseEntity {
@ApiModelProperty(value = "是否推送到智慧工程01:是")
private Long pushNotifications;
@ApiModelProperty(value = "出库类型 0编码出库 1数量出库 2成套出库")
private Integer manageType;
}

View File

@ -1,6 +1,8 @@
package com.bonus.material.lease.service;
import java.util.List;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.lease.domain.LeaseOutDetails;
/**
@ -29,10 +31,10 @@ public interface ILeaseOutDetailsService {
/**
* 新增领料出库详细
*
* @param leaseOutDetails 领料出库详细
* @param leaseOutDetailsList 领料出库详细
* @return 结果
*/
public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails);
public AjaxResult insertLeaseOutDetails(List<LeaseOutDetails> leaseOutDetailsList);
/**
* 修改领料出库详细

View File

@ -3,11 +3,13 @@ package com.bonus.material.lease.service.impl;
import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.lease.mapper.LeaseOutDetailsMapper;
import com.bonus.material.lease.domain.LeaseOutDetails;
import com.bonus.material.lease.service.ILeaseOutDetailsService;
import org.springframework.transaction.annotation.Transactional;
/**
* 领料出库详细Service业务层处理
@ -45,17 +47,19 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
/**
* 新增领料出库详细
*
* @param leaseOutDetails 领料出库详细
* @param leaseOutDetailsList 领料出库详细
* @return 结果
*/
@Override
public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails) {
leaseOutDetails.setCreateTime(DateUtils.getNowDate());
try {
return leaseOutDetailsMapper.insertLeaseOutDetails(leaseOutDetails);
} catch (Exception e) {
throw new ServiceException("错误信息描述");
public AjaxResult insertLeaseOutDetails(List<LeaseOutDetails> leaseOutDetailsList) {
for (LeaseOutDetails bean : leaseOutDetailsList) {
// AjaxResult ajaxResult = submitOut(bean);
// if (ajaxResult.isError()) {
// return ajaxResult;
// }
leaseOutDetailsMapper.insertLeaseOutDetails(bean);
}
return AjaxResult.success();
}
/**
@ -95,4 +99,87 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
public int deleteLeaseOutDetailsById(Long id) {
return leaseOutDetailsMapper.deleteLeaseOutDetailsById(id);
}
/**
* 领料出库处理
*
* @param record 出库对象
* @return 结果
*/
//@Override
// @Transactional(rollbackFor = Exception.class)
// public AjaxResult submitOut(LeaseOutDetails record) {
// int res = 0;
// try {
// // 1判断是否重复提交
// res = checkRepeatSubmit(record);
// //record.setPreStoreNum(getStorageNum(record));
// if (res > 0) {
// if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) {
// record.setOutNum(record.getInputNum());
// }
// //2判断成套机具出库库存是否足够
// if (record.getManageType() == 2) {
// res = checkStorageNumCt(record);
// if (res == 0) {
// throw new RuntimeException("出库失败,库存不足");
// }
// } else {
// res = checkStorageNum(record);
// }
//
// if (res > 0) {
// // 3插入出库记录修改库存修改机具状态
// res = insertRecords(record);
// if (res == 0) {
// throw new RuntimeException("出库失败,更新设备规格库存数量时出错!");
// }
// // 4修改任务状态tm_task
// res = updateTaskStatus(record);
// if (res == 0) {
// throw new RuntimeException("出库失败,修改任务状态失败");
// }
// // 5插入结算记录
// String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
// res = insSltInfo(taskId, record);
// if (res == 0) {
// throw new RuntimeException("出库失败,插入结算记录失败");
// }
// record.setPostStoreNum(getStorageNum(record));
// } else {
// return AjaxResult.error("领料出库失败,机具库存不足");
// }
// } else {
// return AjaxResult.error("已领数量大于预领数量或该机具未在库");
// }
// } catch (Exception e) {
// return AjaxResult.error("出库失败");
// }
// return AjaxResult.success("出库成功");
// }
//
// private int checkRepeatSubmit(LeaseOutDetails record) {
// String maStatus = "15";
// int res = 0;
// if (record.getManageType() == 1 || record.getManageType() == 2) {
// // 如果是数量出库校验待出库数量
// LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
// if (details == null) {
// return res;
// } else {
// res = 1;
// }
// } else {
// // 如果是编码出库判断是否在库
// if (!(Objects.equals(0, record.getMaId()) || record.getMaId() == null)) {
// String status = leaseOutDetailsMapper.getMachineStatus(record);
// if (!maStatus.equals(status)) {
// return res;
// } else {
// res = 1;
// }
// }
// }
// return res;
// }
}

View File

@ -8,8 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="agreementCode" column="agreement_code" />
<result property="signTime" column="sign_time" />
<result property="unitId" column="unit_id" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="unitName" column="unit_name" />
<result property="createBy" column="create_by" />
<result property="leaseDay" column="lease_day" />
<result property="planStartTime" column="plan_start_time" />