供应商新增营业执照附件上传,新购流程开发

This commit is contained in:
syruan 2024-10-18 13:54:24 +08:00
parent c16a47c957
commit bb4d2ebf80
18 changed files with 373 additions and 108 deletions

View File

@ -4,65 +4,49 @@ import java.util.List;
import com.bonus.material.basic.domain.BmFileInfo;
/**
* 附件
Mapper接口
*
* 附件Mapper接口
* @author xsheng
* @date 2024-09-26
*/
public interface BmFileInfoMapper
{
public interface BmFileInfoMapper {
/**
* 查询附件
*
* @param id 附件
主键
*
* @param id 附件主键
* @return 附件
*/
public BmFileInfo selectBmFileInfoById(Long id);
BmFileInfo selectBmFileInfoById(Long id);
/**
* 查询附件
列表
*
* 查询附件列表
*
* @param bmFileInfo 附件
* @return 附件
集合
* @return 附件集合
*/
public List<BmFileInfo> selectBmFileInfoList(BmFileInfo bmFileInfo);
List<BmFileInfo> selectBmFileInfoList(BmFileInfo bmFileInfo);
/**
* 新增附件
*
*
* @param bmFileInfo 附件
* @return 结果
*/
public int insertBmFileInfo(BmFileInfo bmFileInfo);
int insertBmFileInfo(BmFileInfo bmFileInfo);
/**
* 修改附件
*
*
* @param bmFileInfo 附件
* @return 结果
*/
public int updateBmFileInfo(BmFileInfo bmFileInfo);
int updateBmFileInfo(BmFileInfo bmFileInfo);
/**
* 删除附件
*
* @param id 附件
主键
*
* @param id 附件主键
* @return 结果
*/
public int deleteBmFileInfoById(Long id);
int deleteBmFileInfoById(Long id);
/**
* 批量删除附件
@ -71,5 +55,5 @@ public interface BmFileInfoMapper
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBmFileInfoByIds(Long[] ids);
int deleteBmFileInfoByIds(Long[] ids);
}

View File

@ -82,7 +82,7 @@ public class SupplierInfoController extends BaseController {
@SysLog(title = "物资厂家管理", businessType = OperaType.INSERT, module = "物资管理->新增物资厂家管理")
@PostMapping
public AjaxResult add(@RequestBody SupplierInfo supplierInfo) {
return toAjax(supplierInfoService.insertSupplierInfo(supplierInfo));
return supplierInfoService.insertSupplierInfo(supplierInfo);
}
/**

View File

@ -1,11 +1,15 @@
package com.bonus.material.ma.domain;
import com.bonus.common.core.annotation.Excel;
import com.bonus.system.api.domain.SysFile;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 物资厂家管理对象 ma_supplier_info
@ -54,8 +58,8 @@ public class SupplierInfo extends BaseEntity {
private String businessScope;
/** 营业执照 */
@Excel(name = "营业执照")
@ApiModelProperty(value = "营业执照")
@Excel(name = "营业执照URL")
@ApiModelProperty(value = "营业执照URL")
private String businessLicense;
/** 删除标志0代表存在 2代表删除 */
@ -71,5 +75,10 @@ public class SupplierInfo extends BaseEntity {
@ApiModelProperty(value = "状态(0开 1关)")
private Long status;
/**
* 营业执照文件列表
*/
@ApiModelProperty(value = "营业执照文件列表")
List<SysFile> businessLicenseFileList;
}

View File

@ -1,6 +1,8 @@
package com.bonus.material.ma.service;
import java.util.List;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.ma.domain.SupplierInfo;
/**
@ -31,7 +33,7 @@ public interface ISupplierInfoService {
* @param supplierInfo 物资厂家管理
* @return 结果
*/
int insertSupplierInfo(SupplierInfo supplierInfo);
AjaxResult insertSupplierInfo(SupplierInfo supplierInfo);
/**
* 修改物资厂家管理

View File

@ -1,8 +1,13 @@
package com.bonus.material.ma.service.impl;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.basic.domain.BmFileInfo;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.system.api.RemoteFileService;
import org.springframework.stereotype.Service;
import com.bonus.material.ma.mapper.SupplierInfoMapper;
import com.bonus.material.ma.domain.SupplierInfo;
@ -17,9 +22,17 @@ import javax.annotation.Resource;
*/
@Service
public class SupplierInfoServiceImpl implements ISupplierInfoService {
public static final long MODEL_ID = 16L;
@Resource
private SupplierInfoMapper supplierInfoMapper;
@Resource
private RemoteFileService remoteFileService;
@Resource
private BmFileInfoMapper bmFileInfoMapper;
/**
* 查询物资厂家管理
*
@ -49,9 +62,42 @@ public class SupplierInfoServiceImpl implements ISupplierInfoService {
* @return 结果
*/
@Override
public int insertSupplierInfo(SupplierInfo supplierInfo) {
public AjaxResult insertSupplierInfo(SupplierInfo supplierInfo) {
supplierInfo.setCreateTime(DateUtils.getNowDate());
return supplierInfoMapper.insertSupplierInfo(supplierInfo);
int insertedSupplierInfoResult = supplierInfoMapper.insertSupplierInfo(supplierInfo);
if (insertedSupplierInfoResult > 0) {
AtomicBoolean addFileInfoResult = new AtomicBoolean(false);
supplierInfo.getBusinessLicenseFileList().forEach(file -> {
BmFileInfo bmFileInfo = new BmFileInfo();
if (file.getName() != null) {
bmFileInfo.setFileName(file.getName());
}
bmFileInfo.setFileUrl(file.getUrl());
// TODO: 此处需要修改为字典表中定义的Model模块id
bmFileInfo.setModelId(MODEL_ID);
addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0);
});
return addFileInfoResult.get() ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,详情表插入0条");
} else {
return AjaxResult.error("新增任务失败,info表插入0条");
}
// if (insertedSupplierInfoResult > 0 && ArrayUtil.isNotEmpty(supplierInfo.getFiles())) {
// AjaxResult uploadedFilesResult = remoteFileService.uploadFile(supplierInfo.getFiles());
// if (uploadedFilesResult.isSuccess()) {
// Object uploadFilesResultData = uploadedFilesResult.get("data");
// if (uploadFilesResultData != null) {
// if (uploadFilesResultData instanceof List) {
//
// }
// }
// } else {
// return AjaxResult.error("新增任务失败,文件上传失败:" + uploadedFilesResult.get("msg"));
// }
// }
}
/**

View File

@ -1,9 +1,14 @@
package com.bonus.material.purchase.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.purchase.dto.PurchaseCheckDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,7 +40,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
@RequestMapping("/purchase_check_info")
public class PurchaseCheckInfoController extends BaseController {
@Autowired
@Resource
private IPurchaseCheckInfoService purchaseCheckInfoService;
/**
@ -50,19 +55,6 @@ public class PurchaseCheckInfoController extends BaseController {
return getDataTable(list);
}
/**
* 导出新购验收任务列表
*/
@ApiOperation(value = "导出新购验收任务列表")
@PreventRepeatSubmit
@RequiresPermissions("purchase:info:export")
@SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出新购验收任务")
@PostMapping("/export")
public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseCheckInfo> list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo);
ExcelUtil<PurchaseCheckInfo> util = new ExcelUtil<PurchaseCheckInfo>(PurchaseCheckInfo.class);
util.exportExcel(response, list, "新购验收任务数据");
}
/**
* 获取新购验收任务详细信息
@ -80,11 +72,11 @@ public class PurchaseCheckInfoController extends BaseController {
@ApiOperation(value = "新增新购验收任务")
@PreventRepeatSubmit
@RequiresPermissions("purchase:info:add")
@SysLog(title = "新购验收任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增新购验收任务")
@SysLog(title = "新购验收任务", businessType = OperaType.INSERT, module = "仓储管理->新增新购验收任务")
@PostMapping
public AjaxResult add(@RequestBody PurchaseCheckInfo purchaseCheckInfo) {
public AjaxResult add(@Valid @NotNull @RequestBody PurchaseCheckDto purchaseCheckDto) {
try {
return toAjax(purchaseCheckInfoService.insertPurchaseCheckInfo(purchaseCheckInfo));
return purchaseCheckInfoService.insertPurchaseCheckInfo(purchaseCheckDto);
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
@ -96,7 +88,7 @@ public class PurchaseCheckInfoController extends BaseController {
@ApiOperation(value = "修改新购验收任务")
@PreventRepeatSubmit
@RequiresPermissions("purchase:info:edit")
@SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购验收任务")
@SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, module = "仓储管理->修改新购验收任务")
@PutMapping
public AjaxResult edit(@RequestBody PurchaseCheckInfo purchaseCheckInfo) {
try {
@ -112,9 +104,25 @@ public class PurchaseCheckInfoController extends BaseController {
@ApiOperation(value = "删除新购验收任务")
@PreventRepeatSubmit
@RequiresPermissions("purchase:info:remove")
@SysLog(title = "新购验收任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除新购验收任务")
@SysLog(title = "新购验收任务", businessType = OperaType.DELETE, module = "仓储管理->删除新购验收任务")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(purchaseCheckInfoService.deletePurchaseCheckInfoByIds(ids));
}
/**
* 导出新购验收任务列表
*/
@ApiOperation(value = "导出新购验收任务列表")
@PreventRepeatSubmit
@RequiresPermissions("purchase:info:export")
@SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, module = "仓储管理->导出新购验收任务")
@PostMapping("/export")
public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseCheckInfo> list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo);
ExcelUtil<PurchaseCheckInfo> util = new ExcelUtil<PurchaseCheckInfo>(PurchaseCheckInfo.class);
util.exportExcel(response, list, "新购验收任务数据");
}
}

View File

@ -6,20 +6,19 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 新购验收任务详细对象 purchase_check_details
*
* @author xsheng
* @date 2024-10-16
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class PurchaseCheckDetails extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id */
@ -35,6 +34,12 @@ public class PurchaseCheckDetails extends BaseEntity {
@ApiModelProperty(value = "规格id")
private Long typeId;
@ApiModelProperty(value = "规格名称")
private String typeName;
@ApiModelProperty(value = "物资名称--规格parent类型")
private String maTypeName;
/** 采购单价 */
@Excel(name = "采购单价")
@ApiModelProperty(value = "采购单价")
@ -60,11 +65,15 @@ public class PurchaseCheckDetails extends BaseEntity {
@ApiModelProperty(value = "验收结论")
private String checkResult;
/** 供应商id */
@Excel(name = "供应商id")
@ApiModelProperty(value = "供应商id")
/** 物资厂家id */
@Excel(name = "物资厂家id")
@ApiModelProperty(value = "物资厂家id")
private Long supplierId;
/** 物资厂家名称 */
@ApiModelProperty(value = "物资厂家名称")
private String supplierName;
/** 0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过7-综合服务中心不通过 */
@Excel(name = "0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过7-综合服务中心不通过")
@ApiModelProperty(value = "0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过7-综合服务中心不通过")

View File

@ -5,17 +5,15 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 新购验收任务对象 purchase_check_info
*
* @author xsheng
* @date 2024-10-16
* @author syruan
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class PurchaseCheckInfo extends BaseEntity {
@ -29,6 +27,9 @@ public class PurchaseCheckInfo extends BaseEntity {
@ApiModelProperty(value = "任务ID")
private Long taskId;
@ApiModelProperty(value = "任务状态")
private String taskStatus;
/** 采购日期 */
@ApiModelProperty(value = "采购日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@ -51,5 +52,16 @@ public class PurchaseCheckInfo extends BaseEntity {
@ApiModelProperty(value = "数据所属组织")
private Long companyId;
/**
* 采购物资
*/
@ApiModelProperty(value = "采购物资--外层Table字段")
private String purchaseMaTypeName;
/**
* 采购数量
*/
@ApiModelProperty(value = "采购数量--外层Table字段")
private String purchaseMaNumber;
}

View File

@ -0,0 +1,35 @@
package com.bonus.material.purchase.dto;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.material.purchase.domain.PurchaseCheckInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.material.purchase
* @CreateTime: 2024-10-18 09:52
* @Description: 新购任务新增-请求参数封装DTO
*/
@Data
public class PurchaseCheckDto {
/**
* 采购验收任务info
*/
@ApiModelProperty(value = "采购验收任务info")
@NotNull(message = "采购验收任务info对象不能为空")
private PurchaseCheckInfo purchaseCheckInfo;
/**
* 采购验收任务详情集合
*/
@ApiModelProperty(value = "采购验收任务详情集合")
private List<PurchaseCheckDetails> purchaseCheckDetailsList;
}

View File

@ -2,6 +2,7 @@ package com.bonus.material.purchase.mapper;
import java.util.List;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import org.apache.ibatis.annotations.Param;
/**
* 新购验收任务详细Mapper接口
@ -10,6 +11,16 @@ import com.bonus.material.purchase.domain.PurchaseCheckDetails;
* @date 2024-10-16
*/
public interface PurchaseCheckDetailsMapper {
/**
* 根据任务id查询物资类型名称1-验收2-入库
*
* @param taskId * @param type 1-验收2-入库
* @return String类型多个物资类型根据逗号分割
*/
String selectMaTypeNameByTaskId(@Param("taskId") Long taskId, @Param("type") String type);
/**
* 查询新购验收任务详细
*
@ -24,7 +35,7 @@ public interface PurchaseCheckDetailsMapper {
* @param purchaseCheckDetails 新购验收任务详细
* @return 新购验收任务详细集合
*/
public List<PurchaseCheckDetails> selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails);
List<PurchaseCheckDetails> selectPurchaseCheckDetailsList(PurchaseCheckDetails purchaseCheckDetails);
/**
* 新增新购验收任务详细
@ -32,7 +43,13 @@ public interface PurchaseCheckDetailsMapper {
* @param purchaseCheckDetails 新购验收任务详细
* @return 结果
*/
public int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
int insertPurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
/**
* 批量新增新购验收任务详细
* @param purchaseCheckDetailsList 新购验收任务详细集合
*/
int insertPurchaseCheckDetailsList(List<PurchaseCheckDetails> purchaseCheckDetailsList);
/**
* 修改新购验收任务详细
@ -40,7 +57,7 @@ public interface PurchaseCheckDetailsMapper {
* @param purchaseCheckDetails 新购验收任务详细
* @return 结果
*/
public int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
/**
* 删除新购验收任务详细
@ -48,7 +65,7 @@ public interface PurchaseCheckDetailsMapper {
* @param id 新购验收任务详细主键
* @return 结果
*/
public int deletePurchaseCheckDetailsById(Long id);
int deletePurchaseCheckDetailsById(Long id);
/**
* 批量删除新购验收任务详细
@ -56,5 +73,5 @@ public interface PurchaseCheckDetailsMapper {
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePurchaseCheckDetailsByIds(Long[] ids);
int deletePurchaseCheckDetailsByIds(Long[] ids);
}

View File

@ -16,15 +16,24 @@ public interface PurchaseCheckInfoMapper {
* @param id 新购验收任务主键
* @return 新购验收任务
*/
public PurchaseCheckInfo selectPurchaseCheckInfoById(Long id);
PurchaseCheckInfo selectPurchaseCheckInfoById(Long id);
/**
* 查询新购验收任务列表
* 查询新购验收任务列表--单表基础查询
*
* @param purchaseCheckInfo 新购验收任务
* @return 新购验收任务集合
*/
public List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo);
List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo);
/**
* 查询新购验收任务列表--多表关联查询
*
* @param purchaseCheckInfo 新购验收任务
* @return 新购验收任务集合
*/
List<PurchaseCheckInfo> selectPurchaseCheckInfoJoinList(PurchaseCheckInfo purchaseCheckInfo);
/**
* 新增新购验收任务
@ -32,7 +41,7 @@ public interface PurchaseCheckInfoMapper {
* @param purchaseCheckInfo 新购验收任务
* @return 结果
*/
public int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo);
int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo);
/**
* 修改新购验收任务
@ -40,7 +49,7 @@ public interface PurchaseCheckInfoMapper {
* @param purchaseCheckInfo 新购验收任务
* @return 结果
*/
public int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo);
int updatePurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo);
/**
* 删除新购验收任务
@ -48,7 +57,7 @@ public interface PurchaseCheckInfoMapper {
* @param id 新购验收任务主键
* @return 结果
*/
public int deletePurchaseCheckInfoById(Long id);
int deletePurchaseCheckInfoById(Long id);
/**
* 批量删除新购验收任务
@ -56,5 +65,5 @@ public interface PurchaseCheckInfoMapper {
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePurchaseCheckInfoByIds(Long[] ids);
int deletePurchaseCheckInfoByIds(Long[] ids);
}

View File

@ -1,7 +1,10 @@
package com.bonus.material.purchase.service;
import java.util.List;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.purchase.domain.PurchaseCheckInfo;
import com.bonus.material.purchase.dto.PurchaseCheckDto;
/**
* 新购验收任务Service接口
@ -28,10 +31,10 @@ public interface IPurchaseCheckInfoService {
/**
* 新增新购验收任务
*
* @param purchaseCheckInfo 新购验收任务
* @param purchaseCheckDto 新购验收任务dto
* @return 结果
*/
int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo);
AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckDto);
/**
* 修改新购验收任务

View File

@ -3,6 +3,11 @@ package com.bonus.material.purchase.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 com.bonus.material.purchase.dto.PurchaseCheckDto;
import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.mapper.TmTaskMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.purchase.mapper.PurchaseCheckInfoMapper;
@ -10,6 +15,7 @@ import com.bonus.material.purchase.domain.PurchaseCheckInfo;
import com.bonus.material.purchase.service.IPurchaseCheckInfoService;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
/**
* 新购验收任务Service业务层处理
@ -22,6 +28,12 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
@Resource
private PurchaseCheckInfoMapper purchaseCheckInfoMapper;
@Resource
private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper;
@Resource
private TmTaskMapper tmTaskMapper;
/**
* 查询新购验收任务
*
@ -36,12 +48,22 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
/**
* 查询新购验收任务列表
*
* @param purchaseCheckInfo 新购验收任务
* @param purchaseCheckInfoDto 新购验收任务请求参数
* @return 新购验收任务
*/
@Override
public List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo) {
return purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfo);
public List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfoDto) {
// 查询新购info列表
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfoDto);
// 过滤info列表中空的对象
purchaseCheckInfos.removeIf(purchaseCheckInfo -> purchaseCheckInfo.getTaskId() == null);
// 查询details表获取详细的采购物资名称
for (PurchaseCheckInfo purchaseCheckInfo : purchaseCheckInfos) {
String purchaseMaName = purchaseCheckDetailsMapper.selectMaTypeNameByTaskId(purchaseCheckInfo.getTaskId(), null);
purchaseCheckInfo.setPurchaseMaTypeName(purchaseMaName != null ? purchaseMaName : "");
}
return purchaseCheckInfos;
}
/**
@ -51,12 +73,49 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
* @return 结果
*/
@Override
public int insertPurchaseCheckInfo(PurchaseCheckInfo purchaseCheckInfo) {
purchaseCheckInfo.setCreateTime(DateUtils.getNowDate());
public AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckInfo) {
// 赋值创建时间
purchaseCheckInfo.getPurchaseCheckInfo().setCreateTime(DateUtils.getNowDate());
try {
return purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo);
// TODO: 任务类型XG 待完善先定义死后期修改至配置中心
// 查询新购任务当月最大单号
Integer thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), 16L);
// 查询出的单号值进行必要性校正
if (thisMonthMaxOrder == null || thisMonthMaxOrder == 0) {
thisMonthMaxOrder = 1;
} else {
thisMonthMaxOrder = thisMonthMaxOrder + 1;
}
// 生成单号
String taskCode = "XG" + DateUtils.getCurrentYear() + DateUtils.getCurrentMonth() + String.format("%06d", thisMonthMaxOrder);
// 先往tm_task任务表中创建任务
TmTask tmTask = new TmTask(null, 16L, 55L, taskCode, purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1);
Long taskId = 0L;
if (tmTaskMapper.insertTmTask(tmTask) > 0) {
taskId = tmTask.getTaskId();
} else {
return AjaxResult.error("新增任务失败_task表插入0条");
}
// tm_task 插入成功后再往新购验收info表中插入数据
purchaseCheckInfo.getPurchaseCheckInfo().setTaskId(taskId);
if (purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo.getPurchaseCheckInfo()) > 0) {
Long finalTaskId = taskId;
purchaseCheckInfo.getPurchaseCheckDetailsList().forEach(
details -> {
details.setTaskId(finalTaskId);
details.setInputStatus("0");
});
// 批量插入详情数据
boolean purchaseCheckDetailsListAddResult = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckInfo.getPurchaseCheckDetailsList()) > 0;
return purchaseCheckDetailsListAddResult ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,详情表插入0条");
} else {
return AjaxResult.error("新增任务失败,info表插入0条");
}
} catch (Exception e) {
throw new ServiceException("错误信息描述");
return AjaxResult.error("新增任务失败:" + e.getMessage());
}
}

View File

@ -3,20 +3,19 @@ package com.bonus.material.task.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 任务对象 tm_task
*
* @author xsheng
* @date 2024-10-16
* @author syruan
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
public class TmTask extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 任务ID */
@ -47,5 +46,18 @@ public class TmTask extends BaseEntity {
@ApiModelProperty(value = "0不启用 1启用")
private String status;
@ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型")
private Integer monthOrder;
public TmTask(Long taskId, Long taskType, Long taskStatus, String code, Long companyId, String status, Integer monthOrder) {
this.taskId = taskId;
this.taskType = taskType;
this.taskStatus = taskStatus;
this.code = code;
this.companyId = companyId;
this.status = status;
this.monthOrder = monthOrder;
}
public TmTask() {}
}

View File

@ -2,6 +2,7 @@ package com.bonus.material.task.mapper;
import java.util.List;
import com.bonus.material.task.domain.TmTask;
import org.apache.ibatis.annotations.Param;
/**
* 任务Mapper接口
@ -16,7 +17,15 @@ public interface TmTaskMapper {
* @param taskId 任务主键
* @return 任务
*/
public TmTask selectTmTaskByTaskId(Long taskId);
TmTask selectTmTaskByTaskId(Long taskId);
/**
* 查询当年当月最大任务序号用于生成任务编号 by 分类型查询
* @param year
* @param month
* @param type 任务类型字典表中获取例如新购是:16
*/
Integer getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month, @Param("type") Long type);
/**
* 查询任务列表
@ -24,7 +33,7 @@ public interface TmTaskMapper {
* @param tmTask 任务
* @return 任务集合
*/
public List<TmTask> selectTmTaskList(TmTask tmTask);
List<TmTask> selectTmTaskList(TmTask tmTask);
/**
* 新增任务
@ -32,7 +41,7 @@ public interface TmTaskMapper {
* @param tmTask 任务
* @return 结果
*/
public int insertTmTask(TmTask tmTask);
int insertTmTask(TmTask tmTask);
/**
* 修改任务
@ -40,7 +49,7 @@ public interface TmTaskMapper {
* @param tmTask 任务
* @return 结果
*/
public int updateTmTask(TmTask tmTask);
int updateTmTask(TmTask tmTask);
/**
* 删除任务
@ -48,7 +57,7 @@ public interface TmTaskMapper {
* @param taskId 任务主键
* @return 结果
*/
public int deleteTmTaskByTaskId(Long taskId);
int deleteTmTaskByTaskId(Long taskId);
/**
* 批量删除任务
@ -56,5 +65,5 @@ public interface TmTaskMapper {
* @param taskIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteTmTaskByTaskIds(Long[] taskIds);
int deleteTmTaskByTaskIds(Long[] taskIds);
}

View File

@ -157,4 +157,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectMaTypeNameByTaskId" resultType="java.lang.String">
select
GROUP_CONCAT(type_name) typeName
from
(
select
distinct pcd.task_id, mt1.type_name
from
purchase_check_details pcd
left join
ma_type mt on pcd.type_id = mt.type_id
left join
ma_type mt1 on mt.parent_id = mt1.type_id
where
pcd.task_id = #{taskId}
) t
GROUP BY task_id
</select>
<insert id="insertPurchaseCheckDetailsList">
<foreach collection="list" item="item" separator=";">
insert into purchase_check_details(task_id,type_id,purchase_price,purchase_num,check_num,bind_num,check_result,supplier_id,status,production_time,create_by,create_time,update_by,update_time,remark,check_url_name,check_url,input_num,input_status,input_time,file_name,file_url,company_id)
values(#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId},#{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum},#{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId})
</foreach>
</insert>
</mapper>

View File

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="taskStatus" column="task_status" />
</resultMap>
<sql id="selectPurchaseCheckInfoBaseSQL">
@ -28,9 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseCheckInfoJoinSQL">
select
pci.id, pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by,
pci.create_time, pci.update_by, pci.update_time, pci.remark, pci.company_id
pci.create_time, pci.update_by, pci.update_time, pci.remark, pci.company_id,
t.task_status, t.task_type
from
purchase_check_info pci
left join tm_task t on t.task_id = pci.task_id
</sql>
<select id="selectPurchaseCheckInfoList" parameterType="com.bonus.material.purchase.domain.PurchaseCheckInfo" resultMap="PurchaseCheckInfoResult">
@ -104,4 +107,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectPurchaseCheckInfoJoinList" resultMap="PurchaseCheckInfoResult">
<include refid="selectPurchaseCheckInfoJoinSQL"/>
<where>
<if test="taskId != null "> and pci.task_id = #{taskId}</if>
<if test="purchaseTime != null "> and pci.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null "> and pci.arrival_time = #{arrivalTime}</if>
<if test="purchaser != null "> and pci.purchaser = #{purchaser}</if>
</where>
</select>
</mapper>

View File

@ -15,10 +15,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="status" column="status" />
<result property="monthOrder" column="month_order" />
</resultMap>
<sql id="selectTmTaskVo">
select task_id, task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id, status from tm_task
select task_id, task_type, task_status, code, create_by, create_time,
update_by, update_time, remark, company_id, status , month_order
from tm_task
</sql>
<select id="selectTmTaskList" parameterType="com.bonus.material.task.domain.TmTask" resultMap="TmTaskResult">
@ -42,14 +45,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskType != null">task_type,</if>
<if test="taskStatus != null">task_status,</if>
<if test="code != null">code,</if>
<if test="code != null">`code`,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
<if test="status != null">status,</if>
<if test="status != null">`status`,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskType != null">#{taskType},</if>
@ -77,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="status != null">status = #{status},</if>
<if test="status != null">`status` = #{status},</if>
</trim>
where task_id = #{taskId}
</update>
@ -92,4 +95,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{taskId}
</foreach>
</delete>
<select id="getMonthMaxOrderByDate" resultType="java.lang.Integer">
select max(month_order) from tm_task
where
month(create_time) = #{month} and year(create_time) = #{year}
<if test="type != null and type !=''">
and task_type = #{type}
</if>
</select>
</mapper>