员工部门修改

master
LegnaYet 6 years ago
parent 3f672eefa6
commit 5bf4716cb1

@ -2,11 +2,9 @@ package com.kiisoo.ic.config;
import com.google.common.collect.Maps;
import lombok.val;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.chanjar.weixin.cp.constant.WxCpConsts;
import me.chanjar.weixin.cp.message.WxCpMessageRouter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@ -24,7 +22,6 @@ import java.util.stream.Collectors;
public class WxCpConfiguration {
private WxCpProperties properties;
private static Map<Integer, WxCpMessageRouter> routers = Maps.newHashMap();
private static Map<Integer, WxCpService> cpServices = Maps.newHashMap();
@Autowired
@ -43,6 +40,8 @@ public class WxCpConfiguration {
configStorage.setCorpId(this.properties.getCorpId());
configStorage.setAgentId(a.getAgentId());
configStorage.setCorpSecret(a.getSecret());
configStorage.setToken(a.getToken());
configStorage.setAesKey(a.getAesKey());
val service = new WxCpServiceImpl();
service.setWxCpConfigStorage(configStorage);
return service;

@ -1,13 +1,13 @@
package com.kiisoo.ic.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.customer.entity.OpVipAttr;
import org.springframework.stereotype.Repository;
/**
* vip
*/
@Repository
public interface OpVipAttrDOMapper extends BaseMapper<OpVipAttr> {
}
//package com.kiisoo.ic.customer.mapper;
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.kiisoo.ic.customer.entity.OpVipAttr;
//import org.springframework.stereotype.Repository;
//
///**
// * 客户vip
// */
//@Repository
//public interface OpVipAttrDOMapper extends BaseMapper<OpVipAttr> {
//
//}

@ -1,8 +1,8 @@
package com.kiisoo.ic.department.controller;
import com.kiisoo.ic.common.BaseController;
import com.kiisoo.ic.employee.entity.EmployeeDO;
import com.kiisoo.ic.employee.service.EmployeeService;
import com.kiisoo.ic.department.entity.DepartmentDO;
import com.kiisoo.ic.department.service.DepartmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -13,26 +13,26 @@ import org.springframework.web.bind.annotation.RequestMethod;
import java.util.Map;
/**
* @Description: controller
* @Description: controller
* @Auther: yechenhao
* @Date: 2020/4/7 0002 10:06
* @Version: v1
*/
@Controller
@RequestMapping("/user")
@RequestMapping("/department")
@Slf4j
public class DepartmentConreoller extends BaseController {
@Autowired
private EmployeeService employeeService;
private DepartmentService departmentService;
@RequestMapping(value = "add",method = RequestMethod.POST)
public Map<String,Object> addUser(@RequestBody EmployeeDO employee){
public Map<String,Object> addDepartment(@RequestBody DepartmentDO departmentDO){
try {
Boolean hasAdd = employeeService.addUser(employee);
Boolean hasAdd = departmentService.addDepartment(departmentDO);
return data(hasAdd);
}catch (Exception e){
log.error("添加用户失败",e);
log.error("添加部门失败",e);
return fail();
}
}

@ -1,10 +1,9 @@
package com.kiisoo.ic.department.entity;
import lombok.Data;
import me.chanjar.weixin.cp.bean.Gender;
/**
* @Description:
* @Description:
* @Auther: yechenhao
* @Date: 2020/4/7 0002 10:06
* @Version: v1
@ -12,10 +11,19 @@ import me.chanjar.weixin.cp.bean.Gender;
@Data
public class DepartmentDO {
/**
* idid
* idid
*/
private Long id;
/**
*
*/
private String name;
/**
* id32
*/
private Long parentId;
/**
* order[0, 2^32)
*/
private Long order;
}

@ -1,6 +1,6 @@
package com.kiisoo.ic.department.service;
import com.kiisoo.ic.employee.entity.EmployeeDO;
import com.kiisoo.ic.department.entity.DepartmentDO;
import com.kiisoo.ic.wx.service.QWMailListManageService;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
@ -8,25 +8,23 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @Description: service
* @Description: service
* @Auther: yechenhao
* @Date: 2020/4/7 0002 10:06
* @Version: v1
*/
@Service
public class EmployeeService {
public class DepartmentService {
@Autowired
private QWMailListManageService qwMailListManageService;
@Transactional(rollbackFor = Exception.class)
public Boolean addUser(EmployeeDO employee) throws WxErrorException {
//数据库创建用户
//数据库创建登录account
public Boolean addDepartment(DepartmentDO departmentDO) throws WxErrorException {
//数据库创建部门需要返回部门id
//成功则添加用户到企业微信
qwMailListManageService.addUser(employee);
qwMailListManageService.addDepartment(departmentDO);
return true;
}

@ -33,7 +33,7 @@ public class QWMailListManageService {
*
*/
public void addUser(EmployeeDO employeeDO) throws WxErrorException {
wxCpService = WxCpConfiguration.getCpService(applicationid);
wxCpService = WxCpConfiguration.getCpService(1);
WxCpUserService userService = wxCpService.getUserService();
WxCpUser wxCpUser = new WxCpUser();
BeanUtils.copyProperties(employeeDO,wxCpUser);

@ -15,17 +15,25 @@ spring:
qywx:
corpid: wwc8b3e81998fe5394
corpsecret: fNF_2L3qe9xw4cv4k1Xo4kqhFdzGa61Y6xb1RojNbmc
applicationid: 1000042
corpsecret: scb9m8DEtSwJpB_ZFXg4J9WE91yH-WNBBQ4Vxv1NYy4
applicationid: 1000037
wechat:
cp:
corpId: wwc8b3e81998fe5394
appConfigs:
- agentId: 1000037
secret: scb9m8DEtSwJpB_ZFXg4J9WE91yH-WNBBQ4Vxv1NYy4
token: mx3hi3yH1LkkHDgvs70u
aesKey: 9Dsf9pubOb2tMWtrueZsxC9jsYKX1Id7tTgeg2hou1w
- agentId: 1000042
secret: fNF_2L3qe9xw4cv4k1Xo4kqhFdzGa61Y6xb1RojNbmc
token: 111
aesKey: 111
- agentId: 1
secret: 9FCD26JgFztDCc7ToTh-c9ETFBgKlgTRDCsrcv-GxBA
token: 111
aesKey: 111
##开发环境
server:

Loading…
Cancel
Save