Commit b18656a5 by qwmqiuwenmin

fix

parent 48e9a03a
......@@ -31,4 +31,6 @@ public interface StaffApiService {
public void syscGicClerk(String fieldListString);
public StaffDTO selectByUserId(String userId);
}
......@@ -112,11 +112,24 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
//调微信的修改接口
String wxDepartmentId = "";
if(StringUtils.isBlank(wxDepartmentId)) {
hr.setErrorCode(0);
hr.setMessage("微信修改部门失败");
return hr;
TabHaobanDepartment tab = departmentService.selectById(department.getDepartmentId());
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(tab.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(tab.getWxEnterpriseId(),1);
if(enterpriseDTO != null) {
if(application != null) {
com.gic.wechat.api.dto.qywx.DepartmentDTO dto = new com.gic.wechat.api.dto.qywx.DepartmentDTO();
dto.setCorpid(enterpriseDTO.getCorpid());
dto.setName(department.getDepartmentName());
dto.setOrder(department.getSort());
TabHaobanDepartment parent = departmentService.selectById(department.getParentDepartmentId());
dto.setParentid(Integer.valueOf(parent.getWxDepartmentId()));
JSONResponse jp = qywxDepartmentApiService.updateDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto);
if(jp.getErrorCode() != 1) {
hr.setErrorCode(0);
hr.setMessage("微信修改部门失败");
return hr;
}
}
}
departmentService.edit(department);
......@@ -127,13 +140,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
public HaobanResponse del(String departmentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
//调微信的新增接口
String wxDepartmentId = "";
if(StringUtils.isBlank(wxDepartmentId)) {
hr.setErrorCode(0);
hr.setMessage("微信删除部门失败");
return hr;
}
List<TabHaobanDepartment> list = departmentService.listByParentId(departmentId);
if(!list.isEmpty()) {
hr.setErrorCode(0);
......@@ -147,6 +154,20 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
hr.setMessage("存在成员,删除部门失败");
return hr;
}
//调微信的新增接口
TabHaobanDepartment department = departmentService.selectById(departmentId);
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(department.getWxEnterpriseId(),1);
if(enterpriseDTO != null) {
if(application != null) {
JSONResponse jp = qywxDepartmentApiService.deleteDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), Integer.parseInt(department.getWxDepartmentId()));
if(jp.getErrorCode() != 1) {
hr.setErrorCode(0);
hr.setMessage("微信删除部门失败");
return hr;
}
}
}
departmentService.del(departmentId);
return hr;
......
......@@ -220,4 +220,9 @@ public class StaffApiServiceImpl implements StaffApiService {
}
@Override
public StaffDTO selectByUserId(String userId) {
return EntityUtil.changeEntityByJSON(StaffDTO.class, staffService.selectByUserId(userId));
}
}
......@@ -63,6 +63,11 @@
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-wechat-api</artifactId>
<version>${gic-wechat-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId>
<version>${gic-commons}</version>
<exclusions>
......
......@@ -9,11 +9,14 @@ import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
@RestController
public class LoginController extends WebBaseController{
......@@ -22,8 +25,18 @@ public class LoginController extends WebBaseController{
@Autowired
StaffApiService staffApiService;
@Autowired
private QywxCorpApiService qywxCorpApiService;
public static final String siteId = "ww7d6566614055cf27";
public static final String redirectUri = "https://www.gicdev.com/haoban-manage3-web/login";
@RequestMapping("login")
public HaobanResponse login() {
public HaobanResponse login(String code) {
String userId = qywxCorpApiService.getUserInfoSimple(siteId,code);
StaffDTO loginStaff = staffApiService.selectByUserId(userId);
LoginVO loginVO = new LoginVO();
StaffDTO staff = staffApiService.selectById("1");
logger.info("【好办登录】staff={}",JSON.toJSONString(staff));
......@@ -36,12 +49,13 @@ public class LoginController extends WebBaseController{
@RequestMapping("get-login-qrcode")
public HaobanResponse getLoginQrcode(){
return resultResponse(HaoBanErrCode.ERR_1,"");
String url = qywxCorpApiService.getGrantAuthorizationUrl(siteId, redirectUri);
return resultResponse(HaoBanErrCode.ERR_1,url);
}
//运维登录
@RequestMapping("yw-login")
public HaobanResponse login(String wxEnterpriseId) {
public HaobanResponse ywLogin(String wxEnterpriseId) {
//TODO 获取超级管理员账号接口
StaffDTO staff = new StaffDTO();
......
package com.gic.haoban.manage.web.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.dict.api.dto.NationCodeDTO;
import com.gic.dict.api.service.ManagerDictService;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
@RequestMapping("/nationcode")
@RestController
public class NationcodeController extends WebBaseController{
@Autowired
ManagerDictService managerDictService;
private static final String NATION_CODE = "NATION_CODE";
/**
* 获取国际码
* @return
*/
@RequestMapping("/get-nationcode-list")
public HaobanResponse getNationcodeList(){
List<NationCodeDTO> list = managerDictService.getDictList(NATION_CODE);
return resultResponse(HaoBanErrCode.ERR_1, list);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment