Commit 7d6f3938 authored by 廖旭伟's avatar 廖旭伟

营业执照打印相关

parent 72852fec
package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.module.business.model.BusinessLicenseEntity;
import com.mortals.xhx.module.business.model.BusinessLicenseQuery;
import com.mortals.xhx.module.business.service.BusinessLicenseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 营业执照转换
*/
@Slf4j
@Service("BusinessLicenseTask")
public class BusinessLicenseTaskImpl implements ITaskExcuteService {
@Autowired
private BusinessLicenseService businessLicenseService;
@Override
public void excuteTask(ITask task) throws AppException {
BusinessLicenseQuery query = new BusinessLicenseQuery();
query.setStatus(0);
List<BusinessLicenseEntity> list = businessLicenseService.find(query);
if(CollectionUtils.isNotEmpty(list)){
log.info("营业执照转化任务开始.....");
int count = 0;
for (BusinessLicenseEntity businessLicenseEntity:list){
try {
businessLicenseService.doConversion(businessLicenseEntity);
count++;
}catch (Exception e){
log.error("营业执照转化出错",e);
continue;
}
}
log.info("营业执照转化任务结束,共计转化"+count+"条数据.....");
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
package com.mortals.xhx.module.business.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.business.model.BusinessLicenseEntity;
import java.util.List;
/**
* 营业执照信息Dao
* 营业执照信息 DAO接口
*
* @author zxfei
* @date 2022-12-12
*/
public interface BusinessLicenseDao extends ICRUDDao<BusinessLicenseEntity,Long>{
}
package com.mortals.xhx.module.business.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.business.dao.BusinessLicenseDao;
import com.mortals.xhx.module.business.model.BusinessLicenseEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 营业执照信息DaoImpl DAO接口
*
* @author zxfei
* @date 2022-12-12
*/
@Repository("businessLicenseDao")
public class BusinessLicenseDaoImpl extends BaseCRUDDaoMybatis<BusinessLicenseEntity,Long> implements BusinessLicenseDao {
}
package com.mortals.xhx.module.business.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.business.model.BusinessLicenseEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 营业执照信息视图对象
*
* @author zxfei
* @date 2022-12-12
*/
public class BusinessLicenseVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.business.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessLicenseEntity;
/**
* BusinessLicenseService
*
* 营业执照信息 service接口
*
* @author zxfei
* @date 2022-12-12
*/
public interface BusinessLicenseService extends ICRUDService<BusinessLicenseEntity,Long>{
/**
* API添加营业执照信息
* @param businessLicenseEntity
*/
void apiSave(BusinessLicenseEntity businessLicenseEntity);
/**
* 营业执照转化为可打印数据
* @param businessLicenseEntity
*/
void doConversion(BusinessLicenseEntity businessLicenseEntity);
}
\ No newline at end of file
package com.mortals.xhx.module.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.code.ExcuteStatus;
import com.mortals.framework.common.code.TaskExcuteStrategy;
import com.mortals.framework.common.code.TaskInterimExcuteStatus;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.util.SystemUtil;
import com.mortals.xhx.base.system.task.model.TaskEntity;
import com.mortals.xhx.base.system.task.model.TaskQuery;
import com.mortals.xhx.common.code.HolderIdType;
import com.mortals.xhx.common.code.HolderType;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.pdu.ApplyLogPdu;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.record.service.ApplyLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.business.dao.BusinessLicenseDao;
import com.mortals.xhx.module.business.model.BusinessLicenseEntity;
import com.mortals.xhx.module.business.service.BusinessLicenseService;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* BusinessLicenseService
* 营业执照信息 service实现
*
* @author zxfei
* @date 2022-12-12
*/
@Service("businessLicenseService")
public class BusinessLicenseServiceImpl extends AbstractCRUDServiceImpl<BusinessLicenseDao, BusinessLicenseEntity, Long> implements BusinessLicenseService {
/** 营业执照目录(个人)id*/
@Value("${catalog.business.personal:1}")
private long personal;
/** 营业执照目录(有限责任公司)id*/
@Value("${catalog.business.liabilityCompany:2}")
private long liabilityCompany;
/** 营业执照目录(股份有限公司)id*/
@Value("${catalog.business.stockCompany:3}")
private long stockCompany;
@Autowired
private ApplyLogService applyLogService;
@Override
public void apiSave(BusinessLicenseEntity businessLicenseEntity) {
businessLicenseEntity.setCreateTime(new Date());
this.save(businessLicenseEntity);
}
@Override
public void doConversion(BusinessLicenseEntity businessLicenseEntity) {
ApplyLogPdu applyLogPdu = new ApplyLogPdu();
Date date = DateUtils.StrToDateTime(businessLicenseEntity.getStartDate(),"yyyy-MM-dd");
if(date==null){
date = DateUtils.StrToDateTime(businessLicenseEntity.getStartDate(),"yyyy年MM月dd日");
}else {
date = new Date();
}
applyLogPdu.setIssueTime(date);
applyLogPdu.setPickerName(businessLicenseEntity.getProprietorName());
applyLogPdu.setPickerIDCardNo(businessLicenseEntity.getCredentialsCode());
applyLogPdu.setHolderIdType(HolderIdType.ID_CARD.getValue());
applyLogPdu.setHolderName(businessLicenseEntity.getProprietorName());
applyLogPdu.setHolderIDCardNo(businessLicenseEntity.getCredentialsCode());
applyLogPdu.setEnterpriseName(businessLicenseEntity.getTypeSizeName());
applyLogPdu.setPrivateID("https://www.gsxt.gov.cn");
if(businessLicenseEntity.getComposingForm().indexOf("个人经营")>0){
applyLogPdu.setCatalogId(personal);
applyLogPdu.setCertificateCode(businessLicenseEntity.getCredentialsCode());
applyLogPdu.setCertificateName(businessLicenseEntity.getTypeSizeName());
applyLogPdu.setHolderType(HolderType.PERSON.getValue());
}else if(businessLicenseEntity.getComposingForm().indexOf("有限责任公司")>0){
applyLogPdu.setCatalogId(liabilityCompany);
applyLogPdu.setCertificateCode(businessLicenseEntity.getCredentialsCode());
applyLogPdu.setCertificateName(businessLicenseEntity.getTypeSizeName());
applyLogPdu.setHolderType(HolderType.LEGAL.getValue());
//TODO
}else if(businessLicenseEntity.getComposingForm().indexOf("股份公司")>0){
applyLogPdu.setCatalogId(stockCompany);
applyLogPdu.setCertificateCode(businessLicenseEntity.getCredentialsCode());
applyLogPdu.setCertificateName(businessLicenseEntity.getTypeSizeName());
applyLogPdu.setHolderType(HolderType.LEGAL.getValue());
//TODO
}
if(businessLicenseEntity.getDyZb()==1) {
applyLogPdu.setFormContent(personalJson(businessLicenseEntity,1));
applyLogPdu.setCertificateName(applyLogPdu.getCertificateName()+"【营业执照正本】");
}
applyLogService.apiSaveApplyLog(applyLogPdu);
if(businessLicenseEntity.getDyFb()==1){
applyLogPdu.setFormContent(personalJson(businessLicenseEntity,2));
applyLogPdu.setCertificateName(applyLogPdu.getCertificateName()+"【营业执照副本】");
}
applyLogService.apiSaveApplyLog(applyLogPdu);
}
private Map<String,String> dateFromt(String dateStr){
Map<String,String> dateMap = new HashMap<>();
Date date = DateUtils.StrToDateTime(dateStr,"yyyy-MM-dd");
if(date==null){
date = DateUtils.StrToDateTime(dateStr,"yyyy年MM月dd日");
}else {
date = new Date();
}
if(date!=null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
dateMap.put("year",String.valueOf(year));
dateMap.put("month",String.valueOf(month));
dateMap.put("day",String.valueOf(day));
}
return dateMap;
}
/**
*
* @param businessLicenseEntity
* @param qrCodeType 1正本二维码 2副本二维码
* @return
*/
private String personalJson(BusinessLicenseEntity businessLicenseEntity,int qrCodeType){
JSONObject formContent = new JSONObject();
formContent.put("i_1_执照编码",businessLicenseEntity.getBusinessLicense());
formContent.put("i_2_单位名称",businessLicenseEntity.getTypeSizeName());
formContent.put("i_3_单位类型","个体工商户");
formContent.put("i_4_经营者名称",businessLicenseEntity.getProprietorName());
formContent.put("i_5_组成形式",businessLicenseEntity.getComposingForm());
String zcrq = businessLicenseEntity.getStartDate();
if(StringUtils.isNotEmpty(businessLicenseEntity.getEndDate())){
zcrq=zcrq+" 至 "+businessLicenseEntity.getEndDate();
}else {
zcrq=zcrq+" 至 长期";
}
formContent.put("i_6_注册日期",zcrq);
formContent.put("i_7_经营场所",businessLicenseEntity.getManageLocation());
formContent.put("i_8_登记机关","某某某市场监督管理局");
formContent.put("i_9_年",dateFromt(businessLicenseEntity.getStartDate()).get("year"));
formContent.put("i_10_月",dateFromt(businessLicenseEntity.getStartDate()).get("month"));
formContent.put("i_11_日",dateFromt(businessLicenseEntity.getStartDate()).get("day"));
formContent.put("t_1_经营范围",businessLicenseEntity.getManageRange());
if(qrCodeType==1) {
formContent.put("@image_1_二维码", businessLicenseEntity.getQrCodeOriginalBase64());
}else {
formContent.put("@image_1_二维码", businessLicenseEntity.getQrCodeDuplicateBase64());
}
return formContent.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.module.business.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.api.PrintCatalogVO;
import com.mortals.xhx.module.print.model.PrintCatalogEntity;
import com.mortals.xhx.module.print.model.PrintCatalogQuery;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.business.model.BusinessLicenseEntity;
import com.mortals.xhx.module.business.service.BusinessLicenseService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 营业执照信息
*
* @author zxfei
* @date 2022-12-12
*/
@RestController
@RequestMapping("business/license")
public class BusinessLicenseController extends BaseCRUDJsonBodyMappingController<BusinessLicenseService,BusinessLicenseEntity,Long> {
@Autowired
private ParamService paramService;
public BusinessLicenseController(){
super.setModuleDesc( "营业执照信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "dyZb", paramService.getParamBySecondOrganize("BusinessLicense","dyZb"));
this.addDict(model, "dyFb", paramService.getParamBySecondOrganize("BusinessLicense","dyFb"));
super.init(model, context);
}
@PostMapping({"inter"})
@UnAuth
public String apiSave(@RequestBody BusinessLicenseEntity businessLicense){
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap();
String busiDesc = "API接口存入营业执照信息";
int code = 200;
try {
service.apiSave(businessLicense);
model.put("message_info", "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
}catch (Exception e){
code = 400;
model.put("message_info", "失败");
this.doException(this.request, busiDesc, model, e);
}
ret.put("code", code);
ret.put("message", model.remove("message_info"));
return ret.toJSONString();
}
}
\ No newline at end of file
......@@ -59,4 +59,5 @@ cookie:
token:
head: mortal
upload:
path: /mortals/app/data/cpm
path: D:/mortals/app/data/cpm
url: http://localhost:17216/cpm/file/commonupload?prePath=/file/uploadfile
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