Commit 96883dac authored by 廖旭伟's avatar 廖旭伟

bug修改

parent d5b27230
package com.mortals.xhx.module.certificate.model.vo;
import lombok.Data;
@Data
public class CertificateDocumentPdu {
Long id;
/**
* 站点id
*/
private Long siteId;
/**
* 部门id
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 子证名称
*/
private String documentName;
/**
* 简称
*/
private String shortName;
/**
* 状态,0:禁用1:启用
*/
private Integer status;
}
...@@ -2,6 +2,9 @@ package com.mortals.xhx.module.certificate.service; ...@@ -2,6 +2,9 @@ package com.mortals.xhx.module.certificate.service;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity; import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity;
import com.mortals.xhx.module.certificate.dao.CertificateDocumentDao; import com.mortals.xhx.module.certificate.dao.CertificateDocumentDao;
import java.util.List;
/** /**
* CertificateDocumentService * CertificateDocumentService
* *
...@@ -13,4 +16,6 @@ import com.mortals.xhx.module.certificate.dao.CertificateDocumentDao; ...@@ -13,4 +16,6 @@ import com.mortals.xhx.module.certificate.dao.CertificateDocumentDao;
public interface CertificateDocumentService extends ICRUDService<CertificateDocumentEntity,Long>{ public interface CertificateDocumentService extends ICRUDService<CertificateDocumentEntity,Long>{
CertificateDocumentDao getDao(); CertificateDocumentDao getDao();
List<CertificateDocumentEntity> getListByCatalogId(Long catalogId);
} }
\ No newline at end of file
package com.mortals.xhx.module.certificate.service.impl; package com.mortals.xhx.module.certificate.service.impl;
import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.module.certificate.model.CertificateChildEntity;
import com.mortals.xhx.module.certificate.model.CertificateChildQuery;
import com.mortals.xhx.module.certificate.model.CertificateDocumentQuery;
import com.mortals.xhx.module.certificate.service.CertificateChildService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.util.List;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -20,4 +30,14 @@ import lombok.extern.slf4j.Slf4j; ...@@ -20,4 +30,14 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class CertificateDocumentServiceImpl extends AbstractCRUDServiceImpl<CertificateDocumentDao, CertificateDocumentEntity, Long> implements CertificateDocumentService { public class CertificateDocumentServiceImpl extends AbstractCRUDServiceImpl<CertificateDocumentDao, CertificateDocumentEntity, Long> implements CertificateDocumentService {
@Autowired
private CertificateChildService certificateChildService;
@Override
public List<CertificateDocumentEntity> getListByCatalogId(Long catalogId) {
List<CertificateChildEntity> childEntityList = certificateChildService.find(new CertificateChildQuery().catalogId(catalogId));
List<Long> documentIdList = childEntityList.stream().map(CertificateChildEntity::getDocumentId).collect(Collectors.toList());
List<CertificateDocumentEntity> documentEntityList = this.find(new CertificateDocumentQuery().idList(documentIdList).status(StatusEnum.ENABLE.getValue()));
return documentEntityList;
}
} }
\ No newline at end of file
...@@ -18,5 +18,5 @@ public interface ChildLicenseService extends ICRUDService<ChildLicenseEntity,Lon ...@@ -18,5 +18,5 @@ public interface ChildLicenseService extends ICRUDService<ChildLicenseEntity,Lon
ChildLicenseDao getDao(); ChildLicenseDao getDao();
int createChildLicense(ApplyLogEntity applyLogEntity, Context context) throws AppException; int createChildLicense(ApplyLogEntity applyLogEntity,Long oldApplyId, Context context) throws AppException;
} }
\ No newline at end of file
package com.mortals.xhx.module.child.service.impl; package com.mortals.xhx.module.child.service.impl;
import com.mortals.xhx.common.code.ProcessStatusEnum; import com.mortals.xhx.common.code.ProcessStatusEnum;
import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.module.certificate.model.CertificateChildEntity; import com.mortals.xhx.module.certificate.model.CertificateChildEntity;
import com.mortals.xhx.module.certificate.model.CertificateChildQuery; import com.mortals.xhx.module.certificate.model.CertificateChildQuery;
import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity; import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity;
import com.mortals.xhx.module.certificate.model.CertificateDocumentQuery; import com.mortals.xhx.module.certificate.model.CertificateDocumentQuery;
import com.mortals.xhx.module.certificate.service.CertificateChildService; import com.mortals.xhx.module.certificate.service.CertificateChildService;
import com.mortals.xhx.module.certificate.service.CertificateDocumentService; import com.mortals.xhx.module.certificate.service.CertificateDocumentService;
import com.mortals.xhx.module.child.model.ChildLicenseQuery;
import com.mortals.xhx.module.record.model.ApplyLogEntity; import com.mortals.xhx.module.record.model.ApplyLogEntity;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -41,12 +41,37 @@ public class ChildLicenseServiceImpl extends AbstractCRUDServiceImpl<ChildLicens ...@@ -41,12 +41,37 @@ public class ChildLicenseServiceImpl extends AbstractCRUDServiceImpl<ChildLicens
@Autowired @Autowired
private CertificateDocumentService certificateDocumentService; private CertificateDocumentService certificateDocumentService;
@Override @Override
public int createChildLicense(ApplyLogEntity applyLogEntity, Context context) throws AppException { public int createChildLicense(ApplyLogEntity applyLogEntity, Long oldId, Context context) throws AppException {
int result = 0; int result = 0;
if(applyLogEntity.getCatalogId()!=null) { if(applyLogEntity.getCatalogId()!=null) {
Map<Long,Long> documentIdMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(applyLogEntity.getChildCertificate())){
applyLogEntity.getChildCertificate().forEach(i->{
if(i.getStatus()==1){
documentIdMap.put(i.getId(),i.getId());
}
});
}
boolean isAdd = true;
if(oldId!=null){
List<ChildLicenseEntity> oldChildList = this.find(new ChildLicenseQuery().applyId(oldId));
if(CollectionUtils.isNotEmpty(oldChildList)){
isAdd = false;
}
for(ChildLicenseEntity child:oldChildList){
child.setApplyId(applyLogEntity.getId());
if (documentIdMap.size() > 0 && documentIdMap.containsKey(child.getDocumentId())) {
child.setChildStatus(StatusEnum.ENABLE.getValue());
} else {
child.setChildStatus(StatusEnum.DISABLE.getValue());
}
}
this.update(oldChildList);
}
if(isAdd) {
List<CertificateChildEntity> childEntityList = certificateChildService.find(new CertificateChildQuery().catalogId(applyLogEntity.getCatalogId())); List<CertificateChildEntity> childEntityList = certificateChildService.find(new CertificateChildQuery().catalogId(applyLogEntity.getCatalogId()));
List<Long> documentIdList = childEntityList.stream().map(CertificateChildEntity::getDocumentId).collect(Collectors.toList()); List<Long> documentIdList = childEntityList.stream().map(CertificateChildEntity::getDocumentId).collect(Collectors.toList());
List<CertificateDocumentEntity> documentEntityList = certificateDocumentService.find(new CertificateDocumentQuery().idList(documentIdList)); List<CertificateDocumentEntity> documentEntityList = certificateDocumentService.find(new CertificateDocumentQuery().idList(documentIdList).status(StatusEnum.ENABLE.getValue()));
if (CollectionUtils.isNotEmpty(documentEntityList)) { if (CollectionUtils.isNotEmpty(documentEntityList)) {
List<ChildLicenseEntity> childLicense = new ArrayList<>(); List<ChildLicenseEntity> childLicense = new ArrayList<>();
for (CertificateDocumentEntity item : documentEntityList) { for (CertificateDocumentEntity item : documentEntityList) {
...@@ -74,11 +99,17 @@ public class ChildLicenseServiceImpl extends AbstractCRUDServiceImpl<ChildLicens ...@@ -74,11 +99,17 @@ public class ChildLicenseServiceImpl extends AbstractCRUDServiceImpl<ChildLicens
entity.setProcessStatus(ProcessStatusEnum.未处理.getValue()); entity.setProcessStatus(ProcessStatusEnum.未处理.getValue());
entity.setCreateTime(applyLogEntity.getCreateTime()); entity.setCreateTime(applyLogEntity.getCreateTime());
entity.setCreateUserId(applyLogEntity.getCreateUserId()); entity.setCreateUserId(applyLogEntity.getCreateUserId());
if (documentIdMap.size() > 0 && documentIdMap.containsKey(item.getId())) {
entity.setChildStatus(StatusEnum.ENABLE.getValue());
} else {
entity.setChildStatus(StatusEnum.DISABLE.getValue());
}
childLicense.add(entity); childLicense.add(entity);
} }
this.dao.insertBatch(childLicense); this.dao.insertBatch(childLicense);
} }
} }
}
return result; return result;
} }
......
package com.mortals.xhx.module.record.model.vo; package com.mortals.xhx.module.record.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity;
import com.mortals.xhx.module.certificate.model.vo.CertificateDocumentPdu;
import com.mortals.xhx.module.child.model.ChildLicenseEntity; import com.mortals.xhx.module.child.model.ChildLicenseEntity;
import com.mortals.xhx.module.record.model.ApplyLogEntity; import com.mortals.xhx.module.record.model.ApplyLogEntity;
import lombok.Data; import lombok.Data;
...@@ -25,6 +27,9 @@ public class ApplyLogVo extends BaseEntityLong { ...@@ -25,6 +27,9 @@ public class ApplyLogVo extends BaseEntityLong {
/** 子证信息 */ /** 子证信息 */
List<ChildLicenseEntity> childLicense; List<ChildLicenseEntity> childLicense;
/** 子证联报状态 已联报数/子证总数 */
private String processStatus; private String processStatus;
private List<CertificateDocumentPdu> childCertificate;
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.mortals.xhx.module.record.web; ...@@ -2,6 +2,8 @@ package com.mortals.xhx.module.record.web;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.utils.ReflectUtils; import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.utils.poi.ExcelUtil; import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
...@@ -10,7 +12,12 @@ import com.mortals.xhx.base.system.upload.service.UploadService; ...@@ -10,7 +12,12 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.utils.ImportExcelUtil; import com.mortals.xhx.common.utils.ImportExcelUtil;
import com.mortals.xhx.common.utils.ReadExcelPictureUtil; import com.mortals.xhx.common.utils.ReadExcelPictureUtil;
import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity;
import com.mortals.xhx.module.certificate.model.CertificateDocumentQuery;
import com.mortals.xhx.module.certificate.model.vo.CertificateDocumentPdu;
import com.mortals.xhx.module.certificate.service.CertificateDocumentService;
import org.apache.poi.ss.usermodel.PictureData; import org.apache.poi.ss.usermodel.PictureData;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -25,12 +32,10 @@ import com.mortals.xhx.module.record.model.ApplyLogEntity; ...@@ -25,12 +32,10 @@ import com.mortals.xhx.module.record.model.ApplyLogEntity;
import com.mortals.xhx.module.record.service.ApplyLogService; import com.mortals.xhx.module.record.service.ApplyLogService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
...@@ -48,6 +53,9 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL ...@@ -48,6 +53,9 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
@Value("${upload.path}") @Value("${upload.path}")
private String filePath; private String filePath;
@Autowired
private CertificateDocumentService certificateDocumentService;
public ApplyLogController(){ public ApplyLogController(){
super.setModuleDesc( "证照申请"); super.setModuleDesc( "证照申请");
} }
...@@ -196,4 +204,44 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL ...@@ -196,4 +204,44 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
return ret.toJSONString(); return ret.toJSONString();
} }
} }
@PostMapping(value = "addInit")
@UnAuth
public String add(@RequestBody ApplyLogEntity params) {
Map<String, Object> model = new HashMap();
int code = 1;
Context context = this.getContext();
String busiDesc = "打开新增" + this.getModuleDesc() + "页面";
try {
this.addBefore(model);
ApplyLogEntity entity = new ApplyLogEntity();
entity.initAttrValue();
List<CertificateDocumentEntity> certificateDocumentEntityList = certificateDocumentService.getListByCatalogId(params.getCatalogId());
List<CertificateDocumentPdu> documentEntityList = new ArrayList<>();
for(CertificateDocumentEntity item:certificateDocumentEntityList){
CertificateDocumentPdu pdu = new CertificateDocumentPdu();
BeanUtils.copyProperties(item, pdu);
documentEntityList.add(pdu);
}
entity.setChildCertificate(documentEntityList);
model.put("entity", entity);
this.addAfter(model);
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
} catch (Exception var7) {
code = -1;
this.doException(this.request, busiDesc, model, var7);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment