|
|
@@ -9,7 +9,9 @@ import com.usoftchina.saas.commons.dto.DocBaseDTO;
|
|
|
import com.usoftchina.saas.commons.dto.DocSavedDTO;
|
|
|
import com.usoftchina.saas.commons.dto.ListReqDTO;
|
|
|
import com.usoftchina.saas.commons.exception.BizExceptionCode;
|
|
|
+import com.usoftchina.saas.commons.po.BillCodeSeq;
|
|
|
import com.usoftchina.saas.commons.po.Operation;
|
|
|
+import com.usoftchina.saas.commons.po.Status;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
import com.usoftchina.saas.money.dto.*;
|
|
|
@@ -31,8 +33,8 @@ import java.util.List;
|
|
|
|
|
|
@Service
|
|
|
public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationMapper,Verification> implements VerificationService {
|
|
|
-// @Autowired
|
|
|
-// private MaxnumberService maxnumberService;
|
|
|
+ @Autowired
|
|
|
+ private MaxnumberService maxnumberService;
|
|
|
@Autowired
|
|
|
private VerificationMapper verificationMapper;
|
|
|
@Autowired
|
|
|
@@ -41,8 +43,8 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
private VerificationdetailMapper verificationdetailMapper;
|
|
|
@Autowired
|
|
|
private VerificationListMapper verificationListMapper;
|
|
|
-// @Autowired
|
|
|
- // private MessageLogService messageLogService;
|
|
|
+ @Autowired
|
|
|
+ private MessageLogService messageLogService;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -117,15 +119,15 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
List<Verificationdet> updateDetails1 = new ArrayList<>();
|
|
|
List<Verificationdetail> updateDetails2 = new ArrayList<>();
|
|
|
DocSavedDTO saveDTO = new DocSavedDTO();
|
|
|
- Long id = main.getId();
|
|
|
+ Long id = Long.valueOf(String.valueOf(main.getVc_id()));
|
|
|
String code = main.getVc_code();
|
|
|
Verification verification = BeanMapper.map(main,Verification.class);
|
|
|
verification.setCompanyId(companyId);
|
|
|
verification.setCreatorId(userId);
|
|
|
verification.setCreateTime(new Date());
|
|
|
//编号获取
|
|
|
-// code = pushMaxnubmer(code,id);
|
|
|
- code = "1";
|
|
|
+ code = pushMaxnubmer(code,id);
|
|
|
+// code = "1";
|
|
|
verification.setVc_code(code);
|
|
|
saveDTO.setCode(code);
|
|
|
//判断更新与保存动作
|
|
|
@@ -137,11 +139,13 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
for (VerificationdetDTO item : items1) {
|
|
|
Verificationdet detail = BeanMapper.map(item,Verificationdet.class);
|
|
|
detail.setVd_vcid(id);
|
|
|
+ detail.setCompanyId(companyId);
|
|
|
insertDetails1.add(detail);
|
|
|
}
|
|
|
for (VerificationdetailDTO item : items2) {
|
|
|
Verificationdetail detail = BeanMapper.map(item,Verificationdetail.class);
|
|
|
detail.setVcd_vcid(id);
|
|
|
+ detail.setCompanyId(companyId);
|
|
|
insertDetails2.add(detail);
|
|
|
}
|
|
|
//插入从表
|
|
|
@@ -160,6 +164,7 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
for (VerificationdetDTO item : items1) {
|
|
|
Verificationdet detail = BeanMapper.map(item, Verificationdet.class);
|
|
|
detail.setVd_vcid(id);
|
|
|
+ detail.setCompanyId(companyId);
|
|
|
if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
|
|
|
insertDetails1.add(detail);
|
|
|
} else {
|
|
|
@@ -169,6 +174,7 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
for (VerificationdetailDTO item : items2) {
|
|
|
Verificationdetail detail = BeanMapper.map(item, Verificationdetail.class);
|
|
|
detail.setVcd_vcid(id);
|
|
|
+ detail.setCompanyId(companyId);
|
|
|
if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
|
|
|
insertDetails2.add(detail);
|
|
|
} else {
|
|
|
@@ -206,9 +212,39 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
DocBaseDTO baseDTO = new DocBaseDTO();
|
|
|
baseDTO.setId(id);
|
|
|
baseDTO.setCode(code);
|
|
|
- baseDTO.setName("Verification");
|
|
|
+ baseDTO.setName(BillCodeSeq.VERIFICATION.getName());
|
|
|
//日志
|
|
|
-// messageLogService.delete(baseDTO);
|
|
|
+ messageLogService.delete(baseDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteDetail1(Long id) {
|
|
|
+ if (null != id) {
|
|
|
+ verificationdetMapper.deleteByParentPrimaryKey(Long.valueOf(String.valueOf(id)));
|
|
|
+ Verificationdet verificationdet = verificationdetMapper.selectByPrimaryKey(Integer.valueOf(String.valueOf(id)));
|
|
|
+ Verification verification = verificationMapper.selectByPrimaryKey(verificationdet.getVd_vcid());
|
|
|
+ DocBaseDTO baseDTO = new DocBaseDTO();
|
|
|
+ baseDTO.setId(id);
|
|
|
+ baseDTO.setCode(verification.getVc_code());
|
|
|
+ baseDTO.setName(BillCodeSeq.VERIFICATION.getName());
|
|
|
+ //日志
|
|
|
+ messageLogService.deleteDetail(baseDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteDetail2(Long id) {
|
|
|
+ if (null != id) {
|
|
|
+ verificationdetailMapper.deleteByParentPrimaryKey(id);
|
|
|
+ Verificationdetail verificationdetail = verificationdetailMapper.selectByPrimaryKey(Integer.valueOf(String.valueOf(id)));
|
|
|
+ Verification verification = verificationMapper.selectByPrimaryKey(verificationdetail.getVcd_vcid());
|
|
|
+ DocBaseDTO baseDTO = new DocBaseDTO();
|
|
|
+ baseDTO.setId(id);
|
|
|
+ baseDTO.setCode(verification.getVc_code());
|
|
|
+ baseDTO.setName(BillCodeSeq.VERIFICATION.getName());
|
|
|
+ //日志
|
|
|
+ messageLogService.deleteDetail(baseDTO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -217,14 +253,15 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
Long id = null;
|
|
|
DocSavedDTO savedDTO = new DocSavedDTO();
|
|
|
if (null != formData) {
|
|
|
- id = formData.getMain().getId();
|
|
|
+ id = Long.valueOf(String.valueOf(formData.getMain().getVc_id()));
|
|
|
if (StringUtils.isEmpty(id)) {
|
|
|
DocSavedDTO saveDTO = saveFormData(formData);
|
|
|
id = saveDTO.getId();
|
|
|
}
|
|
|
Verification verification = new Verification();
|
|
|
- // verification.setVc_status(Operation.AUDIT.getTitle());
|
|
|
- // verification.setVc_statuscode(Status.AUDITED.name());
|
|
|
+ verification.setVc_status(Status.AUDITED.getDisplay());
|
|
|
+ verification.setVc_statuscode(Status.AUDITED.name());
|
|
|
+ verification.setVc_id(Integer.valueOf(String.valueOf(id)));
|
|
|
verificationMapper.updateByPrimaryKeySelective(verification);
|
|
|
}
|
|
|
savedDTO.setId(id);
|
|
|
@@ -242,9 +279,9 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
}
|
|
|
Verification verification = new Verification();
|
|
|
//生成更新对象
|
|
|
- verification.setId(id);
|
|
|
-// verification.setVc_status();
|
|
|
-// verification.setVc_statuscode();
|
|
|
+ verification.setVc_id(Integer.valueOf(String.valueOf(id)));
|
|
|
+ verification.setVc_status(Status.UNAUDITED.getDisplay());
|
|
|
+ verification.setVc_statuscode(Status.UNAUDITED.name());
|
|
|
verification.setUpdateTime(new Date());
|
|
|
verification.setUpdaterId(BaseContextHolder.getUserId());
|
|
|
//更新存在字段
|
|
|
@@ -254,15 +291,15 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
|
|
|
baseDTO.setCode(code);
|
|
|
baseDTO.setName("Verification");
|
|
|
//日志
|
|
|
-// messageLogService.unAudit(baseDTO);
|
|
|
+ messageLogService.unAudit(baseDTO);
|
|
|
}
|
|
|
|
|
|
-// private String pushMaxnubmer(String code, Long id) {
|
|
|
-// if (null == code) {
|
|
|
-// throw new BizException(BizExceptionCode.NULL_CODE);
|
|
|
-// }
|
|
|
-// Integer count = "0".equals(String.valueOf(id)) ? verificationMapper.validateCodeWhenInsert(code) :
|
|
|
-// verificationMapper.validateCodeWhenUpdate(code, id);
|
|
|
-// return maxnumberService.pushMaxnubmer(count, code, "Verification");
|
|
|
-// }
|
|
|
+ private String pushMaxnubmer(String code, Long id) {
|
|
|
+ if (null == code) {
|
|
|
+ throw new BizException(BizExceptionCode.NULL_CODE);
|
|
|
+ }
|
|
|
+ Integer count = "0".equals(String.valueOf(id)) ? verificationMapper.validateCodeWhenInsert(code) :
|
|
|
+ verificationMapper.validateCodeWhenUpdate(code, id);
|
|
|
+ return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.VERIFICATION.getCaller()).getData();
|
|
|
+ }
|
|
|
}
|