|
|
@ -6,6 +6,9 @@ import com.deepoove.poi.XWPFTemplate; |
|
|
|
import com.deepoove.poi.config.Configure; |
|
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; |
|
|
|
import com.github.pagehelper.Page; |
|
|
|
import com.ruoyi.common.config.RuoYiConfig; |
|
|
|
import com.ruoyi.common.config.ServerConfig; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
|
import com.ruoyi.common.core.page.PageDomain; |
|
|
|
import com.ruoyi.common.core.page.TableSupport; |
|
|
@ -18,6 +21,7 @@ import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils; |
|
|
|
import com.ruoyi.common.utils.file.FileDownloadUtils; |
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils; |
|
|
|
import com.ruoyi.erp.domain.ErpDevelopModifyorder; |
|
|
|
import com.ruoyi.erp.mapper.ErpDevelopModifyorderMapper; |
|
|
|
import com.ruoyi.financial.domain.FinancialAccountsPayable; |
|
|
@ -32,6 +36,7 @@ import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper; |
|
|
|
import com.ruoyi.purchase.mapper.PurchaseOrderMapper; |
|
|
|
import com.ruoyi.purchase.mapper.PurchasePlanMapper; |
|
|
|
import com.ruoyi.purchase.service.IPurchaseOrderService; |
|
|
|
import com.ruoyi.system.domain.SysAttachFile; |
|
|
|
import com.ruoyi.system.domain.SysCompanyInformation; |
|
|
|
import com.ruoyi.system.domain.SysSupplier; |
|
|
|
import com.ruoyi.system.domain.Vo.SysSupplierVo; |
|
|
@ -55,6 +60,7 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
@ -135,6 +141,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
|
private SysCompanyInformationMapper companyInformationMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ServerConfig serverConfig; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询采购订单 |
|
|
|
* |
|
|
@ -707,6 +718,9 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
|
return processInstance; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出采购订单供应商合同 |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public void exportPurchaseOrder(PurchaseOrder purchaseOrder, String supplierCode, HttpServletResponse response) { |
|
|
|
String fileName = "采购合同.docx"; |
|
|
@ -823,6 +837,48 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 导入采购订单供应商合同 |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public AjaxResult uploadSingleFile(MultipartFile file,String purchaseOrderCode) { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
|
//上传路径
|
|
|
|
String filePath = RuoYiConfig.getUploadPath(); |
|
|
|
//上传并返回新文件名称
|
|
|
|
String fileName = FileUploadUtils.upload(filePath, file); |
|
|
|
String url = serverConfig.getUrl() + fileName; |
|
|
|
String originalFilename = file.getOriginalFilename(); |
|
|
|
String fileExt = originalFilename.substring(originalFilename.lastIndexOf(".") + 1); |
|
|
|
long fileSize = file.getSize(); |
|
|
|
if (StringUtils.isEmpty(purchaseOrderCode)){ |
|
|
|
throw new RuntimeException("采购订单编码为空"); |
|
|
|
} |
|
|
|
PurchaseOrder purchaseOrder = purchaseOrderMapper.selectPurchaseOrderByOrderCode(purchaseOrderCode); |
|
|
|
|
|
|
|
//保存文件信息
|
|
|
|
SysAttachFile sysAttachFile = new SysAttachFile(); |
|
|
|
sysAttachFile.setBusinessKey(purchaseOrderCode); |
|
|
|
sysAttachFile.setBusinessId(purchaseOrder.getPurchaseOrderId()); |
|
|
|
sysAttachFile.setName(originalFilename); |
|
|
|
sysAttachFile.setExt(fileExt); |
|
|
|
sysAttachFile.setPath(fileName); |
|
|
|
sysAttachFile.setSize(fileSize); |
|
|
|
sysAttachFile.setUrl(url); |
|
|
|
sysAttachFile.setCreateBy(loginName); |
|
|
|
attachFileService.insertSysAttachFile(sysAttachFile); |
|
|
|
AjaxResult ajaxResult = AjaxResult.success(sysAttachFile); |
|
|
|
return ajaxResult; |
|
|
|
} catch (Exception e) { |
|
|
|
return AjaxResult.error(e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private ProcessInstance startProcessInstance(String applyTitle, String instanceType, PurchaseOrder purchaseOrder, SysUser user) { |
|
|
|
Long materialId = purchaseOrder.getPurchaseOrderId(); |
|
|
|
String businessKey = materialId.toString(); // 实体类 ID,作为流程的业务 key
|
|
|
|