Browse Source

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu.git

Reiskuchen 5 years ago
parent
commit
0c8c82a4ff
41 changed files with 1690 additions and 204 deletions
  1. 10 8
      cloud-model/src/main/java/com/hssx/cloudmodel/controller/CompanyController.java
  2. 21 0
      cloud-model/src/main/java/com/hssx/cloudmodel/controller/LngLatCompanyController.java
  3. 0 4
      cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldController.java
  4. 22 0
      cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeController.java
  5. 50 0
      cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeUserController.java
  6. 110 0
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/LngLatCompany.java
  7. 218 0
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNotice.java
  8. 94 0
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNoticeUser.java
  9. 27 0
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/CompanyVO.java
  10. 15 6
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/MouldEquipmentVO.java
  11. 30 0
      cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/NewsNoticeVO.java
  12. 3 1
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/CompanyMapper.java
  13. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/LngLatCompanyMapper.java
  14. 1 1
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/MouldEquipmentMapper.java
  15. 24 0
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeMapper.java
  16. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeUserMapper.java
  17. 3 2
      cloud-model/src/main/java/com/hssx/cloudmodel/service/CompanyService.java
  18. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/LngLatCompanyService.java
  19. 19 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeService.java
  20. 16 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeUserService.java
  21. 68 22
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java
  22. 20 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/LngLatCompanyServiceImpl.java
  23. 3 3
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java
  24. 128 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldServiceImpl.java
  25. 58 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeServiceImpl.java
  26. 20 0
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeUserServiceImpl.java
  27. 2 4
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/UserServiceImpl.java
  28. 1 1
      cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java
  29. 306 0
      cloud-model/src/main/java/com/hssx/cloudmodel/util/HttpKit.java
  30. 23 0
      cloud-model/src/main/java/com/hssx/cloudmodel/util/NewsNoticeTemplate.java
  31. 31 2
      cloud-model/src/main/resources/mapper/CompanyMapper.xml
  32. 19 0
      cloud-model/src/main/resources/mapper/LngLatCompanyMapper.xml
  33. 6 1
      cloud-model/src/main/resources/mapper/MouldEquipmentMapper.xml
  34. 81 0
      cloud-model/src/main/resources/mapper/NewsNoticeMapper.xml
  35. 18 0
      cloud-model/src/main/resources/mapper/NewsNoticeUserMapper.xml
  36. BIN
      ys_vue/src/assets/image/login_logo.png
  37. 2 2
      ys_vue/src/main.js
  38. 3 3
      ys_vue/src/routes.js
  39. 1 1
      ys_vue/src/views/Login.vue
  40. 29 28
      ys_vue/src/views/base/comp.vue
  41. 160 115
      ys_vue/src/views/base/factory.vue

+ 10 - 8
cloud-model/src/main/java/com/hssx/cloudmodel/controller/CompanyController.java

@@ -4,6 +4,7 @@ package com.hssx.cloudmodel.controller;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.cloudmodel.entity.Company;
 import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.CompanyVO;
 import com.hssx.cloudmodel.service.CompanyService;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.PageUtil;
@@ -35,17 +36,18 @@ public class CompanyController {
     /**
      * 添加/修改公司
      *
-     * @param company 参数:companyName 公司名 companyAddress 公司地址 companyType 公司类型 0-资产方 1-客户
-     * @param flag    0-添加,1-修改
+     * 参数:companyName 公司名 companyAddress 公司地址
+     * companyType公司类型 0-资产方 1-生产方(yLng 经度  xLat 纬度)
+     * flag   0-添加,1-修改
      * @return
      */
     @ApiOperation("添加/修改公司")
     @RequestMapping("/add")
     @ResponseBody
-    public HttpRespMsg addAndUpdateRole(Company company, HttpServletRequest request, Integer flag,
+    public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, HttpServletRequest request, Integer flag,
                                         HttpServletResponse response) {
         HttpRespMsg msg = new HttpRespMsg();
-        msg = companyService.addAndUpdateRole(company, flag);
+        msg = companyService.addAndUpdateRole(companyVO, flag);
         return msg;
     }
 
@@ -61,22 +63,22 @@ public class CompanyController {
     public HttpRespMsg delete(Company company, HttpServletRequest request,
                               HttpServletResponse response) {
         HttpRespMsg msg = new HttpRespMsg();
-        msg.data = companyService.deleteById(company.getId());
+        msg = companyService.deleteById(company.getId());
         return msg;
     }
 
     /**
      * 公司列表
-     * 参数:pageNum 当前页码,pageSize 每页条数 keyName 关键字查询
+     * 参数:pageNum 当前页码,pageSize 每页条数 keyName 关键字查询,companyType 公司类型 0-资产方 1-生产方
      * @return
      */
     @ApiOperation("公司列表")
     @RequestMapping("/list")
     @ResponseBody
     public HttpRespMsg deleteRole(@RequestParam(required = false)String keyName, HttpServletRequest request,
-                                  HttpServletResponse response, PageUtil page) {
+                                  HttpServletResponse response, PageUtil page,@RequestParam(required = false)Integer companyType) {
         HttpRespMsg msg = new HttpRespMsg();
-        msg = companyService.pageList(page,keyName);
+        msg = companyService.pageList(page,keyName,companyType);
         return msg;
     }
 

+ 21 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/LngLatCompanyController.java

@@ -0,0 +1,21 @@
+package com.hssx.cloudmodel.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@RestController
+@RequestMapping("/lnglatcompany")
+public class LngLatCompanyController {
+
+}
+

+ 0 - 4
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldController.java

@@ -95,9 +95,5 @@ public class MouldController {
         HttpRespMsg msg = mouldService.getMoildDetail(mouldVO);
         return msg;
     }
-
-
-
-
 }
 

+ 22 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeController.java

@@ -0,0 +1,22 @@
+package com.hssx.cloudmodel.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@RestController
+@RequestMapping("/newsnotice")
+public class NewsNoticeController {
+
+
+}
+

+ 50 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/NewsNoticeUserController.java

@@ -0,0 +1,50 @@
+package com.hssx.cloudmodel.controller;
+
+
+import com.hssx.cloudmodel.entity.NewsNotice;
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.hssx.cloudmodel.entity.vo.NewsNoticeVO;
+import com.hssx.cloudmodel.service.NewsNoticeService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import com.hssx.cloudmodel.util.PageUtil;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@Controller
+@RequestMapping("/newsnoticeuser")
+public class NewsNoticeUserController {
+    @Autowired
+    private NewsNoticeService newsNoticeService;
+
+    /**
+     * 消息通知列表
+     * 默认显示五条的参数:token 登陆者的用户凭证,flag = 0,(默认显示最近五条)
+     * 查看全部时传的参数:token 登陆者的用户凭证,flag = 0,pageNum 当前页码,pageSize 每页条数,
+     * (筛选字段:notice_type 0-审批,1-告警,2-保养)(默认不传)
+     * @return
+     */
+    @ApiOperation("消息通知列表")
+    @RequestMapping("/list")
+    @ResponseBody
+    public HttpRespMsg deleteRole(NewsNotice newsNotice, HttpServletRequest request,String token,
+                                  HttpServletResponse response, PageUtil page,Integer flag) {
+        HttpRespMsg msg = new HttpRespMsg();
+        msg = newsNoticeService.pageList(newsNotice,page,flag,token);
+        return msg;
+    }
+
+}
+

+ 110 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/LngLatCompany.java

@@ -0,0 +1,110 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@TableName("tb_lng_lat_company")
+public class LngLatCompany extends Model<LngLatCompany> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 公司经纬度表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 经度
+     */
+    @TableField("y_lng")
+    private String yLng;
+
+    /**
+     * 纬度
+     */
+    @TableField("x_lat")
+    private String xLat;
+
+    /**
+     * 创建时间
+     */
+    @TableField("indate")
+    private LocalDateTime indate;
+
+    /**
+     * 所属生产方公司id
+     */
+    @TableField("company_id")
+    private Integer companyId;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getyLng() {
+        return yLng;
+    }
+
+    public void setyLng(String yLng) {
+        this.yLng = yLng;
+    }
+
+    public String getxLat() {
+        return xLat;
+    }
+
+    public void setxLat(String xLat) {
+        this.xLat = xLat;
+    }
+
+    public LocalDateTime getIndate() {
+        return indate;
+    }
+
+    public void setIndate(LocalDateTime indate) {
+        this.indate = indate;
+    }
+
+    public Integer getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Integer companyId) {
+        this.companyId = companyId;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "LngLatCompany{" +
+        "id=" + id +
+        ", yLng=" + yLng +
+        ", xLat=" + xLat +
+        ", indate=" + indate +
+        ", companyId=" + companyId +
+        "}";
+    }
+}

+ 218 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNotice.java

@@ -0,0 +1,218 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@TableName("tb_news_notice")
+public class NewsNotice extends Model<NewsNotice> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 消息盒子表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 项目id
+     */
+    @TableField("project_id")
+    private Integer projectId;
+
+    /**
+     * 项目名
+     */
+    @TableField("project_name")
+    private String projectName;
+
+    /**
+     * 模具id(针对消息提醒类型1,2)
+     */
+    @TableField("mould_id")
+    private Integer mouldId;
+
+    /**
+     * 消息提醒类型0-审批,1-保养,2-告警
+     */
+    @TableField("notice_type")
+    private Integer noticeType;
+
+    /**
+     * 内容
+     */
+    @TableField("content")
+    private String content;
+
+    /**
+     * 模具编号(针对消息提醒类型1)
+     */
+    @TableField("mould_no")
+    private String mouldNo;
+
+    /**
+     * 文件id
+     */
+    @TableField("file_id")
+    private Integer fileId;
+
+    /**
+     * 文件所属类型
+     */
+    @TableField("file_blong_type")
+    private Integer fileBlongType;
+
+    /**
+     * 设备id(针对消息提醒类型2)
+     */
+    @TableField("equipment_id")
+    private Integer equipmentId;
+
+    /**
+     * 设备编号(针对消息提醒类型2)
+     */
+    @TableField("equipment_no")
+    private String equipmentNo;
+
+    /**
+     * 时间
+     */
+    @TableField("indate")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime indate;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(Integer projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public Integer getMouldId() {
+        return mouldId;
+    }
+
+    public void setMouldId(Integer mouldId) {
+        this.mouldId = mouldId;
+    }
+
+    public Integer getNoticeType() {
+        return noticeType;
+    }
+
+    public void setNoticeType(Integer noticeType) {
+        this.noticeType = noticeType;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getMouldNo() {
+        return mouldNo;
+    }
+
+    public void setMouldNo(String mouldNo) {
+        this.mouldNo = mouldNo;
+    }
+
+    public Integer getFileId() {
+        return fileId;
+    }
+
+    public void setFileId(Integer fileId) {
+        this.fileId = fileId;
+    }
+
+    public Integer getFileBlongType() {
+        return fileBlongType;
+    }
+
+    public void setFileBlongType(Integer fileBlongType) {
+        this.fileBlongType = fileBlongType;
+    }
+
+    public Integer getEquipmentId() {
+        return equipmentId;
+    }
+
+    public void setEquipmentId(Integer equipmentId) {
+        this.equipmentId = equipmentId;
+    }
+
+    public String getEquipmentNo() {
+        return equipmentNo;
+    }
+
+    public void setEquipmentNo(String equipmentNo) {
+        this.equipmentNo = equipmentNo;
+    }
+
+    public LocalDateTime getIndate() {
+        return indate;
+    }
+
+    public void setIndate(LocalDateTime indate) {
+        this.indate = indate;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "NewsNotice{" +
+        "id=" + id +
+        ", projectId=" + projectId +
+        ", projectName=" + projectName +
+        ", mouldId=" + mouldId +
+        ", noticeType=" + noticeType +
+        ", content=" + content +
+        ", mouldNo=" + mouldNo +
+        ", fileId=" + fileId +
+        ", fileBlongType=" + fileBlongType +
+        ", equipmentId=" + equipmentId +
+        ", equipmentNo=" + equipmentNo +
+        ", indate=" + indate +
+        "}";
+    }
+}

+ 94 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/NewsNoticeUser.java

@@ -0,0 +1,94 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@TableName("tb_news_notice_user")
+public class NewsNoticeUser extends Model<NewsNoticeUser> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 消息通知者表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 通知者id
+     */
+    @TableField("user_id")
+    private Integer userId;
+
+    /**
+     * 是否已读 0-未读,1-已读
+     */
+    @TableField("is_read")
+    private Integer isRead;
+
+    /**
+     * 消息通知表id
+     */
+    @TableField("news_id")
+    private Integer newsId;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getIsRead() {
+        return isRead;
+    }
+
+    public void setIsRead(Integer isRead) {
+        this.isRead = isRead;
+    }
+
+    public Integer getNewsId() {
+        return newsId;
+    }
+
+    public void setNewsId(Integer newsId) {
+        this.newsId = newsId;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "NewsNoticeUser{" +
+        "id=" + id +
+        ", userId=" + userId +
+        ", isRead=" + isRead +
+        ", newsId=" + newsId +
+        "}";
+    }
+}

+ 27 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/CompanyVO.java

@@ -0,0 +1,27 @@
+package com.hssx.cloudmodel.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.hssx.cloudmodel.entity.Company;
+import com.hssx.cloudmodel.entity.Factory;
+import lombok.Data;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 09 13:44
+ * Description:<描述>
+ * Version: 1.0
+ */
+@Data
+public class CompanyVO extends Company{
+        /**
+         * 经度
+         */
+        @TableField("y_lng")
+        private String yLng;
+
+        /**
+         * 纬度
+         */
+        @TableField("x_lat")
+        private String xLat;
+}

+ 15 - 6
cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/MouldEquipmentVO.java

@@ -1,6 +1,8 @@
 package com.hssx.cloudmodel.entity.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.hssx.cloudmodel.entity.MouldEquipment;
+import lombok.Data;
 
 /**
  * Author: 吴涛涛 cuiyi@itany.com
@@ -8,14 +10,21 @@ import com.hssx.cloudmodel.entity.MouldEquipment;
  * Description:<描述>
  * Version: 1.0
  */
+@Data
 public class MouldEquipmentVO extends MouldEquipment {
     private String companyName;
+    private String  emergencyType;//告警类型
+    private String emergencyContent;//告警内容
+    private String area;//所在科室
+    private String planType;//计划类型
+    /**
+     * 模具编号
+     */
+    private String modelNo;
 
-    public String getCompanyName() {
-        return companyName;
-    }
+    /**
+     * 模具名称
+     */
+    private String modelName;
 
-    public void setCompanyName(String companyName) {
-        this.companyName = companyName;
-    }
 }

+ 30 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/NewsNoticeVO.java

@@ -0,0 +1,30 @@
+package com.hssx.cloudmodel.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.hssx.cloudmodel.entity.NewsNotice;
+import lombok.Data;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 10 9:12
+ * Description:<描述>
+ * Version: 1.0
+ */
+@Data
+public class NewsNoticeVO extends NewsNotice {
+    /**
+     * 通知者id
+     */
+    private Integer userId;
+
+    /**
+     * 是否已读 0-未读,1-已读
+     */
+    private Integer isRead;
+
+    /**
+     * 消息通知表id
+     */
+    private Integer newsId;
+
+}

+ 3 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/CompanyMapper.java

@@ -3,6 +3,7 @@ package com.hssx.cloudmodel.mapper;
 import com.hssx.cloudmodel.entity.Company;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.CompanyVO;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -17,6 +18,7 @@ import java.util.List;
  */
 public interface CompanyMapper extends BaseMapper<Company> {
 
-    List<Company> getListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize);
+    List<CompanyVO> getListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize, @Param("companyType")Integer companyType);
 
+    List<CompanyVO> getCustomerListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize, @Param("companyType")Integer companyType);
 }

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/LngLatCompanyMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.mapper;
+
+import com.hssx.cloudmodel.entity.LngLatCompany;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface LngLatCompanyMapper extends BaseMapper<LngLatCompany> {
+
+}

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/MouldEquipmentMapper.java

@@ -20,5 +20,5 @@ public interface MouldEquipmentMapper extends BaseMapper<MouldEquipment> {
 
     List<MouldEquipmentVO> getListByCompanyId(@Param("belongCompanyId") Integer belongCompanyId,@Param("list") List<Integer> ides);
 
-    List<MouldEquipment> getList();
+    List<MouldEquipmentVO> getList();
 }

+ 24 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeMapper.java

@@ -0,0 +1,24 @@
+package com.hssx.cloudmodel.mapper;
+
+import com.hssx.cloudmodel.entity.NewsNotice;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.NewsNoticeVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeMapper extends BaseMapper<NewsNotice> {
+
+    List<NewsNoticeVO> selectNewestFiveUnreadNewsByUserId(@Param("user") User user);
+
+    List<NewsNoticeVO> selectAllUnreadNewsByUserId(@Param("user")User user, @Param("newsNotice")NewsNotice newsNotice);
+}

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/NewsNoticeUserMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.mapper;
+
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeUserMapper extends BaseMapper<NewsNoticeUser> {
+
+}

+ 3 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/service/CompanyService.java

@@ -3,6 +3,7 @@ package com.hssx.cloudmodel.service;
 import com.hssx.cloudmodel.entity.Company;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.CompanyVO;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.PageUtil;
 
@@ -18,9 +19,9 @@ import java.util.List;
  */
 public interface CompanyService extends IService<Company> {
 
-    HttpRespMsg addAndUpdateRole(Company company, Integer flag);
+    HttpRespMsg addAndUpdateRole(CompanyVO company, Integer flag);
 
-    HttpRespMsg pageList(PageUtil page, String keyName);
+    HttpRespMsg pageList(PageUtil page, String keyName,Integer companyType);
 
     List<Company> getIdAndNamelist(User user);
 

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/LngLatCompanyService.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.LngLatCompany;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface LngLatCompanyService extends IService<LngLatCompany> {
+
+}

+ 19 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeService.java

@@ -0,0 +1,19 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.NewsNotice;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import com.hssx.cloudmodel.util.PageUtil;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeService extends IService<NewsNotice> {
+
+    HttpRespMsg pageList(NewsNotice newsNotice,PageUtil page,Integer flag,String token);
+}

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/NewsNoticeUserService.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+public interface NewsNoticeUserService extends IService<NewsNoticeUser> {
+
+}

+ 68 - 22
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java

@@ -3,22 +3,28 @@ package com.hssx.cloudmodel.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.cloudmodel.constant.Constant;
 import com.hssx.cloudmodel.entity.Company;
+import com.hssx.cloudmodel.entity.Factory;
+import com.hssx.cloudmodel.entity.LngLatCompany;
 import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.CompanyVO;
 import com.hssx.cloudmodel.mapper.CompanyMapper;
+import com.hssx.cloudmodel.mapper.LngLatCompanyMapper;
 import com.hssx.cloudmodel.mapper.UserMapper;
 import com.hssx.cloudmodel.service.CompanyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.PageUtil;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author 吴涛涛
@@ -30,39 +36,78 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     CompanyMapper companyMapper;
     @Resource
     UserMapper userMapper;
+    @Resource
+    LngLatCompanyMapper lngLatCompanyMapper;
 
     @Override
-    public HttpRespMsg addAndUpdateRole(Company company, Integer flag) {
+    public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, Integer flag) {
         HttpRespMsg msg = new HttpRespMsg();
+        Company company = new Company();
         if (flag == 0) {
             //添加公司
             QueryWrapper<Company> qw = new QueryWrapper<>();
-            qw.eq("company_name", company.getCompanyName());
+            qw.eq("company_name", companyVO.getCompanyName());
             int count = companyMapper.selectCount(qw);
             if (count > 0) {
                 msg.setError("公司已存在,请勿重复添加");
             } else {
-                companyMapper.insert(company);
+                if (companyVO.getCompanyType() == 0) {
+                    //资产方直接添加
+                    BeanUtils.copyProperties(companyVO,company);
+                    companyMapper.insert(company);
+                }else if (companyVO.getCompanyType() == 1){
+                    //生产方
+                    BeanUtils.copyProperties(companyVO,company);
+                    companyMapper.insert(company);
+                    LngLatCompany factory = new LngLatCompany();
+                    factory.setxLat(companyVO.getXLat());
+                    factory.setyLng(companyVO.getYLng());
+                    factory.setCompanyId(company.getId());
+                    lngLatCompanyMapper.insert(factory);
+                }
             }
         } else if (flag == 1) {
             //更新公司信息
-            companyMapper.updateById(company);
+            BeanUtils.copyProperties(companyVO,company);
+            if (companyVO.getCompanyType() == 0) {
+                //修改资产方
+                BeanUtils.copyProperties(companyVO,company);
+                companyMapper.updateById(company);
+            }else if (companyVO.getCompanyType() == 1){
+                //生产方
+                BeanUtils.copyProperties(companyVO,company);
+                companyMapper.updateById(company);
+                QueryWrapper<LngLatCompany> qw = new QueryWrapper<>();
+                qw.eq("company_id",companyVO.getId());
+                LngLatCompany lngLatCompany = lngLatCompanyMapper.selectOne(qw);
+                LngLatCompany factory = new LngLatCompany();
+                factory.setxLat(companyVO.getXLat());
+                factory.setyLng(companyVO.getYLng());
+                factory.setCompanyId(company.getId());
+                factory.setId(lngLatCompany.getId());
+                lngLatCompanyMapper.updateById(factory);
+            }
         }
         return msg;
     }
 
     @Override
-    public HttpRespMsg pageList(PageUtil page, String keyName) {
+    public HttpRespMsg pageList(PageUtil page, String keyName,Integer companyType) {
         HttpRespMsg msg = new HttpRespMsg();
-        QueryWrapper<Company> qw = new QueryWrapper<>();
-        if(keyName !=null && !"".equals(keyName)){
-            qw.like("company_name", keyName);
+        List<CompanyVO> list = new ArrayList<>();
+        System.out.println(page);
+        Integer start = (page.getPageNum() - 1) * page.getPageSize();
+        if(companyType == 0){
+            list = companyMapper.getListByKeyName(keyName, start, page.getPageSize(),companyType);
+            Integer count = list.size();
+            page.setTotal(count);
+            page.setPages(page.getTotal());
+        }else{
+            list = companyMapper.getCustomerListByKeyName(keyName, start, page.getPageSize(),companyType);
+            Integer count = list.size();
+            page.setTotal(count);
+            page.setPages(page.getTotal());
         }
-        Integer start = (page.getPageNum()-1)*page.getPageSize();
-        Integer count = companyMapper.selectCount(qw);
-        page.setTotal(count);
-        page.setPages(page.getTotal());
-        List<Company> list = companyMapper.getListByKeyName(keyName, start, page.getPageSize());
         page.setList(list);
         msg.data = page;
         return msg;
@@ -71,18 +116,18 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     @Override
     public List<Company> getIdAndNamelist(User user) {
         QueryWrapper<Company> qw = new QueryWrapper<>();
-        qw.select("id","company_name","company_type");
-        if(Constant.SYS_ID == user.getParentId()){
+        qw.select("id", "company_name", "company_type");
+        if (Constant.SYS_ID == user.getParentId()) {
             //此时是admin创建用户,返回可选的生产方公司,查询出当前admin的信息并获取他的公司id
             User admin = userMapper.selectOne(new QueryWrapper<User>().eq("id", user.getId()));
-            qw.eq("company_type",Constant.PRODUCER_COMPANY).or().eq("id",admin.getCompanyId());
-        }else if(Constant.SYS_PARENT_ID == user.getParentId()){
+            qw.eq("company_type", Constant.PRODUCER_COMPANY).or().eq("id", admin.getCompanyId());
+        } else if (Constant.SYS_PARENT_ID == user.getParentId()) {
             //系统管理员创建admin,返回资产方公司
-            qw.eq("company_type",Constant.ASSETS_COMPANY);
-        }else{
+            qw.eq("company_type", Constant.ASSETS_COMPANY);
+        } else {
             //此时是项目经理创建其他用户
             User admin = userMapper.selectOne(new QueryWrapper<User>().eq("id", user.getParentId()));
-            qw.eq("company_type",Constant.PRODUCER_COMPANY).or().eq("id",admin.getCompanyId());
+            qw.eq("company_type", Constant.PRODUCER_COMPANY).or().eq("id", admin.getCompanyId());
         }
         return companyMapper.selectList(qw);
     }
@@ -90,7 +135,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     @Override
     public List<Company> addCompanyListToProject(User user) {
         QueryWrapper<Company> qw = new QueryWrapper<>();
-        qw.eq("company_type",Constant.PRODUCER_COMPANY);
+        qw.eq("company_type", Constant.PRODUCER_COMPANY);
         return companyMapper.selectList(qw);
     }
 
@@ -100,6 +145,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
         Integer count = userMapper.selectCount(new QueryWrapper<User>().eq("company_id", id));
         if (count > 0) {
             msg.setError("该公司已被应用到用户中,暂不提供删除操作");
+            return msg;
         } else {
             companyMapper.deleteById(id);
         }

+ 20 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/LngLatCompanyServiceImpl.java

@@ -0,0 +1,20 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.hssx.cloudmodel.entity.LngLatCompany;
+import com.hssx.cloudmodel.mapper.LngLatCompanyMapper;
+import com.hssx.cloudmodel.service.LngLatCompanyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@Service
+public class LngLatCompanyServiceImpl extends ServiceImpl<LngLatCompanyMapper, LngLatCompany> implements LngLatCompanyService {
+
+}

+ 3 - 3
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -45,7 +45,7 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
             if (mouldEquipment.getId() == null) {
                 //添加设备
                 //查询当前设备编号的模具是否存在
-                Integer count = mouldMapper.selectCount(new QueryWrapper<Mould>().eq("equipment_no", mouldEquipment.getEquipmentNo()));
+                Integer count = mouldEquipmentMapper.selectCount(new QueryWrapper<MouldEquipment>().eq("equipment_no", mouldEquipment.getEquipmentNo()));
                 if (count > 0) {
                     msg.setError("当前设备编号已存在,请重新输入其他模具编号");
                 } else {
@@ -90,8 +90,8 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
         if (user != null) {
             if (Constant.SYS_PARENT_ID == user.getParentId()) {
                 PageHelper.startPage(page.getPageNum(), page.getPageSize());
-                List<MouldEquipment> mouldEquipments = mouldEquipmentMapper.getList();
-                PageInfo<MouldEquipment> pageInfo = new PageInfo<>(mouldEquipments);
+                List<MouldEquipmentVO> mouldEquipments = mouldEquipmentMapper.getList();
+                PageInfo<MouldEquipmentVO> pageInfo = new PageInfo<>(mouldEquipments);
                 msg.data = pageInfo;
             } else {
                 msg.setError("对不起!您不含有查看该列表的权利。");

+ 128 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldServiceImpl.java

@@ -1,18 +1,34 @@
 package com.hssx.cloudmodel.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.cloudmodel.entity.Mould;
+import com.hssx.cloudmodel.entity.MouldEquipment;
 import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.MouldEquipmentVO;
 import com.hssx.cloudmodel.entity.vo.MouldVO;
 import com.hssx.cloudmodel.mapper.MouldMapper;
 import com.hssx.cloudmodel.service.MouldService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.cloudmodel.util.HttpKit;
 import com.hssx.cloudmodel.util.HttpRespMsg;
+import com.hssx.cloudmodel.util.WechatTemplateMessage;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringEscapeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -23,6 +39,7 @@ import java.util.List;
  * @since 2019-07-30
  */
 @Service
+@Slf4j
 public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements MouldService {
     @Resource
     MouldMapper mouldMapper;
@@ -57,4 +74,115 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
         msg.data = mouldMapper.getDetailById(mouldVO);
         return msg;
     }
+
+    //告警模板推送通用接口
+    /**
+     * templateId 模板id,touserOpenId 被推送者的openId,appId微信公众号的appId
+     * firstData 推送标题
+     */
+    public HttpRespMsg sendEmergencyTemplateMessage(String templateId, String touserOpenId, String appId,String secret, MouldEquipmentVO mouldEquipmentVO)throws Exception{
+        HttpRespMsg msg = new HttpRespMsg();
+        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
+                + appId + "&secret=" + secret;
+        String resp;
+        String resp1;
+        resp1 = HttpKit.get(url, true);
+        resp1 = StringEscapeUtils.unescapeJava(resp1);
+        JSONObject json = (JSONObject) JSON.parse(resp1);
+        // 获取值赋值给全局变量
+        if (!json.containsKey("errcode")) {
+            String newAccessToken = json.getString("access_token");
+            String url1 = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
+                    + newAccessToken;
+            WechatTemplateMessage wechat = new WechatTemplateMessage();
+            wechat.setTemplate_id(templateId);
+            wechat.setTouser(touserOpenId);
+            wechat.setAppid(appId);
+            Map<String, Map<String, String>> data = new HashMap<>();
+            Map<String, String> first = new HashMap<>();
+            Map<String, String> value1 = new HashMap<>();
+            Map<String, String> value2 = new HashMap<>();
+            Map<String, String> value3 = new HashMap<>();
+            Map<String, String> value4 = new HashMap<>();
+            Map<String, String> remark = new HashMap<>();
+            // 推送信息主体
+            first.put("value", "告警通知");//firstData推送标题
+            data.put("first", first);
+            value1.put("value", mouldEquipmentVO.getEquipmentName());
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            data.put("keyword1", value1);
+            value2.put("value", mouldEquipmentVO.getEmergencyType());
+            data.put("keyword2", value2);
+            value3.put("value", sdf.format(new Date()));
+            data.put("keyword3", value3);
+            value4.put("value", mouldEquipmentVO.getEmergencyContent());
+            data.put("keyword4", value4);
+            remark.put("value", "请尽快检查该设备");
+            data.put("remark", remark);
+            wechat.setData(data);
+            String jsonString = JSONObject.toJSONString(wechat);
+            // System.out.println("jsonString"+jsonString);
+            resp = HttpKit.post(url1, jsonString);
+            // System.out.println("resp0"+resp);
+            resp = StringEscapeUtils.unescapeJava(resp);
+            // System.out.println("resp"+resp);
+            json = (JSONObject) JSON.parse(resp);
+        }
+        return msg;
+    }
+    //保养
+    /**
+     * templateId 模板id,touserOpenId 被推送者的openId,appId微信公众号的appId
+     * firstData 推送标题
+     */
+    public HttpRespMsg sendMaintainTemplateMessage(String templateId, String touserOpenId, String appId,String secret, MouldEquipmentVO mouldEquipmentVO) throws Exception{
+        HttpRespMsg msg = new HttpRespMsg();
+        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
+                + appId + "&secret=" + secret;
+        String resp;
+        String resp1;
+        resp1 = HttpKit.get(url, true);
+        resp1 = StringEscapeUtils.unescapeJava(resp1);
+        JSONObject json = (JSONObject) JSON.parse(resp1);
+        // 获取值赋值给全局变量
+        if (!json.containsKey("errcode")) {
+            String newAccessToken = json.getString("access_token");
+            String url1 = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="
+                    + newAccessToken;
+            WechatTemplateMessage wechat = new WechatTemplateMessage();
+            wechat.setTemplate_id(templateId);
+            wechat.setTouser(touserOpenId);
+            wechat.setAppid(appId);
+            Map<String, Map<String, String>> data = new HashMap<>();
+            Map<String, String> first = new HashMap<>();
+            Map<String, String> value1 = new HashMap<>();
+            Map<String, String> value2 = new HashMap<>();
+            Map<String, String> value3 = new HashMap<>();
+            Map<String, String> value4 = new HashMap<>();
+            Map<String, String> remark = new HashMap<>();
+            // 推送信息主体
+            first.put("value", "你好,你有新的保养通知");//firstData推送标题
+            data.put("first", first);
+            value1.put("value", mouldEquipmentVO.getEquipmentName());
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
+            data.put("keyword1", value1);
+            value2.put("value", mouldEquipmentVO.getArea());
+            data.put("keyword2", value2);
+            value3.put("value", sdf.format(new Date()));
+            data.put("keyword3", value3);
+            value4.put("value", mouldEquipmentVO.getEmergencyContent());
+            data.put("keyword4", value4);
+            remark.put("value", "给水泵内燃力不足");
+            data.put("remark", remark);
+            wechat.setData(data);
+            String jsonString = JSONObject.toJSONString(wechat);
+            // System.out.println("jsonString"+jsonString);
+            resp = HttpKit.post(url1, jsonString);
+            // System.out.println("resp0"+resp);
+            resp = StringEscapeUtils.unescapeJava(resp);
+            // System.out.println("resp"+resp);
+            json = (JSONObject) JSON.parse(resp);
+        }
+        return msg;
+    }
 }

+ 58 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeServiceImpl.java

@@ -0,0 +1,58 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hssx.cloudmodel.entity.NewsNotice;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.NewsNoticeVO;
+import com.hssx.cloudmodel.mapper.NewsNoticeMapper;
+import com.hssx.cloudmodel.mapper.UserMapper;
+import com.hssx.cloudmodel.service.NewsNoticeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import com.hssx.cloudmodel.util.PageUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@Service
+public class NewsNoticeServiceImpl extends ServiceImpl<NewsNoticeMapper, NewsNotice> implements NewsNoticeService {
+    @Resource
+    NewsNoticeMapper newsNoticeMapper;
+    @Resource
+    UserMapper userMapper;
+
+    @Override
+    public HttpRespMsg pageList(NewsNotice newsNotice,PageUtil page,Integer flag,String token) {
+        HttpRespMsg msg = new HttpRespMsg();
+        List<NewsNoticeVO> list = new ArrayList<>();
+        User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl",token));
+        if(user != null){
+            if(flag == 0){
+                //显示最近五条的未读消息
+                list = newsNoticeMapper.selectNewestFiveUnreadNewsByUserId(user);
+                msg.data = list;
+            }else if(flag == 1){
+                //加载全部
+                PageHelper.startPage(page.getPageNum(),page.getPageSize());
+                list = newsNoticeMapper.selectAllUnreadNewsByUserId(user,newsNotice);
+                PageInfo<NewsNoticeVO> pageInfo = new PageInfo<>(list);
+                msg.data = pageInfo;
+            }
+        }else{
+            msg.setError("用户不存在或者未登录");
+        }
+        return msg;
+    }
+}

+ 20 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/NewsNoticeUserServiceImpl.java

@@ -0,0 +1,20 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.hssx.cloudmodel.entity.NewsNoticeUser;
+import com.hssx.cloudmodel.mapper.NewsNoticeUserMapper;
+import com.hssx.cloudmodel.service.NewsNoticeUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-09
+ */
+@Service
+public class NewsNoticeUserServiceImpl extends ServiceImpl<NewsNoticeUserMapper, NewsNoticeUser> implements NewsNoticeUserService {
+
+}

+ 2 - 4
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/UserServiceImpl.java

@@ -109,8 +109,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     public HttpRespMsg addAndUpdateUser(User user, Integer flag) {
         //获取该账号的创建者
         User parentUser = userMapper.selectById(user.getParentId());
-        //获取admin的用户信息
-        User proParentUser = userMapper.selectById(parentUser.getParentId());
         HttpRespMsg msg = new HttpRespMsg();
         if (flag == 0) {
             //添加角色
@@ -123,7 +121,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 UserCompany userCompany = new UserCompany();
                 userCompany.setUserId(existingUser.getId());
                 userCompany.setBelongCompanyId(existingUser.getCompanyId());
-                userCompany.setCooperationCompanyId(proParentUser.getCompanyId());
+                userCompany.setCooperationCompanyId(parentUser.getCompanyId());
                 QueryWrapper<UserCompany> qWra = new QueryWrapper<>(userCompany);
                 int userCompanyCount = userCompanyMapper.selectCount(qWra);
                 if (count == 0) {
@@ -146,7 +144,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 UserCompany userCompany = new UserCompany();
                 userCompany.setUserId(user.getId());
                 userCompany.setBelongCompanyId(user.getCompanyId());
-                userCompany.setCooperationCompanyId(proParentUser.getCompanyId());
+                userCompany.setCooperationCompanyId(parentUser.getCompanyId());
                 QueryWrapper<UserCompany> qWra = new QueryWrapper<>(userCompany);
                 int userCompanyCount = userCompanyMapper.selectCount(qWra);
                 if (count == 0) {

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("tb_mould_file".split(","));
+        strategy.setInclude("tb_news_notice");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 306 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/util/HttpKit.java

@@ -0,0 +1,306 @@
+package com.hssx.cloudmodel.util;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+@Slf4j
+public class HttpKit {
+    
+    private static final String DEFAULT_CHARSET = "UTF-8";
+    /**
+     * 发送Get请求
+     * @param url
+     * @return
+     * @throws NoSuchProviderException 
+     * @throws NoSuchAlgorithmException 
+     * @throws IOException 
+     * @throws KeyManagementException 
+     */
+    public static String get(String url) throws NoSuchAlgorithmException, NoSuchProviderException, IOException, KeyManagementException {
+        StringBuffer bufferRes = null;
+        TrustManager[] tm = { new MyX509TrustManager() };  
+        SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");  
+        sslContext.init(null, tm, new java.security.SecureRandom());  
+        // 从上述SSLContext对象中得到SSLSocketFactory对象  
+        SSLSocketFactory ssf = sslContext.getSocketFactory();
+        
+        URL urlGet = new URL(url);
+        HttpsURLConnection http = (HttpsURLConnection) urlGet.openConnection();
+        // 连接超时
+        http.setConnectTimeout(25000);
+        // 读取超时 --服务器响应比较慢,增大时间
+        http.setReadTimeout(25000);
+        http.setRequestMethod("GET");
+        http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
+        http.setSSLSocketFactory(ssf);
+        http.setDoOutput(true);
+        http.setDoInput(true);
+        http.connect();
+        
+        InputStream in = http.getInputStream();
+        BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
+        String valueString = null;
+        bufferRes = new StringBuffer();
+        while ((valueString = read.readLine()) != null){
+            bufferRes.append(valueString);
+        }
+        in.close();
+        if (http != null) {
+            // 关闭连接
+            http.disconnect();
+        }
+        return bufferRes.toString();
+    }
+    
+    /**
+     * 发送Get请求
+     * @param url
+     * @return
+     * @throws NoSuchProviderException 
+     * @throws NoSuchAlgorithmException 
+     * @throws IOException 
+     * @throws KeyManagementException 
+     */
+    public static String get(String url,Boolean https) throws NoSuchAlgorithmException, NoSuchProviderException, IOException, KeyManagementException {
+     if(https != null && https){
+      return get(url);
+     }else{
+      StringBuffer bufferRes = null;
+            URL urlGet = new URL(url);
+            HttpURLConnection http = (HttpURLConnection) urlGet.openConnection();
+            // 连接超时
+            http.setConnectTimeout(25000);
+            // 读取超时 --服务器响应比较慢,增大时间
+            http.setReadTimeout(25000);
+            http.setRequestMethod("GET");
+            http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
+            http.setDoOutput(true);
+            http.setDoInput(true);
+            http.connect();
+            
+            InputStream in = http.getInputStream();
+            BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
+            String valueString = null;
+            bufferRes = new StringBuffer();
+            while ((valueString = read.readLine()) != null){
+                bufferRes.append(valueString);
+            }
+            in.close();
+            if (http != null) {
+                // 关闭连接
+                http.disconnect();
+            }
+            return bufferRes.toString();
+     }
+    }
+    /**
+     *  发送Get请求
+     * @param url
+     * @param params
+     * @return
+     * @throws IOException 
+     * @throws NoSuchProviderException 
+     * @throws NoSuchAlgorithmException 
+     * @throws KeyManagementException 
+     */
+    public static String get(String url, Map<String, String> params) throws KeyManagementException, NoSuchAlgorithmException, NoSuchProviderException, IOException {
+        return get(initParams(url, params));
+    }
+    /**
+     *  发送Post请求
+     * @param url
+     * @param params
+     * @return
+     * @throws IOException 
+     * @throws NoSuchProviderException 
+     * @throws NoSuchAlgorithmException 
+     * @throws KeyManagementException 
+     */
+    public static String post(String url, String params) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException {
+     StringBuffer bufferRes = null;
+        TrustManager[] tm = { new MyX509TrustManager() };
+        SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
+        sslContext.init(null, tm, new java.security.SecureRandom());
+        // 从上述SSLContext对象中得到SSLSocketFactory对象  
+        SSLSocketFactory ssf = sslContext.getSocketFactory();
+        URL urlGet = new URL(url);
+        HttpsURLConnection http = (HttpsURLConnection) urlGet.openConnection();
+        // 连接超时
+        http.setConnectTimeout(25000);
+        // 读取超时 --服务器响应比较慢,增大时间
+        http.setReadTimeout(25000);
+        http.setRequestMethod("POST");
+        http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
+        http.setSSLSocketFactory(ssf);
+        http.setDoOutput(true);
+        http.setDoInput(true);
+        http.connect();
+        OutputStream out = http.getOutputStream();
+        out.write(params.getBytes("UTF-8"));
+        out.flush();
+        out.close();
+        InputStream in = http.getInputStream();
+        BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
+        String valueString = null;
+        bufferRes = new StringBuffer();
+        while ((valueString = read.readLine()) != null){
+            bufferRes.append(valueString);
+        }
+        in.close();
+        if (http != null) {
+            // 关闭连接
+            http.disconnect();
+        }
+        return bufferRes.toString();
+    }
+    
+    /**
+     * 上传媒体文件
+     * @param url
+     * @param file
+     * @return
+     * @throws IOException
+     * @throws NoSuchAlgorithmException
+     * @throws NoSuchProviderException
+     * @throws KeyManagementException
+     */
+    public static String upload(String url,File file) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException {
+        String BOUNDARY = "----WebKitFormBoundaryiDGnV9zdZA1eM1yL"; // 定义数据分隔线  
+        StringBuffer bufferRes = null;
+        URL urlGet = new URL(url);
+        HttpURLConnection conn = (HttpURLConnection) urlGet.openConnection();
+        conn.setDoOutput(true);  
+        conn.setDoInput(true);  
+        conn.setUseCaches(false);  
+        conn.setRequestMethod("POST");  
+        conn.setRequestProperty("connection", "Keep-Alive");  
+        conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36");  
+        conn.setRequestProperty("Charsert", "UTF-8");   
+        conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);  
+          
+        OutputStream out = new DataOutputStream(conn.getOutputStream());  
+        byte[] end_data = ("\r\n--" + BOUNDARY + "--\r\n").getBytes();// 定义最后数据分隔线  
+        StringBuilder sb = new StringBuilder();    
+        sb.append("--");    
+        sb.append(BOUNDARY);    
+        sb.append("\r\n");    
+        sb.append("Content-Disposition: form-data;name=\"media\";filename=\""+ file.getName() + "\"\r\n");    
+        sb.append("Content-Type:application/octet-stream\r\n\r\n");    
+        byte[] data = sb.toString().getBytes();  
+        out.write(data);  
+        DataInputStream fs = new DataInputStream(new FileInputStream(file));  
+        int bytes = 0;  
+        byte[] bufferOut = new byte[1024];  
+        while ((bytes = fs.read(bufferOut)) != -1) {  
+            out.write(bufferOut, 0, bytes);  
+        }  
+        out.write("\r\n".getBytes()); //多个文件时,二个文件之间加入这个  
+        fs.close();  
+        out.write(end_data);  
+        out.flush();    
+        out.close();   
+          
+        // 定义BufferedReader输入流来读取URL的响应  
+        InputStream in = conn.getInputStream();
+        BufferedReader read = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET));
+        String valueString = null;
+        bufferRes = new StringBuffer();
+        while ((valueString = read.readLine()) != null){
+            bufferRes.append(valueString);
+        }
+        in.close();
+        if (conn != null) {
+            // 关闭连接
+         conn.disconnect();
+        }
+        return bufferRes.toString();
+    }
+    
+    /**
+     * 构造url
+     * @param url
+     * @param params
+     * @return
+     */
+    private static String initParams(String url, Map<String, String> params){
+        if (null == params || params.isEmpty()) {
+            return url;
+        }
+        StringBuilder sb = new StringBuilder(url);
+        if (url.indexOf("?") == -1) {
+            sb.append("?");
+        } else {
+            sb.append("&");
+        }
+        boolean first = true;
+        for (Entry<String, String> entry : params.entrySet()) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append("&");
+            }
+            String key = entry.getKey();
+            String value = entry.getValue();
+            sb.append(key).append("=");
+            if (StringUtils.isNotEmpty(value)) {
+                try {
+                    sb.append(URLEncoder.encode(value, DEFAULT_CHARSET));
+                } catch (UnsupportedEncodingException e) {
+                    e.printStackTrace();
+                    log.error(url,e);
+                }
+            }
+        }
+        return sb.toString();
+    }
+    
+    public static void main(String[] args) {
+     String fname = "dsasdas.mp4";
+     String s = fname.substring(0, fname.lastIndexOf("."));
+     String f = fname.substring(s.length()+1);
+  System.out.println(f);
+ }
+}
+/**
+ * 证书管理
+ */
+class MyX509TrustManager implements X509TrustManager {
+    public X509Certificate[] getAcceptedIssuers() {
+        return null;  
+    }
+    @Override
+    public void checkClientTrusted(X509Certificate[] chain, String authType)
+            throws CertificateException {
+    }
+    @Override
+    public void checkServerTrusted(X509Certificate[] chain, String authType)
+            throws CertificateException {
+    }
+}

+ 23 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/util/NewsNoticeTemplate.java

@@ -0,0 +1,23 @@
+package com.hssx.cloudmodel.util;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 09 15:43
+ * Description:<描述>
+ * Version: 1.0
+ */
+public class NewsNoticeTemplate {
+
+    //模具文档审批消息模板
+    public static String approvalMessage(String username){
+        return "模具开发人员:"+username+"已上传成功,待您审批!";
+    }
+//    //模具保养消息模板
+//    public static String approvalMessage(String username){
+//        return "模具开发人员:"+username+"已上传成功,待您审批!";
+//    }
+//    //模具文档审批消息模板
+//    public static String approvalMessage(String username){
+//        return "模具开发人员:"+username+"已上传成功,待您审批!";
+//    }
+}

+ 31 - 2
cloud-model/src/main/resources/mapper/CompanyMapper.xml

@@ -9,20 +9,49 @@
         <result column="company_address" property="companyAddress" />
         <result column="company_type" property="companyType" />
     </resultMap>
+    <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.CompanyVO">
+        <id column="id" property="id" />
+        <result column="company_name" property="companyName" />
+        <result column="company_address" property="companyAddress" />
+        <result column="company_type" property="companyType" />
+        <result column="y_lng" property="yLng" />
+        <result column="x_lat" property="xLat" />
+    </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id, company_name, company_address, company_type
     </sql>
 
-    <select id="getListByKeyName" resultMap="BaseResultMap">
+    <select id="getListByKeyName" resultMap="BaseResultMapVO">
         select
         <include refid="Base_Column_List"/>
         from
         tb_company
         <where>
             <if test="keyName != null and keyName != ''">
-                company_name like concat('%',#{keyName},'%')
+               and company_name like concat('%',#{keyName},'%')
+            </if>
+            <if test="companyType != null">
+                and company_type = #{companyType}
+            </if>
+        </where>
+        Limit #{start},#{pageSize}
+    </select>
+    <select id="getCustomerListByKeyName" resultMap="BaseResultMapVO">
+        select
+        t.id, t.company_name, t.company_address, t.company_type,tc.y_lng, tc.x_lat
+        from
+        tb_company t
+        left join
+        tb_lng_lat_company tc
+        on tc.company_id = t.id
+        <where>
+            <if test="keyName != null and keyName != ''">
+               and t.company_name like concat('%',#{keyName},'%')
+            </if>
+            <if test="companyType != null">
+                and t.company_type = #{companyType}
             </if>
         </where>
         Limit #{start},#{pageSize}

+ 19 - 0
cloud-model/src/main/resources/mapper/LngLatCompanyMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.cloudmodel.mapper.LngLatCompanyMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.LngLatCompany">
+        <id column="id" property="id" />
+        <result column="y_lng" property="yLng" />
+        <result column="x_lat" property="xLat" />
+        <result column="indate" property="indate" />
+        <result column="company_id" property="companyId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, y_lng, x_lat, indate, company_id
+    </sql>
+
+</mapper>

+ 6 - 1
cloud-model/src/main/resources/mapper/MouldEquipmentMapper.xml

@@ -25,6 +25,8 @@
         <result column="equipment_no" property="equipmentNo" />
         <result column="is_use" property="isUse" />
         <result column="hill_number" property="hillNumber" />
+        <result column="modelNo" property="modelNo" />
+        <result column="modelName" property="modelName" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
@@ -57,9 +59,12 @@
         select
           tbme.id id, tbme.equipment_name equipment_name, tbme.start_time start_time, tbme.end_time end_time,
           tbme.use_life use_life, tbme.belong_company_id belong_company_id, tbme.equipment_no equipment_no,
-          tbme.is_use, tbme.hill_number,tbc.company_name companyName
+          tbme.is_use, tbme.hill_number,tbc.company_name companyName,tbm.model_no modelNo,tbm.model_name modelName
         from
           tb_mould_equipment tbme
+        left join
+          tb_mould tbm
+        on tbme.id = tbm.equipment_id
         left join
           tb_company tbc
         on

+ 81 - 0
cloud-model/src/main/resources/mapper/NewsNoticeMapper.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.cloudmodel.mapper.NewsNoticeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.NewsNotice">
+        <id column="id" property="id" />
+        <result column="project_id" property="projectId" />
+        <result column="project_name" property="projectName" />
+        <result column="mould_id" property="mouldId" />
+        <result column="notice_type" property="noticeType" />
+        <result column="content" property="content" />
+        <result column="mould_no" property="mouldNo" />
+        <result column="file_id" property="fileId" />
+        <result column="file_blong_type" property="fileBlongType" />
+        <result column="equipment_id" property="equipmentId" />
+        <result column="equipment_no" property="equipmentNo" />
+        <result column="indate" property="indate" />
+    </resultMap>
+    <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.NewsNoticeVO">
+        <id column="id" property="id" />
+        <result column="project_id" property="projectId" />
+        <result column="project_name" property="projectName" />
+        <result column="mould_id" property="mouldId" />
+        <result column="notice_type" property="noticeType" />
+        <result column="content" property="content" />
+        <result column="mould_no" property="mouldNo" />
+        <result column="file_id" property="fileId" />
+        <result column="file_blong_type" property="fileBlongType" />
+        <result column="equipment_id" property="equipmentId" />
+        <result column="equipment_no" property="equipmentNo" />
+        <result column="indate" property="indate" />
+        <result column="user_id" property="userId" />
+        <result column="is_read" property="isRead" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, project_id, project_name, mould_id, notice_type, content, mould_no, file_id, file_blong_type, equipment_id, equipment_no, indate
+    </sql>
+<!--未读的最新五条消息-->
+    <select id="selectNewestFiveUnreadNewsByUserId" resultMap="BaseResultMapVO">
+        select
+        tnn.id, tnn.project_id, tnn.project_name, tnn.mould_id, tnn.notice_type,
+        tnn.content, tnn.mould_no, tnn.file_id, tnn.file_blong_type,
+        tnn.equipment_id, tnn.equipment_no, tnn.indate,tnnu.user_id,tnnu.is_read
+        from
+          tb_news_notice tnn
+        left join
+          tb_news_notice_user tnnu
+        on
+          tnn.id = tnnu.news_id
+        where
+          tnnu.user_id = #{user.id}
+        and
+          tnnu.is_read = 0
+        limit
+          0,5
+    </select>
+    <!--未读的全部消息-->
+    <select id="selectAllUnreadNewsByUserId" resultMap="BaseResultMapVO">
+        select
+        tnn.id, tnn.project_id, tnn.project_name, tnn.mould_id, tnn.notice_type,
+        tnn.content, tnn.mould_no, tnn.file_id, tnn.file_blong_type,
+        tnn.equipment_id, tnn.equipment_no, tnn.indate,tnnu.user_id,tnnu.is_read
+        from
+          tb_news_notice tnn
+        left join
+          tb_news_notice_user tnnu
+        on
+          tnn.id = tnnu.news_id
+        <where>
+              tnnu.user_id = #{user.id}
+            and
+              tnnu.is_read = 0
+            <if test="newsNotice.noticeType != null">
+               and tnn.notice_type = #{newsNotice.noticeType}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 18 - 0
cloud-model/src/main/resources/mapper/NewsNoticeUserMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.cloudmodel.mapper.NewsNoticeUserMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.NewsNoticeUser">
+        <id column="id" property="id" />
+        <result column="user_id" property="userId" />
+        <result column="is_read" property="isRead" />
+        <result column="news_id" property="newsId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, user_id, is_read, news_id
+    </sql>
+
+</mapper>

BIN
ys_vue/src/assets/image/login_logo.png


+ 2 - 2
ys_vue/src/main.js

@@ -56,10 +56,10 @@ router.beforeEach((to, from, next) => {
                 if(routes[i].name == "项目管理" && user.parentId > 1){
                     var children = routes[i].children;
                     for(var j in children){
-                        if(children[j].name == "人员管理" && user.isManager == 1){
+                        if(children[j].name == "人员管理" && user.isManager == 0){
                             children[j].hidden = true
                         }
-                        if(children[j].name == "权限管理" && user.isManager == 1){
+                        if(children[j].name == "权限管理" && user.isManager == 0){
                             children[j].hidden = true
                         }
                     }

+ 3 - 3
ys_vue/src/routes.js

@@ -76,7 +76,7 @@ let routes = [
         children: [
             { path: '/moldList', component: moldList, name: '模具列表' },
             { path: '/moldList/:id', component: moldDetail, name: '模具详情', hidden: true },
-            { path: '/moldFile', component: moldFile, name: '文档审批' },
+            // { path: '/moldFile', component: moldFile, name: '文档审批' },
             { path: '/moldDownload', component: moldDownload, name: '文档下载' }
         ]
     },
@@ -88,8 +88,8 @@ let routes = [
         iconCls: 'iconfont icon-setting-fill',
         children: [
             // { path: '/role', component: role, name: '角色管理' },
-            { path: '/comp', component: comp, name: '公司管理' },
-            { path: '/factory', component: factory, name: '工厂管理' },
+            { path: '/comp', component: comp, name: '资产方管理' },
+            { path: '/factory', component: factory, name: '生产方管理' },
             { path: '/allocation', component: allocation, name: '云模盒管理' }
         ]
     },

+ 1 - 1
ys_vue/src/views/Login.vue

@@ -2,7 +2,7 @@
     <div class="login-par">
         <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="left" label-width="0px" class="demo-ruleForm login-container">
             <div class="login-logo">
-                <img src="../assets/image/login_logo.png" />
+                <img src="../assets/image/login_logo.png" style="width:80px;"/>
             </div>
             <h3 class="title">云塑网后台管理系统</h3>
             <el-form-item class="login-input" prop="account">

+ 29 - 28
ys_vue/src/views/base/comp.vue

@@ -4,7 +4,7 @@
 		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
 			<el-form :inline="true" :model="filters">
                 <el-form-item>
-                    <el-input v-model="filters.keyName" placeholder="请输入公司名称进行搜索" clearable></el-input>
+                    <el-input v-model="filters.keyName" placeholder="请输入资产方名称进行搜索" clearable></el-input>
                 </el-form-item>
 				<el-form-item>
 					<el-button type="primary" @click.native="getComp">查询</el-button>
@@ -18,13 +18,13 @@
 		<!--列表-->
 		<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
             <el-table-column type="index" width="60"></el-table-column>
-			<el-table-column prop="companyName" label="公司名称" width="300" sortable></el-table-column>
-            <el-table-column prop="companyType" label="公司类型" width="200" sortable>
+			<el-table-column prop="companyName" label="资产方名称" width="300" sortable></el-table-column>
+            <!-- <el-table-column prop="companyType" label="资产方类型" width="200" sortable>
                 <template slot-scope="scope">
                     {{ scope.row.companyType == 0?"资产方":"生产方" }}
                 </template>
-            </el-table-column>
-            <el-table-column prop="companyAddress" label="公司地址" sortable></el-table-column>
+            </el-table-column> -->
+            <el-table-column prop="companyAddress" label="资产方地址" sortable></el-table-column>
 			<el-table-column label="操作" width="150">
 				<template slot-scope="scope">
 					<el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
@@ -47,19 +47,19 @@
 		</el-col>
 
         <!--新增界面-->
-		<el-dialog title="新增公司" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
+		<el-dialog title="新增资产方" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
 			<el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
-				<el-form-item label="公司名称" prop="companyName">
-					<el-input v-model="addForm.companyName" autocomplete="off" placeholder="请输入公司地址"></el-input>
+				<el-form-item label="资产方名称" prop="companyName">
+					<el-input v-model="addForm.companyName" autocomplete="off" placeholder="请输入资产方地址"></el-input>
 				</el-form-item>
-                <el-form-item label="公司类型" prop="companyType">
+                <!-- <el-form-item label="公司类型" prop="companyType">
                     <el-select v-model="addForm.companyType" clearable filterable placeholder="请选择公司类型" style="width:533px">
                         <el-option v-for="item in team" :key="item.value" :label="item.label" :value="item.value">
                         </el-option>
                     </el-select>
-				</el-form-item>
-                <el-form-item label="公司地址" prop="companyAddress">
-					<el-input v-model="addForm.companyAddress" autocomplete="off" placeholder="请输入公司地址"></el-input>
+				</el-form-item> -->
+                <el-form-item label="资产方地址" prop="companyAddress">
+					<el-input v-model="addForm.companyAddress" autocomplete="off" placeholder="请输入资产方地址"></el-input>
 				</el-form-item>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
@@ -69,19 +69,19 @@
 		</el-dialog>
 
 		<!--编辑界面-->
-		<el-dialog title="编辑公司" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
+		<el-dialog title="编辑资产方" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
 			<el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm">
-				<el-form-item label="公司名称" prop="companyName">
-					<el-input v-model="editForm.companyName" autocomplete="off" placeholder="请输入公司地址"></el-input>
+				<el-form-item label="资产方名称" prop="companyName">
+					<el-input v-model="editForm.companyName" autocomplete="off" placeholder="请输入资产方地址"></el-input>
 				</el-form-item>
-                <el-form-item label="公司名称" prop="companyType">
+                <!-- <el-form-item label="公司名称" prop="companyType">
                     <el-select v-model="editForm.companyType" clearable filterable placeholder="请选择公司类型" style="width:533px">
                         <el-option v-for="item in team" :key="item.value" :label="item.label" :value="item.value">
                         </el-option>
                     </el-select>
-				</el-form-item>
-                <el-form-item label="公司地址" prop="companyAddress">
-					<el-input v-model="editForm.companyAddress" autocomplete="off" placeholder="请输入公司地址"></el-input>
+				</el-form-item> -->
+                <el-form-item label="资产方地址" prop="companyAddress">
+					<el-input v-model="editForm.companyAddress" autocomplete="off" placeholder="请输入资产方地址"></el-input>
 				</el-form-item>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
@@ -110,13 +110,13 @@
                 
                 formRules: {
 					companyName: [
-						{ required: true, message: '请输入公司名称', trigger: 'blur' }
+						{ required: true, message: '请输入资产方名称', trigger: 'blur' }
                     ],
                     companyType: [
-                        { required: true, message:'请选择公司类型', trigger: ['blur', 'change'] }
+                        { required: true, message:'请选择资产方类型', trigger: ['blur', 'change'] }
                     ],
                     companyAddress: [
-                        { required: true, message: '请输入公司地址', trigger: 'blur' }
+                        { required: true, message: '请输入资产方地址', trigger: 'blur' }
                     ]
                 },
 
@@ -126,7 +126,7 @@
 				addLoading: false,
 				addForm: {
                     companyName: '',
-                    companyType: '',
+                    companyType: 0,
                     companyAddress: '',
                     flag: 0
 				},
@@ -137,7 +137,7 @@
 				editForm: {
 					id: 0,
                     companyName: '',
-                    companyType: '',
+                    companyType: 0,
                     companyAddress: '',
                     flag: 1
 				}
@@ -161,7 +161,8 @@
                 this.http.post(this.port.base.companyList, {
                     keyName: this.filters.keyName,
                     pageNum: this.page,
-                    pageSize: this.size
+                    pageSize: this.size,
+                    companyType: 0
                 }, res => {
                     this.listLoading = false;
                     if (res.code == "ok") {
@@ -187,7 +188,7 @@
                 this.addFormVisible = true;
 				this.addForm = {
                     companyName: '',
-                    companyType: '',
+                    companyType: 0,
                     companyAddress: '',
                     flag: 0
 				};
@@ -227,7 +228,7 @@
             
 			//删除
 			handleDel(index, row) {
-				this.$confirm('确认删除该公司吗?', '提示', {
+				this.$confirm('确认删除该资产方吗?', '提示', {
 					type: 'warning'
 				}).then(() => {
                     this.http.post(this.port.base.delCompany, {
@@ -260,7 +261,7 @@
                 this.editForm = {
                     id: row.id,
                     companyName: row.companyName,
-                    companyType: row.companyType==0?'资产方':'生产方',
+                    companyType: 0,
                     companyAddress: row.companyAddress,
                     flag: 1
 				};

+ 160 - 115
ys_vue/src/views/base/factory.vue

@@ -4,7 +4,7 @@
 		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
 			<el-form :inline="true" :model="filters">
                 <el-form-item>
-                    <el-input v-model="filters.keyName" placeholder="请输入工厂名称进行搜索" clearable></el-input>
+                    <el-input v-model="filters.keyName" placeholder="请输入生产方名称进行搜索" clearable></el-input>
                 </el-form-item>
 				<el-form-item>
 					<el-button type="primary" @click.native="getFactory">查询</el-button>
@@ -18,8 +18,8 @@
 		<!--列表-->
 		<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
             <el-table-column type="index" width="60"></el-table-column>
-			<el-table-column prop="factoryName" label="工厂名称" width="300" sortable></el-table-column>
-            <el-table-column prop="factoryArea" label="工厂地址" sortable></el-table-column>
+			<el-table-column prop="companyName" label="生产方名称" width="300" sortable></el-table-column>
+            <el-table-column prop="companyAddress" label="生产方地址" sortable></el-table-column>
 			<el-table-column label="操作" width="150">
 				<template slot-scope="scope">
 					<el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
@@ -42,15 +42,15 @@
 		</el-col>
 
         <!--新增界面-->
-		<el-dialog title="新增工厂" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm" :inline="true" class="demo-form-inline">
-				<el-form-item label="工厂名称" prop="factoryName">
-					<el-input v-model="addForm.factoryName" autocomplete="off" placeholder="请输入工厂名称"></el-input>
+		<el-dialog title="新增生产方" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
+			<el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
+				<el-form-item label="生产方名称" prop="factoryName">
+					<el-input v-model="addForm.companyName" autocomplete="off" placeholder="请输入生产方名称"></el-input>
 				</el-form-item>
-                <el-form-item label="工厂地址" prop="factoryArea">
-					<el-input v-model="addForm.factoryArea" autocomplete="off" :change="changeFactoryArea('addContainer')" placeholder="请输入工厂地址"></el-input>
+                <el-form-item label="生产方地址" prop="factoryArea">
+					<el-input v-model="addForm.companyAddress" autocomplete="off" :change="changeFactoryArea('addContainer')" placeholder="请输入生产方地址"></el-input>
 				</el-form-item>
-                <div id="addContainer" class="formMap" v-if="addForm.factoryArea != ''"></div>
+                <div id="addContainer" class="formMap"></div>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
 				<el-button @click.native="addFormVisible = false">取消</el-button>
@@ -59,15 +59,15 @@
 		</el-dialog>
 
 		<!--编辑界面-->
-		<el-dialog title="编辑工厂" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
-			<el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm" :inline="true" class="demo-form-inline">
-				<el-form-item label="工厂名称" prop="factoryName">
-					<el-input v-model="editForm.factoryName" autocomplete="off" placeholder="请输入工厂名称"></el-input>
+		<el-dialog title="编辑生产方" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
+			<el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm">
+				<el-form-item label="生产方名称" prop="factoryName">
+					<el-input v-model="editForm.companyName" autocomplete="off" placeholder="请输入生产方名称"></el-input>
 				</el-form-item>
-                <el-form-item label="工厂地址" prop="factoryArea">
-					<el-input v-model="editForm.factoryArea" autocomplete="off" :change="changeFactoryArea('editContainer')" placeholder="请输入工厂地址"></el-input>
+                <el-form-item label="生产方地址" prop="factoryArea">
+					<el-input v-model="editForm.companyAddress" autocomplete="off" :change="changeFactoryArea('editContainer')" placeholder="请输入生产方地址"></el-input>
 				</el-form-item>
-                <div id="editContainer" class="formMap" v-if="editForm.factoryArea != ''"></div>
+                <div id="editContainer" class="formMap"></div>
 			</el-form>
 			<div slot="footer" class="dialog-footer">
 				<el-button @click.native="editFormVisible = false">取消</el-button>
@@ -78,6 +78,7 @@
 </template>
 
 <script>
+    import Vue from 'vue';
 	import util from '../../common/js/util'
 
 	export default {
@@ -93,22 +94,26 @@
                 listLoading: false,
                 tableHeight: 0,
                 
-                noSub: false,
                 formRules: {
-					factoryName: [
-						{ required: true, message: '请输入公司名称', trigger: 'blur' }
+					companyName: [
+						{ required: true, message: '请输入生产方名称', trigger: 'blur' }
                     ],
-                    factoryArea: [
-                        { required: true, message: '请输入公司地址', trigger: 'blur' }
+                    companyAddress: [
+                        { required: true, message: '请输入生产方地址', trigger: 'blur' }
                     ]
                 },
 
+                // 地图
+                map: '',
+                marker: '',
+
                 // 新增界面
 				addFormVisible: false,
 				addLoading: false,
 				addForm: {
-                    factoryName: '',
-                    factoryArea: '',
+                    companyName: '',
+                    companyType: 1,
+                    companyAddress: '',
                     yLng: 0,
                     xLat: 0,
                     flag: 0
@@ -119,8 +124,9 @@
 				editLoading: false,
 				editForm: {
 					id: 0,
-					factoryName: '',
-                    factoryArea: '',
+					companyName: '',
+                    companyType: 1,
+                    companyAddress: '',
                     yLng: 0,
                     xLat: 0,
                     flag: 1
@@ -139,13 +145,14 @@
 				this.getFactory();
             },
 
-			//获取用户列表
+			//获取列表
 			getFactory() {
 				this.listLoading = true;
-                this.http.post(this.port.base.factoryList, {
+                this.http.post(this.port.base.companyList, {
                     keyName: this.filters.keyName,
                     pageNum: this.page,
-                    pageSize: this.size
+                    pageSize: this.size,
+                    companyType: 1
                 }, res => {
                     this.listLoading = false;
                     if (res.code == "ok") {
@@ -169,9 +176,9 @@
             //地址输入切换
             changeFactoryArea(mapId) {
                 if(mapId == "addContainer"){
-                    this.markLocation(this.addForm.factoryArea, mapId);
+                    this.markLocation(this.addForm.companyAddress, mapId);
                 } else {
-                    this.markLocation(this.editForm.factoryArea, mapId);
+                    this.markLocation(this.editForm.companyAddress, mapId);
                 }
                 
             },
@@ -179,61 +186,54 @@
             //显示新增界面
 			handleAdd() {
                 this.addFormVisible = true;
-                this.noSub = false;
 				this.addForm = {
-                    factoryName: '',
-                    factoryArea: '',
-                    yLng: 0,
-                    xLat: 0,
+                    companyName: '',
+                    companyType: 1,
+                    companyAddress: '',
+                    yLng: 116.397511,
+                    xLat: 39.907545,
                     flag: 0
-				};
+                };
             },
 
             //新增
 			addSubmit() {
 				this.$refs.addForm.validate((valid) => {
 					if (valid) {
-                        if(this.noSub){
-                            this.$message({
-                                message: '定位失败!',
-                                type: 'error'
-                            });
-                        } else {
-                            this.addLoading = true;
-                            this.http.post(this.port.base.addFactory, this.addForm , res => {
-                                this.addLoading = false;
-                                this.addFormVisible = false;
-                                if (res.code == "ok") {
-                                    this.$message({
-                                        message: '创建成功',
-                                        type: 'success'
-                                    });
-                                    this.getFactory();
-                                } else {
-                                    this.$message({
-                                        message: res.msg,
-                                        type: 'error'
-                                    });
-                                }
-                            }, error => {
-                                this.addLoading = false;
-                                this.addFormVisible = false;
+                        this.addLoading = true;
+                        this.http.post(this.port.base.addCompany, this.addForm , res => {
+                            this.addLoading = false;
+                            this.addFormVisible = false;
+                            if (res.code == "ok") {
+                                this.$message({
+                                    message: '创建成功',
+                                    type: 'success'
+                                });
+                                this.getFactory();
+                            } else {
                                 this.$message({
-                                    message: error,
+                                    message: res.msg,
                                     type: 'error'
                                 });
-                            })
-                        }
+                            }
+                        }, error => {
+                            this.addLoading = false;
+                            this.addFormVisible = false;
+                            this.$message({
+                                message: error,
+                                type: 'error'
+                            });
+                        })
 					}
 				});
             },
             
 			//删除
 			handleDel(index, row) {
-				this.$confirm('确认删除该工厂吗?', '提示', {
+				this.$confirm('确认删除该生产方吗?', '提示', {
 					type: 'warning'
 				}).then(() => {
-                    this.http.post(this.port.base.delFactory, {
+                    this.http.post(this.port.base.delCompany, {
                         id: row.id
                     }, res => {
                         if (res.code == "ok") {
@@ -258,60 +258,98 @@
             },
             
 			//显示编辑界面
-			handleEdit: function (index, row) {
+			handleEdit(index, row) {
                 this.editFormVisible = true;
-                this.noSub = false;
                 this.editForm = {
                     id: row.id,
-                    factoryName: row.factoryName,
-                    factoryArea: row.factoryArea,
-                    yLng: row.yLng,
-                    xLat: row.xLat,
+                    companyName: row.companyName,
+                    companyType: 1,
+                    companyAddress: row.companyAddress,
+                    yLng: row.ylng,
+                    xLat: row.xlat,
                     flag: 1
 				};
             },
             
 			//编辑
-			editSubmit: function () {
+			editSubmit() {
 				this.$refs.editForm.validate((valid) => {
 					if (valid) {
-                        if(this.noSub){
-                            this.$message({
-                                message: '定位失败!',
-                                type: 'error'
-                            });
-                        } else {
-                            this.editLoading = true;
-                            this.http.post(this.port.base.addFactory, this.editForm , res => {
-                                this.editLoading = false;
-                                this.editFormVisible = false;
-                                if (res.code == "ok") {
-                                    this.$message({
-                                        message: '修改成功',
-                                        type: 'success'
-                                    });
-                                    this.getFactory();
-                                } else {
-                                    this.$message({
-                                        message: res.msg,
-                                        type: 'error'
-                                    });
-                                }
-                            }, error => {
-                                this.editLoading = false;
-                                this.editFormVisible = false;
+                        this.editLoading = true;
+                        this.http.post(this.port.base.addCompany, this.editForm , res => {
+                            this.editLoading = false;
+                            this.editFormVisible = false;
+                            if (res.code == "ok") {
                                 this.$message({
-                                    message: error,
+                                    message: '修改成功',
+                                    type: 'success'
+                                });
+                                this.getFactory();
+                            } else {
+                                this.$message({
+                                    message: res.msg,
                                     type: 'error'
                                 });
-                            })
-                        }
+                            }
+                        }, error => {
+                            this.editLoading = false;
+                            this.editFormVisible = false;
+                            this.$message({
+                                message: error,
+                                type: 'error'
+                            });
+                        })
 					}
 				});
             },
 
+            //获取地图
+            setMap(mapId) {
+                if(mapId == 'addContainer') {
+                    this.map = new AMap.Map('addContainer', {
+                        resizeEnable: true, // 允许缩放
+                        center:[118.784333,32.041546],
+                        zoom:10
+                    })
+
+                    this.marker = new AMap.Marker({
+                        map: this.map,
+                        position: new AMap.LngLat(118.784333,32.041546),   // 经纬度
+                    });
+                } else {
+                    this.map = new AMap.Map('editContainer', {
+                        resizeEnable: true, // 允许缩放
+                        center:[this.editForm.yLng , this.editForm.xLat],
+                        zoom:10
+                    })
+
+                    this.marker = new AMap.Marker({
+                        map: this.map,
+                        position: new AMap.LngLat(this.editForm.yLng , this.editForm.xLat),   // 经纬度
+                    });
+                }
+                
+                var _this = this;
+                this.map.on('click', function(e) {
+                    _this.map.remove(_this.marker);
+                    var Lng = e.lnglat.getLng(),
+                    Lat = e.lnglat.getLat();
+                    if(mapId == 'addContainer') {
+                        _this.addForm.yLng = Lng;
+                        _this.addForm.xLat = Lat;
+                    } else {
+                        _this.editForm.yLng = Lng;
+                        _this.editForm.xLat = Lat;
+                    }
+                    _this.marker = new AMap.Marker({
+                        map: _this.map,
+                        position: new AMap.LngLat(Lng , Lat),   // 经纬度
+                    });
+                });
+            },
+
             // 获取经纬度
-            markLocation: function(address,mapId) {
+            markLocation(address,mapId) {
                 var _this = this;
                 AMap.plugin('AMap.Geocoder', function() {
                     var geocoder = new AMap.Geocoder();            
@@ -329,29 +367,23 @@
                                 _this.editForm.yLng = lng;
                                 _this.editForm.xLat = lat;
                             }
-        
-                            // 地图实例
-                            var map = new AMap.Map(mapId, {
-                                resizeEnable: true, // 允许缩放
-                                center: [lng, lat], // 设置地图的中心点
-                                zoom: 15        // 设置地图的缩放级别,0 - 20
-                            });
                             
                             // 添加标记
-                            var marker = new AMap.Marker({
-                                map: map,
+                            _this.map.remove(_this.marker);
+                            _this.map.setZoomAndCenter(10, [lng, lat]);
+                            _this.marker = new AMap.Marker({
+                                map: _this.map,
                                 position: new AMap.LngLat(lng, lat),   // 经纬度
                             });
                             
+
                         } else {
-                            _this.noSub = true;
                             //console.log('定位失败!');
                         }
                     });
                 });
             }
         },
-
         created() {
             let height = window.innerHeight;
             this.tableHeight = height - 210;
@@ -360,7 +392,20 @@
                 that.tableHeight = window.innerHeight - 210;    
             };
         },
-
+        watch: {
+            addFormVisible(val) {
+                if(val){
+                    var _this = this
+                    setTimeout(function(){ _this.setMap('addContainer'); }, 300);
+                }
+            },
+            editFormVisible(val) {
+                if(val){
+                    var _this = this
+                    setTimeout(function(){ _this.setMap('editContainer'); }, 300);
+                }
+            }
+        },
 		mounted() {
 			this.getFactory();
         }