资质审核

cert
schry 2 years ago
parent 61c2c0cc56
commit 5c92217351

@ -1,40 +1,60 @@
package com.glxp.api.controller.purchase; package com.glxp.api.controller.purchase;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.annotation.Log;
import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.purchase.SupCertEntity; import com.glxp.api.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.purchase.*;
import com.glxp.api.entity.sup.UserCertEntity; import com.glxp.api.entity.sup.UserCertEntity;
import com.glxp.api.entity.sup.UserCertSetEntity; import com.glxp.api.entity.sup.UserCertSetEntity;
import com.glxp.api.req.purchase.FilterImageRequest; import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity;
import com.glxp.api.req.purchase.FilterSupCertRequest; import com.glxp.api.entity.system.SystemPDFTemplateEntity;
import com.glxp.api.req.purchase.certRequest; import com.glxp.api.exception.JsonException;
import com.glxp.api.req.inout.InspectionPDFTemplateRequest;
import com.glxp.api.req.purchase.*;
import com.glxp.api.req.system.DeleteCompanyFileRequest; import com.glxp.api.req.system.DeleteCompanyFileRequest;
import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.auth.registComPerResponse; import com.glxp.api.res.auth.registComPerResponse;
import com.glxp.api.res.purchase.SupProductResponse;
import com.glxp.api.service.auth.AuthAdminService; import com.glxp.api.service.auth.AuthAdminService;
import com.glxp.api.service.purchase.SupCertService;
import com.glxp.api.service.purchase.SupCompanyService;
import com.glxp.api.service.purchase.SupManufacturerService;
import com.glxp.api.service.purchase.SupProductService;
import com.glxp.api.service.sup.UserCertService; import com.glxp.api.service.sup.UserCertService;
import com.glxp.api.service.sup.UserCertSetService; import com.glxp.api.service.sup.UserCertSetService;
import com.glxp.api.service.system.SystemPDFModuleService; import com.glxp.api.service.system.SystemPDFModuleService;
import com.glxp.api.service.system.SystemPDFTemplateService; import com.glxp.api.service.system.SystemPDFTemplateService;
import com.glxp.api.util.JasperUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
/** /**
* @author : zhangsan * @author : zhangsan
@ -48,51 +68,295 @@ public class SupCertController {
@Resource @Resource
private AuthAdminService authAdminService; private AuthAdminService authAdminService;
@Resource @Resource
private UserCertService userCertService; private SupCertService supCertService;
@Value("${file_path}") @Value("${file_path}")
private String filePath; private String filePath;
@Resource
private UserCertSetService userCertSetService;
@Resource @Resource
private SystemPDFTemplateService systemPDFTemplateService; private SystemPDFTemplateService systemPDFTemplateService;
@Resource @Resource
private SystemPDFModuleService systemPDFModuleService; private SystemPDFModuleService systemPDFModuleService;
@AuthRuleAnnotation("")
@ApiOperation(value = "获取供应商资质信息",response = UserCertEntity.class) @GetMapping("/sup/company/cert/filter")
@GetMapping("/sup/company/cert/filterList") public BaseResponse filterCompanyCert(FilterSupCertRequest filterSupCertRequest,
public BaseResponse filterCompanyCert(certRequest certRequest , BindingResult bindingResult){ BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
List<UserCertEntity> userCertEntities = userCertService.selectBybId(certRequest); List<SupCertEntity> supCertEntityList
PageInfo<UserCertEntity> pageInfo; = supCertService.filterCompanyCert(filterSupCertRequest);
pageInfo = new PageInfo<>(userCertEntities); PageInfo<SupCertEntity> pageInfo;
PageSimpleResponse<UserCertEntity> pageSimpleResponse = new PageSimpleResponse<>(); pageInfo = new PageInfo<>(supCertEntityList);
PageSimpleResponse<SupCertEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(supCertEntityList);
return ResultVOUtils.success(pageSimpleResponse);
}
private BaseResponse insertCompanyCert(String customerId, PostSelCertRequest request) {
if (CollUtil.isEmpty(request.getSupCertSetEntities())) {
return ResultVOUtils.error(500, "请选入资质证书!");
}
if (request.getCertType() == null) {
return ResultVOUtils.error(500, "参数错误!");
}
int certType = request.getCertType();
String productIdFk = request.getProductIdFk();
String manufacturerIdFk = request.getManufacturerIdFk();
String errMsg = "";
ArrayList<String> list = new ArrayList<>();
int i = request.getSupCertSetEntities().size();
for (SupCertSetEntity supCertSetEntity : request.getSupCertSetEntities()) {
i--;
FilterSupCertRequest supCertRequest = new FilterSupCertRequest();
supCertRequest.setName(supCertSetEntity.getName());
supCertRequest.setCustomerId(customerId);
supCertRequest.setManufacturerIdFk(manufacturerIdFk);
if (productIdFk != null) {
supCertRequest.setProductIdFk(productIdFk);
supCertRequest.setType(3);
} else {
supCertRequest.setType(2);
}
List<SupCertEntity> supCertEntities = supCertService.selectCompanyCert(supCertRequest);
if (!supCertEntities.isEmpty()) {
list.add(supCertEntities.get(0).getName());
if (i == 0) {
errMsg = list.stream().map(s -> "," + s).collect(Collectors.joining());
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
}
}
}
for (SupCertSetEntity supCertSetEntity : request.getSupCertSetEntities()) {
SupCertEntity supCertEntity = new SupCertEntity();
supCertEntity.setName(supCertSetEntity.getName());
supCertEntity.setManufacturerIdFk(manufacturerIdFk);
supCertEntity.setProductIdFk(productIdFk);
supCertEntity.setCustomerId(customerId);
supCertEntity.setType(certType);
supCertEntity.setCreateTime(new Date());
supCertEntity.setStatus(0);
supCertEntity.setAuditStatus(ConstantStatus.AUDIT_DRAFT);
supCertEntity.setUpdateTime(new Date());
supCertEntity.setId(IdUtil.getSnowflakeNextId());
boolean b = supCertService.insertCompanyCert(supCertEntity);
}
return ResultVOUtils.success("成功");
}
@AuthRuleAnnotation("")
@PostMapping("/sup/info/selectAllCert")
@Log(title = "资质证书", businessType = BusinessType.INSERT)
public BaseResponse selectAllCert(@RequestBody PostSelCertRequest postSelCertRequest) {
String customerId = null;
if (StrUtil.isEmpty(postSelCertRequest.getCustomerId()))
customerId = getCustomerId();
else {
customerId = postSelCertRequest.getCustomerId();
}
if (CollUtil.isEmpty(postSelCertRequest.getSupCertSetEntities())) {
return ResultVOUtils.error(500, "请选入资质证书!");
}
if (postSelCertRequest.getCertType() == null) {
return ResultVOUtils.error(500, "参数错误!");
}
String errMsg = checkCert(postSelCertRequest, customerId);
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
}
for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) {
SupCertEntity supCertEntity = new SupCertEntity();
supCertEntity.setName(supCertSetEntity.getName());
supCertEntity.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
supCertEntity.setProductIdFk(postSelCertRequest.getProductIdFk());
supCertEntity.setCustomerId(customerId);
supCertEntity.setType(postSelCertRequest.getCertType());
supCertEntity.setCreateTime(new Date());
supCertEntity.setStatus(0);
supCertEntity.setAuditStatus(ConstantStatus.AUDIT_DRAFT);
supCertEntity.setUpdateTime(new Date());
supCertEntity.setId(IdUtil.getSnowflakeNextId());
boolean b = supCertService.insertCompanyCert(supCertEntity);
}
return ResultVOUtils.success("成功");
}
public String checkCert(PostSelCertRequest postSelCertRequest, String customerId) {
String errMsg = "";
ArrayList<String> list = new ArrayList<>();
int i = postSelCertRequest.getSupCertSetEntities().size();
for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) {
i--;
FilterSupCertRequest supCertRequest = new FilterSupCertRequest();
supCertRequest.setName(supCertSetEntity.getName());
supCertRequest.setCustomerId(customerId);
if (StrUtil.isEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) {
supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
supCertRequest.setType(2);
}
if (StrUtil.isNotEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) {
supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
supCertRequest.setProductIdFk(postSelCertRequest.getProductIdFk());
supCertRequest.setType(3);
}
List<SupCertEntity> supCertEntities = supCertService.selectCompanyCert(supCertRequest);
if (supCertEntities.size() != 0) {
list.add(supCertEntities.get(0).getName());
if (supCertEntities.size() != 0 && i == 0) {
for (String s : list) {
errMsg = errMsg + "," + s;
}
return errMsg;
}
} else {
if (i == 0 && list.size() > 0) {
for (String s : list) {
errMsg = errMsg + "," + s;
}
return errMsg;
}
}
}
return errMsg;
}
@AuthRuleAnnotation("")
@GetMapping("/sale/info/getCompanyCert")
public BaseResponse getCompanyCert(FilterSupCertRequest filterSupCertRequest) {
filterSupCertRequest.setCustomerId(getCustomerId());
List<SupCertEntity> companyCertEntities = supCertService.getCompanyCert(filterSupCertRequest);
PageInfo<SupCertEntity> pageInfo = new PageInfo<>(companyCertEntities);
PageSimpleResponse<SupCertEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(userCertEntities); pageSimpleResponse.setList(companyCertEntities);
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@AuthRuleAnnotation("")
@PostMapping("/sup/info/insertCompanyCert")
@Log(title = "资质证书", businessType = BusinessType.INSERT)
public BaseResponse insertCompanyCert(@RequestBody SupCertEntity supCertEntity) {
supCertEntity.setCreateTime(new Date());
supCertEntity.setUpdateTime(new Date());
supCertEntity.setStatus(0);
supCertEntity.setId(IdUtil.getSnowflakeNextId());
if (supCertEntity.getVailDate() != null && supCertEntity.getExpireDate() != null) {
if (supCertEntity.getVailDate().getTime() > supCertEntity.getExpireDate().getTime()) {
return ResultVOUtils.error(999, "失效期不能小于生效期!");
}
}
boolean b = supCertService.insertCompanyCert(supCertEntity);
return ResultVOUtils.success("成功");
}
//资质证书添加 @AuthRuleAnnotation("")
@ApiOperation(value = "资质证书添加",response = BaseResponse.class) @PostMapping("/sale/sup/cert/audit")
@PostMapping("/sup/company/cert/isertCert") @Log(title = "资质证书", businessType = BusinessType.UPDATE)
public BaseResponse isertCert(@RequestBody UserCertEntity userCert){ public BaseResponse auditSupCert(@RequestBody SupCertEntity supCertEntity) {
userCert.setCreateTime(new Date()); supCertEntity.setCreateTime(new Date());
userCert.setUpdateTime(new Date()); supCertEntity.setUpdateTime(new Date());
userCert.setStatus(1+""); boolean b = supCertService.updateCompanyCert(supCertEntity);
userCert.setCheckStatus(0+"");
userCert.setId(IdUtil.getSnowflakeNextId());
userCertService.insertCert(userCert);
return ResultVOUtils.success("成功"); return ResultVOUtils.success("成功");
} }
//删除 //撤回单据
@ApiOperation(value = "删除资质证书",response = BaseResponse.class) @AuthRuleAnnotation("")
@PostMapping("/sup/company/cert/deleteCert") @PostMapping("/sale/sup/cert/revoke")
public BaseResponse deleteCert(@RequestBody DeleteCompanyFileRequest deleteCompanyFileRequest){ @Log(title = "单据管理", businessType = BusinessType.UPDATE)
boolean b = userCertService.deleteById(deleteCompanyFileRequest.getId()); public BaseResponse revokeSupCert(@RequestBody SupCertEntity supCertEntity) {
supCertEntity.setCreateTime(new Date());
supCertEntity.setUpdateTime(new Date());
boolean b = supCertService.updateCompanyCert(supCertEntity);
if (supCertEntity.getType() == ConstantStatus.CERT_COMPANY) {
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supCertEntity.getCustomerId());
supCompanyEntity.setAuditStatus(ConstantStatus.AUDIT_UN);
supCompanyEntity.setUpdateTime(new Date());
supCompanyService.modifyCompany(supCompanyEntity);
} else if (supCertEntity.getType() == ConstantStatus.CERT_MANUFACTURER) {
SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supCertEntity.getManufacturerIdFk());
supManufacturerEntity.setAuditStatus(ConstantStatus.AUDIT_UN);
supManufacturerEntity.setUpdateTime(new Date());
supManufacturerService.modifyCompany(supManufacturerEntity);
} else if (supCertEntity.getType() == ConstantStatus.CERT_PRODUCT) {
SupProductResponse supProductResponse = supProductService.findByProductId(supCertEntity.getProductIdFk());
SupProductEntity supProductEntity = new SupProductEntity();
supProductEntity.setId(supProductResponse.getId());
supProductEntity.setUpdateTime(new Date());
supProductEntity.setAuditStatus(ConstantStatus.AUDIT_UN);
supProductService.modifyRegistration(supProductEntity);
}
return ResultVOUtils.success("成功");
}
@Resource
SupCompanyService supCompanyService;
@Resource
SupManufacturerService supManufacturerService;
@Resource
SupProductService supProductService;
@AuthRuleAnnotation("")
@PostMapping("/sup/info/updateCompanyCert")
@Log(title = "资质证书", businessType = BusinessType.UPDATE)
public BaseResponse updateCompanyCert(@RequestBody PostSupCertRequest postSupCertRequest) {
SupCertEntity supCertEntity = new SupCertEntity();
BeanUtils.copyProperties(postSupCertRequest, supCertEntity);
if (postSupCertRequest.getVailDate() != null && postSupCertRequest.getExpireDate() != null) {
if (postSupCertRequest.getVailDate().getTime() > postSupCertRequest.getExpireDate().getTime()) {
return ResultVOUtils.error(999, "失效期不能小于生效期!");
}
}
if (postSupCertRequest.getRepeatUpload() == 1) {
//已审核的重新提交
//1.修改对应的资质信息进入变更审核状态,
if (postSupCertRequest.getType() == ConstantStatus.CERT_COMPANY) {
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supCertEntity.getCustomerId());
supCompanyEntity.setAuditStatus(ConstantStatus.AUDIT_CHANGE);
supCompanyEntity.setUpdateTime(new Date());
supCompanyService.modifyCompany(supCompanyEntity);
} else if (postSupCertRequest.getType() == ConstantStatus.CERT_MANUFACTURER) {
SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supCertEntity.getManufacturerIdFk());
supManufacturerEntity.setAuditStatus(ConstantStatus.AUDIT_CHANGE);
supManufacturerEntity.setUpdateTime(new Date());
supManufacturerService.modifyCompany(supManufacturerEntity);
} else if (postSupCertRequest.getType() == ConstantStatus.CERT_PRODUCT) {
SupProductResponse supProductResponse = supProductService.findByProductId(supCertEntity.getProductIdFk());
SupProductEntity supProductEntity = new SupProductEntity();
supProductEntity.setId(supProductResponse.getId());
supProductEntity.setUpdateTime(new Date());
supProductEntity.setAuditStatus(ConstantStatus.AUDIT_CHANGE);
supProductService.modifyRegistration(supProductEntity);
}
}
boolean b = supCertService.updateCompanyCert(supCertEntity);
return ResultVOUtils.success("修改成功");
}
@AuthRuleAnnotation("")
@PostMapping("/sup/info/deleteCompanyCert")
public BaseResponse deleteCompanyCert(@RequestBody DeleteCompanyFileRequest deleteCompanyFileRequest, BindingResult bindingResult) {
boolean b = supCertService.deleteById(deleteCompanyFileRequest.getId());
String URL = filePath + "/register/file/image2/" + deleteCompanyFileRequest.getFilePath(); String URL = filePath + "/register/file/image2/" + deleteCompanyFileRequest.getFilePath();
File file = new File(URL); File file = new File(URL);
if (file.exists() && file.isFile()) { if (file.exists() && file.isFile()) {
@ -101,10 +365,282 @@ public class SupCertController {
return ResultVOUtils.success("成功"); return ResultVOUtils.success("成功");
} }
public String getCustomerId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
throw new JsonException(ResultEnum.NOT_NETWORK);
}
HttpServletRequest request = attributes.getRequest();
String userId = request.getHeader("ADMIN_ID");
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
return authAdmin.getCustomerId() + "";
}
/**
*
*
* @param inspectionPDFTemplateRequest
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/sup/info/verifyTemplateFile")
public BaseResponse verifyTemplateFile(@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
if (null == inspectionPDFTemplateRequest) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空!");
}
//查询模板文件是否存在
SysPdfTemplateRelevanceStatemenEntity sysPdfTemplateRelevanceStatemenEntity = systemPDFModuleService.selectByStatemenId(inspectionPDFTemplateRequest.getId());
if (null == sysPdfTemplateRelevanceStatemenEntity) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误");
}
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(sysPdfTemplateRelevanceStatemenEntity.getTemplateId()));
if (null == systemPDFTemplateEntity) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误");
}
return ResultVOUtils.success(sysPdfTemplateRelevanceStatemenEntity.getTemplateId());
}
/**
*
*
* @param purPlanPrintRequest
* @param request
* @param response
* @throws Exception
*/
@AuthRuleAnnotation("")
@PostMapping("/sup/info/printOrder")
public void printOrder(@RequestBody purPlanPrintRequest purPlanPrintRequest, HttpServletRequest request, HttpServletResponse response) throws Exception {
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(purPlanPrintRequest.getTemplateId());
//打印单号标签
Map<String, Object> data = new HashMap<>(1);
List<Object> list = new ArrayList<>();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式
//查询配送企业信息
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(purPlanPrintRequest.getCustomerId());
//查询详情
List<SupCertEntity> selectSupCertList = supCertService.selectSupCertList(purPlanPrintRequest);
int i = 1;
if (selectSupCertList != null && selectSupCertList.size() > 0) {
for (SupCertEntity obj : selectSupCertList) {
List<String> urlList = Arrays.asList(obj.getFilePath().split(","));
for (String url : urlList) {
//组装数据
Map<String, Object> supData = new HashMap<>();
supData.put("companyName", supCompanyEntity.getCompanyName() == null ? ' ' : supCompanyEntity.getCompanyName());
supData.put("creditNum", supCompanyEntity.getCreditNum() == null ? ' ' : supCompanyEntity.getCreditNum());
supData.put("classes", supCompanyEntity.getClasses().equals(1) ? "医院" : "经营企业");
supData.put("area", supCompanyEntity.getArea() == null ? ' ' : supCompanyEntity.getArea());
supData.put("contacts", supCompanyEntity.getContacts() == null ? ' ' : supCompanyEntity.getContacts());
supData.put("detailAddr", supCompanyEntity.getDetailAddr() == null ? ' ' : supCompanyEntity.getDetailAddr());
supData.put("mobile", supCompanyEntity.getMobile() == null ? ' ' : supCompanyEntity.getMobile());
supData.put("email", supCompanyEntity.getEmail() == null ? ' ' : supCompanyEntity.getEmail());
supData.put("index", String.valueOf(i));
supData.put("name", obj.getName() == null ? ' ' : obj.getName());
supData.put("code", obj.getCode() == null ? ' ' : obj.getCode());
supData.put("vaiDate", obj.getVailDate() == null ? ' ' : formatter.format(obj.getVailDate()));
supData.put("expireDate", obj.getExpireDate() == null ? ' ' : formatter.format(obj.getExpireDate()));
supData.put("status", obj.getStatus() == 0 ? "有效" : "失效");
supData.put("auditStatus", getAuditStatus(obj.getAuditStatus()));
supData.put("remark", obj.getRemark() == null ? ' ' : obj.getRemark());
supData.put("filePath", filePath + "register/image2/" + url);
list.add(supData);
i++;
}
}
}
String param = JSON.toJSONString(list);
JasperUtils.jasperReport(request, response, param, filePath+"pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
/**
* ids
*
* @param filterSupCertRequest
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/sup/info/filterCompanyCertIdList")
public BaseResponse filterCompanyCertIdList(@RequestBody FilterSupCertRequest filterSupCertRequest) {
if (StrUtil.isNotEmpty(filterSupCertRequest.getCustomerId()) && filterSupCertRequest.getType() != null) {
List<SupCertEntity> supCertEntityList = supCertService.filterCompanyCert(filterSupCertRequest);
List<Long> idsList = supCertEntityList.stream().map(SupCertEntity::getId).distinct().collect(Collectors.toList());
return ResultVOUtils.success(idsList);
}
return ResultVOUtils.error(999, "参数错误");
}
public String getAuditStatus(int type) {
if (type == 0) {
return "草稿";
} else if (type == 1) {
return "审核通过";
} else if (type == 2) {
return "审核不通过";
} else if (type == 3) {
return "申请变更";
} else if (type == 4) {
return "申请变更通过";
} else if (type == 5) {
return "申请变更不通过";
} else if (type == 6) {
return "已提交未审核";
}
return "";
}
public String getRegisterStatus(String type) {
if (type.equals("1")) {
return "续存(在营,开业,在册)";
} else if (type.equals("2")) {
return "吊销";
} else if (type.equals("3")) {
return "注销";
} else if (type.equals("4")) {
return "迁出";
}
return "";
}
/**
*
*
* @param purPlanPrintRequest
* @param request
* @param response
* @throws Exception
*/
@AuthRuleAnnotation("")
@PostMapping("/sup/info/printSupCertManufacturer")
public void printSupCertManufacturer(@RequestBody purPlanPrintRequest purPlanPrintRequest, HttpServletRequest request, HttpServletResponse response) throws Exception {
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(purPlanPrintRequest.getTemplateId());
//打印单号标签
Map<String, Object> data = new HashMap<>(1);
List<Object> list = new ArrayList<>();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式
FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest();
filterSupManufacturerRequest.setId(purPlanPrintRequest.getId());
//查询生产企业信息
List<SupManufacturerEntity> supManufacturerEntityList = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest);
SupManufacturerEntity supManufacturerEntity = supManufacturerEntityList.get(0);
//查询详情
List<SupCertEntity> selectSupCertList = supCertService.selectSupCertList(purPlanPrintRequest);
int i = 1;
if (selectSupCertList != null && selectSupCertList.size() > 0) {
for (SupCertEntity obj : selectSupCertList) {
List<String> urlList = Arrays.asList(obj.getFilePath().split(","));
for (String url : urlList) {
//组装数据
Map<String, Object> supData = new HashMap<>();
supData.put("customerName", supManufacturerEntity.getSupName() == null ? ' ' : supManufacturerEntity.getSupName());
supData.put("companyName", supManufacturerEntity.getCompanyName() == null ? ' ' : supManufacturerEntity.getCompanyName());
supData.put("companyType", supManufacturerEntity.getCompanyType().equals(1) ? "境内企业" : "境外企业");
supData.put("creditCode", supManufacturerEntity.getCreditCode() == null ? ' ' : supManufacturerEntity.getCreditCode());
supData.put("placeArea", supManufacturerEntity.getPlaceArea() == null ? ' ' : supManufacturerEntity.getPlaceArea());
supData.put("productionArea", supManufacturerEntity.getProductionArea() == null ? ' ' : supManufacturerEntity.getProductionArea());
supData.put("registerStatus", getRegisterStatus(supManufacturerEntity.getRegisterStatus()));
supData.put("placeAddress", supManufacturerEntity.getPlaceAddress() == null ? ' ' : supManufacturerEntity.getPlaceAddress());
supData.put("productionAddress", supManufacturerEntity.getProductionAddress() == null ? ' ' : supManufacturerEntity.getProductionAddress());
supData.put("remark1", supManufacturerEntity.getRemark() == null ? ' ' : supManufacturerEntity.getRemark());
supData.put("index", String.valueOf(i));
supData.put("name", obj.getName() == null ? ' ' : obj.getName());
supData.put("code", obj.getCode() == null ? ' ' : obj.getCode());
supData.put("vaiDate", obj.getVailDate() == null ? ' ' : formatter.format(obj.getVailDate()));
supData.put("expireDate", obj.getExpireDate() == null ? ' ' : formatter.format(obj.getExpireDate()));
supData.put("status", obj.getStatus() == 0 ? "有效" : "失效");
supData.put("auditStatus", getAuditStatus(obj.getAuditStatus()));
supData.put("remark2", obj.getRemark() == null ? ' ' : obj.getRemark());
supData.put("filePath", filePath + "register/image2/" + url);
list.add(supData);
i++;
}
}
}
String param = JSON.toJSONString(list);
JasperUtils.jasperReport(request, response, param, filePath+"pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
/**
*
*
* @param purPlanPrintRequest
* @param request
* @param response
* @throws Exception
*/
@AuthRuleAnnotation("")
@PostMapping("/sup/info/printSupCertProduction")
public void printSupCertProduction(@RequestBody purPlanPrintRequest purPlanPrintRequest, HttpServletRequest request, HttpServletResponse response) throws Exception {
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(purPlanPrintRequest.getTemplateId());
//打印单号标签
Map<String, Object> data = new HashMap<>(1);
List<Object> list = new ArrayList<>();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式
//查询配送产品信息
SupProductEntity supProductEntity = supProductService.findRegistration(purPlanPrintRequest.getId());
//查询生产企业信息
FilterSupManufacturerRequest filterSupManufacturerRequest = new FilterSupManufacturerRequest();
filterSupManufacturerRequest.setManufacturerId(supProductEntity.getManufacturerIdFk());
List<SupManufacturerEntity> supManufacturerEntityList = supManufacturerService.getCompanyByNameAndCode(filterSupManufacturerRequest);
SupManufacturerEntity supManufacturerEntity = supManufacturerEntityList.get(0);
//查询详情
List<SupCertEntity> selectSupCertList = supCertService.selectSupCertList(purPlanPrintRequest);
int i = 1;
if (selectSupCertList != null && selectSupCertList.size() > 0) {
for (SupCertEntity obj : selectSupCertList) {
List<String> urlList = Arrays.asList(obj.getFilePath().split(","));
for (String url : urlList) {
//组装数据
Map<String, Object> supData = new HashMap<>();
supData.put("customerName", supManufacturerEntity.getSupName() == null ? ' ' : supManufacturerEntity.getSupName());
supData.put("manufacturerldFk", supManufacturerEntity.getCompanyName() == null ? ' ' : supManufacturerEntity.getCompanyName());
supData.put("recordProductName", supProductEntity.getRecordProductName() == null ? ' ' : supProductEntity.getRecordProductName());
supData.put("recordCode", supProductEntity.getRecordCode() == null ? ' ' : supProductEntity.getRecordCode());
supData.put("recordPeopleName", supProductEntity.getRecordPeopleName() == null ? ' ' : supProductEntity.getRecordPeopleName());
supData.put("hchzsb", supProductEntity.getHchzsb() == null ? ' ' : supProductEntity.getHchzsb());
supData.put("productType", supProductEntity.getProductType() == null ? ' ' : supProductEntity.getProductType());
supData.put("productDirectoryCode", supProductEntity.getProductDirectoryCode() == null ? ' ' : supProductEntity.getProductDirectoryCode());
supData.put("specification", supProductEntity.getSpecification() == null ? ' ' : supProductEntity.getSpecification());
// supData.put("cpms", supProductEntity.getCpms() == null ? ' ' : supProductEntity.getCpms());
supData.put("remark1", supProductEntity.getRemark() == null ? ' ' : supProductEntity.getRemark());
supData.put("index", String.valueOf(i));
supData.put("name", obj.getName() == null ? ' ' : obj.getName());
supData.put("code", obj.getCode() == null ? ' ' : obj.getCode());
supData.put("vaiDate", obj.getVailDate() == null ? ' ' : formatter.format(obj.getVailDate()));
supData.put("expireDate", obj.getExpireDate() == null ? ' ' : formatter.format(obj.getExpireDate()));
supData.put("status", obj.getStatus() == 0 ? "有效" : "失效");
supData.put("auditStatus", getAuditStatus(obj.getAuditStatus()));
supData.put("remark2", obj.getRemark() == null ? ' ' : obj.getRemark());
supData.put("filePath", filePath + "register/image2/" + url);
list.add(supData);
i++;
}
}
}
String param = JSON.toJSONString(list);
JasperUtils.jasperReport(request, response, param, filePath+"pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
//首营预览文件 //首营预览文件
@ApiOperation(value = "上传注册人文件",response = BaseResponse.class)
@PostMapping("/udiwms/image/register/file") @PostMapping("/udiwms/image/register/file")
public BaseResponse uploadRegisterFile(@RequestBody FilterImageRequest filterImageRequest) { public BaseResponse uploadRegisterFile(@RequestBody FilterImageRequest filterImageRequest) {
List<String> urlList = Arrays.asList(filterImageRequest.getImageUrl().split(",")); List<String> urlList = Arrays.asList(filterImageRequest.getImageUrl().split(","));
@ -116,29 +652,99 @@ public class SupCertController {
return ResultVOUtils.success(list); return ResultVOUtils.success(list);
} }
//修改 // @Resource
@ApiOperation(value = "修改资质证书",response = BaseResponse.class) // private AuthAdminService authAdminService;
@PostMapping("/sup/info/updateCert") // @Resource
public BaseResponse updateCert(@RequestBody UserCertEntity userCert){ // private UserCertService userCertService;
// @Value("${file_path}")
if (userCert.getValidDate() != null && userCert.getExpireDate() != null) { // private String filePath;
if (userCert.getValidDate().getTime() > userCert.getExpireDate().getTime()) { // @Resource
return ResultVOUtils.error(999, "生效期不能小于失效期!"); // private UserCertSetService userCertSetService;
} // @Resource
} // private SystemPDFTemplateService systemPDFTemplateService;
userCertService.updateCert(userCert); // @Resource
// private SystemPDFModuleService systemPDFModuleService;
if("key".equals(userCert.getKey())){ //
//插入记录表中 // @ApiOperation(value = "获取供应商资质信息",response = UserCertEntity.class)
UserCertSetEntity userCertSetEntity = new UserCertSetEntity(); // @GetMapping("/sup/company/cert/filterList")
userCertSetEntity.setId(IdUtil.getSnowflakeNextId()); // public BaseResponse filterCompanyCert(certRequest certRequest , BindingResult bindingResult){
userCertSetEntity.setCreateTime(new Date()); // if (bindingResult.hasErrors()) {
userCertSetEntity.setCreateUser(userCert.getCreateUser()); // return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
userCertSetEntity.setName(userCert.getName()); // }
userCertSetService.insert(userCertSetEntity); // List<UserCertEntity> userCertEntities = userCertService.selectBybId(certRequest);
// PageInfo<UserCertEntity> pageInfo;
} // pageInfo = new PageInfo<>(userCertEntities);
// PageSimpleResponse<UserCertEntity> pageSimpleResponse = new PageSimpleResponse<>();
return ResultVOUtils.success("修改成功"); // pageSimpleResponse.setTotal(pageInfo.getTotal());
} // pageSimpleResponse.setList(userCertEntities);
// return ResultVOUtils.success(pageSimpleResponse);
// }
//
//
// //资质证书添加
// @ApiOperation(value = "资质证书添加",response = BaseResponse.class)
// @PostMapping("/sup/company/cert/isertCert")
// public BaseResponse isertCert(@RequestBody UserCertEntity userCert){
// userCert.setCreateTime(new Date());
// userCert.setUpdateTime(new Date());
// userCert.setStatus(1+"");
// userCert.setCheckStatus(0+"");
// userCert.setId(IdUtil.getSnowflakeNextId());
// userCertService.insertCert(userCert);
// return ResultVOUtils.success("成功");
// }
//
// //删除
// @ApiOperation(value = "删除资质证书",response = BaseResponse.class)
// @PostMapping("/sup/company/cert/deleteCert")
// public BaseResponse deleteCert(@RequestBody DeleteCompanyFileRequest deleteCompanyFileRequest){
// boolean b = userCertService.deleteById(deleteCompanyFileRequest.getId());
// String URL = filePath + "/register/file/image2/" + deleteCompanyFileRequest.getFilePath();
// File file = new File(URL);
// if (file.exists() && file.isFile()) {
// file.delete();
// }
// return ResultVOUtils.success("成功");
// }
//
//
//
// //首营预览文件
// @ApiOperation(value = "上传注册人文件",response = BaseResponse.class)
// @PostMapping("/udiwms/image/register/file")
// public BaseResponse uploadRegisterFile(@RequestBody FilterImageRequest filterImageRequest) {
// List<String> urlList = Arrays.asList(filterImageRequest.getImageUrl().split(","));
// List<String> list = new ArrayList<>();
// for (String obj : urlList) {
// String url = filterImageRequest.getCertFileUrl() + obj;
// list.add(url);
// }
// return ResultVOUtils.success(list);
// }
//
// //修改
// @ApiOperation(value = "修改资质证书",response = BaseResponse.class)
// @PostMapping("/sup/info/updateCert")
// public BaseResponse updateCert(@RequestBody UserCertEntity userCert){
//
// if (userCert.getValidDate() != null && userCert.getExpireDate() != null) {
// if (userCert.getValidDate().getTime() > userCert.getExpireDate().getTime()) {
// return ResultVOUtils.error(999, "生效期不能小于失效期!");
// }
// }
// userCertService.updateCert(userCert);
//
// if("key".equals(userCert.getKey())){
// //插入记录表中
// UserCertSetEntity userCertSetEntity = new UserCertSetEntity();
// userCertSetEntity.setId(IdUtil.getSnowflakeNextId());
// userCertSetEntity.setCreateTime(new Date());
// userCertSetEntity.setCreateUser(userCert.getCreateUser());
// userCertSetEntity.setName(userCert.getName());
// userCertSetService.insert(userCertSetEntity);
//
// }
//
// return ResultVOUtils.success("修改成功");
// }
} }

@ -69,53 +69,53 @@ public class SupCompanyController {
return ResultVOUtils.success(customerInfoEntity); return ResultVOUtils.success(customerInfoEntity);
} }
@AuthRuleAnnotation("") // @AuthRuleAnnotation("")
@GetMapping("/sup/company/cert/filter") // @GetMapping("/sup/company/cert/filter")
public BaseResponse filterCompanyCert(FilterSupCertRequest filterSupCertRequest, // public BaseResponse filterCompanyCert(FilterSupCertRequest filterSupCertRequest,
BindingResult bindingResult) { // BindingResult bindingResult) {
if (bindingResult.hasErrors()) { // if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); // return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} // }
List<SupCertEntity> supCertEntityList // List<SupCertEntity> supCertEntityList
= supCertService.filterCompanyCert(filterSupCertRequest); // = supCertService.filterCompanyCert(filterSupCertRequest);
PageInfo<SupCertEntity> pageInfo; // PageInfo<SupCertEntity> pageInfo;
pageInfo = new PageInfo<>(supCertEntityList); // pageInfo = new PageInfo<>(supCertEntityList);
PageSimpleResponse<SupCertEntity> pageSimpleResponse = new PageSimpleResponse<>(); // PageSimpleResponse<SupCertEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal()); // pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(supCertEntityList); // pageSimpleResponse.setList(supCertEntityList);
return ResultVOUtils.success(pageSimpleResponse); // return ResultVOUtils.success(pageSimpleResponse);
} // }
//撤回单据 //撤回单据
@AuthRuleAnnotation("") // @AuthRuleAnnotation("")
@PostMapping("/sale/sup/cert/revoke") // @PostMapping("/sale/sup/cert/revoke")
@Log(title = "单据管理", businessType = BusinessType.UPDATE) // @Log(title = "单据管理", businessType = BusinessType.UPDATE)
public BaseResponse revokeSupCert(@RequestBody SupCertEntity supCertEntity) { // public BaseResponse revokeSupCert(@RequestBody SupCertEntity supCertEntity) {
supCertEntity.setCreateTime(new Date()); // supCertEntity.setCreateTime(new Date());
supCertEntity.setUpdateTime(new Date()); // supCertEntity.setUpdateTime(new Date());
boolean b = supCertService.updateCompanyCert(supCertEntity); // boolean b = supCertService.updateCompanyCert(supCertEntity);
if (supCertEntity.getType() == ConstantStatus.CERT_COMPANY) { // if (supCertEntity.getType() == ConstantStatus.CERT_COMPANY) {
SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supCertEntity.getCustomerId()); // SupCompanyEntity supCompanyEntity = supCompanyService.findCompany(supCertEntity.getCustomerId());
supCompanyEntity.setAuditStatus(ConstantStatus.AUDIT_UN); // supCompanyEntity.setAuditStatus(ConstantStatus.AUDIT_UN);
supCompanyEntity.setUpdateTime(new Date()); // supCompanyEntity.setUpdateTime(new Date());
supCompanyService.modifyCompany(supCompanyEntity); // supCompanyService.modifyCompany(supCompanyEntity);
} else if (supCertEntity.getType() == ConstantStatus.CERT_MANUFACTURER) { // } else if (supCertEntity.getType() == ConstantStatus.CERT_MANUFACTURER) {
SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supCertEntity.getManufacturerIdFk()); // SupManufacturerEntity supManufacturerEntity = supManufacturerService.findManufacturer(supCertEntity.getManufacturerIdFk());
supManufacturerEntity.setAuditStatus(ConstantStatus.AUDIT_UN); // supManufacturerEntity.setAuditStatus(ConstantStatus.AUDIT_UN);
supManufacturerEntity.setUpdateTime(new Date()); // supManufacturerEntity.setUpdateTime(new Date());
supManufacturerService.modifyCompany(supManufacturerEntity); // supManufacturerService.modifyCompany(supManufacturerEntity);
} else if (supCertEntity.getType() == ConstantStatus.CERT_PRODUCT) { // } else if (supCertEntity.getType() == ConstantStatus.CERT_PRODUCT) {
SupProductResponse supProductResponse = supProductService.findByProductId(supCertEntity.getProductIdFk()); // SupProductResponse supProductResponse = supProductService.findByProductId(supCertEntity.getProductIdFk());
SupProductEntity supProductEntity = new SupProductEntity(); // SupProductEntity supProductEntity = new SupProductEntity();
supProductEntity.setId(supProductResponse.getId()); // supProductEntity.setId(supProductResponse.getId());
supProductEntity.setUpdateTime(new Date()); // supProductEntity.setUpdateTime(new Date());
supProductEntity.setAuditStatus(ConstantStatus.AUDIT_UN); // supProductEntity.setAuditStatus(ConstantStatus.AUDIT_UN);
supProductService.modifyRegistration(supProductEntity); // supProductService.modifyRegistration(supProductEntity);
} // }
//
//
return ResultVOUtils.success("成功"); // return ResultVOUtils.success("成功");
} // }

@ -0,0 +1,20 @@
package com.glxp.api.req.inout;
import lombok.Data;
@Data
public class InspectionPDFTemplateRequest {
private String queryId;
private String id;
private int type;
private int module;
private String orderId;
private Long customerId;
private Integer moduleId;
private String modelKey;
private Integer labelId;
}
Loading…
Cancel
Save