|
@@ -1,6 +1,5 @@
|
|
|
package com.gubersail.admin.corp.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -16,7 +15,6 @@ import com.gubersail.dealer.admin.api.corps.entity.*;
|
|
|
import com.gubersail.dealer.admin.api.corps.vo.CorpsDescVO;
|
|
|
import com.gubersail.dealer.admin.api.excel.CorpsDescImportExcel;
|
|
|
import com.gubersail.dealer.admin.api.goods.entity.PjBrandDesc;
|
|
|
-import com.gubersail.dealer.admin.api.zcrm.customer.entity.ViewCustomerSel;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
@@ -33,7 +31,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -144,7 +141,9 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
corpsDesc.setSalesmanId(AuthUtil.getUserId());
|
|
|
}
|
|
|
}
|
|
|
- corpsDesc.setSalesCompanyId(Long.parseLong(AuthUtil.getDeptId()));
|
|
|
+ if (AuthUtil.getUserRole().contains("dealer")) {
|
|
|
+ corpsDesc.setSrcDistributorId(AuthUtil.getUserId());
|
|
|
+ }
|
|
|
IPage<CorpsDescVO> page1 = page.setRecords(baseMapper.selectCorpsDescPage(page, corpsDesc));
|
|
|
return page1;
|
|
|
|
|
@@ -187,7 +186,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
corpsDesc.setCreateUser(userId);
|
|
|
corpsDesc.setSalesCompanyId(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
corpsDesc.setSalesCompanyName(sysClient.getDept(Long.valueOf(AuthUtil.getDeptId())).getData().getFullName());
|
|
|
- corpsDesc.setEnableOrNot(1);
|
|
|
+ corpsDesc.setEnableOrNot(0);
|
|
|
//查询当前登录人信息
|
|
|
R<User> userR = userClient.userInfoById(AuthUtil.getUserId());
|
|
|
if (!userR.isSuccess() || ObjectUtils.isNull(userR.getData())) {
|
|
@@ -282,7 +281,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
.apply("find_in_set(cname,'" + brandName + "')"));
|
|
|
R<String> r = sysClient.getRoleIds(AuthUtil.getTenantId(), "客户");
|
|
|
List<String> cname = data.stream().map(CorpsDescImportExcel::getCname).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- if (cname.isEmpty()){
|
|
|
+ if (cname.isEmpty()) {
|
|
|
throw new RuntimeException("客户名称不能为空");
|
|
|
}
|
|
|
LambdaQueryWrapper<PjCorpsDesc> queryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -332,13 +331,13 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
}
|
|
|
}
|
|
|
//名称相等视为重复数据
|
|
|
- PjCorpsDesc selectOne = selectList.stream().filter(i-> i.getCname().equals(corpsDesc.getCname()))
|
|
|
+ PjCorpsDesc selectOne = selectList.stream().filter(i -> i.getCname().equals(corpsDesc.getCname()))
|
|
|
.findFirst().orElse(null);
|
|
|
if (selectOne == null) {
|
|
|
corpsDesc.setCreateTime(new Date());
|
|
|
corpsDesc.setCreateUser(AuthUtil.getUserId());
|
|
|
corpsDesc.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
- corpsDesc.setCheckStatus("通过");
|
|
|
+ corpsDesc.setCheckStatus("审核通过");
|
|
|
baseMapper.insert(corpsDesc);
|
|
|
PjCorpsTypeDesc middle = new PjCorpsTypeDesc();
|
|
|
middle.setCorpId(corpsDesc.getId());
|
|
@@ -478,273 +477,37 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public R saveCorpsDescApp(CorpsDescVO corpsDescVO) {
|
|
|
+ public R submitApply(Long id) {
|
|
|
PjCorpsDesc corpsDesc = new PjCorpsDesc();
|
|
|
- BeanUtil.copyProperties(corpsDescVO, corpsDesc);
|
|
|
- Long userId = SecureUtil.getUserId();
|
|
|
- Long deptId = Long.valueOf(AuthUtil.getDeptId());
|
|
|
- Date date = new Date();
|
|
|
-
|
|
|
- if (ObjectUtils.isNotNull(corpsDesc.getBrandId())) {
|
|
|
- List<PjBrandDesc> pjBrandDescList = brandDescService.list(new LambdaQueryWrapper<PjBrandDesc>()
|
|
|
- .eq(PjBrandDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjBrandDesc::getIsDeleted, 0)
|
|
|
- .eq(PjBrandDesc::getType, "PP")
|
|
|
- .eq(PjBrandDesc::getEnableOrNot, 1)
|
|
|
- .apply("find_in_set(id,'" + corpsDesc.getBrandId() + "')"));
|
|
|
- if (!pjBrandDescList.isEmpty()) {
|
|
|
- corpsDesc.setBrandName(pjBrandDescList.stream().map(PjBrandDesc::getCname).collect(Collectors.joining(",")));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- R<Dept> resDept = sysClient.getDept(Long.parseLong(AuthUtil.getDeptId()));
|
|
|
- if (!resDept.isSuccess() || ObjectUtils.isNull(resDept.getData())) {
|
|
|
- throw new RuntimeException("未找到小程序id");
|
|
|
- }
|
|
|
- String deptName = resDept.getData().getFullName();
|
|
|
- //保存客户信息
|
|
|
- corpsDesc.setCorpType("KH");
|
|
|
- if (StringUtils.isBlank(corpsDesc.getCname())) {
|
|
|
- return R.data(200, "error", "客户名称不能为空");
|
|
|
- }
|
|
|
- User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
|
|
|
- if (ObjectUtils.isNull(user)) {
|
|
|
- //用户不存在,注册用户
|
|
|
- User saveUser = new User();
|
|
|
- saveUser.setAppletsId(resDept.getData().getAppletsId());
|
|
|
- saveUser.setTenantId(AuthUtil.getTenantId());
|
|
|
- saveUser.setAccount(corpsDesc.getTel());
|
|
|
- saveUser.setName(corpsDesc.getTel());
|
|
|
- saveUser.setRealName(corpsDesc.getTel());
|
|
|
- saveUser.setUserType(4);
|
|
|
- saveUser.setPhone(corpsDesc.getTel());
|
|
|
- saveUser.setDeptId(AuthUtil.getDeptId());
|
|
|
- //获取注册用户类型
|
|
|
- R<String> r = sysClient.getRoleIds(AuthUtil.getTenantId(), "客户");
|
|
|
- if (r.isSuccess() && ObjectUtils.isNotNull(r.getData())) {
|
|
|
- saveUser.setRoleId(r.getData());
|
|
|
- } else {
|
|
|
- saveUser.setRoleId("");
|
|
|
- }
|
|
|
- saveUser.setPassword("123456");
|
|
|
- R<Boolean> result = userClient.saveUser(saveUser);
|
|
|
- if (!result.isSuccess()) {
|
|
|
- throw new RuntimeException(result.getMsg());
|
|
|
- }
|
|
|
- R<UserInfo> resu = userClient.userInfo(AuthUtil.getTenantId(), corpsDesc.getTel(), UserEnum.WECHAT.getName());
|
|
|
- if (resu.isSuccess()) {
|
|
|
- user = resu.getData().getUser();
|
|
|
- } else {
|
|
|
- throw new RuntimeException("创建用户失败");
|
|
|
- }
|
|
|
- }
|
|
|
- List<PjCorpsDesc> pjCorpsDesc = baseMapper.selectList(new LambdaQueryWrapper<PjCorpsDesc>()
|
|
|
- .eq(PjCorpsDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsDesc::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsDesc::getCname, corpsDesc.getCname()));
|
|
|
- List<PjCorpsDesc> corpsDescTel = baseMapper.selectList(new LambdaQueryWrapper<PjCorpsDesc>()
|
|
|
- .eq(PjCorpsDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsDesc::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsDesc::getTel, corpsDesc.getTel()));
|
|
|
- if (null == corpsDesc.getId()) {
|
|
|
- if (!pjCorpsDesc.isEmpty()) {
|
|
|
- throw new RuntimeException("客户" + corpsDesc.getCname() + "已存在,请勿重复添加!");
|
|
|
- }
|
|
|
- if (!corpsDescTel.isEmpty()) {
|
|
|
- throw new RuntimeException("客户" + corpsDesc.getTel() + "已存在,请勿重复添加!");
|
|
|
- }
|
|
|
- corpsDesc.setTenantId(SecureUtil.getTenantId());
|
|
|
- corpsDesc.setCreateDept(Long.valueOf(SecureUtil.getDeptId()));
|
|
|
- corpsDesc.setCreateTime(date);
|
|
|
- corpsDesc.setCreateUser(userId);
|
|
|
- corpsDesc.setPriceSystem("售价1");
|
|
|
- corpsDesc.setSalesCompanyId(deptId);
|
|
|
- corpsDesc.setSalesCompanyName(deptName);
|
|
|
- baseMapper.insert(corpsDesc);
|
|
|
- Long pId = corpsDesc.getId();
|
|
|
- String tenantId = corpsDesc.getTenantId();
|
|
|
-
|
|
|
- //保存客户联系人信息
|
|
|
- PjCorpsAttn corpsAttn = new PjCorpsAttn();
|
|
|
- if (ObjectUtils.isNotNull(user)) {
|
|
|
- long count = corpsAttnService.count(new LambdaQueryWrapper<PjCorpsAttn>()
|
|
|
- .eq(PjCorpsAttn::getUserId, user.getId())
|
|
|
- .eq(PjCorpsAttn::getTel, corpsDesc.getTel())
|
|
|
- .eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAttn::getIsDeleted, 0));
|
|
|
- if (count > 0) {
|
|
|
- throw new RuntimeException("手机号已存在,提交失败");
|
|
|
- }
|
|
|
- corpsAttn.setUserId(user.getId());
|
|
|
- }
|
|
|
- List<PjCorpsAttn> corpsAttnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>()
|
|
|
- .eq(PjCorpsAttn::getTel, corpsDesc.getTel())
|
|
|
- .eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAttn::getIsDeleted, 0));
|
|
|
- if (!corpsAttnList.isEmpty()) {
|
|
|
- PjCorpsDesc pjCorpsDesc1 = baseMapper.selectById(corpsAttnList.get(0).getPid());
|
|
|
- if (pjCorpsDesc1 != null) {
|
|
|
- throw new RuntimeException("该手机号:" + corpsDesc.getTel() + "已经在客户:" + pjCorpsDesc1.getCname() + "注册,请修改客户名称");
|
|
|
- } else {
|
|
|
- throw new RuntimeException("该手机号未查到客户信息");
|
|
|
- }
|
|
|
- }
|
|
|
- corpsAttn.setCname(corpsDescVO.getAttn());
|
|
|
- corpsAttn.setTel(corpsDesc.getTel());
|
|
|
- corpsAttn.setTenantId(AuthUtil.getTenantId());
|
|
|
- corpsAttn.setPid(corpsDesc.getId());
|
|
|
- corpsAttn.setCreateTime(new Date());
|
|
|
- corpsAttn.setTenantId(AuthUtil.getTenantId());
|
|
|
- corpsAttn.setCreateUser(AuthUtil.getUserId());
|
|
|
- corpsAttn.setSalesCompanyId(deptId);
|
|
|
- corpsAttn.setSalesCompanyName(deptName);
|
|
|
- corpsAttnService.save(corpsAttn);
|
|
|
-
|
|
|
- //保存客户地址信息
|
|
|
- PjCorpsAddr corpsAddr = new PjCorpsAddr();
|
|
|
- corpsAddr.setContacts(corpsDescVO.getAttn());
|
|
|
- corpsAddr.setTel(corpsDesc.getTel());
|
|
|
- corpsAddr.setBelongtoarea(corpsDescVO.getAddr());
|
|
|
- corpsAddr.setDetailedAddress(corpsDescVO.getDetails());
|
|
|
- corpsAddr.setTenantId(AuthUtil.getTenantId());
|
|
|
- corpsAddr.setPid(corpsDesc.getId());
|
|
|
- corpsAddr.setCreateTime(new Date());
|
|
|
- corpsAddr.setTenantId(AuthUtil.getTenantId());
|
|
|
- corpsAddr.setCreateUser(AuthUtil.getUserId());
|
|
|
- corpsAddr.setDefaultAddres("1");
|
|
|
- corpsAddrService.save(corpsAddr);
|
|
|
- //保存客户与类别对应关系
|
|
|
- this.saveOrUpdateTypeDesc(corpsDescVO, userId, pId, date, tenantId);
|
|
|
- } else {
|
|
|
- List<Long> ids = pjCorpsDesc.stream().map(PjCorpsDesc::getId).distinct().collect(Collectors.toList());
|
|
|
- if (!pjCorpsDesc.isEmpty() && !ids.contains(corpsDesc.getId())) {
|
|
|
- throw new RuntimeException("客户" + corpsDesc.getCname() + "已存在,请勿重复添加!");
|
|
|
- }
|
|
|
- List<Long> idList = corpsDescTel.stream().map(PjCorpsDesc::getId).distinct().collect(Collectors.toList());
|
|
|
- if (!corpsDescTel.isEmpty() && !idList.contains(corpsDesc.getId())) {
|
|
|
- throw new RuntimeException("客户" + corpsDesc.getTel() + "已存在,请勿重复添加!");
|
|
|
- }
|
|
|
- corpsDesc.setUpdateTime(new Date());
|
|
|
- corpsDesc.setUpdateUser(AuthUtil.getUserId());
|
|
|
- baseMapper.updateById(corpsDesc);
|
|
|
- List<PjCorpsAttn> corpsAttnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>()
|
|
|
- .eq(PjCorpsAttn::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAttn::getTel, corpsDesc.getTel()));
|
|
|
- PjCorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAttn::getPid, corpsDesc.getId())
|
|
|
- .eq(PjCorpsAttn::getTel, corpsDesc.getTel()));
|
|
|
- if (ObjectUtils.isNotNull(corpsAttn)) {
|
|
|
- List<Long> idLists = corpsAttnList.stream().map(PjCorpsAttn::getId).distinct().collect(Collectors.toList());
|
|
|
- if (!corpsAttnList.isEmpty() && !idLists.contains(corpsAttn.getId())) {
|
|
|
- throw new RuntimeException("客户" + corpsDesc.getTel() + "已存在,请勿重复添加!");
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotNull(user)) {
|
|
|
- corpsAttn.setUserId(user.getId());
|
|
|
- }
|
|
|
- corpsAttn.setCname(corpsDescVO.getAttn());
|
|
|
- corpsAttn.setTel(corpsDesc.getTel());
|
|
|
- corpsAttn.setSalesCompanyId(deptId);
|
|
|
- corpsAttn.setSalesCompanyName(deptName);
|
|
|
- corpsAttnService.updateById(corpsAttn);
|
|
|
- } else {
|
|
|
- if (!corpsAttnList.isEmpty()) {
|
|
|
- throw new RuntimeException("客户" + corpsDesc.getTel() + "已存在,请勿重复添加!");
|
|
|
- }
|
|
|
- //保存客户联系人信息
|
|
|
- PjCorpsAttn corpsAttn1 = new PjCorpsAttn();
|
|
|
- if (ObjectUtils.isNotNull(user)) {
|
|
|
- corpsAttn1.setUserId(user.getId());
|
|
|
- }
|
|
|
- corpsAttn1.setCname(corpsDescVO.getAttn());
|
|
|
- corpsAttn1.setTel(corpsDesc.getTel());
|
|
|
- corpsAttn1.setTenantId(AuthUtil.getTenantId());
|
|
|
- corpsAttn1.setPid(corpsDesc.getId());
|
|
|
- corpsAttn1.setCreateTime(new Date());
|
|
|
- corpsAttn1.setCreateUser(AuthUtil.getUserId());
|
|
|
- corpsAttn1.setSalesCompanyId(deptId);
|
|
|
- corpsAttn1.setSalesCompanyName(deptName);
|
|
|
- corpsAttnService.save(corpsAttn1);
|
|
|
- }
|
|
|
-
|
|
|
- PjCorpsAddr corpsAddr = corpsAddrService.getOne(new LambdaQueryWrapper<PjCorpsAddr>().eq(PjCorpsAddr::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsAddr::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAddr::getPid, corpsDesc.getId())
|
|
|
- .eq(PjCorpsAddr::getTel, corpsDesc.getTel()));
|
|
|
- if (ObjectUtils.isNotNull(corpsAddr)) {
|
|
|
- corpsAddr.setContacts(corpsDescVO.getAttn());
|
|
|
- corpsAddr.setTel(corpsDesc.getTel());
|
|
|
- corpsAddr.setBelongtoarea(corpsDescVO.getAddr());
|
|
|
- corpsAddr.setDetailedAddress(corpsDescVO.getDetails());
|
|
|
- corpsAddr.setSalesCompanyId(deptId);
|
|
|
- corpsAddr.setSalesCompanyName(deptName);
|
|
|
- corpsAddrService.updateById(corpsAddr);
|
|
|
- } else {
|
|
|
- //保存客户地址信息
|
|
|
- PjCorpsAddr corpsAddr1 = new PjCorpsAddr();
|
|
|
- corpsAddr1.setContacts(corpsDescVO.getAttn());
|
|
|
- corpsAddr1.setTel(corpsDesc.getTel());
|
|
|
- corpsAddr1.setBelongtoarea(corpsDescVO.getAddr());
|
|
|
- corpsAddr1.setDetailedAddress(corpsDescVO.getDetails());
|
|
|
- corpsAddr1.setTenantId(AuthUtil.getTenantId());
|
|
|
- corpsAddr1.setPid(corpsDesc.getId());
|
|
|
- corpsAddr1.setCreateTime(new Date());
|
|
|
- corpsAddr1.setTenantId(AuthUtil.getTenantId());
|
|
|
- corpsAddr1.setCreateUser(AuthUtil.getUserId());
|
|
|
- corpsAddr1.setSalesCompanyId(deptId);
|
|
|
- corpsAddr1.setSalesCompanyName(deptName);
|
|
|
- corpsAddr1.setDefaultAddres("0");
|
|
|
- corpsAddrService.save(corpsAddr1);
|
|
|
- }
|
|
|
- }
|
|
|
- //保存客户与类别对应关系
|
|
|
- this.saveOrUpdateTypeDesc(corpsDescVO, userId, corpsDesc.getId(), date, AuthUtil.getTenantId());
|
|
|
+ corpsDesc.setId(id);
|
|
|
+ corpsDesc.setUpdateTime(new Date());
|
|
|
+ corpsDesc.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ corpsDesc.setCheckStatus("提交");
|
|
|
+ baseMapper.updateById(corpsDesc);
|
|
|
return R.data(corpsDesc);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R appDetailsV1(Long id) {
|
|
|
- CorpsDescVO corpsDescVO = new CorpsDescVO();
|
|
|
+ public R review(Long id, String type) {
|
|
|
PjCorpsDesc corpsDesc = baseMapper.selectById(id);
|
|
|
- BeanUtil.copyProperties(corpsDesc, corpsDescVO);
|
|
|
- if (ObjectUtils.isNotNull(corpsDesc)) {
|
|
|
- PjCorpsAddr corpsAddr = corpsAddrService.getOne(new LambdaQueryWrapper<PjCorpsAddr>().eq(PjCorpsAddr::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsAddr::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAddr::getPid, corpsDesc.getId())
|
|
|
- .eq(PjCorpsAddr::getDefaultAddres, "1"));
|
|
|
- if (ObjectUtils.isNotNull(corpsAddr)) {
|
|
|
- corpsDescVO.setAddr(corpsAddr.getBelongtoarea());
|
|
|
- corpsDescVO.setDetails(corpsAddr.getDetailedAddress());
|
|
|
- }
|
|
|
- PjCorpsAttn pjCorpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ corpsDesc.setUpdateTime(new Date());
|
|
|
+ corpsDesc.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ corpsDesc.setCheckStatus("审核通过");
|
|
|
+ List<PjCorpsAttn> corpsAttnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>()
|
|
|
+ .eq(PjCorpsAttn::getPid, id)
|
|
|
+ .eq(PjCorpsAttn::getIsDeleted, 0)
|
|
|
.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAttn::getPid, corpsDesc.getId())
|
|
|
- .eq(PjCorpsAttn::getTel, corpsDesc.getTel()));
|
|
|
- if (ObjectUtils.isNotNull(pjCorpsAttn)) {
|
|
|
- corpsDescVO.setAttn(pjCorpsAttn.getCname());
|
|
|
- corpsDesc.setTel(pjCorpsAttn.getTel());
|
|
|
- }
|
|
|
- List<PjCorpsAttn> attnList = corpsAttnService.list(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAttn::getPid, corpsDesc.getId()));
|
|
|
- corpsDescVO.setNumber(new BigDecimal(attnList.size()));
|
|
|
- //获取客户类别
|
|
|
- List<String> longs = corpsTypeDescService.selectTypeId(corpsDesc.getId());
|
|
|
- corpsDescVO.setCorpsTypeId(String.join(",", longs));
|
|
|
- StringBuilder corpsTypeName = new StringBuilder();
|
|
|
- if (ObjectUtils.isNotNull(longs)) {
|
|
|
- for (String item : longs) {
|
|
|
- String name = corpsTypeService.getById(Long.parseLong(item)) == null ? "" : corpsTypeService.getById(Long.parseLong(item)).getCname();
|
|
|
- corpsTypeName.append(name).append(",");
|
|
|
- }
|
|
|
- String corpsName = corpsTypeName.substring(0, corpsTypeName.length() - 1);
|
|
|
- corpsDescVO.setCorpsTypeName(corpsName);
|
|
|
- } else {
|
|
|
- corpsDescVO.setCorpsTypeName("");
|
|
|
+ .and(i -> i.isNull(PjCorpsAttn::getUserId).or().eq(PjCorpsAttn::getUserId, 0)));
|
|
|
+ if (!corpsAttnList.isEmpty()){
|
|
|
+ corpsAttnService.createUserBatch(corpsAttnList);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ corpsDesc.setUpdateTime(new Date());
|
|
|
+ corpsDesc.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ corpsDesc.setCheckStatus("审核驳回");
|
|
|
}
|
|
|
+ baseMapper.updateById(corpsDesc);
|
|
|
return R.data(corpsDesc);
|
|
|
}
|
|
|
|
|
@@ -866,7 +629,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
return;
|
|
|
}
|
|
|
List<String> list = Arrays.asList(corpsDesc.getCorpsTypeId().split(","));
|
|
|
- corpsTypeDescService.remove(new QueryWrapper<PjCorpsTypeDesc>().eq("corp_id", corpsDesc.getId()));
|
|
|
+ corpsTypeDescService.remove(new QueryWrapper<PjCorpsTypeDesc>().eq("corp_id", pId));
|
|
|
List<PjCorpsTypeDesc> typeDescList = corpsTypeDescService.list(new QueryWrapper<PjCorpsTypeDesc>().eq("corp_id", pId)
|
|
|
.in("corp_type_id", list));
|
|
|
List<PjCorpsTypeDesc> typeDescListNew = new ArrayList<>();
|
|
@@ -874,13 +637,13 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
PjCorpsTypeDesc typeDesc = typeDescList.stream().filter(e -> item.equals(e.getCorpTypeId() + "")).findFirst().orElse(null);
|
|
|
if (typeDesc != null) {
|
|
|
typeDesc.setCorpTypeId(Long.valueOf(item));
|
|
|
- typeDesc.setCorpId(corpsDesc.getId());
|
|
|
+ typeDesc.setCorpId(pId);
|
|
|
typeDesc.setUpdateTime(date);
|
|
|
typeDesc.setUpdateUser(userId);
|
|
|
typeDescListNew.add(typeDesc);
|
|
|
} else {
|
|
|
PjCorpsTypeDesc corpsTypeDesc = new PjCorpsTypeDesc();
|
|
|
- corpsTypeDesc.setCorpId(corpsDesc.getId());
|
|
|
+ corpsTypeDesc.setCorpId(pId);
|
|
|
corpsTypeDesc.setCorpTypeId(Long.valueOf(item));
|
|
|
corpsTypeDesc.setCreateUser(userId);
|
|
|
corpsTypeDesc.setCreateTime(date);
|