yxt_djz 3 years ago
parent
commit
1dd9047e7b
  1. 15
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/productinformation/ProductInformationService.java
  2. 26
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionService.java
  3. 204
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java

15
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/productinformation/ProductInformationService.java

@ -202,10 +202,17 @@ public class ProductInformationService extends MybatisBaseService<ProductInforma
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value= brandIdHSSFCell.getStringCellValue();
String[] split = value.split("\\[");
String v = split[0];//类别value
String key=split[1].replace("]","");//key
int i1 = value.indexOf("[");
String key="";
String v="";
/*if(i1>=0){*/
String[] split = value.split("\\[");
v = split[0];//类别value
key=split[1].replace("]","");//key
/*}else{
key=value;
v=key;
}*/
DictCommonDetailsVo dictCommonDetailsVo = dictCommonService.fetchByKeyAndType(key,"category");
if(dictCommonDetailsVo==null){
DictCommon dc=new DictCommon();

26
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionService.java

@ -18,6 +18,7 @@ import com.yxt.supervise.portal.api.manufacturerinfo.ManufacturerInfoVo;
import com.yxt.supervise.portal.api.productinformation.*;
import com.yxt.supervise.portal.api.purchaserequisition.PurchaseRequisition;
import com.yxt.supervise.portal.api.purchaserequisitionpro.PurchaseRequisitionPro;
import com.yxt.supervise.portal.api.restrictedcategory.RestrictedCategory;
import com.yxt.supervise.portal.api.supplierinfo.SupplierInfo;
import com.yxt.supervise.portal.api.supplierinfo.SupplierInfoVo;
import com.yxt.supervise.portal.api.warehouseposition.WarehousePosition;
@ -29,6 +30,7 @@ import com.yxt.supervise.portal.biz.dictcommon.DictCommonService;
import com.yxt.supervise.portal.biz.manufacturerinfo.ManufacturerInfoService;
import com.yxt.supervise.portal.biz.productinformation.ProductInformationService;
import com.yxt.supervise.portal.biz.purchaserequisitionpro.PurchaseRequisitionProService;
import com.yxt.supervise.portal.biz.restrictedcategory.RestrictedCategoryService;
import com.yxt.supervise.portal.biz.supplierinfo.SupplierInfoService;
import com.yxt.supervise.portal.biz.warehouseposition.WarehousePositionService;
import com.yxt.supervise.portal.biz.warehouseshelves.WarehouseShelvesService;
@ -68,6 +70,8 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
private PurchaseRequisitionService purchaseRequisitionService;
@Resource
private PurchaseRequisitionProService purchaseRequisitionProService;
@Resource
private RestrictedCategoryService restrictedCategoryService;
public void readBrandPeriodSorXls1(InputStream is, String sid) {
HSSFWorkbook hssfWorkbook = null;
try {
@ -175,6 +179,28 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
}
if(StringUtils.isNotBlank(p.getCode())){
p.setBrandSid("supervise");
p.setBrand("监管");
String categoryKey = prp.getCategoryKey();
DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(categoryKey, "category");
if(category==null){
category=new DictCommonDetailsVo();
category.setDictKey(categoryKey);
category.setDictValue(prp.getCategory());
category.setDictType("category");
DictCommon dictCommon = new DictCommon();
BeanUtil.copyProperties(category,dictCommon);
dictCommonService.insert(dictCommon);
}
List<RestrictedCategory> supervise = restrictedCategoryService.limitJudgement(category.getDictKey(), "supervise");
if(supervise==null||supervise.size()==0){
RestrictedCategory restrictedCategory=new RestrictedCategory();
restrictedCategory.setCategorys(category.getDictKey());
restrictedCategory.setCategorys("supervise");
restrictedCategoryService.insert(restrictedCategory);
}
p.setCategoryKey(category.getDictKey());
p.setCategory(category.getDictValue());
productInformationService.insert(p);
}
}

204
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java

@ -324,16 +324,187 @@ public class SalesDataService extends MybatisBaseService<SalesDataMapper, SalesD
}
row.createCell(9).setCellValue(salesData.getSalePrice());//"销售价格"
BigDecimal bigDecimal1 = new BigDecimal(salesData.getSalePrice());
bigDecimal.add(bigDecimal1);
bigDecimal=bigDecimal.add(bigDecimal1);
row.createCell(10).setCellValue(salesData.getSaleCost());//"销售成本"
row.createCell(11).setCellValue(salesData.getProfit());
row.createCell(12).setCellValue(salesData.getState()==1?"符合":"不符合");
row.createCell(12).setCellValue(salesData.getState()==1?"符合":salesData.getState()==0?"不符合":"未知");
row.createCell(13).setCellValue(salesData.getDataDate());
row.createCell(14).setCellValue(salesData.getRemarks());
}
row = sheet.createRow(list.size() + 2+1);
row = sheet.createRow(list.size() + 2);
row.createCell(0).setCellValue("合计");
row.createCell(9).setCellValue(bigDecimal.toString());
sheetName = pc+"符合限定品类的销售数据";
//创建HSSFWorkbook
// 第一步,创建一个HSSFWorkbook,对应一个Excel文件
// 第二步,在workbook中添加一个sheet,对应Excel文件中的sheet
HSSFSheet sheet2 = wb.createSheet(sheetName);
// 合并单元格:参数:起始行, 终止行, 起始列, 终止列
CellRangeAddress cra2 = new CellRangeAddress(0, 0, 0, 15);
sheet2.addMergedRegion(cra2);
// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
HSSFRow row2 = sheet2.createRow(0);
// 第四步,创建单元格,并设置值表头 设置表头居中
HSSFCell titleRow2 = row2.createCell(0);
titleRow2.setCellValue(title);
titleRow2.setCellStyle(style);
//列头
createRow3(sheet2, 1, col1, style);
BigDecimal bigDecimal2 = new BigDecimal("0");
int j=0;
//创建内容
for(int i=0;i<list.size();i++){
SalesData salesData = list.get(i);
if(salesData.getState()==1){
row2 = sheet2.createRow(j + 2);
//将内容按顺序赋给对应的列对象
//"序号","销售订单号","类型","商品编码","商品条码","商品名称","销售数量","销售渠道","门店名称","销售价格","销售成本","利润" ,"限定情况","数据日期","备注"
row2.createCell(0).setCellValue(j+1);
row2.createCell(1).setCellValue(salesData.getCode());
row2.createCell(2).setCellValue(salesData.getType());
row2.createCell(3).setCellValue(salesData.getProCode());
row2.createCell(4).setCellValue(salesData.getProBarCode());
row2.createCell(5).setCellValue(salesData.getProName());
row2.createCell(6).setCellValue(salesData.getSaleNum());
row2.createCell(7).setCellValue(salesData.getStoreCode());
StoreInfo storeInfo=storeInfoService.selectByCode(salesData.getStoreCode());
if(storeInfo!=null){
row2.createCell(8).setCellValue(storeInfo.getName());
}else{
row2.createCell(8).setCellValue("");
}
row2.createCell(9).setCellValue(salesData.getSalePrice());//"销售价格"
BigDecimal bigDecimal1 = new BigDecimal(salesData.getSalePrice());
bigDecimal2=bigDecimal2.add(bigDecimal1);
row2.createCell(10).setCellValue(salesData.getSaleCost());//"销售成本"
row2.createCell(11).setCellValue(salesData.getProfit());
row2.createCell(12).setCellValue("符合");
row2.createCell(13).setCellValue(salesData.getDataDate());
row2.createCell(14).setCellValue(salesData.getRemarks());
j++;
}
}
row2 = sheet2.createRow(j + 2);
row2.createCell(0).setCellValue("合计");
row2.createCell(9).setCellValue(bigDecimal2.toString());
sheetName = pc+"不符合限定品类的销售数据";
//创建HSSFWorkbook
// 第一步,创建一个HSSFWorkbook,对应一个Excel文件
// 第二步,在workbook中添加一个sheet,对应Excel文件中的sheet
HSSFSheet sheet3 = wb.createSheet(sheetName);
// 合并单元格:参数:起始行, 终止行, 起始列, 终止列
CellRangeAddress cra3 = new CellRangeAddress(0, 0, 0, 15);
sheet3.addMergedRegion(cra3);
// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
HSSFRow row3 = sheet3.createRow(0);
// 第四步,创建单元格,并设置值表头 设置表头居中
HSSFCell titleRow3 = row3.createCell(0);
titleRow3.setCellValue(title);
titleRow3.setCellStyle(style);
//列头
createRow3(sheet3, 1, col1, style);
BigDecimal bigDecimal3 = new BigDecimal("0");
j=0;
//创建内容
for(int i=0;i<list.size();i++){
SalesData salesData = list.get(i);
if(salesData.getState()==0){
row3 = sheet3.createRow(j + 2);
//将内容按顺序赋给对应的列对象
//"序号","销售订单号","类型","商品编码","商品条码","商品名称","销售数量","销售渠道","门店名称","销售价格","销售成本","利润" ,"限定情况","数据日期","备注"
row3.createCell(0).setCellValue(j+1);
row3.createCell(1).setCellValue(salesData.getCode());
row3.createCell(2).setCellValue(salesData.getType());
row3.createCell(3).setCellValue(salesData.getProCode());
row3.createCell(4).setCellValue(salesData.getProBarCode());
row3.createCell(5).setCellValue(salesData.getProName());
row3.createCell(6).setCellValue(salesData.getSaleNum());
row3.createCell(7).setCellValue(salesData.getStoreCode());
StoreInfo storeInfo=storeInfoService.selectByCode(salesData.getStoreCode());
if(storeInfo!=null){
row3.createCell(8).setCellValue(storeInfo.getName());
}else{
row3.createCell(8).setCellValue("");
}
row3.createCell(9).setCellValue(salesData.getSalePrice());//"销售价格"
BigDecimal bigDecimal1 = new BigDecimal(salesData.getSalePrice());
bigDecimal3=bigDecimal3.add(bigDecimal1);
row3.createCell(10).setCellValue(salesData.getSaleCost());//"销售成本"
row3.createCell(11).setCellValue(salesData.getProfit());
row3.createCell(12).setCellValue("不符合");
row3.createCell(13).setCellValue(salesData.getDataDate());
row3.createCell(14).setCellValue(salesData.getRemarks());
j++;
}
}
row3 = sheet3.createRow(j + 2);
row3.createCell(0).setCellValue("合计");
row3.createCell(9).setCellValue(bigDecimal3.toString());
sheetName = pc+"未知限定品类的销售数据";
//创建HSSFWorkbook
// 第一步,创建一个HSSFWorkbook,对应一个Excel文件
// 第二步,在workbook中添加一个sheet,对应Excel文件中的sheet
HSSFSheet sheet4 = wb.createSheet(sheetName);
// 合并单元格:参数:起始行, 终止行, 起始列, 终止列
CellRangeAddress cra4 = new CellRangeAddress(0, 0, 0, 15);
sheet4.addMergedRegion(cra4);
// 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制
HSSFRow row4 = sheet4.createRow(0);
// 第四步,创建单元格,并设置值表头 设置表头居中
HSSFCell titleRow4 = row4.createCell(0);
titleRow4.setCellValue(title);
titleRow4.setCellStyle(style);
//列头
createRow3(sheet4, 1, col1, style);
BigDecimal bigDecimal4 = new BigDecimal("0");
j=0;
//创建内容
for(int i=0;i<list.size();i++){
SalesData salesData = list.get(i);
if(salesData.getState()==2){
row4 = sheet4.createRow(j + 2);
//将内容按顺序赋给对应的列对象
//"序号","销售订单号","类型","商品编码","商品条码","商品名称","销售数量","销售渠道","门店名称","销售价格","销售成本","利润" ,"限定情况","数据日期","备注"
row4.createCell(0).setCellValue(j+1);
row4.createCell(1).setCellValue(salesData.getCode());
row4.createCell(2).setCellValue(salesData.getType());
row4.createCell(3).setCellValue(salesData.getProCode());
row4.createCell(4).setCellValue(salesData.getProBarCode());
row4.createCell(5).setCellValue(salesData.getProName());
row4.createCell(6).setCellValue(salesData.getSaleNum());
row4.createCell(7).setCellValue(salesData.getStoreCode());
StoreInfo storeInfo=storeInfoService.selectByCode(salesData.getStoreCode());
if(storeInfo!=null){
row4.createCell(8).setCellValue(storeInfo.getName());
}else{
row4.createCell(8).setCellValue("");
}
row4.createCell(9).setCellValue(salesData.getSalePrice());//"销售价格"
BigDecimal bigDecimal1 = new BigDecimal(salesData.getSalePrice());
bigDecimal4=bigDecimal4.add(bigDecimal1);
row4.createCell(10).setCellValue(salesData.getSaleCost());//"销售成本"
row4.createCell(11).setCellValue(salesData.getProfit());
row4.createCell(12).setCellValue("未知");
row4.createCell(13).setCellValue(salesData.getDataDate());
row4.createCell(14).setCellValue(salesData.getRemarks());
j++;
}
}
row4 = sheet4.createRow(j + 2);
row4.createCell(0).setCellValue("合计");
row4.createCell(9).setCellValue(bigDecimal4.toString());
return wb;
}
@ -342,19 +513,22 @@ public class SalesDataService extends MybatisBaseService<SalesDataMapper, SalesD
SalesData pr=list.get(i);
ProductInformationVo productInformation=productInformationService.selectByCode(pr.getProCode());
log.info("pr:{}",JSONObject.toJSONString(pr));
ProductInformationVo b=productInformationService.selectByCode(pr.getProCode());
log.info("b:{}",JSONObject.toJSONString(b));
String brandSid = b.getBrandSid();
String categoryKey = b.getCategoryKey();
List<RestrictedCategory> restrictedCategorys=restrictedCategoryService.limitJudgement(categoryKey,brandSid);
if("081101,081102,081103".indexOf(categoryKey)>=0||(restrictedCategorys!=null&&restrictedCategorys.size()>0)){
pr.setState(1);
if(productInformation==null) {
pr.setState(2);
}else{
pr.setState(0);
String remarks="";
remarks=remarks+productInformation.getCategory()+"["+productInformation.getCategoryKey()+"]品类,";
remarks=remarks+productInformation.getBrand()+"["+productInformation.getBrandSid()+"]品牌不符合;";
pr.setRemarks(remarks);
log.info("b:{}",JSONObject.toJSONString(productInformation));
String brandSid = productInformation.getBrandSid();
String categoryKey = productInformation.getCategoryKey();
List<RestrictedCategory> restrictedCategorys=restrictedCategoryService.limitJudgement(categoryKey,brandSid);
if("081101,081102,081103".indexOf(categoryKey)>=0||(restrictedCategorys!=null&&restrictedCategorys.size()>0)){
pr.setState(1);
}else{
pr.setState(0);
String remarks="";
remarks=remarks+productInformation.getCategory()+"["+productInformation.getCategoryKey()+"]品类,";
remarks=remarks+productInformation.getBrand()+"["+productInformation.getBrandSid()+"]品牌不符合;";
pr.setRemarks(remarks);
}
}
}
return list;

Loading…
Cancel
Save