yonge 3 năm trước cách đây
mục cha
commit
fb2a2e4c00

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -86,7 +86,7 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @param status
      * @return
      */
-    StudentPaymentOrder findMusicGroupApplyOrderByStatus(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId,
+    List<StudentPaymentOrder> findMusicGroupApplyOrderByStatus(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId,
                                                          @Param("status") DealStatusEnum status);
 
     /**

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

@@ -53,7 +53,7 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
      * @param status
      * @return
      */
-    StudentPaymentOrder findMusicGroupApplyOrderByStatus(Integer userId, String musicGroupId, DealStatusEnum status);
+    List<StudentPaymentOrder> findMusicGroupApplyOrderByStatus(Integer userId, String musicGroupId, DealStatusEnum status);
 
     /**
      * 根据orderNo查询订单

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

@@ -667,121 +667,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 	@Override
 	public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum) {
-		if(true){
-			return transferProduceContract(userId, musicGroupId);
-		}
-
-		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
-
-		if (sysUserTsign == null) {
-			SysUser user = sysUserFeignService.queryUserById(userId);
-			if (user == null) {
-				throw new BizException("用户信息查询失败");
-			}
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
-		}
-		Date date = new Date();
-
-		// 合成freemarker
-		String srcPdfPath = contractBaseDir + "/goods/" + dateFormat1.format(date) + "/" + userId + ".pdf";
-
-		File srcFile = new File(srcPdfPath);
-
-		File debtFile = new File(srcFile.getParent());
-		if (!debtFile.exists()) {
-			debtFile.mkdirs();
-		}
-
-		FreemarkerTemplateEngine templateEngine = FreemarkerTemplateEngine.getInstance();
-		templateEngine.setClassForTemplateLoading(ContractServiceImpl.class, "/config/contracts/");
-
-		Map<String, Object> params = new HashMap<String, Object>();
-
-		// 查询参数信息
-		StudentInfo studentInfo = studentRegistrationService.queryStudentInfo(userId);
-
-		int subjectId = studentInfo.getSubject().getId();
-
-		Subject subject = subjectService.get(subjectId);
-		studentInfo.setSubject(subject);
-
-		params.put("studentInfo", studentInfo);
-
-		List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
-		params.put("goodsList", goodsList);
-
-		double depositFee = 0d;
-		if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
-			StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.SUCCESS);
-
-			if (studentPaymentOrder == null) {
-				MusicGroupSubjectGoodsGroup musicGroupSubjectPlan = musicGroupSubjectGoodsGroupService.query(musicGroupId, subjectId, goodsIds);
-				if (musicGroupSubjectPlan != null) {
-					depositFee = musicGroupSubjectPlan.getDepositFee().doubleValue();
-				}
-			} else {
-
-				List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
-				for (StudentPaymentOrderDetail detail : orderDetailList) {
-					if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
-						depositFee = detail.getPrice().doubleValue();
-					}
-				}
-			}
-		}
-		params.put("depositFee", depositFee);
-		params.put("depositFeeFmt", MoneyUtil.toChinese(depositFee + ""));
-
-		params.put("isShowVisualSeal", false);
-
-		MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-		if (musicGroup == null) {
-			throw new BizException("乐团信息没找到");
-		}
-
-		params.put("ownershipType", musicGroup.getOwnershipType().name());
-
-		templateEngine.render(params, "goods.ftl", srcFile);
-
-		// 生成借款协议PDF
-		try {
-			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
-		} catch (IOException e) {
-			throw new BizException("生成pdf协议失败", e);
-		}
-		String organCode = "";
-		if (musicGroup.getOwnershipType() == OwnershipType.OWN) {
-			organCode = "91440300326364429H";
-		} else {
-			organCode = "91420106333619290A";
-		}
-		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
-		if (organTsign == null) {
-			throw new BizException("甲方未创建签章");
-		}
-
-		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
-
-		if (sysUserTsign != null) {
-			eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-		}
-
-		// 上传到oss
-		String dateStrOss = dateFormatOss.format(date);
-		dateStrOss = "goods/" + dateStrOss + "/" + DateUtil.getHour(date);
-		String pdfFilePath = storagePluginContext.uploadFile(KS3StoragePlugin.PLUGIN_NAME, dateStrOss, srcFile);
-
-		SysUserContracts sysUserContracts = new SysUserContracts();
-		sysUserContracts.setCreateTime(date);
-		sysUserContracts.setType(ContractType.INSTRUMENT);
-		sysUserContracts.setUrl(pdfFilePath);
-		sysUserContracts.setUserId(userId);
-
-		sysUserContractsService.insert(sysUserContracts);
-
-		FileUtils.deleteQuietly(srcFile);
+			
+		return transferProduceContract(userId, musicGroupId);
 
-		return true;
 	}
 
 	@Override

+ 10 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1022,7 +1022,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         Integer userId = studentRegistration.getUserId();
 
-        StudentPaymentOrder applyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        List<StudentPaymentOrder> applyOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        
+        StudentPaymentOrder applyOrder = null;
+        
+        if(applyOrderList != null && applyOrderList.size() > 0){
+        	applyOrder = applyOrderList.get(0);
+        }
+        
         if (applyOrder == null) {
             throw new BizException("没有支付中订单,请在我的订单中查看订单状态");
         }
@@ -2238,10 +2245,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             
             if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
     			if(currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.NORMAL || (currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.APPLY && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES)){
-    				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
-    				if (studentPaymentOrder != null) {
-    					studentPaymentOrderList.add(studentPaymentOrder);
-    				}
+    				studentPaymentOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
     			}
     			
     		} else {
@@ -2564,10 +2568,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         
 		if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
 			if(currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.NORMAL || (currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.APPLY && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES)){
-				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
-				if (studentPaymentOrder != null) {
-					studentPaymentOrderList.add(studentPaymentOrder);
-				}
+				studentPaymentOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
 			}
 			
 		} else {

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

@@ -309,11 +309,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
         	List<StudentPaymentOrder> studentPaymentOrderList = new ArrayList<StudentPaymentOrder>();
 
 			if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
-				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
-				if (studentPaymentOrder != null) {
-					studentPaymentOrderList.add(studentPaymentOrder);
-				}
-
+				studentPaymentOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
 			} else {
 				studentPaymentOrderList = studentPaymentOrderService.queryByBatchNo(userId, studentRegistration.getMusicGroupPaymentCalenderId() + "",
 						DealStatusEnum.SUCCESS);

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

@@ -185,7 +185,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public StudentPaymentOrder findMusicGroupApplyOrderByStatus(Integer userId, String musicGroupId, DealStatusEnum status) {
+    public List<StudentPaymentOrder> findMusicGroupApplyOrderByStatus(Integer userId, String musicGroupId, DealStatusEnum status) {
         return studentPaymentOrderDao.findMusicGroupApplyOrderByStatus(userId, musicGroupId, status);
     }
 

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

@@ -438,10 +438,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         
 		if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
 			if(studentRegistration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL){
-				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentId, musicGroupId, SUCCESS);
-				if (studentPaymentOrder != null) {
-					studentPaymentOrderList.add(studentPaymentOrder);
-				}
+				studentPaymentOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentId, musicGroupId, SUCCESS);
 			}
 		} else {
 			studentPaymentOrderList = studentPaymentOrderService.queryByBatchNo(studentId, studentRegistration.getMusicGroupPaymentCalenderId() + "",

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

@@ -444,7 +444,6 @@
           AND type_ = 'APPLY'
           AND status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         ORDER BY id_ DESC
-        LIMIT 1
     </select>
     
     <select id="queryByBatchNo" resultMap="StudentPaymentOrder" parameterType="map">

+ 9 - 4
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -320,8 +320,12 @@ public class MusicGroupController extends BaseController {
         Integer userId = studentRegistration.getUserId();
 
         //判断用户是否已存在订单
-        StudentPaymentOrder applyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
-        return succeed(applyOrder);
+        List<StudentPaymentOrder> applyOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        
+        if(applyOrderList != null && applyOrderList.size() > 0){
+        	return succeed(applyOrderList.get(0));
+        }
+        return succeed(null);
     }
 
     @ApiOperation(value = "乐团报名支付")
@@ -346,9 +350,10 @@ public class MusicGroupController extends BaseController {
             return failed("您已支付成功,请勿重复支付");
         }*/
         //判断用户是否已存在订单
-        StudentPaymentOrder applyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        List<StudentPaymentOrder> applyOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
         
-        if (applyOrder != null) {
+        if (applyOrderList != null && applyOrderList.size() > 0) {
+        	StudentPaymentOrder applyOrder = applyOrderList.get(0);
         	// 查询订单状态
             PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
             if(payStatus == PayStatus.SUCCESSED){