LIVE_YE 1 жил өмнө
parent
commit
a6e62065a0

+ 0 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/doumu/DoumuEvaluateController.java

@@ -62,7 +62,6 @@ public class DoumuEvaluateController extends BaseController
     /**
     /**
      * 获取订单评价详细信息
      * 获取订单评价详细信息
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:evaluate:query')")
     @GetMapping(value = "/{evaluateId}")
     @GetMapping(value = "/{evaluateId}")
     public AjaxResult getInfo(@PathVariable("evaluateId") Long evaluateId)
     public AjaxResult getInfo(@PathVariable("evaluateId") Long evaluateId)
     {
     {
@@ -72,7 +71,6 @@ public class DoumuEvaluateController extends BaseController
     /**
     /**
      * 新增订单评价
      * 新增订单评价
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:evaluate:add')")
     @Log(title = "订单评价", businessType = BusinessType.INSERT)
     @Log(title = "订单评价", businessType = BusinessType.INSERT)
     @PostMapping
     @PostMapping
     public AjaxResult add(@RequestBody DoumuEvaluate doumuEvaluate)
     public AjaxResult add(@RequestBody DoumuEvaluate doumuEvaluate)
@@ -83,7 +81,6 @@ public class DoumuEvaluateController extends BaseController
     /**
     /**
      * 修改订单评价
      * 修改订单评价
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:evaluate:edit')")
     @Log(title = "订单评价", businessType = BusinessType.UPDATE)
     @Log(title = "订单评价", businessType = BusinessType.UPDATE)
     @PostMapping("/put")
     @PostMapping("/put")
     public AjaxResult edit(@RequestBody DoumuEvaluate doumuEvaluate)
     public AjaxResult edit(@RequestBody DoumuEvaluate doumuEvaluate)
@@ -94,7 +91,6 @@ public class DoumuEvaluateController extends BaseController
     /**
     /**
      * 删除订单评价
      * 删除订单评价
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:evaluate:remove')")
     @Log(title = "订单评价", businessType = BusinessType.DELETE)
     @Log(title = "订单评价", businessType = BusinessType.DELETE)
 	@GetMapping("/delete/{evaluateIds}")
 	@GetMapping("/delete/{evaluateIds}")
     public AjaxResult remove(@PathVariable Long[] evaluateIds)
     public AjaxResult remove(@PathVariable Long[] evaluateIds)

+ 34 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/doumu/StatisticsController.java

@@ -18,6 +18,7 @@ public class StatisticsController {
 
 
     /**
     /**
      * pc首页各环节数量统计
      * pc首页各环节数量统计
+     * dateType 1:当天,2:本周,3:本月,4:当前季度,5:年度
      */
      */
     @PreAuthorize("@ss.hasPermi('system:statistics:link')")
     @PreAuthorize("@ss.hasPermi('system:statistics:link')")
     @GetMapping(value = "/link")
     @GetMapping(value = "/link")
@@ -65,4 +66,37 @@ public class StatisticsController {
     {
     {
         return doumuProductInfoService.evaluate();
         return doumuProductInfoService.evaluate();
     }
     }
+
+    /**
+     * app首页销售额统计
+     */
+    @PreAuthorize("@ss.hasPermi('system:statistics:sales')")
+    @GetMapping(value = "/app/sales")
+    public AjaxResult sales()
+    {
+        return doumuProductInfoService.sales();
+    }
+
+    /**
+     * app首页销售额统计
+     */
+    @PreAuthorize("@ss.hasPermi('system:statistics:numberWorks')")
+    @GetMapping(value = "/app/numberWorks")
+    public AjaxResult numberWorks()
+    {
+        return doumuProductInfoService.numberWorks();
+    }
+
+    /**
+     * app首页好评率统计
+     * dateType 1:当天,2:本周,3:本月,4:当前季度,5:年度
+     */
+    @PreAuthorize("@ss.hasPermi('system:statistics:reputation')")
+    @GetMapping(value = "/app/reputation")
+    public AjaxResult reputation(String dateType)
+    {
+        return doumuProductInfoService.reputation(dateType);
+    }
+
+
 }
 }

+ 0 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java

@@ -35,7 +35,6 @@ public class SysNoticeController extends BaseController
     /**
     /**
      * 获取通知公告列表
      * 获取通知公告列表
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:list')")
     @GetMapping("/list")
     @GetMapping("/list")
     public TableDataInfo list(SysNotice notice)
     public TableDataInfo list(SysNotice notice)
     {
     {
@@ -47,7 +46,6 @@ public class SysNoticeController extends BaseController
     /**
     /**
      * 根据通知公告编号获取详细信息
      * 根据通知公告编号获取详细信息
      */
      */
-    @PreAuthorize("@ss.hasPermi('system:notice:query')")
     @GetMapping(value = "/{noticeId}")
     @GetMapping(value = "/{noticeId}")
     public AjaxResult getInfo(@PathVariable Long noticeId)
     public AjaxResult getInfo(@PathVariable Long noticeId)
     {
     {

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -113,6 +113,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                 .antMatchers("/login", "/register", "/captchaImage").permitAll()
                 .antMatchers("/login", "/register", "/captchaImage").permitAll()
                 .antMatchers("/new/news/**", "/wx/pay/**", "/ali/pay/**","/sf/**","/china/area/fractionation/**","/common/upload","/system/info/**").permitAll()
                 .antMatchers("/new/news/**", "/wx/pay/**", "/ali/pay/**","/sf/**","/china/area/fractionation/**","/common/upload","/system/info/**").permitAll()
+                .antMatchers("/system/dict/data/type/**","/system/evaluate/**","/banner/banner/listNoPage","/system/notice/list","system/notice/**").permitAll()
                 // 静态资源,可匿名访问
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DoumuProductFjMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
 
 
 import java.util.List;
 import java.util.List;
 import com.ruoyi.system.domain.DoumuProductFj;
 import com.ruoyi.system.domain.DoumuProductFj;
+import org.apache.ibatis.annotations.Param;
 
 
 /**
 /**
  * 痘姆古陶_附件Mapper接口
  * 痘姆古陶_附件Mapper接口
@@ -58,4 +59,6 @@ public interface DoumuProductFjMapper
      * @return 结果
      * @return 结果
      */
      */
     public int deleteDoumuProductFjByFiIds(Long[] fiIds);
     public int deleteDoumuProductFjByFiIds(Long[] fiIds);
+
+    void deleteDoumuProductFjByProductId(@Param("productId")Long productId, @Param("module")String module);
 }
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IDoumuProductInfoService.java

@@ -73,4 +73,10 @@ public interface IDoumuProductInfoService
     AjaxResult weekFollow();
     AjaxResult weekFollow();
 
 
     AjaxResult evaluate();
     AjaxResult evaluate();
+
+    AjaxResult sales();
+
+    AjaxResult numberWorks();
+
+    AjaxResult reputation(String dateType);
 }
 }

+ 10 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DoumuEvaluateServiceImpl.java

@@ -34,6 +34,14 @@ public class DoumuEvaluateServiceImpl implements IDoumuEvaluateService
     @Override
     @Override
     public DoumuEvaluate selectDoumuEvaluateByEvaluateId(Long evaluateId)
     public DoumuEvaluate selectDoumuEvaluateByEvaluateId(Long evaluateId)
     {
     {
+        DoumuEvaluate doumuEvaluate = doumuEvaluateMapper.selectDoumuEvaluateByEvaluateId(evaluateId);
+        //查询附件
+        DoumuProductFj doumuProductFj = new DoumuProductFj();
+        doumuProductFj.setProductId(doumuEvaluate.getProductId());
+        doumuProductFj.setModule("2");
+        List<DoumuProductFj> fjList = doumuProductFjMapper.selectDoumuProductFjList(doumuProductFj);
+        doumuEvaluate.setFjList(fjList);
+
         return doumuEvaluateMapper.selectDoumuEvaluateByEvaluateId(evaluateId);
         return doumuEvaluateMapper.selectDoumuEvaluateByEvaluateId(evaluateId);
     }
     }
 
 
@@ -83,13 +91,13 @@ public class DoumuEvaluateServiceImpl implements IDoumuEvaluateService
     public int updateDoumuEvaluate(DoumuEvaluate doumuEvaluate)
     public int updateDoumuEvaluate(DoumuEvaluate doumuEvaluate)
     {
     {
         doumuEvaluate.setUpdateTime(DateUtils.getNowDate());
         doumuEvaluate.setUpdateTime(DateUtils.getNowDate());
+        //先删除附件
+        doumuProductFjMapper.deleteDoumuProductFjByProductId(doumuEvaluate.getProductId(),"2");
 
 
         //保存附件
         //保存附件
         List<DoumuProductFj> fjList = doumuEvaluate.getFjList();
         List<DoumuProductFj> fjList = doumuEvaluate.getFjList();
         if(fjList!=null && fjList.size()>0){
         if(fjList!=null && fjList.size()>0){
             for (DoumuProductFj doumuProductFj : fjList) {
             for (DoumuProductFj doumuProductFj : fjList) {
-                //先删除附件
-                doumuProductFjMapper.deleteDoumuProductFjByFiId(doumuProductFj.getFiId());
                 //再保存附件
                 //再保存附件
                 doumuProductFj.setProductId(doumuEvaluate.getProductId());
                 doumuProductFj.setProductId(doumuEvaluate.getProductId());
                 doumuProductFj.setModule("2");
                 doumuProductFj.setModule("2");

+ 227 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DoumuProductInfoServiceImpl.java

@@ -123,13 +123,12 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
     public int updateDoumuProductInfo(DoumuProductInfo doumuProductInfo)
     public int updateDoumuProductInfo(DoumuProductInfo doumuProductInfo)
     {
     {
         doumuProductInfo.setUpdateTime(DateUtils.getNowDate());
         doumuProductInfo.setUpdateTime(DateUtils.getNowDate());
-
+        //先删除附件
+        doumuProductFjMapper.deleteDoumuProductFjByProductId(doumuProductInfo.getProductId(),"1");
         //保存附件
         //保存附件
         List<DoumuProductFj> fjList = doumuProductInfo.getFjList();
         List<DoumuProductFj> fjList = doumuProductInfo.getFjList();
         if(fjList!=null && fjList.size()>0){
         if(fjList!=null && fjList.size()>0){
             for (DoumuProductFj doumuProductFj : fjList) {
             for (DoumuProductFj doumuProductFj : fjList) {
-                //先删除附件
-                doumuProductFjMapper.deleteDoumuProductFjByFiId(doumuProductFj.getFiId());
                 //再保存附件
                 //再保存附件
                 doumuProductFj.setProductId(doumuProductInfo.getProductId());
                 doumuProductFj.setProductId(doumuProductInfo.getProductId());
                 doumuProductFj.setModule("1");
                 doumuProductFj.setModule("1");
@@ -312,8 +311,12 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
             StringBuilder sb = new StringBuilder();
             StringBuilder sb = new StringBuilder();
             sb.append(i).append("月");
             sb.append(i).append("月");
             listX.add(sb.toString());
             listX.add(sb.toString());
-            //当前月份
-            String month = DateUtils.dateTimeNow("yyyy-MM");
+
+            //月份
+            String month = year+"-0"+i;
+            if(i>10){
+                month = year+"-"+i;
+            }
             //发货数
             //发货数
             int y1 = 0;
             int y1 = 0;
             //取货数
             //取货数
@@ -432,4 +435,223 @@ public class DoumuProductInfoServiceImpl implements IDoumuProductInfoService
         map.put("hc",hc);
         map.put("hc",hc);
         return AjaxResult.success(map);
         return AjaxResult.success(map);
     }
     }
+
+    @Override
+    public AjaxResult sales() {
+        Map<String,Object> map = new HashMap<>();
+        //当前年第一天
+        String startTime = DateUtils.getTime("5");
+        //当天
+        String endTime = DateUtils.getTime("1");
+        //查询当前时间内数据
+        DoumuProductInfo doumuProductInfo = new DoumuProductInfo();
+        doumuProductInfo.setBeginTime(startTime);
+        doumuProductInfo.setEndTime(endTime);
+        List<DoumuProductInfo> doumuProductInfoList = doumuProductInfoMapper.selectDoumuProductInfoList(doumuProductInfo);
+        //月份
+        List<String> listX = new ArrayList<>();
+        //金额
+        List<String> listy = new ArrayList<>();
+        //获取当前年份
+        String year = DateUtils.dateTimeNow("yyyy");
+        if(doumuProductInfoList==null || doumuProductInfoList.size()<=0){
+            for (int i = 1; i < 13; i++) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(i).append("月");
+                listX.add(sb.toString());
+                listy.add("0");
+            }
+            map.put("month",listX);
+            map.put("sales",listy);
+            return AjaxResult.success(map);
+        }
+
+        for (int i = 1; i < 13; i++) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(i).append("月");
+            listX.add(sb.toString());
+            //月份
+            String month = year+"-0"+i;
+            if(i>10){
+                month = year+"-"+i;
+            }
+            //金额
+            Double y3 = 0D;
+            for (DoumuProductInfo productInfo : doumuProductInfoList) {
+                if(productInfo.getCreateTime().toString().contains(month)){
+                    //金额
+                    BigDecimal num1 = new BigDecimal(y3);
+                    BigDecimal num2 = new BigDecimal(productInfo.getTotalPrice());
+                    BigDecimal subNum1 = num1.add(num2);
+                    y3 = subNum1.doubleValue();
+                }
+            }
+            listy.add(String.valueOf(y3));
+
+        }
+        map.put("month",listX);
+        map.put("sales",listy);
+        return AjaxResult.success(map);
+    }
+
+    @Override
+    public AjaxResult numberWorks() {
+        Map<String,Object> map = new HashMap<>();
+        //当前年第一天
+        String startTime = DateUtils.getTime("5");
+        //当天
+        String endTime = DateUtils.getTime("1");
+        //查询当前时间内数据
+        DoumuProductInfo doumuProductInfo = new DoumuProductInfo();
+        doumuProductInfo.setBeginTime(startTime);
+        doumuProductInfo.setEndTime(endTime);
+        List<DoumuProductInfo> doumuProductInfoList = doumuProductInfoMapper.selectDoumuProductInfoList(doumuProductInfo);
+        List<String> listX = new ArrayList<>();
+        //发货数
+        List<String> listy = new ArrayList<>();
+
+        //获取当前年份
+        String year = DateUtils.dateTimeNow("yyyy");
+        if(doumuProductInfoList==null || doumuProductInfoList.size()<=0){
+            for (int i = 1; i < 13; i++) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(i).append("月");
+                listX.add(sb.toString());
+                listy.add("0");
+
+            }
+            map.put("totality",0);
+            map.put("month",listX);
+            map.put("num",listy);
+            return AjaxResult.success(map);
+        }
+        int totality = 0;
+        for (int i = 1; i < 13; i++) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(i).append("月");
+            listX.add(sb.toString());
+
+            //月份
+            String month = year+"-0"+i;
+            if(i>10){
+                month = year+"-"+i;
+            }
+            //发货数
+            int y = 0;
+
+            for (DoumuProductInfo productInfo : doumuProductInfoList) {
+                if(productInfo.getCreateTime().toString().contains(month)){
+                    y = y + Integer.parseInt(productInfo.getQuantity());
+                }
+            }
+            totality = totality + y;
+            listy.add(String.valueOf(y));
+        }
+        map.put("totality",totality);
+        map.put("month",listX);
+        map.put("num",listy);
+        return AjaxResult.success(map);
+    }
+
+
+    /**
+     * app首页好评率统计
+     * dateType 1:当天,2:本周,3:本月,4:当前季度,5:年度
+     */
+    @Override
+    public AjaxResult reputation(String dateType) {
+        Map<String,Object> map = new HashMap<>();
+        String startTime = DateUtils.getTime(dateType);
+        String endTime = DateUtils.getTime("1");
+        DoumuEvaluate doumuEvaluate = new DoumuEvaluate();
+        doumuEvaluate.setBeginTime(startTime);
+        doumuEvaluate.setEndTime(endTime);
+        List<DoumuEvaluate> doumuEvaluateList = doumuEvaluateMapper.selectDoumuEvaluateList(doumuEvaluate);
+        if(doumuEvaluateList==null || doumuEvaluateList.size()<=0){
+            map.put("fch","0%");
+            map.put("h","0%");
+            map.put("yb","0%");
+            map.put("c","0%");
+            map.put("hc","0%");
+            return AjaxResult.success(map);
+        }
+        int zs = doumuEvaluateList.size();
+        BigDecimal numZs = new BigDecimal(zs);
+        //非常好
+        int fch = 0;
+        //好
+        int h = 0;
+        //一般
+        int yb = 0;
+        //差
+        int c = 0;
+        //很差
+        int hc = 0;
+        if(doumuEvaluateList!=null && doumuEvaluateList.size()>0){
+            for (DoumuEvaluate evaluate : doumuEvaluateList) {
+                if("5".equals(evaluate.getProductEvaluate())){
+                    fch++;
+                }else if("4".equals(evaluate.getProductEvaluate())){
+                    h++;
+                }else if("3".equals(evaluate.getProductEvaluate())){
+                    yb++;
+                }else if("2".equals(evaluate.getProductEvaluate())){
+                    c++;
+                }else if("1".equals(evaluate.getProductEvaluate())){
+                    hc++;
+                }
+            }
+            map.put("fch","0%");
+            map.put("h","0%");
+            map.put("yb","0%");
+            map.put("c","0%");
+            map.put("hc","0%");
+            if(fch != 0){
+                BigDecimal numFch = new BigDecimal(fch);
+                double result = Double.parseDouble(((numZs.divide(numFch,2,BigDecimal.ROUND_HALF_UP))).toString());
+                // 创建DecimalFormat对象并设置格式化模式为"0%"
+                DecimalFormat decimalFormat = new DecimalFormat("0%");
+                // 使用DecimalFormat对象进行格式化操作
+                String fchBfb = decimalFormat.format((result));
+                map.put("fch",fchBfb);
+            }
+            if(h != 0){
+                BigDecimal numH = new BigDecimal(h);
+                double result = Double.parseDouble(((numZs.divide(numH,2,BigDecimal.ROUND_HALF_UP))).toString());
+                // 创建DecimalFormat对象并设置格式化模式为"0%"
+                DecimalFormat decimalFormat = new DecimalFormat("0%");
+                // 使用DecimalFormat对象进行格式化操作
+                String HBfb = decimalFormat.format((result));
+                map.put("h",HBfb);
+            }
+            if(yb != 0){
+                BigDecimal numYb = new BigDecimal(yb);
+                double result = Double.parseDouble(((numZs.divide(numYb,2,BigDecimal.ROUND_HALF_UP))).toString());
+                // 创建DecimalFormat对象并设置格式化模式为"0%"
+                DecimalFormat decimalFormat = new DecimalFormat("0%");
+                // 使用DecimalFormat对象进行格式化操作
+                String ybBfb = decimalFormat.format((result));
+                map.put("yb",ybBfb);
+            }
+            if(c != 0){
+                BigDecimal numC = new BigDecimal(c);
+                double result = Double.parseDouble(((numZs.divide(numC,2,BigDecimal.ROUND_HALF_UP))).toString());
+                // 创建DecimalFormat对象并设置格式化模式为"0%"
+                DecimalFormat decimalFormat = new DecimalFormat("0%");
+                // 使用DecimalFormat对象进行格式化操作
+                String cBfb = decimalFormat.format((result));
+                map.put("c",cBfb);
+            }
+            if(hc != 0){
+                BigDecimal numHc = new BigDecimal(hc);
+                double result = Double.parseDouble(((numZs.divide(numHc,2,BigDecimal.ROUND_HALF_UP))).toString());
+                // 创建DecimalFormat对象并设置格式化模式为"0%"
+                DecimalFormat decimalFormat = new DecimalFormat("0%");
+                // 使用DecimalFormat对象进行格式化操作
+                String hcBfb = decimalFormat.format((result));
+                map.put("hc",hcBfb);
+            }
+        }
+        return AjaxResult.success(map);
+    }
 }
 }

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/DoumuEvaluateMapper.xml

@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectDoumuEvaluateVo"/>
         <include refid="selectDoumuEvaluateVo"/>
         where evaluate_id = #{evaluateId}
         where evaluate_id = #{evaluateId}
     </select>
     </select>
-    <select id="selectDoumuEvaluateByProductId" resultType="com.ruoyi.system.domain.DoumuEvaluate">
+    <select id="selectDoumuEvaluateByProductId" resultMap="DoumuEvaluateResult">
         <include refid="selectDoumuEvaluateVo"/>
         <include refid="selectDoumuEvaluateVo"/>
         where product_id = #{productId}
         where product_id = #{productId}
     </select>
     </select>

+ 5 - 0
ruoyi-system/src/main/resources/mapper/system/DoumuProductFjMapper.xml

@@ -76,4 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{fiId}
             #{fiId}
         </foreach>
         </foreach>
     </delete>
     </delete>
+    <delete id="deleteDoumuProductFjByProductId">
+        delete from doumu_product_fj
+        where product_id = #{productId}
+        <if test="module != null  and module != ''"> and module = #{module}</if>
+    </delete>
 </mapper>
 </mapper>