Browse Source

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

liweifan 3 years ago
parent
commit
d74e1ab73c
19 changed files with 375 additions and 186 deletions
  1. 174 166
      cms/src/main/java/com/ym/mec/cms/controller/NewsController.java
  2. 5 1
      cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java
  3. 2 0
      cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java
  4. 1 1
      cms/src/main/java/com/ym/mec/cms/service/SysNewsTypeService.java
  5. 6 1
      cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java
  6. 4 2
      cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsTypeServiceImpl.java
  7. 20 0
      cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml
  8. 4 4
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/provider/PhoneAuthenticationProvider.java
  9. 5 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkStudentDetailDto.java
  10. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java
  11. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java
  12. 13 1
      mec-biz/src/main/resources/config/mybatis/HfMerchantConfigMapper.xml
  13. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  14. 5 1
      mec-im/src/main/java/com/ym/service/Impl/LiveRoomServiceImpl.java
  15. 12 0
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/StoragePlugin.java
  16. 18 0
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/StoragePluginContext.java
  17. 6 1
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/provider/AliyunOssStoragePlugin.java
  18. 14 0
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/provider/KS3StoragePlugin.java
  19. 83 0
      mec-web/src/main/java/com/ym/mec/web/controller/HfMerchantConfigController.java

+ 174 - 166
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -1,32 +1,8 @@
 package com.ym.mec.cms.controller;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiOperation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-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.auth.api.entity.SysUser;
 import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
-import com.ym.mec.cms.dal.dao.StudentRegistrationDao;
 import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
 import com.ym.mec.cms.dal.entity.SysConfig;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
@@ -34,160 +10,192 @@ import com.ym.mec.cms.service.SysConfigService;
 import com.ym.mec.cms.service.SysNewsInformationService;
 import com.ym.mec.cms.service.SysNewsTypeService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.web.WebFeignService;
 import com.yonge.log.model.AuditLogAnnotation;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
 
-import javax.validation.constraints.NotNull;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("news")
 @Api(tags = "资讯服务")
 public class NewsController extends BaseController {
 
-	@Autowired
-	private SysNewsInformationService sysNewsInformationService;
-	@Autowired
-	private SysNewsTypeService sysNewsTypeService;
-	@Autowired
-	private SysNewsInformationDao sysNewsInformationDao;
-	@Autowired
-	private SysUserFeignService sysUserFeignService;
-	@Autowired
-	private WebFeignService webFeignService;
-	@Autowired
-	private SysConfigService sysConfigService;
-
-	@ApiOperation("资讯列表分页查询")
-	@GetMapping(value = "/list")
-	public Object getList(NewsInformationQueryInfo queryInfo) {
-		if(queryInfo.getType() == 6 || queryInfo.getType() == 4){
-			queryInfo.setTenantId(-1);
-		}
-		String clientId = queryInfo.getClientId();
-
-		SysUser user = sysUserFeignService.queryUserInfo();
-		if (user == null || user.getId() == null) {
-			queryInfo.setOrganId(43);
-			queryInfo.setExcludeIds(new ArrayList<>());
-		} else {
-			if (!StringUtils.equalsIgnoreCase("student", clientId)) {
-				queryInfo.setOrganIdList(webFeignService.queryOrganIdByUserId(user.getId(), clientId));
-			}else {
-				queryInfo.setOrganId(user.getOrganId());
-			}
-		}
-		
-		Map<String, Object> params = new HashMap<String, Object>();
-		MapUtil.populateMap(params, queryInfo);
-		int count = sysNewsInformationDao.queryCount(params);
-		if(count == 0){
-			queryInfo.setMemo(null);
-		}
-		return succeed(sysNewsInformationService.queryPage(queryInfo));
-	}
-
-	@ApiOperation("资讯列表分页查询")
-	@GetMapping(value = "/queryPage")
-	public Object queryPage(NewsInformationQueryInfo queryInfo) {
-		
-		if(queryInfo.getType() != null && (queryInfo.getType() == 6 || queryInfo.getType() == 4)){
-			queryInfo.setTenantId(-1);
-		}
-		
-		Map<String, Object> params = new HashMap<String, Object>();
-		MapUtil.populateMap(params, queryInfo);
-		int count = sysNewsInformationDao.queryCount(params);
-		if(count == 0){
-			queryInfo.setMemo(null);
-		}
-		return succeed(sysNewsInformationService.queryPage(queryInfo));
-	}
-
-	@ApiOperation("资讯类型列表查询")
-	@GetMapping(value = "/typeList")
-	public Object getTypeList(Integer parentId) {
-		return succeed(sysNewsTypeService.queryByParentId(parentId));
-	}
-
-	@ApiOperation("资讯列表分页查询")
-	@GetMapping(value = "/homeList")
-	public Object getHomeList(NewsInformationQueryInfo queryInfo) {
-		queryInfo.setRows(10);
-		SysUser user = sysUserFeignService.queryUserInfo();
-		SysConfig cloudTeacherActiveIds = sysConfigService.findByParamName(SysConfigService.CLOUD_TEACHER_ACTIVE_BANNER_IDS);
-		List<Integer> excludeIds = new ArrayList<>();
-		if(Objects.nonNull(cloudTeacherActiveIds)&&StringUtils.isNotBlank(cloudTeacherActiveIds.getParanValue())){
-			excludeIds = Arrays.stream(cloudTeacherActiveIds.getParanValue().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
-		}
-		if (user == null || user.getId() == null) {
-			queryInfo.setOrganId(43);
-			queryInfo.setTenantId(1);
-			queryInfo.setExcludeIds(excludeIds);
-		} else {
-			queryInfo.setOrganId(user.getOrganId());
-		}
-		return succeed(sysNewsInformationService.getHomeList(user, queryInfo));
-	}
-
-	@ApiOperation("查询资讯详情")
-	@ApiImplicitParam(name = "id", value = "资讯ID编号", required = true, dataType = "Long", paramType = "path")
-	@GetMapping(value = "/query")
-	public Object query(Long id) {
-
-		return succeed(sysNewsInformationService.queryById(id));
-	}
-
-	@ApiOperation("新增资讯")
-	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@AuditLogAnnotation(operateName = "资讯新增",interfaceURL = "news/add")
-	@PreAuthorize("@pcs.hasPermissions('news/add')")
-	public Object add(SysNewsInformation newsInfo) {
-		
-		if(newsInfo.getType() == 6 || newsInfo.getType() == 4){
-			newsInfo.setTenantId(-1);
-		}
-		if (newsInfo.getContent().length() > 7999) {
-			return failed("内容过长");
-		}
-		return succeed(sysNewsInformationService.insert(newsInfo));
-	}
-
-	@ApiOperation("更新资讯")
-	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@AuditLogAnnotation(operateName = "资讯更新",interfaceURL = "news/update")
-	@PreAuthorize("@pcs.hasPermissions('news/update')")
-	public Object update(SysNewsInformation newsInfo) {
-		Date date = new Date();
-		newsInfo.setUpdateTime(date);
-		
-		SysNewsInformation originNewsInfo = sysNewsInformationService.get(newsInfo.getId());
-		if(originNewsInfo == null){
-			return failed("请求参数错误");
-		}
-		
-		if(newsInfo.getType() == null){
-			newsInfo.setType(originNewsInfo.getType());
-		}
-		
-		if(newsInfo.getType() == 6 || newsInfo.getType() == 4){
-			newsInfo.setTenantId(-1);
-		}
-		return succeed(sysNewsInformationService.update(newsInfo));
-	}
-
-	@ApiOperation("删除")
-	@PostMapping(value = "/del/{id}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@AuditLogAnnotation(operateName = "资讯删除",interfaceURL = "news/del")
-	@PreAuthorize("@pcs.hasPermissions('news/del')")
-	public Object add(@PathVariable("id") Long id) {
-		return succeed(sysNewsInformationService.deleteWithLogical(id));
-	}
+    @Autowired
+    private SysNewsInformationService sysNewsInformationService;
+    @Autowired
+    private SysNewsTypeService sysNewsTypeService;
+    @Autowired
+    private SysNewsInformationDao sysNewsInformationDao;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private WebFeignService webFeignService;
+    @Autowired
+    private SysConfigService sysConfigService;
+
+    @ApiOperation("查询底部按钮信息")
+    @GetMapping(value = "/queryBottomInfo")
+    public HttpResponseResult<List<SysNewsInformation>> queryBySubType(String clientName) {
+        Optional<String> optional = Optional.ofNullable(clientName);
+        optional.orElseThrow(() -> new BizException("clientName不能为空"));
+        boolean b = WrapperUtil.checkStr(clientName.toLowerCase(), "student", "teacher");
+        Integer subType;
+        if (b) {
+            // 学生21  老师22
+            subType = optional.filter(q -> q.equalsIgnoreCase("student"))
+                    .map(q -> 21)
+                    .orElse(22);
+        } else {
+            return failed("参数错误");
+        }
+        return succeed(sysNewsInformationService.queryBottomInfo(subType));
+    }
+
+    @ApiOperation("资讯列表分页查询")
+    @GetMapping(value = "/list")
+    public Object getList(NewsInformationQueryInfo queryInfo) {
+        if (queryInfo.getType() == 6 || queryInfo.getType() == 4) {
+            queryInfo.setTenantId(-1);
+        }
+        String clientId = queryInfo.getClientId();
+
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || user.getId() == null) {
+            queryInfo.setOrganId(43);
+            queryInfo.setExcludeIds(new ArrayList<>());
+        } else {
+            if (!StringUtils.equalsIgnoreCase("student", clientId)) {
+                queryInfo.setOrganIdList(webFeignService.queryOrganIdByUserId(user.getId(), clientId));
+            } else {
+                queryInfo.setOrganId(user.getOrganId());
+            }
+        }
+
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+        int count = sysNewsInformationDao.queryCount(params);
+        if (count == 0) {
+            queryInfo.setMemo(null);
+        }
+        return succeed(sysNewsInformationService.queryPage(queryInfo));
+    }
+
+    @ApiOperation("资讯列表分页查询")
+    @GetMapping(value = "/queryPage")
+    public Object queryPage(NewsInformationQueryInfo queryInfo) {
+
+        if (queryInfo.getType() != null && (queryInfo.getType() == 6 || queryInfo.getType() == 4)) {
+            queryInfo.setTenantId(-1);
+        }
+
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+        int count = sysNewsInformationDao.queryCount(params);
+        if (count == 0) {
+            queryInfo.setMemo(null);
+        }
+        return succeed(sysNewsInformationService.queryPage(queryInfo));
+    }
+
+    @ApiOperation("资讯类型列表查询")
+    @GetMapping(value = "/typeList")
+    public Object getTypeList(Integer parentId) {
+        return succeed(sysNewsTypeService.queryByParentId(parentId));
+    }
+
+    @ApiOperation("资讯列表分页查询")
+    @GetMapping(value = "/homeList")
+    public Object getHomeList(NewsInformationQueryInfo queryInfo) {
+        queryInfo.setRows(10);
+        SysUser user = sysUserFeignService.queryUserInfo();
+        SysConfig cloudTeacherActiveIds = sysConfigService.findByParamName(SysConfigService.CLOUD_TEACHER_ACTIVE_BANNER_IDS);
+        List<Integer> excludeIds = new ArrayList<>();
+        if (Objects.nonNull(cloudTeacherActiveIds) && StringUtils.isNotBlank(cloudTeacherActiveIds.getParanValue())) {
+            excludeIds = Arrays.stream(cloudTeacherActiveIds.getParanValue().split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
+        }
+        if (user == null || user.getId() == null) {
+            queryInfo.setOrganId(43);
+            queryInfo.setTenantId(1);
+            queryInfo.setExcludeIds(excludeIds);
+        } else {
+            queryInfo.setOrganId(user.getOrganId());
+        }
+        return succeed(sysNewsInformationService.getHomeList(user, queryInfo));
+    }
+
+    @ApiOperation("查询资讯详情")
+    @ApiImplicitParam(name = "id", value = "资讯ID编号", required = true, dataType = "Long", paramType = "path")
+    @GetMapping(value = "/query")
+    public Object query(Long id) {
+
+        return succeed(sysNewsInformationService.queryById(id));
+    }
+
+    @ApiOperation("新增资讯")
+    @PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @AuditLogAnnotation(operateName = "资讯新增", interfaceURL = "news/add")
+    @PreAuthorize("@pcs.hasPermissions('news/add')")
+    public Object add(SysNewsInformation newsInfo) {
+
+        if (newsInfo.getType() == 6 || newsInfo.getType() == 4) {
+            newsInfo.setTenantId(-1);
+        }
+        if (newsInfo.getContent().length() > 7999) {
+            return failed("内容过长");
+        }
+        return succeed(sysNewsInformationService.insert(newsInfo));
+    }
+
+    @ApiOperation("更新资讯")
+    @PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @AuditLogAnnotation(operateName = "资讯更新", interfaceURL = "news/update")
+    @PreAuthorize("@pcs.hasPermissions('news/update')")
+    public Object update(SysNewsInformation newsInfo) {
+        Date date = new Date();
+        newsInfo.setUpdateTime(date);
+
+        SysNewsInformation originNewsInfo = sysNewsInformationService.get(newsInfo.getId());
+        if (originNewsInfo == null) {
+            return failed("请求参数错误");
+        }
+
+        if (newsInfo.getType() == null) {
+            newsInfo.setType(originNewsInfo.getType());
+        }
+
+        if (newsInfo.getType() == 6 || newsInfo.getType() == 4) {
+            newsInfo.setTenantId(-1);
+        }
+        return succeed(sysNewsInformationService.update(newsInfo));
+    }
+
+    @ApiOperation("删除")
+    @PostMapping(value = "/del/{id}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+    @AuditLogAnnotation(operateName = "资讯删除", interfaceURL = "news/del")
+    @PreAuthorize("@pcs.hasPermissions('news/del')")
+    public Object add(@PathVariable("id") Long id) {
+        return succeed(sysNewsInformationService.deleteWithLogical(id));
+    }
 
 	@ApiOperation("查询资讯详情")
-	@ApiImplicitParam(name = "id", value = "资讯ID编号", required = true, dataType = "Long")
+	@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "资讯ID编号", required = true, dataType = "Long"),
+						@ApiImplicitParam(name = "memo", value = "版本号",  dataType = "String") })
 	@GetMapping("/list/tree")
-	public Object listWithTree(Integer id) {
-		return succeed(sysNewsTypeService.listWithTree(id));
+	public Object listWithTree(Integer id,String memo) {
+		return succeed(sysNewsTypeService.listWithTree(id,memo));
 	}
 }

+ 5 - 1
cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java

@@ -15,7 +15,9 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	 * @param type
 	 * @return
 	 */
-	List<SysNewsInformation> queryByType(@Param("type") Integer type);
+	List<SysNewsInformation> queryByType(@Param("type") Integer type,@Param("subType") Integer subType);
+
+	List<SysNewsInformation> queryBottomInfo(@Param("subType") Integer subType);
 
 	/**
 	 * 逻辑删除
@@ -35,4 +37,6 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	List<SysNewsInformation> queryNeedUpdateStatusList();
 	
 	SysNewsInformationDto queryById(Long id);
+
+	List<SysNewsInformation> queryBySubType(@Param("subType") Integer subType,@Param("memo") String memo);
 }

+ 2 - 0
cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java

@@ -19,6 +19,8 @@ public interface SysNewsInformationService extends BaseService<Long, SysNewsInfo
 	 */
 	List<SysNewsInformation> queryByType(Integer type);
 
+    List<SysNewsInformation> queryBottomInfo(Integer subType);
+
 	/**
 	 * 逻辑删除
 	 * @param id

+ 1 - 1
cms/src/main/java/com/ym/mec/cms/service/SysNewsTypeService.java

@@ -13,5 +13,5 @@ public interface SysNewsTypeService extends BaseService<Integer, SysNewsType> {
 	//根据父级查询子集
 	List<SysNewsTypeTree> queryByParentId(Integer parentId);
 
-	List<SysNewsType> listWithTree(Integer id);
+	List<SysNewsType> listWithTree(Integer id,String memo);
 }

+ 6 - 1
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -50,9 +50,14 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 
 	@Override
 	public List<SysNewsInformation> queryByType(Integer type) {
-		return sysNewsInformationDao.queryByType(type);
+		return sysNewsInformationDao.queryByType(type,null);
 	}
 
+    @Override
+    public List<SysNewsInformation> queryBottomInfo(Integer subType) {
+        return sysNewsInformationDao.queryBottomInfo(subType);
+    }
+
 	@Override
 	public boolean deleteWithLogical(Long id) {
 		sysNewsInformationDao.deleteWithLogical(id);

+ 4 - 2
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsTypeServiceImpl.java

@@ -51,14 +51,16 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
         return sysNewsTypeDao.queryByParentId(parentId);
     }
 
-    public List<SysNewsType> listWithTree(Integer id) {
+    public List<SysNewsType> listWithTree(Integer id, String memo) {
         SysNewsType newsType = sysNewsTypeDao.get(id);
         List<SysNewsType> all = sysNewsTypeDao.findAll(null);
 
         all.forEach(e -> {
-            List<SysNewsInformation> list = informationDao.queryByType(e.getId());
+            List<SysNewsInformation> list = informationDao.queryBySubType(e.getId(), memo);
             if (CollectionUtils.isNotEmpty(list)) {
                 e.setInformationList(list);
+            } else {
+                e.setInformationList(informationDao.queryBySubType(e.getId(), null));
             }
         });
 

+ 20 - 0
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -192,8 +192,17 @@
 			<if test="type != null">
 				and type_ = #{type}
 			</if>
+			<if test="subType != null">
+				and sub_type_ = #{subType}
+			</if>
 		</where>
 	</select>
+
+    <select id="queryBottomInfo" resultMap="SysNewsInformation" parameterType="java.lang.Integer">
+        SELECT * FROM sys_news_information
+        where del_flag_=0 and status_ = 1
+                and sub_type_ = #{subType}
+    </select>
 	
 	<update id="deleteWithLogical">
 		UPDATE sys_news_information SET del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
@@ -303,4 +312,15 @@
 		left join sys_news_type snts on sni.sub_type_ = snts.id_
 		where sni.id_ = #{id}
 	</select>
+	<select id="queryBySubType" resultMap="SysNewsInformation">
+		SELECT * FROM sys_news_information
+		WHERE del_flag_=0
+		AND status_=1
+		<if test="subType != null">
+			AND sub_type_ = #{subType}
+		</if>
+		<if test="memo != null and memo !=''">
+			AND memo_ = #{memo}
+		</if>
+	</select>
 </mapper>

+ 4 - 4
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/provider/PhoneAuthenticationProvider.java

@@ -78,10 +78,10 @@ public class PhoneAuthenticationProvider extends AbstractAuthenticationProvider
 				throw new LockedException("用户不存在");
 			}
 			//如果机构不一致,不允许跨机构注册
-			if(loginEntity.getTenantId() != null && loginEntity.getTenantId() != 0 &&
-					!loginEntity.getTenantId().equals(user.getTenantId())){
-				throw new LockedException("用户已注册");
-			}
+//			if(loginEntity.getTenantId() != null && loginEntity.getTenantId() != 0 &&
+//					!loginEntity.getTenantId().equals(user.getTenantId())){
+//				throw new LockedException("用户已注册");
+//			}
 			if (StringUtils.isNotBlank(deviceNum)) {
 				sysUserDeviceService.bindDevice(clientId, user.getId(), deviceNum, userInfo.getSysUser().getTenantId());
 			}

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkStudentDetailDto.java

@@ -86,14 +86,14 @@ public class CourseHomeworkStudentDetailDto {
     
     private MusicGroupTrainPlan musicGroupTrainPlan;
 
-    private Date submitDate;
+    private Date submitTime;
 
-    public Date getSubmitDate() {
-        return submitDate;
+    public Date getSubmitTime() {
+        return submitTime;
     }
 
-    public void setSubmitDate(Date submitDate) {
-        this.submitDate = submitDate;
+    public void setSubmitTime(Date submitTime) {
+        this.submitTime = submitTime;
     }
 
     public boolean getExpire() {

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

@@ -396,7 +396,7 @@ public class PayServiceImpl implements PayService {
             routeScaleDtos = noUsePaymentConfig(amount); //款项都收到平台商户
         }
 
-        //根据费用类型
+        //根据费用类型,mark
         if (routeScaleDtos == null) {
             routeScaleDtos = getTypeRouteChannel(organId, orderNo, amount, balanceAmount);
         }

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

@@ -226,7 +226,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 		}
 		
         CourseHomeworkStudentDetailDto courseHomeworkStudentDetail = studentCourseHomeworkDao.findCourseHomeworkStudentDetail(courseScheduleID, userId);
-        courseHomeworkStudentDetail.setExpire(DateUtil.isOverdue(courseHomeworkStudentDetail.getSubmitDate(),
+        courseHomeworkStudentDetail.setExpire(DateUtil.isOverdue(courseHomeworkStudentDetail.getSubmitTime(),
                 sysConfigDao.findConfigValue("file_expiration_time")));
         if(courseHomeworkStudentDetail == null){
         	courseHomeworkStudentDetail = new CourseHomeworkStudentDetailDto();

+ 13 - 1
mec-biz/src/main/resources/config/mybatis/HfMerchantConfigMapper.xml

@@ -100,16 +100,28 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="HfMerchantConfig" parameterType="map">
-		SELECT * FROM hf_merchant_config ORDER BY id_
+		SELECT * FROM hf_merchant_config
+        <include refid="queryPageSql"/>
+		ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM hf_merchant_config
+        <include refid="queryPageSql"/>
 	</select>
 	
 	<select id="queryByTenantId" resultMap="HfMerchantConfig">
 		SELECT * FROM hf_merchant_config where tenant_id_ = #{tenantId}
 	</select>
+
+    <sql id="queryPageSql">
+        <where>
+            <if test="tenantId != null">
+                AND tenant_id_ = #{tenantId}
+            </if>
+        </where>
+    </sql>
+
 </mapper>

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

@@ -1062,7 +1062,7 @@
         LIMIT 1
     </select>
     <select id="countByActivityIds" resultType="java.lang.Integer">
-        SELECT COUNT(0) FROM student_payment_order WHERE user_id_ = #{userId} AND activity_id_ IN
+        SELECT COUNT(0) FROM student_payment_order WHERE user_id_ = #{userId} AND status_ = 'SUCCESS' AND activity_id_ IN
         <foreach collection="activityIds" item="activityId" open="(" close=")" separator=",">
             #{activityId}
         </foreach>

+ 5 - 1
mec-im/src/main/java/com/ym/service/Impl/LiveRoomServiceImpl.java

@@ -8,6 +8,8 @@ import com.ym.mec.biz.service.ImLiveRoomVideoService;
 import com.ym.mec.common.entity.ImRoomMessage;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.im.IMHelper;
+import com.ym.mec.thirdparty.storage.StoragePluginContext;
+import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
 import com.ym.pojo.IMApiResultInfo;
 import com.ym.pojo.IMUserOnlineInfo;
 import com.ym.pojo.RecordConfig;
@@ -40,6 +42,8 @@ public class LiveRoomServiceImpl implements LiveRoomService {
     private RedissonClient redissonClient;
     @Autowired
     private ImLiveRoomVideoService imLiveRoomVideoService;
+    @Autowired
+    private StoragePluginContext storagePluginContext;
 
     /**
      * 创建房间-聊天室
@@ -158,7 +162,7 @@ public class LiveRoomServiceImpl implements LiveRoomService {
         if (recordNotify.getCode().equals(200)) {
             if (Objects.nonNull(recordNotify.getType()) && recordNotify.getType() == 4) {
                 //云端录制文件地址
-                String fileUrl = recordNotify.getOutput().getFileUrl();
+                String fileUrl = storagePluginContext.getPublicUrl(recordNotify.getOutput().getFileUrl(),"live-rewind");
                 String roomId = recordNotify.getRoomId();
                 //写入数据库
                 try {

+ 12 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/StoragePlugin.java

@@ -43,4 +43,16 @@ public interface StoragePlugin {
 	 * @return
 	 */
 	PostObjectFormFields getUploadSign(UploadSign uploadSign);
+
+	/**
+	 * @describe 设置文件访问为私有或公开
+	 * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+	 * @author zx
+	 * @date 2022/7/13
+	 * @time 11:35
+	 * @param fileName:
+	 * @param isPublic:
+	 * @return void
+	 */
+	void setFileAcl(String fileName,Boolean isPublic,String bucketName);
 }

+ 18 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/StoragePluginContext.java

@@ -6,6 +6,7 @@ import java.util.Map;
 
 import com.ksyun.ks3.dto.PostObjectFormFields;
 import com.ym.mec.thirdparty.entity.UploadSign;
+import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
 import org.springframework.stereotype.Component;
 
 import com.ym.mec.thirdparty.exception.ThirdpartyException;
@@ -37,6 +38,23 @@ public class StoragePluginContext {
 		return StoragePlugin.getUploadSign(uploadSign);
 	}
 
+	public void setFileAcl(String storagePluginName,String fileName,Boolean isPublic,String bucketName){
+		StoragePlugin storagePlugin = getStoragePlugin(storagePluginName);
+		storagePlugin.setFileAcl(fileName,isPublic,bucketName);
+	}
+
+	public String getPublicUrl(String fileName,String bucketName){
+		try {
+			String substring = fileName.substring(0, fileName.lastIndexOf("?"));
+			String substring1 = substring.substring(substring.lastIndexOf("/") + 1);
+			this.setFileAcl(KS3StoragePlugin.PLUGIN_NAME,substring1,true,bucketName);
+			return substring;
+		}catch (Exception e) {
+			e.printStackTrace();
+		}
+		return fileName;
+	}
+
 	private StoragePlugin getStoragePlugin(String storagePluginName) {
 		StoragePlugin storagePlugin = mapper.get(storagePluginName);
 

+ 6 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/provider/AliyunOssStoragePlugin.java

@@ -168,7 +168,12 @@ public class AliyunOssStoragePlugin implements StoragePlugin, InitializingBean,
 		return client.postObject(bucketName, fileName, postData, unknowValueField);
 	}
 
-	@Override
+    @Override
+    public void setFileAcl(String fileName, Boolean isPublic,String bucketName) {
+		return;
+    }
+
+    @Override
 	public void destroy() throws Exception {
 		if (ossClient != null) {
 			ossClient.shutdown();

+ 14 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/storage/provider/KS3StoragePlugin.java

@@ -8,6 +8,7 @@ import java.util.Map;
 
 import com.ksyun.ks3.dto.PostObjectFormFields;
 import com.ym.mec.thirdparty.entity.UploadSign;
+import com.ksyun.ks3.service.request.PutObjectACLRequest;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.util.IOUtils;
@@ -192,6 +193,19 @@ public class KS3StoragePlugin implements StoragePlugin, InitializingBean, Dispos
 	}
 
 	@Override
+	public void setFileAcl(String fileName, Boolean isPublic,String bucketName) {
+		PutObjectACLRequest request = new PutObjectACLRequest(bucketName,fileName);
+		if (isPublic){
+			//设为公开读
+			request.setCannedAcl(CannedAccessControlList.PublicRead);
+		}else {
+			//设为私有
+			request.setCannedAcl(CannedAccessControlList.Private);
+		}
+		client.putObjectACL(request);
+	}
+
+	@Override
 	public void destroy() throws Exception {
 	}
 

+ 83 - 0
mec-web/src/main/java/com/ym/mec/web/controller/HfMerchantConfigController.java

@@ -0,0 +1,83 @@
+package com.ym.mec.web.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.huifu.adapay.Adapay;
+import com.huifu.adapay.model.MerConfig;
+import com.ym.mec.biz.service.HfMerchantConfigService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * (HfMerchantConfig)表控制层
+ *
+ * @author hgw
+ * @since 2022-07-13 10:07:36
+ */
+@RestController
+@RequestMapping("/hfMerchantConfig")
+public class HfMerchantConfigController extends BaseController {
+    private static final Logger log = LoggerFactory.getLogger(HfMerchantConfigController.class);
+    /**
+     * 服务对象
+     */
+    @Resource
+    private HfMerchantConfigService hfMerchantConfigService;
+
+    @ApiOperation("创建汇付商户配置")
+    @PostMapping("/add")
+    public HttpResponseResult<Object> add(@RequestBody HfMerchantConfig dto) throws Exception {
+        long insert = hfMerchantConfigService.insert(dto);
+        if (insert == 1) {
+            MerConfig merConfig = new MerConfig();
+            merConfig.setApiKey(dto.getApiKey());
+            merConfig.setApiMockKey(dto.getMockApiKey());
+            merConfig.setRSAPrivateKey(dto.getRsaPrivateKey());
+            Adapay.addMerConfig(merConfig, dto.getMerKey());
+            MerConfig config = Adapay.getConfig(dto.getMerKey());
+            log.info("HfMerchantConfig in config:{}", JSONObject.toJSONString(config));
+            return succeed();
+        }
+        return failed("添加失败");
+    }
+
+    @ApiOperation("创建汇付商户配置")
+    @PostMapping("/update")
+    public HttpResponseResult<Object> update(@RequestBody HfMerchantConfig dto) throws Exception {
+        int update = hfMerchantConfigService.update(dto);
+        if (update == 1) {
+            MerConfig merConfig = new MerConfig();
+            merConfig.setApiKey(dto.getApiKey());
+            merConfig.setApiMockKey(dto.getMockApiKey());
+            merConfig.setRSAPrivateKey(dto.getRsaPrivateKey());
+            Adapay.addMerConfig(merConfig, dto.getMerKey());
+            MerConfig config = Adapay.getConfig(dto.getMerKey());
+            log.info("HfMerchantConfig up config:{}", JSONObject.toJSONString(config));
+            return succeed();
+        }
+        return failed("修改失败");
+    }
+
+    @ApiOperation("根据机构id查询汇付商户配置")
+    @GetMapping(value = "/queryByTenantId/{id}")
+    public HttpResponseResult<HfMerchantConfig> queryByTenantId(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {
+        return succeed(hfMerchantConfigService.queryByTenantId(id));
+    }
+
+    @ApiOperation("分页查询汇付商户配置")
+    @PostMapping(value = "/queryPage")
+    public HttpResponseResult<PageInfo<HfMerchantConfig>> queryPage(@RequestBody QueryInfo dto) {
+        return succeed(hfMerchantConfigService.queryPage(dto));
+    }
+
+}
+