Joburgess 5 年之前
父节点
当前提交
fad97b4165

+ 2 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/EmployeeController.java

@@ -41,6 +41,8 @@ public class EmployeeController extends BaseController {
 	@ApiOperation("新增员工")
 	@PostMapping(value = "/add")
 	public HttpResponseResult add(Employee employee) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		employee.setOrganId(sysUser.getId());
 		employeeService.add(employee);
 		return succeed();
 	}

+ 8 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamTeacherSalaryController.java

@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -34,6 +35,9 @@ public class ExamTeacherSalaryController extends BaseController {
     @ApiOperation("新增")
     @PostMapping(value = "/add")
     public HttpResponseResult add(ExamTeacherSalary examTeacherSalary) {
+        examTeacherSalary.setTotalInvigilationNum(0);
+        examTeacherSalary.setTotalInvigilationStudentNum(0);
+        examTeacherSalary.setTotalSettlementCost(BigDecimal.ZERO);
         examTeacherSalaryService.insert(examTeacherSalary);
         return succeed();
     }
@@ -47,9 +51,10 @@ public class ExamTeacherSalaryController extends BaseController {
     }
 
     @ApiOperation("删除")
-    @PostMapping(value = "/del/{id}")
-    public HttpResponseResult add(@PathVariable("id") Long id) {
-        return succeed(examTeacherSalaryService.delete(id));
+    @PostMapping(value = "/del")
+    public HttpResponseResult add(Long id) {
+        examTeacherSalaryService.deleteExamTeacherSalary(id);
+        return succeed();
     }
 
 }

+ 11 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/Employee.java

@@ -72,6 +72,8 @@ public class Employee {
 	@ApiModelProperty(value = "员工信息",required = false)
 	private SysUser sysUser;
 
+	private Integer organId;
+
 	private String tenantId;
 
 	public String getTenantId() {
@@ -217,7 +219,15 @@ public class Employee {
 	public String getPostalCode(){
 		return this.postalCode;
 	}
-			
+
+	public Integer getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(Integer organId) {
+		this.organId = organId;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 13 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamTeacherSalary.java

@@ -1,5 +1,6 @@
 package com.keao.edu.user.entity;
 
+import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.user.enums.ExamModeEnum;
 import com.keao.edu.user.enums.SettlementTypeEnum;
 import com.keao.edu.user.enums.TeacherSettlementTypeEnum;
@@ -21,9 +22,11 @@ public class ExamTeacherSalary {
 	@ApiModelProperty(value = "考试类型")
 	private ExamModeEnum examMode;
 
-	@ApiModelProperty(value = "")
+	@ApiModelProperty(value = "教室编号")
 	private Integer teacherId;
 
+	private SysUser teacher;
+
 	@ApiModelProperty(value = "结算类型(按天/人)")
 	private TeacherSettlementTypeEnum settlementType;
 
@@ -84,7 +87,15 @@ public class ExamTeacherSalary {
 	public Integer getTeacherId(){
 		return this.teacherId;
 	}
-			
+
+	public SysUser getTeacher() {
+		return teacher;
+	}
+
+	public void setTeacher(SysUser teacher) {
+		this.teacher = teacher;
+	}
+
 	public void setShareProfitAmount(java.math.BigDecimal shareProfitAmount){
 		this.shareProfitAmount = shareProfitAmount;
 	}

+ 9 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamTeacherSalaryService.java

@@ -14,4 +14,13 @@ public interface ExamTeacherSalaryService extends BaseService<Long, ExamTeacherS
      */
     void teacherSalarySettlementWithExam(Integer examId);
 
+    /**
+     * @describe 删除考级教室分润设置
+     * @author Joburgess
+     * @date 2020.07.02
+     * @param examTeacherSalaryId:
+     * @return void
+     */
+    void deleteExamTeacherSalary(Long examTeacherSalaryId);
+
 }

+ 3 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/TenantInfoService.java

@@ -5,4 +5,6 @@ import com.keao.edu.user.entity.TenantInfo;
 
 public interface TenantInfoService extends BaseService<Integer, TenantInfo> {
 
-}
+    void addTenant(TenantInfo tenantInfo);
+
+}

+ 5 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -166,11 +166,16 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(Objects.isNull(examRoomId)){
 			throw new BizException("请指定教室");
 		}
+		ExamRoom examRoom = examRoomDao.get(examRoomId);
+		if(Objects.isNull(examRoom)){
+			throw new BizException("教室不存在");
+		}
 		if(StringUtils.isBlank(studentIdsStr)){
 			return;
 		}
 		List<Integer> studentIds = Arrays.asList(studentIdsStr.split(",")).stream().map(e -> Integer.valueOf(e)).collect(Collectors.toList());
 		examRoomStudentRelationDao.deleteStudentsFromExamRoom(examRoomId, studentIds);
+		examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
 	}
 
 	@Override

+ 13 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamTeacherSalaryServiceImpl.java

@@ -1,6 +1,7 @@
 package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
@@ -81,4 +82,16 @@ public class ExamTeacherSalaryServiceImpl extends BaseServiceImpl<Long, ExamTeac
 		}
 		examTeacherSalaryDao.batchUpdate(examTeacherSalaries);
 	}
+
+	@Override
+	public void deleteExamTeacherSalary(Long examTeacherSalaryId) {
+		ExamTeacherSalary examTeacherSalary = examTeacherSalaryDao.get(examTeacherSalaryId);
+		if(Objects.isNull(examTeacherSalary)){
+			throw new BizException("教室分润设置不能存在");
+		}
+		if(examTeacherSalary.getTotalInvigilationNum()>0){
+			throw new BizException("该教室已被分配到考场");
+		}
+		examTeacherSalaryDao.delete(examTeacherSalaryId);
+	}
 }

+ 6 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/TenantInfoServiceImpl.java

@@ -18,5 +18,9 @@ public class TenantInfoServiceImpl extends BaseServiceImpl<Integer, TenantInfo>
 	public BaseDAO<Integer, TenantInfo> getDAO() {
 		return tenantInfoDao;
 	}
-	
-}
+
+	@Override
+	public void addTenant(TenantInfo tenantInfo) {
+
+	}
+}

+ 53 - 48
edu-user/edu-user-server/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -24,6 +24,7 @@
 		<result column="role_name_" property="roleName" />
 		<result column="del_flag_" property="delFlag" />
 		<result column="tenant_id_" property="tenantId" />
+		<result column="organ_id_" property="organId" />
 		<association property="sysUser" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
 	</resultMap>
 
@@ -40,59 +41,63 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.entity.Employee" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO employee (user_id_,job_nature_,education_background_,graduate_school_,technical_titles_,entry_date_,
-		certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_,contact_address_,postal_code_,tenant_id_)
+		certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_,contact_address_,postal_code_,tenant_id_,organ_id_)
 		VALUES(#{userId},#{jobNature},#{educationBackground},#{graduateSchool},#{technicalTitles},#{entryDate},#{certificateType},
-		#{certificateNum},#{updateTime},#{createTime},#{introduction},#{demissionDate},#{contactAddress},#{postalCode},#{tenantId})
+		#{certificateNum},NOW(),NOW(),#{introduction},#{demissionDate},#{contactAddress},#{postalCode},#{tenantId},#{organId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.keao.edu.user.entity.Employee">
-		UPDATE employee <set>
-		<if test="graduateSchool != null">
-		graduate_school_ = #{graduateSchool},
-		</if>
-		<if test="introduction != null">
-		introduction_ = #{introduction},
-		</if>
-		<if test="postalCode != null">
-		postal_code_ = #{postalCode},
-		</if>
-		<if test="technicalTitles != null">
-		technical_titles_ = #{technicalTitles},
-		</if>
-		<if test="entryDate != null">
-		entry_date_ = #{entryDate},
-		</if>
-		<if test="contactAddress != null">
-		contact_address_ = #{contactAddress},
-		</if>
-		<if test="jobNature != null">
-		job_nature_ = #{jobNature},
-		</if>
-		<if test="createTime != null">
-		create_time_ = #{createTime},
-		</if>
-		<if test="userId != null">
-		user_id_ = #{userId},
-		</if>
-		<if test="certificateType != null">
-		certificate_type_ = #{certificateType},
-		</if>
-		<if test="updateTime != null">
-		update_time_ = #{updateTime},
-		</if>
-		<if test="educationBackground != null">
-		education_background_ = #{educationBackground},
-		</if>
-		<if test="certificateNum != null">
-		certificate_num_ = #{certificateNum},
-		</if>
-		<if test="demissionDate != null">
-		demission_date_ = #{demissionDate},
-		</if>
-		<if test="tenantId != null">
-			tenant_id_=#{tenantId}
-		</if>
+		UPDATE employee
+		<set>
+			<if test="graduateSchool != null">
+				graduate_school_ = #{graduateSchool},
+			</if>
+			<if test="introduction != null">
+				introduction_ = #{introduction},
+			</if>
+			<if test="postalCode != null">
+				postal_code_ = #{postalCode},
+			</if>
+			<if test="technicalTitles != null">
+				technical_titles_ = #{technicalTitles},
+			</if>
+			<if test="entryDate != null">
+				entry_date_ = #{entryDate},
+			</if>
+			<if test="contactAddress != null">
+				contact_address_ = #{contactAddress},
+			</if>
+			<if test="jobNature != null">
+				job_nature_ = #{jobNature},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+			<if test="userId != null">
+				user_id_ = #{userId},
+			</if>
+			<if test="certificateType != null">
+				certificate_type_ = #{certificateType},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="educationBackground != null">
+				education_background_ = #{educationBackground},
+			</if>
+			<if test="certificateNum != null">
+				certificate_num_ = #{certificateNum},
+			</if>
+			<if test="demissionDate != null">
+				demission_date_ = #{demissionDate},
+			</if>
+			<if test="tenantId != null">
+				tenant_id_=#{tenantId},
+			</if>
+			<if test="organId != null">
+				organ_id_=#{organId},
+			</if>
 		</set> WHERE user_id_ = #{userId}
 	</update>
 	<!-- 根据主键删除一条记录 -->

+ 5 - 3
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamTeacherSalaryMapper.xml

@@ -19,7 +19,8 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
-	</resultMap>
+		<association property="teacher" columnPrefix="teacher_" resultMap="com.keao.edu.auth.dal.dao.SysUserDao.SysUser"/>
+ 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="ExamTeacherSalary" >
@@ -123,14 +124,15 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ExamTeacherSalary" parameterType="map">
-		SELECT * FROM exam_teacher_salary
+		SELECT ets.*,su.real_name_ teacher_real_name_ FROM exam_teacher_salary ets
+		LEFT JOIN sys_user su ON ets.teacher_id_=su.id_
 		<include refid="queryPageCondition"/>
 		ORDER BY id_ <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM exam_teacher_salary
+		SELECT COUNT(*) FROM exam_teacher_salary ets
 		<include refid="queryPageCondition"/>
 	</select>
     <select id="queryWithExam" resultMap="ExamTeacherSalary">