采购订单-文件导入

product
chuang 2 years ago
parent 273161bff7
commit 4ac2d775f0

@ -34,133 +34,182 @@ import java.util.Map;
*/
public class FileCopy {
public static String getInfoAndUpFile(File[] fileList)throws Exception {
String fileName="";
// 图片对应的信息
public static ArrayList<Object> getInfoAndUpFile(File[] fileList) throws Exception {
String fileName = "";
// 榜单图片对应的信息
HashMap<String, Object> fileMap = new HashMap<>();
File excelFile =null;
// 车辆图片对应的信息
HashMap<String, Object> carFileMap = new HashMap<>();
ArrayList<Object> resultList = new ArrayList<>();
File excelFile = null;
for (int i = 0; i < fileList.length; i++) {
File file = fileList[i];
String name = file.getName();
int xlsIndex=0;
int xlsIndex = 0;
// 将文件夹中的文件上传到文件服务器
if (file.isDirectory()){
fileName = getInfoAndUpFile(file.listFiles());
if (file.isDirectory()) {
ArrayList<Object> resultListt = getInfoAndUpFile(file.listFiles());
if (resultListt.get(0) != null) {
fileName = fileName+String.valueOf(resultListt.get(0));
}
if (resultListt.get(1) != null) {
carFileMap.putAll ((HashMap<String, Object>) resultListt.get(1));
}
if (resultListt.get(2) != null) {
fileMap.putAll ((HashMap<String, Object>) resultListt.get(2));
}
}
if (file.isFile()){
String indexString = name.substring(0,name.lastIndexOf("."));
if (file.isFile()) {
String indexString = name.substring(0, name.lastIndexOf("."));
String parent = file.getParent();
String parentName = parent.substring(parent.lastIndexOf("\\") + 1, parent.length());
String substring = name.substring(name.lastIndexOf(".") + 1, name.length());
if (substring.contains("xls")||substring.contains("xlsx")){
if (substring.contains("xls") || substring.contains("xlsx")) {
// 进行word操作
excelFile=file;
xlsIndex=i;
}else {
excelFile = file;
xlsIndex = i;
} else {
// 这个文件图片的信息
ArrayList<Object> list = new ArrayList<>();
@Cleanup InputStream input=new FileInputStream(file);
@Cleanup InputStream input = new FileInputStream(file);
// MultipartFile multipartFile = new MultipartFileDto(file.getName(),input);
// MultipartFile multipartFile = new MultipartFileDto(file.getName(),input);
MultipartFile multipartFile = new MultipartFileDto(file.getName(), file.getName(), ContentType.JSON.toString(), FileCopyUtils.copyToByteArray(input));
UtilsController utilsController = SpringContext.getBean(UtilsController.class);
System.out.println(multipartFile.getName());
ActionResult annex = utilsController.uploader(multipartFile, "annex");
if (annex.getCode()==200){
list.add(annex.getData());
if (annex.getCode() == 200) {
list.add(annex.getData());
}
// 将榜单照片存在榜单列表中
if (indexString.equals("1")) {
if (fileMap.containsKey(parentName)) {
List<Object> o = (List<Object>) fileMap.get(parentName);
o.add(annex.getData());
fileMap.put(parentName, o);
} else {
fileMap.put(parentName, list);
}
} else {
if (carFileMap.containsKey(parentName)) {
List<Object> o = (List<Object>) carFileMap.get(parentName);
o.add(annex.getData());
carFileMap.put(parentName, o);
} else {
carFileMap.put(parentName, list);
}
}
fileMap.put(indexString,JsonUtil.getListToJsonArray(list));
// 将车辆照片存在车辆照片中
}
if (i==fileList.length-1){
ExcelReader reader = ExcelUtil.getReader(excelFile);
reader.setIgnoreEmptyRow(true);
if (i == fileList.length - 1) {
if (excelFile != null) {
ExcelReader reader = ExcelUtil.getReader(excelFile);
reader.setIgnoreEmptyRow(true);
// List<HashMap> read = reader.read(3, reader.read().size(), HashMap.class);
// List<Object> objects1 = reader.readRow(0);
// System.out.println(objects1);
List<Object> objects2 = reader.readColumn(0, 0, 1);
List<Object> objects2 = reader.readColumn(0, 0, 1);
// 公司名字
String companyStr = String.valueOf(objects2.get(0));
String companyStr = String.valueOf(objects2.get(0));
// 销售合同编码
String infoStr = String.valueOf(objects2.get(1));
String companyName = companyStr.substring(0,companyStr.lastIndexOf("废钢收货明细表"));
infoStr=infoStr.replaceAll(" ","");
String infoStr = String.valueOf(objects2.get(1));
String companyName = companyStr.substring(0, companyStr.lastIndexOf("废钢收货明细表"));
infoStr = infoStr.replaceAll(" ", "");
// 销售合同编码
String str = infoStr.substring(7,infoStr.indexOf("采购合同编码"));
String str = infoStr.substring(7, infoStr.indexOf("采购合同编码"));
// 销售合同编码
String str3 = infoStr.substring(infoStr.lastIndexOf("")+1,infoStr.length());
List<Object> objects = reader.readColumn(0, 3);
System.out.println(objects);
String str3 = infoStr.substring(infoStr.lastIndexOf("") + 1, infoStr.length());
List<Object> objects = reader.readColumn(0, 3);
System.out.println(objects);
// 写入工具类
ExcelWriter writer = reader.getWriter();
ExcelWriter writer = reader.getWriter();
// Workbook workbook = writer.getWorkbook();
Sheet sheet = writer.getSheet();
for (int i1 = 0; i1 < objects.size(); i1++) {
Object o = objects.get(i1);
Row row = sheet.getRow(i1 + 3);
if (String.valueOf(o).isEmpty()){
continue;
}
Sheet sheet = writer.getSheet();
for (int i1 = 0; i1 < objects.size(); i1++) {
Object o = objects.get(i1);
Row row = sheet.getRow(i1 + 3);
if (String.valueOf(o).isEmpty()) {
continue;
}
//// System.out.println(row.getCell(0).getStringCellValue());
// if ( row.getCell(0).getStringCellValue().isEmpty()){
// continue;
// }
Cell cell = row.createCell(19);
Cell cell1 = row.createCell(20);
Cell cell2 = row.createCell(21);
Cell cell3 = row.createCell(22);
if (i1==(objects.size()-1)){
row=sheet.getRow(2);
cell=row.createCell(19);
cell.setCellValue("榜单图片地址");
cell=row.createCell(20);
cell.setCellValue("客户");
cell=row.createCell(21);
cell.setCellValue("销售合同编码");
cell=row.createCell(22);
cell.setCellValue("采购合同编码");
}else {
Object o1 = fileMap.get(String.valueOf(o));
cell.setCellValue(String.valueOf(o1).equals("null")?"":String.valueOf(o1));
cell1.setCellValue(companyStr);
cell2.setCellValue(str);
cell3.setCellValue(str3);
Cell cell4 = row.createCell(18);
Cell cell = row.createCell(19);
Cell cell1 = row.createCell(20);
Cell cell2 = row.createCell(21);
Cell cell3 = row.createCell(22);
if (i1 == (objects.size() - 1)) {
row = sheet.getRow(2);
cell = row.createCell(19);
cell.setCellValue("榜单图片地址");
cell = row.createCell(20);
cell.setCellValue("客户");
cell = row.createCell(21);
cell.setCellValue("销售合同编码");
cell = row.createCell(22);
cell.setCellValue("采购合同编码");
cell = row.createCell(18);
cell.setCellValue("车辆图片地址");
} else {
Object o1 = fileMap.get(String.valueOf(o));
Object o2 = carFileMap.get(String.valueOf(o));
cell.setCellValue(String.valueOf(o1).equals("null") ? "" : String.valueOf(o1));
cell4.setCellValue(String.valueOf(o2).equals("null") ? "" : String.valueOf(o2));
cell1.setCellValue(companyStr);
cell2.setCellValue(str);
cell3.setCellValue(str3);
}
}
}
writer.flush(excelFile);
writer.close();
@Cleanup InputStream input=new FileInputStream(excelFile);
writer.flush(excelFile);
writer.close();
@Cleanup InputStream input = new FileInputStream(excelFile);
// MultipartFile multipartFile = new MultipartFileDto(file.getName(),input);
MultipartFile multipartFile = new MultipartFileDto(excelFile.getName(), excelFile.getName(), ContentType.JSON.toString(), FileCopyUtils.copyToByteArray(input));
UtilsController utilsController = SpringContext.getBean(UtilsController.class);
System.out.println(multipartFile.getName());
ActionResult annex = utilsController.uploader(multipartFile, "annex");
if (annex.getCode()==200){
UploaderVO fileLoader=(UploaderVO)annex.getData();
System.out.println(fileLoader);
System.out.println(fileLoader.getName());
return fileLoader.getName();
MultipartFile multipartFile = new MultipartFileDto(excelFile.getName(), excelFile.getName(), ContentType.JSON.toString(), FileCopyUtils.copyToByteArray(input));
UtilsController utilsController = SpringContext.getBean(UtilsController.class);
System.out.println(multipartFile.getName());
ActionResult annex = utilsController.uploader(multipartFile, "annex");
if (annex.getCode() == 200) {
UploaderVO fileLoader = (UploaderVO) annex.getData();
System.out.println(fileLoader);
System.out.println(fileLoader.getName());
resultList.add(fileLoader.getName());
resultList.add(carFileMap);
resultList.add(fileMap);
return resultList;
}
}
}
}
}
return fileName;
resultList.add(fileName);
resultList.add(carFileMap);
resultList.add(fileMap);
return resultList;
}
public static void createFile(String path){
public static void createFile(String path) {
File file = new File(path);
if (!file.exists()){
file.mkdirs();
}
if (!file.exists()) {
file.mkdirs();
}
}
/**
* @TODO
* @param path
* @return
* @TODO
*/
public static boolean delAllFile(String path) {
boolean flag = false;
@ -192,20 +241,18 @@ public class FileCopy {
}
/**
* base64
*
* @param picturesInfo
* @return
* @throws Exception
*/
public static List<Map<String,Object>> getImageInfo(String picturesInfo) throws Exception {
List<Map<String,Object>> imageBaseList = new ArrayList<>();
if (!picturesInfo.equals("null")){
public static List<Map<String, Object>> getImageInfo(String picturesInfo) throws Exception {
List<Map<String, Object>> imageBaseList = new ArrayList<>();
if (!picturesInfo.equals("null")) {
for (Object o : JsonUtil.getJsonToJsonArray(picturesInfo)) {
Map<String,String> map =(Map<String,String>)o;
Map<String, String> map = (Map<String, String>) o;
String url = map.get("url");
// System.out.println(url);
int i = url.indexOf("/", 16);
@ -214,17 +261,17 @@ public class FileCopy {
// System.out.println("type.toLowerCase()"+type.toLowerCase());
String fileId = map.get("fileId");
// 本地文件路径
String filePath = FilePathUtil.getFilePath(type.toLowerCase())+fileId;
String filePath = FilePathUtil.getFilePath(type.toLowerCase()) + fileId;
// 获得图片的base64码
String imageBase = FileCopy.getImageBase(filePath);
int[] imgWidthHeight = FileCopy.getImgWidthHeight(filePath);
HashMap<String, Object> map1 = new HashMap<>();
map1.put("imgBase",imageBase);
map1.put("name",fileId);
map1.put("filePath",filePath);
if (imgWidthHeight!=null){
map1.put("width",String.valueOf(imgWidthHeight[0]));
map1.put("height",String.valueOf(imgWidthHeight[1]));
map1.put("imgBase", imageBase);
map1.put("name", fileId);
map1.put("filePath", filePath);
if (imgWidthHeight != null) {
map1.put("width", String.valueOf(imgWidthHeight[0]));
map1.put("height", String.valueOf(imgWidthHeight[1]));
}
imageBaseList.add(map1);
@ -234,8 +281,10 @@ public class FileCopy {
}
return imageBaseList;
}
/**
*
*
* @param
* @return
*/
@ -249,14 +298,14 @@ public class FileCopy {
}
InputStream is = null;
BufferedImage src = null;
int result[] = { 0, 0 };
int result[] = {0, 0};
try {
// 获得文件输入流
is = new FileInputStream(file);
// 从流里将图片写入缓冲图片区
src = ImageIO.read(is);
result[0] =src.getWidth(null); // 得到源图片宽
result[1] =src.getHeight(null);// 得到源图片高
result[0] = src.getWidth(null); // 得到源图片宽
result[1] = src.getHeight(null);// 得到源图片高
is.close(); //关闭输入流
src = null;
} catch (Exception ef) {
@ -290,45 +339,46 @@ public class FileCopy {
return encoder.encode(data);
}
public static void copySCMFile(File source, String dest )throws IOException{
public static void copySCMFile(File source, String dest) throws IOException {
File parentFile = source.getParentFile();
if (!parentFile.exists()){
if (!parentFile.exists()) {
parentFile.mkdirs();
copyFile(source, dest);
}else{
} else {
copyFile(source, dest);
}
}
public static void copyFile(File source, String dest )throws IOException {
if (source.exists()){
public static void copyFile(File source, String dest) throws IOException {
if (source.exists()) {
//创建目的地文件夹
File destfile = new File(dest);
if(!destfile.exists()){
if (!destfile.exists()) {
destfile.mkdir();
}
//如果source是文件夹则在目的地址中创建新的文件夹
if(source.isDirectory()){
File file = new File(dest+"\\"+source.getName());//用目的地址加上source的文件夹名称创建新的文件夹
if (source.isDirectory()) {
File file = new File(dest + "\\" + source.getName());//用目的地址加上source的文件夹名称创建新的文件夹
file.mkdir();
//得到source文件夹的所有文件及目录
File[] files = source.listFiles();
if(files.length==0){
if (files.length == 0) {
return;
}else{
for(int i = 0 ;i<files.length;i++){
copyFile(files[i],file.getPath());
} else {
for (int i = 0; i < files.length; i++) {
copyFile(files[i], file.getPath());
}
}
}
//source是文件则用字节输入输出流复制文件
else if(source.isFile()){
else if (source.isFile()) {
FileInputStream fis = new FileInputStream(source);
//创建新的文件,保存复制内容,文件名称与源文件名称一致
File dfile = new File(dest+"\\"+source.getName());
if(!dfile.exists()){
File dfile = new File(dest + "\\" + source.getName());
if (!dfile.exists()) {
dfile.createNewFile();
}
@ -339,9 +389,9 @@ public class FileCopy {
// 定义长度
int len;
// 循环读取
while ((len = fis.read(b))!=-1) {
while ((len = fis.read(b)) != -1) {
// 写出数据
fos.write(b, 0 , len);
fos.write(b, 0, len);
}
//关闭资源

@ -73,8 +73,8 @@ import java.util.List;
import java.util.Map;
/**
*
* purchaseorder
*
* @ V3.2.0
* @ LINKAGE-BOOT
* @ LINKAGE-BOOT
@ -82,7 +82,7 @@ import java.util.Map;
*/
@Slf4j
@RestController
@Api(tags = "purchaseorder" , value = "purchaseorder")
@Api(tags = "purchaseorder", value = "purchaseorder")
@RequestMapping("/api/purchaseorder/Purchaseorder")
public class PurchaseorderController {
@ -145,7 +145,7 @@ public class PurchaseorderController {
@Transactional
public ActionResult pigeonhole(@RequestBody PigeonholeModel pigeonholeModel) {
PurchaseorderitemEntity purchaseorder = purchaseorderitemService.getById(pigeonholeModel.getId());
if (purchaseorder.getInvoiceAmount().equals(purchaseorder.getAmount()) && purchaseorder.getInvoiceAmount().equals(purchaseorder.getPayPrice())){
if (purchaseorder.getInvoiceAmount().equals(purchaseorder.getAmount()) && purchaseorder.getInvoiceAmount().equals(purchaseorder.getPayPrice())) {
purchaseorder.setStatus("3");
purchaseorderitemService.updateById(purchaseorder);
List<PoundlistEntity> poundlistEntityList = purchaseorderitemService.getPoundList(purchaseorder.getId());
@ -154,7 +154,7 @@ public class PurchaseorderController {
poundlistService.updateById(poundlistEntity);
}
return ActionResult.success("归档成功!");
}else{
} else {
return ActionResult.fail("发票金额、金额、已付款金额三者不一致!");
}
}
@ -171,18 +171,18 @@ public class PurchaseorderController {
String[] idList = ids.split(",");
String supplier = "";
int i = 0;
for (String id : idList){
for (String id : idList) {
PurchaseorderEntity purchaseorderEntity = purchaseorderService.getById(id);
if (!purchaseorderEntity.getStatus().equals("2")){
if (!purchaseorderEntity.getStatus().equals("2")) {
return ActionResult.fail("请先完成入库操作");
}
if (purchaseorderEntity.getPayPrice().equals(purchaseorderEntity.getAmount())){
if (purchaseorderEntity.getPayPrice().equals(purchaseorderEntity.getAmount())) {
return ActionResult.fail("已完成付款");
}
if (!purchaseorderEntity.getInvoiceAmount().equals(purchaseorderEntity.getAmount())){
if (!purchaseorderEntity.getInvoiceAmount().equals(purchaseorderEntity.getAmount())) {
return ActionResult.fail("请先开具发票");
}
if (i>0 && !supplier.equals(purchaseorderEntity.getSupplierName())){
if (i > 0 && !supplier.equals(purchaseorderEntity.getSupplierName())) {
return ActionResult.fail("存在多个不同供应商,请重新勾选");
}
supplier = purchaseorderEntity.getSupplierName();
@ -198,8 +198,8 @@ public class PurchaseorderController {
* @return
*/
@PostMapping("/getList")
public ActionResult list(@RequestBody PurchaseorderPagination purchaseorderPagination)throws IOException{
List<PurchaseorderitemEntity> list= purchaseorderitemService.getList(purchaseorderPagination);
public ActionResult list(@RequestBody PurchaseorderPagination purchaseorderPagination) throws IOException {
List<PurchaseorderitemEntity> list = purchaseorderitemService.getList(purchaseorderPagination);
//处理id字段转名称若无需转或者为空可删除
/*for(PurchaseorderitemEntity entity:list){
Map<String,Object> contractCodeMap = new HashMap<>();
@ -211,12 +211,12 @@ public class PurchaseorderController {
entity.setCreatorUserName(generaterSwapUtil.userSelectValue(entity.getCreatorUserName()));
}*/
List<PurchaseorderListVO> listVO=JsonUtil.getJsonToList(list,PurchaseorderListVO.class);
for(PurchaseorderListVO purchaseorderVO:listVO){
List<PurchaseorderListVO> listVO = JsonUtil.getJsonToList(list, PurchaseorderListVO.class);
for (PurchaseorderListVO purchaseorderVO : listVO) {
}
PageListVO vo=new PageListVO();
PageListVO vo = new PageListVO();
vo.setList(listVO);
PaginationVO page=JsonUtil.getJsonToBean(purchaseorderPagination,PaginationVO.class);
PaginationVO page = JsonUtil.getJsonToBean(purchaseorderPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
@ -231,8 +231,8 @@ public class PurchaseorderController {
@PostMapping
@Transactional
public ActionResult create(@RequestBody @Valid PurchaseorderCrForm purchaseorderCrForm) throws DataException {
String mainId =RandomUtil.uuId();
UserInfo userInfo=userProvider.get();
String mainId = RandomUtil.uuId();
UserInfo userInfo = userProvider.get();
purchaseorderCrForm.setDocumentNo(generaterSwapUtil.getBillNumber("cgdj", false));
purchaseorderCrForm.setCreatorUserName(userInfo.getUserId());
purchaseorderCrForm.setCreatorTime(DateUtil.getNow());
@ -243,8 +243,8 @@ public class PurchaseorderController {
PurchaseorderitemEntity entity = JsonUtil.getJsonToBean(purchaseorderCrForm, PurchaseorderitemEntity.class);
entity.setId(mainId);
purchaseorderitemService.save(entity);
List<Purchaseorder_item0Entity> Purchaseorder_item0List = JsonUtil.getJsonToList(purchaseorderCrForm.getPurchaseorder_item0List(),Purchaseorder_item0Entity.class);
for(Purchaseorder_item0Entity entitys : Purchaseorder_item0List){
List<Purchaseorder_item0Entity> Purchaseorder_item0List = JsonUtil.getJsonToList(purchaseorderCrForm.getPurchaseorder_item0List(), Purchaseorder_item0Entity.class);
for (Purchaseorder_item0Entity entitys : Purchaseorder_item0List) {
entitys.setId(RandomUtil.uuId());
entitys.setPurchaseorderId(entity.getId());
purchaseorder_item0Service.save(entitys);
@ -286,7 +286,6 @@ public class PurchaseorderController {
}
/**
*
*
@ -294,14 +293,14 @@ public class PurchaseorderController {
*/
@ApiOperation("模板下载")
@GetMapping("/templateDownload")
public ActionResult<DownloadVO> TemplateDownload(){
UserInfo userInfo=userProvider.get();
DownloadVO vo=DownloadVO.builder().build();
try{
public ActionResult<DownloadVO> TemplateDownload() {
UserInfo userInfo = userProvider.get();
DownloadVO vo = DownloadVO.builder().build();
try {
vo.setName("职员信息.xlsx");
vo.setUrl(UploaderUtil.uploaderFile("/api/Common/DownloadModel?encryption=" ,userInfo.getId()+"#"+"职员信息.xlsx"+"#"+"Temporary"));
}catch(Exception e){
log.error("信息导出Excel错误:{}" ,e.getMessage());
vo.setUrl(UploaderUtil.uploaderFile("/api/Common/DownloadModel?encryption=", userInfo.getId() + "#" + "职员信息.xlsx" + "#" + "Temporary"));
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
}
return ActionResult.success(vo);
}
@ -313,27 +312,26 @@ public class PurchaseorderController {
*/
@ApiOperation("上传文件")
@PostMapping("/Uploader")
public ActionResult Uploader() throws Exception {
public ActionResult Uploader() throws Exception {
List<MultipartFile> list = UpUtil.getFileAll();
MultipartFile file = list.get(0);
if (file.getOriginalFilename().endsWith(".zip" )) {
String filePath = configValueUtil.getTemporaryFilePath()+"unzip\\";
if (file.getOriginalFilename().endsWith(".zip")) {
String filePath = configValueUtil.getTemporaryFilePath() + "unzip\\";
// String fileName = RandomUtil.uuId() + "." + UpUtil.getFileType(file);
// fileName = XSSEscape.escape(fileName);
//上传文件
File temporaryFile = new File(filePath);
if (!temporaryFile.exists()){
if (!temporaryFile.exists()) {
temporaryFile.mkdirs();
}
@Cleanup InputStream inputStream = file.getInputStream();
File gbk = ZipUtil.unzip(inputStream, temporaryFile, Charset.forName("GBK"));
HashMap<String, String> imgMap = new HashMap<>();
String fileName = FileCopy.getInfoAndUpFile(gbk.listFiles());
log.warn(filePath);
log.warn(fileName);
List<Object> resultList= FileCopy.getInfoAndUpFile(gbk.listFiles());
FileUtil.deleteFileAll(temporaryFile);
// FileUtil.upFile(file, filePath, fileName);
DownloadVO vo = DownloadVO.builder().build();
vo.setName(fileName);
vo.setName(String.valueOf(resultList.get(0)));
return ActionResult.success(vo);
} else {
return ActionResult.fail("选择文件不符合导入");
@ -376,92 +374,93 @@ public class PurchaseorderController {
/**
* Excel
*
* @return
*/
* Excel
*
* @return
*/
@ApiOperation("导出Excel")
@GetMapping("/Actions/Export")
public ActionResult Export(PurchaseorderPaginationExportModel purchaseorderPaginationExportModel) throws IOException {
if (StringUtil.isEmpty(purchaseorderPaginationExportModel.getSelectKey())){
if (StringUtil.isEmpty(purchaseorderPaginationExportModel.getSelectKey())) {
return ActionResult.fail("请选择导出字段");
}
PurchaseorderPagination purchaseorderPagination=JsonUtil.getJsonToBean(purchaseorderPaginationExportModel, PurchaseorderPagination.class);
List<PurchaseorderitemEntity> list= purchaseorderitemService.getTypeList(purchaseorderPagination,purchaseorderPaginationExportModel.getDataType());
PurchaseorderPagination purchaseorderPagination = JsonUtil.getJsonToBean(purchaseorderPaginationExportModel, PurchaseorderPagination.class);
List<PurchaseorderitemEntity> list = purchaseorderitemService.getTypeList(purchaseorderPagination, purchaseorderPaginationExportModel.getDataType());
//处理id字段转名称若无需转或者为空可删除
for(PurchaseorderitemEntity entity:list){
Map<String,Object> contractNameMap = new HashMap<>();
entity.setContractName(generaterSwapUtil.getPopupSelectValue("390143765857220229","contract_name","contract_name",entity.getContractName(),contractNameMap));
for (PurchaseorderitemEntity entity : list) {
Map<String, Object> contractNameMap = new HashMap<>();
entity.setContractName(generaterSwapUtil.getPopupSelectValue("390143765857220229", "contract_name", "contract_name", entity.getContractName(), contractNameMap));
entity.setCreatorUserName(generaterSwapUtil.userSelectValue(entity.getCreatorUserName()));
}
List<PurchaseorderListVO> listVO=JsonUtil.getJsonToList(list,PurchaseorderListVO.class);
for(PurchaseorderListVO purchaseorderVO:listVO){
List<PurchaseorderListVO> listVO = JsonUtil.getJsonToList(list, PurchaseorderListVO.class);
for (PurchaseorderListVO purchaseorderVO : listVO) {
}
//转换为map输出
List<Map<String, Object>>mapList=JsonUtil.getJsonToListMap(JsonUtil.getObjectToStringDateFormat(listVO,"yyyy-MM-dd HH:mm:ss"));
String[]keys=!StringUtil.isEmpty(purchaseorderPaginationExportModel.getSelectKey())?purchaseorderPaginationExportModel.getSelectKey().split(","):new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),mapList,keys,userInfo);
List<Map<String, Object>> mapList = JsonUtil.getJsonToListMap(JsonUtil.getObjectToStringDateFormat(listVO, "yyyy-MM-dd HH:mm:ss"));
String[] keys = !StringUtil.isEmpty(purchaseorderPaginationExportModel.getSelectKey()) ? purchaseorderPaginationExportModel.getSelectKey().split(",") : new String[0];
UserInfo userInfo = userProvider.get();
DownloadVO vo = this.creatModelExcel(configValueUtil.getTemporaryFilePath(), mapList, keys, userInfo);
return ActionResult.success(vo);
}
//导出表格
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "documentNo" :
entitys.add(new ExcelExportEntity("单据编号" ,"documentNo"));
public DownloadVO creatModelExcel(String path, List<Map<String, Object>> list, String[] keys, UserInfo userInfo) {
DownloadVO vo = DownloadVO.builder().build();
List<ExcelExportEntity> entitys = new ArrayList<>();
if (keys.length > 0) {
for (String key : keys) {
switch (key) {
case "documentNo":
entitys.add(new ExcelExportEntity("单据编号", "documentNo"));
break;
case "contractName" :
entitys.add(new ExcelExportEntity("合同名称" ,"contractName"));
case "contractName":
entitys.add(new ExcelExportEntity("合同名称", "contractName"));
break;
case "supplierName" :
entitys.add(new ExcelExportEntity("供应商名称" ,"supplierName"));
case "supplierName":
entitys.add(new ExcelExportEntity("供应商名称", "supplierName"));
break;
case "currency" :
entitys.add(new ExcelExportEntity("币种" ,"currency"));
case "currency":
entitys.add(new ExcelExportEntity("币种", "currency"));
break;
case "contractNo" :
entitys.add(new ExcelExportEntity("对方合同号" ,"contractNo"));
case "contractNo":
entitys.add(new ExcelExportEntity("对方合同号", "contractNo"));
break;
case "advanceAmount" :
entitys.add(new ExcelExportEntity("垫资金额" ,"advanceAmount"));
case "advanceAmount":
entitys.add(new ExcelExportEntity("垫资金额", "advanceAmount"));
break;
case "num" :
entitys.add(new ExcelExportEntity("重量" ,"num"));
case "num":
entitys.add(new ExcelExportEntity("重量", "num"));
break;
case "amount" :
entitys.add(new ExcelExportEntity("金额" ,"amount"));
case "amount":
entitys.add(new ExcelExportEntity("金额", "amount"));
break;
case "notAmount" :
entitys.add(new ExcelExportEntity("不含税金额" ,"notAmount"));
case "notAmount":
entitys.add(new ExcelExportEntity("不含税金额", "notAmount"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注信息" ,"remark"));
case "remark":
entitys.add(new ExcelExportEntity("备注信息", "remark"));
break;
case "creatorUserName" :
entitys.add(new ExcelExportEntity("制单人" ,"creatorUserName"));
case "creatorUserName":
entitys.add(new ExcelExportEntity("制单人", "creatorUserName"));
break;
case "creatorTime" :
entitys.add(new ExcelExportEntity("制单时间" ,"creatorTime"));
case "creatorTime":
entitys.add(new ExcelExportEntity("制单时间", "creatorTime"));
break;
case "erpNo" :
entitys.add(new ExcelExportEntity("ERP订单号" ,"erpNo"));
case "erpNo":
entitys.add(new ExcelExportEntity("ERP订单号", "erpNo"));
break;
case "payPrice" :
entitys.add(new ExcelExportEntity("已付款金额" ,"payPrice"));
case "payPrice":
entitys.add(new ExcelExportEntity("已付款金额", "payPrice"));
break;
case "invoiceNum" :
entitys.add(new ExcelExportEntity("发票数量" ,"invoiceNum"));
case "invoiceNum":
entitys.add(new ExcelExportEntity("发票数量", "invoiceNum"));
break;
case "invoiceAmount" :
entitys.add(new ExcelExportEntity("发票金额" ,"invoiceAmount"));
case "invoiceAmount":
entitys.add(new ExcelExportEntity("发票金额", "invoiceAmount"));
break;
case "status" :
entitys.add(new ExcelExportEntity("单据状态 " ,"status"));
case "status":
entitys.add(new ExcelExportEntity("单据状态 ", "status"));
break;
default:
break;
@ -471,9 +470,9 @@ public class PurchaseorderController {
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
try {
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (entitys.size() > 0) {
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String name = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
@ -502,14 +501,14 @@ public class PurchaseorderController {
*/
@DeleteMapping("/batchRemove/{ids}")
@Transactional
public ActionResult batchRemove(@PathVariable("ids") String ids){
public ActionResult batchRemove(@PathVariable("ids") String ids) {
String[] idList = ids.split(",");
int i =0;
for (String allId : idList){
int i = 0;
for (String allId : idList) {
this.delete(allId);
i++;
}
if (i == 0 ){
if (i == 0) {
return ActionResult.fail("删除失败");
}
return ActionResult.success("删除成功");
@ -524,16 +523,16 @@ public class PurchaseorderController {
*/
@GetMapping("/batchQueryPurchaseorder/{ids}")
@Transactional
public ActionResult<List<PurchaseorderitemEntity>> batchQueryPurchaseorder(@PathVariable("ids") String ids){
public ActionResult<List<PurchaseorderitemEntity>> batchQueryPurchaseorder(@PathVariable("ids") String ids) {
List<PurchaseorderitemEntity> list = new ArrayList<>();
String[] idList = ids.split(",");
for (String id: idList) {
PurchaseorderitemEntity entity= purchaseorderitemService.getInfo(id);
for (String id : idList) {
PurchaseorderitemEntity entity = purchaseorderitemService.getInfo(id);
List<PoundlistEntity> poundlistEntityList = purchaseorderitemService.getPoundList(id);
entity.setPoundlistEntityList(poundlistEntityList);
if(entity != null && StringUtils.isNotEmpty(entity.getContractCode())){
if (entity != null && StringUtils.isNotEmpty(entity.getContractCode())) {
ContractFileEntity contractFileEntity = contractFileService.getById(entity.getContractCode());
if(contractFileEntity != null && StringUtils.isNotEmpty(contractFileEntity.getContractName())){
if (contractFileEntity != null && StringUtils.isNotEmpty(contractFileEntity.getContractName())) {
entity.setContractNo(contractFileEntity.getContractCode());
}
}
@ -549,9 +548,9 @@ public class PurchaseorderController {
* @return
*/
@GetMapping("/{id}")
public ActionResult<PurchaseorderInfoVO> info(@PathVariable("id") String id){
PurchaseorderitemEntity entity= purchaseorderitemService.getInfo(id);
PurchaseorderInfoVO vo=JsonUtil.getJsonToBean(entity, PurchaseorderInfoVO.class);
public ActionResult<PurchaseorderInfoVO> info(@PathVariable("id") String id) {
PurchaseorderitemEntity entity = purchaseorderitemService.getInfo(id);
PurchaseorderInfoVO vo = JsonUtil.getJsonToBean(entity, PurchaseorderInfoVO.class);
vo.setCreatorUserName(generaterSwapUtil.userSelectValue(vo.getCreatorUserName()));
/*SupplierEntity supplierEntity = supplierService.getById(vo.getSupplierId());
if(supplierEntity != null){
@ -559,43 +558,40 @@ public class PurchaseorderController {
}*/
if(vo.getCreatorTime()!=null){
if (vo.getCreatorTime() != null) {
vo.setCreatorTime(vo.getCreatorTime());
}
//子表
List<Purchaseorder_item0Entity> Purchaseorder_item0List = purchaseorderitemService.GetPurchaseorder_item0List(id);
for(Purchaseorder_item0Entity purchaseorder_item0Entity : Purchaseorder_item0List){
if(StringUtils.isNotEmpty(purchaseorder_item0Entity.getMaterialId())){
for (Purchaseorder_item0Entity purchaseorder_item0Entity : Purchaseorder_item0List) {
if (StringUtils.isNotEmpty(purchaseorder_item0Entity.getMaterialId())) {
MaterialEntity materialEntity = materialService.getById(purchaseorder_item0Entity.getMaterialId());
if(materialEntity != null){
if (materialEntity != null) {
purchaseorder_item0Entity.setMaterialName(materialEntity.getItemName());
if(StringUtils.isNotEmpty(materialEntity.getInArea())){
if (StringUtils.isNotEmpty(materialEntity.getInArea())) {
purchaseorder_item0Entity.setReservoirareaId(materialEntity.getInArea());
ReservoirareaEntity reservoirareaEntity = reservoirareaService.getById(materialEntity.getInArea());
if(reservoirareaEntity != null && StringUtils.isNotEmpty(reservoirareaEntity.getWarehouseId())){
if (reservoirareaEntity != null && StringUtils.isNotEmpty(reservoirareaEntity.getWarehouseId())) {
purchaseorder_item0Entity.setWarehouseId(reservoirareaEntity.getWarehouseId());
}
}
}
}
}
vo.setPurchaseorder_item0List(JsonUtil.getJsonToList(Purchaseorder_item0List,Purchaseorder_item0Model.class ));
vo.setPurchaseorder_item0List(JsonUtil.getJsonToList(Purchaseorder_item0List, Purchaseorder_item0Model.class));
QueryWrapper<InvoicesitemEntity> invoicesitemWrapper = new QueryWrapper<>();
invoicesitemWrapper.lambda().eq(InvoicesitemEntity::getPurchaseorderId,id);
invoicesitemWrapper.lambda().eq(InvoicesitemEntity::getPurchaseorderId, id);
List<InvoicesitemEntity> invoicesitemList = invoicesitemService.list(invoicesitemWrapper);
List<Invoices_item0itemEntity> Invoices_item0itemList = new ArrayList<>();
for (InvoicesitemEntity invoicesitemEntity : invoicesitemList){
for (InvoicesitemEntity invoicesitemEntity : invoicesitemList) {
List<Invoices_item0itemEntity> invoices_item0itemList = purchaseorderitemService.GetInvoices_item0itemList(invoicesitemEntity.getId());
Invoices_item0itemList.addAll(invoices_item0itemList);
}
for(Invoices_item0itemEntity invoices_item0itemEntity : Invoices_item0itemList){
for (Invoices_item0itemEntity invoices_item0itemEntity : Invoices_item0itemList) {
}
vo.setInvoices_item0itemList(JsonUtil.getJsonToList(Invoices_item0itemList,Invoices_item0itemModel.class ));
if(invoicesitemList != null && invoicesitemList.size() > 0){
vo.setInvoices_item0itemList(JsonUtil.getJsonToList(Invoices_item0itemList, Invoices_item0itemModel.class));
if (invoicesitemList != null && invoicesitemList.size() > 0) {
vo.setInvoicesitemEntity(invoicesitemList.get(0));
}
List<PaymentListVO> paymentList = paymentService.queryByPurchaseorderId(id);
@ -605,9 +601,9 @@ public class PurchaseorderController {
List<PurchasebackEntity> PurchasebackList = purchasebackService.list(purchasebackWrapper);
vo.setPurchasebackList(PurchasebackList);
List<CollectionpoEntity> CollectionitemList = purchaseorderitemService.GetCollectionitemList(entity.getDocumentNo());
for(CollectionpoEntity collectionpoEntity : CollectionitemList){
for (CollectionpoEntity collectionpoEntity : CollectionitemList) {
}
vo.setCollectionitemList(JsonUtil.getJsonToList(CollectionitemList,CollectionitemModel.class ));
vo.setCollectionitemList(JsonUtil.getJsonToList(CollectionitemList, CollectionitemModel.class));
//副表
return ActionResult.success(vo);
}
@ -619,8 +615,8 @@ public class PurchaseorderController {
* @return
*/
@GetMapping("guidang/{id}")
public ActionResult<PurchaseorderInfoVO> guidang(@PathVariable("id") String id){
PurchaseorderitemEntity entity= purchaseorderitemService.getInfo(id);
public ActionResult<PurchaseorderInfoVO> guidang(@PathVariable("id") String id) {
PurchaseorderitemEntity entity = purchaseorderitemService.getInfo(id);
entity.setStatus("3");
purchaseorderitemService.updateById(entity);
return ActionResult.success("归档成功");
@ -634,58 +630,58 @@ public class PurchaseorderController {
*/
@GetMapping("/detail/{id}")
public ActionResult<PurchaseorderInfoVO> detailInfo(@PathVariable("id") String id) throws IOException {
PurchaseorderitemEntity entity= purchaseorderitemService.getInfo(id);
PurchaseorderInfoVO vo=JsonUtil.getJsonToBean(entity, PurchaseorderInfoVO.class);
PurchaseorderitemEntity entity = purchaseorderitemService.getInfo(id);
PurchaseorderInfoVO vo = JsonUtil.getJsonToBean(entity, PurchaseorderInfoVO.class);
//子表数据转换
List<Purchaseorder_item0Entity> jg_purchaseorder_item0List = purchaseorderitemService.GetPurchaseorder_item0List(id);
List<Purchaseorder_item0Model> jg_purchaseorder_item0ModelList = JsonUtil.getJsonToList(jg_purchaseorder_item0List,Purchaseorder_item0Model.class);
for(Purchaseorder_item0Model jg_purchaseorder_item0Model : jg_purchaseorder_item0ModelList){
Map<String,Object> vehicleIdMap = new HashMap<>();
jg_purchaseorder_item0Model.setVehicleName(generaterSwapUtil.getPopupSelectValue("389754644018016581","vehicle_id","ticketno",jg_purchaseorder_item0Model.getVehicleId(),vehicleIdMap));
Map<String,Object> materialIdMap = new HashMap<>();
jg_purchaseorder_item0Model.setMaterialName(generaterSwapUtil.getPopupSelectValue("397736371898382533","id","item_name",jg_purchaseorder_item0Model.getMaterialId(),materialIdMap));
List<Purchaseorder_item0Model> jg_purchaseorder_item0ModelList = JsonUtil.getJsonToList(jg_purchaseorder_item0List, Purchaseorder_item0Model.class);
for (Purchaseorder_item0Model jg_purchaseorder_item0Model : jg_purchaseorder_item0ModelList) {
Map<String, Object> vehicleIdMap = new HashMap<>();
jg_purchaseorder_item0Model.setVehicleName(generaterSwapUtil.getPopupSelectValue("389754644018016581", "vehicle_id", "ticketno", jg_purchaseorder_item0Model.getVehicleId(), vehicleIdMap));
Map<String, Object> materialIdMap = new HashMap<>();
jg_purchaseorder_item0Model.setMaterialName(generaterSwapUtil.getPopupSelectValue("397736371898382533", "id", "item_name", jg_purchaseorder_item0Model.getMaterialId(), materialIdMap));
PoundlistEntity poundlistEntity = poundlistService.getById(jg_purchaseorder_item0Model.getPoundlistId());
jg_purchaseorder_item0Model.setPoundDate(poundlistEntity.getPoundDate());
SupplierEntity supplierEntity = supplierService.getById(jg_purchaseorder_item0Model.getSupplierId());
if(supplierEntity != null){
if (supplierEntity != null) {
jg_purchaseorder_item0Model.setSupplierName(supplierEntity.getSupplierName());
}
UserEntity userEntity = userService.getById(poundlistEntity.getBusinessId());
if(userEntity != null){
if (userEntity != null) {
jg_purchaseorder_item0Model.setBusinessName(userEntity.getRealName());
}
}
vo.setPurchaseorder_item0List(jg_purchaseorder_item0ModelList);
List<Invoices_item0itemEntity> jg_invoices_item0List = purchaseorderitemService.GetInvoices_item0itemList(id);
List<Invoices_item0itemModel> jg_invoices_item0ModelList = JsonUtil.getJsonToList(jg_invoices_item0List,Invoices_item0itemModel.class);
for(Invoices_item0itemModel jg_invoices_item0Model : jg_invoices_item0ModelList){
}
vo.setInvoices_item0itemList(jg_invoices_item0ModelList);
List<Invoices_item0itemEntity> jg_invoices_item0List = purchaseorderitemService.GetInvoices_item0itemList(id);
List<Invoices_item0itemModel> jg_invoices_item0ModelList = JsonUtil.getJsonToList(jg_invoices_item0List, Invoices_item0itemModel.class);
for (Invoices_item0itemModel jg_invoices_item0Model : jg_invoices_item0ModelList) {
}
vo.setInvoices_item0itemList(jg_invoices_item0ModelList);
QueryWrapper<InvoicesitemEntity> invoicesitemWrapper = new QueryWrapper<>();
invoicesitemWrapper.lambda().eq(InvoicesitemEntity::getPurchaseorderId,id);
invoicesitemWrapper.lambda().eq(InvoicesitemEntity::getPurchaseorderId, id);
List<InvoicesitemEntity> invoicesitemList = invoicesitemService.list(invoicesitemWrapper);
List<Invoices_item0itemEntity> Invoices_item0itemList = new ArrayList<>();
for (InvoicesitemEntity invoicesitemEntity : invoicesitemList){
for (InvoicesitemEntity invoicesitemEntity : invoicesitemList) {
List<Invoices_item0itemEntity> invoices_item0itemList = purchaseorderitemService.GetInvoices_item0itemList(invoicesitemEntity.getId());
Invoices_item0itemList.addAll(invoices_item0itemList);
}
for(Invoices_item0itemEntity invoices_item0itemEntity : Invoices_item0itemList){
for (Invoices_item0itemEntity invoices_item0itemEntity : Invoices_item0itemList) {
}
vo.setInvoices_item0itemList(JsonUtil.getJsonToList(Invoices_item0itemList,Invoices_item0itemModel.class ));
vo.setInvoices_item0itemList(JsonUtil.getJsonToList(Invoices_item0itemList, Invoices_item0itemModel.class));
List<PaymentListVO> paymentList = paymentService.queryByPurchaseorderId(id);
vo.setPaymentList(paymentList);
List<Receiptin_item0Entity> receiptin_item0itemList = purchaseorderitemService.GetReceiptin_item0itemList(id);
List<Receiptin_item0Model> jg_receiptin_item0ModelList = JsonUtil.getJsonToList(receiptin_item0itemList,Receiptin_item0Model.class);
List<Receiptin_item0Model> jg_receiptin_item0ModelList = JsonUtil.getJsonToList(receiptin_item0itemList, Receiptin_item0Model.class);
vo.setReceiptin_item0List(jg_receiptin_item0ModelList);
QueryWrapper<ReceiptinEntity> receiptinWrapper = new QueryWrapper<>();
receiptinWrapper.lambda().eq(ReceiptinEntity::getSouceno, id);
ReceiptinEntity receiptinEntity = receiptinService.getOne(receiptinWrapper);
if(receiptinEntity != null){
if (receiptinEntity != null) {
vo.setReceiptamount(receiptinEntity.getReceiptamount());
vo.setReceiptnum(receiptinEntity.getReceiptnum());
}
@ -699,7 +695,7 @@ public class PurchaseorderController {
BigDecimal refundNum = new BigDecimal(0);
BigDecimal refundAmount = new BigDecimal(0);
List<Purchaseback_item0Entity> purchaseback_item0EntityList = new ArrayList<>();
for (PurchasebackEntity purchasebackEntity: PurchasebackList) {
for (PurchasebackEntity purchasebackEntity : PurchasebackList) {
refundNum = refundNum.add(purchasebackEntity.getRefundNum());
refundAmount = refundAmount.add(purchasebackEntity.getRefundAmount());
QueryWrapper<Purchaseback_item0Entity> purchasebackitem0Wrapper = new QueryWrapper<>();
@ -710,32 +706,30 @@ public class PurchaseorderController {
vo.setRefundAmount(refundAmount);
vo.setRefundNum(refundNum);
vo.setPurchaseback_item0EntityList(purchaseback_item0EntityList);
List<CollectionpoEntity> jg_collectionList = purchaseorderitemService.GetCollectionitemList(id);
List<CollectionitemModel> jg_collectionModelList = JsonUtil.getJsonToList(jg_collectionList,CollectionitemModel.class);
for(CollectionitemModel jg_collectionModel : jg_collectionModelList){
}
vo.setCollectionitemList(jg_collectionModelList);
List<CollectionpoEntity> jg_collectionList = purchaseorderitemService.GetCollectionitemList(id);
List<CollectionitemModel> jg_collectionModelList = JsonUtil.getJsonToList(jg_collectionList, CollectionitemModel.class);
for (CollectionitemModel jg_collectionModel : jg_collectionModelList) {
}
vo.setCollectionitemList(jg_collectionModelList);
List<CollectionpoEntity> CollectionitemList = purchaseorderitemService.GetCollectionitemList(entity.getDocumentNo());
for(CollectionpoEntity collectionpoEntity : CollectionitemList){
for (CollectionpoEntity collectionpoEntity : CollectionitemList) {
}
vo.setCollectionitemList(JsonUtil.getJsonToList(CollectionitemList,CollectionitemModel.class ));
vo.setCollectionitemList(JsonUtil.getJsonToList(CollectionitemList, CollectionitemModel.class));
//附表数据转换
//添加到详情表单对象中
Map<String,Object> contractCodeMap = new HashMap<>();
vo.setContractName(generaterSwapUtil.getPopupSelectValue("390143765857220229","id","contract_name",vo.getContractCode(),contractCodeMap));
Map<String,Object> supplierIdMap = new HashMap<>();
vo.setSupplierName(generaterSwapUtil.getPopupSelectValue("397751667988199621","id","supplier_name",vo.getSupplierId(),supplierIdMap));
Map<String, Object> contractCodeMap = new HashMap<>();
vo.setContractName(generaterSwapUtil.getPopupSelectValue("390143765857220229", "id", "contract_name", vo.getContractCode(), contractCodeMap));
Map<String, Object> supplierIdMap = new HashMap<>();
vo.setSupplierName(generaterSwapUtil.getPopupSelectValue("397751667988199621", "id", "supplier_name", vo.getSupplierId(), supplierIdMap));
vo.setCreatorUserName(generaterSwapUtil.userSelectValue(vo.getCreatorUserName()));
return ActionResult.success(vo);
}
/**
*
*
@ -747,7 +741,7 @@ public class PurchaseorderController {
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid PurchaseorderUpForm purchaseorderUpForm) throws DataException {
UserInfo userInfo = userProvider.get();
PurchaseorderitemEntity entity = purchaseorderitemService.getInfo(id);
if(!entity.getStatus().equals("0")){
if (!entity.getStatus().equals("0")) {
String info = "";
switch (entity.getStatus()) {
case "1":
@ -760,7 +754,7 @@ public class PurchaseorderController {
info = "归档";
break;
}
return ActionResult.fail("已"+info+",无法编辑!");
return ActionResult.fail("已" + info + ",无法编辑!");
}
if (entity != null) {
PurchaseorderitemEntity subentity = JsonUtil.getJsonToBean(purchaseorderUpForm, PurchaseorderitemEntity.class);
@ -794,12 +788,12 @@ public class PurchaseorderController {
invoices_item0itemService.save(entitys);
}
QueryWrapper<PaymentdocpoEntity> PaymentdocpoWrapper = new QueryWrapper<>();
PaymentdocpoWrapper.lambda().eq(PaymentdocpoEntity::getPurchaseOrderNo,entity.getDocumentNo());
PaymentdocpoWrapper.lambda().eq(PaymentdocpoEntity::getPurchaseOrderNo, entity.getDocumentNo());
List<PaymentdocpoEntity> paymentdocList = paymentdocpoService.list(PaymentdocpoWrapper);
for (PaymentdocpoEntity paymentdocpoEntity : paymentdocList) {
QueryWrapper<PaymentitemEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(PaymentitemEntity::getPaymentno,paymentdocpoEntity.getDocumentNo());
queryWrapper.lambda().eq(PaymentitemEntity::getPaymentno, paymentdocpoEntity.getDocumentNo());
paymentitemService.remove(queryWrapper);
}
@ -847,7 +841,6 @@ public class PurchaseorderController {
}
/**
*
*
@ -856,27 +849,27 @@ public class PurchaseorderController {
*/
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
PurchaseorderitemEntity entity= purchaseorderitemService.getInfo(id);
if (!entity.getStatus().equals("0")){
public ActionResult delete(@PathVariable("id") String id) {
PurchaseorderitemEntity entity = purchaseorderitemService.getInfo(id);
if (!entity.getStatus().equals("0")) {
return ActionResult.fail("该状态下不允许删除!");
}
if(entity!=null){
if (entity != null) {
purchaseorderitemService.delete(entity);
QueryWrapper<Purchaseorder_item0Entity> queryWrapperPurchaseorder_item0=new QueryWrapper<>();
queryWrapperPurchaseorder_item0.lambda().eq(Purchaseorder_item0Entity::getPurchaseorderId,entity.getId());
QueryWrapper<Purchaseorder_item0Entity> queryWrapperPurchaseorder_item0 = new QueryWrapper<>();
queryWrapperPurchaseorder_item0.lambda().eq(Purchaseorder_item0Entity::getPurchaseorderId, entity.getId());
purchaseorder_item0Service.remove(queryWrapperPurchaseorder_item0);
QueryWrapper<Invoices_item0itemEntity> queryWrapperInvoices_item0item=new QueryWrapper<>();
queryWrapperInvoices_item0item.lambda().eq(Invoices_item0itemEntity::getPurchaseorderId,entity.getId());
QueryWrapper<Invoices_item0itemEntity> queryWrapperInvoices_item0item = new QueryWrapper<>();
queryWrapperInvoices_item0item.lambda().eq(Invoices_item0itemEntity::getPurchaseorderId, entity.getId());
invoices_item0itemService.remove(queryWrapperInvoices_item0item);
QueryWrapper<PaymentitemEntity> queryWrapperPaymentitem=new QueryWrapper<>();
queryWrapperPaymentitem.lambda().eq(PaymentitemEntity::getDocumentno,entity.getDocumentNo());
QueryWrapper<PaymentitemEntity> queryWrapperPaymentitem = new QueryWrapper<>();
queryWrapperPaymentitem.lambda().eq(PaymentitemEntity::getDocumentno, entity.getDocumentNo());
paymentitemService.remove(queryWrapperPaymentitem);
QueryWrapper<PurchasebackitemEntity> queryWrapperPurchasebackitem=new QueryWrapper<>();
queryWrapperPurchasebackitem.lambda().eq(PurchasebackitemEntity::getPurchaseOrderId,entity.getId());
QueryWrapper<PurchasebackitemEntity> queryWrapperPurchasebackitem = new QueryWrapper<>();
queryWrapperPurchasebackitem.lambda().eq(PurchasebackitemEntity::getPurchaseOrderId, entity.getId());
purchasebackitemService.remove(queryWrapperPurchasebackitem);
QueryWrapper<CollectionpoEntity> queryWrapperCollectionitem=new QueryWrapper<>();
queryWrapperCollectionitem.lambda().eq(CollectionpoEntity::getSalesOrderNo,entity.getDocumentNo());
QueryWrapper<CollectionpoEntity> queryWrapperCollectionitem = new QueryWrapper<>();
queryWrapperCollectionitem.lambda().eq(CollectionpoEntity::getSalesOrderNo, entity.getDocumentNo());
collectionpoService.remove(queryWrapperCollectionitem);
}
@ -884,8 +877,4 @@ public class PurchaseorderController {
}
}

@ -41,19 +41,17 @@ public class PurchaseorderDTO {
@Excel(name = "结算重量")
private String settlement;
@Excel(name = "磅单图片")
private String imgPicturess;
@Excel(name = "是否垫资")
private String advance;
@Excel(name = "自然人")
private String naturalId;
// @Excel(name = "自然人")
// private String naturalId;
@Excel(name = "采购单价")
@Excel(name = "采购")
private String purchasePrice;
@Excel(name = "销售单价")
@Excel(name = "销售")
private String salesPrice;
@Excel(name = "运费")
@ -62,6 +60,9 @@ public class PurchaseorderDTO {
@Excel(name = "起始地")
private String originPrice;
@Excel(name = "业务员2")
private String naturalId;
@Excel(name = "备注")
private String remark;
@ -70,15 +71,18 @@ public class PurchaseorderDTO {
@Excel(name = "榜单图片地址")
private String poundPictures;
@Excel(name = "车辆图片地址")
private String carPictures;
@Excel(name = "销售合同编码")
private String salesId;
@Excel(name="采购合同编码")
@Excel(name = "采购合同编码")
private String purchaseId;
@Excel(name="客户")
@Excel(name = "客户")
private String customerId;
private String id;
private List<PurchaseorderDTO> list;

Loading…
Cancel
Save