|
|
@@ -9,9 +9,8 @@ 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.DeptTypeEnum;
|
|
|
import com.sckw.core.model.enums.EntTypeEnum;
|
|
|
-import com.sckw.core.model.enums.UserSystemTypeEnum;
|
|
|
+import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
@@ -21,13 +20,11 @@ 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.response.HttpResult;
|
|
|
+import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
|
import com.sckw.system.dao.*;
|
|
|
import com.sckw.system.model.*;
|
|
|
-import com.sckw.system.model.pojo.FindMenuTreePojo;
|
|
|
import com.sckw.system.model.vo.req.*;
|
|
|
import com.sckw.system.model.vo.res.CertificateResVo;
|
|
|
-import com.sckw.system.model.vo.res.IdResVo;
|
|
|
-import com.sckw.system.model.vo.res.KwsMenuResVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -56,24 +53,14 @@ public class KwsEnterpriseService {
|
|
|
@Autowired
|
|
|
private KwsEntDeptDao kwsEntDeptDao;
|
|
|
|
|
|
- @Autowired
|
|
|
- private KwsDeptService kwsDeptService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private KwsRoleService kwsRoleService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private KwsUserService kwsUserService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private KwsMenuService kwsMenuService;
|
|
|
-
|
|
|
/**
|
|
|
- * 添加新纪录
|
|
|
- *
|
|
|
- * @param params
|
|
|
- * @return
|
|
|
- * @throws Exception
|
|
|
+ * @param params 入库
|
|
|
+ * @desc: 单表入库
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/6/19
|
|
|
*/
|
|
|
public void add(KwsEnterprise params) {
|
|
|
if (kwsEnterpriseDao.insert(params) <= 0) {
|
|
|
@@ -83,17 +70,35 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
/**
|
|
|
* 删除记录-根据主键
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- * @throws Exception
|
|
|
+ * @param ids 主键
|
|
|
+ * @desc: 批量删除
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/6/19
|
|
|
*/
|
|
|
- public HttpResult deleteByKey(String ids) throws Exception {
|
|
|
- return null;
|
|
|
+ public void deleteByKey(String ids) throws Exception {
|
|
|
+ String[] idArr = ids.split(",");
|
|
|
+ List<Long> list = new ArrayList<>();
|
|
|
+ for (String id : idArr) {
|
|
|
+ list.add(Long.valueOf(id));
|
|
|
+ }
|
|
|
+ List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectByKeys(list);
|
|
|
+ if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
|
+ throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (KwsEnterprise kwsEnterprise : kwsEnterprises) {
|
|
|
+ kwsEnterprise.setDelFlag(Global.YES);
|
|
|
+ if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
|
|
|
+ throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 更新记录,有的是更新有的是新增,两种情况
|
|
|
+ * @param reqVo 更新记录入参
|
|
|
+ * @desc: 更新记录,有的是更新有的是新增,两种情况
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/6/19
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void update(KwsEnterpriseReqVo reqVo) throws Exception {
|
|
|
@@ -106,7 +111,7 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
|
|
|
|
/*2、更新企业类型*/
|
|
|
- List<KwsEntType> kwsEntTypes = null;
|
|
|
+ List<KwsEntType> kwsEntTypes = kwsEntTypeDao.findListByEntId(entId);
|
|
|
List<String> typeReqList = new ArrayList<>();
|
|
|
String entTypes = reqVo.getEntTypes();
|
|
|
if (StringUtils.isNotBlank(entTypes)) {
|
|
|
@@ -187,11 +192,11 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 根据主键查询
|
|
|
- *
|
|
|
- * @param key
|
|
|
- * @return
|
|
|
- * @throws Exception
|
|
|
+ * @param key 企业id
|
|
|
+ * @return KwsEnterprise
|
|
|
+ * @desc: 根据主键查询
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/6/9
|
|
|
*/
|
|
|
public KwsEnterprise selectByKey(Long key) {
|
|
|
return checkKwsEnterpriseById(key);
|
|
|
@@ -199,7 +204,7 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * @param reqVo
|
|
|
+ * @param reqVo 分页入参
|
|
|
* @return HttpResult
|
|
|
* @desc: 分页查询
|
|
|
* @author: czh
|
|
|
@@ -208,11 +213,11 @@ public class KwsEnterpriseService {
|
|
|
public PageResult findPage(EntFindPageReqVo reqVo) throws Exception {
|
|
|
PageHelper.startPage(reqVo.getPageNum(), reqVo.getPageSize());
|
|
|
List<KwsEnterprise> list = findList(reqVo);
|
|
|
- return PageHelperUtil.getPageResult(new PageInfo(list));
|
|
|
+ return PageHelperUtil.getPageResult(new PageInfo<>(list));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param reqVo
|
|
|
+ * @param reqVo 企业实体类入参
|
|
|
* @return List<KwsEnterprise>
|
|
|
* @desc: 全量查询
|
|
|
* @author: czh
|
|
|
@@ -223,15 +228,12 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 参数校验
|
|
|
- *
|
|
|
- * @param params
|
|
|
- * @return
|
|
|
- * @throws Exception
|
|
|
+ * @param params 参数校验
|
|
|
+ * @desc: 参数校验
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/6/19
|
|
|
*/
|
|
|
- public HttpResult paramsCheck(KwsEnterprise params) {
|
|
|
-
|
|
|
- return null;
|
|
|
+ public void paramsCheck(KwsEnterprise params) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -240,9 +242,12 @@ public class KwsEnterpriseService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void register(EntRegisterReqVo reqVo) {
|
|
|
/*1、存企业信息表*/
|
|
|
- KwsEnterprise kwsEnterprise = new KwsEnterprise();
|
|
|
- long entId = reqVo.getEntId();
|
|
|
- kwsEnterprise.setId(entId);
|
|
|
+ KwsEnterprise kwsEnterprise = kwsEnterpriseDao.selectByKey(reqVo.getEntId());
|
|
|
+ if (Objects.isNull(kwsEnterprise)) {
|
|
|
+ throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
+ }
|
|
|
+
|
|
|
+ Long entId = kwsEnterprise.getId();
|
|
|
Date date = new Date();
|
|
|
Long userId = LoginUserHolder.getUserId();
|
|
|
BeanUtils.copyProperties(reqVo, kwsEnterprise);
|
|
|
@@ -303,7 +308,6 @@ public class KwsEnterpriseService {
|
|
|
kwsEntDept.setEntId(entId);
|
|
|
kwsEntDept.setEntPid(reqVo.getEntPid());
|
|
|
kwsEntDept.setId(new IdWorker(1L).nextId());
|
|
|
- kwsEntDept.setRemark("");
|
|
|
if (kwsEntDeptDao.insert(kwsEntDept) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
|
|
|
}
|
|
|
@@ -366,7 +370,7 @@ public class KwsEnterpriseService {
|
|
|
List<CertificateResVo> list = new ArrayList<>();
|
|
|
kwsEntCertificates.forEach(item -> {
|
|
|
CertificateResVo certificateResVo = new CertificateResVo();
|
|
|
- certificateResVo.setTypeName(EntTypeEnum.getName(item.getType()).getName());
|
|
|
+ certificateResVo.setTypeName(Objects.requireNonNull(EntTypeEnum.getName(item.getType())).getName());
|
|
|
BeanUtils.copyProperties(item, certificateResVo);
|
|
|
list.add(certificateResVo);
|
|
|
});
|
|
|
@@ -384,4 +388,23 @@ public class KwsEnterpriseService {
|
|
|
return kwsEnterpriseDao.findByUserId(userId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param reqVo 新增企业入驻入参
|
|
|
+ * @desc: 新增企业入驻
|
|
|
+ * @author: czh
|
|
|
+ * @date: 2023/6/19
|
|
|
+ */
|
|
|
+ public void addEntSettle(EntRegisterReqVo reqVo) {
|
|
|
+ /*1、存用户信息*/
|
|
|
+ RegisterReqDto registerReqDto = new RegisterReqDto();
|
|
|
+ registerReqDto.setEntName(reqVo.getFirmName());
|
|
|
+ registerReqDto.setName(reqVo.getContacts());
|
|
|
+ registerReqDto.setTelephone(reqVo.getTelephone());
|
|
|
+ registerReqDto.setIsMain(Global.YES);
|
|
|
+ registerReqDto.setSystemType(SystemTypeEnum.COMPANY.getCode());
|
|
|
+ kwsUserService.register(registerReqDto);
|
|
|
+
|
|
|
+ /*2、认证*/
|
|
|
+ register(reqVo);
|
|
|
+ }
|
|
|
}
|