Jelajahi Sumber

存储空间

suochencheng 7 tahun lalu
induk
melakukan
e5e0b51960

+ 1 - 0
src/main/java/com/izouma/awesomeadmin/dao/OrderImageMapper.java

@@ -30,5 +30,6 @@ public interface OrderImageMapper{
 
     List<OrderImage> query(OrderImage record);
 
+    OrderImage getMemorySize(OrderImage record);
 }
 

+ 69 - 1
src/main/java/com/izouma/awesomeadmin/dao/OrderImageMapper.xml

@@ -263,7 +263,7 @@
         <where>
             and del_flag = 'N'
             <if test="record.baseRepairId != null and !&quot;&quot;.equals(record.baseRepairId)">
-                and  id in ( SELECT image_id FROM order_repair_detail WHERE repair_id = #{record.baseRepairId})
+                and id in ( SELECT image_id FROM order_repair_detail WHERE repair_id = #{record.baseRepairId})
             </if>
             <if test="record.id != null and !&quot;&quot;.equals(record.id)">
                 and id = #{record.id}
@@ -567,6 +567,74 @@
         </where>
         LIMIT 1
     </select>
+    <select id="getMemorySize" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.OrderImage">
+        SELECT
+        store_id,
+        ROUND(SUM(original_size) / 1024) AS original_size,
+        ROUND(SUM(finished_size) / 1024) AS finished_size,
+        ROUND(
+        SUM(original_size) / 1024 + SUM(finished_size) / 1024
+        ) AS total_size
+        FROM
+        order_image
+        <where>
+            and del_flag = 'N'
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="orderId != null and !&quot;&quot;.equals(orderId)">
+                and order_id = #{orderId}
+            </if>
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                and user_id = #{userId}
+            </if>
+            <if test="storeId != null and !&quot;&quot;.equals(storeId)">
+                and store_id = #{storeId}
+            </if>
+            <if test="originalImage != null and !&quot;&quot;.equals(originalImage)">
+                and original_image = #{originalImage}
+            </if>
+            <if test="originalSize != null and !&quot;&quot;.equals(originalSize)">
+                and original_size = #{originalSize}
+            </if>
+            <if test="finishedImage != null and !&quot;&quot;.equals(finishedImage)">
+                and finished_image = #{finishedImage}
+            </if>
+            <if test="finishedSize != null and !&quot;&quot;.equals(finishedSize)">
+                and finished_size = #{finishedSize}
+            </if>
+            <if test="dealUser != null and !&quot;&quot;.equals(dealUser)">
+                and deal_user = #{dealUser}
+            </if>
+            <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
+                and status_flag = #{statusFlag}
+            </if>
+            <if test="remark != null and !&quot;&quot;.equals(remark)">
+                and remark = #{remark}
+            </if>
+            <if test="imageName != null and !&quot;&quot;.equals(imageName)">
+                and image_name = #{imageName}
+            </if>
+
+        </where>
+        GROUP BY
+        store_id
+    </select>
     <update id="delete">
         UPDATE order_image SET del_flag = 'Y'
         <where>

+ 12 - 0
src/main/java/com/izouma/awesomeadmin/dao/StoreInfoMapper.xml

@@ -31,6 +31,7 @@
         <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
         <result column="subclass" property="subclass" jdbcType="VARCHAR"/>
         <result column="storelabel" property="storelabel" jdbcType="VARCHAR"/>
+        <result column="memory_space" property="memorySpace" jdbcType="DECIMAL"/>
     </resultMap>
     <sql id="Base_Column_List">
         <trim suffixOverrides=",">
@@ -92,6 +93,8 @@
 
             storelabel,
 
+            memory_space,
+
         </trim>
     </sql>
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
@@ -195,6 +198,9 @@
             <if test="storelabel!= null">
                 storelabel,
             </if>
+            <if test="memorySpace!= null">
+                memory_space,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">
@@ -284,6 +290,9 @@
             <if test="storelabel != null">
                 #{storelabel,jdbcType=VARCHAR},
             </if>
+            <if test="memorySpace != null">
+                #{memorySpace,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.StoreInfo">
@@ -376,6 +385,9 @@
             <if test="storelabel != null">
                 storelabel= #{storelabel,jdbcType=VARCHAR},
             </if>
+            <if test="memorySpace != null">
+                memory_space= #{memorySpace,jdbcType=VARCHAR},
+            </if>
         </set>
         where id = #{id,jdbcType=INTEGER}
     </update>

+ 9 - 0
src/main/java/com/izouma/awesomeadmin/model/OrderImage.java

@@ -28,6 +28,8 @@ public class OrderImage {
 
     private String imageName;
 
+    private BigDecimal totalSize;
+
 
     /**
      * 图片备注
@@ -258,5 +260,12 @@ public class OrderImage {
         this.imageName = imageName;
     }
 
+    public BigDecimal getTotalSize() {
+        return totalSize;
+    }
+
+    public void setTotalSize(BigDecimal totalSize) {
+        this.totalSize = totalSize;
+    }
 }
 

+ 14 - 0
src/main/java/com/izouma/awesomeadmin/model/StoreInfo.java

@@ -1,5 +1,6 @@
 package com.izouma.awesomeadmin.model;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
@@ -40,6 +41,11 @@ public class StoreInfo {
 
     private String storelabel;
 
+    /**
+     * 存储空间
+     */
+    private BigDecimal memorySpace;
+
     private String searchKey;
 
     /**
@@ -307,5 +313,13 @@ public class StoreInfo {
     public void setStorelabel(String storelabel) {
         this.storelabel = storelabel;
     }
+
+    public BigDecimal getMemorySpace() {
+        return memorySpace;
+    }
+
+    public void setMemorySpace(BigDecimal memorySpace) {
+        this.memorySpace = memorySpace;
+    }
 }
 

+ 1 - 0
src/main/java/com/izouma/awesomeadmin/service/OrderImageService.java

@@ -33,5 +33,6 @@ public interface OrderImageService {
      */
     boolean repair(OrderImage record);
 
+    OrderImage getMemorySize(OrderImage record);
 }
 

+ 14 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/OrderImageServiceImpl.java

@@ -226,5 +226,19 @@ public class OrderImageServiceImpl implements OrderImageService {
 
         return false;
     }
+
+    @Override
+    public OrderImage getMemorySize(OrderImage record) {
+
+        logger.info("getMemorySize");
+        try {
+
+            return orderImageMapper.getMemorySize(record);
+        } catch (Exception e) {
+            logger.error("getMemorySize", e);
+        }
+
+        return null;
+    }
 }
 

+ 71 - 45
src/main/java/com/izouma/awesomeadmin/web/CustomerServiceController.java

@@ -18,8 +18,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 /**
-*  controller类
-*/
+ * controller类
+ */
 @Controller
 @RequestMapping("/customerService")
 public class CustomerServiceController {
@@ -28,8 +28,8 @@ public class CustomerServiceController {
     private CustomerServiceService customerServiceService;
 
     /**
-    * <p>获取全部记录。</p>
-    */
+     * <p>获取全部记录。</p>
+     */
     @RequiresAuthentication
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
@@ -39,8 +39,8 @@ public class CustomerServiceController {
     }
 
     /**
-    * <p>根据Id。</p>
-    */
+     * <p>根据Id。</p>
+     */
     @RequestMapping(value = "/getCustomerService", method = RequestMethod.GET)
     @ResponseBody
     public Result getCustomerService(@RequestParam(required = false, value = "id") String id) {
@@ -49,8 +49,8 @@ public class CustomerServiceController {
     }
 
     /**
-    * <p>根据条件获取。</p>
-    */
+     * <p>根据条件获取。</p>
+     */
     @RequestMapping(value = "/getOne", method = RequestMethod.GET)
     @ResponseBody
     public Result getOne(CustomerService record) {
@@ -60,14 +60,14 @@ public class CustomerServiceController {
 
 
     /**
-    * <p>分页查询。</p>
-    */
+     * <p>分页查询。</p>
+     */
     @RequestMapping(value = "/page", method = RequestMethod.GET)
     @ResponseBody
     public Result page(Page page, CustomerService record) {
         Map<String, Object> result = new HashMap<>();
 
-        List<CustomerService> pp =customerServiceService.getCustomerServiceByPage(page, record);
+        List<CustomerService> pp = customerServiceService.getCustomerServiceByPage(page, record);
 
         result.put(AppConstant.PAGE, page);
         result.put("pp", pp);
@@ -76,90 +76,116 @@ public class CustomerServiceController {
 
 
     /**
-    * <p>保存。</p>
-    */
+     * <p>保存。</p>
+     */
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ResponseBody
     public Result save(CustomerService record) {
         boolean num = customerServiceService.createCustomerService(record);
         if (num) {
-        return new Result(true, record.getId());
+            return new Result(true, record.getId());
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>更新信息。</p>
-    */
+     * <p>更新信息。</p>
+     */
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ResponseBody
     public Result updateCustomerService(CustomerService record) {
         boolean num = customerServiceService.updateCustomerService(record);
         if (num) {
-        return new Result(true, "保存成功");
+            return new Result(true, "保存成功");
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>删除。</p>
-    */
+     * <p>删除。</p>
+     */
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @ResponseBody
     public Result deleteCustomerService(@RequestParam(required = true, value = "id") String id) {
 
         boolean num = customerServiceService.deleteCustomerService(id);
         if (num) {
-        return new Result(true, "删除成功");
+            return new Result(true, "删除成功");
         }
         return new Result(false, "删除异常");
     }
 
     /**
-    * 导出Excel
-    * @param request
-    * @param response
-    * @param record
-    * @throws Exception
-    */
+     * 导出Excel
+     *
+     * @param request
+     * @param response
+     * @param record
+     * @throws Exception
+     */
     @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
     @ResponseBody
     public void exportExcel(HttpServletRequest request, HttpServletResponse response, CustomerService record) throws Exception {
 
-    List<CustomerService> customerServices = customerServiceService.getCustomerServiceList(record);
+        List<CustomerService> customerServices = customerServiceService.getCustomerServiceList(record);
 
 
         String sheetName = "customer_service";
         String titleName = "店铺客服数据表";
         String fileName = "店铺客服表";
         int columnNumber = 14;
-        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
-        String[] columnName = {  "" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "店铺" ,   "客服名" ,   "密码" ,   "登录名" ,   "头像" ,   "可用标识" ,   "状态" ,   "登录时间"  };
+        int[] columnWidth = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
+        String[] columnName = {"", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "店铺", "客服名", "密码", "登录名", "头像", "可用标识", "状态", "登录时间"};
         String[][] dataList = new String[customerServices.size()][14];
 
         for (int i = 0; i < customerServices.size(); i++) {
 
-                        dataList[i][0] = String.valueOf(customerServices.get(i).getId());
-                        dataList[i][1] = String.valueOf(customerServices.get(i).getDelFlag());
-                        dataList[i][2] = String.valueOf(customerServices.get(i).getUpdateTime());
-                        dataList[i][3] = String.valueOf(customerServices.get(i).getUpdateUser());
-                        dataList[i][4] = String.valueOf(customerServices.get(i).getCreateTime());
-                        dataList[i][5] = String.valueOf(customerServices.get(i).getCreateUser());
-                        dataList[i][6] = String.valueOf(customerServices.get(i).getStoreId());
-                        dataList[i][7] = String.valueOf(customerServices.get(i).getServiceName());
-                        dataList[i][8] = String.valueOf(customerServices.get(i).getPassword());
-                        dataList[i][9] = String.valueOf(customerServices.get(i).getUsername());
-                        dataList[i][10] = String.valueOf(customerServices.get(i).getIcon());
-                        dataList[i][11] = String.valueOf(customerServices.get(i).getUseFlag());
-                        dataList[i][12] = String.valueOf(customerServices.get(i).getStatusFlag());
-                        dataList[i][13] = String.valueOf(customerServices.get(i).getLoginTime());
-                    }
+            dataList[i][0] = String.valueOf(customerServices.get(i).getId());
+            dataList[i][1] = String.valueOf(customerServices.get(i).getDelFlag());
+            dataList[i][2] = String.valueOf(customerServices.get(i).getUpdateTime());
+            dataList[i][3] = String.valueOf(customerServices.get(i).getUpdateUser());
+            dataList[i][4] = String.valueOf(customerServices.get(i).getCreateTime());
+            dataList[i][5] = String.valueOf(customerServices.get(i).getCreateUser());
+            dataList[i][6] = String.valueOf(customerServices.get(i).getStoreId());
+            dataList[i][7] = String.valueOf(customerServices.get(i).getServiceName());
+            dataList[i][8] = String.valueOf(customerServices.get(i).getPassword());
+            dataList[i][9] = String.valueOf(customerServices.get(i).getUsername());
+            dataList[i][10] = String.valueOf(customerServices.get(i).getIcon());
+            dataList[i][11] = String.valueOf(customerServices.get(i).getUseFlag());
+            dataList[i][12] = String.valueOf(customerServices.get(i).getStatusFlag());
+            dataList[i][13] = String.valueOf(customerServices.get(i).getLoginTime());
+        }
 
 
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
-        columnNumber, columnWidth, columnName, dataList, response);
+                columnNumber, columnWidth, columnName, dataList, response);
+
+
+    }
+
+
+    @RequestMapping(value = "/login", method = RequestMethod.POST)
+    @ResponseBody
+    public Result login(@RequestParam(required = true, value = "username") String username, @RequestParam(required = true, value = "password") String password) {
+
+        CustomerService record = new CustomerService();
+        record.setUsername(username);
+        record.setPassword(password);
+
+        record = customerServiceService.getCustomerService(record);
 
+        if (record != null) {
+            CustomerService update = new CustomerService();
+            update.setId(record.getId());
+            update.setLoginTime(new Date());
 
+            customerServiceService.updateCustomerService(update);
+
+            return new Result(true, record);
         }
+
+        return new Result(false, "用户名或密码错误");
     }
 
+}
+

+ 7 - 0
src/main/java/com/izouma/awesomeadmin/web/OrderImageController.java

@@ -301,5 +301,12 @@ public class OrderImageController {
         return new Result(true, "保存成功");
     }
 
+    @RequestMapping(value = "/getMemorySize", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getMemorySize(OrderImage record) {
+        OrderImage data = orderImageService.getMemorySize(record);
+        return new Result(true, data);
+    }
+
 }