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;
@ -250,12 +251,12 @@ public class RegisterController {
if (StrUtil.isNotBlank(company_check) && company_check.equals("1")) {
//新用户注册时根据往来单位字典进行企业名称校验
CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(userRegisterEntity.getCompanyId());
if (customerInfoEntity != null ) {
if (customerInfoEntity != null) {
return ResultVOUtils.error(500, "该企业已被注册!");
}
}
UserRegisterEntity userRegisterEntity2 = userRegisterService.selectByCname(userRegisterEntity.getCompanyName());
if (userRegisterEntity2 !=null ) {
if (userRegisterEntity2 != null) {
return ResultVOUtils.error(500, "该企业已被注册!");
}
@ -275,8 +276,8 @@ public class RegisterController {
}
userRegisterEntity.setUserName(userName);
UserRegisterEntity userRegisterEntity1 = userRegisterService.selectByMobile(userRegisterEntity.getMobile());
if(userRegisterEntity1!=null){
userRegisterService.deleteByMobile(userRegisterEntity.getMobile(),2);
if (userRegisterEntity1 != null) {
userRegisterService.deleteByMobile(userRegisterEntity.getMobile(), 2);
}
boolean b = userRegisterService.insertUserRegister(userRegisterEntity);
if (!b) {
@ -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.setCustomerId(customerId+"");
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());
//分配角色
@ -431,13 +437,13 @@ public class RegisterController {
customerContactEntity.setMobile(userRegisterEntity.getMobile());
customerContactEntity.setTel(userRegisterEntity.getTel());
CustomerContactEntity customerContactEntity1 = customerContactService.selectById(customerId);
if(customerContactEntity1==null){
if (customerContactEntity1 == null) {
customerContactService.insertCustomerContact(customerContactEntity);
}
//生产本企业信息
CompanyEntity companyEntity = new CompanyEntity();
companyEntity.setCustomerId(customerId+"");
companyEntity.setCustomerId(customerId + "");
companyEntity.setArea(userRegisterEntity.getArea());
companyEntity.setAreaCode(userRegisterEntity.getAreaCode());
companyEntity.setDetailAddr(userRegisterEntity.getDetailAddr());
@ -465,21 +471,18 @@ public class RegisterController {
CustomerInfoFilterRequest request = new CustomerInfoFilterRequest();
request.setCompanyName(registerCheckRequest.getCompanyName());
List<CustomerInfoEntity> customerInfoEntities = customerInfoService.filterCustomerInfo(request);
int i=0;
int i = 0;
for (CustomerInfoEntity infoEntity : customerInfoEntities) {
if(registerCheckRequest.getCompanyName().equals(infoEntity.getCompanyName())){
if (registerCheckRequest.getCompanyName().equals(infoEntity.getCompanyName())) {
i++;
}
}
if(i<=0){
if (i <= 0) {
customerInfoService.insertCustomerInfo(customerInfoEntity);
companyService.insertCompany(companyEntity);//TODO !!!!!!!!!!!
}
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,76 +157,11 @@ 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;
}
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
}
}
}
}else{
if(postSelCertRequest.getProductIdFk()==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);
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);
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());
if (supCertEntities.size() != 0 && i == 0) {
for (String s : list) {
errMsg = errMsg + "," + s;
}
return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!");
}
}
}
}
}
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());
@ -187,6 +179,48 @@ public class SupCertController {
}
public String checkCert(PostSelCertRequest postSelCertRequest,String customerId){
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.isEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) {
supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk());
supCertRequest.setType(2);
}
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());
if (supCertEntities.size() != 0 && i == 0) {
for (String s : list) {
errMsg = errMsg + "," + s;
}
return errMsg;
}
}else{
if(i == 0 && list.size()>0){
for (String s : list) {
errMsg = errMsg + "," + s;
}
return errMsg;
}
}
}
return errMsg;
}
@AuthRuleAnnotation("")
@GetMapping("/sale/info/getCompanyCert")
public BaseResponse getCompanyCert(FilterSupCertRequest filterSupCertRequest) {

Loading…
Cancel
Save