|
|
@@ -17,15 +17,19 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
+import com.goafanti.common.dao.ContractMapper;
|
|
|
import com.goafanti.common.dao.CopyrightInfoMapper;
|
|
|
import com.goafanti.common.dao.CopyrightLogMapper;
|
|
|
import com.goafanti.common.dao.NoticeMapper;
|
|
|
import com.goafanti.common.dao.OrgIntellectualPropertyMapper;
|
|
|
import com.goafanti.common.dao.UserMapper;
|
|
|
+import com.goafanti.common.enums.ContractBusinessStatus;
|
|
|
import com.goafanti.common.enums.CopyrightStatus;
|
|
|
+import com.goafanti.common.enums.DeleteStatus;
|
|
|
import com.goafanti.common.enums.IntellectualPropertyType;
|
|
|
import com.goafanti.common.enums.NoticeReadStatus;
|
|
|
import com.goafanti.common.enums.NoticeStatus;
|
|
|
+import com.goafanti.common.model.Contract;
|
|
|
import com.goafanti.common.model.CopyrightInfo;
|
|
|
import com.goafanti.common.model.CopyrightLog;
|
|
|
import com.goafanti.common.model.Notice;
|
|
|
@@ -52,6 +56,8 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
|
|
|
private NoticeMapper noticeMapper;
|
|
|
@Autowired
|
|
|
private UserMapper userMapper;
|
|
|
+ @Autowired
|
|
|
+ private ContractMapper contractMapper;
|
|
|
|
|
|
@Override
|
|
|
public CopyrightInfo insert(CopyrightInfo copyrightInfo, String aid) {
|
|
|
@@ -245,29 +251,6 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- private void createNotice(CopyrightInfo c, CopyrightLog l) {
|
|
|
- CopyrightInfo info = copyrightInfoMapper.selectByPrimaryKey(c.getId());
|
|
|
- Notice n = new Notice();
|
|
|
- Calendar now = Calendar.getInstance();
|
|
|
- now.set(Calendar.MILLISECOND, 0);
|
|
|
- n.setId(UUID.randomUUID().toString());
|
|
|
- n.setCreateTime(now.getTime());
|
|
|
- n.setReaded(NoticeReadStatus.UNREAD.getCode());
|
|
|
-
|
|
|
- User u = userMapper.selectByPrimaryKey(c.getUid());
|
|
|
- if (null != u) {
|
|
|
- n.setPid(u.getAid());
|
|
|
- }
|
|
|
-
|
|
|
- n.setUid(c.getUid());
|
|
|
- n.setRid(c.getId());
|
|
|
-
|
|
|
- n.setAid(l.getPrincipal());
|
|
|
- n.setContent("编号" + info.getSerialNumber() + " " + CopyrightStatus.getStatus(l.getStatus()).getDesc());
|
|
|
- n.setNoticeType(NoticeStatus.COPYRIGHT.getCode());
|
|
|
- noticeMapper.insert(n);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public CopyrightInfo saveCopyright(CopyrightInfo copyrightInfo, String salesman) {
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
@@ -305,4 +288,63 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
|
|
|
return copyrightInfoMapper.listContractCopyrightByContractId(contractId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void batchInsertContractRecord(Contract contract) {
|
|
|
+ contract.setCopyrightStatus(ContractBusinessStatus.CREATE.getCode());
|
|
|
+ contractMapper.updateByPrimaryKeySelective(contract);
|
|
|
+
|
|
|
+ List<CopyrightInfo> ci = new ArrayList<>();
|
|
|
+ List<CopyrightLog> cl = new ArrayList<>();
|
|
|
+
|
|
|
+ for (int i = 0; i < contract.getCopyrightNum(); i++) {
|
|
|
+ CopyrightInfo c = new CopyrightInfo();
|
|
|
+ CopyrightLog l = new CopyrightLog();
|
|
|
+ c.getId();
|
|
|
+ c.setUid(contract.getUid());
|
|
|
+ c.setContractId(contract.getId());
|
|
|
+ c.setStatus(CopyrightStatus.CREATE.getCode());
|
|
|
+ c.setPrincipal(TokenManager.getAdminId());
|
|
|
+ c.setFounder(TokenManager.getAdminId());
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
+ now.set(Calendar.MILLISECOND, 0);
|
|
|
+ c.setCreateTime(now.getTime());
|
|
|
+ c.setDeleteSign(DeleteStatus.UNDELETE.getCode());
|
|
|
+
|
|
|
+ l.getId();
|
|
|
+ l.setCid(c.getId());
|
|
|
+ l.setStatus(CopyrightStatus.CREATE.getCode());
|
|
|
+ l.setOperator(TokenManager.getAdminId());
|
|
|
+ l.setOperator(TokenManager.getAdminId());
|
|
|
+ l.setRecordTime(now.getTime());
|
|
|
+
|
|
|
+ ci.add(c);
|
|
|
+ cl.add(l);
|
|
|
+ }
|
|
|
+ copyrightInfoMapper.batchInsert(ci);
|
|
|
+ copyrightLogMapper.batchInsert(cl);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void createNotice(CopyrightInfo c, CopyrightLog l) {
|
|
|
+ CopyrightInfo info = copyrightInfoMapper.selectByPrimaryKey(c.getId());
|
|
|
+ Notice n = new Notice();
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
+ now.set(Calendar.MILLISECOND, 0);
|
|
|
+ n.setId(UUID.randomUUID().toString());
|
|
|
+ n.setCreateTime(now.getTime());
|
|
|
+ n.setReaded(NoticeReadStatus.UNREAD.getCode());
|
|
|
+
|
|
|
+ User u = userMapper.selectByPrimaryKey(c.getUid());
|
|
|
+ if (null != u) {
|
|
|
+ n.setPid(u.getAid());
|
|
|
+ }
|
|
|
+
|
|
|
+ n.setUid(c.getUid());
|
|
|
+ n.setRid(c.getId());
|
|
|
+
|
|
|
+ n.setAid(l.getPrincipal());
|
|
|
+ n.setContent("编号" + info.getSerialNumber() + " " + CopyrightStatus.getStatus(l.getStatus()).getDesc());
|
|
|
+ n.setNoticeType(NoticeStatus.COPYRIGHT.getCode());
|
|
|
+ noticeMapper.insert(n);
|
|
|
+ }
|
|
|
+
|
|
|
}
|