|
|
@@ -25,6 +25,7 @@ import com.goafanti.common.enums.ContractStatus;
|
|
|
import com.goafanti.common.enums.DeleteStatus;
|
|
|
import com.goafanti.common.enums.NoticeReadStatus;
|
|
|
import com.goafanti.common.enums.NoticeStatus;
|
|
|
+import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.Contract;
|
|
|
import com.goafanti.common.model.ContractLog;
|
|
|
import com.goafanti.common.model.Notice;
|
|
|
@@ -53,15 +54,15 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
@Autowired
|
|
|
private PatentInfoMapper patentInfoMapper;
|
|
|
@Autowired
|
|
|
- private CopyrightInfoMapper copyrightInfoMapper;
|
|
|
+ private CopyrightInfoMapper copyrightInfoMapper;
|
|
|
@Autowired
|
|
|
- private OrgCognizanceMapper orgCognizanceMapper;
|
|
|
+ private OrgCognizanceMapper orgCognizanceMapper;
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
- public Pagination<ContractManageListBo> getManageList(String contractId, Integer serialNumber, Integer type, Integer status,
|
|
|
- String startDateFormattedDate, String endDateFormattedDate, String province, String unitName, String uid,
|
|
|
- Integer pNo, Integer pSize) {
|
|
|
+ public Pagination<ContractManageListBo> getManageList(String contractId, Integer serialNumber, Integer type,
|
|
|
+ Integer status, String startDateFormattedDate, String endDateFormattedDate, String province,
|
|
|
+ String unitName, String uid, Integer pNo, Integer pSize) {
|
|
|
Date cStart = null;
|
|
|
Date cEnd = null;
|
|
|
|
|
|
@@ -131,7 +132,7 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
return (Pagination<ContractManageListBo>) findPage("findManageContractListByPage", "findManageContractCount",
|
|
|
params, pNo, pSize);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
public Pagination<ContractClientListBo> getClientList(String contractId, Integer serialNumber, Integer type,
|
|
|
@@ -141,8 +142,8 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
|
|
- params.put("uid", TokenManager.getUserId());
|
|
|
-
|
|
|
+ params.put("uid", TokenManager.getUserId());
|
|
|
+
|
|
|
if (null != serialNumber) {
|
|
|
params.put("serialNumber", serialNumber);
|
|
|
}
|
|
|
@@ -239,35 +240,6 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
|
|
|
}
|
|
|
|
|
|
- private Contract disposeContract(Contract c) {
|
|
|
- c.setId(UUID.randomUUID().toString());
|
|
|
- Calendar now = Calendar.getInstance();
|
|
|
- now.set(Calendar.MILLISECOND, 0);
|
|
|
- c.setCreateTime(now.getTime());
|
|
|
- c.setFounder(TokenManager.getAdminId());
|
|
|
-
|
|
|
- c.setPatentStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
- c.setCopyrightStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
- c.setTechProjectStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
- c.setCognizanceStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
- c.setDeletedSign(DeleteStatus.UNDELETE.getCode());
|
|
|
- return c;
|
|
|
- }
|
|
|
-
|
|
|
- private ContractLog disposeContractLog(Contract c) {
|
|
|
- ContractLog cl = new ContractLog();
|
|
|
- cl.setId(UUID.randomUUID().toString());
|
|
|
- cl.setComment(c.getComment());
|
|
|
- cl.setOperator(c.getFounder());
|
|
|
- cl.setPrincipal(c.getFounder());
|
|
|
- Calendar now = Calendar.getInstance();
|
|
|
- now.set(Calendar.MILLISECOND, 0);
|
|
|
- cl.setRecordTime(now.getTime());
|
|
|
- cl.setStatus(c.getStatus());
|
|
|
- cl.setCid(c.getId());
|
|
|
- return cl;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public ContractDetail selectContractDetail(String id) {
|
|
|
return contractMapper.selectContractDetail(id);
|
|
|
@@ -286,13 +258,19 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
@Override
|
|
|
public void updateSubmit(Contract c, String[] principals, String signDateFormattedDate) {
|
|
|
Date signDate = null;
|
|
|
+ Boolean flag = false;
|
|
|
if (!StringUtils.isBlank(signDateFormattedDate)) {
|
|
|
try {
|
|
|
signDate = DateUtils.parseDate(signDateFormattedDate, AFTConstants.YYYYMMDDHHMMSS);
|
|
|
} catch (ParseException e) {
|
|
|
}
|
|
|
}
|
|
|
- c.setStatus(ContractStatus.CIRCULATION.getCode());
|
|
|
+
|
|
|
+ if (null != c.getStatus() && c.getStatus().equals(ContractStatus.CIRCULATION.getCode())) {
|
|
|
+ c.setStatus(ContractStatus.SIGN.getCode());
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+
|
|
|
c.setSignDate(signDate);
|
|
|
contractMapper.updateByPrimaryKeySelective(c);
|
|
|
|
|
|
@@ -301,6 +279,9 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
|
|
|
for (int i = 0; i < principals.length; i++) {
|
|
|
ContractLog log = disposeContractLog(c);
|
|
|
+ if (flag){
|
|
|
+ log.setStatus(ContractStatus.CIRCULATION.getCode());
|
|
|
+ }
|
|
|
log.setPrincipal(principals[i]);
|
|
|
log.setOperator(TokenManager.getAdminId());
|
|
|
logs.add(log);
|
|
|
@@ -328,8 +309,31 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public Contract saveContract(Contract c) {
|
|
|
+ c.setStatus(ContractStatus.CREATE.getCode());
|
|
|
+ c.setUid(TokenManager.getUserId());
|
|
|
+ c = disposeContract(c);
|
|
|
+ contractMapper.insert(c);
|
|
|
+ contractLogMapper.insert(disposeContractLog(c));
|
|
|
+ return c;
|
|
|
+ }
|
|
|
|
|
|
+ private ContractLog disposeContractLog(Contract c) {
|
|
|
+ ContractLog cl = new ContractLog();
|
|
|
+ cl.setId(UUID.randomUUID().toString());
|
|
|
+ cl.setComment(c.getComment());
|
|
|
+ if (TokenManager.getToken() instanceof Admin) {
|
|
|
+ cl.setOperator(c.getFounder());
|
|
|
+ cl.setPrincipal(c.getFounder());
|
|
|
+ }
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
+ now.set(Calendar.MILLISECOND, 0);
|
|
|
+ cl.setRecordTime(now.getTime());
|
|
|
+ cl.setStatus(c.getStatus());
|
|
|
+ cl.setCid(c.getId());
|
|
|
+ return cl;
|
|
|
+ }
|
|
|
|
|
|
private Notice createNotice(Contract c, ContractLog l) {
|
|
|
Contract info = contractMapper.selectByPrimaryKey(c.getId());
|
|
|
@@ -355,4 +359,22 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
n.setYear(info.getCognizanceYear());
|
|
|
return n;
|
|
|
}
|
|
|
+
|
|
|
+ private Contract disposeContract(Contract c) {
|
|
|
+ c.setId(UUID.randomUUID().toString());
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
+ now.set(Calendar.MILLISECOND, 0);
|
|
|
+ c.setCreateTime(now.getTime());
|
|
|
+ if (TokenManager.getToken() instanceof Admin) {
|
|
|
+ c.setFounder(TokenManager.getAdminId());
|
|
|
+ }
|
|
|
+
|
|
|
+ c.setPatentStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
+ c.setCopyrightStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
+ c.setTechProjectStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
+ c.setCognizanceStatus(ContractBusinessStatus.UNCREATE.getCode());
|
|
|
+ c.setDeletedSign(DeleteStatus.UNDELETE.getCode());
|
|
|
+ return c;
|
|
|
+ }
|
|
|
+
|
|
|
}
|