1、模板配置,辅助核算配置。
This commit is contained in:
parent
8e3e84f1b0
commit
50bdaf9e32
|
@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -55,10 +56,10 @@ public class TemplateController extends DefaultController {
|
|||
*
|
||||
*/
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public JsonResultEntity save(@RequestBody AeConfVoucherTemplateEntity entity) {
|
||||
public JsonResultEntity save(@RequestBody List<AeConfVoucherTemplateEntity> list) {
|
||||
try {
|
||||
AeConfVoucherTemplateEntity aeConfVoucherTemplateEntity = templateService.saveEntity(entity);
|
||||
return getSuccessMessageEntity("请求成功", aeConfVoucherTemplateEntity);
|
||||
List<AeConfVoucherTemplateEntity> aeConfVoucherTemplateEntityList = templateService.saveEntity(list);
|
||||
return getSuccessMessageEntity("请求成功", aeConfVoucherTemplateEntityList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return getFailureMessageEntity(e.getMessage());
|
||||
|
|
|
@ -599,8 +599,8 @@
|
|||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null">#{id} ,</if>
|
||||
<if test="mdmId != null and mdmId != ''">#{mdmId} ,</if>
|
||||
<if test="pkGlorgbook != null and pkGlorgbook != ''">#{pkGlorgbook} ,</if>
|
||||
<if test="templateTypeId != null and templateTypeId != ''">#{templateTypeId} ,</if>
|
||||
<if test="pkGlorgbook != null and pkGlorgbook != ''">#{pkGlorgbook} ,</if>
|
||||
<if test="glOrgbookCode != null and glOrgbookCode != ''">#{glOrgbookCode} ,</if>
|
||||
<if test="glOrgbookName != null and glOrgbookName != ''">#{glOrgbookName} ,</if>
|
||||
<if test="voucherTypeId != null and voucherTypeId != ''">#{voucherTypeId} ,</if>
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
public interface IAeConfVoucherTemplateService extends IBaseService<AeConfVoucherTemplateEntity, String>{
|
||||
List<AeConfVoucherTemplateEntity> queryAll(AeConfVoucherTemplateEntity entity);
|
||||
AeConfVoucherTemplateEntity queryById(AeConfVoucherTemplateEntity entity);
|
||||
AeConfVoucherTemplateEntity saveEntity(AeConfVoucherTemplateEntity entity);
|
||||
List<AeConfVoucherTemplateEntity> saveEntity(List<AeConfVoucherTemplateEntity> list);
|
||||
AeConfVoucherTemplateEntity updateEntity(AeConfVoucherTemplateEntity entity);
|
||||
AeConfVoucherTemplateEntity deleteEntity(AeConfVoucherTemplateEntity entity);
|
||||
|
||||
|
|
|
@ -13,13 +13,16 @@ import com.hzya.frame.voucher.ae.comf.template.dao.IAeConfVoucherTemplateAssistD
|
|||
import com.hzya.frame.voucher.ae.comf.template.entity.AeConfVoucherTemplateAssistEntity;
|
||||
import com.hzya.frame.voucher.ae.comf.template.entity.AeConfVoucherTemplateEntity;
|
||||
import com.hzya.frame.voucher.ae.comf.template.dao.IAeConfVoucherTemplateDao;
|
||||
import com.hzya.frame.voucher.ae.comf.template.service.IAeConfVoucherTemplateAssistService;
|
||||
import com.hzya.frame.voucher.ae.comf.template.service.IAeConfVoucherTemplateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
@ -44,6 +47,11 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
|
|||
@Autowired
|
||||
private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao;
|
||||
|
||||
@Autowired
|
||||
private IAeConfVoucherTemplateAssistService templateAssistService;
|
||||
|
||||
private StringBuffer sb = new StringBuffer();
|
||||
|
||||
|
||||
@Autowired
|
||||
public void setAeConfVoucherTemplateDao(IAeConfVoucherTemplateDao dao) {
|
||||
|
@ -80,36 +88,116 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
|
|||
|
||||
/**
|
||||
* 保存实体
|
||||
* 主表:有id的更新,无id的新增,
|
||||
* 子表:有id的更新,无id的新增,
|
||||
*/
|
||||
@Override
|
||||
public AeConfVoucherTemplateEntity saveEntity(AeConfVoucherTemplateEntity entity) {
|
||||
checkTempNull("saveEntity", entity);
|
||||
@Transactional
|
||||
public List<AeConfVoucherTemplateEntity> saveEntity(List<AeConfVoucherTemplateEntity> list) {
|
||||
List<AeConfVoucherTemplateEntity> all = new ArrayList<>();
|
||||
|
||||
//校验摘要
|
||||
checkAbstract(entity);
|
||||
for (AeConfVoucherTemplateEntity entity : list) {
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {//新增
|
||||
checkTempNull("saveEntity", entity);
|
||||
//校验摘要
|
||||
checkAbstract(entity);
|
||||
//查询分类定义
|
||||
AeConfSubjectClassificationEntity classificationEntity = new AeConfSubjectClassificationEntity();
|
||||
classificationEntity.setId(String.valueOf(entity.getSubjectClassificationId()));
|
||||
List<AeConfSubjectClassificationEntity> query = subjectClassificationDao.query(classificationEntity);
|
||||
AeConfSubjectClassificationEntity ification = query.get(0);
|
||||
entity.setSubjectClassificationCode(ification.getCode());
|
||||
entity.setSubjectClassificationName(ification.getName());
|
||||
AeConfVoucherTemplateEntity save = templateDao.save(entity);
|
||||
all.add(save);
|
||||
String tId = save.getId();
|
||||
|
||||
//转换摘要
|
||||
transformAbstract(entity);
|
||||
//保存子表,或更新
|
||||
List<AeConfVoucherTemplateAssistEntity> details = new ArrayList<>();
|
||||
List<AeConfVoucherTemplateAssistEntity> assistEntityList = entity.getAssistEntityList();
|
||||
for (AeConfVoucherTemplateAssistEntity detail : assistEntityList) {
|
||||
detail.setVoucherTemplateId(Long.valueOf(tId));
|
||||
if (detail.getId() == null || "".equals(detail.getId())) {
|
||||
AeConfVoucherTemplateAssistEntity aeConfVoucherTemplateAssistEntity = templateAssistService.saveEntity(detail);
|
||||
details.add(aeConfVoucherTemplateAssistEntity);
|
||||
} else {
|
||||
AeConfVoucherTemplateAssistEntity aeConfVoucherTemplateAssistEntity = templateAssistService.updateEntity(detail);
|
||||
details.add(aeConfVoucherTemplateAssistEntity);
|
||||
}
|
||||
}
|
||||
save.setAssistEntityList(details);
|
||||
} else {//更新
|
||||
checkTempNull("updateEntity", entity);
|
||||
//校验摘要
|
||||
checkAbstract(entity);
|
||||
//查询分类定义
|
||||
AeConfSubjectClassificationEntity classificationEntity = new AeConfSubjectClassificationEntity();
|
||||
classificationEntity.setId(String.valueOf(entity.getSubjectClassificationId()));
|
||||
List<AeConfSubjectClassificationEntity> query = subjectClassificationDao.query(classificationEntity);
|
||||
AeConfSubjectClassificationEntity ification = query.get(0);
|
||||
entity.setSubjectClassificationCode(ification.getCode());
|
||||
entity.setSubjectClassificationName(ification.getName());
|
||||
AeConfVoucherTemplateEntity update = templateDao.update(entity);
|
||||
all.add(entity);
|
||||
|
||||
//查询分类定义
|
||||
AeConfSubjectClassificationEntity classificationEntity = new AeConfSubjectClassificationEntity();
|
||||
classificationEntity.setId(String.valueOf(entity.getSubjectClassificationId()));
|
||||
List<AeConfSubjectClassificationEntity> query = subjectClassificationDao.query(classificationEntity);
|
||||
AeConfSubjectClassificationEntity ification = query.get(0);
|
||||
entity.setSubjectClassificationCode(ification.getCode());
|
||||
entity.setSubjectClassificationName(ification.getName());
|
||||
|
||||
AeConfVoucherTemplateEntity save = templateDao.save(entity);
|
||||
//保存子表
|
||||
if (entity.getAssistEntityList() != null && entity.getAssistEntityList().size() != 0) {
|
||||
String tempId = save.getId();
|
||||
for (AeConfVoucherTemplateAssistEntity assistEntity : entity.getAssistEntityList()) {
|
||||
assistEntity.setVoucherTemplateId(Long.valueOf(tempId));
|
||||
templateAssistDao.save(assistEntity);
|
||||
String tId = entity.getId();
|
||||
//保存子表,或更新
|
||||
List<AeConfVoucherTemplateAssistEntity> details = new ArrayList<>();
|
||||
List<AeConfVoucherTemplateAssistEntity> assistEntityList = entity.getAssistEntityList();
|
||||
for (AeConfVoucherTemplateAssistEntity detail : assistEntityList) {
|
||||
detail.setVoucherTemplateId(Long.valueOf(tId));
|
||||
if (detail.getId() == null || "".equals(detail.getId())) {
|
||||
AeConfVoucherTemplateAssistEntity aeConfVoucherTemplateAssistEntity = templateAssistService.saveEntity(detail);
|
||||
details.add(aeConfVoucherTemplateAssistEntity);
|
||||
} else {
|
||||
AeConfVoucherTemplateAssistEntity aeConfVoucherTemplateAssistEntity = templateAssistService.updateEntity(detail);
|
||||
details.add(aeConfVoucherTemplateAssistEntity);
|
||||
}
|
||||
}
|
||||
entity.setAssistEntityList(details);
|
||||
}
|
||||
}
|
||||
return save;
|
||||
|
||||
return all;
|
||||
}
|
||||
// @Override
|
||||
// public List<AeConfVoucherTemplateEntity> saveEntity(List<AeConfVoucherTemplateEntity> list) {
|
||||
// for (AeConfVoucherTemplateEntity entity : list) {
|
||||
// if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
// checkTempNull("saveEntity", entity);
|
||||
//
|
||||
// //转换摘要
|
||||
// sb.delete(0, sb.length());
|
||||
// transformAbstract(entity);
|
||||
//
|
||||
// //校验摘要
|
||||
// checkAbstract(entity);
|
||||
//
|
||||
// //查询分类定义
|
||||
// AeConfSubjectClassificationEntity classificationEntity = new AeConfSubjectClassificationEntity();
|
||||
// classificationEntity.setId(String.valueOf(entity.getSubjectClassificationId()));
|
||||
// List<AeConfSubjectClassificationEntity> query = subjectClassificationDao.query(classificationEntity);
|
||||
// AeConfSubjectClassificationEntity ification = query.get(0);
|
||||
// entity.setSubjectClassificationCode(ification.getCode());
|
||||
// entity.setSubjectClassificationName(ification.getName());
|
||||
//
|
||||
// AeConfVoucherTemplateEntity save = templateDao.save(entity);
|
||||
// //保存子表
|
||||
// if (entity.getAssistEntityList() != null && entity.getAssistEntityList().size() != 0) {
|
||||
// String tempId = save.getId();
|
||||
// for (AeConfVoucherTemplateAssistEntity assistEntity : entity.getAssistEntityList()) {
|
||||
// assistEntity.setVoucherTemplateId(Long.valueOf(tempId));
|
||||
// templateAssistDao.save(assistEntity);
|
||||
// }
|
||||
// }
|
||||
// }else {
|
||||
// updateEntity(entity);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return list;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -170,6 +258,7 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
|
|||
|
||||
String[] parts = abstractRes.split("\\+");
|
||||
for (String part : parts) {
|
||||
sb.append(part);
|
||||
if (part.startsWith("@@$")) {
|
||||
String fieldPath = part.substring(3); // 去除 @@$
|
||||
if (!isValidFieldPath(entity.getMdmId(), fieldPath)) {
|
||||
|
@ -399,7 +488,7 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
|
|||
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
|
||||
mdmModuleDbEntity.setDbName(ruleValue);
|
||||
List<MdmModuleDbEntity> dbList = mdmModuleDbDao.query(mdmModuleDbEntity);
|
||||
if(dbList.size()==0||dbList.size()>1){
|
||||
if (dbList.size() == 0 || dbList.size() > 1) {
|
||||
return null;
|
||||
}
|
||||
return dbList.get(0);
|
||||
|
@ -410,6 +499,7 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
|
|||
|
||||
|
||||
private void transformAbstract(AeConfVoucherTemplateEntity entity) {
|
||||
sb.delete(0, sb.length());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue