zouxuan 5 năm trước cách đây
mục cha
commit
6e747ff85e

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

@@ -102,6 +102,11 @@ public class StudentRepair {
     private Integer payStatus;
 
     /**
+    * 支付状态 0维修中,1已完成
+    */
+    private Integer repairStatus;
+
+    /**
     * 送修时间
     */
     private Date createTime;

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

@@ -2,12 +2,64 @@ package com.ym.mec.biz.dal.page;
 
 import com.ym.mec.common.page.QueryInfo;
 
+import java.util.Date;
+
 public class RepairStudentQueryInfo extends QueryInfo {
 
     private Integer employeeId;
 
     private String organIdList;
 
+    private Integer subjectId;
+
+    private Integer type;
+
+    private Integer repairStatus;
+
+    private Date startTime;
+
+    private Date endTime;
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getRepairStatus() {
+        return repairStatus;
+    }
+
+    public void setRepairStatus(Integer repairStatus) {
+        this.repairStatus = repairStatus;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
     public Integer getEmployeeId() {
         return employeeId;
     }

+ 44 - 2
mec-biz/src/main/resources/config/mybatis/StudentRepairMapper.xml

@@ -22,6 +22,7 @@
         <result column="contact_mobile_" jdbcType="VARCHAR" property="contactMobile"/>
         <result column="address_" jdbcType="VARCHAR" property="address"/>
         <result column="pay_status_" jdbcType="INTEGER" property="payStatus"/>
+        <result column="repair_status_" jdbcType="INTEGER" property="repairStatus"/>
         <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
         <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
     </resultMap>
@@ -41,7 +42,7 @@
         description_, amount_, finish_time_,
         send_type_, contact_name_, contact_mobile_,
         address_, pay_status_, create_time_,
-        update_time_)
+        update_time_,repair_status_)
         values (#{id,jdbcType=INTEGER}, #{transNo,jdbcType=VARCHAR}, #{organId,jdbcType=INTEGER},
         #{studentId,jdbcType=INTEGER}, #{studentName,jdbcType=VARCHAR}, #{studentSchool,jdbcType=VARCHAR},
         #{employeeId,jdbcType=INTEGER}, #{employeeName,jdbcType=VARCHAR}, #{subjectId,jdbcType=INTEGER},
@@ -49,7 +50,7 @@
         #{description,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{finishTime,jdbcType=TIMESTAMP},
         #{sendType,jdbcType=INTEGER}, #{contactName,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
         #{address,jdbcType=VARCHAR}, #{payStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
-        #{updateTime,jdbcType=TIMESTAMP})
+        #{updateTime,jdbcType=TIMESTAMP},#{repairStatus})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentRepair">
         <!--@mbg.generated-->
@@ -58,6 +59,9 @@
             <if test="transNo != null">
                 trans_no_ = #{transNo},
             </if>
+            <if test="repairStatus != null">
+                repair_status_ = #{repairStatus},
+            </if>
             <if test="organId != null">
                 organ_id_ = ##{organId},
             </if>
@@ -151,4 +155,42 @@
         AND mg.repair_user_id_ != #{employeeId}
         )
     </select>
+
+    <select id="queryPage" resultMap="StudentRepair">
+        SELECT * FROM student_repair sr
+        <include refid="queryPageSql"/>
+        <include refid="global.limit"/>
+    </select>
+    <sql id="queryPageSql">
+        <where>
+            <if test="search != null and search != ''">
+                AND (sr.trans_no_ LIKE CONCAT('%',#{search},'%') OR sr.student_id_ = #{search} OR sr.student_name_ LIKE CONCAT('%',#{search},'%'))
+            </if>
+            <if test="employeeId != null">
+                AND sr.employee_id_ = #{employeeId}
+            </if>
+            <if test="organIdList != null">
+                AND FIND_IN_SET(sr.organ_id_,#{organIdList})
+            </if>
+            <if test="subjectId != null">
+                AND sr.subject_id_ = #{subjectId}
+            </if>
+            <if test="type != null">
+                AND sr.type = #{type}
+            </if>
+            <if test="repairStatus != null">
+                AND sr.repair_status_ = #{repairStatus}
+            </if>
+            <if test="startTime != null">
+                AND sr.create_time_ >= #{startTime}
+            </if>
+            <if test="endTime != null">
+                AND sr.create_time_ &lt;= #{endTime}
+            </if>
+        </where>
+    </sql>
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(id_) FROM student_repair sr
+        <include refid="queryPageSql"/>
+    </select>
 </mapper>

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

@@ -0,0 +1,59 @@
+package com.ym.mec.web.controller;
+
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
+import com.ym.mec.biz.service.StudentRepairService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+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.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+@RequestMapping("studentRepair")
+@Api(tags = "维修服务")
+@RestController
+public class StudentRepairController extends BaseController {
+
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private StudentRepairService studentRepairService;
+    @Autowired
+    private EmployeeDao employeeDao;
+
+    @ApiOperation("获取维修列表")
+    @GetMapping(value = "/queryPage")
+    public HttpResponseResult queryPage(RepairStudentQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+                queryInfo.setOrganIdList(employee.getOrganIdList());
+            }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+                return failed("用户所在分部异常");
+            }else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if(!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))){
+                    return failed("非法请求");
+                }
+            }
+        }
+        return succeed(studentRepairService.queryPage(queryInfo));
+    }
+}