Răsfoiți Sursa

谁是舞王

xiongzhu 7 ani în urmă
părinte
comite
91cb37ad7d

+ 6 - 1
src/main/java/com/thmodel/jooq/tables/Ads.java

@@ -41,7 +41,7 @@ import org.jooq.impl.TableImpl;
 @SuppressWarnings({ "all", "unchecked", "rawtypes" })
 public class Ads extends TableImpl<AdsRecord> {
 
-    private static final long serialVersionUID = 1715187154;
+    private static final long serialVersionUID = -800853821;
 
     /**
      * The reference instance of <code>thmodel.ads</code>
@@ -76,6 +76,11 @@ public class Ads extends TableImpl<AdsRecord> {
      */
     public final TableField<AdsRecord, String> NAME = createField("name", org.jooq.impl.SQLDataType.VARCHAR(255), this, "");
 
+    /**
+     * The column <code>thmodel.ads.detail</code>.
+     */
+    public final TableField<AdsRecord, String> DETAIL = createField("detail", org.jooq.impl.SQLDataType.CLOB, this, "");
+
     /**
      * Create a <code>thmodel.ads</code> table reference
      */

+ 60 - 11
src/main/java/com/thmodel/jooq/tables/records/AdsRecord.java

@@ -10,8 +10,8 @@ import javax.annotation.Generated;
 
 import org.jooq.Field;
 import org.jooq.Record1;
-import org.jooq.Record4;
-import org.jooq.Row4;
+import org.jooq.Record5;
+import org.jooq.Row5;
 import org.jooq.impl.UpdatableRecordImpl;
 
 
@@ -26,9 +26,9 @@ import org.jooq.impl.UpdatableRecordImpl;
     comments = "This class is generated by jOOQ"
 )
 @SuppressWarnings({ "all", "unchecked", "rawtypes" })
-public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4<Integer, String, Integer, String> {
+public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record5<Integer, String, Integer, String, String> {
 
-    private static final long serialVersionUID = -605133729;
+    private static final long serialVersionUID = -252379142;
 
     /**
      * Setter for <code>thmodel.ads.id</code>.
@@ -86,6 +86,20 @@ public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4
         return (String) get(3);
     }
 
+    /**
+     * Setter for <code>thmodel.ads.detail</code>.
+     */
+    public void setDetail(String value) {
+        set(4, value);
+    }
+
+    /**
+     * Getter for <code>thmodel.ads.detail</code>.
+     */
+    public String getDetail() {
+        return (String) get(4);
+    }
+
     // -------------------------------------------------------------------------
     // Primary key information
     // -------------------------------------------------------------------------
@@ -99,23 +113,23 @@ public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4
     }
 
     // -------------------------------------------------------------------------
-    // Record4 type implementation
+    // Record5 type implementation
     // -------------------------------------------------------------------------
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public Row4<Integer, String, Integer, String> fieldsRow() {
-        return (Row4) super.fieldsRow();
+    public Row5<Integer, String, Integer, String, String> fieldsRow() {
+        return (Row5) super.fieldsRow();
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public Row4<Integer, String, Integer, String> valuesRow() {
-        return (Row4) super.valuesRow();
+    public Row5<Integer, String, Integer, String, String> valuesRow() {
+        return (Row5) super.valuesRow();
     }
 
     /**
@@ -150,6 +164,14 @@ public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4
         return Ads.ADS.NAME;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Field<String> field5() {
+        return Ads.ADS.DETAIL;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -182,6 +204,14 @@ public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4
         return getName();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String component5() {
+        return getDetail();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -214,6 +244,14 @@ public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4
         return getName();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String value5() {
+        return getDetail();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -254,11 +292,21 @@ public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4
      * {@inheritDoc}
      */
     @Override
-    public AdsRecord values(Integer value1, String value2, Integer value3, String value4) {
+    public AdsRecord value5(String value) {
+        setDetail(value);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public AdsRecord values(Integer value1, String value2, Integer value3, String value4, String value5) {
         value1(value1);
         value2(value2);
         value3(value3);
         value4(value4);
+        value5(value5);
         return this;
     }
 
@@ -276,12 +324,13 @@ public class AdsRecord extends UpdatableRecordImpl<AdsRecord> implements Record4
     /**
      * Create a detached, initialised AdsRecord
      */
-    public AdsRecord(Integer id, String pic, Integer parttypk, String name) {
+    public AdsRecord(Integer id, String pic, Integer parttypk, String name, String detail) {
         super(Ads.ADS);
 
         set(0, id);
         set(1, pic);
         set(2, parttypk);
         set(3, name);
+        set(4, detail);
     }
 }

+ 57 - 52
src/main/java/com/thmodel/servlet/ActivityServlet.java

@@ -153,63 +153,68 @@ public class ActivityServlet extends HttpServlet {
                 String desc = CommentUtils.myToString(request.getParameter("desc"));
                 String pic = null, video = null;
 
-                DiskFileItemFactory factory = new DiskFileItemFactory();
-                ServletFileUpload sfu = new ServletFileUpload(factory);
-                List items = sfu.parseRequest(request);// 从request得到所有上传域的列表
-                for (Iterator iter = items.iterator(); iter.hasNext(); ) {
-                    FileItem fileitem = (FileItem) iter.next();
-                    if (!fileitem.isFormField()) {
-                        String rootPath = request.getRealPath("/");
-                        String relativePath;
-                        String fileName;
-                        if (fileitem.getContentType().contains("video")) {
-                            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-                            relativePath = "upload/video/" + sdf.format(new Date()) + "/";
-                            File file = new File(rootPath + relativePath);
-                            if (!file.exists()) {
-                                file.mkdirs();
-                            }
-                            String uuid = MD5Util.MD5(UUID.randomUUID().toString() + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString());
-                            fileName = uuid + ".mov";
-
-                            InputStream fin = fileitem.getInputStream();
-                            FileOutputStream fout = new FileOutputStream(rootPath + relativePath + fileName);
-                            byte[] b = new byte[1024];
-                            int length = 0;
-                            while ((length = fin.read(b)) > 0) {
-                                fout.write(b, 0, length);
-                            }
-                            fin.close();
-                            fout.close();
-                            video = relativePath + fileName;
-                            System.out.println("file:" + relativePath + fileName);
-                        } else if (fileitem.getContentType().contains("image")) {
-                            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-                            relativePath = "upload/photo/" + sdf.format(new Date()) + "/";
-                            File file = new File(rootPath + relativePath);
-                            if (!file.exists()) {
-                                file.mkdirs();
-                            }
-                            String uuid = MD5Util.MD5(UUID.randomUUID().toString() + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString());
-                            fileName = uuid + ".jpg";
-
-                            InputStream fin = fileitem.getInputStream();
-                            FileOutputStream fout = new FileOutputStream(rootPath + relativePath + fileName);
-                            byte[] b = new byte[1024];
-                            int length = 0;
-                            while ((length = fin.read(b)) > 0) {
-                                fout.write(b, 0, length);
+                try {
+                    DiskFileItemFactory factory = new DiskFileItemFactory();
+                    ServletFileUpload sfu = new ServletFileUpload(factory);
+                    List items = sfu.parseRequest(request);// 从request得到所有上传域的列表
+                    for (Iterator iter = items.iterator(); iter.hasNext(); ) {
+                        FileItem fileitem = (FileItem) iter.next();
+                        if (!fileitem.isFormField()) {
+                            String rootPath = request.getRealPath("/");
+                            String relativePath;
+                            String fileName;
+                            if (fileitem.getContentType().contains("video")) {
+                                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+                                relativePath = "upload/video/" + sdf.format(new Date()) + "/";
+                                File file = new File(rootPath + relativePath);
+                                if (!file.exists()) {
+                                    file.mkdirs();
+                                }
+                                String uuid = MD5Util.MD5(UUID.randomUUID().toString() + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString());
+                                fileName = uuid + ".mov";
+
+                                InputStream fin = fileitem.getInputStream();
+                                FileOutputStream fout = new FileOutputStream(rootPath + relativePath + fileName);
+                                byte[] b = new byte[1024];
+                                int length = 0;
+                                while ((length = fin.read(b)) > 0) {
+                                    fout.write(b, 0, length);
+                                }
+                                fin.close();
+                                fout.close();
+                                video = relativePath + fileName;
+                                System.out.println("file:" + relativePath + fileName);
+                            } else if (fileitem.getContentType().contains("image")) {
+                                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+                                relativePath = "upload/photo/" + sdf.format(new Date()) + "/";
+                                File file = new File(rootPath + relativePath);
+                                if (!file.exists()) {
+                                    file.mkdirs();
+                                }
+                                String uuid = MD5Util.MD5(UUID.randomUUID().toString() + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString());
+                                fileName = uuid + ".jpg";
+
+                                InputStream fin = fileitem.getInputStream();
+                                FileOutputStream fout = new FileOutputStream(rootPath + relativePath + fileName);
+                                byte[] b = new byte[1024];
+                                int length = 0;
+                                while ((length = fin.read(b)) > 0) {
+                                    fout.write(b, 0, length);
+                                }
+                                fin.close();
+                                fout.close();
+                                pic = relativePath + fileName;
+                                System.out.println("file:" + relativePath + fileName);
+                            } else {
+                                break;
                             }
-                            fin.close();
-                            fout.close();
-                            pic = relativePath + fileName;
-                            System.out.println("file:" + relativePath + fileName);
-                        } else {
-                            break;
                         }
                     }
+                } catch (Exception e) {
+
                 }
 
+
                 Map<String, Object> map = activityService.enroll(pk, parttyPk, people, tel, pCount, fee, pic, video, desc);
                 int code = (int) map.get("result");