zouxuan 5 年之前
父節點
當前提交
ed404b63e3

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRepair.java

@@ -116,6 +116,14 @@ public class StudentRepair {
     */
     private Date updateTime;
 
+    public Integer getRepairStatus() {
+        return repairStatus;
+    }
+
+    public void setRepairStatus(Integer repairStatus) {
+        this.repairStatus = repairStatus;
+    }
+
     public Integer getId() {
         return id;
     }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/RepairStudentQueryInfo.java

@@ -12,8 +12,10 @@ public class RepairStudentQueryInfo extends QueryInfo {
 
     private Integer subjectId;
 
+    //维修类型 0-线下 1-线上
     private Integer type;
 
+    //'0维修中,1已完成'
     private Integer repairStatus;
 
     private Date startTime;

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java

@@ -13,4 +13,11 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * 根据维修技师获取相应学生列表
      */
     PageInfo<BasicUserDto> getStudents(RepairStudentQueryInfo queryInfo);
+
+    /**
+     * 维修完成
+     * @param id
+     * @param description
+     */
+    void repairSuccess(Integer id, String description);
 }

+ 29 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -1,27 +1,32 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.StudentRepairDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
 import com.ym.mec.biz.service.StudentRepairService;
+import com.ym.mec.common.config.RequestAttributeHystrixConcurrencyStrategy;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.*;
 
 @Service
 public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRepair> implements StudentRepairService {
-
+    private static final Logger log = LoggerFactory.getLogger(StudentRepairServiceImpl.class);
     @Autowired
     private StudentRepairDao studentRepairDao;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
 
     @Override
@@ -45,4 +50,22 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         pageInfo.setRows(dataList);
         return pageInfo;
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void repairSuccess(Integer id, String description) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        StudentRepair studentRepair = studentRepairDao.get(id);
+        if(studentRepair == null){
+            throw new BizException("维修信息不存在");
+        }
+        studentRepair.setRepairStatus(1);
+        studentRepair.setUpdateTime(new Date());
+        studentRepair.setDescription(description);
+        studentRepairDao.update(studentRepair);
+        log.info("操作人 :" + sysUser.getId());
+    }
 }

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentRepairController.java

@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -36,6 +37,7 @@ public class StudentRepairController extends BaseController {
 
     @ApiOperation("获取维修列表")
     @GetMapping(value = "/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('studentRepair/queryPage')")
     public HttpResponseResult queryPage(RepairStudentQueryInfo queryInfo) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
@@ -56,4 +58,13 @@ public class StudentRepairController extends BaseController {
         }
         return succeed(studentRepairService.queryPage(queryInfo));
     }
+
+
+    @ApiOperation("维修完成")
+    @GetMapping(value = "/repairSuccess")
+    @PreAuthorize("@pcs.hasPermissions('studentRepair/repairSuccess')")
+    public HttpResponseResult repairSuccess(Integer id,String description) {
+        studentRepairService.repairSuccess(id,description);
+        return succeed();
+    }
 }