|
|
@@ -1,9 +1,11 @@
|
|
|
package com.goafanti.contract.service.impl;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
@@ -145,14 +147,20 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
ContractLog clog = disposeContractLog(c);
|
|
|
clog.setStatus(ContractStatus.SIGN.getCode());
|
|
|
clog.setRecordTime(signDate);
|
|
|
- contractLogMapper.insert(clog);
|
|
|
+
|
|
|
+ List<ContractLog> logs = new ArrayList<>();
|
|
|
+ List<Notice> notice = new ArrayList<>();
|
|
|
+ logs.add(clog);
|
|
|
|
|
|
for (int i = 0; i < principals.length; i++) {
|
|
|
ContractLog log = disposeContractLog(c);
|
|
|
log.setPrincipal(principals[i]);
|
|
|
- contractLogMapper.insert(log);
|
|
|
- createNotice(c, log);
|
|
|
+ logs.add(log);
|
|
|
+ notice.add(createNotice(c, log));
|
|
|
}
|
|
|
+ contractLogMapper.insertBatch(logs);
|
|
|
+ noticeMapper.insertBatch(notice);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private Contract disposeContract(Contract c) {
|
|
|
@@ -184,7 +192,54 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
return cl;
|
|
|
}
|
|
|
|
|
|
- private void createNotice(Contract c, ContractLog l) {
|
|
|
+ @Override
|
|
|
+ public ContractDetail selectContractDetail(String id) {
|
|
|
+ return contractMapper.selectContractDetail(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Contract selectByPrimaryKey(String id) {
|
|
|
+ return contractMapper.selectByPrimaryKey(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateByPrimaryKeySelective(Contract contract) {
|
|
|
+ return contractMapper.updateByPrimaryKeySelective(contract);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateSubmit(Contract c, String[] principals, String signDateFormattedDate) {
|
|
|
+ Date signDate = null;
|
|
|
+ if (!StringUtils.isBlank(signDateFormattedDate)) {
|
|
|
+ try {
|
|
|
+ signDate = DateUtils.parseDate(signDateFormattedDate, AFTConstants.YYYYMMDDHHMMSS);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ c.setStatus(ContractStatus.CIRCULATION.getCode());
|
|
|
+ c.setSignDate(signDate);
|
|
|
+ contractMapper.updateByPrimaryKeySelective(c);
|
|
|
+
|
|
|
+ ContractLog clog = disposeContractLog(c);
|
|
|
+ clog.setStatus(ContractStatus.SIGN.getCode());
|
|
|
+ clog.setRecordTime(signDate);
|
|
|
+
|
|
|
+ List<ContractLog> logs = new ArrayList<>();
|
|
|
+ List<Notice> notice = new ArrayList<>();
|
|
|
+ logs.add(clog);
|
|
|
+
|
|
|
+ for (int i = 0; i < principals.length; i++) {
|
|
|
+ ContractLog log = disposeContractLog(c);
|
|
|
+ log.setPrincipal(principals[i]);
|
|
|
+ log.setOperator(TokenManager.getAdminId());
|
|
|
+ logs.add(log);
|
|
|
+ notice.add(createNotice(c, log));
|
|
|
+ }
|
|
|
+ contractLogMapper.insertBatch(logs);
|
|
|
+ noticeMapper.insertBatch(notice);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Notice createNotice(Contract c, ContractLog l) {
|
|
|
Contract info = contractMapper.selectByPrimaryKey(c.getId());
|
|
|
|
|
|
Notice n = new Notice();
|
|
|
@@ -206,22 +261,7 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
n.setContent("编号" + info.getSerialNumber() + " " + ContractStatus.getStatus(c.getStatus()).getDesc());
|
|
|
n.setNoticeType(NoticeStatus.CONTRACT.getCode());
|
|
|
n.setYear(info.getCognizanceYear());
|
|
|
- noticeMapper.insert(n);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public ContractDetail selectContractDetail(String id) {
|
|
|
- return contractMapper.selectContractDetail(id);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Contract selectByPrimaryKey(String id) {
|
|
|
- return contractMapper.selectByPrimaryKey(id);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public int updateByPrimaryKeySelective(Contract contract) {
|
|
|
- return contractMapper.updateByPrimaryKeySelective(contract);
|
|
|
+ return n;
|
|
|
}
|
|
|
|
|
|
}
|