wangchangsheng 3 年之前
父节点
当前提交
a56d0b45f9

+ 5 - 0
src/main/java/com/gyee/viewticket/comm/domain/AjaxResult.java

@@ -1,5 +1,7 @@
 package com.gyee.viewticket.comm.domain;
 
+import com.alibaba.fastjson.annotation.JSONField;
+
 import java.util.HashMap;
 
 /**
@@ -16,6 +18,7 @@ public class AjaxResult extends HashMap<String, Object>
     /**
      * 初始化一个新创建的 Message 对象
      */
+
     public AjaxResult()
     {
     }
@@ -48,6 +51,7 @@ public class AjaxResult extends HashMap<String, Object>
      * @param msg 内容
      * @return 错误消息
      */
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
     public static AjaxResult error(int code, String msg)
     {
         AjaxResult json = new AjaxResult();
@@ -80,6 +84,7 @@ public class AjaxResult extends HashMap<String, Object>
         return AjaxResult.success("操作成功");
     }
 
+
     public static AjaxResult successData(Object value){
         AjaxResult json = new AjaxResult();
         json.put("code", 200);

+ 47 - 0
src/main/java/com/gyee/viewticket/config/MyWebAppConfigurer.java

@@ -0,0 +1,47 @@
+package com.gyee.viewticket.config;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * 拦截器
+* @ClassName: MyWebAppConfigurer
+* @author gyee
+* @date 2018年6月3日
+*
+ */
+@Configuration
+public class MyWebAppConfigurer implements WebMvcConfigurer {
+	
+	private static Logger logger= LoggerFactory.getLogger(WebMvcConfigurationSupport.class);
+
+	
+	
+	/** 解决跨域问题 **/
+	@Override
+	public void addCorsMappings(CorsRegistry registry){
+
+        registry.addMapping("/**")
+			// 设置允许跨域请求的域名
+			.allowedOrigins("*")
+			// 是否允许证书
+			.allowCredentials(true)
+			// 设置允许的方法
+			.allowedMethods("GET", "POST", "DELETE", "PUT")
+			// 设置允许的header属性
+			.allowedHeaders("*")
+				// 跨域允许时间
+			.maxAge(3600);
+			//super.addCorsMappings(registry);
+
+	}
+	
+
+	
+	
+	
+}

+ 1 - 1
src/main/java/com/gyee/viewticket/controller/viewticket/EquoperationrecordController.java

@@ -38,7 +38,7 @@ public class EquoperationrecordController {
      * @param type 类型
      * @return
      */
-    @CrossOrigin(origins = "*",maxAge = 3600)
+    //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "list")
     public AjaxResult getEquoperationrecordPageList(
             @RequestParam(value = "pagenum") Integer pageNum,

+ 1 - 1
src/main/java/com/gyee/viewticket/controller/viewticket/PolineController.java

@@ -37,7 +37,7 @@ public class PolineController {
      * @param ponum 采购单号
      * @return
      */
-    @CrossOrigin(origins = "*",maxAge = 3600)
+   // @CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "list")
     public AjaxResult getPolinePageList(
             @RequestParam(value = "pagenum") Integer pageNum,

+ 1 - 1
src/main/java/com/gyee/viewticket/controller/viewticket/WindturbineController.java

@@ -43,7 +43,7 @@ public class WindturbineController {
      * @param wtid 风机编号
      * @return
      */
-    @CrossOrigin(origins = "*",maxAge = 3600)
+    //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "list")
     public AjaxResult getWindturbineid(
             @RequestParam(value = "wtid",required = false)String wtid) {

+ 5 - 5
src/main/java/com/gyee/viewticket/controller/viewticket/WorkticketController.java

@@ -45,7 +45,7 @@ public class WorkticketController {
      * @param deptnum 风机编号
      * @return
      */
-    @CrossOrigin(origins = "*",maxAge = 3600)
+    //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "windlist")
     public AjaxResult getWindturbineid(@RequestParam("deptnum")String deptnum) {
         if ("".equals(deptnum.trim())){
@@ -59,7 +59,7 @@ public class WorkticketController {
      * 工作类型
      * @return
      */
-    @CrossOrigin(origins = "*",maxAge = 3600)
+    //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "list")
     public AjaxResult getWorkTypeList() {
         List<Map> list =workriskpoolService.getWorkriskpoolList();
@@ -72,7 +72,7 @@ public class WorkticketController {
      * @param deptnum 场站名称
      * @return
      */
-    @CrossOrigin(origins = "*",maxAge = 3600)
+    //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "getLaborList")
     public AjaxResult getLaborNameList(@RequestParam("deptnum")String deptnum) {
         List<Labor> labors = laborService.getLaborList(deptnum);
@@ -88,7 +88,7 @@ public class WorkticketController {
      * @param worktypeid 作业类型
      * @return
      */
-    @CrossOrigin(origins = "*",maxAge = 3600)
+    //@CrossOrigin(origins = "*",maxAge = 3600)
     @PostMapping(value = "addWindelec")
     public AjaxResult addWorkticket(@RequestParam("workdept")String workdept,
                                     @RequestParam("location")String location,
@@ -105,7 +105,7 @@ public class WorkticketController {
                 return AjaxResult.success();
             }
         }
-        return AjaxResult.error(4004, "数据操作失败");
+        return AjaxResult.error(500, "数据操作失败");
     }
 
 }

+ 0 - 6
src/main/java/com/gyee/viewticket/model/ticket/Windturbine.java

@@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
 import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -96,19 +94,15 @@ public class Windturbine extends Model<Windturbine> {
     private Double hubheight;
 
     @TableField("RELEASEDATE")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date releasedate;
 
     @TableField("INSTALLDATE")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date installdate;
 
     @TableField("TESTDATE")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date testdate;
 
     @TableField("OPDATE")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date opdate;
 
     @TableField("LOCATION")

+ 2 - 2
src/main/resources/application.yml

@@ -11,11 +11,11 @@ mybatis-plus:
 spring:
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
-    time-zone: GMT+8
+    time-zone: Asia/Shanghai
   datasource:
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
     type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:sqlserver://10.155.32.2:1433;DatabaseName=fdtest
+    url: jdbc:sqlserver://10.155.32.2:1433;DatabaseName=test
     username: sa
     password: Gyee@321#!
     maxActive: 20

+ 1 - 1
src/main/resources/mapper/ticket/WindturbineMapper.xml

@@ -60,7 +60,7 @@
     </select>
 
 
-    <select id="selectWindturbinePageList" resultType="java.util.HashMap">
+    <select id="selectWindturbinePageList" resultType="java.util.Map">
         SELECT
         w.wtnum,
         w.ownerwf,