Browse Source

upload

master
liupopo 2 years ago
parent
commit
65fff87f3c
  1. 2
      supervise-customer-ui/.env.development
  2. 16
      supervise-customer-ui/src/router/modules/codemenu.js
  3. 8
      supervise-customer-ui/src/views/purchaserequisition/uploadxlsx/index.vue
  4. 2
      yxt-portal-ui/.env.development
  5. 2
      yxt-portal-ui/src/views/Home/Home.vue
  6. 1
      yxt_supervise/gateway/src/main/resources/application.yml
  7. 21
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisition/PurchaseRequisitionRest.java
  8. 516
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisition/PurchaseRequisitionService.java
  9. 54
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/tools/StrTool.java
  10. 4
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application.yml

2
supervise-customer-ui/.env.development

@ -6,4 +6,4 @@ VUE_APP_BASE_API = '/api/service'
## 配置测试和本地开发时的 接口地址
##VUE_APP_URL = "http://8.130.39.13:8112"
VUE_APP_URL = "http://192.168.3.173:8112"
VUE_APP_URL = "http://127.0.0.1:8112"

16
supervise-customer-ui/src/router/modules/codemenu.js

@ -302,5 +302,21 @@ const codemenu = [{
noCache: true
}
}, ]
}, {
path: '/purchaserequisition',
component: Layout,
redirect: '/purchaserequisition/uploadxlsx',
meta: {
title: '采购订单管理'
},
children: [{
path: '/purchaserequisition/uploadxlsx',
component: () => import('@/views/purchaserequisition/uploadxlsx/index.vue'),
name: 'purchaserequisitionUploadxlsx',
meta: {
title: '上传采购订单',
noCache: true
}
}]
}]
export default codemenu

8
supervise-customer-ui/src/views/purchaserequisition/uploadxlsx/index.vue

@ -351,10 +351,10 @@
},
handleBeforeUpload(file) {
console.log('handleBeforeUpload', file)
req.checkCodeByFileName(file.name).then(res => {
console.log('eeee', res)
return false
})
// req.checkCodeByFileName(file.name).then(res => {
// console.log('eeee', res)
// return false
// })
},
submitUpload() {
this.$refs.upload.submit()

2
yxt-portal-ui/.env.development

@ -5,5 +5,5 @@ ENV = 'development'
VUE_APP_BASE_API = '/api'
## 配置测试和本地开发时的 接口地址
VUE_APP_URL = "http://192.168.3.20:8112"
VUE_APP_URL = "http://127.0.0.1:8112"
##VUE_APP_URL = "http://8.130.39.13:8112"

2
yxt-portal-ui/src/views/Home/Home.vue

@ -428,7 +428,7 @@
if (index === 9) {
window.open('/#/index', '_blank')
} else if (index === 0) {
window.open('http://192.168.3.8:9531/#/' + '?token=' + getStorage(), '_blank')
window.open('http://127.0.0.1:9531/#/' + '?token=' + getStorage(), '_blank')
} else if (index === 1) {
window.open('http://192.168.3.8:9531#/' + '?token=' + getStorage(), '_blank')
} else if (index === 2) {

1
yxt_supervise/gateway/src/main/resources/application.yml

@ -53,6 +53,7 @@ spring:
- StripPrefix=1
ignore:
whites:
- /customer/v1/wechat/authGet #app端登录
- /portal/v1/regions/treeList
- /portal/v1/sysuser/login #pc端登录
- /portal/v1/sysuser/loginByNoVeriCode #登录无验证码

21
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisition/PurchaseRequisitionRest.java

@ -6,15 +6,13 @@ import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGdExcelVo;
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGdQuery;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionExcelVo;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionFeign;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionQuery;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionVo;
import com.yxt.supervise.customer.api.purchaserequisition.*;
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandQuery;
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -36,6 +34,7 @@ public class PurchaseRequisitionRest implements PurchaseRequisitionFeign {
@Autowired
PurchaseRequisitionService purchaseRequisitionService;
@ApiOperation("根据条件分页查询数据的列表")
@PostMapping("/listPage")
public ResultBean<PagerVo<PurchaseRequisitionVo>> listPage(@RequestBody PagerQuery<PurchaseRequisitionQuery> pq) {
@ -43,15 +42,16 @@ public class PurchaseRequisitionRest implements PurchaseRequisitionFeign {
PagerVo<PurchaseRequisitionVo> pv = purchaseRequisitionService.listPageVo(pq);
return rb.success().setData(pv);
}
@PostMapping("/exportExcel")
@ApiOperation(value = "采购订单数据导出")
public void exportExcel(@RequestBody PagerQuery<PurchaseRequisitionQuery> pq, HttpServletResponse response) throws IOException {
//得到所有要导出的数据
List<PurchaseRequisitionExcelVo> excelVos = purchaseRequisitionService.exportExcel(pq);
String fileName = "采购订单" + System.currentTimeMillis() + ".xlsx";
response.setContentType( "application/vnd.ms-excel");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf8");
response.setHeader("Content-disposition","attachment;filename="+ fileName );
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
// 这里 需要指定写用哪个class去读,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
// 如果这里想使用03 则 传入excelType参数即可
ServletOutputStream outputStream = response.getOutputStream();
@ -62,9 +62,14 @@ public class PurchaseRequisitionRest implements PurchaseRequisitionFeign {
@ApiOperation("上传采购订单的EXCEL文件")
@PostMapping(value = "/uploadXlsxFile")
public ResultBean importBrandSort(@RequestParam("file") MultipartFile file) {
public ResultBean<PurchaseRequisition> uploadXlsxFile(@RequestParam("file") MultipartFile file) {
ResultBean rb = ResultBean.fireFail();
log.debug("---{},{}", file.getOriginalFilename(), file.getName());
String filename = file.getOriginalFilename();
if (StringUtils.isBlank(filename))
return rb.setMsg("文件名不可为空");
if (filename.length() < 15)
return rb.setMsg("文件名格式错误");
rb = purchaseRequisitionService.uploadXlsxFile(file);
return rb;
}

516
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisition/PurchaseRequisitionService.java

@ -1,6 +1,10 @@
package com.yxt.supervise.customer.biz.purchaserequisition;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.common.base.service.MybatisBaseService;
@ -8,28 +12,26 @@ import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGd;
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGdExcelVo;
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGdQuery;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisition;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionExcelVo;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionQuery;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionVo;
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrand;
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandQuery;
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandVo;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionPro;
import com.yxt.supervise.customer.biz.purchaserequisitionpro.PurchaseRequisitionProService;
import com.yxt.supervise.customer.tools.StrTool;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.ss.usermodel.CellType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -40,6 +42,8 @@ import java.util.Map;
@Service
public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequisitionMapper, PurchaseRequisition> {
@Autowired
private PurchaseRequisitionProService purchaseRequisitionProService;
public PagerVo<PurchaseRequisitionVo> listPageVo(PagerQuery<PurchaseRequisitionQuery> pq) {
PurchaseRequisitionQuery query = pq.getParams();
@ -66,6 +70,7 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
PagerVo<PurchaseRequisitionVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public List<PurchaseRequisitionExcelVo> exportExcel(PagerQuery<PurchaseRequisitionQuery> pq) {
PurchaseRequisitionQuery query = pq.getParams();
QueryWrapper<PurchaseRequisition> qw = new QueryWrapper<>();
@ -90,167 +95,105 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
return pagging;
}
public void supplierAnalysis() throws ParseException {
ztspglhzb();
gysddmxb();
public ResultBean<String> checkCodeByFileName(String filename) {
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isBlank(filename))
return rb.setMsg("文件名不可为空");
if (filename.length() < 15)
return rb.setMsg("文件名格式错误");
String code = filename.substring(0, 14);
PurchaseRequisition purchaseRequisition = fetchByCode(code);
if (purchaseRequisition == null)
return rb.success().setData("nothas");
return rb.success().setData("hased");
}
/**
* 在途商品管理汇总表
*
* @throws ParseException
*/
public void ztspglhzb() throws ParseException {
// Date date = new Date();
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
// baseMapper.deleteAll();
// List<Map<String, Object>> list = baseMapper.ztspglhzb();//--在途商品管理汇总表
// for (Map<String, Object> m : list) {
// String billTotalPrice = m.get("billTotalPrice") != null ? m.get("billTotalPrice").toString() : "0";//订单总额
// String prodValue = m.get("prodValue") != null ? m.get("prodValue").toString() : "0";//实际到货价值
// String arrivalDate = m.get("arrivalDate") != null ? m.get("arrivalDate").toString() : "0";//全部到货日期
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
// m.put("date", sdf.format(date));
// m.put("no", sdf1.format(date).toString() + "01");//编号
// BigDecimal bigDecimal = new BigDecimal(billTotalPrice); //总金额
// BigDecimal bigDecimal1 = new BigDecimal(prodValue);//到货金额
// BigDecimal subtract = bigDecimal.subtract(bigDecimal1);//有未到货的货值
// Date parse = sdf.parse(arrivalDate);
// long nowMillisecond = date.getTime();
// long arrivalMillisecond = parse.getTime();//到货日期
// if (nowMillisecond > arrivalMillisecond && subtract.compareTo(new BigDecimal("0")) == 1) {//是否延期 大于到货日期 并且在途货值大于0 为延期
// m.put("sfyq", "是");
// } else {
// m.put("sfyq", "否");
// }
// if (subtract.compareTo(new BigDecimal("0")) == 1) {
// m.put("wdhjz", subtract.toString());
// m.put("cchjz", "0");
// } else {
// m.put("wdhjz", "0");
// BigDecimal subtract2 = bigDecimal1.subtract(bigDecimal);
// m.put("cchjz", subtract2.toString());
// }
// }
// log.info("ztspglhzb:{}", JSONObject.toJSONString(list));
// baseMapper.insertZtspglhzb(list);
public PurchaseRequisition fetchByCode(String code) {
QueryWrapper<PurchaseRequisition> qw = new QueryWrapper<>();
qw.eq("code", code);
List<PurchaseRequisition> list = baseMapper.selectList(qw);
if (list == null || list.isEmpty())
return null;
return list.get(0);
}
/**
* 供应商订单明细表
*/
public void gysddmxb() {
// Date date = new Date();
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
// List<Map<String, String>> list2 = baseMapper.gysddmxb();//--供应商订单明细表
// for (Map<String, String> m : list2) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
// String format = sdf.format(date);
// m.put("date", format.toString());
// String no = sdf1.format(date).toString() + "01";//编号
// m.put("no", no);
// }
// log.info("gysddmxb:{}", JSONObject.toJSONString(list2));
// baseMapper.deleteGysddmxb();
// baseMapper.insertGysddmxb(list2);
public ResultBean<PurchaseRequisition> uploadXlsxFile(MultipartFile file) {
ResultBean rb = ResultBean.fireFail();
PurchaseRequisition pr = new PurchaseRequisition();
pr.setPurchasingOrgCode("1");
pr.setPurchasingOrgName("36524集团");
pr.setPurchasingDeptCode("9001");
pr.setPurchasingDeptName("365生活通");
List<PurchaseRequisitionPro> proList = new ArrayList<>();
try {
ExcelReaderBuilder read = EasyExcel.read(file.getInputStream(), createReadListener(pr, proList));
read.sheet().doRead();
} catch (IOException e) {
e.printStackTrace();
return rb.setMsg("读取Excel文件异常:" + e.getMessage());
}
baseMapper.insert(pr);
purchaseRequisitionProService.saveBatch(proList);
return rb.success().setData(pr);
}
//
// public ResultBean<String> readBrandPeriodSorXls1(InputStream is) {
// /* int ii=uddatePrice();
// if(ii==1){
// return;
// }*/
// HSSFWorkbook hssfWorkbook = null;
// try {
// hssfWorkbook = new HSSFWorkbook(is);
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// List<String> lisss=new ArrayList<>();
// List<String> lisss2=new ArrayList<>();
// HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
// PurchaseRequisition pr=new PurchaseRequisition();
// List<PurchaseRequisitionPro> prps=new ArrayList<>();
// pr.setPurchasingOrgCode("1");
// pr.setPurchasingOrgName("36524集团");
// pr.setPurchasingDeptCode("9001");
// pr.setPurchasingDeptName("365生活通");
// // 循环行Row
// for (int rowNum = 0; rowNum <=hssfSheet.getLastRowNum(); rowNum++) {
// HSSFRow hssfRow = hssfSheet.getRow(rowNum);
// int i = 0;
// try{
// //设置单号 填单人 填单时间
// /*if(rowNum==0){
// for ( ; i < hssfRow.getLastCellNum(); i++) {
// setRow0(pr, hssfRow, i);
// }
// }*/
// //设置单号 填单人 填单时间
// if(rowNum==1){
// for ( ; i < hssfRow.getLastCellNum(); i++) {
// setRow1(pr, hssfRow, i);
// }
// }
// //设置供货单位 仓位 到货日期
// if(rowNum==2){
// for ( ; i < hssfRow.getLastCellNum(); i++) {
// setRow2(pr, hssfRow, i);
// }
// }
// //设置采购员 入库单位 单据到效期
// if(rowNum==3){
// for ( ; i < hssfRow.getLastCellNum(); i++) {
// setRow3(pr, hssfRow, i);
// }
// }
// //设置采购员 入库单位 单据到效期
// if(rowNum==4){
// for ( ; i < hssfRow.getLastCellNum(); i++) {
// setRow4(pr, hssfRow, i);
// }
// }
// if(rowNum>6){
// ProductInformation p=new ProductInformation();
// PurchaseRequisitionPro prp = new PurchaseRequisitionPro();
// prp.setMainSid(pr.getSid());
// String hsje="";//含税金额
// for ( ; i < hssfRow.getLastCellNum(); i++) {
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
// if(brandIdHSSFCell!=null){
// if (i == 1) {//商品代码
// brandIdHSSFCell.setCellType(CellType.STRING);
// String code = brandIdHSSFCell.getStringCellValue();
// ProductInformationVo productInformation=productInformationService.selectByCode(code);
// if(productInformation==null){
// p.setCode(code);
// }else{
// prp.setCategory(productInformation.getCategory());
// prp.setCategoryKey(productInformation.getCategoryKey());
// prp.setBrand(productInformation.getBrand());
// prp.setBrandCode(productInformation.getBrandSid());
// }
// prp.setProCode(code);
// prp.setContent("code");//规格型号
// }
// if (i == 2) {//名称
private ReadListener<Map<Integer, String>> createReadListener(PurchaseRequisition pr, List<PurchaseRequisitionPro> proList) {
return new ReadListener<Map<Integer, String>>() {
private void full1(Map<Integer, String> map) {
String code = map.get(1);
pr.setCode(code);
pr.setPurchaseDate(map.get(5));
}
private void full2(Map<Integer, String> map) {
String str1 = map.get(1);
String[] arr1 = StrTool.splitBySquareBrackets(str1);
pr.setSupplierName(arr1[0]);
pr.setSupplierCode(arr1[1]);
pr.setWarehousePosition("供应链仓");
pr.setWarehousePositionCode("112");
pr.setArrivalDate(map.get(5));
}
private void full3(Map<Integer, String> map) {
String str1 = map.get(1);
String[] arr1 = StrTool.splitBySquareBrackets(str1);
pr.setBuyerName(arr1[0]);
pr.setBuyerCode(arr1[1]);
pr.setExpiryDate(map.get(5));
}
private void full4(Map<Integer, String> map) {
pr.setCompletionStatus(map.get(5));
pr.setCompletionStatusKey("0");//0未完成
}
private void addPro(Map<Integer, String> map) {
PurchaseRequisitionPro prp = new PurchaseRequisitionPro();
prp.setMainSid(pr.getSid());
String hsje = "";//含税金额
prp.setProCode(map.get(1));
// prp.setCategory(productInformation.getCategory());
// prp.setCategoryKey(productInformation.getCategoryKey());
// prp.setBrand(productInformation.getBrand());
// prp.setBrandCode(productInformation.getBrandSid());
prp.setContent("code");//规格型号
prp.setProName(map.get(2));
prp.setNumber(map.get(3));
prp.setPackageSpec(map.get(4));
prp.setPackageNumber(map.get(5));
// if (i == 7) {//含税单价(元)
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String name = brandIdHSSFCell.getStringCellValue();
// prp.setProName(name);
// p.setName(name);
// if(StringUtils.isBlank(prp.getProCode())){
// continue;
// }
// }
// if (i == 3) {//数量
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value = brandIdHSSFCell.getStringCellValue();
// prp.setNumber(value);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// hsje= brandIdHSSFCell.getStringCellValue();
// }
// }
// if (i == 10) {//第二代码
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
@ -258,13 +201,6 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
// prp.setSecondCode(value);
// }
// }
// if (i == 53) {//包装数量
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value = brandIdHSSFCell.getStringCellValue();
// prp.setPackageNumber(value);
// }
// }
// if (i == 53) {//包内数量 对应采购订单的规格
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
@ -313,13 +249,6 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
// productInformationService.insert(p);
// }
// }
// if (i == 4) {//包装规格
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// prp.setPackageSpec(value);
// }
// }
// if (i == 11) {//单位
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
@ -372,15 +301,6 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
// }
// }
//
// if (i == 7) {//含税单价(元)
// brandIdHSSFCell.setCellType(CellType.STRING);
// if(StringUtils.isBlank(prp.getProCode())){
// continue;
// }
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// hsje= brandIdHSSFCell.getStringCellValue();
// }
// }
// }else{
// System.err.println("rowNum="+rowNum+",i="+i+",value=null");
// }
@ -388,215 +308,33 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
// if(StringUtils.isNotBlank(prp.getProCode())){
// prps.add(prp);
// }
// }
// }catch(Exception e){
// e.printStackTrace();
// System.err.println("i="+i+",value=null");
// }
//
// lisss.add(rowNum+"");
//
// }
// log.info("productInformation:{}", JSONObject.toJSONString(pr));
// ResultBean<String> objectResultBean=ResultBean.fireFail();
// SupplierInfoVo supplierInfoVo = supplierInfoService.selectByCodeForIndex(pr.getSupplierCode());
// if(supplierInfoVo==null){
// return objectResultBean.setMsg("供应商不存在!");
// }
// // List<Map<String,String>> suplierZtyz=baseMapper.suplierZtyz(pr.getSupplierCode()); 临时注释掉 2023-01-16
// List<Map<String,String>> suplierZtyz=baseMapper.suplierZtyz2(pr.getSupplierCode());
// if(suplierZtyz.size()>0){
// return objectResultBean.setMsg("供应商有在途商品!");
// }
// purchaseRequisitionService.insert(pr);
// for (PurchaseRequisitionPro p: prps){
// purchaseRequisitionProService.insert(p);
// /* String proCode = p.getProCode();*/
// /*int row=purchaseRequisitionProService.selectProdCodeTable(proCode);
// if(row==0){
// purchaseRequisitionProService.insertProdCodeTable(proCode);
// }*/
// }
// GdRescategoryProdService.resetCache();
// log.info("x:{}",JSON.toJSONString(lisss));
// String x1 = JSON.toJSONString(lisss2);
// log.info("x1:{}",JSON.toJSONString(lisss2));
// return objectResultBean.success().setData(pr.getCode());
// //return message;
// }
//
// private void setRow0(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
// if(brandIdHSSFCell!=null){
// if (i == 1) {//单号
// brandIdHSSFCell.setCellType(CellType.STRING);
// String code = brandIdHSSFCell.getStringCellValue();
// if(com.yxt.common.base.utils.StringUtils.isNotBlank(code)){
// PurchaseRequisition purchaseRequisition = purchaseRequisitionService.selectByCode(code);
// if(purchaseRequisition!=null){
// String newCode = purchaseRequisition.getNewCode();
// String[] split = newCode.split(",");
// split[split.length]=code;
// String str="";
// for(String s:split){
// str=str+","+s;
// }
// String substring = str.substring(1, str.length());
// purchaseRequisition.setNewCode(substring);
// purchaseRequisitionService.updateById(purchaseRequisition);
// }
// pr.setOldCode(code);
// }
// }
// }
// }
// private void setRow1(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
// if(brandIdHSSFCell!=null){
// if (i == 1) {//单号
// brandIdHSSFCell.setCellType(CellType.STRING);
// String code = brandIdHSSFCell.getStringCellValue();
// PurchaseRequisition purchaseRequisition = baseMapper.selectByCode(code);
// Map<String,Object> map=new HashMap<>();
// map.put("code",code);
// baseMapper.deleteByMap(map);
// purchaseRequisition=new PurchaseRequisition();
// Map<String,Object> map1=new HashMap<>();
// if(purchaseRequisition!=null){
// map1.put("mainSid",purchaseRequisition.getSid());
// purchaseRequisitionProService.deleteByMap(map1);
// }
//
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
// pr.setCode(code);
//
// }
// if (i == 3) {//填单人
// brandIdHSSFCell.setCellType(CellType.STRING);
// String value = brandIdHSSFCell.getStringCellValue();
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
// String[] split = value.split("\\[");
// String v = split[0];//类别value
// String key=split[1].replace("]","");//key
// pr.setBuyerName(v);
// pr.setBuyerCode(key);
// }
// if (i == 5) {//填单时间
// brandIdHSSFCell.setCellType(CellType.STRING);
// String value = brandIdHSSFCell.getStringCellValue();
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
// pr.setPurchaseDate(value);
// }
// }
// }
// private void setRow2(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
// if(brandIdHSSFCell!=null){
// if (i == 1) {//供货单位 供应商
// brandIdHSSFCell.setCellType(CellType.STRING);
// String value = brandIdHSSFCell.getStringCellValue();
// String[] split = value.split("\\[");
// String v = split[0];//类别value
// String key=split[1].replace("]","");//key
// SupplierInfoVo supplierInfoVo = supplierInfoService.selectByCodeForIndex(key);
// pr.setSupplierCode(supplierInfoVo.getCodeUnified());
// pr.setSupplierName(v);
//
// }
// if (i == 3) {//仓位
// brandIdHSSFCell.setCellType(CellType.STRING);
// String value = brandIdHSSFCell.getStringCellValue();
// String[] split = value.split("\\[");
// String v ="供应链仓";// split[0];//类别value
// String key="112";//split[1].replace("]","");//key
// WarehousePositionVo warehousePositionVo = warehousePositionService.selectByCode(key);
// if(warehousePositionVo==null){
// WarehousePosition warehousePosition=new WarehousePosition();
// warehousePosition.setName(v);
// warehousePosition.setCode(key);
// warehousePositionService.insert(warehousePosition);
// }
// pr.setWarehousePosition(v);
// pr.setWarehousePositionCode(key);
// }
// if (i == 5) {//到货日期
// brandIdHSSFCell.setCellType(CellType.STRING);
// String value = brandIdHSSFCell.getStringCellValue();
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
// pr.setArrivalDate(value);
// }
// }
// }
private void setRow3(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
if (brandIdHSSFCell != null) {
if (i == 1) {//采购员
brandIdHSSFCell.setCellType(CellType.STRING);
String value = brandIdHSSFCell.getStringCellValue();
//ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
String[] split = value.split("\\[");
String v = split[0];//类别value
String key = split[1].replace("]", "");//key
pr.setBuyerName(v);
pr.setBuyerCode(key);
pr.setLogisticsCompanyCode(key);
pr.setLogisticsCompanyName(v);
proList.add(prp);
}
if (i == 5) {//单据到效期
brandIdHSSFCell.setCellType(CellType.STRING);
String value = brandIdHSSFCell.getStringCellValue();
//ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
pr.setExpiryDate(value);
}
}
}
private void setRow4(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
if (brandIdHSSFCell != null) {
if (i == 5) {//完成状态
brandIdHSSFCell.setCellType(CellType.STRING);
String value = brandIdHSSFCell.getStringCellValue();
//ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
pr.setCompletionStatus(value);
pr.setCompletionStatusKey("0");//0未完成
@Override
public void invoke(Map<Integer, String> map, AnalysisContext analysisContext) {
ReadRowHolder readRowHolder = analysisContext.readRowHolder();
int rowIndex = readRowHolder.getRowIndex();
if (1 == rowIndex) {
full1(map);
}
if (2 == rowIndex) {
full2(map);
}
if (3 == rowIndex) {
full3(map);
}
if (4 == rowIndex) {
full4(map);
}
if (rowIndex > 6)
addPro(map);
}
}
}
private void createRow3(HSSFSheet sheet, int rownum, String[] col1, HSSFCellStyle style) {
//声明列对象
HSSFCell cell = null;
//创建标题
HSSFRow row2 = sheet.createRow(rownum);
for (int i = 0; i < col1.length; i++) {
cell = row2.createCell(i);
cell.setCellValue(col1[i]);
cell.setCellStyle(style);
}
}
public ResultBean<String> checkCodeByFileName(String filename) {
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isBlank(filename))
return rb.setMsg("文件名不可为空");
if (filename.length() < 15)
return rb.setMsg("文件名格式错误");
String code = filename.substring(0, 14);
PurchaseRequisition purchaseRequisition = fetchByCode(code);
if (purchaseRequisition == null)
return rb.success().setData("nothas");
return rb.success().setData("hased");
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
public PurchaseRequisition fetchByCode(String code) {
QueryWrapper<PurchaseRequisition> qw = new QueryWrapper<>();
qw.eq("code", code);
List<PurchaseRequisition> list = baseMapper.selectList(qw);
if (list == null || list.isEmpty())
return null;
return list.get(0);
}
};
}
}

54
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/tools/StrTool.java

@ -0,0 +1,54 @@
package com.yxt.supervise.customer.tools;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import java.util.ArrayList;
import java.util.List;
public class StrTool {
/**
* 将字符串通过中括号分解
*
* @param src
* @return
*/
public static String[] splitBySquareBrackets(String src) {
String[] strings = new String[3];
List<String> list = new ArrayList<>();
int i = src.indexOf('[');
if (i == -1)
return strings;
if (i == 0) {
int i1 = src.indexOf(']');
if (i1 == -1) {
String one = src.substring(1);
list.add(one);
} else {
String one = StrUtil.sub(src, 1, i1);
list.add(one);
if ((i1 + 1) < src.length()) {
String two = src.substring(i1 + 1);
list.add(two);
}
}
} else {
String one = StrUtil.sub(src, 0, i);
list.add(one);
int i1 = src.indexOf(']');
if (i1 == -1) {
String two = src.substring(i + 1);
list.add(two);
} else {
String two = StrUtil.sub(src, i + 1, i1);
list.add(two);
if ((i1 + 1) < src.length()) {
String three = src.substring(i1 + 1);
list.add(three);
}
}
}
return list.toArray(strings);
}
}

4
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application.yml

@ -2,8 +2,8 @@ spring:
application:
name: supervise-customer
profiles:
active: devv
# active: test
# active: devv
active: test
messages:
# 国际化资源文件路径
basename: i18n/messages

Loading…
Cancel
Save