浏览代码

修改企业认证接口

LiFei 6 年之前
父节点
当前提交
7ae04ebf3b

+ 10 - 3
happy-boot-module-hppay/src/main/java/org/jeecg/modules/company/service/impl/CompanyAuthenticationServiceImpl.java

@@ -69,6 +69,9 @@ public class CompanyAuthenticationServiceImpl extends ServiceImpl<CompanyAuthent
         String userToken = request.getParameter("user_token");
         //验证用户合法性
         if (TokenUtil.validateToken(userId, userToken)) {
+            CompanyAuthentication companyAuthentication = new CompanyAuthentication();
+            companyAuthentication.setUserId(Integer.parseInt(userId));
+            List<CompanyAuthentication> list = companyAuthenticationMapper.getEnterpriseList(companyAuthentication);
             String enterpriseName = request.getParameter("enterpriseName");//企业全称
             String expiryDate = request.getParameter("expiryDate"); //过期时间(长期:用2100-01-01)
             if (StringUtils.isBlank(expiryDate)) {
@@ -76,8 +79,6 @@ public class CompanyAuthenticationServiceImpl extends ServiceImpl<CompanyAuthent
             }
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
             String isHumanResource = request.getParameter("isHumanResource"); //是否人力资源公司
-            CompanyAuthentication companyAuthentication = new CompanyAuthentication();
-            companyAuthentication.setUserId(Integer.parseInt(userId));
             companyAuthentication.setEnterpriseName(enterpriseName);
             companyAuthentication.setIsHumanResource(Integer.parseInt(isHumanResource));
             companyAuthentication.setAuthenticationStatus(1);
@@ -104,7 +105,13 @@ public class CompanyAuthenticationServiceImpl extends ServiceImpl<CompanyAuthent
             companyAuthentication.setCreateTime(new Date());
             companyAuthentication.setUpdateTime(new Date());
             companyAuthentication.setDelFlag("0");
-            companyAuthenticationMapper.saveCompanyInfo(companyAuthentication);
+            if(list.size()>0){
+                companyAuthentication.setId(list.get(0).getId());
+                updateById(companyAuthentication);
+                companyAuthentication=getById(companyAuthentication.getId());
+            }else {
+                companyAuthenticationMapper.saveCompanyInfo(companyAuthentication);
+            }
             returnMap.put("companyAuthentication", companyAuthentication);
         } else {
             returnMap.put("success", "1004");