Browse Source

封面关联修改

yumeng 5 years ago
parent
commit
762a061213

+ 45 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageInfoController.java

@@ -2,14 +2,19 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialImageInfo;
 import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -27,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.sql.Date;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -111,6 +117,45 @@ public class MaterialImageInfoController {
         return result;
     }
 
+
+    @AutoLog(value = "素材-编辑")
+    @ApiOperation(value = "素材-编辑", notes = "素材-编辑")
+    @PutMapping(value = "/batchEdit")
+    public Result<MaterialImageInfo> batchEdit(@RequestBody JSONArray updateArr) {
+        Result<MaterialImageInfo> result = new Result<MaterialImageInfo>();
+        try {
+            if (!Check.isNull(updateArr)) {
+                LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                        .getPrincipal();
+                for (int i = 0; i < updateArr.size(); i++) {
+                    JSONObject updateJson = updateArr.getJSONObject(i);
+                    if (!Check.isNull(updateJson)) {
+                        MaterialImageInfo materialImageInfo = new MaterialImageInfo();
+
+                        Long id = updateJson.getLong("id");
+                        materialImageInfo.setId(id);
+                        Integer status = updateJson.getInteger("status");
+                        materialImageInfo.setStatus(status);
+                        if (status == 2) {
+                            materialImageInfo.setRefuseReason(updateJson.getString("refuseReason"));
+                        }
+                        materialImageInfo.setAuditorId(user.getId());
+                        MaterialImageInfoService.updateById(materialImageInfo);
+                    }
+                }
+            }
+            result.success("修改成功!");
+            result.setSuccess(true);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            e.printStackTrace();
+
+        }
+
+        return result;
+    }
+
+
     /**
      * 通过id删除
      *

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialImageInfo.java

@@ -31,7 +31,7 @@ public class MaterialImageInfo {
      */
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-    private String id;
+    private Long id;
     /**
      * code
      */

+ 4 - 6
module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java

@@ -28,9 +28,9 @@ public class ExportExcelUtils {
      * @Description: 导出Excel的方法
      */
     public void exportExcelOld(XSSFWorkbook workbook, int sheetNum,
-                            String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {
-        System.out.println("!!!!!!!!!"+ XSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
-        System.out.println("!!!!!!!!!"+ HSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
+                               String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {
+        System.out.println("!!!!!!!!!" + XSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
+        System.out.println("!!!!!!!!!" + HSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
         // 生成一个表格
         XSSFSheet sheet = workbook.createSheet();
         workbook.setSheetName(sheetNum, sheetTitle);
@@ -40,7 +40,7 @@ public class ExportExcelUtils {
         XSSFCellStyle style = workbook.createCellStyle();
         // 设置这些样式
         style.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
-      //  style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+        //  style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
         style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
         style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
         style.setBorderRight(HSSFCellStyle.BORDER_THIN);
@@ -101,8 +101,6 @@ public class ExportExcelUtils {
 
     public void exportExcel(XSSFWorkbook workbook, int sheetNum,
                             String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {
-        System.out.println("!!!!!!!!!"+ XSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
-        System.out.println("!!!!!!!!!"+ HSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
         // 生成一个表格
         XSSFSheet sheet = workbook.createSheet();
         workbook.setSheetName(sheetNum, sheetTitle);