From 020019989b0aad7ed98cf549c118fe1e7567e75d Mon Sep 17 00:00:00 2001 From: fkf <1475794025@qq.com> Date: Thu, 11 May 2023 16:08:02 +0800 Subject: [PATCH] 5-11 --- .../CrawlSalesAmountMapper.java | 4 +- .../CrawlSalesAmountMapper.xml | 15 +-- .../CrawlSalesAmountService.java | 70 ++++++----- .../CrawlSalesDishesMapper.java | 2 + .../CrawlSalesDishesMapper.xml | 4 + .../CrawlSalesDishesService.java | 2 +- .../biz/crawlpurchase/CrawlPurchaseMapper.xml | 2 +- .../biz/dishesInfo/DishesInfoService.java | 11 +- .../crawl/biz/enpBrand/EnpBrandMapper.java | 2 +- .../zhj/crawl/biz/enpBrand/EnpBrandMapper.xml | 6 +- .../crawl/biz/enpBrand/EnpBrandService.java | 22 +++- .../zhj/crawl/biz/enpInfo/EnpInfoMapper.xml | 5 + .../zhj/crawl/biz/enpInfo/EnpInfoRest.java | 15 ++- .../zhj/crawl/biz/enpInfo/EnpInfoService.java | 64 +++++++++- .../zhj/crawl/biz/enpStore/EnpStoreDto.java | 112 ++++++++++++++++++ .../crawl/biz/enpStore/EnpStoreMapper.java | 16 +++ .../zhj/crawl/biz/enpStore/EnpStoreMapper.xml | 11 ++ .../zhj/crawl/biz/enpStore/EnpStoreRest.java | 41 +++++++ .../crawl/biz/enpStore/EnpStoreService.java | 42 +++++++ .../crawl/biz/materialInfo/MaterialInfo.java | 32 +++++ .../biz/materialInfo/MaterialInfoDto.java | 72 +++++++++++ .../biz/materialInfo/MaterialInfoMapper.java | 12 ++ .../biz/materialInfo/MaterialInfoRest.java | 41 +++++++ .../biz/materialInfo/MaterialInfoService.java | 42 +++++++ 24 files changed, 575 insertions(+), 70 deletions(-) create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoMapper.xml create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreDto.java create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.java create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.xml create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreRest.java create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreService.java create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoDto.java create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoMapper.java create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoRest.java create mode 100644 yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoService.java diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.java index 60f74c07..b6784240 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.java @@ -15,9 +15,7 @@ import org.apache.ibatis.annotations.Param; */ @Mapper public interface CrawlSalesAmountMapper extends BaseMapper { - CrawlSalesAmount select(); - - IPage selectPageVo(IPage page, @Param(Constants.WRAPPER) Wrapper qw); + IPage listPageVo(IPage page, @Param(Constants.WRAPPER) Wrapper qw); @Delete("delete from crawl_sales_amount where dataDate=#{dataDate} ") void deleteOfDay(@Param("dataDate") String currDay); diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.xml b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.xml index 59d3925a..189fc516 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.xml +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountMapper.xml @@ -1,17 +1,12 @@ - - - - - + SELECT s.enpName,b.name,a.storeName,a.dataDate,a.salesAmount + FROM crawl_sales_amount a + inner join enp_store s on s.name = a.storeName + inner join enp_brand b on s.brandName = b.name ${ew.sqlSegment} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountService.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountService.java index cb70aa14..52803148 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountService.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesAmount/CrawlSalesAmountService.java @@ -1,19 +1,15 @@ package com.yxt.supervise.dbcenter.zhj.crawl.biz.crawlSalesAmount; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.yxt.common.base.service.MybatisBaseService; 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.dbcenter.zhj.crawl.ZhjSpider; import com.yxt.supervise.dbcenter.zhj.crawl.spider.RespSalesAmount; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -41,7 +37,7 @@ public class CrawlSalesAmountService extends ServiceImpl qw = new QueryWrapper<>(); if (query != null){ - if (StrUtil.isNotBlank(query.getStoreName())){ + if (query.getStoreName() != null && !query.getStoreName().equals("")){ qw.eq("a.storeName",query.getStoreName()); } if (query.getFromTime() != null && !query.getFromTime().equals("")){ @@ -54,39 +50,41 @@ public class CrawlSalesAmountService extends ServiceImpl crawlSalesAmountIPage = baseMapper.selectPage(page, qw); +// List records = crawlSalesAmountIPage.getRecords(); +// List voList = new ArrayList<>(); +// for (CrawlSalesAmount csa: records){ +// CrawlSalesAmountVo vo = new CrawlSalesAmountVo(); +// BeanUtil.copyProperties(csa,vo); +// vo.setEnpName("中鸿记"); +// String storeName = csa.getStoreName(); +// if("熟溢香振头店".equals(storeName)){ +// vo.setName("熟溢香"); +// }else{ +// vo.setName("馍馍卤"); +// } +// vo.setOils(csa.getSalesAmount()*50*0.01); +// vo.setRice(csa.getSalesAmount()*30*0.01); +// vo.setFace(csa.getSalesAmount()*20*0.01); +// vo.setTotalCount(vo.getOils()+vo.getRice()+vo.getFace()); +// voList.add(vo); +// } +// +// PagerVo pvo = new PagerVo<>(); +// PagerVo pv = PagerUtil.pageToVo(crawlSalesAmountIPage, pvo); +// pv.setRecords(voList); IPage page = PagerUtil.queryToPage(pq); - IPage crawlSalesAmountIPage = baseMapper.selectPage(page, qw); - List records = crawlSalesAmountIPage.getRecords(); - List voList = new ArrayList<>(); - for (CrawlSalesAmount csa: records){ - CrawlSalesAmountVo vo = new CrawlSalesAmountVo(); - BeanUtil.copyProperties(csa,vo); - vo.setEnpName("中鸿记"); - String storeName = csa.getStoreName(); - if("熟溢香振头店".equals(storeName)){ - vo.setName("熟溢香"); - }else{ - vo.setName("馍馍卤"); - } - vo.setOils(csa.getSalesAmount()*50*0.01); - vo.setRice(csa.getSalesAmount()*30*0.01); - vo.setFace(csa.getSalesAmount()*20*0.01); - vo.setTotalCount(vo.getOils()+vo.getRice()+vo.getFace()); - voList.add(vo); + IPage pagging = baseMapper.listPageVo(page, qw); + PagerVo pv = PagerUtil.pageToVo(pagging, null); + List records = pv.getRecords(); + for (CrawlSalesAmountVo record : records) { + record.setOils(record.getSalesAmount()*50*0.01); + record.setRice(record.getSalesAmount()*30*0.01); + record.setFace(record.getSalesAmount()*20*0.01); + record.setTotalCount(record.getOils()+record.getRice()+record.getFace()); } - - PagerVo pvo = new PagerVo<>(); - PagerVo pv = PagerUtil.pageToVo(crawlSalesAmountIPage, pvo); - pv.setRecords(voList); -// IPage pagging = baseMapper.selectPage();//.selectPageVo(page, qw); -// PagerVo pv = PagerUtil.pageToVo(pagging, null); -// List records = pv.getRecords(); -// for (CrawlSalesAmountVo record : records) { -// record.setOils(record.getSalesAmount()*50*0.01); -// record.setRice(record.getSalesAmount()*30*0.01); -// record.setFace(record.getSalesAmount()*20*0.01); -// record.setTotalCount(record.getOils()+record.getRice()+record.getFace()); -// } return pv; } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.java index daaa386d..d06d3645 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.java @@ -16,6 +16,8 @@ public interface CrawlSalesDishesMapper extends BaseMapper { List selectSalesDishesList(CrawlSalesDishesDto dto); + List selectSalesDishesListList(CrawlSalesDishesDto dto); + @Delete("delete from crawl_sales_dishes where dataDate=#{dataDate} ") void deleteOfDay(@Param("dataDate") String currDay); } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.xml b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.xml index 39032901..e96469f0 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.xml +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesMapper.xml @@ -8,4 +8,8 @@ where a.storeName = #{StoreName} and d.dataDate = #{dataDate} + + \ No newline at end of file diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesService.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesService.java index b0d3b26b..9422ecab 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesService.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlSalesDishes/CrawlSalesDishesService.java @@ -34,7 +34,7 @@ public class CrawlSalesDishesService extends ServiceImpl crawlSalesDishes = baseMapper.selectSalesDishesList(dto); + List crawlSalesDishes = baseMapper.selectSalesDishesListList(dto); if (crawlSalesDishes == null || crawlSalesDishes.size() == 0) { return rb.setMsg("此门店下没有销售数据"); } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlpurchase/CrawlPurchaseMapper.xml b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlpurchase/CrawlPurchaseMapper.xml index d102d7b8..2c87a5f1 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlpurchase/CrawlPurchaseMapper.xml +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/crawlpurchase/CrawlPurchaseMapper.xml @@ -3,7 +3,7 @@ - select * from crawl_purchase where storeName = #{storeName} and dataDate = #{dataDate} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/dishesInfo/DishesInfoService.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/dishesInfo/DishesInfoService.java index c38dff9e..606e1e84 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/dishesInfo/DishesInfoService.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/dishesInfo/DishesInfoService.java @@ -16,14 +16,11 @@ import java.util.List; @Service public class DishesInfoService extends MybatisBaseService { - @Autowired - private DishesInfoMapper dishesInfoMapper; - public ResultBean save(DishesInfoDto dto){ ResultBean rb = ResultBean.fireFail(); DishesInfo info = new DishesInfo(); BeanUtil.copyProperties(dto,info,"id","sid"); - int insert = dishesInfoMapper.insert(info); + int insert = baseMapper.insert(info); if (insert == 0){ return rb.setMsg("添加失败"); } @@ -35,7 +32,7 @@ public class DishesInfoService extends MybatisBaseService().eq("sid", sid)); + int delete = baseMapper.delete(new QueryWrapper().eq("sid", sid)); if (delete == 0){ return rb.setMsg("删除失败"); } @@ -53,7 +50,7 @@ public class DishesInfoService extends MybatisBaseService dishesInfos = dishesInfoMapper.selectDishesInfoList(); + List dishesInfos = baseMapper.selectDishesInfoList(); return rb.success().setData(dishesInfos); } } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.java index 35c1f3b9..8dc2b3ed 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.java @@ -10,5 +10,5 @@ import org.apache.ibatis.annotations.Param; */ @Mapper public interface EnpBrandMapper extends BaseMapper { - void deleteEnpBrandBySid(@Param("sid") String sid); + EnpBrand selectEnpBrandBEnpySid(@Param("sid") String sid); } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.xml b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.xml index e8f05409..a646fe6a 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.xml +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandMapper.xml @@ -1,7 +1,7 @@ - - delete from enp_brand where sid = #{sid} - + \ No newline at end of file diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandService.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandService.java index f6245844..a16ec196 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandService.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpBrand/EnpBrandService.java @@ -2,7 +2,10 @@ package com.yxt.supervise.dbcenter.zhj.crawl.biz.enpBrand; import cn.hutool.core.bean.BeanUtil; import com.yxt.common.base.service.MybatisBaseService; +import com.yxt.common.base.utils.StringUtils; import com.yxt.common.core.result.ResultBean; +import com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore.EnpStore; +import com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore.EnpStoreMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -14,13 +17,13 @@ import org.springframework.stereotype.Service; public class EnpBrandService extends MybatisBaseService { @Autowired - private EnpBrandMapper enpBrandMapper; + private EnpStoreMapper enpStoreMapper; public ResultBean save(EnpBrandDto dto){ ResultBean rb = ResultBean.fireFail(); EnpBrand enpBrand = new EnpBrand(); BeanUtil.copyProperties(dto,enpBrand); - int insert = enpBrandMapper.insert(enpBrand); + int insert = baseMapper.insert(enpBrand); if (insert == 0){ return rb.setMsg("添加失败"); } @@ -29,7 +32,7 @@ public class EnpBrandService extends MybatisBaseService + + + + \ No newline at end of file diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoRest.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoRest.java index dac70d01..5540c9c7 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoRest.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoRest.java @@ -4,6 +4,7 @@ import com.yxt.common.core.result.ResultBean; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -20,9 +21,21 @@ public class EnpInfoRest { @Autowired private EnpInfoService enpInfoService; - @ApiOperation("新增企业") + @ApiOperation("新增企业信息") @RequestMapping("/save") public ResultBean save(@RequestBody EnpInfoDto enpInfoDto){ return enpInfoService.save(enpInfoDto); } + + @ApiOperation("删除该企业信息") + @RequestMapping("/deleteEnpInfoBySid/{sid}") + public ResultBean deleteEnpInfoBySid(@PathVariable String sid){ + return enpInfoService.deleteEnpInfoBySid(sid); + } + + @ApiOperation("修改该企业信息") + @RequestMapping("/alterEnpInfo") + public ResultBean alterEnpInfo(@RequestBody EnpInfoDto dto){ + return enpInfoService.alterEnpInfo(dto); + } } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoService.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoService.java index f38987f0..29237ea4 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoService.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpInfo/EnpInfoService.java @@ -1,9 +1,15 @@ package com.yxt.supervise.dbcenter.zhj.crawl.biz.enpInfo; +import cn.hutool.core.bean.BeanUtil; import com.yxt.common.base.service.MybatisBaseService; +import com.yxt.common.base.utils.StringUtils; import com.yxt.common.core.result.ResultBean; +import com.yxt.supervise.dbcenter.zhj.crawl.biz.enpBrand.EnpBrand; +import com.yxt.supervise.dbcenter.zhj.crawl.biz.enpBrand.EnpBrandMapper; +import com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore.EnpStore; +import com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore.EnpStoreMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestBody; /** * @author shkstart @@ -12,7 +18,59 @@ import org.springframework.web.bind.annotation.RequestBody; @Service public class EnpInfoService extends MybatisBaseService{ - public ResultBean save(EnpInfoDto enpInfoDto){ - return null; + @Autowired + private EnpBrandMapper enpBrandMapper; + @Autowired + private EnpStoreMapper enpStoreMapper; + + public ResultBean save(EnpInfoDto dto){ + ResultBean rb = ResultBean.fireFail(); + EnpInfo enpInfo = new EnpInfo(); + BeanUtil.copyProperties(dto,enpInfo); + int insert = baseMapper.insert(enpInfo); + if (insert == 0){ + return rb.setMsg("新增失败"); + } + return rb.success().setMsg("新增成功"); + } + + public ResultBean deleteEnpInfoBySid(String sid){ + ResultBean rb = ResultBean.fireFail(); + int i = deleteBySid(sid); + if (i == 0){ + return rb.setMsg("删除失败"); + } + return rb.success().setMsg("删除成功"); + } + + public ResultBean alterEnpInfo(EnpInfoDto dto){ + ResultBean rb = ResultBean.fireFail(); + EnpInfo enpInfo = fetchBySid(dto.getSid()); + BeanUtil.copyProperties(dto,enpInfo,"id","sid"); + int i = baseMapper.updateById(enpInfo); + EnpBrand enpBrand = enpBrandMapper.selectEnpBrandBEnpySid(dto.getSid()); + EnpStore enpStore = enpStoreMapper.selectEnpStoreByEnpSid(dto.getSid()); + if (enpBrand != null || enpStore != null){ + if (StringUtils.isNotNull(dto.getCode())){ + enpBrand.setEnpCode(dto.getCode()); + enpStore.setEnpCode(dto.getCode()); + } + if (StringUtils.isNotNull(dto.getName())){ + enpBrand.setEnpName(dto.getName()); + enpStore.setEnpName(dto.getName()); + } + if (enpBrand != null){ + //修改企业品牌中所属企业的信息 + enpBrandMapper.updateById(enpBrand); + } + if (enpStore != null){ + //修改企业门店中所属企业的信息 + enpStoreMapper.updateById(enpStore); + } + } + if (i == 0){ + return rb.setMsg("修改失败"); + } + return rb.success().setMsg("修改成功"); } } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreDto.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreDto.java new file mode 100644 index 00000000..23e9b254 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreDto.java @@ -0,0 +1,112 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore; + +import com.yxt.common.core.dto.Dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @author shkstart + * @create 2023-05-11-11:03 + */ +@ApiModel("企业门店信息 传输对象") +public class EnpStoreDto implements Dto { + private String id; + private String sid; + + @ApiModelProperty("门店编码") + private String code; + @ApiModelProperty("门店名称") + private String name; + @ApiModelProperty("所属企业Sid") + private String enpSid; + @ApiModelProperty("所属企业编码") + private String enpCode; + @ApiModelProperty("所属企业名称") + private String enpName; + @ApiModelProperty("所属品牌Sid") + private String brandSid; + @ApiModelProperty("所属品牌编码") + private String brandCode; + @ApiModelProperty("所属品牌名称") + private String brandName; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSid() { + return sid; + } + + public void setSid(String sid) { + this.sid = sid; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEnpSid() { + return enpSid; + } + + public void setEnpSid(String enpSid) { + this.enpSid = enpSid; + } + + public String getEnpCode() { + return enpCode; + } + + public void setEnpCode(String enpCode) { + this.enpCode = enpCode; + } + + public String getEnpName() { + return enpName; + } + + public void setEnpName(String enpName) { + this.enpName = enpName; + } + + public String getBrandSid() { + return brandSid; + } + + public void setBrandSid(String brandSid) { + this.brandSid = brandSid; + } + + public String getBrandCode() { + return brandCode; + } + + public void setBrandCode(String brandCode) { + this.brandCode = brandCode; + } + + public String getBrandName() { + return brandName; + } + + public void setBrandName(String brandName) { + this.brandName = brandName; + } +} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.java new file mode 100644 index 00000000..2f8d0394 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.java @@ -0,0 +1,16 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @author shkstart + * @create 2023-05-11-11:11 + */ +@Mapper +public interface EnpStoreMapper extends BaseMapper { + EnpStore selectEnpStoreByEnpSid(@Param("sid") String sid); + + EnpStore selectEnpStoreByBrandSid(@Param("sid") String sid); +} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.xml b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.xml new file mode 100644 index 00000000..33471513 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreRest.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreRest.java new file mode 100644 index 00000000..44c8c179 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreRest.java @@ -0,0 +1,41 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore; + +import com.yxt.common.core.result.ResultBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author shkstart + * @create 2023-05-11-11:07 + */ +@Api("企业门店信息") +@RestController +@RequestMapping("dbCenter/enpStore") +public class EnpStoreRest { + + @Autowired + private EnpStoreService enpStoreService; + + @ApiOperation("新增企业门店信息") + @RequestMapping("/save") + public ResultBean save(@RequestBody EnpStoreDto dto){ + return enpStoreService.save(dto); + } + + @ApiOperation("删除企业门店信息") + @RequestMapping("/deleteEnpStore/{sid}") + public ResultBean deleteEnpStore(@PathVariable String sid){ + return enpStoreService.deleteEnpStore(sid); + } + + @ApiOperation("修改企业门店信息") + @RequestMapping("/alterEnpStore") + public ResultBean alterEnpStore(@RequestBody EnpStoreDto dto){ + return enpStoreService.alterEnpStore(dto); + } +} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreService.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreService.java new file mode 100644 index 00000000..e3eac574 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/enpStore/EnpStoreService.java @@ -0,0 +1,42 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.enpStore; + +import cn.hutool.core.bean.BeanUtil; +import com.yxt.common.base.service.MybatisBaseService; +import com.yxt.common.core.result.ResultBean; +import org.springframework.stereotype.Service; + +/** + * @author shkstart + * @create 2023-05-11-11:11 + */ +@Service +public class EnpStoreService extends MybatisBaseService { + + public ResultBean save(EnpStoreDto dto){ + ResultBean rb = ResultBean.fireFail(); + EnpStore store = new EnpStore(); + BeanUtil.copyProperties(dto,store); + int insert = baseMapper.insert(store); + if (insert == 0){ + return rb.setMsg("新增失败"); + } + return rb.success().setMsg("新增成功"); + } + + public ResultBean deleteEnpStore(String sid){ + ResultBean rb = ResultBean.fireFail(); + int i = deleteBySid(sid); + return rb.success().setMsg("删除成功"); + } + + public ResultBean alterEnpStore(EnpStoreDto dto){ + ResultBean rb = ResultBean.fireFail(); + EnpStore enpStore = fetchBySid(dto.getSid()); + BeanUtil.copyProperties(dto,enpStore,"id","sid"); + int i = baseMapper.updateById(enpStore); + if (i == 0){ + return rb.setMsg("修改失败"); + } + return rb.success().setMsg("修改成功"); + } +} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfo.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfo.java index b3db38f2..3bd2f317 100644 --- a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfo.java +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfo.java @@ -18,4 +18,36 @@ public class MaterialInfo extends BaseEntity { private String unit; @ApiModelProperty("含税单位") private String taxPrice; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getTaxPrice() { + return taxPrice; + } + + public void setTaxPrice(String taxPrice) { + this.taxPrice = taxPrice; + } } diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoDto.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoDto.java new file mode 100644 index 00000000..9bc3037a --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoDto.java @@ -0,0 +1,72 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.materialInfo; + +import com.yxt.common.core.dto.Dto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @author shkstart + * @create 2023-05-11-11:26 + */ +@ApiModel("物料信息 传输对象") +public class MaterialInfoDto implements Dto { + private String id; + private String sid; + + @ApiModelProperty("物料编码") + private String code; + @ApiModelProperty("物料名称") + private String name; + @ApiModelProperty("规格单位") + private String unit; + @ApiModelProperty("含税单位") + private String taxPrice; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSid() { + return sid; + } + + public void setSid(String sid) { + this.sid = sid; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getTaxPrice() { + return taxPrice; + } + + public void setTaxPrice(String taxPrice) { + this.taxPrice = taxPrice; + } +} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoMapper.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoMapper.java new file mode 100644 index 00000000..4f713ac0 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoMapper.java @@ -0,0 +1,12 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.materialInfo; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author shkstart + * @create 2023-05-11-11:35 + */ +@Mapper +public interface MaterialInfoMapper extends BaseMapper { +} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoRest.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoRest.java new file mode 100644 index 00000000..810adc62 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoRest.java @@ -0,0 +1,41 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.materialInfo; + +import com.yxt.common.core.result.ResultBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author shkstart + * @create 2023-05-11-11:28 + */ +@Api("物料信息") +@RestController +@RequestMapping("dbCenter/materialInfo") +public class MaterialInfoRest { + + @Autowired + private MaterialInfoService materialInfoService; + + @ApiOperation("新增物料信息") + @RequestMapping("/save") + public ResultBean save(@RequestBody MaterialInfoDto dto){ + return materialInfoService.save(dto); + } + + @ApiOperation("删除物料信息") + @RequestMapping("/deleteMaterialInfo/{sid}") + public ResultBean deleteMaterialInfo(@PathVariable String sid){ + return materialInfoService.deleteMaterialInfo(sid); + } + + @ApiOperation("修改物料信息") + @RequestMapping("/alterMaterialInfo") + public ResultBean alterMaterialInfo(@RequestBody MaterialInfoDto dto){ + return materialInfoService.alterMaterialInfo(dto); + } +} diff --git a/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoService.java b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoService.java new file mode 100644 index 00000000..40807263 --- /dev/null +++ b/yxt-supervise-dbcenter/yxt-supervise-dbcenter-biz/src/main/java/com/yxt/supervise/dbcenter/zhj/crawl/biz/materialInfo/MaterialInfoService.java @@ -0,0 +1,42 @@ +package com.yxt.supervise.dbcenter.zhj.crawl.biz.materialInfo; + +import cn.hutool.core.bean.BeanUtil; +import com.yxt.common.base.service.MybatisBaseService; +import com.yxt.common.core.result.ResultBean; +import org.springframework.stereotype.Service; + +/** + * @author shkstart + * @create 2023-05-11-11:34 + */ +@Service +public class MaterialInfoService extends MybatisBaseService { + + public ResultBean save(MaterialInfoDto dto){ + ResultBean rb = ResultBean.fireFail(); + MaterialInfo info = new MaterialInfo(); + BeanUtil.copyProperties(dto,info); + int insert = baseMapper.insert(info); + if (insert == 0){ + return rb.setMsg("新增失败"); + } + return rb.success().setMsg("新增成功"); + } + + public ResultBean deleteMaterialInfo(String sid){ + ResultBean rb = ResultBean.fireFail(); + int i = deleteBySid(sid); + return rb.success().setMsg("删除成功"); + } + + public ResultBean alterMaterialInfo(MaterialInfoDto dto){ + ResultBean rb = ResultBean.fireFail(); + MaterialInfo materialInfo = fetchBySid(dto.getSid()); + BeanUtil.copyProperties(dto,materialInfo,"id","sid"); + int i = baseMapper.updateById(materialInfo); + if (i == 0){ + return rb.setMsg("修改失败"); + } + return rb.success().setMsg("修改成功"); + } +}