Browse Source

Merge remote-tracking branch 'origin/saas' into saas

yanite 3 years ago
parent
commit
ea368c6869
21 changed files with 261 additions and 361 deletions
  1. 0 8
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUserRole.java
  2. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantOrderRecord.java
  3. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/EmployeeService.java
  4. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantInfoService.java
  5. 0 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  6. 37 22
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java
  7. 0 12
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
  8. 11 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  9. 67 71
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java
  10. 0 16
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  11. 7 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysTenantConfigServiceImpl.java
  12. 41 56
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  13. 6 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java
  14. 0 21
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  15. 12 3
      mec-biz/src/main/resources/config/mybatis/PracticeGroupSellPriceMapper.xml
  16. 6 11
      mec-biz/src/main/resources/config/mybatis/TenantOrderRecordMapper.xml
  17. 9 0
      mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java
  18. 19 12
      mec-web/src/main/java/com/ym/mec/web/controller/PracticeGroupSellPriceController.java
  19. 0 11
      mec-web/src/main/java/com/ym/mec/web/controller/TenantInfoController.java
  20. 9 39
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduOnlineMusicGroupController.java
  21. 21 44
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduRegisterController.java

+ 0 - 8
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUserRole.java

@@ -10,17 +10,9 @@ import com.ym.mec.common.entity.BaseEntity;
  * 对应数据库表(sys_user_role):
  */
 public class SysUserRole extends BaseEntity {
-	//分部经理
-	public static Integer SECTION_MANAGER = 3;
-	//教务老师、乐团主管
-	public static Integer EDUCATIONAL_TEACHER = 4;
-	//维修技师
-	public static Integer REPAIR = 37;
-
 	/** 用户ID */
 	@ApiModelProperty(value = "用户ID",required = false)
 	private Integer userId;
-	
 	/** 角色ID */
 	@ApiModelProperty(value = "角色ID",required = false)
 	private Integer roleId;

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantOrderRecord.java

@@ -57,6 +57,10 @@ public class TenantOrderRecord implements Serializable {
     @ApiModelProperty(value = "实付金额")
     private BigDecimal actualAmount;
 
+    @TableField("mer_nos")
+    @ApiModelProperty(value = "收款账户")
+    private String merNos;
+
     @TableField("order_state_")
     @ApiModelProperty(value = "订单状态/0待支付、1已支付、2支付失败")
     private Integer orderState;
@@ -161,6 +165,14 @@ public class TenantOrderRecord implements Serializable {
         this.actualAmount = actualAmount;
     }
 
+    public String getMerNos() {
+        return merNos;
+    }
+
+    public void setMerNos(String merNos) {
+        this.merNos = merNos;
+    }
+
     public Integer getOrderState() {
         return orderState;
     }

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/EmployeeService.java

@@ -11,6 +11,7 @@ import com.ym.mec.common.service.BaseService;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ExecutionException;
 
 public interface EmployeeService extends BaseService<Integer, Employee> {
 

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/TenantInfoService.java

@@ -37,11 +37,11 @@ public interface TenantInfoService extends IService<TenantInfo> {
 
     Map<String, Object> tenantRenewPay(Integer tenantId, Integer val) throws Exception;
 
-    RBucket<Object> opsRenewInfo(Integer tenantId);
+    RBucket<Map<String, Object>> cacheOrder(String key);
 
-    void renewSuccess(Integer val, TenantProductInfo productInfo, BigDecimal amount);
+    RBucket<Integer> opsRenewInfo(Integer tenantId);
 
-    Msg orderNotify(Msg msg);
+    void renewSuccess(Integer val, TenantProductInfo productInfo, BigDecimal amount);
 
     Map<String, Object> recharge(Integer tenantId, BigDecimal amount) throws Exception;
 

+ 0 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -3968,9 +3968,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         }
         //保存调整日志
 		saveModifyLog(modifyLogs,newCourseScheduleIds);
-//        if(oldCourseScheduleList.get(0).getGroupType().equals(GroupType.VIP)){
-//            courseScheduleStudentPaymentService.updateVipGiveCourse(Long.valueOf(oldCourseScheduleList.get(0).getMusicGroupId()));
-//        }
 
         try {
             //推送课时调整
@@ -3984,7 +3981,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             teacherIds.forEach(e -> {
                 map.put(e, e.toString());
             });
-//		HashMap<Integer,String> map = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(teacherDao.queryPhoneByIds(StringUtils.join(teacherIds, ",")))), HashMap.class);
             if (map != null && map.size() > 0) {
                 sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.TEACHER_PUSH_COURSE_SCHEDULE_CHANGE_RESULT,
                         map, null, 0, "7","TEACHER");
@@ -3992,12 +3988,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         } catch (Exception e) {
             e.printStackTrace();
         }
-
-//		Set<Integer> roleIds = new HashSet<>(1);
-//		roleIds.add(SysUserRole.SECTION_MANAGER);
-//		classGroupDao.get();
-//		sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds),MessageTypeEnum.BACKSTAGE_COURSE_CHANGE,
-//				teacher.getRealName());
     }
 
     @Transactional(rollbackFor = Exception.class)

+ 37 - 22
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -36,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.util.*;
+import java.util.concurrent.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -300,7 +301,7 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void level(List<EmployeeLevelDto> employeeLevelDtos) {
+	public void level(List<EmployeeLevelDto> employeeLevelDtos){
 		Integer levelUserId = employeeLevelDtos.get(0).getLevelUserId();
 		List<ImGroupModel> educationGroupModels = new ArrayList<>();
 		//获取用户需要加入的群组列表
@@ -389,31 +390,45 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 		employeeDao.updateUserDemissionDate(levelUserId);
 		//冻结用户
 		employeeDao.updateUserLock(levelUserId,1);
-		//获取用户担任教务老师、维修技师的所有乐团列表
-		List<String> musicGroupIds = employeeDao.queryMusicGroupIdByUserId(levelUserId);
-		//获取用户担任教务老师的所有网管课列表
-		List<String> practiceGroupIds = employeeDao.queryPracticeGroupIdByUserId(levelUserId);
-		//获取用户担任教务老师的所有VIP课列表
-		List<String> vipGroupIds = employeeDao.queryVipGroupIdByUserId(levelUserId);
-		if(musicGroupIds.size() > 0){
-			for (String musicGroupId : musicGroupIds) {
-				imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
+		ExecutorService executor = Executors.newFixedThreadPool(20);
+		CompletableFuture<Boolean> refreshUserFriend = CompletableFuture.supplyAsync(()->{
+			//获取用户担任教务老师、维修技师的所有乐团列表
+			List<String> musicGroupIds = employeeDao.queryMusicGroupIdByUserId(levelUserId);
+			//获取用户担任教务老师的所有网管课列表
+			List<String> practiceGroupIds = employeeDao.queryPracticeGroupIdByUserId(levelUserId);
+			//获取用户担任教务老师的所有VIP课列表
+			List<String> vipGroupIds = employeeDao.queryVipGroupIdByUserId(levelUserId);
+			Boolean refreshFlag = false;
+			if(musicGroupIds.size() > 0){
+				for (String musicGroupId : musicGroupIds) {
+					imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
+				}
+				refreshFlag = true;
 			}
-		}
-		if(practiceGroupIds.size() > 0){
-			for (String musicGroupId : practiceGroupIds) {
-				imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.PRACTICE);
+			if(practiceGroupIds.size() > 0){
+				for (String musicGroupId : practiceGroupIds) {
+					imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.PRACTICE);
+				}
+				refreshFlag = true;
 			}
-		}
-		if(vipGroupIds.size() > 0){
-			for (String musicGroupId : vipGroupIds) {
-				imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.VIP);
+			if(vipGroupIds.size() > 0){
+				for (String musicGroupId : vipGroupIds) {
+					imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.VIP);
+				}
+				refreshFlag = true;
 			}
+			return refreshFlag;
+		},executor);
+		Boolean join = refreshUserFriend.join();
+		if(join){
+			refreshUserFriend.thenRun(()->{
+				//更新群成员数量
+				imGroupDao.updateMemberNum();
+				//删除重复的群成员
+				imGroupMemberService.delRepeat();
+			});
 		}
-		//更新群成员数量
-		imGroupDao.updateMemberNum();
-		//删除重复的群成员
-		imGroupMemberService.delRepeat();
+		executor.shutdown();
 	}
 
 	@Override

+ 0 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -3,29 +3,23 @@ package com.ym.mec.biz.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.auth.api.entity.SysUserRole;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.IndexDataQueryInfo;
 import com.ym.mec.biz.dal.page.OrganCloudStudyStudentDataQueryInfo;
-import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
-import com.ym.mec.common.filters.TenantIdThreadLocal;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
-
-import io.swagger.models.auth.In;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -34,12 +28,10 @@ import java.math.BigDecimal;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.enums.IndexDataType.*;
-import static com.ym.mec.biz.dal.enums.IndexErrorType.WAIT_CREATE_PAYMENT_CALENDER;
 import static com.ym.mec.biz.dal.enums.SysUserRoleEnum.EDUCATION;
 
 @Service
@@ -50,8 +42,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	@Autowired
 	private OrganizationService organizationService;
 	@Autowired
-	private EmployeeDao employeeDao;
-	@Autowired
 	private MusicGroupDao musicGroupDao;
 	@Autowired
 	private SysConfigDao sysConfigDao;
@@ -66,8 +56,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	@Autowired
 	private ClassGroupDao classGroupDao;
 	@Autowired
-	private EmployeeService employeeService;
-	@Autowired
 	private StudentRegistrationDao studentRegistrationDao;
 	@Autowired
 	private MusicGroupPerformanceDao musicGroupPerformanceDao;

+ 11 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1960,25 +1960,23 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroupQuitDao.insert(musicGroupQuit);
 
         if (reqMusicGroupQuit.getStatus() == PROCESSING) {
-            Set<Integer> roleIds = new HashSet<>(1);
-            roleIds.add(SysUserRole.SECTION_MANAGER);
-            Set<Integer> integers = musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId());
+            SysUser sysUser = sysUserFeignService.queryUserById(userId);
 
+            Set<Integer> integers = employeePositionService.queryUserIdByRoleId(new SysUserRoleEnum[]{ORGAN_MANAGER},musicGroup.getOrganId());
             if (currentOperatorRoleIds == null || currentOperatorRoleIds.size() == 0) {
                 integers.add(musicGroup.getEducationalTeacherId());
             }
-
+            if(integers.size() > 0){
+                Map<Integer, String> receivers = new HashMap<>(integers.size());
+                for (Integer integer : integers) {
+                    receivers.put(integer, integer.toString());
+                }
+                sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.SYSTEM_PUSH_STUDENT_COMMIT_QUIT_MUSIC_APPLY, receivers, null, 0, null,
+                        "SYSTEM", musicGroup.getName(), sysUser.getUsername());
+            }
             Map<String, Object> memo = new HashMap<>(2);
             memo.put("Id", musicGroupQuit.getId());
             memo.put("type", "MUSICGROUP");
-            SysUser sysUser = sysUserFeignService.queryUserById(userId);
-            Map<Integer, String> receivers = new HashMap<>(integers.size());
-            for (Integer integer : integers) {
-                receivers.put(integer, integer.toString());
-            }
-            sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.SYSTEM_PUSH_STUDENT_COMMIT_QUIT_MUSIC_APPLY, receivers, null, 0, null,
-                    "SYSTEM", musicGroup.getName(), sysUser.getUsername());
-
             sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
                     JSONObject.toJSONString(memo), null, MessageTypeEnum.BACKSTAGE_STUDENT_APPLY_QUIT_GROUP, sysUser.getUsername());
         } else {
@@ -2124,7 +2122,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (status != ApprovalStatus.PROCESSING) {
             courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), Arrays.asList(userId), GroupType.MUSIC);
         } else {
-            musicGroupQuit.setCurrentApproveRole(SysUserRole.SECTION_MANAGER + "");
+            musicGroupQuit.setCurrentApproveRole(ORGAN_MANAGER.ordinal() + "");
         }
         musicGroupQuitDao.update(musicGroupQuit);
 

+ 67 - 71
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java

@@ -1,30 +1,5 @@
 package com.ym.mec.biz.service.impl;
 
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiPredicate;
-import java.util.function.Consumer;
-import java.util.function.Function;
-
-import org.redisson.api.RBucket;
-import org.redisson.api.RedissonClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.DigestUtils;
-
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
@@ -32,12 +7,7 @@ import com.ym.mec.biz.dal.entity.TenantConfig;
 import com.ym.mec.biz.dal.entity.TenantOrderRecord;
 import com.ym.mec.biz.dal.entity.TenantPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.service.CloudTeacherOrderService;
-import com.ym.mec.biz.service.OrderPayOpsService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.TenantConfigService;
-import com.ym.mec.biz.service.TenantOrderRecordService;
-import com.ym.mec.biz.service.TenantPaymentOrderService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
@@ -45,6 +15,23 @@ import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.mec.util.json.JsonUtil;
+import org.redisson.api.RBucket;
+import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.DigestUtils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BiPredicate;
+import java.util.function.Consumer;
+import java.util.function.Function;
 
 /**
  * @author hgw
@@ -64,7 +51,6 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
     private RedissonClient redissonClient;
     @Autowired
     private CloudTeacherOrderService cloudTeacherOrderService;
-    
     @Autowired
     private TenantConfigService tenantConfigService;
 
@@ -218,7 +204,7 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         //校验订单是否超时
         String timeExpire = checkOrderTimeOut(createTime);
         //初始化支付数据
-        Map<String, Object> paymentParams = getPaymentParam(payParam);
+        Map<String, Object> paymentParams = getPaymentParam(payParam, clazz);
         paymentParams.put("time_expire", timeExpire);
         paymentParams.put("expend", getExpend(payParam));
         //向第三方发起支付,获取第三方的支付的信息
@@ -284,47 +270,57 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         return openId;
     }
 
-    private Map<String, Object> getPaymentParam(PaymentParam payParam) {
+    private <T> Map<String, Object> getPaymentParam(PaymentParam payParam, T clazz) {
         Map<String, Object> paymentParams = new HashMap<>();
         paymentParams.put("app_id", ConfigInit.appId);
         paymentParams.put("order_no", payParam.getOrderNo());
         paymentParams.put("pay_channel", payParam.getPayChannel());
-        paymentParams.put("pay_amt", payParam.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
+        paymentParams.put("pay_amt", payParam.getAmount().setScale(2, RoundingMode.HALF_UP));
         paymentParams.put("goods_title", payParam.getOrderSubject());
         paymentParams.put("goods_desc", payParam.getOrderBody());
-        
+
         if (payParam.getTenantId() == 1) {
-			// 延时分账
-			paymentParams.put("pay_mode", "delay");
-		} else {
-
-			StudentPaymentOrder paymentOrder = studentPaymentOrderService.findOrderByOrderNo(payParam.getOrderNo());
-			if (paymentOrder == null) {
-				throw new BizException("订单[{}]找不到", payParam.getOrderNo());
-			}
-
-			TenantConfig tenantConfig = tenantConfigService.queryByTenantId(payParam.getTenantId());
-			if (tenantConfig == null) {
-				throw new BizException("机构[{}]信息找不到", payParam.getTenantId());
-			}
-
-			// 实时分账
-			List<Map<String, Object>> divMemberList = new ArrayList<Map<String, Object>>();
-			Map<String, Object> divMember = new HashMap<String, Object>();
-			divMember.put("member_id", paymentOrder.getMerNos());
-			divMember.put("amount",
-					paymentOrder.getActualAmount().multiply(tenantConfig.getChargeRate()).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_UP));
-			divMember.put("fee_flag", "Y");
-
-			divMemberList.add(divMember);
-
-			paymentParams.put("div_members", JsonUtil.toJSONString(divMemberList));
-
-		}
-        
+            // 延时分账
+            paymentParams.put("pay_mode", "delay");
+        } else {
+            TenantConfig tenantConfig = tenantConfigService.queryByTenantId(payParam.getTenantId());
+            if (tenantConfig == null) {
+                throw new BizException("机构[{}]信息找不到", payParam.getTenantId());
+            }
+            String merNos;
+            BigDecimal amount;
+            Function<BigDecimal, BigDecimal> amountTo = (a) -> a
+                    .multiply(tenantConfig.getChargeRate())
+                    .divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
+
+            if (clazz instanceof StudentPaymentOrder) {
+                StudentPaymentOrder st = (StudentPaymentOrder) clazz;
+                merNos = st.getMerNos();
+                amount = amountTo.apply(st.getActualAmount());
+            } else if (clazz instanceof TenantOrderRecord) {
+                TenantOrderRecord tor = (TenantOrderRecord) clazz;
+                merNos = tor.getMerNos();
+                amount = amountTo.apply(tor.getActualAmount());
+            } else if (clazz instanceof TenantPaymentOrder) {
+                TenantPaymentOrder tpo = (TenantPaymentOrder) clazz;
+                merNos = tpo.getMerNos();
+                amount = amountTo.apply(tpo.getActualAmount());
+            } else {
+                throw new BizException("订单[{}]找不到", payParam.getOrderNo());
+            }
+
+            // 实时分账
+            List<Map<String, Object>> divMemberList = new ArrayList<>();
+            Map<String, Object> divMember = new HashMap<>();
+            divMember.put("member_id", merNos);
+            divMember.put("amount", amount);
+            divMember.put("fee_flag", "Y");
+            divMemberList.add(divMember);
+            paymentParams.put("div_members", JsonUtil.toJSONString(divMemberList));
+        }
+
         //手续费收取模式:O-商户手续费账户扣取手续费,I-交易金额中扣取手续费;值为空时,默认值为I;若为O时,分账对象列表中不支持传入手续费承担方
         paymentParams.put("fee_mode", "I");
-        
         return paymentParams;
     }
 
@@ -500,13 +496,13 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
             this.platform = platform;
         }
 
-		public Integer getTenantId() {
-			return tenantId;
-		}
+        public Integer getTenantId() {
+            return tenantId;
+        }
 
-		public void setTenantId(Integer tenantId) {
-			this.tenantId = tenantId;
-		}
+        public void setTenantId(Integer tenantId) {
+            this.tenantId = tenantId;
+        }
     }
 
 }

+ 0 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -5008,22 +5008,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
         applyBaseInfoDto.setCourseScheduleJson(JSON.toJSONString(courseSchedules));
         practiceGroupDao.update(applyBaseInfoDto);
-
-//        Set<Integer> roleIds = new HashSet<>(1);
-//        roleIds.add(SysUserRole.SECTION_MANAGER);
-//        Map<String,Long> memo = new HashMap<>(1);
-//        memo.put("practiceGroupId",applyBaseInfoDto.getId());
-//        if(Objects.isNull(teacher)){
-//            throw new BizException("该用户不存在");
-//        }
-//        Set<Integer> userIds = musicGroupDao.queryUserIdByRoleId(roleIds,teacher.getTeacherOrganId());
-//        if(CollectionUtils.isEmpty(userIds)){
-//            throw new BizException("当前分部没有运营主管,无法创建,请联系总部工作人员!");
-//        }
-//        if(applyBaseInfoDto.getEducationalTeacherId() != null){
-//            userIds.add(applyBaseInfoDto.getEducationalTeacherId());
-//        }
-//        sysMessageService.batchSeoMessage(userIds,MessageTypeEnum.BACKSTAGE_TEACHER_APPLY_PRACTICE, JSONObject.toJSONString(memo),teacher.getRealName());
         return BaseController.succeed(applyBaseInfoDto.getAuditStatus().getCode());
     }
 

+ 7 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysTenantConfigServiceImpl.java

@@ -52,13 +52,13 @@ public class SysTenantConfigServiceImpl extends BaseServiceImpl<Integer, SysTena
 
 	@Override
 	public String getTenantConfigValue(String paramName,Integer tenantId) {
-		RBucket<ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>>> bucket = redissonClient.getBucket(tenantKey);
-		ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> tenantConfigMap = bucket.get();
-		ConcurrentHashMap<String, String> map = tenantConfigMap.get(tenantId);
-		if(map != null){
-			return map.get(paramName);
-		}
-		applicationEventPublisher.publishEvent(new TenantConfigChangeEvent(this,tenantId));
+//		RBucket<ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>>> bucket = redissonClient.getBucket(tenantKey);
+//		ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> tenantConfigMap = bucket.get();
+//		ConcurrentHashMap<String, String> map = tenantConfigMap.get(tenantId);
+//		if(map != null){
+//			return map.get(paramName);
+//		}
+//		applicationEventPublisher.publishEvent(new TenantConfigChangeEvent(this,tenantId));
 		return sysTenantConfigDao.getConfigValue(paramName,tenantId);
 	}
 

+ 41 - 56
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -1,6 +1,5 @@
 package com.ym.mec.biz.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -27,7 +26,6 @@ import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.yqpay.DateUtils;
-import com.ym.mec.thirdparty.yqpay.Msg;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -442,12 +440,19 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      * 机构开通缴费
      */
     public Map<String, Object> tenantOpenPay(Integer tenantId) throws Exception {
+        TenantOrderRecordEnum tenantEnum = TenantOrderRecordEnum.TENANT_OPEN;
+        RBucket<Map<String, Object>> cacheOrder = cacheOrder(tenantEnum.getCode() + ":" + tenantId);
+        Map<String, Object> result = cacheOrder.get();
+        if (Objects.nonNull(result)) {
+            return result;
+        } else {
+            result = new HashMap<>();
+        }
+
         TenantProductInfo productInfo = getProductInfo(tenantId);
         //生成订单编号
         String orderNo = idGenerator.generatorId("payment") + "";
         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
-        TenantOrderRecordEnum tenantEnum = TenantOrderRecordEnum.TENANT_OPEN;
-        Map<String, Object> result = new HashMap<>();
         int orderState = 0;
         //消费大于0元则拉起支付
         if (productInfo.getPayAmount().compareTo(BigDecimal.ZERO) > 0) {
@@ -462,6 +467,8 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
                     1,//todo 机构开通付款临时写死
                     tenantEnum.getCode()
             );
+            //将数据缓存起来避免重复生成订单数据,如果这次没有支付 3分钟内可以重复支付
+            cacheOrder.set(result, 3L, TimeUnit.MINUTES);
         } else {
             //已支付
             orderState = 1;
@@ -469,9 +476,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             Map<String, Object> payMap = new HashMap<>();
             payMap.put("orderNo", orderNo);
             result.put("payMap", payMap);
-            result.put("amount", productInfo.getPayAmount());
         }
-        createOrderRecord(tenantId, productInfo.getPayAmount(), orderNo, tenantEnum, orderState);
+        result.put("amount", productInfo.getPayAmount());
+        createOrderRecord(tenantId, productInfo.getPayAmount(), orderNo, tenantEnum, orderState, WrapperUtil.toStr(result, "routingMerNos"));
         log.info("tenant pay >>>>> {} ", result);
         return result;
     }
@@ -483,14 +490,19 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      * @param val      购买周期
      */
     public Map<String, Object> tenantRenewPay(Integer tenantId, Integer val) throws Exception {
+        TenantOrderRecordEnum tenantEnum = TenantOrderRecordEnum.TENANT_RENEW;
+        RBucket<Map<String, Object>> cacheOrder = cacheOrder(tenantEnum.getCode() + ":" + tenantId + ":" + val);
+        Map<String, Object> result = cacheOrder.get();
+        if (Objects.nonNull(result)) {
+            return result;
+        } else {
+            result = new HashMap<>();
+        }
         TenantProductInfo productInfo = getProductInfo(tenantId);
         //续费时 取合同价
         BigDecimal amount = productInfo.getContractPrice().multiply(new BigDecimal(val));
-
         //生成订单编号
         String orderNo = idGenerator.generatorId("payment") + "";
-        TenantOrderRecordEnum tenantEnum = TenantOrderRecordEnum.TENANT_RENEW;
-        Map<String, Object> result = new HashMap<>();
         int orderState = 0;
         //消费大于0元则拉起支付
         if (amount.compareTo(BigDecimal.ZERO) > 0) {
@@ -507,23 +519,33 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             );
             //操作续费信息,把续费周期存起来
             opsRenewInfo(tenantId).set(val, 1, TimeUnit.HOURS);
+            //将数据缓存起来避免重复生成订单数据,如果这次没有支付 3分钟内可以重复支付
+            cacheOrder.set(result, 3L, TimeUnit.MINUTES);
         } else {
             //续费成功
             renewSuccess(val, productInfo, amount);
             orderState = 1;
-            result.put("amount", amount);
         }
-        createOrderRecord(tenantId, amount, orderNo, tenantEnum, orderState);
+        result.put("amount", amount);
+        createOrderRecord(tenantId, amount, orderNo, tenantEnum, orderState, WrapperUtil.toStr(result, "routingMerNos"));
         log.info("tenant pay >>>>> {} ", result);
         return result;
     }
 
-    //操作续费信息
-    public RBucket<Object> opsRenewInfo(Integer tenantId) {
-        String key = TenantOrderRecordEnum.TENANT_RENEW.getCode() + ":" + tenantId;
+    /**
+     * 缓存订单数据
+     *
+     * @param key TenantOrderRecordEnum+机构id+其他
+     */
+    public RBucket<Map<String, Object>> cacheOrder(String key) {
         return redissonClient.getBucket(key);
     }
 
+    //操作续费信息
+    public RBucket<Integer> opsRenewInfo(Integer key) {
+        return redissonClient.getBucket(TenantOrderRecordEnum.TENANT_RENEW.getCode() + ":" + key);
+    }
+
     /**
      * 续费成功
      *
@@ -581,7 +603,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 
     //生成订单
     private void createOrderRecord(Integer tenantId, BigDecimal payAmount, String orderNo, TenantOrderRecordEnum
-            tenantEnum, Integer orderState) {
+            tenantEnum, Integer orderState, String merNos) {
         TenantOrderRecord record = new TenantOrderRecord();
         record.setTenantId(tenantId);
         record.setOrderNo(orderNo);
@@ -590,6 +612,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         record.setExpectAmount(payAmount);
         record.setActualAmount(payAmount);
         record.setOrderState(orderState);
+        record.setMerNos(merNos);
         LocalDateTime now = LocalDateTime.now();
         if (orderState == 1) {
             record.setPayDate(now.toLocalDate().toDate());
@@ -600,44 +623,6 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
     }
 
     /**
-     * 支付消息回调
-     *
-     * @param msg
-     * @return
-     */
-    @Override
-    public Msg orderNotify(Msg msg) {
-        log.info("tenant orderNotify >>>>> {}", msg);
-        msg.setMsg("fail");
-        Map<String, String> notifyMap = JSON.parseObject(msg.getResponseParameters(), Map.class);
-        String orderNo = notifyMap.get("merMerOrderNo");
-        TenantOrderRecord record = tenantOrderRecordService.getOne(new WrapperUtil<TenantOrderRecord>()
-                .hasEq("order_no_", orderNo).queryWrapper());
-        String channelType = notifyMap.get("channelType").equals("1") ? "WXPay" : (notifyMap.get("channelType").equals("2") ? "Alipay" : "quickPay");
-        record.setPayChannel(channelType);
-        //支付中订单存在,更新状态 tradeState 88就是正确的 其他错误的
-        if (msg.getResponseType().equals("1") && notifyMap.size() > 0 && msg.getCode().equals("88")) {
-            // notifyMap.put("totalMoney", notifyMap.get("payAmount"));
-            LocalDateTime now = LocalDateTime.now();
-            record.setOrderState(1);
-            record.setPayDate(now.toLocalDate().toDate());
-            record.setPayTime(now.toDate());
-            msg.setCode("000000");
-            msg.setMsg("success");
-            if (TenantOrderRecordEnum.TENANT_OPEN.getCode().equals(record.getOrderType())) {
-                tenantOpen(record.getTenantId());
-            }
-        } else {
-            //支付失败
-            record.setOrderState(2);
-        }
-        log.info("tenant orderNotify return>>>>> {}", record);
-        tenantOrderRecordService.updateById(record);
-        log.info("tenant orderNotify return>>>>> {}", msg);
-        return msg;
-    }
-
-    /**
      * 校验手机号
      */
     private RBucket<Object> checkPhone(TenantInfoDto dto) {
@@ -747,10 +732,10 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
                     tenantEnum.getCode()
             );
         } else {
-            result.put("amount",amount);
-            return result;
+            orderState = 1;
         }
-        createOrderRecord(tenantId, amount, orderNo, tenantEnum, orderState);
+        result.put("amount", amount);
+        createOrderRecord(tenantId, amount, orderNo, tenantEnum, orderState, WrapperUtil.toStr(result, "routingMerNos"));
         log.info("tenant pay >>>>> {} ", result);
         return result;
     }

+ 6 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -156,6 +156,8 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
         productInfo.setPayDate(new Date());
         productInfo.setTenantId(record.getTenantId());
         tenantProductInfoService.updateById(productInfo);
+        //删除订单数据及订单缓存
+        tenantInfoService.cacheOrder(TenantOrderRecordEnum.TENANT_RENEW + ":" + record.getTenantId()).delete();
     }
 
     private void renew(TenantOrderRecord record) {
@@ -163,11 +165,13 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
         TenantProductInfo productInfo = tenantProductInfoService.getOne(new WrapperUtil<TenantProductInfo>()
                 .hasEq("tenant_id_", record.getTenantId()).queryWrapper().eq("using_", 0));
         //获取机构续费时长
-        RBucket<Object> bucket = tenantInfoService.opsRenewInfo(record.getTenantId());
-        Integer val = (Integer) bucket.get();
+        RBucket<Integer> bucket = tenantInfoService.opsRenewInfo(record.getTenantId());
+        Integer val = bucket.get();
         //修改产品信息
         tenantInfoService.renewSuccess(val, productInfo, record.getActualAmount());
+        //删除订单数据及订单缓存
         bucket.delete();
+        tenantInfoService.cacheOrder(TenantOrderRecordEnum.TENANT_RENEW + ":" + record.getTenantId() + ":" + val).delete();
     }
 
     //主动去第三方查询订单状态

+ 0 - 21
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -417,27 +417,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
         vipGroupApplyBaseInfoDto.setCourseSchedulesJson(JSON.toJSONString(courseSchedules));
         vipGroupDao.update(vipGroupApplyBaseInfoDto);
-
-//		Set<Integer> roleIds = new HashSet<>(1);
-//		roleIds.add(SysUserRole.SECTION_MANAGER);
-//		Map<String,Long> memo = new HashMap<>(1);
-//		memo.put("vipGroupId",vipGroupApplyBaseInfoDto.getId());
-//		SysUser sysUser = sysUserFeignService.queryUserById(vipGroup.getVipGroupApplyBaseInfo().getUserId());
-//		if(Objects.isNull(teacher)){
-//			throw new BizException("该用户不存在");
-//		}
-//		Set<Integer> userIds = musicGroupDao.queryUserIdByRoleId(roleIds,teacher.getTeacherOrganId());
-//		if(CollectionUtils.isEmpty(userIds)){
-//			throw new BizException("当前分部没有运营主管,无法创建,请联系总部工作人员!");
-//		}
-//		if(vipGroupApplyBaseInfoDto.getEducationalTeacherId() != null){
-//			userIds.add(vipGroupApplyBaseInfoDto.getEducationalTeacherId());
-//		}
-//		if (vipGroup.getVipGroupApplyBaseInfo().getUserId() != null){
-//			sysMessageService.batchSeoMessage(userIds,MessageTypeEnum.BACKSTAGE_VIP_COURSE_APPLY, JSONObject.toJSONString(memo),sysUser.getUsername(),sysUser.getUsername());
-//		}else {
-//		sysMessageService.batchSeoMessage(userIds,MessageTypeEnum.BACKSTAGE_TEACHER_APPLY_VIP, JSONObject.toJSONString(memo),teacher.getRealName());
-//		}
         return BaseController.succeed(vipGroupApplyBaseInfoDto.getAuditStatus().getCode());
     }
 

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

@@ -69,7 +69,7 @@
 			<if test="twiceActivityPrice != null">
 				twice_activity_price = #{twiceActivityPrice},
 			</if>
-			update_time_=NOW
+			update_time_= NOW()
 		</set>
 		WHERE organ_id_ = #{organId} and tenant_id_ = #{tenantId}
 	</update>
@@ -83,12 +83,21 @@
 	<select id="queryPage" resultMap="PracticeGroupSellPrice" parameterType="map">
 		SELECT pgsp.*,o.name_ organ_name_ FROM practice_group_sell_price pgsp
 		LEFT JOIN organization o ON o.id_ = pgsp.organ_id_
-		WHERE pgsp.tenant_id_ = #{tenantId} ORDER BY pgsp.organ_id_
+		WHERE pgsp.tenant_id_ = #{tenantId}
+		<if test="search != null and search != ''">
+			AND o.name_ LIKE CONCAT('%',#{search},'%')
+		</if>
+		ORDER BY pgsp.organ_id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM practice_group_sell_price where tenant_id_ = #{tenantId}
+		SELECT COUNT(DISTINCT pgsp.organ_id_) FROM practice_group_sell_price pgsp
+		LEFT JOIN organization o ON o.id_ = pgsp.organ_id_
+		WHERE pgsp.tenant_id_ = #{tenantId}
+		<if test="search != null and search != ''">
+			AND o.name_ LIKE CONCAT('%',#{search},'%')
+		</if>
 	</select>
 </mapper>

+ 6 - 11
mec-biz/src/main/resources/config/mybatis/TenantOrderRecordMapper.xml

@@ -11,6 +11,7 @@
         <result column="pay_channel_" jdbcType="VARCHAR" property="payChannel"/>
         <result column="expect_amount" jdbcType="VARCHAR" property="expectAmount"/>
         <result column="actual_amount" jdbcType="VARCHAR" property="actualAmount"/>
+        <result column="mer_nos" jdbcType="VARCHAR" property="merNos"/>
         <result column="order_state_" jdbcType="INTEGER" property="orderState"/>
         <result column="pay_date_" jdbcType="TIMESTAMP" property="payDate"/>
         <result column="pay_time_" jdbcType="TIMESTAMP" property="payTime"/>
@@ -19,22 +20,23 @@
 
     <sql id="Base_Column_List">
         id_
-        , tenant_id_, order_no_, trans_no_, order_type_, payment_channel_, pay_channel_, expect_amount, actual_amount, order_state_, pay_date_, pay_time_, created_time_
+        , tenant_id_, order_no_, trans_no_, order_type_, payment_channel_, pay_channel_, expect_amount, actual_amount, mer_nos, order_state_, pay_date_, pay_time_, created_time_
     </sql>
 
     <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
             parameterType="com.ym.mec.biz.dal.entity.TenantOrderRecord">
         insert into tenant_order_record(tenant_id_, order_no_, trans_no_, order_type_, payment_channel_, pay_channel_,
-        expect_amount, actual_amount, order_state_, pay_date_, pay_time_, created_time_)
+        expect_amount, actual_amount, mer_nos,order_state_, pay_date_, pay_time_, created_time_)
         values
         <foreach collection="entities" item="entity" separator=",">
             (#{entity.tenantId}, #{entity.orderNo}, #{entity.transNo}, #{entity.orderType}, #{entity.paymentChannel},
-            #{entity.payChannel}, #{entity.expectAmount}, #{entity.actualAmount}, #{entity.orderState},
+            #{entity.payChannel}, #{entity.expectAmount}, #{entity.actualAmount}, #{entity.merNos},#{entity.orderState},
             #{entity.payDate}, #{entity.payTime}, #{entity.createdTime})
         </foreach>
     </insert>
 
-    <select id="queryPage" parameterType="com.ym.mec.biz.dal.dto.TenantOrderRecordDto" resultType="com.ym.mec.biz.dal.vo.TenantOrderRecordVo">
+    <select id="queryPage" parameterType="com.ym.mec.biz.dal.dto.TenantOrderRecordDto"
+            resultType="com.ym.mec.biz.dal.vo.TenantOrderRecordVo">
         SELECT
             b.name_ as tenantName,
             a.tenant_id_ as tenantId,
@@ -69,13 +71,6 @@
         <if test="param.orderState != null ">
             AND a.`order_state_` = #{param.orderState}
         </if>
-<!--        前端去掉 tenantId 搜索 -->
-<!--        <if test="param.tenantIdList != null ">-->
-<!--            AND a.`tenant_id_`  IN-->
-<!--            <foreach collection="param.tenantIdList" item="id" open="(" close=")" separator=",">-->
-<!--                #{id}-->
-<!--            </foreach>-->
-<!--        </if>-->
         <if test="param.startDate != null">
             AND a.`created_time_` <![CDATA[ >= ]]>  #{param.startDate}
         </if>

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java

@@ -113,6 +113,15 @@ public class EmployeeController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation(value = "修改员工")
+    @PostMapping("/simpleUpdate")
+    @PreAuthorize("@pcs.hasPermissions('employee/simpleUpdate')")
+    public Object simpleUpdate(@RequestBody Employee employee) {
+        employee.setUpdateTime(new Date());
+        employeeService.update(employee);
+        return succeed();
+    }
+
     @ApiOperation(value = "修改用户")
     @PostMapping("/updateUser")
     public Object update(SysUser sysUser) {

+ 19 - 12
mec-web/src/main/java/com/ym/mec/web/controller/PracticeGroupSellPriceController.java

@@ -1,11 +1,13 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.entity.PracticeGroupSellPrice;
+import com.ym.mec.biz.service.PracticeGroupSellPriceService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
-
-import java.util.Date;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -14,11 +16,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.biz.dal.entity.PracticeGroupSellPrice;
-import com.ym.mec.biz.service.PracticeGroupSellPriceService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.QueryInfo;
+import java.util.Date;
 
 @RequestMapping("practiceGroupSellPrice")
 @Api(tags = "网管课价格配置")
@@ -26,9 +24,6 @@ import com.ym.mec.common.page.QueryInfo;
 public class PracticeGroupSellPriceController extends BaseController {
 
 	@Autowired
-	private SysUserFeignService sysUserFeignService;
-
-	@Autowired
 	private PracticeGroupSellPriceService practiceGroupSellPriceService;
 
 	@ApiOperation("分页查询")
@@ -50,7 +45,10 @@ public class PracticeGroupSellPriceController extends BaseController {
 	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/add')")
 	public Object add(PracticeGroupSellPrice practiceGroupSellPrice) {
-
+		PracticeGroupSellPrice practiceGroupSellPrice1 = practiceGroupSellPriceService.get(practiceGroupSellPrice.getOrganId());
+		if(practiceGroupSellPrice1 != null){
+			throw new BizException("数据已存在");
+		}
 		Date date = new Date();
 		practiceGroupSellPrice.setCreateTime(date);
 		practiceGroupSellPrice.setUpdateTime(date);
@@ -66,4 +64,13 @@ public class PracticeGroupSellPriceController extends BaseController {
 		practiceGroupSellPriceService.update(practiceGroupSellPrice);
 		return succeed();
 	}
+
+	@ApiOperation("删除")
+	@PostMapping(value = "/del")
+	@ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer", paramType = "path")
+	@PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/del')")
+	public Object del(Integer organId) {
+		practiceGroupSellPriceService.delete(organId);
+		return succeed();
+	}
 }

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

@@ -119,17 +119,6 @@ public class TenantInfoController extends BaseController {
         return succeed(tenantInfoService.tenantRenewPay(id, val));
     }
 
-    /**
-     * 支付回调-第三方回调地址
-     *
-     * @param msg
-     * @return
-     */
-    @PostMapping("/notify")
-    public Msg notify(@ModelAttribute Msg msg) {
-        return tenantInfoService.orderNotify(msg);
-    }
-
     @ApiOperation(value = "机构充值")
     @GetMapping("/recharge/{amount}")
     @PreAuthorize("@pcs.hasPermissions('tenantInfo/recharge')")

+ 9 - 39
mec-web/src/main/java/com/ym/mec/web/controller/education/EduOnlineMusicGroupController.java

@@ -10,11 +10,9 @@ import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.OnlineMusicGroupService;
-import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -49,7 +47,9 @@ public class EduOnlineMusicGroupController extends BaseController {
     @Autowired
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
     @Autowired
-    private EmployeeDao employeeDao;
+    private SysEmployeePositionService employeePositionService;
+    @Autowired
+    private OrganizationService organizationService;
 
     @ApiOperation(value = "分页查询维修技师所在乐团列表")
     @GetMapping("/findMusicGroups")
@@ -58,22 +58,12 @@ public class EduOnlineMusicGroupController extends BaseController {
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
+        Boolean onlyForRole = employeePositionService.onlyForRole(SysUserRoleEnum.REPAIR, sysUser.getId(), sysUser.getIsSuperAdmin());
         //如果当前用户只有维修技师角色,那么只能看到他所管理的课程组的信息
-		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.REPAIR)) {
+		if (onlyForRole) {
             queryInfo.setRepairUserId(sysUser.getId());
 		}else {
-            Employee employee = employeeDao.get(sysUser.getId());
-            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-                queryInfo.setOrganId(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.getOrganId().split(",")))){
-                    return failed("非法请求");
-                }
-            }
+            queryInfo.setOrganId(organizationService.getEmployeeOrgan(sysUser.getId(), queryInfo.getOrganId(), sysUser.getIsSuperAdmin()));
         }
         queryInfo.setStatus(MusicGroupStatusEnum.PROGRESS);
         return succeed(musicGroupService.findEduTeacherMusicGroups(queryInfo));
@@ -81,14 +71,12 @@ public class EduOnlineMusicGroupController extends BaseController {
 
     @ApiOperation(value = "获取乐团下所有学员身上的声部列表")
     @GetMapping("/findMusicGroupAllStudentSubjects")
-//    @PreAuthorize("@pcs.hasPermissions('eduOnlineMusic/findMusicGroupAllStudentSubjects')")
     public HttpResponseResult findMusicGroupAllStudentSubjects(String musicGroupId){
         return succeed(studentRegistrationService.findMusicGroupAllStudentSubjects(musicGroupId));
     }
 
     @ApiOperation(value = "根据声部获取乐团下完成缴费的学员")
     @GetMapping("/findMusicGroupStudentWithSubject")
-//    @PreAuthorize("@pcs.hasPermissions('eduOnlineMusic/findMusicGroupStudentWithSubject')")
     public HttpResponseResult findMusicGroupStudentWithSubject(String musicGroupId,Integer subjectId){
         if(Objects.isNull(subjectId)){
             return failed("请指定声部");
@@ -98,7 +86,6 @@ public class EduOnlineMusicGroupController extends BaseController {
 
     @ApiOperation(value = "获取可选择的教师")
     @GetMapping("/getEnableApplyTeachers")
-//    @PreAuthorize("@pcs.hasPermissions('eduOnlineMusic/getEnableApplyTeachers')")
     public HttpResponseResult getEnableApplyTeachers(Integer studentId, Integer subjectId){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
@@ -112,7 +99,6 @@ public class EduOnlineMusicGroupController extends BaseController {
 
     @ApiOperation(value = "获取教师空闲时间")
     @GetMapping("/getTeacherFreeTimes")
-//    @PreAuthorize("@pcs.hasPermissions('eduOnlineMusic/getTeacherFreeTimes')")
     public HttpResponseResult getTeacherFreeTimes(Integer studentId, Integer teacherId, boolean skipHoliday) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
@@ -126,7 +112,6 @@ public class EduOnlineMusicGroupController extends BaseController {
 
     @ApiOperation(value = "检测学生是否存在进行中的乐团网管课")
     @GetMapping("/checkStudentExistMusicNetwork")
-//    @PreAuthorize("@pcs.hasPermissions('eduOnlineMusic/checkStudentExistMusicNetwork')")
     public HttpResponseResult checkStudentExistMusicNetwork(Integer studentId){
         int i = courseScheduleStudentPaymentDao.countStudentNotStartCourseNumWithCourseType(studentId, CourseSchedule.CourseScheduleType.MUSIC_NETWORK);
         return succeed(i>0?1:0);
@@ -134,7 +119,6 @@ public class EduOnlineMusicGroupController extends BaseController {
 
     @ApiOperation(value = "创建乐团网管课")
     @PostMapping("/createOnlineMusicClassGroup")
-//    @PreAuthorize("@pcs.hasPermissions('eduOnlineMusic/createOnlineMusicClassGroup')")
     public HttpResponseResult createOnlineMusicClassGroup(OnlineMusicGroupCourseDto onlineMusicGroupCourseInfo){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
@@ -146,21 +130,7 @@ public class EduOnlineMusicGroupController extends BaseController {
     @ApiOperation(value = "分页查询乐团列表")
     @RequestMapping("/queryPage")
     public Object queryPage(MusicGroupQueryInfo queryInfo) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
-        Employee employee = employeeDao.get(sysUser.getId());
-        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
-            queryInfo.setOrganId(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.getOrganId().split(",")))){
-                return failed("非法请求");
-            }
-        }
+        queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
         return succeed(musicGroupService.queryMusicGroupPage(queryInfo));
     }
 

+ 21 - 44
mec-web/src/main/java/com/ym/mec/web/controller/education/EduRegisterController.java

@@ -1,37 +1,26 @@
 package com.ym.mec.web.controller.education;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.dao.CooperationOrganDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
-import com.ym.mec.biz.dal.dao.StudentPreRegistrationDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.Mapper;
 import com.ym.mec.biz.dal.dto.MusicGroupRegAndMoneyDto;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
+import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
+import com.ym.mec.biz.service.OrganizationService;
+import com.ym.mec.biz.service.SysEmployeePositionService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.tenant.TenantContextHolder;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.stream.Collectors;
 
 @RequestMapping("eduRegister")
 @Api(tags = "乐团报名回款统计(教务端)")
@@ -47,40 +36,28 @@ public class EduRegisterController extends BaseController {
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
     @Autowired
-    private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    @Autowired
     private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
     @Autowired
     private StudentPaymentOrderDao studentPaymentOrderDao;
     @Autowired
-    private EmployeeDao employeeDao;
-    @Autowired
     private CooperationOrganDao cooperationOrganDao;
+    @Autowired
+    private SysEmployeePositionService employeePositionService;
+    @Autowired
+    private OrganizationService organizationService;
 
     @ApiOperation(value = "获取分部报名、回款统计")
     @GetMapping("/getRegAndMoney")
     public HttpResponseResult<List<MusicGroupRegAndMoneyDto>> getRegAndMoney(String organId, String musicGroupName) {
-        String organIds = null;
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-        Employee employee = employeeDao.get(sysUser.getId());
-        if (StringUtils.isEmpty(organId)) {
-            organIds = employee.getOrganIdList();
-        } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
-            return failed("用户所在分部异常");
-        } else {
-            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-            if (!list.containsAll(Arrays.asList(organId.split(",")))) {
-                return failed("非法请求");
-            }
-            organIds = organId;
-        }
+        organId = organizationService.getEmployeeOrgan(sysUser.getId(), organId, sysUser.getIsSuperAdmin());
         //是乐团主管,不是分部经理
         List<Integer> cooperationOrganIds = null;
-        List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
-        if (!sysUser.getIsSuperAdmin() && !userRole.contains(SysUserRole.SECTION_MANAGER)) {
+        Boolean onlyForRole = employeePositionService.onlyForRole(SysUserRoleEnum.EDUCATION, sysUser.getId(), sysUser.getIsSuperAdmin());
+        if (onlyForRole) {
             List<CooperationOrgan> cooperationOrgans = cooperationOrganDao.getCooperationOrganByEduTeacherId(sysUser.getId());
             if (cooperationOrgans.size() > 0) {
                 cooperationOrganIds = cooperationOrgans.stream().map(CooperationOrgan::getId).collect(Collectors.toList());
@@ -89,7 +66,7 @@ public class EduRegisterController extends BaseController {
             }
         }
 
-        List<MusicGroupRegAndMoneyDto> musicGroups = musicGroupDao.getMusicGroupByStatus(organIds, cooperationOrganIds, musicGroupName, TenantContextHolder.getTenantId());
+        List<MusicGroupRegAndMoneyDto> musicGroups = musicGroupDao.getMusicGroupByStatus(organId, cooperationOrganIds, musicGroupName, TenantContextHolder.getTenantId());
         if (musicGroups.size() <= 0) {
             return succeed();
         }