yonge 2 years ago
parent
commit
02abe313c6

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ContractService.java

@@ -118,6 +118,13 @@ public interface ContractService {
 	 * @return
 	 */
 	void transferProduceContract(Integer userId, String musicGroupId, OrderTypeEnum orderType);
+	
+	/**
+	 * 传递产品协议
+	 * @param userId
+	 * @return
+	 */
+	void transferProduceContract(Integer userId, String musicGroupId, OrderTypeEnum orderType, Date currentDate);
 
 	/**
 	 * 查询产品协议

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

@@ -897,9 +897,14 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
     }
 
     @Override
+    public void transferProduceContract(Integer userId, String musicGroupId, OrderTypeEnum orderType) {
+    	transferProduceContract(userId, musicGroupId, orderType, new Date());
+    }
+
+    @Override
     @Async
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
-    public void transferProduceContract(Integer userId, String musicGroupId, OrderTypeEnum orderType) {
+	public void transferProduceContract(Integer userId, String musicGroupId, OrderTypeEnum orderType, Date currentDate) {
         SysUser user = studentDao.lockUserReturnInfo(userId);
 
         if (user == null) {
@@ -943,6 +948,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         params.put("studentInfo", studentInfo);
 
         params.put("isShowVisualSeal", false);
+        params.put("currentDate", date);
 
         if (StringUtils.isBlank(musicGroupId)) {
             params.put("ownershipType", "OWN");
@@ -1041,7 +1047,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         FileUtils.deleteQuietly(srcFile);
     }
 
-    @Override
+	@Override
     @Transactional(isolation = Isolation.READ_COMMITTED)
     public Map<String, Object> queryProductContract(Integer userId, String musicGroupId, OrderTypeEnum orderType) {
         // 合成freemarker

+ 2 - 2
mec-biz/src/main/resources/config/contracts/latest_contract_template.ftl

@@ -118,10 +118,10 @@
             </div>
         	<#else>
             <div class="sign">甲方签章:${companyName}
-                <span>日期:${.now?string("yyyy年MM月dd日")}</span>
+                <span>日期:${currentDate?string("yyyy年MM月dd日")}</span>
             </div>
             <div class="sign">乙方签章:
-                <span>日期:${.now?string("yyyy年MM月dd日")} </span>
+                <span>日期:${currentDate?string("yyyy年MM月dd日")} </span>
             </div>
         	</#if>
         </div>

+ 2 - 2
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/provider/TsignPlugin.java

@@ -63,12 +63,12 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
         projectconfig.setItsmApiUrl(apisUrl);
         Result result = ServiceClientManager.registClient(projectconfig, null, null);
         if (result.getErrCode() != 0) {
-            //throw new ThirdpartyException("e签宝客户端注册失败:{}", result.getMsg());
+            throw new ThirdpartyException("e签宝客户端注册失败:{}", result.getMsg());
         }
 
         serviceClient = ServiceClientManager.get(projectId);
         if (serviceClient == null) {
-            //throw new ThirdpartyException("获取e签宝客户端失败");
+            throw new ThirdpartyException("获取e签宝客户端失败");
         }
     }
 

+ 14 - 1
mec-web/src/main/java/com/ym/mec/web/controller/TempController.java

@@ -4,11 +4,11 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.service.ContractService;
 import com.ym.mec.biz.service.TempTestService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.util.excel.POIUtil;
@@ -26,6 +28,9 @@ public class TempController extends BaseController {
 	
 	@Autowired
 	private TempTestService tempTestService;
+	
+	@Autowired
+	private ContractService contractService;
 
 	@PostMapping(value = "/queryOrganMusicInfos")
 	public Object queryOrganMusicInfos(@RequestParam("multipartFile") MultipartFile multipartFile) {
@@ -61,4 +66,12 @@ public class TempController extends BaseController {
 
 		return succeed();
 	}
+
+	@PostMapping(value = "/generateContract")
+	public Object generateContract(Integer userId, String musicGroupId, OrderTypeEnum orderType, Date currentDate) {
+
+		contractService.transferProduceContract(userId, musicGroupId, orderType, currentDate);
+
+		return succeed();
+	}
 }