|
|
@@ -4,10 +4,7 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
-import com.sckw.core.model.enums.ApprovalEnum;
|
|
|
-import com.sckw.core.model.enums.EntTypeEnum;
|
|
|
-import com.sckw.core.model.enums.EntryTypeEnum;
|
|
|
-import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
+import com.sckw.core.model.enums.*;
|
|
|
import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
@@ -17,6 +14,7 @@ import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.model.EntCertificateInfo;
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
|
import com.sckw.system.api.model.dto.res.RegisterResDto;
|
|
|
import com.sckw.system.dao.*;
|
|
|
@@ -28,6 +26,7 @@ import com.sckw.system.model.pojo.FindManagePojo;
|
|
|
import com.sckw.system.model.pojo.FindPojoParam;
|
|
|
import com.sckw.system.model.vo.req.*;
|
|
|
import com.sckw.system.model.vo.res.CertificateResVo;
|
|
|
+import com.sckw.system.model.vo.res.EntDetailResVo;
|
|
|
import com.sckw.system.model.vo.res.EntFindPageResVo;
|
|
|
import com.sckw.system.model.vo.res.FindListGroupResVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -312,6 +311,8 @@ public class KwsEnterpriseService {
|
|
|
kwsEnterprise.setMemberLevel(0);
|
|
|
kwsEnterprise.setOrgCode("");
|
|
|
kwsEnterprise.setRegTime(date);
|
|
|
+ kwsEnterprise.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ kwsEnterprise.setCreateBy(LoginUserHolder.getUserId());
|
|
|
kwsEnterprise.setApproval(ApprovalEnum.PROCESS.getCode());
|
|
|
if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
@@ -340,7 +341,6 @@ public class KwsEnterpriseService {
|
|
|
List<KwsEntCertificate> kwsEntCertificates = new ArrayList<>();
|
|
|
for (BusinessLicense businessLicense : reqVo.getBusinessLicense()) {
|
|
|
KwsEntCertificate kwsEntCertificate = new KwsEntCertificate();
|
|
|
- //todo 上传证书正反面,将url放到两个入参里
|
|
|
kwsEntCertificate.setEntId(entId);
|
|
|
kwsEntCertificate.setCreateBy(userId);
|
|
|
kwsEntCertificate.setCreateTime(date);
|
|
|
@@ -375,18 +375,16 @@ public class KwsEnterpriseService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void approval(ApprovalReqVo reqVo) throws SystemException {
|
|
|
Integer status = reqVo.getStatus();
|
|
|
- Long entId = null;
|
|
|
- String certificateIds = reqVo.getCertificateIds();
|
|
|
+ Long entId = reqVo.getEntId();
|
|
|
+ List<KwsEntCertificate> kwsEntCertificateList = kwsEntCertificateDao.selectByEntId(entId);
|
|
|
+ if (CollectionUtils.isEmpty(kwsEntCertificateList)) {
|
|
|
+ throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENTCERTIFICATES_NOT_EXISTS);
|
|
|
+ }
|
|
|
List<KwsEntCertificate> kwsEntCertificates = new ArrayList<>();
|
|
|
- for (String id : certificateIds.split(",")) {
|
|
|
- KwsEntCertificate kwsEntCertificate = kwsEntCertificateDao.selectByKey(Long.parseLong(id));
|
|
|
- if (Objects.isNull(kwsEntCertificate)) {
|
|
|
- throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
- }
|
|
|
-
|
|
|
+ for (KwsEntCertificate kwsEntCertificate : kwsEntCertificateList) {
|
|
|
//先把旧的作废
|
|
|
List<KwsEntCertificate> previous = kwsEntCertificateDao.findByEntType(kwsEntCertificate.getEntId(), kwsEntCertificate.getType());
|
|
|
- previous = previous.stream().filter(item -> item.getId() != Long.parseLong(id)).toList();
|
|
|
+ previous = previous.stream().filter(item -> item.getId().compareTo(kwsEntCertificate.getId()) != 0).toList();
|
|
|
if (!CollectionUtils.isEmpty(previous)) {
|
|
|
for (KwsEntCertificate kwsEntCertificate1 : previous) {
|
|
|
kwsEntCertificate1.setDelFlag(Global.YES);
|
|
|
@@ -406,6 +404,7 @@ public class KwsEnterpriseService {
|
|
|
KwsEnterprise kwsEnterprise = checkKwsEnterpriseById(entId);
|
|
|
Integer currentApproval = kwsEnterprise.getApproval();
|
|
|
kwsEnterprise.setApproval(reqVo.getStatus());
|
|
|
+ kwsEnterprise.setRemark(reqVo.getRemark());
|
|
|
if (kwsEnterpriseDao.approval(kwsEnterprise) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
}
|
|
|
@@ -474,7 +473,7 @@ public class KwsEnterpriseService {
|
|
|
List<CertificateResVo> list = new ArrayList<>();
|
|
|
kwsEntCertificates.forEach(item -> {
|
|
|
CertificateResVo certificateResVo = new CertificateResVo();
|
|
|
- certificateResVo.setTypeName(Objects.requireNonNull(EntTypeEnum.getName(item.getType())).getName());
|
|
|
+ certificateResVo.setTypeName(Objects.requireNonNull(CertificateTypeEnum.getName(item.getType())).getName());
|
|
|
BeanUtils.copyProperties(item, certificateResVo);
|
|
|
list.add(certificateResVo);
|
|
|
});
|
|
|
@@ -621,4 +620,19 @@ public class KwsEnterpriseService {
|
|
|
findListGroupResVo.setApprovalName(ApprovalEnum.getName(code).getName());
|
|
|
return findListGroupResVo;
|
|
|
}
|
|
|
+
|
|
|
+ public EntDetailResVo detail(Long id) {
|
|
|
+ KwsEnterprise kwsEnterprise = selectByKey(id);
|
|
|
+ if (Objects.isNull(kwsEnterprise)) {
|
|
|
+ throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ EntDetailResVo entDetailResVo = new EntDetailResVo();
|
|
|
+ BeanUtils.copyProperties(kwsEnterprise, entDetailResVo);
|
|
|
+ List<KwsEntType> listByEntIds = kwsEntTypeDao.findListByEntIds(Collections.singletonList(kwsEnterprise.getId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(listByEntIds)) {
|
|
|
+ entDetailResVo.setEntTypes(String.join(Global.COMMA, listByEntIds.stream().map(KwsEntType::getType).map(String::valueOf).toList()));
|
|
|
+ }
|
|
|
+ return entDetailResVo;
|
|
|
+ }
|
|
|
+
|
|
|
}
|