Browse Source

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

# Conflicts:
#	cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java
5 years ago
parent
commit
f1661aedf2

+ 2 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/constant/Constant.java

@@ -28,7 +28,6 @@ public class Constant {
     public static final Integer PRODUCER_COMPANY = 1;//生产方编号
     public static final Integer SYS_PARENT_ID = 0;//系统管理员的上级id
     public static final Integer SYS_ID = 1;//系统管理员的id
-    public static final String MOULD_PREFIX = "YMMJ";//模具编号前缀
     public static final String PROJECT_PREFIX = "YMXM";//项目编号
     public static final String UPLOAD = "上传";//上传
     public static final String UPDATE = "申请模具更新";//申请模具更新
@@ -48,7 +47,7 @@ public class Constant {
     public static final String PLAN_TYPE = "保养类型";//保养类型
     public static final String MAIN_TAIN_NOTICE = "该模具需要保养,请前往处理";//保养通知
     public static final String SCRAP_NOTICE = "该模具运行次数已超过寿命次数,请申请报废处理";//待报废
-    public static final String EMERGENCY_NOTICE = "该模具运行次数已超过寿命次数,请申请报废处理";//待报废
+    public static final String EMERGENCY_NOTICE = "模具云墨盒已被更换,请前往查看并处理";//模具云墨盒解绑告警
     public static final String MAINTAIN_NAME_FIRST = "动作";//保养类型名称0
     public static final String MAINTAIN_NAME_SECOND = "易损件";//保养类型名称1
     public static final String MAINTAIN_WAY_FIRST = "喷漆";//对应保养类型动作
@@ -56,6 +55,7 @@ public class Constant {
     public static final String PART_FILE_2D = "2D";//零件2d
     public static final String PART_FILE_3D = "3D";//零件3d
     public static final Double ELECTRICITY_THRESHOLD = 0.2;//电量阈值
+    public static final Double TEMPERATURE_THRESHOLD = 15.0;//温度阈值
 //    public static void main(String[] args){
 //        System.out.println("222222");
 //        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="

+ 47 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/InvitationRecordController.java

@@ -0,0 +1,47 @@
+package com.hssx.cloudmodel.controller;
+
+
+import com.hssx.cloudmodel.entity.InvitationRecord;
+import com.hssx.cloudmodel.entity.vo.CompanyVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import com.hssx.cloudmodel.service.InvitationRecordService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * @author 吴涛涛
+ * @since 2019-08-20
+ */
+@Controller
+@RequestMapping("/invitationrecord")
+public class InvitationRecordController {
+
+    @Autowired
+    InvitationRecordService invitationRecordService;
+    /**
+     * 添加邀请记录并产生链接
+     * token 用户凭证,
+     * 参数:
+     * @return
+     */
+    @ApiOperation("添加邀请记录并产生链接")
+    @RequestMapping("/inviteUser")
+    @ResponseBody
+    public HttpRespMsg inviteUser(InvitationRecord invitationRecord,String token) {
+        HttpRespMsg msg = new HttpRespMsg();
+        msg = invitationRecordService.add(invitationRecord);
+        return msg;
+    }
+
+
+}
+

+ 3 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldFileController.java

@@ -52,8 +52,9 @@ public class MouldFileController {
      * 模具文档的上传
      * 参数: token 用户身份凭证,
      * mouldId 模具id ,
-     * blongType 文档类型(0-模具文档 1-零件文档 2-试模验收 2-保养方案 3-模具更新 4-模具报废),
+     * blongType 文档类型(0-模具文档 1-零件文档 2-试模验收 3-保养方案 4-模具更新 5-模具报废),
      * 注:blongType 为 1 时需要多传  partId 零件id
+     *    blongType  为3 以下的file和dwgType参数均不需要传递
      * file 文件信息,dwgType 图档类型0-2D,1-3D(上传零件文档和模具文档时传该参数)
      *
      * @return
@@ -63,7 +64,7 @@ public class MouldFileController {
     @ResponseBody
     public HttpRespMsg uploadFile(@RequestParam(required = false) MultipartFile file,@RequestParam(required = false) MultipartFile file2,@RequestParam(required = false, defaultValue = "0") Integer blongType,
                                   HttpServletResponse response, HttpServletRequest request, UserVO userVO) throws Exception {
-        System.out.println("开始上传文件" + "file+" + file.getOriginalFilename());
+//        System.out.println("开始上传文件" + "file+" + file.getOriginalFilename());
         HttpRespMsg msg = new HttpRespMsg();
         msg = mouldFileService.addFile(userVO,blongType, file,file2, path);
         return msg;

+ 153 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/InvitationRecord.java

@@ -0,0 +1,153 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-20
+ */
+@TableName("tb_invitation_record")
+public class InvitationRecord extends Model<InvitationRecord> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 项目邀请人员记录表主键
+     */
+    @TableField("id")
+    private Integer id;
+
+    /**
+     * 操作者
+     */
+    @TableField("operator_id")
+    private Integer operatorId;
+
+    /**
+     * 操作者名字
+     */
+    @TableField("operator")
+    private String operator;
+
+    /**
+     * 被邀请者id
+     */
+    @TableField("invitee_id")
+    private Integer inviteeId;
+
+    /**
+     * 被邀请者名字
+     */
+    @TableField("invitee")
+    private String invitee;
+
+    /**
+     * 链接地址
+     */
+    @TableField("address_url")
+    private String addressUrl;
+
+    /**
+     * 邀请时间
+     */
+    @TableField("indate")
+    private LocalDateTime indate;
+
+    /**
+     * 项目id
+     */
+    @TableField("project_id")
+    private Integer projectId;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getOperatorId() {
+        return operatorId;
+    }
+
+    public void setOperatorId(Integer operatorId) {
+        this.operatorId = operatorId;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public Integer getInviteeId() {
+        return inviteeId;
+    }
+
+    public void setInviteeId(Integer inviteeId) {
+        this.inviteeId = inviteeId;
+    }
+
+    public String getInvitee() {
+        return invitee;
+    }
+
+    public void setInvitee(String invitee) {
+        this.invitee = invitee;
+    }
+
+    public String getAddressUrl() {
+        return addressUrl;
+    }
+
+    public void setAddressUrl(String addressUrl) {
+        this.addressUrl = addressUrl;
+    }
+
+    public LocalDateTime getIndate() {
+        return indate;
+    }
+
+    public void setIndate(LocalDateTime indate) {
+        this.indate = indate;
+    }
+
+    public Integer getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(Integer projectId) {
+        this.projectId = projectId;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return "InvitationRecord{" +
+        "id=" + id +
+        ", operatorId=" + operatorId +
+        ", operator=" + operator +
+        ", inviteeId=" + inviteeId +
+        ", invitee=" + invitee +
+        ", addressUrl=" + addressUrl +
+        ", indate=" + indate +
+        ", projectId=" + projectId +
+        "}";
+    }
+}

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

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

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

@@ -0,0 +1,19 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.InvitationRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-20
+ */
+public interface InvitationRecordService extends IService<InvitationRecord> {
+
+    HttpRespMsg add(InvitationRecord invitationRecord);
+}

+ 32 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/InvitationRecordServiceImpl.java

@@ -0,0 +1,32 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.hssx.cloudmodel.entity.InvitationRecord;
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import com.hssx.cloudmodel.mapper.InvitationRecordMapper;
+import com.hssx.cloudmodel.service.InvitationRecordService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-20
+ */
+@Service
+public class InvitationRecordServiceImpl extends ServiceImpl<InvitationRecordMapper, InvitationRecord> implements InvitationRecordService {
+
+    @Resource
+    InvitationRecordMapper invitationRecordMapper;
+    @Override
+    public HttpRespMsg add(InvitationRecord invitationRecord) {
+        HttpRespMsg msg = new HttpRespMsg();
+
+        return null;
+    }
+}

+ 13 - 5
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldServiceImpl.java

@@ -434,7 +434,6 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
                         set.add(projectUser.getProjectId());
                     }
                 }
-
             }
             moulds = mouldMapper.selectList(new QueryWrapper<Mould>().in("project_id", set).eq("state", 3));
             msg.data = moulds;
@@ -453,12 +452,21 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
             m.setId(mould.getId());
             m.setEquipmentId(mould.getEquipmentId());
             mouldMapper.updateById(m);
-            projectMapper.selectOne(new QueryWrapper<>());
-            //通知资产方管理员
+            Mould mou = mouldMapper.selectById(mould.getId());
+            Project project = projectMapper.selectById(mou.getProjectId());
+            //添加通知消息
             NewsNotice newsNotice = new NewsNotice();
+            newsNotice.setNoticeType(Constant.EMERGENCY_TYPE);
+            newsNotice.setProjectName(project.getProjectName());
+            newsNotice.setRefId(mould.getId());
+            newsNotice.setContent(mou.getModelNo()+"-"+Constant.EMERGENCY_NOTICE);
+            newsNoticeMapper.insert(newsNotice);
+            //通知该模具所属资产方的管理员
             User user = userMapper.selectOne(new QueryWrapper<User>().eq("company_id", mould.getCompanyId()).eq("parent_id", 1));
-
-            newsNotice.setContent("111");
+            NewsNoticeUser newsNoticeUser = new NewsNoticeUser();
+            newsNoticeUser.setNewsId(newsNotice.getId());
+            newsNoticeUser.setUserId(user.getId());
+            newsNoticeUserMapper.insert(newsNoticeUser);
         } else {
             msg.setError("用户不存在或未登录");
         }

+ 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_operation_dynamics");
+        strategy.setInclude("tb_invitation_record");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 22 - 0
cloud-model/src/main/resources/mapper/InvitationRecordMapper.xml

@@ -0,0 +1,22 @@
+<?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.InvitationRecordMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.InvitationRecord">
+        <result column="id" property="id" />
+        <result column="operator_id" property="operatorId" />
+        <result column="operator" property="operator" />
+        <result column="invitee_id" property="inviteeId" />
+        <result column="invitee" property="invitee" />
+        <result column="address_url" property="addressUrl" />
+        <result column="indate" property="indate" />
+        <result column="project_id" property="projectId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, operator_id, operator, invitee_id, invitee, address_url, indate, project_id
+    </sql>
+
+</mapper>