Explorar o código

零件的添加与修改

%!s(int64=5) %!d(string=hai) anos
pai
achega
f2c4d5988a

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

@@ -127,5 +127,16 @@ public class MouldController {
         HttpRespMsg msg = mouldService.maintenanceReminder();
         HttpRespMsg msg = mouldService.maintenanceReminder();
         return msg;
         return msg;
     }
     }
+    /**
+     * 是否开启模具保养提醒
+     * 参数 isMaintain 是否开启保养 0-是 1-否
+     */
+    @ApiOperation("模具保养提醒")
+    @RequestMapping("/isMaintain")
+    @ResponseBody
+    public HttpRespMsg isMaintain(Mould mould) throws Exception {
+        HttpRespMsg msg = mouldService.isMaintain(mould);
+        return msg;
+    }
 }
 }
 
 

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldMaintainController.java

@@ -41,7 +41,7 @@ public class MouldMaintainController {
      *
      *
      * 模具保养
      * 模具保养
      * file 文件,token 用户身份凭证 ,mouldId 模具id,maintainType 保养类型 0-动作 1-易损件
      * file 文件,token 用户身份凭证 ,mouldId 模具id,maintainType 保养类型 0-动作 1-易损件
-     * 方式 :ways isMaintain 是否需要保养 0-不需要 1-需要
+     * 方式 :ways
      * (0-喷漆 1-检查 )==》对应maintainType 保养类型 选择了0-动作
      * (0-喷漆 1-检查 )==》对应maintainType 保养类型 选择了0-动作
      * (2-易损件) ==》对应maintainType 保养类型 选择了1-动作 (此时ways传易损件的id)
      * (2-易损件) ==》对应maintainType 保养类型 选择了1-动作 (此时ways传易损件的id)
      * @return
      * @return

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/controller/VnoticeUserController.java

@@ -33,7 +33,7 @@ public class VnoticeUserController {
 
 
     /**
     /**
      * 消息通知列表
      * 消息通知列表
-     * 默认显示五条的参数:token 登陆者的用户凭证,
+     * 默认显示五条的参数:token 登陆者的用户凭证, pageNum 1,pageSize 5,
      * 查看全部时传的参数:token 登陆者的用户凭证,pageNum 当前页码,pageSize 每页条数,
      * 查看全部时传的参数:token 登陆者的用户凭证,pageNum 当前页码,pageSize 每页条数,
      * @return
      * @return
      */
      */

+ 13 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/Mould.java

@@ -158,6 +158,11 @@ public class Mould extends Model<Mould> {
      */
      */
     @TableField("run_times")
     @TableField("run_times")
     private Integer runTimes;
     private Integer runTimes;
+    /**
+     * 保养提醒 0-提醒,1-不提醒
+     */
+    @TableField("is_maintain")
+    private Integer isMaintain;
 
 
 
 
     public Integer getId() {
     public Integer getId() {
@@ -344,6 +349,14 @@ public class Mould extends Model<Mould> {
         this.runTimes = runTimes;
         this.runTimes = runTimes;
     }
     }
 
 
+    public Integer getIsMaintain() {
+        return isMaintain;
+    }
+
+    public void setIsMaintain(Integer isMaintain) {
+        this.isMaintain = isMaintain;
+    }
+
     @Override
     @Override
     protected Serializable pkVal() {
     protected Serializable pkVal() {
         return this.id;
         return this.id;

+ 0 - 15
cloud-model/src/main/java/com/hssx/cloudmodel/entity/MouldMaintain.java

@@ -75,12 +75,6 @@ public class MouldMaintain extends Model<MouldMaintain> {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime indate;
     private LocalDateTime indate;
 
 
-    /**
-     * 是否需要保养0-不需要 1-需要
-     */
-    @TableField("is_maintain")
-    private Integer isMaintain;
-
     /**
     /**
      * 文件大小
      * 文件大小
      */
      */
@@ -166,14 +160,6 @@ public class MouldMaintain extends Model<MouldMaintain> {
         this.indate = indate;
         this.indate = indate;
     }
     }
 
 
-    public Integer getIsMaintain() {
-        return isMaintain;
-    }
-
-    public void setIsMaintain(Integer isMaintain) {
-        this.isMaintain = isMaintain;
-    }
-
     public String getFileSize() {
     public String getFileSize() {
         return fileSize;
         return fileSize;
     }
     }
@@ -207,7 +193,6 @@ public class MouldMaintain extends Model<MouldMaintain> {
         ", maintainUserId=" + maintainUserId +
         ", maintainUserId=" + maintainUserId +
         ", maintainUserName=" + maintainUserName +
         ", maintainUserName=" + maintainUserName +
         ", indate=" + indate +
         ", indate=" + indate +
-        ", isMaintain=" + isMaintain +
         ", fileSize=" + fileSize +
         ", fileSize=" + fileSize +
         ", projectId=" + projectId +
         ", projectId=" + projectId +
         "}";
         "}";

+ 2 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/MouldService.java

@@ -23,4 +23,6 @@ public interface MouldService extends IService<Mould> {
     HttpRespMsg maintenanceReminder() throws Exception;
     HttpRespMsg maintenanceReminder() throws Exception;
 
 
     HttpRespMsg delMoule(Mould mould);
     HttpRespMsg delMoule(Mould mould);
+
+    HttpRespMsg isMaintain(Mould mould);
 }
 }

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

@@ -215,6 +215,17 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
         return msg;
         return msg;
     }
     }
 
 
+    @Override
+    public HttpRespMsg isMaintain(Mould mould) {
+        HttpRespMsg msg = new HttpRespMsg();
+        if(mould.getId() !=null){
+            mouldMapper.updateById(mould);
+        }else{
+            msg.setError("模具id不存在");
+        }
+        return msg;
+    }
+
     //告警模板推送通用接口
     //告警模板推送通用接口
 
 
     /**
     /**

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/PartServiceImpl.java

@@ -107,6 +107,7 @@ public class PartServiceImpl extends ServiceImpl<PartMapper, Part> implements Pa
                             if(Integer.parseInt(value)<mould.getSettingLife()){
                             if(Integer.parseInt(value)<mould.getSettingLife()){
                                 part.setIsVulnerable(1);
                                 part.setIsVulnerable(1);
                             }
                             }
+                            part.setPartLife(Integer.parseInt(value));
                         }
                         }
                     }
                     }
                     part.setCreatorId(user.getId());
                     part.setCreatorId(user.getId());

+ 15 - 4
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/VnoticeUserServiceImpl.java

@@ -20,7 +20,9 @@ import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -40,18 +42,27 @@ public class VnoticeUserServiceImpl extends ServiceImpl<VnoticeUserMapper, Vnoti
 
 
     @Resource
     @Resource
     UserMapper userMapper;
     UserMapper userMapper;
+
     @Override
     @Override
     public HttpRespMsg pageList(PageUtil page, String token) {
     public HttpRespMsg pageList(PageUtil page, String token) {
         HttpRespMsg msg = new HttpRespMsg();
         HttpRespMsg msg = new HttpRespMsg();
         List<VnoticeUser> list = new ArrayList<>();
         List<VnoticeUser> list = new ArrayList<>();
-        User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl",token));
-        if(user != null){
+        User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", token));
+        if (user != null) {
             //加载全部
             //加载全部
-            PageHelper.startPage(page.getPageNum(),page.getPageSize());
+            PageHelper.startPage(page.getPageNum(), page.getPageSize());
             list = vnoticeUserMapper.selectList(new QueryWrapper<VnoticeUser>().eq("user_id", user.getId()).orderByDesc("id"));
             list = vnoticeUserMapper.selectList(new QueryWrapper<VnoticeUser>().eq("user_id", user.getId()).orderByDesc("id"));
+            Integer count = vnoticeUserMapper.selectCount(new QueryWrapper<VnoticeUser>().eq("user_id", user.getId()).eq("is_read", 0));
+            boolean isReadPoint = false;
+            if (count > 0) {
+                isReadPoint = true;
+            }
             PageInfo<VnoticeUser> pageInfo = new PageInfo<VnoticeUser>(list);
             PageInfo<VnoticeUser> pageInfo = new PageInfo<VnoticeUser>(list);
+            Map<String,Object> map = new HashMap<>();
+            map.put("list",pageInfo);
+            map.put("list",pageInfo);
             msg.data = pageInfo;
             msg.data = pageInfo;
-        }else{
+        } else {
             msg.setError("用户不存在或者未登录");
             msg.setError("用户不存在或者未登录");
         }
         }
         return msg;
         return msg;

+ 2 - 3
cloud-model/src/main/resources/mapper/MouldMaintainMapper.xml

@@ -13,20 +13,19 @@
         <result column="maintain_user_id" property="maintainUserId" />
         <result column="maintain_user_id" property="maintainUserId" />
         <result column="maintain_user_name" property="maintainUserName" />
         <result column="maintain_user_name" property="maintainUserName" />
         <result column="indate" property="indate" />
         <result column="indate" property="indate" />
-        <result column="is_maintain" property="isMaintain" />
         <result column="file_size" property="fileSize" />
         <result column="file_size" property="fileSize" />
         <result column="project_id" property="projectId" />
         <result column="project_id" property="projectId" />
     </resultMap>
     </resultMap>
 
 
     <!-- 通用查询结果列 -->
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
-        id, mould_id, maintain_type, ways, file_name, file_url, maintain_user_id, maintain_user_name, indate, is_maintain, file_size, project_id
+        id, mould_id, maintain_type, ways, file_name, file_url, maintain_user_id, maintain_user_name, indate, file_size, project_id
     </sql>
     </sql>
 
 
     <select id="selectListByProject" resultMap="BaseResultMap">
     <select id="selectListByProject" resultMap="BaseResultMap">
         select
         select
           id, mould_id, maintain_type, ways, file_name, file_url,
           id, mould_id, maintain_type, ways, file_name, file_url,
-          maintain_user_id, maintain_user_name, indate, is_maintain, file_size, project_id
+          maintain_user_id, maintain_user_name, indate, file_size, project_id
         from
         from
           tb_mould_maintain
           tb_mould_maintain
         <where>
         <where>

+ 1 - 0
cloud-model/src/main/resources/mapper/MouldMapper.xml

@@ -27,6 +27,7 @@
         <result column="belong_project_grade" property="belongProjectGrade" />
         <result column="belong_project_grade" property="belongProjectGrade" />
         <result column="produce_company_id" property="produceCompanyId" />
         <result column="produce_company_id" property="produceCompanyId" />
         <result column="run_times" property="runTimes" />
         <result column="run_times" property="runTimes" />
+        <result column="is_maintain" property="isMaintain" />
     </resultMap>
     </resultMap>
 
 
     <!-- 通用查询结果列 -->
     <!-- 通用查询结果列 -->

+ 5 - 2
cloud-model/src/main/resources/mapper/PartMapper.xml

@@ -36,9 +36,12 @@
     </sql>
     </sql>
     <select id="selectPartFileByMouldId" resultMap="BaseResultMapVO">
     <select id="selectPartFileByMouldId" resultMap="BaseResultMapVO">
         select
         select
-          id, part_no, part_name, indate, part_life, is_vulnerable, creator_id, creator, mould_id
+          tbp.id, tbp.part_no, tbp.part_name, tbmf.indate, tbp.part_life, tbp.is_vulnerable, tbp.creator_id, tbp.creator, tbp.mould_id
         from
         from
-          tb_mould_file
+          tb_part tbp
+        left join
+          tb_mould_file tbmf
+        on  tbmf.part_id = tbp.id
         where
         where
           mould_id = #{userVO.mouldId}
           mould_id = #{userVO.mouldId}
     </select>
     </select>