三七 4 روز پیش
والد
کامیت
cdf8310bdf

+ 1 - 1
fs-company/src/main/java/com/fs/company/controller/company/CompanyUserController.java

@@ -261,7 +261,7 @@ public class CompanyUserController extends BaseController
         String encodedStatus = URLEncoder.encode(status, StandardCharsets.UTF_8.toString());
 
         String url="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+user.getCorpId()+"&redirect_uri=" +
-                "http://"+qwCompany.getRealmNameUrl()+"/qwh5/pages/user/index?corpId="+user.getCorpId() +
+                "http://"+qwCompany.getRealmNameUrl()+"/loginqw/pages/companyLogin/index?corpId="+user.getCorpId() +
                 "&response_type=code&scope=snsapi_base&state="+encodedStatus+"&agentid="+qwCompany.getServerAgentId()+"#wechat_redirect";
 
         R andUpload = QRCodeUtils.createAndUpload(url);

+ 0 - 12
fs-qw-api/src/main/java/com/fs/app/service/QwDataCallbackService.java

@@ -111,18 +111,6 @@ public class QwDataCallbackService {
                         delQwUser.setIsDel(2);
                         delQwUser.setStatus(0);
                         qwUserMapper.updateQwUser(delQwUser);
-                        QwExternalContact qwExternalContact = new QwExternalContact();
-                        qwExternalContact.setUserId(fromUserName);
-                        qwExternalContact.setStatus(0);
-                        qwExternalContact.setCorpId(corpId);
-                        List<QwExternalContact> qwExternalContacts = qwExternalContactService.selectQwExternalContactList(qwExternalContact);
-                        for (QwExternalContact externalContact : qwExternalContacts) {
-                            QwExternalContact lz = new QwExternalContact();
-                            lz.setId(externalContact.getId());
-                            lz.setStatus(1);
-                            qwExternalContactMapper.updateQwExternalContact(lz);
-                        }
-
                     }
                     break;
                 case "subscribe":

+ 72 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwUserController.java

@@ -1,8 +1,20 @@
 package com.fs.app.controller;
 
+import com.fs.app.params.LoginBindCompanyParam;
+import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
+import com.fs.common.enums.BusinessType;
 import com.fs.common.exception.CustomException;
+import com.fs.common.exception.base.BaseException;
+import com.fs.common.utils.PatternUtils;
+import com.fs.common.utils.SecurityUtils;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.param.CompanyUserCodeParam;
+import com.fs.company.service.ICompanyPostService;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.course.param.FsCourseListBySidebarParam;
 import com.fs.qw.domain.QwExternalContactInfo;
 import com.fs.qw.domain.QwUser;
@@ -21,6 +33,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
@@ -42,6 +55,19 @@ public class ApisQwUserController extends BaseController {
     @Autowired
     private ISopUserLogsInfoService iSopUserLogsInfoService;
 
+    @Autowired
+    private ICompanyUserService companyUserService;
+
+    @Autowired
+    ICompanyUserService userService;
+
+    @Autowired
+    private ICompanyService companyService;
+
+    @Autowired
+    ICompanyPostService postService;
+
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -116,4 +142,50 @@ public class ApisQwUserController extends BaseController {
         return R.ok().put("data", result);
     }
 
+    /**
+     * 注册或者绑定销售
+     */
+    @PostMapping("/registerCompany")
+    @Log(title = "注册或者绑定销售", businessType = BusinessType.INSERT)
+    public R registerCompany(@RequestBody CompanyUserCodeParam userCodeParam) {
+        return companyUserService.registerCompany(userCodeParam);
+    }
+
+    @PostMapping("/login")
+    @ApiOperation("密码登录")
+    public R login(@Validated @RequestBody LoginBindCompanyParam param) {
+
+        // 密码校验
+        if (!PatternUtils.checkPassword(param.getPassword())) {
+            return R.error("密码格式不正确,需包含字母、数字和特殊字符,长度为 8-20位");
+        }
+
+        try {
+
+            //判断用户基本规则
+            CompanyUser companyUser = userService.selectUserByUserName(param.getAccount());
+            if (companyUser == null) {
+                return R.error("工号不存在");
+            }
+            if (companyUser.getStatus().equals("1")) {
+                return R.error("用户已禁用");
+            }
+            if (!SecurityUtils.matchesPassword(param.getPassword(), companyUser.getPassword())) {
+                return R.error("密码错误");
+            }
+            if (companyUser.getIsAudit() == 0) {
+                return R.error("用户未审核");
+            }
+
+            Company company = companyService.selectCompanyById(companyUser.getCompanyId());
+            if (company == null || company.getStatus() == 0 || company.getIsDel() == 1) {
+                throw new BaseException("此用户所属公司不存在或已停用");
+            }
+
+            return R.ok("验证成功");
+        } catch (Exception e) {
+            return R.error("登录异常:"+e.getMessage());
+        }
+    }
+
 }

+ 70 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/QwUserController.java

@@ -1,9 +1,21 @@
 package com.fs.app.controller;
 
+import com.fs.app.params.LoginBindCompanyParam;
 import com.fs.common.BeanCopyUtils;
+import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
+import com.fs.common.enums.BusinessType;
 import com.fs.common.exception.CustomException;
+import com.fs.common.exception.base.BaseException;
+import com.fs.common.utils.PatternUtils;
+import com.fs.common.utils.SecurityUtils;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.param.CompanyUserCodeParam;
+import com.fs.company.service.ICompanyPostService;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.qw.domain.QwExternalContactInfo;
 import com.fs.qw.domain.QwTagGroup;
 import com.fs.qw.param.ExternalContactDetailsParam;
@@ -27,6 +39,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
@@ -51,6 +64,18 @@ public class QwUserController extends BaseController {
     @Autowired
     private ISopUserLogsInfoService iSopUserLogsInfoService;
 
+    @Autowired
+    private ICompanyUserService companyUserService;
+
+    @Autowired
+    ICompanyUserService userService;
+
+    @Autowired
+    private ICompanyService companyService;
+
+    @Autowired
+    ICompanyPostService postService;
+
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     public R getUserDetails(@ApiParam(value = "外部联系人id", required = true) @RequestParam Long contactId,
@@ -150,5 +175,50 @@ public class QwUserController extends BaseController {
         return R.error();
     }
 
+    /**
+     * 注册或者绑定销售
+     */
+    @PostMapping("/registerCompany")
+    @Log(title = "注册或者绑定销售", businessType = BusinessType.INSERT)
+    public R registerCompany(@RequestBody CompanyUserCodeParam userCodeParam) {
+        return companyUserService.registerCompany(userCodeParam);
+    }
+
+    @PostMapping("/login")
+    @ApiOperation("密码登录")
+    public R login(@Validated @RequestBody LoginBindCompanyParam param) {
+
+        // 密码校验
+        if (!PatternUtils.checkPassword(param.getPassword())) {
+            return R.error("密码格式不正确,需包含字母、数字和特殊字符,长度为 8-20位");
+        }
+
+        try {
+
+            //判断用户基本规则
+            CompanyUser companyUser = userService.selectUserByUserName(param.getAccount());
+            if (companyUser == null) {
+                return R.error("工号不存在");
+            }
+            if (companyUser.getStatus().equals("1")) {
+                return R.error("用户已禁用");
+            }
+            if (!SecurityUtils.matchesPassword(param.getPassword(), companyUser.getPassword())) {
+                return R.error("密码错误");
+            }
+            if (companyUser.getIsAudit() == 0) {
+                return R.error("用户未审核");
+            }
+
+            Company company = companyService.selectCompanyById(companyUser.getCompanyId());
+            if (company == null || company.getStatus() == 0 || company.getIsDel() == 1) {
+                throw new BaseException("此用户所属公司不存在或已停用");
+            }
+
+            return R.ok("验证成功");
+        } catch (Exception e) {
+            return R.error("登录异常:"+e.getMessage());
+        }
+    }
 
 }

+ 16 - 0
fs-qwhook-sop/src/main/java/com/fs/app/params/LoginBindCompanyParam.java

@@ -0,0 +1,16 @@
+package com.fs.app.params;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+
+@Data
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class LoginBindCompanyParam {
+    @NotBlank(message = "请填写帐号")
+    private String account;
+    @NotBlank(message = "请填写密码")
+    private String password;
+}

+ 0 - 33
fs-user-app/src/test/java/com/fs/app/controller/medical/PhysicalExamReportControllerTest.java

@@ -1,33 +0,0 @@
-package com.fs.app.controller.medical;
-
-import com.alibaba.fastjson.JSON;
-import com.fs.FsUserAppApplication;
-import com.fs.medical.param.PhysicalExamReportCompareDto;
-import com.fs.medical.service.PhysicalExamReportService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = FsUserAppApplication.class)
-@RequiredArgsConstructor
-@Slf4j
-public class PhysicalExamReportControllerTest {
-
-    @Autowired
-    private PhysicalExamReportService physicalExamReportService;
-
-    @Test
-    public void compareReport() {
-        PhysicalExamReportCompareDto compareDto = new PhysicalExamReportCompareDto();
-        compareDto.setReport1(24L);
-        compareDto.setReport2(26L);
-        compareDto.setType(1);
-        Object result = physicalExamReportService.compareReport(compareDto);
-        log.info("对比结果: {}", JSON.toJSONString(result));
-    }
-}