Procházet zdrojové kódy

员工管理所在分部字段调整

Joburgess před 5 roky
rodič
revize
a898a0ea42

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/DemoGroupCoursesPlanDao.java

@@ -2,8 +2,19 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.DemoGroupCoursesPlan;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
 
 public interface DemoGroupCoursesPlanDao extends BaseDAO<Long, DemoGroupCoursesPlan> {
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/9/25
+     * 根据上课时间批量记录临时上课计划
+     */
+    int batchInsertByDates(@Param("dates") List<Date> dates,
+                           @Param("demoGroupId") Long demoGroupId);
 	
 }

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/DemoGroupApplyDto.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.DemoGroup;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/25
+ */
+public class DemoGroupApplyDto extends DemoGroup {
+
+    private List<Date> courseDates;
+
+    public List<Date> getCourseDates() {
+        return courseDates;
+    }
+
+    public void setCourseDates(List<Date> courseDates) {
+        this.courseDates = courseDates;
+    }
+}

+ 9 - 9
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Employee.java

@@ -17,8 +17,8 @@ public class Employee extends SysUser {
 	private Integer userId;
 	
 	/**  */
-	@ApiModelProperty(value = "机构编号",required = false)
-	private Integer organId;
+	@ApiModelProperty(value = "机构编号列表,逗号分隔",required = false)
+	private String organIdList;
 	
 	/** 工作性质(兼职、全职、临时) */
 	@ApiModelProperty(value = "工作性质",required = false)
@@ -73,15 +73,15 @@ public class Employee extends SysUser {
 	public Integer getUserId(){
 		return this.userId;
 	}
-			
-	public void setOrganId(Integer organId){
-		this.organId = organId;
+
+	public String getOrganIdList() {
+		return organIdList;
 	}
-	
-	public Integer getOrganId(){
-		return this.organId;
+
+	public void setOrganIdList(String organIdList) {
+		this.organIdList = organIdList;
 	}
-			
+
 	public void setEducationBackground(String educationBackground){
 		this.educationBackground = educationBackground;
 	}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/DemoGroupService.java

@@ -1,8 +1,16 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.DemoGroupApplyDto;
 import com.ym.mec.biz.dal.entity.DemoGroup;
 import com.ym.mec.common.service.BaseService;
 
 public interface DemoGroupService extends BaseService<Long, DemoGroup> {
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/9/25
+     * 试听课申请
+     */
+    void demoGroupApply(DemoGroupApplyDto demoGroupApplyDto);
+
 }

+ 47 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/DemoGroupServiceImpl.java

@@ -1,5 +1,16 @@
 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.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.DemoGroupClassGroupMapperDao;
+import com.ym.mec.biz.dal.dao.DemoGroupCoursesPlanDao;
+import com.ym.mec.biz.dal.dto.DemoGroupApplyDto;
+import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.DemoGroupClassGroupMapper;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -14,10 +25,45 @@ public class DemoGroupServiceImpl extends BaseServiceImpl<Long, DemoGroup>  impl
 	
 	@Autowired
 	private DemoGroupDao demoGroupDao;
+	@Autowired
+	private ClassGroupDao classGroupDao;
+	@Autowired
+	private DemoGroupClassGroupMapperDao demoGroupClassGroupMapperDao;
+	@Autowired
+	private DemoGroupCoursesPlanDao demoGroupCoursesPlanDao;
+
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
 
 	@Override
 	public BaseDAO<Long, DemoGroup> getDAO() {
 		return demoGroupDao;
 	}
-	
+
+	@Override
+	public void demoGroupApply(DemoGroupApplyDto demoGroupApplyDto) {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		demoGroupApplyDto.setUserId(user.getId());
+		demoGroupDao.insert(demoGroupApplyDto);
+		ClassGroup classGroup=new ClassGroup();
+		classGroup.setName(demoGroupApplyDto.getName());
+		classGroup.setType(ClassGroupTypeEnum.DEMO);
+		classGroup.setDelFlag(YesOrNoEnum.NO);
+		classGroupDao.insert(classGroup);
+		DemoGroupClassGroupMapper demoGroupClassGroupMapper=new DemoGroupClassGroupMapper();
+		demoGroupClassGroupMapper.setDemoGroupId(demoGroupApplyDto.getId());
+		demoGroupClassGroupMapper.setClassGroupId(classGroup.getId());
+		demoGroupClassGroupMapperDao.insert(demoGroupClassGroupMapper);
+		demoGroupCoursesPlanDao.batchInsertByDates(demoGroupApplyDto.getCourseDates(),demoGroupApplyDto.getId());
+	}
+
+	/**
+	 * @Author: Joburgess
+	 * @Date: 2019/9/25
+	 * 创建上课计划及跟新所属分部列表
+	 */
+	public void createCourseScheduleAndUpdateOrganId(Long demoGroupId){
+		DemoGroup demoGroup=demoGroupDao.get(demoGroupId);
+
+	}
 }

+ 16 - 2
mec-biz/src/main/resources/config/mybatis/DemoGroupCoursesPlanMapper.xml

@@ -24,13 +24,27 @@
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
-	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.DemoGroupCoursesPlan" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+	<insert id="batchInsertByDates" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		<!--
 		<selectKey resultClass="int" keyProperty="id" > 
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO demo_group_courses_plan (id_,demo_group_id_,courses_start_time_,create_time_) VALUES(#{id},#{demoGroupId},#{coursesStartTime},#{createTime})
+		INSERT INTO demo_group_courses_plan (demo_group_id_,courses_start_time_,create_time_)
+		VALUE
+		<foreach collection="dates" item="date" separator=",">
+			(#{demoGroupId},#{date},now())
+		</foreach>
+	</insert>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.DemoGroupCoursesPlan" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" >
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
+		</selectKey>
+		-->
+		INSERT INTO demo_group_courses_plan (id_,demo_group_id_,courses_start_time_,create_time_) VALUES(#{id},#{demoGroupId},#{coursesStartTime},now())
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml

@@ -8,7 +8,7 @@
 
 	<resultMap type="com.ym.mec.biz.dal.entity.Employee" id="Employee">
 		<result column="user_id_" property="userId" />
-		<result column="organ_id_" property="organId" />
+		<result column="organ_id_list" property="organIdList" />
 		<result column="job_nature_" property="jobNature" />
 		<result column="is_probation_period_" property="isProbationPeriod" />
 		<result column="education_background_" property="educationBackground" />
@@ -40,7 +40,7 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO employee (user_id_,organ_id_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,entry_date_,certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_) VALUES(#{userId},#{organId},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},#{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},#{updateTime},#{createTime},#{introduction},#{demissionDate})
+		INSERT INTO employee (user_id_,organ_id_list,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,entry_date_,certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_) VALUES(#{userId},#{organIdList},#{jobNature},#{isProbationPeriod},#{educationBackground},#{graduateSchool},#{technicalTitles},#{entryDate},#{certificateType},#{certificateNum},#{updateTime},#{createTime},#{introduction},#{demissionDate})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -53,7 +53,7 @@
         graduate_school_ = #{graduateSchool},
         </if>
         <if test="organId != null">
-        organ_id_ = #{organId},
+            organ_id_list = #{organIdList},
         </if>
         <if test="introduction != null">
         introduction_ = #{introduction},

+ 33 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/DemoGroupController.java

@@ -0,0 +1,33 @@
+package com.ym.mec.teacher.controller;
+
+import com.ym.mec.biz.dal.dto.DemoGroupApplyDto;
+import com.ym.mec.biz.service.DemoGroupService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/25
+ */
+@Api(tags = "试听课")
+@RequestMapping("demoGroup")
+@RestController
+public class DemoGroupController extends BaseController {
+
+    @Autowired
+    private DemoGroupService demoGroupService;
+
+    @ApiOperation(value = "试听课申请")
+    @PostMapping("/demoGroupApply")
+    public Object demoGroupApply(@RequestBody DemoGroupApplyDto demoGroup){
+        demoGroupService.demoGroupApply(demoGroup);
+        return succeed();
+    }
+
+}