上传文件至 'op-modules/op-sap/src/main/java/com/op/sap/service/impl'
parent
8f8a7b479e
commit
d22b40f91f
@ -0,0 +1,110 @@
|
||||
package com.op.sap.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.sap.domain.SapBaseFile;
|
||||
import com.op.sap.mapper.SapBaseFileMapper;
|
||||
import com.op.sap.service.SapBaseFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件Service业务层处理
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-10
|
||||
*/
|
||||
@Service
|
||||
public class SapBaseFileServiceImpl implements SapBaseFileService {
|
||||
@Autowired
|
||||
private SapBaseFileMapper baseFileMapper;
|
||||
|
||||
/**
|
||||
* 查询附件
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 附件
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public SapBaseFile selectBaseFileByFileId(String fileId) {
|
||||
return baseFileMapper.selectBaseFileByFileId(fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 附件
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public List<SapBaseFile> selectBaseFileList(SapBaseFile baseFile) {
|
||||
return baseFileMapper.selectBaseFileList(baseFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int insertBaseFile(SapBaseFile baseFile) {
|
||||
baseFile.setCreateTime(DateUtils.getNowDate());
|
||||
return baseFileMapper.insertBaseFile(baseFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param baseFile 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int updateBaseFile(SapBaseFile baseFile) {
|
||||
baseFile.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseFileMapper.updateBaseFile(baseFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param fileIds 需要删除的附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteBaseFileByFileIds(String[] fileIds) {
|
||||
return baseFileMapper.deleteBaseFileByFileIds(fileIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件信息
|
||||
*
|
||||
* @param fileId 附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteBaseFileByFileId(String fileId) {
|
||||
return baseFileMapper.deleteBaseFileByFileId(fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param baseFiles 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public Boolean insertBaseFileBatch(List<BaseFileData> baseFiles) {
|
||||
return baseFileMapper.insertBaseFileBatch(baseFiles);
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package com.op.sap.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.op.common.core.domain.R;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.common.security.utils.SecurityUtils;
|
||||
import com.op.sap.domain.SapBaseProduct;
|
||||
import com.op.sap.domain.SapConn;
|
||||
import com.op.sap.mapper.SapBaseProductMapper;
|
||||
import com.op.sap.service.ISapBaseProductService;
|
||||
import com.op.sap.util.SAPConnUtils;
|
||||
import com.op.system.api.RemotePlanService;
|
||||
import com.sap.conn.jco.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料信息Service业务层处理
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-18
|
||||
*/
|
||||
@Service
|
||||
public class SapBaseProductServiceImpl implements ISapBaseProductService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SapBaseProductMapper baseProductMapper;
|
||||
|
||||
/**
|
||||
* 查询物料信息
|
||||
*
|
||||
* @param productId 物料信息主键
|
||||
* @return 物料信息
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public SapBaseProduct selectBaseProductByProductId(String productId) {
|
||||
return baseProductMapper.selectBaseProductByProductId(productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物料信息列表
|
||||
*
|
||||
* @param baseProduct 物料信息
|
||||
* @return 物料信息
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public List<SapBaseProduct> selectBaseProductList(SapBaseProduct baseProduct) {
|
||||
return baseProductMapper.selectBaseProductList(baseProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物料信息
|
||||
*
|
||||
* @param baseProduct 物料信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int insertBaseProduct(SapBaseProduct baseProduct) {
|
||||
|
||||
baseProduct.setCreateTime(DateUtils.getNowDate());
|
||||
baseProduct.setCreateBy(SecurityUtils.getUsername());
|
||||
return baseProductMapper.insertBaseProduct(baseProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物料信息
|
||||
*
|
||||
* @param baseProduct 物料信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int updateBaseProduct(SapBaseProduct baseProduct) {
|
||||
baseProduct.setUpdateTime(DateUtils.getNowDate());
|
||||
baseProduct.setUpdateBy(SecurityUtils.getUsername());
|
||||
return baseProductMapper.updateBaseProduct(baseProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除物料信息
|
||||
*
|
||||
* @param productIds 需要删除的物料信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteBaseProductByProductIds(String[] productIds) {
|
||||
return baseProductMapper.deleteBaseProductByProductIds(productIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除物料信息信息
|
||||
*
|
||||
* @param productId 物料信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteBaseProductByProductId(String productId) {
|
||||
return baseProductMapper.deleteBaseProductByProductId(productId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectBaseProductIDByProductCode(String productCode) {
|
||||
return baseProductMapper.selectBaseProductIDByProductCode(productCode);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.op.sap.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.common.core.utils.uuid.IdUtils;
|
||||
import com.op.common.security.utils.SecurityUtils;
|
||||
import com.op.sap.domain.SapProRouteProduct;
|
||||
import com.op.sap.mapper.SapProRouteProductMapper;
|
||||
import com.op.sap.service.SapProRouteProductService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工艺线体关联Service业务层处理
|
||||
*
|
||||
* @author Open Platform
|
||||
* @date 2023-07-13
|
||||
*/
|
||||
@Service
|
||||
public class SapProRouteProductServiceImpl implements SapProRouteProductService {
|
||||
@Autowired
|
||||
private SapProRouteProductMapper proRouteProductMapper;
|
||||
|
||||
/**
|
||||
* 查询工艺线体关联
|
||||
*
|
||||
* @param recordId 工艺线体关联主键
|
||||
* @return 工艺线体关联
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public SapProRouteProduct selectProRouteProductByRecordId(String recordId) {
|
||||
return proRouteProductMapper.selectProRouteProductByRecordId(recordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工艺线体关联列表
|
||||
*
|
||||
* @param proRouteProduct 工艺线体关联
|
||||
* @return 工艺线体关联
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public List<SapProRouteProduct> selectProRouteProductList(SapProRouteProduct proRouteProduct) {
|
||||
return proRouteProductMapper.selectProRouteProductList(proRouteProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工艺线体关联
|
||||
*
|
||||
* @param proRouteProduct 工艺线体关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int insertProRouteProduct(SapProRouteProduct proRouteProduct) {
|
||||
Date now = DateUtils.getNowDate();
|
||||
if(StringUtils.isNotBlank(proRouteProduct.getRouteId())){
|
||||
//删除之前的关联关系
|
||||
proRouteProductMapper.deleteByRouteId(proRouteProduct);
|
||||
}
|
||||
if(proRouteProduct.getSelectedValues()!=null){
|
||||
SapProRouteProduct proRouteProductDto =null;
|
||||
for(String ProductCode:proRouteProduct.getSelectedValues()){
|
||||
//查询物料编码对应的各种信息
|
||||
proRouteProductDto = new SapProRouteProduct();
|
||||
proRouteProductDto.setRecordId(IdUtils.fastSimpleUUID());
|
||||
proRouteProductDto.setCreateTime(now);
|
||||
proRouteProductDto.setCreateBy(SecurityUtils.getUsername());
|
||||
proRouteProductDto.setRouteId(proRouteProduct.getRouteId());
|
||||
proRouteProductDto.setItemId(proRouteProduct.getItemId());
|
||||
proRouteProductDto.setItemCode(ProductCode);
|
||||
proRouteProductDto.setItemName(proRouteProduct.getItemName());
|
||||
proRouteProductMapper.insertProRouteProduct(proRouteProductDto);
|
||||
}
|
||||
}
|
||||
//新增关联关系
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工艺线体关联
|
||||
*
|
||||
* @param proRouteProduct 工艺线体关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int updateProRouteProduct(SapProRouteProduct proRouteProduct) {
|
||||
proRouteProduct.setUpdateTime(DateUtils.getNowDate());
|
||||
return proRouteProductMapper.updateProRouteProduct(proRouteProduct);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除工艺线体关联
|
||||
*
|
||||
* @param recordIds 需要删除的工艺线体关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteProRouteProductByRecordIds(String[] recordIds) {
|
||||
return proRouteProductMapper.deleteProRouteProductByRecordIds(recordIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工艺线体关联信息
|
||||
*
|
||||
* @param recordId 工艺线体关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteProRouteProductByRecordId(String recordId) {
|
||||
return proRouteProductMapper.deleteProRouteProductByRecordId(recordId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public SapProRouteProduct getList(SapProRouteProduct proRouteProduct) {
|
||||
SapProRouteProduct dto = new SapProRouteProduct();
|
||||
List<SapProRouteProduct> unSelected = proRouteProductMapper.getRouteProdProductListUndo(proRouteProduct);
|
||||
dto.setUnSelect(unSelected);
|
||||
List<SapProRouteProduct> selected= proRouteProductMapper.getRouteProdProductListDo(proRouteProduct);
|
||||
dto.setSelected(selected);
|
||||
return dto;
|
||||
}
|
||||
}
|
@ -0,0 +1,209 @@
|
||||
package com.op.sap.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.op.common.core.constant.UserConstants;
|
||||
import com.op.common.core.domain.BaseFileData;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.common.core.utils.StringUtils;
|
||||
import com.op.common.core.utils.uuid.IdUtils;
|
||||
import com.op.common.security.utils.SecurityUtils;
|
||||
import com.op.sap.domain.SapBaseFile;
|
||||
import com.op.sap.domain.SapProRoute;
|
||||
import com.op.sap.mapper.SapBaseFileMapper;
|
||||
import com.op.sap.mapper.SapProRouteMapper;
|
||||
import com.op.sap.service.SapProRouteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 工艺路线Service业务层处理
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-05-12
|
||||
*/
|
||||
@Service
|
||||
public class SapProRouteServiceImpl implements SapProRouteService {
|
||||
@Autowired
|
||||
private SapProRouteMapper proRouteMapper;
|
||||
@Autowired
|
||||
private SapBaseFileMapper baseFileMapper;
|
||||
|
||||
/**
|
||||
* 查询工艺路线
|
||||
*
|
||||
* @param routeId 工艺路线主键
|
||||
* @return 工艺路线
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public SapProRoute selectProRouteByRouteId(String routeId) {
|
||||
|
||||
SapProRoute p = proRouteMapper.selectProRouteByRouteId(routeId);
|
||||
List<SapBaseFile> files = baseFileMapper.getBaseFileBatch(routeId);
|
||||
if (!CollectionUtils.isEmpty(files)) {
|
||||
p.setFiles(files);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工艺路线列表
|
||||
*
|
||||
* @param proRoute 工艺路线
|
||||
* @return 工艺路线
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public List<SapProRoute> selectProRouteList(SapProRoute proRoute) {
|
||||
return proRouteMapper.selectProRouteList(proRoute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SapProRoute getRouteByProductId(String itemId) {
|
||||
return proRouteMapper.getRouteByProductId(itemId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public Boolean checkRouteCodeUnique(SapProRoute proRoute) {
|
||||
SapProRoute route = proRouteMapper.checkRouteCodeUnique(proRoute);
|
||||
String routeId = proRoute.getRouteId();
|
||||
if (StringUtils.isNotNull(route) && !route.getRouteId().equals(routeId)) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工艺路线
|
||||
*
|
||||
* @param proRoute 工艺路线
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int insertProRoute(SapProRoute proRoute) {
|
||||
proRoute.setCreateTime(DateUtils.getNowDate());
|
||||
proRoute.setRouteVersion("V.1");
|
||||
//上传附件
|
||||
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
|
||||
String[] ids = proRoute.getFileList().split(",");
|
||||
List<BaseFileData> files = new ArrayList<>();
|
||||
BaseFileData file = null;
|
||||
for (String id : ids) {
|
||||
file = new BaseFileData();
|
||||
file.setFileId(IdUtils.fastSimpleUUID());
|
||||
file.setFileName(id.split("&fileName=")[1]);
|
||||
file.setFileAddress(id);
|
||||
file.setSourceId(proRoute.getRouteId());
|
||||
file.setCreateBy(SecurityUtils.getUsername());
|
||||
file.setCreateTime(new Date());
|
||||
files.add(file);
|
||||
}
|
||||
baseFileMapper.insertBaseFileBatch(files);
|
||||
}
|
||||
|
||||
return proRouteMapper.insertProRoute(proRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工艺路线
|
||||
*
|
||||
* @param proRoute 工艺路线
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int updateProRoute(SapProRoute proRoute) {
|
||||
proRoute.setUpdateTime(DateUtils.getNowDate());
|
||||
//上传附件
|
||||
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
|
||||
baseFileMapper.deleteBaseFileBySourceId(proRoute.getRouteId());
|
||||
String[] ids = proRoute.getFileList().split(",");
|
||||
List<BaseFileData> files = new ArrayList<>();
|
||||
BaseFileData file = null;
|
||||
for (String id : ids) {
|
||||
file = new BaseFileData();
|
||||
file.setFileId(IdUtils.fastSimpleUUID());
|
||||
file.setFileAddress(id);
|
||||
file.setFileName(id.split("&fileName=")[1]);
|
||||
file.setSourceId(proRoute.getRouteId());
|
||||
file.setCreateBy(SecurityUtils.getUsername());
|
||||
file.setCreateTime(new Date());
|
||||
files.add(file);
|
||||
}
|
||||
baseFileMapper.insertBaseFileBatch(files);
|
||||
}
|
||||
|
||||
//更新版本V.1->递增
|
||||
String nowRouteVersion = proRoute.getRouteVersion().replace("V", "")
|
||||
.replace(".", "");
|
||||
int nowRouteVersionNum = Integer.parseInt(nowRouteVersion);
|
||||
String newRouteVersionNum = "V." + (++nowRouteVersionNum);
|
||||
proRoute.setRouteVersion(newRouteVersionNum);
|
||||
return proRouteMapper.updateProRoute(proRoute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除工艺路线
|
||||
*
|
||||
* @param routeIds 需要删除的工艺路线主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteProRouteByRouteIds(String[] routeIds) {
|
||||
return proRouteMapper.deleteProRouteByRouteIds(routeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工艺路线信息
|
||||
*
|
||||
* @param routeId 工艺路线主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int deleteProRouteByRouteId(String routeId) {
|
||||
return proRouteMapper.deleteProRouteByRouteId(routeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#header.poolName")
|
||||
public int batchInsertProRoute(SapProRoute proRoute) {
|
||||
proRoute.setCreateTime(DateUtils.getNowDate());
|
||||
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
|
||||
List<String> ids = proRoute.getIdList();
|
||||
// for (int j = ids.size(); j < 1; j--) {
|
||||
for (String id :ids) {
|
||||
String[] f = proRoute.getFileList().split(",");
|
||||
List<BaseFileData> files = new ArrayList<>();
|
||||
BaseFileData file = null;
|
||||
for (String file1 : f) {
|
||||
file = new BaseFileData();
|
||||
file.setFileId(IdUtils.fastSimpleUUID());
|
||||
file.setFileName(file1.split("&fileName=")[1]);
|
||||
file.setFileAddress(file1);
|
||||
file.setSourceId(id);
|
||||
file.setCreateBy(SecurityUtils.getUsername());
|
||||
file.setCreateTime(new Date());
|
||||
files.add(file);
|
||||
}
|
||||
baseFileMapper.insertBaseFileBatch(files);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectProRrouteByRouteCode(String routeCode) {
|
||||
return proRouteMapper.selectProRouteByRouteCode(routeCode);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue