Sfoglia il codice sorgente

feat: 教务端代买用户协议生成

Joburgess 4 anni fa
parent
commit
eba7aef2f4

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

@@ -12,6 +12,8 @@ import java.util.stream.Collectors;
 import com.ym.mec.biz.dal.dao.StudentDao;
 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.InitializingBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -128,6 +130,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 	private DateFormat dateFormat1 = new SimpleDateFormat("yyMMddHHmmSS");
 
+	private final Logger logger = LoggerFactory.getLogger(ContractService.class);
+
 	@Override
 	public void afterPropertiesSet() throws Exception {
 		// 注册企业账户
@@ -947,6 +951,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		SysUser user = studentDao.lockUserReturnInfo(userId);
 
 		if (user == null) {
+			logger.error("用户不存在({})", userId);
 			return false;
 		}
 
@@ -956,6 +961,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		}
 
 		if(StringUtils.isBlank(user.getRealName())||StringUtils.isBlank(user.getIdCardNo())){
+			logger.error("身份信息缺失({})", userId);
 			return false;
 		}
 
@@ -991,7 +997,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		}else{
 			MusicGroup musicGroup = musicGroupService.get(musicGroupId);
 			if (musicGroup == null) {
-				throw new BizException("乐团信息没找到");
+				logger.error("乐团信息没找到({})", musicGroupId);
+				return false;
 			}
 			params.put("ownershipType", musicGroup.getOwnershipType().name());
 		}
@@ -1002,7 +1009,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		try {
 			PDFUtil.renderToPDFByData(ContractServiceImpl.class.getResource("/").getFile(), FileUtils.readFileToString(srcFile), srcPdfPath, "simsun.ttc");
 		} catch (IOException e) {
-			throw new BizException("生成产品协议失败", e);
+			logger.error("生成产品协议失败", e);
+			return false;
 		}
 
 
@@ -1014,7 +1022,8 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		}
 		SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
 		if (organTsign == null) {
-			throw new BizException("甲方未创建签章");
+			logger.error("甲方未创建签章");
+			return false;
 		}
 
 		eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);