Commit 468c0aff by 陶光胜

Merge branch 'developer' of http://115.159.76.241/haoban3.0/haoban-manage3.0 into developer

parents 36c4e672 3b82a729
......@@ -38,6 +38,8 @@ public class DepartmentDTO implements Serializable {
private String wxEnterpriseId;
private Integer type;
private String storeCode;
private static final long serialVersionUID = 1L;
......@@ -176,6 +178,14 @@ public class DepartmentDTO implements Serializable {
public void setType(Integer type) {
this.type = type;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
......
......@@ -82,7 +82,7 @@ public interface DepartmentApiService {
* 回收站恢复
* @param departmentId
*/
HaobanResponse repairRecycle(String departmentId);
HaobanResponse repairRecycle(String departmentId,String parentId);
/**
* 获取根节点
* @param wxEnterpriseId
......
......@@ -26,7 +26,7 @@ public interface DepartmentService {
Page<TabHaobanDepartment> pageDepartmentByParams(String wxEnterpriseId, String keyword, Integer storeFlag, Integer recycleFlag);
void repairRecycle(String departmentId);
void repairRecycle(TabHaobanDepartment tab);
DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId);
......
......@@ -112,8 +112,7 @@ public class DepartmentServiceImpl implements DepartmentService {
}
@Override
public void repairRecycle(String departmentId) {
TabHaobanDepartment tab = mapper.selectByPrimaryKey(departmentId);
public void repairRecycle(TabHaobanDepartment tab) {
if(tab != null) {
tab.setRecycleFlag(0);
tab.setUpdateTime(new Date());
......
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -36,6 +37,9 @@ public class StaffServiceImpl implements StaffService {
tab.setUpdateTime(now);
tab.setStaffId(StringUtil.randomUUID());
tab.setStatusFlag(1);
if(StringUtils.isBlank(tab.getStaffId())){
tab.setWxUserId(tab.getStaffId());
}
mapper.insertSelective(tab);
return tab.getStaffId();
}
......
......@@ -89,7 +89,6 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(department.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(department.getWxEnterpriseId(),1);
logger.info("【部门新增】enterpriseDTO = {}",JSON.toJSONString(enterpriseDTO));
logger.info("【部门新增】application = {}",JSON.toJSONString(application));
if(enterpriseDTO != null) {
if(application != null) {
com.gic.wechat.api.dto.qywx.DepartmentDTO dto = new com.gic.wechat.api.dto.qywx.DepartmentDTO();
......@@ -198,6 +197,21 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
public HaobanResponse recycle(String departmentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
//调微信的新增接口
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() != 0) {
hr.setErrorCode(0);
hr.setMessage("微信删除部门失败");
return hr;
}
}
}
departmentService.recycle(departmentId);
return hr;
}
......@@ -210,10 +224,39 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
@Override
public HaobanResponse repairRecycle(String departmentId) {
public HaobanResponse repairRecycle(String departmentId,String parentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(0);
departmentService.repairRecycle(departmentId);
TabHaobanDepartment tab = departmentService.selectById(departmentId);
//调微信的新增接口
String wxDepartmentId = "";
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(tab.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(tab.getWxEnterpriseId(),1);
logger.info("【部门新增】enterpriseDTO = {}",JSON.toJSONString(enterpriseDTO));
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(tab.getDepartmentName());
dto.setOrder(tab.getSort());
TabHaobanDepartment parent = departmentService.selectById(parentId);
dto.setParentid(Integer.valueOf(parent.getWxDepartmentId()));
logger.info("【部门新增】corpid() = {},siteId={},dto={}",enterpriseDTO.getCorpid(),application.getSiteId(),JSON.toJSONString(dto));
JSONResponse jp = qywxDepartmentApiService.createDepartment(enterpriseDTO.getCorpid(), application.getSiteId(), dto);
logger.info("【部门新增】jp = {}",JSON.toJSONString(jp));
if(jp.getErrorCode() != 0) {
hr.setErrorCode(0);
hr.setMessage("微信新增部门失败");
return hr;
}
wxDepartmentId = jp.getResult().toString();
tab.setWxDepartmentId(wxDepartmentId);
tab.setParentDepartmentId(parentId);
logger.info("【部门新增】wxDepartmentId = {}",wxDepartmentId);
}
}
departmentService.repairRecycle(tab);
return hr;
}
......
......@@ -245,14 +245,14 @@
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="keyword != null and keyword != ''">
and department_name like CONCAT('%',#{keyWord},'%')
and department_name like CONCAT('%',#{keyword},'%')
</if>
<if test="recycleFlag != null">
and recycle_flag = #{recycleFlag}
</if>
<!-- <if test="departmentId != null and departmentId != ''"> -->
<!-- and department_id = #{departmentId} -->
<!-- </if> -->
<if test="storeFlag != null">
and is_store = #{storeFlag}
</if>
</select>
<select id="listByDepartmentIds" resultMap="BaseResultMap" >
......
package com.gic.haoban.manage.web.auth;
import com.alibaba.fastjson.JSON;
import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -27,12 +29,17 @@ public class AuthRequestUtil {
public static final String REDIS_FAKE_LOGIN_FLAG_PREFIX = "GIC:HAOBAN:HAOBAN_MOBILE_APP:FAKE_LOGIN_TOKEN:";
public static String LOGIN_SESSION_KEY = "HAOBAN:LOGINUSER";
public static Object getSessionUser() {
return getSession().getAttribute(LOGIN_SESSION_KEY);
public static LoginVO getSessionUser() {
String json = (String) getSession().getAttribute(LOGIN_SESSION_KEY);
if (StringUtils.isBlank(json)){
return null;
}
return JSON.parseObject(json, LoginVO.class);
}
public static void setSessionUser(Object obj) {
getSession().setAttribute(LOGIN_SESSION_KEY, obj);
String userJson = JSON.toJSONString(obj);
getSession().setAttribute(LOGIN_SESSION_KEY, userJson);
}
public static void delSessionUser() {
......
......@@ -69,7 +69,7 @@ public class DepartmentContoller extends WebBaseController{
}
List<DepartmentDTO> result = page.getResult();
for (DepartmentDTO departmentDTO : result) {
String chainId = departmentDTO.getChainId();
String chainId = departmentDTO.getChainId() + Constant.ID_SEPARATOR + departmentDTO.getDepartmentId();
List<DepartmentDTO> sonList = departmentApiService.listByChainId(chainId,wxEnterpriseId);
int staffCount = 0;
for (DepartmentDTO departmentDTO2 : sonList) {
......@@ -240,6 +240,9 @@ public class DepartmentContoller extends WebBaseController{
continue;
}
DepartmentDTO department = departmentApiService.selectById(departmentQO.getDepartmentId());
if(department == null){
continue;
}
department.setParentDepartmentId(parentId);
department.setWxEnterpriseId(department.getWxEnterpriseId());
department.setDepartmentName(departmentQO.getDepartmentName());
......@@ -328,8 +331,17 @@ public class DepartmentContoller extends WebBaseController{
String wxEnterpriseId = login.getWxEnterpriseId();
Integer recycleFlag = 1;
Page<DepartmentDTO> page = departmentApiService.pageDepartmentByParams(pageInfo,wxEnterpriseId,keyWord,storeFlag,recycleFlag);
List<DepartmentDTO> list = page.getResult();
for (DepartmentDTO departmentDTO : list) {
if(departmentDTO.getIsStore() != null && departmentDTO.getIsStore() == 1){
StoreDTO store = storeService.getStore(departmentDTO.getRelatedId());
if(store != null){
departmentDTO.setStoreCode(store.getStoreCode());
}
}
}
PageResult<DepartmentDTO> pageVo = new PageResult<>();
pageVo.setList(page.getResult());
pageVo.setList(list);
pageVo.setPageNum(page.getCurrentPage());
pageVo.setPages(page.getPages());
pageVo.setPageSize(page.getPageSize());
......@@ -339,12 +351,12 @@ public class DepartmentContoller extends WebBaseController{
}
@RequestMapping("department-repair")
public HaobanResponse departmentRepair(String departmentId) {
public HaobanResponse departmentRepair(String departmentId,String parentId) {
DepartmentDTO dto = departmentApiService.selectById(departmentId);
if(dto == null || dto.getStatusFlag() == 0) {
return resultResponse(HaoBanErrCode.ERR_10003);
}
departmentApiService.repairRecycle(departmentId);
departmentApiService.repairRecycle(departmentId,parentId);
return resultResponse(HaoBanErrCode.ERR_1);
}
......@@ -376,7 +388,7 @@ public class DepartmentContoller extends WebBaseController{
String departmentId = departmentAddQO.getDepartmentId();
Boolean addFlag = departmentAddQO.getAddFlag();
//在部门下新增部门
if(addFlag == null || addFlag) {
if(addFlag != null && addFlag) {
DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId);
department.setWxEnterpriseId(dto.getWxEnterpriseId());
......@@ -405,10 +417,10 @@ public class DepartmentContoller extends WebBaseController{
continue;
}
department.setParentDepartmentId(parentId);
department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
department.setSort(departmentAddQO.getSort());
HaobanResponse hr = departmentApiService.edit(department);
if(hr.getErrorCode() != 1) {
continue;
......
......@@ -46,6 +46,9 @@ public class HttpLimitInterceptor extends HandlerInterceptorAdapter {
logger.info("post-url:{}", requestURI);
Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
logger.info("post-params:{}", JSONObject.toJSONString(parameterMap));
if (!(o instanceof HandlerMethod)) {
return true;
}
HandlerMethod handler = (HandlerMethod) o;
HttpLimit httpLimit = handler.getMethodAnnotation(HttpLimit.class);
if (httpLimit != null) {
......
......@@ -58,6 +58,9 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
logger.info("post-url:{}", requestURI);
Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
logger.info("post-params:{}", JSONObject.toJSONString(parameterMap));
if (!(o instanceof HandlerMethod)) {
return true;
}
HandlerMethod handler = (HandlerMethod) o;
IgnoreLogin ignoreLogin = handler.getMethodAnnotation(IgnoreLogin.class);
if (null != ignoreLogin) {
......
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