diff --git a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesData.java b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesData.java index 89d8ff20..39b02f21 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesData.java +++ b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesData.java @@ -64,8 +64,10 @@ public class SalesData extends BaseEntity { private String proName; // 商品名称 @ApiModelProperty("销售数量") private String saleNum; // 销售数量 - @ApiModelProperty("销售渠道") + @ApiModelProperty("销售渠道") private String storeCode; // 销售渠道 + @ApiModelProperty("销售渠道名称") + private String storeName; // 销售渠道名称 @ApiModelProperty("销售价格") private String salePrice; // 销售价格 @ApiModelProperty("销售成本") diff --git a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDetailsVo.java b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDetailsVo.java index 3725ceed..314161f3 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDetailsVo.java +++ b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDetailsVo.java @@ -67,6 +67,8 @@ public class SalesDataDetailsVo implements Vo { private String saleNum; // 销售数量 @ApiModelProperty("销售渠道") private String storeCode; // 销售渠道 + @ApiModelProperty("销售渠道名称") + private String storeName; // 销售渠道名称 @ApiModelProperty("销售价格") private String salePrice; // 销售价格 @ApiModelProperty("销售成本") diff --git a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDto.java b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDto.java index 103c32cd..c401c461 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDto.java +++ b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataDto.java @@ -67,6 +67,8 @@ public class SalesDataDto implements Dto { private String saleNum; // 销售数量 @ApiModelProperty("销售渠道") private String storeCode; // 销售渠道 + @ApiModelProperty("销售渠道名称") + private String storeName; // 销售渠道名称 @ApiModelProperty("销售价格") private String salePrice; // 销售价格 @ApiModelProperty("销售成本") diff --git a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataQuery.java b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataQuery.java index 366a7485..37ec8960 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataQuery.java +++ b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataQuery.java @@ -67,6 +67,8 @@ public class SalesDataQuery implements Query { private String storeCode; // 销售渠道 @ApiModelProperty("销售价格") private String salePrice; // 销售价格 + @ApiModelProperty("销售渠道名称") + private String storeName; // 销售渠道名称 @ApiModelProperty("销售成本") private String saleCost; // 销售成本 @ApiModelProperty("利润") diff --git a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataVo.java b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataVo.java index cb838a3a..3e0c8282 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataVo.java +++ b/yxt_supervise/supervise-portal/supervise-portal-api/src/main/java/com/yxt/supervise/portal/api/salesdata/SalesDataVo.java @@ -67,6 +67,8 @@ public class SalesDataVo implements Vo { private String saleNum; // 销售数量 @ApiModelProperty("销售渠道") private String storeCode; // 销售渠道 + @ApiModelProperty("销售渠道名称") + private String storeName; // 销售渠道名称 @ApiModelProperty("销售价格") private String salePrice; // 销售价格 @ApiModelProperty("销售成本") diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.java index ec4c748b..f1923597 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.java @@ -1,11 +1,15 @@ package com.yxt.supervise.portal.biz.purchaserequisition; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yxt.supervise.portal.api.productinformation.ProductInformation; import com.yxt.supervise.portal.api.purchaserequisition.PurchaseRequisition; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import java.util.List; +import java.util.Map; + @Mapper public interface PurchaseRequisitionMapper extends BaseMapper { /** @@ -15,4 +19,24 @@ public interface PurchaseRequisitionMapper extends BaseMapper selectAll(); + @Select(" SELECT sbi.codeUnified, sbi.name ,1,SUM(packageTotalPrice) billTotalPrice, " + + " (SELECT SUM(prodValue) FROM gd_instorage_count gic WHERE gic.supplierCodeUnified=pr.supplierOnlyCode ) prodValue, " + + " MAX(pr.`arrivalDate`) arrivalDate FROM `supplier_bank_info` sbi " + + "LEFT JOIN `purchase_requisition` pr ON pr.supplierOnlyCode=sbi.codeUnified " + + "LEFT JOIN `purchase_requisition_pro` prp ON pr.sid=prp.mainsid " + + " WHERE pr.purchaseState=1 AND pr.bankState=1 AND sbi.`purchaseRequisition`=1 AND sbi.`bankState`=1 " + + " GROUP BY pr.supplierOnlyCode ORDER BY sbi.name;") + List> ztspglhzb(); + @Select("SELECT sbi.name,code,SUM(packageTotalPrice) billTotalPrice,purchaseDate billDate,arrivalDate FROM `purchase_requisition` pr " + + "LEFT JOIN `purchase_requisition_pro` prp ON pr.sid=prp.mainsid " + + "LEFT JOIN `supplier_bank_info` sbi ON sbi.codeUnified=pr.`supplierOnlyCode` " + + " WHERE pr.purchaseState=1 AND pr.bankState=1 " + + " GROUP BY pr.supplierOnlyCode,CODE ORDER BY sbi.name;") + List> gysddmxb(); + + void insertZtspglhzb(List> list); + + void insertGysddmxb(List> list2); } diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.xml b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.xml index c2b531d2..f6b0e73b 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.xml +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionMapper.xml @@ -1,4 +1,36 @@ + + insert into `hz_ztspglhzb` ( `name`, `pc`, `billTotalPrice`, `prodValue`, `arrivalDate`, `no`, `date`, `codeUnified`, `wdhjz`, `cchjz`, `sfyq`) values + + ( + #{item.name,jdbcType=VARCHAR}, + #{item.pc,jdbcType=VARCHAR}, + #{item.billTotalPrice,jdbcType=VARCHAR}, + #{item.prodValue,jdbcType=VARCHAR}, + #{item.arrivalDate,jdbcType=VARCHAR}, + #{item.no,jdbcType=VARCHAR}, + #{item.date,jdbcType=VARCHAR}, + #{item.codeUnified,jdbcType=VARCHAR}, + #{item.wdhjz,jdbcType=VARCHAR}, + #{item.cchjz,jdbcType=VARCHAR}, + #{item.sfyq,jdbcType=VARCHAR} + ) + + + + insert into `hz_gysddmxb` ( `name`, `code`, `billTotalPrice`, `billDate`, `arrivalDate`, `no`, `date`) values + + ( + #{item.name,jdbcType=VARCHAR}, + #{item.code,jdbcType=VARCHAR}, + #{item.billTotalPrice,jdbcType=VARCHAR}, + #{item.billDate,jdbcType=VARCHAR}, + #{item.arrivalDate,jdbcType=VARCHAR}, + #{item.no,jdbcType=VARCHAR}, + #{item.date,jdbcType=VARCHAR} + ) + + \ No newline at end of file diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionRest.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionRest.java index 72f0fc28..c968f125 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionRest.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionRest.java @@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.text.ParseException; @Api(tags = "采购订单基本信息") @RestController("com.supervise.biz.purchaserequisition.PurchaseRequisitionRest") @@ -48,4 +49,17 @@ public class PurchaseRequisitionRest { purchaseRequisitionService.readBrandPeriodSorXls1(in,""); return rb; } + @ApiOperation(" ") + @RequestMapping(value = "/supplierAnalysis", method = RequestMethod.POST) + public ResultBean supplierAnalysis(){ + ResultBean rb = ResultBean.fireFail(); + try { + purchaseRequisitionService. supplierAnalysis(); + } catch (ParseException e) { + e.printStackTrace(); + } + return rb; + } + + } diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionService.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionService.java index 04740c86..6a3f9840 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionService.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisition/PurchaseRequisitionService.java @@ -1,5 +1,6 @@ package com.yxt.supervise.portal.biz.purchaserequisition; +import cn.hutool.Hutool; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -47,11 +48,9 @@ import javax.annotation.Resource; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; +import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Slf4j @Service @@ -72,30 +71,87 @@ public class PurchaseRequisitionService extends MybatisBaseService list=purchaseRequisitionProService.getAll(); - for(PurchaseRequisitionPro p: list){ - String packagePrice = p.getPackagePrice();//包装价格 - String packageInsideNumber = p.getPackageInsideNumber(); - BigDecimal v = new BigDecimal(packagePrice).divide(new BigDecimal(packageInsideNumber),2,BigDecimal.ROUND_HALF_UP); - // ProductInformationVo productInformationVo = productInformationService.selectByCode(p.getProCode()); - // productInformationVo.setLatestPurchasePrice(v.toString()); - // productInformationVo.setNewestPurchasePrice(v.toString()); - // ProductInformation pif=new ProductInformation(); - // BeanUtil.copyProperties(productInformationVo,pif); - p.setUnitPrice(v.toString()); - log.info("pif:{}",JSONObject.toJSONString(p)); - purchaseRequisitionProService.updateById(p); - // productInformationService.updateById(pif); - /* String value= brandIdHSSFCell.getStringCellValue(); - prp.setPackageInsideNumber(value); - BigDecimal v3 = new BigDecimal(value);//包内数量 规格 - String packagePrice = prp.getPackagePrice();//包装价格 - BigDecimal v4 = new BigDecimal(packagePrice); - BigDecimal divide = v4.divide(v3, 4);//单价*/ + public void supplierAnalysis( ) throws ParseException { + /*List suppliers=supplierInfoService.selectAdoptedListVo(); + List> list=new ArrayList<>(); + for(SupplierInfoVo s:suppliers){ + List> totalPrices = purchaseRequisitionProService.selectBySupplierInfoSidForTotalPrice(s.getName()); + for(Map totalPrice:totalPrices){ + Map map=new HashMap<>(); + map.put("code",s.getCode()); + map.put("name",s.getName()); + if(totalPrice!=null){ + map.put("packageTotalPrice", totalPrice.get("packageTotalPrice")+""); + map.put("arrivalDate",totalPrice.get("arrivalDate")+""); + }else{ + map.put("packageTotalPrice","0"); + map.put("arrivalDate",""); + } + list.add(map); + } } - return 1; + purchaseRequisitionProService.deleteSupplierTotalprice(); + purchaseRequisitionProService.addSupplierTotalprice(list); + log.info("selectBySupplierInfoSidForTotalPrice:{}",JSONObject.toJSONString(list)); + List> purchaseRequisitionPros = purchaseRequisitionProService.supplierAndpurAnalysis(); + purchaseRequisitionProService.deleteSupplierAndpurAnalysis(); + purchaseRequisitionProService.addSupplierAndpurAnalysis(purchaseRequisitionPros); + log.info("purchaseRequisitionPros:{}",JSONObject.toJSONString(purchaseRequisitionPros)); +*/ + Date date = new Date(); + SimpleDateFormat sdf1=new SimpleDateFormat("yyyyMMdd"); + List> list=baseMapper.ztspglhzb();//--在途商品管理汇总表 + for(Map 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"); + String no=sdf1.format(date).toString()+"01";//编号 + String format = sdf.format(date); + m.put("date",format); + String wdhjz="";//未到货价值 + String cchjz="";//超出货价值 + String sfyq="";//是否延期到货 + m.put("no",no); + 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(arrivalMillisecond>nowMillisecond&&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); + List> list2= baseMapper.gysddmxb();//--供应商订单明细表 + for(Map m:list2){ + String name= m.get("name");//供应商名称 + String code= m.get("code");//供应商唯一编码 + // String billTotalPrice= m.get("billTotalPrice");//订单总额 + // String billDate= m.get("billDate");//订单日期 + // String no= m.get("no");//编号 + // String date= m.get("date");//订单总额 + 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.insertGysddmxb(list2); } public void readBrandPeriodSorXls1(InputStream is, String sid) { /* int ii=uddatePrice(); @@ -220,15 +276,16 @@ public class PurchaseRequisitionService extends MybatisBaseService restrictedCategorys=restrictedCategoryService.limitJudgement(categoryKey,brandSid); - if("081101,081102,081103".indexOf(categoryKey)>=0||(restrictedCategorys!=null&&restrictedCategorys.size()>0)){ - pr.setState(1); - }else{ - RestrictedCategory restrictedCategory=new RestrictedCategory(); + // List restrictedCategorys=restrictedCategoryService.limitJudgement(categoryKey,brandSid); + // if("081101,081102,081103".indexOf(categoryKey)>=0||(restrictedCategorys!=null&&restrictedCategorys.size()>0)){ + // pr.setState(1); + // }else{ + // pr.setState(2); + /* RestrictedCategory restrictedCategory=new RestrictedCategory(); restrictedCategory.setCategorys("["+categoryKey+"]"); restrictedCategory.setBrands("["+brandSid+"]"); - restrictedCategoryService.insert(restrictedCategory); - } + restrictedCategoryService.insert(restrictedCategory);*/ + // } } if(StringUtils.isNotBlank(p.getCode())){ @@ -439,8 +496,8 @@ public class PurchaseRequisitionService extends MybatisBaseService { @@ -21,4 +23,19 @@ public interface PurchaseRequisitionProMapper extends BaseMapper selectByCode(@Param("proCode")String proCode); @Select("select * from purchase_requisition_pro ") List getAll(); + + /** + * 在途商品管理汇总表 根据 供应商sid查 + * @param code + * @return + */ + List> selectBySupplierInfoSidForTotalPrice(@Param("name")String name); + List> supplierAndpurAnalysis(); + @Delete("delete from supplier_totalprice ") + void deleteSupplierTotalprice(); + void addSupplierTotalprice(List> list); + @Delete("delete from supplier_pur_totalprice ") + void deleteSupplierAndpurAnalysis(); + + void addSupplierAndpurAnalysis(List> purchaseRequisitionPros); } diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProMapper.xml b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProMapper.xml index ff934ded..041d2a6b 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProMapper.xml +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProMapper.xml @@ -1,4 +1,38 @@ + + + + insert into supplier_totalprice(code,name,packageTotalPrice,arrivalDate) values + + (#{item.code,jdbcType=VARCHAR}, + #{item.name,jdbcType=VARCHAR}, + #{item.packageTotalPrice,jdbcType=VARCHAR}, + #{item.arrivalDate,jdbcType=VARCHAR}) + + + + insert into supplier_pur_totalprice(supplierName,purchaseDate,code,packageTotalPrice,arrivalDate) values + + (#{item.supplierName,jdbcType=VARCHAR}, + #{item.purchaseDate,jdbcType=VARCHAR}, + #{item.code,jdbcType=VARCHAR}, + #{item.packageTotalPrice,jdbcType=VARCHAR}, + #{item.arrivalDate,jdbcType=VARCHAR}) + + + \ No newline at end of file diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProService.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProService.java index b00d1bda..6631be3e 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProService.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/purchaserequisitionpro/PurchaseRequisitionProService.java @@ -29,4 +29,28 @@ public class PurchaseRequisitionProService extends MybatisBaseService getAll() { return baseMapper.getAll(); } + + public List> selectBySupplierInfoSidForTotalPrice(String name) { + return baseMapper.selectBySupplierInfoSidForTotalPrice(name); + } + + public List> supplierAndpurAnalysis() { + return baseMapper.supplierAndpurAnalysis(); + } + + public void deleteSupplierTotalprice() { + baseMapper.deleteSupplierTotalprice(); + } + + public void addSupplierTotalprice(List> list) { + baseMapper.addSupplierTotalprice(list); + } + + public void deleteSupplierAndpurAnalysis() { + baseMapper.deleteSupplierAndpurAnalysis(); + } + + public void addSupplierAndpurAnalysis(List> purchaseRequisitionPros) { + baseMapper.addSupplierAndpurAnalysis(purchaseRequisitionPros); + } } diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.java index f0258d6e..d917c78e 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.java @@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.toolkit.Constants; +import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -72,5 +73,15 @@ public interface SalesDataMapper extends BaseMapper { @Select("select * from sales_data where storeCode=#{storeCode} ") List selectByStoreCode( @Param("storeCode") String storeCode); - void insertStoreInfo(List> listss); + void insertsalestest(@Param("list")List> listss); + void batchInsert(List salesDatas); + @Select("SELECT brandcode,categoryb,categorym,categorys FROM sales_data WHERE datadate=#{dataDate} " + + "GROUP BY brandcode,categoryb,categorym,categorys ") + List selectForBrandAndCategory(@Param("dataDate") String dataDate); + @Select("update sales_data sd ,store_info si set sd.storeName=si.name where sd.storeCode=si.code and sd.datadate=#{dataDate} ") + void updateStoreName(@Param("dataDate")String dataDate); + @Insert("insert into import_data_info (date,remarks) values('#{date}','#{remarks}')") + void insertIntoImportDataInfo(@Param("date")String date, @Param("remarks")String remarks); + @Select("delete from salestest where t10=#{date}") + void deleteSalesDataByDate(@Param("date")String date); } \ No newline at end of file diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.xml b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.xml index 1921eb09..0bf67c2d 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.xml +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataMapper.xml @@ -10,10 +10,11 @@ - + insert into salestest(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10) values - (#{item.t1,jdbcType=VARCHAR}, + ( + #{item.t1,jdbcType=VARCHAR}, #{item.t2,jdbcType=VARCHAR}, #{item.t3,jdbcType=VARCHAR}, #{item.t4,jdbcType=VARCHAR}, @@ -21,10 +22,33 @@ #{item.t6,jdbcType=VARCHAR}, #{item.t7,jdbcType=VARCHAR}, #{item.t8,jdbcType=VARCHAR}, - #{item.t9,jdbcType=VARCHAR}) - #{item.t10,jdbcType=VARCHAR}) + #{item.t9,jdbcType=VARCHAR}, + #{item.t10,jdbcType=VARCHAR} + ) + + insert into `sales_data` ( `lockVersion`, `sid`, `createSid`, `modifySid`, + `isEnable`, `createTime`, `modifyTime`, `state`, `isDelete`, + `code`, `proCode`, `proBarCode`, `proName`, `saleNum`, `storeCode`, + `salePrice`, `saleCost`, `profit`, `dataDate`, `type`, `customerCode`, + `customerName`, `brandCode`, `brandName`, `categoryb`, `categorym`, + `categorys`) values + + ( '0',UUID(), + NULL,NULL, + '1', + #{item.createTime},#{item.modifyTime}, + #{item.state},'0',#{item.code},#{item.proCode}, + #{item.proBarCode}, + #{item.proName},#{item.saleNum},#{item.storeCode},#{item.salePrice}, + #{item.saleCost},#{item.profit},#{item.dataDate},#{item.type}, #{item.customerCode}, + #{item.customerName},#{item.brandCode},#{item.brandName},#{item.categoryb},#{item.categorym},#{item.categorys} + ) + + + + diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataRest.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataRest.java index b8fef41c..3af044bd 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataRest.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataRest.java @@ -25,7 +25,10 @@ *********************************************************/ package com.yxt.supervise.portal.biz.salesdata; +import cn.hutool.poi.excel.ExcelUtil; +import com.yxt.common.base.config.component.FileUploadComponent; import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.FileUploadResult; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; import io.swagger.annotations.Api; @@ -106,27 +109,9 @@ public class SalesDataRest implements SalesDataFeign { } @ApiOperation(" ") @RequestMapping(value = "/importBrandSort", method = RequestMethod.POST) - public ResultBean importBrandSort(@RequestParam("filename") MultipartFile file, - HttpServletRequest request, HttpServletResponse response){ + public ResultBean importBrandSort(@RequestParam("filename") MultipartFile file ){ ResultBean rb = ResultBean.fireFail(); - String temp = request.getSession().getServletContext() - .getRealPath(File.separator) - + "temp"; // 临时目录 - File tempFile = new File(temp); - if (!tempFile.exists()) { - tempFile.mkdirs(); - } - String name = file.getOriginalFilename();// 获取上传文件名,包括路径 - long size = file.getSize(); - if ((name == null || name.equals("")) && size == 0) - return null; - InputStream in = null; - try { - in = file.getInputStream(); - } catch (IOException e) { - e.printStackTrace(); - } - salesDataService.readBrandPeriodSorXls1(in,""); + salesDataService.readBrandPeriodSorXls1(file); return rb; } @ApiOperation(" ") diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java index 23edf381..7fa25eb1 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java @@ -26,10 +26,16 @@ package com.yxt.supervise.portal.biz.salesdata; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import cn.hutool.poi.excel.ExcelUtil; +import cn.hutool.poi.excel.sax.handler.RowHandler; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.common.base.config.component.FileUploadComponent; +import com.yxt.common.core.result.FileUploadResult; import com.yxt.supervise.portal.api.brandinfo.BrandInfo; import com.yxt.supervise.portal.api.brandinfo.BrandInfoVo; import com.yxt.supervise.portal.api.dictcommon.DictCommon; @@ -42,12 +48,16 @@ import com.yxt.supervise.portal.api.restrictedcategory.RestrictedCategory; import com.yxt.supervise.portal.api.storeinfo.StoreInfo; import com.yxt.supervise.portal.biz.brandinfo.BrandInfoService; import com.yxt.supervise.portal.biz.dictcommon.DictCommonService; +import com.yxt.supervise.portal.biz.gdinventory.GdInventoryLog; +import com.yxt.supervise.portal.biz.gdinventory.GdInventoryLogErr; +import com.yxt.supervise.portal.biz.gdinventory.GdInventoryOk; import com.yxt.supervise.portal.biz.inventoryinformation.InventoryInformationService; import com.yxt.supervise.portal.biz.productinformation.ProductInformationService; import com.yxt.supervise.portal.biz.purchaserequisition.PurchaseRequisitionService; import com.yxt.supervise.portal.biz.purchaserequisitionpro.PurchaseRequisitionProService; import com.yxt.supervise.portal.biz.restrictedcategory.RestrictedCategoryService; import com.yxt.supervise.portal.biz.storeinfo.StoreInfoService; +import com.yxt.supervise.portal.extexcel.ExcelTool; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import com.yxt.common.base.service.MybatisBaseService; @@ -63,10 +73,13 @@ import com.yxt.supervise.portal.api.salesdata.SalesDataDto; import com.yxt.supervise.portal.api.salesdata.SalesDataFeign; import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.util.CellRangeAddress; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; @@ -107,6 +120,8 @@ public class SalesDataService extends MybatisBaseService createQueryWrapper(SalesDataQuery query) { // todo: 这里根据具体业务调整查询条件 // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); @@ -154,15 +169,159 @@ public class SalesDataService extends MybatisBaseService lisss=new ArrayList<>(); + List salesDatas=new ArrayList<>(); + int i = 0; + int j = 0; + @Override + public void handle(int sheetIndex, long rowNum, List r) { + if(rowNum>=1){ + Map sd_map=new HashMap<>(); + + try{ + sd_map.put("type",r.get(1));//类型 + sd_map.put("code",r.get(2));//销售订单号 + sd_map.put("proCode",r.get( 3));//商品代码 + sd_map.put("proBarCode",r.get( 4));//商品条码 + sd_map.put("proName",r.get( 5));//商品名称 + sd_map.put("brandCode",r.get( 6));//品牌代码 + Object brandName=r.get(7); + if(brandName!=null) + sd_map.put("brandName",brandName.toString());//品牌名称 + + Object dalei=r.get(8);//大类 + if(dalei!=null) + sd_map.put("categoryb",dalei.toString()); + + Object zhonglei=r.get(9);//中类 + if(zhonglei!=null) + sd_map.put("categorym",zhonglei); + + Object xiaolei=r.get(10);//小类 + if(xiaolei!=null) + sd_map.put("categorys",xiaolei); + + sd_map.put("customerCode",r.get( 11));//客户代码 + sd_map.put("customerName",r.get( 12));//客户名称 + sd_map.put("saleNum",r.get( 13));//销售数量 + sd_map.put("storeCode",r.get( 14));//销售渠道 + sd_map.put("salePrice",r.get( 15));//销售价格 + sd_map.put("saleCost",r.get( 16));//销售成本 + sd_map.put("profit",r.get( 17));//利润 + sd_map.put("dataDate",r.get( 18));//销售日期 + SalesData sd=new SalesData(); + BeanUtil.fillBeanWithMap(sd_map, sd, true); + salesDatas.add(sd); + i++; + }catch(Exception e){ + e.printStackTrace(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + baseMapper.insertIntoImportDataInfo(sdf.format(new Date()),"销售数据导入第"+i+"出现异常"+e.getMessage()); + System.err.println("i="+i+",value=null"); + } + lisss.add(rowNum+""); + + //inventoryInformationService.reduceStock(sd.getProCode(),sd.getProName(),sd.getStoreCode(),sd.getSaleNum()); + log.info("productInformation:{}", JSONObject.toJSONString(sd_map)); + log.info("rowNum:{}", rowNum); + } + } + + @Override + public void handleCell(int sheetIndex, long rowIndex, int cellIndex, Object value, CellStyle xssfCellStyle) { + RowHandler.super.handleCell(sheetIndex, rowIndex, cellIndex, value, xssfCellStyle); + } + + @Override + public void doAfterAllAnalysed() { + List> listArray = new ArrayList>(); + int listSize = salesDatas.size(); + int pageSize=5000; + for (int i = 0; i < listSize; i += pageSize) { + int toIndex = Math.min(i + pageSize, listSize); + listArray.add(salesDatas.subList(i, toIndex)); + } + Map params=new HashMap<>(); + params.put("dataDate",salesDatas.get(0).getDataDate()); + baseMapper.deleteByMap(params); + for(List l:listArray){ + log.info("batchInsert-start:{}",l.size()); + baseMapper.batchInsert(l); + log.info("batchInsert-end:{}",l.size()); + } + List list=baseMapper.selectForBrandAndCategory(salesDatas.get(0).getDataDate()); + for(SalesData sd:list){ + BrandInfoVo brandInfoVo = brandInfoService.selectByCode(sd.getBrandCode()); + if(brandInfoVo==null){ + BrandInfo brandInfo = new BrandInfo(); + brandInfo.setName(sd.getBrandName()); + brandInfo.setCode(sd.getBrandCode()); + brandInfoService.insert(brandInfo); + } + String dalei=sd.getCategoryb(); + String[] split_dalei = dalei.split("]"); + String key_dalei = split_dalei[0].replace("[","");//key + String v_dalei=split_dalei[1];//类别value + DictCommonDetailsVo category_dalei = dictCommonService.fetchByKeyAndType(key_dalei, "category"); + if(category_dalei==null){ + DictCommon dc=new DictCommon(); + dc.setDictType("category"); + dc.setDictKey(key_dalei); + dc.setDictValue(v_dalei); + dictCommonService.insert(dc); + } + String zhonglei=sd.getCategorym(); + String[] split_zhonglei = zhonglei.split("]"); + String key_zhonglei = split_zhonglei[0].replace("[","");//key + String v_zhonglei=split_zhonglei[1];//类别value + DictCommonDetailsVo category_zhonglei = dictCommonService.fetchByKeyAndType(key_zhonglei, "category"); + if(category_zhonglei==null){ + DictCommon dc=new DictCommon(); + dc.setDictType("category"); + dc.setDictKey(key_zhonglei); + dc.setDictValue(v_zhonglei); + dictCommonService.insert(dc); + } + String xiaolei=sd.getCategorys(); + String[] split_xiaolei = xiaolei.split("]"); + String key_xiaolei = split_xiaolei[0].replace("[","");//key + String v_xiaolei=split_xiaolei[1];//类别value + DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(key_xiaolei, "category"); + if(category==null){ + DictCommon dc=new DictCommon(); + dc.setDictType("category"); + dc.setDictKey(key_xiaolei); + dc.setDictValue(v_xiaolei); + dictCommonService.insert(dc); + } + } + baseMapper.updateStoreName(salesDatas.get(0).getDataDate()); + baseMapper.deleteSalesDataByDate(salesDatas.get(0).getDataDate()); + analysisSalesData(salesDatas.get(0).getDataDate(),""); + RowHandler.super.doAfterAllAnalysed(); + } + }; + } + public void readBrandPeriodSorXls1(MultipartFile file) { + + ResultBean fub = fileUploadComponent.uploadFile(file, "salesdata"); + String filePath = fub.getData().getFilePath(); + String fp = fileUploadComponent.getUploadPath() + filePath; + long millis = System.currentTimeMillis(); + ExcelUtil.read07BySax(fp, -1, createRowHandler()); + + + /*HSSFWorkbook hssfWorkbook = null; try { hssfWorkbook = new HSSFWorkbook(is); } catch (IOException e) { e.printStackTrace(); } List lisss=new ArrayList<>(); - List lisss2=new ArrayList<>(); + List salesDatas=new ArrayList<>(); HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0); // 循环行Row for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { @@ -170,225 +329,48 @@ public class SalesDataService extends MybatisBaseService=1){ - for ( ; i < hssfRow.getLastCellNum(); i++) { - HSSFCell brandIdHSSFCell = hssfRow.getCell(i); - if(brandIdHSSFCell!=null){ - if (i == 1) {//类型 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setType(value); - } - } - if (i == 2) {//销售订单号 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setCode(value); - } - } + sd.setType(ExcelTool.readStringFromHSSFRow(hssfRow, 1));//类型 + sd.setCode(ExcelTool.readStringFromHSSFRow(hssfRow, 2));//销售订单号 + sd.setProCode(ExcelTool.readStringFromHSSFRow(hssfRow, 3));//商品代码 + sd.setProBarCode(ExcelTool.readStringFromHSSFRow(hssfRow, 4));//商品条码 + sd.setProName(ExcelTool.readStringFromHSSFRow(hssfRow, 5));//商品名称 + sd.setBrandCode(ExcelTool.readStringFromHSSFRow(hssfRow, 6));//品牌代码 + String brandName=ExcelTool.readStringFromHSSFRow(hssfRow, 7); + sd.setBrandName(brandName);//品牌名称 - if (i == 3) {//商品代码 - brandIdHSSFCell.setCellType(CellType.STRING); - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setProCode(value); - } - if (i == 4) {//商品条码 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setProBarCode(value); - } - } - if (i == 5) {//商品名称 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setProName(value); - } - } - if (i == 6) {//品牌代码 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setBrandCode(value); - } - } - if (i == 7) {//品牌名称 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setBrandName(value); - BrandInfoVo brandInfoVo = brandInfoService.selectByCode(sd.getBrandCode()); - if(brandInfoVo==null){ - BrandInfo brandInfo = new BrandInfo(); - brandInfo.setName(value); - brandInfo.setCode(sd.getBrandCode()); - brandInfoService.insert(brandInfo); - } - } - } - if (i == 8) {//大类 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - String[] split = value.split("]"); - String key = split[0].replace("[","");//key - String v=split[1];//类别value - sd.setCategoryb(value); - DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(key, "category"); - if(category==null){ - DictCommon dc=new DictCommon(); - dc.setDictType("category"); - dc.setDictKey(key); - dc.setDictValue(v); - dictCommonService.insert(dc); - } - } - } - if (i == 9) {//中类 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - String[] split = value.split("]"); - String key = split[0].replace("[","");//key - String v=split[1];//类别value - sd.setCategorym(value); - DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(key, "category"); - if(category==null){ - DictCommon dc=new DictCommon(); - dc.setDictType("category"); - dc.setDictKey(key); - dc.setDictValue(v); - dictCommonService.insert(dc); - } - } - } - if (i == 10) {//小类 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - String[] split = value.split("]"); - String key = split[0].replace("[","");//key - String v=split[1];//类别value - sd.setCategorys(value); - DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(key, "category"); - if(category==null){ - DictCommon dc=new DictCommon(); - dc.setDictType("category"); - dc.setDictKey(key); - dc.setDictValue(v); - dictCommonService.insert(dc); - } - } - } - if (i == 11) {//客户代码 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setCustomerCode(value); - } - } - if (i == 12) {//客户名称 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setCustomerName(value); - } - } - if (i == 13) {//销售数量 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setSaleNum(value); - } - } - if (i == 14) {//销售渠道 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setStoreCode(value); - } - } - if (i == 15) {//销售价格 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setSalePrice(value); - } - } - if (i == 16) {//销售成本 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setSaleCost(value); - } - } - if (i == 17) {//利润 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setProfit(value); - } - } - if (i == 18) {//销售日期 - brandIdHSSFCell.setCellType(CellType.STRING); - if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) { - String value = brandIdHSSFCell.getStringCellValue(); - value=value.trim(); - sd.setDataDate(value); - } - } - }else{ - System.err.println("rowNum="+rowNum+",i="+i+",value=null"); - } - } - } + String dalei=ExcelTool.readStringFromHSSFRow(hssfRow, 8);//大类 + + sd.setCategoryb(dalei); + + String zhonglei=ExcelTool.readStringFromHSSFRow(hssfRow, 9);//中类 + sd.setCategorym(zhonglei); + + String xiaolei=ExcelTool.readStringFromHSSFRow(hssfRow, 10);//小类 + sd.setCategorys(xiaolei); + + sd.setCustomerCode(ExcelTool.readStringFromHSSFRow(hssfRow, 11));//客户代码 + sd.setCustomerName(ExcelTool.readStringFromHSSFRow(hssfRow, 12));//客户名称 + sd.setSaleNum(ExcelTool.readStringFromHSSFRow(hssfRow, 13));//销售数量 + sd.setStoreCode(ExcelTool.readStringFromHSSFRow(hssfRow, 14));//销售渠道 + sd.setSalePrice(ExcelTool.readStringFromHSSFRow(hssfRow, 15));//销售价格 + sd.setSaleCost(ExcelTool.readStringFromHSSFRow(hssfRow, 16));//销售成本 + sd.setProfit(ExcelTool.readStringFromHSSFRow(hssfRow, 17));//利润 + sd.setDataDate(ExcelTool.readStringFromHSSFRow(hssfRow, 18));//销售日期 + salesDatas.add(sd); }catch(Exception e){ e.printStackTrace(); System.err.println("i="+i+",value=null"); } - lisss.add(rowNum+""); - baseMapper.insert(sd); - inventoryInformationService.reduceStock(sd.getProCode(),sd.getProName(),sd.getStoreCode(),sd.getSaleNum()); + + //inventoryInformationService.reduceStock(sd.getProCode(),sd.getProName(),sd.getStoreCode(),sd.getSaleNum()); log.info("productInformation:{}", JSONObject.toJSONString(sd)); + log.info("rowNum:{}", rowNum); } String x = JSON.toJSONString(lisss); - System.out.println(x); - String x1 = JSON.toJSONString(lisss2); - System.out.println(x1); - //return message; + System.out.println(x);*/ } - - /** - * - * 销售明细表 - * @param pc - * @return - */ - /*public HSSFWorkbook analysisSalesData2(String pc){ - - }*/ /** * @@ -408,27 +390,23 @@ public class SalesDataService extends MybatisBaseService> listss=new ArrayList<>(); + int i=0; for(SalesData s:list){ String proCode = s.getProCode(); //List storeInfos=storeInfoService.selectLimitStores(); List lps=purchaseRequisitionProService.selectByCode(proCode); - if(lps==null||lps.size()==0){ + if((lps==null||lps.size()==0)){//&&s.getCategorys().indexOf("0811")<0 烟 continue; } if(s.getState()==1){ BigDecimal multiply = new BigDecimal(s.getSaleNum()).multiply(new BigDecimal(s.getSalePrice())); - StoreInfo storeInfo = storeInfoService.selectByCodeAndLimit(s.getStoreCode()); - if(storeInfo!=null){ - System.out.println( - "[" - +s.getStoreCode()+"]"+storeInfo.getName()+","+s.getType()+"," - +s.getCode()+","+s.getProCode()+","+s.getProName()+","+s.getSaleNum()+"," - +s.getSalePrice()+","+multiply.toString()); + /*StoreInfo storeInfo = storeInfoService.selectByCodeAndLimit(s.getStoreCode()); + if(storeInfo!=null){*/ Map map=new HashMap<>(); - map.put("t1","["+s.getStoreCode()+"]"+storeInfo.getName()); - map.put("t2",storeInfo.getName()); + map.put("t1","["+s.getStoreCode()+"]"+s.getStoreName()); + map.put("t2",s.getStoreName()); map.put("t3",s.getType()); map.put("t4",s.getCode()); map.put("t5",s.getProCode()); @@ -438,12 +416,15 @@ public class SalesDataService extends MybatisBaseService addProductNum( List list) { for(int i = 0; i < list.size(); i++){ SalesData pr=list.get(i); - ProductInformationVo productInformation=productInformationService.selectByCode(pr.getProCode()); + /* ProductInformationVo productInformation=productInformationService.selectByCode(pr.getProCode()); log.info("pr:{}",JSONObject.toJSONString(pr)); if(productInformation==null) { pr.setState(2); @@ -697,16 +678,16 @@ public class SalesDataService extends MybatisBaseService restrictedCategorys=restrictedCategoryService.limitJudgement(categoryKey,brandSid); - if("081101,081102,081103".indexOf(categoryKey)>=0||(restrictedCategorys!=null&&restrictedCategorys.size()>0)){ + if("081101,081102,081103".indexOf(categoryKey)>=0||(restrictedCategorys!=null&&restrictedCategorys.size()>0)){*/ pr.setState(1); - }else{ + /* }else{ pr.setState(0); String remarks=""; remarks=remarks+productInformation.getCategory()+"["+productInformation.getCategoryKey()+"]品类,"; remarks=remarks+productInformation.getBrand()+"["+productInformation.getBrandSid()+"]品牌不符合;"; pr.setRemarks(remarks); } - } + }*/ } return list; } diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoMapper.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoMapper.java index 47eeb253..42ce0cbf 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoMapper.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoMapper.java @@ -59,9 +59,14 @@ public interface SupplierInfoMapper extends BaseMapper { IPage selectPageVo(IPage page, @Param(Constants.WRAPPER) Wrapper qw); List selectListAllVo(@Param(Constants.WRAPPER) Wrapper qw); - - @Select("select * from supplier_info") + + @Select("select * from supplier_info ") List selectListVo(); + @Select("select * from supplier_info where purchaseRequisition=1 and bankState=1") + List selectAdoptedListVo(); + @Select("select supplierName name from purchase_requisition group by supplierName") + List selectPurSupplier(); @Select("select * from supplier_info where code=#{code}") SupplierInfoVo selectByCode(String code); + } \ No newline at end of file diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoService.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoService.java index dea93d92..a1d19969 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoService.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/supplierinfo/SupplierInfoService.java @@ -107,4 +107,11 @@ public class SupplierInfoService extends MybatisBaseService selectAll() { + return baseMapper.selectListVo(); + } + public List selectAdoptedListVo() { + return baseMapper.selectAdoptedListVo(); + } } \ No newline at end of file