Commit 1c44890c authored by 廖旭伟's avatar 廖旭伟

证照申请生成二维码,保存子证信息

parent e7c20c05
package com.mortals.xhx.module.child.service; package com.mortals.xhx.module.child.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.child.model.ChildLicenseEntity; import com.mortals.xhx.module.child.model.ChildLicenseEntity;
import com.mortals.xhx.module.child.dao.ChildLicenseDao; import com.mortals.xhx.module.child.dao.ChildLicenseDao;
import com.mortals.xhx.module.record.model.ApplyLogEntity;
/** /**
* ChildLicenseService * ChildLicenseService
* *
...@@ -13,4 +17,6 @@ import com.mortals.xhx.module.child.dao.ChildLicenseDao; ...@@ -13,4 +17,6 @@ import com.mortals.xhx.module.child.dao.ChildLicenseDao;
public interface ChildLicenseService extends ICRUDService<ChildLicenseEntity,Long>{ public interface ChildLicenseService extends ICRUDService<ChildLicenseEntity,Long>{
ChildLicenseDao getDao(); ChildLicenseDao getDao();
int createChildLicense(ApplyLogEntity applyLogEntity, 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.module.certificate.model.CertificateChildEntity;
import com.mortals.xhx.module.certificate.model.CertificateChildQuery;
import com.mortals.xhx.module.certificate.model.CertificateDocumentEntity;
import com.mortals.xhx.module.certificate.model.CertificateDocumentQuery;
import com.mortals.xhx.module.certificate.service.CertificateChildService;
import com.mortals.xhx.module.certificate.service.CertificateDocumentService;
import com.mortals.xhx.module.record.model.ApplyLogEntity;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.Date;
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;
...@@ -19,5 +35,49 @@ import lombok.extern.slf4j.Slf4j; ...@@ -19,5 +35,49 @@ import lombok.extern.slf4j.Slf4j;
@Service("childLicenseService") @Service("childLicenseService")
@Slf4j @Slf4j
public class ChildLicenseServiceImpl extends AbstractCRUDServiceImpl<ChildLicenseDao, ChildLicenseEntity, Long> implements ChildLicenseService { public class ChildLicenseServiceImpl extends AbstractCRUDServiceImpl<ChildLicenseDao, ChildLicenseEntity, Long> implements ChildLicenseService {
@Autowired
private CertificateChildService certificateChildService;
@Autowired
private CertificateDocumentService certificateDocumentService;
@Override
public int createChildLicense(ApplyLogEntity applyLogEntity, Context context) throws AppException {
int result = 0;
if(applyLogEntity.getCatalogId()!=null) {
List<CertificateChildEntity> childEntityList = certificateChildService.find(new CertificateChildQuery().catalogId(applyLogEntity.getCatalogId()));
List<Long> documentIdList = childEntityList.stream().map(CertificateChildEntity::getDocumentId).collect(Collectors.toList());
List<CertificateDocumentEntity> documentEntityList = certificateDocumentService.find(new CertificateDocumentQuery().idList(documentIdList));
if (CollectionUtils.isNotEmpty(documentEntityList)) {
List<ChildLicenseEntity> childLicense = new ArrayList<>();
for (CertificateDocumentEntity item : documentEntityList) {
ChildLicenseEntity entity = new ChildLicenseEntity();
entity.initAttrValue();
entity.setSiteId(applyLogEntity.getSiteId());
entity.setCatalogId(applyLogEntity.getCatalogId());
entity.setCatalogName(applyLogEntity.getCatalogName());
entity.setApplyId(applyLogEntity.getId());
entity.setDocumentId(item.getId());
entity.setDocumentName(item.getDocumentName());
entity.setDeptId(item.getDeptId());
entity.setDeptName(item.getDeptName());
entity.setMarketEntityName(applyLogEntity.getEnterpriseName());
entity.setLicenseCode(applyLogEntity.getCertificateCode());
entity.setLegalPersonName(applyLogEntity.getLegalPerson());
entity.setCreditCode(applyLogEntity.getSocialCode());
entity.setProductLicenseTime(applyLogEntity.getIssueTime());
entity.setCertQRCode(applyLogEntity.getQRCode());
entity.setCertAuthority(applyLogEntity.getAuthority());
entity.setBusinessPlace(applyLogEntity.getBusinessPlace());
entity.setLicensedItems(applyLogEntity.getLicenseProject());
entity.setFormStyleContent(item.getTemplateContent());
entity.setProcessStatus(ProcessStatusEnum.未处理.getValue());
entity.setCreateTime(applyLogEntity.getCreateTime());
entity.setCreateUserId(applyLogEntity.getCreateUserId());
childLicense.add(entity);
}
this.dao.insertBatch(childLicense);
}
}
return result;
}
} }
\ No newline at end of file
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.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;
...@@ -21,4 +22,7 @@ public class ApplyLogVo extends BaseEntityLong { ...@@ -21,4 +22,7 @@ public class ApplyLogVo extends BaseEntityLong {
/** 操作类型名称 */ /** 操作类型名称 */
private String operTypeName; private String operTypeName;
/** 子证信息 */
List<ChildLicenseEntity> childLicense;
} }
\ No newline at end of file
...@@ -52,4 +52,6 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{ ...@@ -52,4 +52,6 @@ public interface ApplyLogService extends ICRUDService<ApplyLogEntity,Long>{
*/ */
String importData(List<Map<Integer, Object>> dataList,Map<String,String> fileMap,Long catalogId,Long templateId,Context context) throws AppException; String importData(List<Map<Integer, Object>> dataList,Map<String,String> fileMap,Long catalogId,Long templateId,Context context) throws AppException;
/** 社会统一信用编码查询 **/
ApplyLogEntity getBySocialCode(String socialCode) throws AppException;
} }
\ No newline at end of file
...@@ -26,6 +26,9 @@ import com.mortals.xhx.module.certificate.model.*; ...@@ -26,6 +26,9 @@ import com.mortals.xhx.module.certificate.model.*;
import com.mortals.xhx.module.certificate.pdu.ApplyLogPdu; import com.mortals.xhx.module.certificate.pdu.ApplyLogPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService; import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService; import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
import com.mortals.xhx.module.child.model.ChildLicenseEntity;
import com.mortals.xhx.module.child.model.ChildLicenseQuery;
import com.mortals.xhx.module.child.service.ChildLicenseService;
import com.mortals.xhx.module.record.dao.RecordDao; import com.mortals.xhx.module.record.dao.RecordDao;
import com.mortals.xhx.module.record.model.*; import com.mortals.xhx.module.record.model.*;
import com.mortals.xhx.module.record.service.PrintWaitQueueService; import com.mortals.xhx.module.record.service.PrintWaitQueueService;
...@@ -63,6 +66,10 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -63,6 +66,10 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Value("${upload.path}") @Value("${upload.path}")
private String filePath; private String filePath;
/** 应用公网地址 */
@Value("${serviceUrl:http://192.168.0.250:11011/onecert}")
private String serviceUrl;
@Autowired @Autowired
private UploadService uploadService; private UploadService uploadService;
...@@ -79,6 +86,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -79,6 +86,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
private UserService userService; private UserService userService;
@Autowired @Autowired
private CertificateClassifyService certificateClassifyService; private CertificateClassifyService certificateClassifyService;
@Autowired
private ChildLicenseService childLicenseService;
@Override @Override
protected void removeAfter(Long[] ids, Context context,int result) throws AppException { protected void removeAfter(Long[] ids, Context context,int result) throws AppException {
...@@ -89,6 +98,16 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -89,6 +98,16 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
} }
} }
@Override
public ApplyLogEntity get(Long key, Context context) throws AppException {
ApplyLogEntity entity = this.dao.get(key);
if(entity!=null){
List<ChildLicenseEntity> childs = childLicenseService.find(new ChildLicenseQuery().applyId(key).processStatus(ProcessStatusEnum.已处理.getValue()));
entity.setChildLicense(childs);
}
return entity;
}
@Override @Override
protected ApplyLogEntity findBefore(ApplyLogEntity entity, PageInfo pageInfo, Context context) throws AppException { protected ApplyLogEntity findBefore(ApplyLogEntity entity, PageInfo pageInfo, Context context) throws AppException {
ApplyLogQuery query = new ApplyLogQuery(); ApplyLogQuery query = new ApplyLogQuery();
...@@ -112,35 +131,32 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -112,35 +131,32 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
@Override @Override
protected void validData(ApplyLogEntity entity, Context context) throws AppException { protected void validData(ApplyLogEntity entity, Context context) throws AppException {
if(StringUtils.isEmpty(entity.getCertificateCode())){ if(StringUtils.isEmpty(entity.getCertificateCode())){
throw new AppException("证照编码不能为空"); throw new AppException("许可证编号不能为空");
} }
if(entity.getIssueTime()==null){ if(entity.getIssueTime()==null){
throw new AppException("颁发时间不能为空"); throw new AppException("制证时间不能为空");
} }
if(StringUtils.isEmpty(entity.getPickerName())){ if(StringUtils.isEmpty(entity.getLegalPerson())){
throw new AppException("取件人姓名不能为空"); throw new AppException("法定代表人不能为空");
} }
if(entity.getHolderType()==null){ if(StringUtils.isEmpty(entity.getBusinessPlace())){
throw new AppException("持有者类型不能为空"); throw new AppException("经营场所不能为空");
} }
if(entity.getHolderIdType()==null){ if(StringUtils.isEmpty(entity.getAuthority())){
throw new AppException("持有者证件类型不能为空"); throw new AppException("制证机关不能为空");
} }
if(StringUtils.isEmpty(entity.getHolderIDCardNo())){ if(StringUtils.isEmpty(entity.getSocialCode())){
throw new AppException("持有者证件号码不能为空"); throw new AppException("统一社会信用代码不能为空");
} }
if(StringUtils.isEmpty(entity.getPrivateID())){ if(StringUtils.isEmpty(entity.getLicenseProject())){
throw new AppException("专网ID不能为空"); throw new AppException("许可项目不能为空");
} }
if(StringUtils.isEmpty(entity.getEnterpriseName())){ if(StringUtils.isEmpty(entity.getEnterpriseName())){
throw new AppException("企业名称不能为空"); throw new AppException("市场主体名称不能为空");
} }
if(StringUtils.isEmpty(entity.getHolderName())){ if(StringUtils.isEmpty(entity.getIndustryName())){
throw new AppException("持有者姓名不能为空"); throw new AppException("行业名称不能为空");
} }
// if(StringUtils.isEmpty(entity.getOriFormContent())){
// throw new AppException("正本表单不能为空");
// }
if(entity.getCatalogId()==null){ if(entity.getCatalogId()==null){
throw new AppException("目录ID不能为空"); throw new AppException("目录ID不能为空");
} }
...@@ -162,6 +178,22 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -162,6 +178,22 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
applyLogEntity.setCreateUserId(context.getUser().getId()); applyLogEntity.setCreateUserId(context.getUser().getId());
} }
applyLogEntity.setGenerateStatus(GenerateStatus.NOT.getValue()); applyLogEntity.setGenerateStatus(GenerateStatus.NOT.getValue());
try {
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filePath = rootPath + "certificate/qrcode/";
String qrcodeName = applyLogEntity.getCertificateCode() + ".png";
File pathDir = new File(filePath);
if (!pathDir.exists()) {
pathDir.mkdirs();
}
String imagepath = filePath + qrcodeName;
String qrCode = serviceUrl+"/apply/log/get/"+applyLogEntity.getSocialCode();
QrCodeUtil.generateQrCodeFile(qrCode,imagepath);
applyLogEntity.setQRCode(imagepath);
//entry.setValue(pictureRenderData);
} catch (Exception e) {
log.error("error", e);
}
if(applyLogEntity.getId()!=null && applyLogEntity.getRecordId()!=null){ if(applyLogEntity.getId()!=null && applyLogEntity.getRecordId()!=null){
applyLogEntity.setOperType(OperTypeEnum.UPDATE.getValue()); applyLogEntity.setOperType(OperTypeEnum.UPDATE.getValue());
oldId = applyLogEntity.getId(); oldId = applyLogEntity.getId();
...@@ -191,6 +223,9 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -191,6 +223,9 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
updata.setUpdateTime(new Date()); updata.setUpdateTime(new Date());
dao.update(updata); dao.update(updata);
} }
//插入子证联报
childLicenseService.createChildLicense(applyLogEntity,context);
return applyLogEntity; return applyLogEntity;
} }
...@@ -522,4 +557,14 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -522,4 +557,14 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
return successMsg.toString(); return successMsg.toString();
} }
@Override
public ApplyLogEntity getBySocialCode(String socialCode) throws AppException {
ApplyLogEntity entity = this.selectOne(new ApplyLogQuery().socialCode(socialCode));
if(entity!=null){
List<ChildLicenseEntity> childs = childLicenseService.find(new ChildLicenseQuery().applyId(entity.getId()).processStatus(ProcessStatusEnum.已处理.getValue()));
entity.setChildLicense(childs);
}
return entity;
}
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ import com.mortals.xhx.common.utils.ReadExcelPictureUtil; ...@@ -13,6 +13,7 @@ import com.mortals.xhx.common.utils.ReadExcelPictureUtil;
import org.apache.poi.ss.usermodel.PictureData; import org.apache.poi.ss.usermodel.PictureData;
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.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -159,4 +160,40 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL ...@@ -159,4 +160,40 @@ public class ApplyLogController extends BaseCRUDJsonBodyMappingController<ApplyL
ret.put("msg", model.remove("message_info")); ret.put("msg", model.remove("message_info"));
return ret.toJSONString(); return ret.toJSONString();
} }
/** 社会统一信用编码查询 */
@GetMapping(value = "get/{socialCode}")
@UnAuth
public String get(@PathVariable(value="socialCode") String socialCode) {
Map<String, Object> model = new HashMap();
if (StringUtils.isEmpty(socialCode)) {
return this.createFailJsonResp("许可证编码不正确");
} else {
JSONObject ret = new JSONObject();
String busiDesc = "扫码查看" + this.getModuleDesc();
Context context = this.getContext();
try {
ApplyLogEntity entity = this.service.getBySocialCode(socialCode);
if (entity == null) {
throw new Exception(busiDesc + ",不存在或已被删除");
}
ret.put("data", entity);
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
ret.put("dict", model.remove("dict"));
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