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
3d1fb1bd31

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

@@ -18,6 +18,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 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 java.util.List;
@@ -44,18 +45,18 @@ public class MouldController {
      * 修改参数:id 模具id, settingLife 使用年限, initialModulus 初始模次 equipmentId 设备id,
      * produceCompanyId 生产方公司id,ocCycle 每模平均周期,rfid rfid码,maintainCount 保养设定次数:"1,2,3"
      *
-     * 模具更新时多传的参数  preUpdateId 要被更新的模具的id
+     * 模具更新时多传的参数  preUpdateId 要被更新的模具的id dynamicId
      * @return
      */
     @ApiOperation("添加/修改模具")
     @RequestMapping("/addOrUpdate")
     @ResponseBody
-    public HttpRespMsg addOrUpdate(Mould mould, String token) {
+    public HttpRespMsg addOrUpdate(Mould mould, String token, @RequestParam("dynamicId") Integer dynamicId) {
         HttpRespMsg msg = new HttpRespMsg();
         QueryWrapper<User> qw = new QueryWrapper<>();
         qw.eq("head_imgurl",token);
         User user = userService.getOne(qw);
-        msg = mouldService.addAndUpdateMould(mould,user);
+        msg = mouldService.addAndUpdateMould(mould,user,dynamicId);
         return msg;
     }
 

+ 16 - 4
cloud-model/src/main/java/com/hssx/cloudmodel/entity/MouldOperationDynamics.java

@@ -6,8 +6,6 @@ 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;
 
 /**
@@ -16,7 +14,7 @@ import java.io.Serializable;
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-08-20
+ * @since 2019-08-21
  */
 @TableName("tb_mould_operation_dynamics")
 public class MouldOperationDynamics extends Model<MouldOperationDynamics> {
@@ -51,7 +49,6 @@ public class MouldOperationDynamics extends Model<MouldOperationDynamics> {
      * 操作的时间
      */
     @TableField("indate")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime indate;
 
     /**
@@ -96,6 +93,12 @@ public class MouldOperationDynamics extends Model<MouldOperationDynamics> {
     @TableField("applicant_name")
     private String applicantName;
 
+    /**
+     * 是否已经更新过模具0-否 ,1-是(只对更新模具有效)
+     */
+    @TableField("is_update")
+    private Integer isUpdate;
+
 
     public Integer getId() {
         return id;
@@ -193,6 +196,14 @@ public class MouldOperationDynamics extends Model<MouldOperationDynamics> {
         this.applicantName = applicantName;
     }
 
+    public Integer getIsUpdate() {
+        return isUpdate;
+    }
+
+    public void setIsUpdate(Integer isUpdate) {
+        this.isUpdate = isUpdate;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -213,6 +224,7 @@ public class MouldOperationDynamics extends Model<MouldOperationDynamics> {
         ", isPass=" + isPass +
         ", applicantId=" + applicantId +
         ", applicantName=" + applicantName +
+        ", isUpdate=" + isUpdate +
         "}";
     }
 }

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

@@ -17,7 +17,7 @@ import com.hssx.cloudmodel.util.HttpRespMsg;
  */
 public interface MouldService extends IService<Mould> {
 
-    HttpRespMsg addAndUpdateMould(Mould mould, User user);
+    HttpRespMsg addAndUpdateMould(Mould mould, User user,Integer dynamicId);
 
     HttpRespMsg getMoildDetail(MouldVO mould);
 

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

@@ -19,6 +19,7 @@ import com.hssx.cloudmodel.util.WechatTemplateMessage;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
@@ -56,9 +57,11 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
     NewsNoticeMapper newsNoticeMapper;
     @Resource
     NewsNoticeUserMapper newsNoticeUserMapper;
+    @Resource
+    MouldOperationDynamicsMapper mouldOperationDynamicsMapper;
 
     @Override
-    public HttpRespMsg addAndUpdateMould(Mould mould, User user) {
+    public HttpRespMsg addAndUpdateMould(Mould mould, User user,Integer dynamicId) {
         HttpRespMsg msg = new HttpRespMsg();
         if (mould.getId() != null) {
             //修改
@@ -80,6 +83,13 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
                 //更新模具操作
                 //取出之前模具的信息
                 Mould model = mouldMapper.selectById(mould.getPreUpdateId());
+                if(null != dynamicId){
+                    //更新模具更新的动态为已更新
+                    MouldOperationDynamics mouldOperationDynamics = new MouldOperationDynamics();
+                    mouldOperationDynamics.setId(dynamicId);
+                    mouldOperationDynamics.setIsUpdate(1);
+                    mouldOperationDynamicsMapper.updateById(mouldOperationDynamics);
+                }
                 //查询当前模具编号的模具是否存在
 //                    if (mould.getProduceCompanyId() != null) {
 //                        Company company = companyMapper.selectById(mould.getProduceCompanyId());

+ 4 - 3
cloud-model/src/main/resources/mapper/MouldOperationDynamicsMapper.xml

@@ -16,11 +16,12 @@
         <result column="is_pass" property="isPass" />
         <result column="applicant_id" property="applicantId" />
         <result column="applicant_name" property="applicantName" />
+        <result column="is_update" property="isUpdate" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, file_id, operator_id, operator_name, indate, file_name, belong_type, content, mould_id, is_pass, applicant_id, applicant_name
+        id, file_id, operator_id, operator_name, indate, file_name, belong_type, content, mould_id, is_pass, applicant_id, applicant_name, is_update
     </sql>
     <select id="selectOperationDynamicsList">
         select
@@ -28,7 +29,7 @@
         from
         tb_mould_operation_dynamics
         where
-          mould_id
-          indate between #{startTime} and #{endTime}
+        mould_id
+        indate between #{startTime} and #{endTime}
     </select>
 </mapper>