فهرست منبع

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

zouxuan 3 سال پیش
والد
کامیت
bf54ae8064

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

@@ -289,7 +289,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
 
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(sysUser.getOrganId());
         if(Objects.isNull(practiceGroupSellPrice)){
-            throw new BizException("所在城市暂不参与此活动");
+            throw new BizException("该分部未设置网管课价格");
         }
         BigDecimal oneMonthPrice;
         BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
@@ -633,7 +633,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
 
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(sysUser.getOrganId());
         if(Objects.isNull(practiceGroupSellPrice)){
-            throw new BizException("所在城市暂不参与此活动");
+            throw new BizException("该分部未设置网管课价格");
         }
 
         BigDecimal price = PracticeGroupType.CARE_PACKAGE.equals(practiceGroupBuyParams.getType())?practiceGroupSellPrice.getCarePackagePrice():practiceGroupSellPrice.getComeOnPackagePrice();

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

@@ -111,7 +111,7 @@ public class PayServiceImpl implements PayService {
         }
         
         //如果当前是买的小课/网管课
-		if (studentPaymentOrder.getType() == OrderTypeEnum.SMALL_CLASS_TO_BUY || studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_BUY
+		if (studentPaymentOrder != null && studentPaymentOrder.getType() == OrderTypeEnum.SMALL_CLASS_TO_BUY || studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_BUY
 				|| studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_RENEW) {
 			
 			// 是否由平台收款

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

@@ -2422,7 +2422,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(sysUser.getOrganId());
         if (Objects.isNull(practiceGroupSellPrice)) {
-            throw new BizException("所在城市暂不参与此活动");
+            throw new BizException("该分部未设置网管课价格");
         }
         BigDecimal oneMonthPrice = practiceGroupSellPrice.getSingleClassMinutesPrice();
         BigDecimal amount = oneMonthPrice.multiply(new BigDecimal(practiceGroupBuyParams.getAllCourseNum()));
@@ -2875,7 +2875,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(sysUser.getOrganId());
         if (Objects.isNull(practiceGroupSellPrice)) {
-            throw new BizException("所在城市暂不参与此活动");
+            throw new BizException("该分部未设置网管课价格");
         }
 
         BigDecimal amount = PracticeGroupType.CARE_PACKAGE.equals(practiceGroupBuyParams.getType()) ? practiceGroupSellPrice.getCarePackagePrice() : practiceGroupSellPrice.getComeOnPackagePrice();
@@ -4211,7 +4211,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(practice.getOrganId());
         if (Objects.isNull(practiceGroupSellPrice)) {
-            throw new BizException("所在城市暂不参与此活动");
+            throw new BizException("该分部未设置网管课价格!");
         }
         Map<String, BigDecimal> results = new HashMap<>(3);
 

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

@@ -75,7 +75,7 @@
 		SELECT mgn.*,su.real_name_ FROM music_group_news mgn
 		LEFT JOIN sys_user su ON  su.id_ = mgn.operator_id_
 		<where>
-			tenant_id_ = #{tenantId}
+            mgn.tenant_id_ = #{tenantId}
 			<if test="search != null and search != ''">
 				mgn.music_group_id_ = #{search}
 			</if>
@@ -91,7 +91,7 @@
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(mgn.id_) FROM music_group_news mgn
 		<where>
-			tenant_id_ = #{tenantId}
+            mgn.tenant_id_ = #{tenantId}
 			<if test="search != null and search != ''">
 				mgn.music_group_id_ = #{search}
 			</if>

+ 39 - 0
mec-web/src/main/java/com/ym/mec/web/controller/UploadFileController.java

@@ -3,10 +3,18 @@ package com.ym.mec.web.controller;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiParam;
 
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.Base64Utils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -28,6 +36,8 @@ public class UploadFileController extends BaseController {
 
 	@Autowired
 	private UploadFileService uploadFileService;
+	
+	private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
 
 	@PostMapping(value = "uploadFile")
 	public Object uploadFile(@ApiParam(value = "上传的文件", required = true) @RequestParam("file") MultipartFile file) {
@@ -45,4 +55,33 @@ public class UploadFileController extends BaseController {
 		}
 		return failed("上传失败");
 	}
+
+	@PostMapping(value = "uploadFileWithBase64")
+	public Object uploadFileWithBase64(String fileName, String extName, String base64Str) throws IOException {
+		if (StringUtils.isBlank(fileName)) {
+			return failed("文件名不能为空");
+		}
+
+		base64Str = base64Str.replaceAll("data:image/"+ extName +";base64,", "");
+		
+		String tmpfileName = sdf.format(new Date()) + (new Random().nextInt(9000) % (9000 - 1000 + 1) + 1000) + "." + extName;
+
+		File file = new File(tmpfileName);
+
+		FileUtils.writeByteArrayToFile(file, Base64Utils.decodeFromString(base64Str));
+
+		if (file.exists()) {
+			UploadReturnBean bean = uploadFileService.uploadFile(FileUtils.openInputStream(file), UploadUtil.getExtension(fileName));
+			bean.setName(fileName);
+			
+			FileUtils.deleteQuietly(file);
+			
+			if (bean.isStatus()) {
+				return succeed(bean);
+			}
+			return failed(bean.getMessage());
+		}
+		
+		return failed();
+	}
 }