Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

Joburgess před 5 roky
rodič
revize
fa0033b09e

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -507,4 +507,9 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      */
     List<ClassGroup> findByClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds);
 
+    List<ImGroupModel> queryStudentGroup();
+
+    List<ImGroupModel> queryTeacherGroup();
+
+    List<ImUserModel> queryImUser();
 }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherCloseDto.java

@@ -31,10 +31,10 @@ public class TeacherCloseDto {
     @ApiModelProperty(value = "当前课时")
     private Integer currentClassTimes;
 
-    @ApiModelProperty(value = "签到状态:0异常,1正常")
+    @ApiModelProperty(value = "签到状态:0异常,1正常,3未签到")
     private Integer signInStatus;
 
-    @ApiModelProperty(value = "签退状态:0异常,1正常")
+    @ApiModelProperty(value = "签退状态:0异常,1正常,3未签到")
     private Integer signOutStatus;
 
     @ApiModelProperty(value = "实际结算薪水")

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ChargeTypeOrganizationFee.java

@@ -13,12 +13,32 @@ public class ChargeTypeOrganizationFee {
 
 	private Integer organId;
 
+	private String chargeTypeName;
+
+	private String organName;
+
 	private BigDecimal courseFee;
 
 	private Date createTime;
 
 	private Date updateTime;
 
+	public String getChargeTypeName() {
+		return chargeTypeName;
+	}
+
+	public void setChargeTypeName(String chargeTypeName) {
+		this.chargeTypeName = chargeTypeName;
+	}
+
+	public String getOrganName() {
+		return organName;
+	}
+
+	public void setOrganName(String organName) {
+		this.organName = organName;
+	}
+
 	public Integer getId() {
 		return id;
 	}

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ChargeTypeOrganizationFeeService.java

@@ -12,4 +12,8 @@ public interface ChargeTypeOrganizationFeeService extends BaseService<Integer, C
      * @return
      */
     ChargeTypeOrganizationFee findByOrganId(Integer chargeTypeId, Integer organId);
+
+    void add(ChargeTypeOrganizationFee chargeTypeOrganizationFee);
+
+    void updateFee(ChargeTypeOrganizationFee chargeTypeOrganizationFee);
 }

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChargeTypeOrganizationFeeServiceImpl.java

@@ -4,9 +4,11 @@ import com.ym.mec.biz.dal.dao.ChargeTypeOrganizationFeeDao;
 import com.ym.mec.biz.dal.entity.ChargeTypeOrganizationFee;
 import com.ym.mec.biz.service.ChargeTypeOrganizationFeeService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 @Service
 public class ChargeTypeOrganizationFeeServiceImpl extends BaseServiceImpl<Integer, ChargeTypeOrganizationFee>  implements ChargeTypeOrganizationFeeService {
@@ -23,4 +25,24 @@ public class ChargeTypeOrganizationFeeServiceImpl extends BaseServiceImpl<Intege
 	public ChargeTypeOrganizationFee findByOrganId(Integer chargeTypeId, Integer organId) {
 		return chargeTypeOrganizationFeeDao.findByOrganId(chargeTypeId,organId);
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void add(ChargeTypeOrganizationFee chargeTypeOrganizationFee) {
+		try {
+			chargeTypeOrganizationFeeDao.insert(chargeTypeOrganizationFee);
+		}catch (Exception e){
+			throw new BizException("数据已存在");
+		}
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateFee(ChargeTypeOrganizationFee chargeTypeOrganizationFee) {
+		try {
+			chargeTypeOrganizationFeeDao.update(chargeTypeOrganizationFee);
+		}catch (Exception e){
+			throw new BizException("数据已存在");
+		}
+	}
 }

+ 7 - 1
mec-biz/src/main/resources/config/mybatis/ChargeTypeOrganizationFeeMapper.xml

@@ -6,6 +6,8 @@
 	<resultMap type="com.ym.mec.biz.dal.entity.ChargeTypeOrganizationFee" id="chargeTypeOrganizationFee">
 		<result column="id_" property="id" />
 		<result column="charge_type_id_" property="chargeTypeId" />
+		<result column="charge_type_name_" property="chargeTypeName" />
+		<result column="organ_name_" property="organName" />
 		<result column="organ_id_" property="organId" />
 		<result column="course_fee_" property="courseFee" />
 		<result column="create_time_" property="createTime" />
@@ -58,7 +60,11 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="chargeTypeOrganizationFee" parameterType="map">
-		SELECT * FROM charge_type_organization_fee ORDER BY ctof.create_time_ DESC
+		SELECT ctof.*,o.name_ organ_name_,ct.name_ charge_type_name_
+		FROM charge_type_organization_fee ctof
+		LEFT JOIN organization o ON o.id_ = ctof.organ_id_
+		LEFT JOIN charge_type ct ON ctof.charge_type_id_ = ct.id_
+		ORDER BY ctof.create_time_ DESC
 		<include refid="global.limit" />
 	</select>
 

+ 36 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -824,6 +824,7 @@
             AND group_type_ = #{groupType}
         GROUP BY music_group_id_,group_type_
     </select>
+
     <select id="findByClassGroupIds" resultMap="ClassGroup">
       SELECT * FROM class_group where id_ IN
       <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
@@ -831,4 +832,39 @@
       </foreach>
     </select>
 
+    <resultMap id="ImGroupModelMap" type="com.ym.mec.common.entity.ImGroupModel">
+        <result property="name" column="class_group_name_"/>
+        <result property="id" column="class_group_id_"/>
+        <collection property="members" ofType="com.ym.mec.common.entity.ImGroupMember">
+            <result property="id" column="user_id_"/>
+        </collection>
+    </resultMap>
+
+    <select id="queryStudentGroup" resultMap="ImGroupModelMap">
+        SELECT cg.name_ class_group_name_,cg.id_ class_group_id_,su.id_ user_id_
+        FROM class_group cg
+        LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
+        LEFT JOIN sys_user su ON su.id_ = cgsm.user_id_
+        WHERE su.id_ IS NOT NULL
+    </select>
+
+    <select id="queryTeacherGroup" resultMap="ImGroupModelMap">
+        SELECT cg.name_ class_group_name_,cg.id_ class_group_id_,su.id_ user_id_
+        FROM class_group cg
+        LEFT JOIN class_group_teacher_mapper cgtm ON cg.id_ = cgtm.class_group_id_
+        LEFT JOIN sys_user su ON su.id_ = cgtm.user_id_
+        WHERE su.id_ IS NOT NULL
+    </select>
+    <resultMap id="ImUserModelMap" type="com.ym.mec.common.entity.ImUserModel">
+        <result property="name" column="real_name_"/>
+        <result property="id" column="id_"/>
+        <result property="portrait" column="head_url_"/>
+    </resultMap>
+    <select id="queryImUser" resultMap="ImUserModelMap">
+        SELECT su.id_,su.real_name_,
+        IF(su.avatar_ IS NULL OR su.avatar_ = '','https://daya-online.oss-cn-beijing.aliyuncs.com/201910/RgHwgKc.jpg',su.avatar_) head_url_
+        FROM sys_user su
+        WHERE su.id_ IS NOT NULL
+    </select>
+
 </mapper>

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

@@ -137,6 +137,9 @@
             <if test="classDate != null">
                 class_date_ = #{classDate},
             </if>
+            <if test="musicGroupId != null">
+                music_group_id_ = #{musicGroupId},
+            </if>
             <if test="endClassTime != null">
                 end_class_time_ = #{endClassTime},
             </if>

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

@@ -304,7 +304,9 @@
     <select id="queryCloses" resultMap="TeacherCloseDto">
         SELECT cs.id_ course_schedule_id_,cs.class_date_,cs.start_class_time_,cg.name_ class_name_,cs.type_ class_type_,
         csts.teacher_role_,ta.current_class_times_,cg.total_class_times_,
-        ta.sign_in_status_,ta.sign_out_status_,csts.actual_salary_,csts.settlement_time_,csts.subsidy_
+        IF(ta.sign_in_status_ IS NULL,3,ta.sign_in_status_) sign_in_status_,
+        IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
+        csts.actual_salary_,csts.settlement_time_,csts.subsidy_
         FROM course_schedule cs
         LEFT JOIN course_schedule_teacher_salary csts ON cs.id_ = csts.course_schedule_id_
         LEFT JOIN teacher_attendance ta ON cs.id_ = ta.course_schedule_id_ AND ta.teacher_id_ = csts.user_id_
@@ -504,12 +506,18 @@
             <if test="teacherRole != null and teacherRole != ''">
                 AND csts.teacher_role_ = #{teacherRole}
             </if>
-            <if test="signInStatus != null and signInStatus != ''">
+            <if test="signInStatus != null and signInStatus != 3">
                 AND ta.sign_in_status_ = #{signInStatus}
             </if>
-            <if test="signOutStatus != null and signOutStatus != ''">
+            <if test="signOutStatus != null and signOutStatus != 3">
                 AND ta.sign_out_status_ = #{signOutStatus}
             </if>
+            <if test="signOutStatus != null and signOutStatus = 3">
+                AND ta.sign_out_status_ IS NULL
+            </if>
+            <if test="signInStatus != null and signInStatus = 3">
+                AND ta.sign_in_status_ IS NULL
+            </if>
         </where>
     </sql>
 

+ 2 - 2
mec-im/src/main/java/com/ym/controller/GroupController.java

@@ -58,8 +58,8 @@ public class GroupController{
     }
 
     @RequestMapping(value = "/batchCreate", method = RequestMethod.POST)
-    public Object batchCreate(@RequestBody List<GroupModel> groupModels) throws Exception {
-        return groupService.batchCreate(groupModels);
+    public Object batchCreate() throws Exception {
+        return groupService.batchCreate();
     }
 
     @RequestMapping(value = "/get", method = RequestMethod.POST)

+ 2 - 9
mec-im/src/main/java/com/ym/controller/UserController.java

@@ -26,15 +26,8 @@ public class UserController {
     }
 
     @RequestMapping(value = "/batchRegister", method = RequestMethod.POST)
-    public Object register(@RequestBody List<UserModel> userModels){
-        userModels.forEach(e->{
-            try {
-                userService.register(e);
-            } catch (Exception e1) {
-                e1.printStackTrace();
-            }
-        });
-        return null;
+    public Object batchRegister(){
+        return userService.batchRegister();
     }
 
     @RequestMapping(value = "/update", method = RequestMethod.POST)

+ 1 - 2
mec-im/src/main/java/com/ym/service/GroupService.java

@@ -59,8 +59,7 @@ public interface GroupService {
 
     /**
      * 初始化群数据
-     * @param groupModels
      * @return
      */
-    Result batchCreate(List<GroupModel> groupModels);
+    Result batchCreate();
 }

+ 19 - 3
mec-im/src/main/java/com/ym/service/Impl/GroupServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ym.service.Impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.service.GroupService;
 import io.rong.RongCloud;
 import io.rong.methods.conversation.Conversation;
@@ -12,6 +15,7 @@ import io.rong.models.conversation.ConversationModel;
 import io.rong.models.group.GroupModel;
 import io.rong.models.group.UserGroup;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -26,6 +30,9 @@ public class GroupServiceImpl implements GroupService {
     @Value("${cn.rongcloud.im.secret}")
     private String appSecret;
 
+    @Autowired
+    private ClassGroupDao classGroupDao;
+
     private Group getGroup(){
         RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret);
         return new Group(appKey,appSecret,rongCloud);
@@ -145,9 +152,18 @@ public class GroupServiceImpl implements GroupService {
     }
 
     @Override
-    public Result batchCreate(List<GroupModel> groupModels) {
-
-//        return getGroup().create();
+    public Result batchCreate() {
+        List<ImGroupModel> studentGroup = classGroupDao.queryStudentGroup();
+        List<ImGroupModel> teacherGroup = classGroupDao.queryTeacherGroup();
+        studentGroup.addAll(teacherGroup);
+        List<GroupModel> groupModels1 = JSONObject.parseArray(JSONObject.toJSONString(studentGroup), GroupModel.class);
+        groupModels1.forEach(e->{
+            try {
+                getGroup().join(e);
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        });
         return null;
     }
 }

+ 14 - 0
mec-im/src/main/java/com/ym/service/Impl/UserServiceImpl.java

@@ -1,6 +1,9 @@
 package com.ym.service.Impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.ym.dao.UserDao;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.im.IMHelper;
 import com.ym.service.UserService;
 import io.rong.RongCloud;
@@ -23,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * Created by weiqinxiao on 2019/2/25.
  */
@@ -35,6 +40,8 @@ public class UserServiceImpl implements UserService {
     private String appSecret;
     @Autowired
     UserDao userDao;
+    @Autowired
+    private ClassGroupDao classGroupDao;
 
     @Autowired
     IMHelper imHelper;
@@ -148,4 +155,11 @@ public class UserServiceImpl implements UserService {
     public Result muteChatroomsGetList() throws Exception {
         return getMuteChatrooms().getList();
     }
+
+    @Override
+    public Result batchRegister() {
+        List<ImUserModel> userModels = classGroupDao.queryImUser();
+        List<UserModel> userModelList = JSONObject.parseArray(JSONObject.toJSONString(userModels), UserModel.class);
+        return null;
+    }
 }

+ 2 - 0
mec-im/src/main/java/com/ym/service/UserService.java

@@ -61,4 +61,6 @@ public interface UserService {
     Result muteChatroomsRemove(ChatroomModel chatroomModel) throws Exception;
 
     Result muteChatroomsGetList() throws Exception;
+
+    Result batchRegister();
 }

+ 4 - 2
mec-web/src/main/java/com/ym/mec/web/controller/ChargeTypeOrganizationFeeController.java

@@ -30,7 +30,8 @@ public class ChargeTypeOrganizationFeeController extends BaseController {
 	@PostMapping(value = "add")
     @PreAuthorize("@pcs.hasPermissions('chargeTypeOrganizationFee/add')")
 	public Object add(ChargeTypeOrganizationFee chargeTypeOrganizationFee) {
-		return succeed(chargeTypeOrganizationFeeService.insert(chargeTypeOrganizationFee));
+		chargeTypeOrganizationFeeService.add(chargeTypeOrganizationFee);
+		return succeed();
 	}
 
 	@ApiOperation(value = "获取收费类型分部关联的默认课程费用")
@@ -52,7 +53,8 @@ public class ChargeTypeOrganizationFeeController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('chargeTypeOrganizationFee/update')")
 	public Object update(ChargeTypeOrganizationFee chargeTypeOrganizationFee) {
 		chargeTypeOrganizationFee.setUpdateTime(new Date());
-		return succeed(chargeTypeOrganizationFeeService.update(chargeTypeOrganizationFee));
+		chargeTypeOrganizationFeeService.updateFee(chargeTypeOrganizationFee);
+		return succeed();
 	}
 
 	@ApiOperation(value = "分页查询")