Merge remote-tracking branch 'origin/master'

master
wj 2 years ago
commit 1996f5a762

@ -10,6 +10,7 @@ import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.dao.auth.AuthAdminDao;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.auth.CustomerInfoEntity;
import com.glxp.api.entity.auth.UserRegisterEntity;
@ -327,6 +328,9 @@ public class RegisterController {
return ResultVOUtils.success("密码修改成功");
}
@Resource
AuthAdminDao authAdminDao;
@AuthRuleAnnotation("")
@PostMapping("salewarehouse/register/check")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@ -383,18 +387,20 @@ public class RegisterController {
}
//创建新用户
AuthAdmin authAdmin = new AuthAdmin();
authAdmin.setId(generateUserId());
authAdmin.setCustomerId(customerId + "");
authAdmin.setPassWord(userRegisterEntity.getPassword());
authAdmin.setCreateTime(DateUtil.parseDate(userRegisterEntity.getCheckTime()));
authAdmin.setUserName(userRegisterEntity.getUserName()); //用手机号当用户名,通过手机号登录
authAdmin.setEmployeeName(userRegisterEntity.getNickName());
authAdmin.setCustomerId(userRegisterEntity.getCompanyId());
//默认给部门、仓库
//默认给部门、仓库 默认给随机用户ID避免数据同步时出错覆盖
authAdmin.setLocDeptCode("1000");
authAdmin.setLocInvCode("1000000");
authAdmin.setUserFlag(1);
authAdmin.setLastModifyTime(new Date());
authAdminService.insertAuthAdmin(authAdmin);
authAdminDao.insert(authAdmin);
// authAdminService.insertAuthAdmin(authAdmin);
authAdmin = authAdminService.findByUserName(authAdmin.getUserName());
//分配角色
@ -477,9 +483,6 @@ public class RegisterController {
}
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}

@ -84,6 +84,63 @@ public class SupCertController {
}
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());
boolean b = supCertService.insertCompanyCert(supCertEntity);
}
return ResultVOUtils.success("成功");
}
@AuthRuleAnnotation("")
@PostMapping("/sup/info/selectAllCert")
@Log(title = "资质证书", businessType = BusinessType.INSERT)
@ -100,28 +157,31 @@ public class SupCertController {
if (postSelCertRequest.getCertType() == null) {
return ResultVOUtils.error(500, "参数错误!");
}
if (postSelCertRequest.getManufacturerIdFk() == null) {
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);
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;
}
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());
boolean b = supCertService.insertCompanyCert(supCertEntity);
}
return ResultVOUtils.success("成功");
}
}else{
if(postSelCertRequest.getProductIdFk()==null) {
public String checkCert(PostSelCertRequest postSelCertRequest,String customerId){
String errMsg = "";
ArrayList<String> list = new ArrayList<>();
int i = postSelCertRequest.getSupCertSetEntities().size();
@ -130,31 +190,15 @@ public class SupCertController {
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);
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 ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
}
}
}
}else{
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.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());
@ -162,28 +206,18 @@ public class SupCertController {
for (String s : list) {
errMsg = errMsg + "," + s;
}
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
}
return errMsg;
}
}else{
if(i == 0 && list.size()>0){
for (String s : list) {
errMsg = errMsg + "," + s;
}
return errMsg;
}
}
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());
boolean b = supCertService.insertCompanyCert(supCertEntity);
}
return ResultVOUtils.success("成功");
return errMsg;
}

Loading…
Cancel
Save