|
|
@@ -21,7 +21,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
@@ -32,7 +31,6 @@ import org.springblade.los.basic.corps.entity.*;
|
|
|
import org.springblade.los.basic.corps.mapper.CorpsMapper;
|
|
|
import org.springblade.los.basic.corps.service.*;
|
|
|
import org.springblade.los.basic.corps.vo.BCorpsVO;
|
|
|
-import org.springblade.los.business.aea.entity.AeaBills;
|
|
|
import org.springblade.los.excel.BCorpsExcel;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
@@ -92,14 +90,14 @@ public class BCorpsServiceImpl extends ServiceImpl<CorpsMapper, BCorps> implemen
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public R submit(BCorps bCorpss) throws Exception{
|
|
|
- Object object = StringTools.handle(bCorpss,"BCorps");
|
|
|
+ public R submit(BCorps bCorpss) throws Exception {
|
|
|
+ Object object = StringTools.handle(bCorpss, "BCorps");
|
|
|
BCorps bCorps = JSONObject.parseObject(JSONObject.toJSONString(object), BCorps.class);
|
|
|
String deptId = "";
|
|
|
String deptName = "";
|
|
|
String branchId = deptUtils.getDeptPid() + "";
|
|
|
//获取部门ids对应中文名
|
|
|
- if (ObjectUtils.isNotNull(deptUtils.getDeptPid()+"")) {
|
|
|
+ if (ObjectUtils.isNotNull(deptUtils.getDeptPid() + "")) {
|
|
|
deptId = AuthUtil.getDeptId();
|
|
|
R<List<String>> res = sysClient.getDeptNames(AuthUtil.getDeptId());
|
|
|
if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
|
|
|
@@ -161,7 +159,7 @@ public class BCorpsServiceImpl extends ServiceImpl<CorpsMapper, BCorps> implemen
|
|
|
throw new RuntimeException("简称不允许重复");
|
|
|
}
|
|
|
BCorps bCorps1 = baseMapper.selectById(bCorps.getId());
|
|
|
- if (bCorps1 != null){
|
|
|
+ if (bCorps1 != null) {
|
|
|
if (!bCorps1.getCnName().equals(bCorps.getCnName())) {
|
|
|
BCorpsRename item = new BCorpsRename();
|
|
|
item.setPid(bCorps.getId());
|
|
|
@@ -418,14 +416,15 @@ public class BCorpsServiceImpl extends ServiceImpl<CorpsMapper, BCorps> implemen
|
|
|
.eq(BCorps::getUscc, item.getUscc())
|
|
|
.eq(BCorps::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(BCorps::getIsDeleted, 0));
|
|
|
- long cname = baseMapper.selectCount(new LambdaQueryWrapper<BCorps>()
|
|
|
+ /*long cname = baseMapper.selectCount(new LambdaQueryWrapper<BCorps>()
|
|
|
.eq(BCorps::getCnName, item.getCnName())
|
|
|
.eq(BCorps::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(BCorps::getIsDeleted, 0));
|
|
|
long uscc = baseMapper.selectCount(new LambdaQueryWrapper<BCorps>()
|
|
|
.eq(BCorps::getUscc, item.getUscc())
|
|
|
.eq(BCorps::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(BCorps::getIsDeleted, 0));
|
|
|
+ .eq(BCorps::getIsDeleted, 0));*/
|
|
|
+ String corpTypeName = "";
|
|
|
if (corps == null) {
|
|
|
BeanUtil.copy(item, bCorps);
|
|
|
//首字母为空
|
|
|
@@ -434,12 +433,12 @@ public class BCorpsServiceImpl extends ServiceImpl<CorpsMapper, BCorps> implemen
|
|
|
String initials = getSpells(bCorps.getCnName());
|
|
|
bCorps.setInitials(initials.substring(0, 1));
|
|
|
}
|
|
|
- if (cname > 0) {
|
|
|
+ /*if (cname > 0) {
|
|
|
throw new RuntimeException("中文名称" + bCorps.getCnName() + "不允许重复");
|
|
|
}
|
|
|
if (uscc > 0) {
|
|
|
throw new RuntimeException("统一社会信用代码" + bCorps.getUscc() + "不允许重复");
|
|
|
- }
|
|
|
+ }*/
|
|
|
bCorps.setCreateTime(new Date());
|
|
|
bCorps.setCreateUser(AuthUtil.getUserId());
|
|
|
bCorps.setCreateUserName(AuthUtil.getUserName());
|
|
|
@@ -452,12 +451,13 @@ public class BCorpsServiceImpl extends ServiceImpl<CorpsMapper, BCorps> implemen
|
|
|
}
|
|
|
this.saveOrUpdate(bCorps);
|
|
|
} else {
|
|
|
- if (cname > 1) {
|
|
|
+ /*if (cname > 1) {
|
|
|
throw new RuntimeException("中文名称" + bCorps.getCnName() + "不允许重复");
|
|
|
}
|
|
|
if (uscc > 1) {
|
|
|
throw new RuntimeException("统一社会信用代码" + bCorps.getUscc() + "不允许重复");
|
|
|
- }
|
|
|
+ }*/
|
|
|
+ corpTypeName = corps.getCorpTypeName();
|
|
|
bCorps.setUpdateUser(AuthUtil.getUserId());
|
|
|
bCorps.setUpdateTime(new Date());
|
|
|
bCorps.setUpdateUserName(AuthUtil.getUserName());
|
|
|
@@ -476,12 +476,15 @@ public class BCorpsServiceImpl extends ServiceImpl<CorpsMapper, BCorps> implemen
|
|
|
}
|
|
|
//客户类别对应
|
|
|
if (ObjectUtils.isNotNull(item.getCorpTypeName())) {
|
|
|
+ if (ObjectUtils.isNotNull(corpTypeName)) {
|
|
|
+ item.setCorpTypeName(item.getCorpTypeName() + "," + corpTypeName);
|
|
|
+ }
|
|
|
List<BCorpsTypeDefine> bCorpsTypeDefineList = bCorpsTypeDefineService.list(new LambdaQueryWrapper<BCorpsTypeDefine>()
|
|
|
.eq(BCorpsTypeDefine::getIsDeleted, 0)
|
|
|
.eq(BCorpsTypeDefine::getTenantId, AuthUtil.getTenantId())
|
|
|
.apply(ObjectUtils.isNotNull(item.getCorpTypeName()), "find_in_set(cn_name,'" + item.getCorpTypeName() + "')"));
|
|
|
if (!bCorpsTypeDefineList.isEmpty()) {
|
|
|
- bCorps.setCorpTypeName(bCorpsTypeDefineList.stream().map(BCorpsTypeDefine::getCnName).collect(Collectors.joining()));
|
|
|
+ bCorps.setCorpTypeName(bCorpsTypeDefineList.stream().map(BCorpsTypeDefine::getCnName).collect(Collectors.joining(",")));
|
|
|
List<Long> ids = bCorpsTypeDefineList.stream().map(BCorpsTypeDefine::getId).collect(Collectors.toList());
|
|
|
List<BCorpsTypes> bCorpsTypesList = new ArrayList<>();
|
|
|
StringBuilder typeIds = new StringBuilder();
|