Merge remote-tracking branch 'origin/master'

This commit is contained in:
jjLv 2024-11-12 16:11:46 +08:00
commit 6f0fef8140
8 changed files with 133 additions and 33 deletions

View File

@ -14,7 +14,8 @@ public enum TmTaskTypeEnum {
TM_TASK_SCRAP(6, "报废任务"), TM_TASK_SCRAP(6, "报废任务"),
TM_TASK_SETTLEMENT(7, "结算任务"), TM_TASK_SETTLEMENT(7, "结算任务"),
TM_TASK_CHECK(8, "检验任务"), TM_TASK_CHECK(8, "检验任务"),
TM_TASK_FACTORY_MANAGEMENT(9, "物资厂家管理任务"); TM_TASK_FACTORY_MANAGEMENT(9, "物资厂家管理任务"),
TM_TASK_AGREEMENT_MANAGEMENT(10, "新增协议任务");
private final Integer taskTypeId; private final Integer taskTypeId;
private final String taskTypeName; private final String taskTypeName;

View File

@ -104,7 +104,7 @@ public class BmAgreementInfoController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody BmAgreementInfo bmAgreementInfo) public AjaxResult edit(@RequestBody BmAgreementInfo bmAgreementInfo)
{ {
return toAjax(bmAgreementInfoService.updateBmAgreementInfo(bmAgreementInfo)); return bmAgreementInfoService.updateBmAgreementInfo(bmAgreementInfo);
} }
/** /**

View File

@ -43,7 +43,7 @@ public interface IBmAgreementInfoService
* @param bmAgreementInfo 协议管理 * @param bmAgreementInfo 协议管理
* @return 结果 * @return 结果
*/ */
public int updateBmAgreementInfo(BmAgreementInfo bmAgreementInfo); public AjaxResult updateBmAgreementInfo(BmAgreementInfo bmAgreementInfo);
/** /**
* 批量删除协议管理 * 批量删除协议管理

View File

@ -5,10 +5,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.basic.domain.BmFileInfo;
import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.basic.mapper.BmFileInfoMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -16,7 +18,6 @@ import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.basic.domain.BmAgreementInfo; import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.service.IBmAgreementInfoService; import com.bonus.material.basic.service.IBmAgreementInfoService;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
/** /**
@ -43,7 +44,13 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
@Override @Override
public BmAgreementInfo selectBmAgreementInfoByAgreementId(Long agreementId) public BmAgreementInfo selectBmAgreementInfoByAgreementId(Long agreementId)
{ {
return bmAgreementInfoMapper.selectBmAgreementInfoByAgreementId(agreementId); BmAgreementInfo bmAgreementInfo = bmAgreementInfoMapper.selectBmAgreementInfoByAgreementId(agreementId);
BmFileInfo bmFileInfo = new BmFileInfo();
bmFileInfo.setModelId(bmAgreementInfo.getAgreementId());
bmFileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_FACTORY_MANAGEMENT.getTaskTypeId());
List<BmFileInfo> fileInfos = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
bmAgreementInfo.setBmFileInfos(fileInfos);
return bmAgreementInfo;
} }
/** /**
@ -105,10 +112,6 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%04d", num); return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%04d", num);
} }
// public static void main(String[] args) {
// System.out.println(String.format("-%05d", 555));
// }
/** /**
* 修改协议管理 * 修改协议管理
* *
@ -116,10 +119,29 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateBmAgreementInfo(BmAgreementInfo bmAgreementInfo) public AjaxResult updateBmAgreementInfo(BmAgreementInfo bmAgreementInfo)
{ {
bmAgreementInfo.setUpdateTime(DateUtils.getNowDate()); bmAgreementInfo.setUpdateTime(DateUtils.getNowDate());
return bmAgreementInfoMapper.updateBmAgreementInfo(bmAgreementInfo); int count = bmAgreementInfoMapper.updateBmAgreementInfo(bmAgreementInfo);
if (count > 0) {
BmFileInfo bmFileInfoToDelete = new BmFileInfo();
bmFileInfoToDelete.setModelId(bmAgreementInfo.getAgreementId());
bmFileInfoToDelete.setTaskType(TmTaskTypeEnum.TM_TASK_AGREEMENT_MANAGEMENT.getTaskTypeId());
bmFileInfoMapper.deleteBmFileInfoByBizInfo(bmFileInfoToDelete);
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 {
AjaxResult.error("无协议被修改");
}
return AjaxResult.success("修改协议成功");
} }
/** /**

View File

@ -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());
} }

View File

@ -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);
/** /**
* 批量删除领料任务 * 批量删除领料任务

View File

@ -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条");
} }
@ -104,6 +105,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
if (!CollectionUtils.isEmpty(leaseApplyDetailsList)) { if (!CollectionUtils.isEmpty(leaseApplyDetailsList)) {
for (LeaseApplyDetails details : leaseApplyDetailsList) { for (LeaseApplyDetails details : leaseApplyDetailsList) {
details.setParentId(taskId); // 设置领料taskId details.setParentId(taskId); // 设置领料taskId
details.setCreateTime(DateUtils.getNowDate());
details.setCreateBy(SecurityUtils.getUsername());
//details.setStatus(PurchaseTaskStatusEnum.TO_NOTICE.getStatus()); //details.setStatus(PurchaseTaskStatusEnum.TO_NOTICE.getStatus());
} }
// 批量插入详情数据 // 批量插入详情数据
@ -130,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("错误信息描述");

View File

@ -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;
}