Commit 0689ee7a by 陶光胜

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

parents 814e955a edf4ac42
......@@ -30,6 +30,8 @@ public class DepartmentDTO implements Serializable {
private Integer level;
private Integer sort;
private String wxEnterpriseId;
private static final long serialVersionUID = 1L;
......@@ -136,6 +138,14 @@ public class DepartmentDTO implements Serializable {
public void setSort(Integer sort) {
this.sort = sort;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
......
......@@ -2,6 +2,8 @@ package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
......@@ -38,5 +40,28 @@ public interface DepartmentApiService {
* @return
*/
DepartmentDTO selectByRelatedId(String departId);
/**
* 放入回收站
* @param departmentId
* @return
*/
HaobanResponse recycle(String departmentId);
/**
* 根据参数查询
* @param pageInfo
* @param wxEnterpriseId
* @param keyword
* @param storeFlag
* @param recycleFlag
* @return
*/
Page<DepartmentDTO> pageDepartmentByParams(BasePageInfo pageInfo, String wxEnterpriseId, String keyword,
Integer storeFlag, Integer recycleFlag);
/**
* 回收站恢复
* @param departmentId
*/
HaobanResponse repairRecycle(String departmentId);
}
......@@ -5,6 +5,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.github.pagehelper.Page;
public interface DepartmentMapper {
int deleteByPrimaryKey(String departmentId);
......@@ -24,4 +25,7 @@ public interface DepartmentMapper {
int selectMaxSort(@Param("parentDepartmentId")String parentDepartmentId);
TabHaobanDepartment selectByRelatedId(@Param("relatedId")String relatedId);
Page<TabHaobanDepartment> pageDepartmentByParams(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword,
@Param("storeFlag")Integer storeFlag, @Param("recycleFlag")Integer recycleFlag);
}
\ No newline at end of file
......@@ -29,6 +29,8 @@ public class TabHaobanDepartment implements Serializable {
private Integer level;
private Integer sort;
private String wxEnterpriseId;
private static final long serialVersionUID = 1L;
......@@ -135,6 +137,14 @@ public class TabHaobanDepartment implements Serializable {
public void setSort(Integer sort) {
this.sort = sort;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import java.util.List;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.github.pagehelper.Page;
public interface DepartmentService {
......@@ -19,4 +20,10 @@ public interface DepartmentService {
TabHaobanDepartment selectByRelatedId(String relatedId);
void recycle(String departmentId);
Page<TabHaobanDepartment> pageDepartmentByParams(String wxEnterpriseId, String keyword, Integer storeFlag, Integer recycleFlag);
void repairRecycle(String departmentId);
}
package com.gic.haoban.manage.service.service.out.impl;
package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List;
......@@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.github.pagehelper.Page;
@Service
public class DepartmentServiceImpl implements DepartmentService {
......@@ -75,4 +77,31 @@ public class DepartmentServiceImpl implements DepartmentService {
return mapper.selectByRelatedId(relatedId);
}
@Override
public void recycle(String departmentId) {
TabHaobanDepartment tab = mapper.selectByPrimaryKey(departmentId);
if(tab != null) {
tab.setRecycleFlag(1);
tab.setUpdateTime(new Date());
}
mapper.updateByPrimaryKeySelective(tab);
}
@Override
public Page<TabHaobanDepartment> pageDepartmentByParams(String wxEnterpriseId, String keyword, Integer storeFlag, Integer recycleFlag) {
return mapper.pageDepartmentByParams(wxEnterpriseId,keyword,storeFlag,recycleFlag);
}
@Override
public void repairRecycle(String departmentId) {
TabHaobanDepartment tab = mapper.selectByPrimaryKey(departmentId);
if(tab != null) {
tab.setRecycleFlag(0);
tab.setUpdateTime(new Date());
}
mapper.updateByPrimaryKeySelective(tab);
}
}
package com.gic.haoban.manage.service.service.out.impl;
package com.gic.haoban.manage.service.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -3,5 +3,5 @@ package com.gic.haoban.manage.service.service.impl;
/**
* Created by tgs on 2020/2/9.
*/
public class TestServiceImpl {
public class TestApiServiceImpl {
}
package com.gic.haoban.manage.service.service.impl;
package com.gic.haoban.manage.service.service.out.impl;
import java.util.Date;
import java.util.List;
......@@ -7,8 +7,11 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
......@@ -16,6 +19,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.github.pagehelper.PageHelper;
@Service
public class DepartmentApiServiceImpl implements DepartmentApiService {
......@@ -107,4 +111,28 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
return EntityUtil.changeEntityByJSON(DepartmentDTO.class, tab);
}
@Override
public HaobanResponse recycle(String departmentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
departmentService.recycle(departmentId);
return hr;
}
@Override
public Page<DepartmentDTO> pageDepartmentByParams(BasePageInfo pageInfo, String wxEnterpriseId, String keyword,
Integer storeFlag, Integer recycleFlag) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(departmentService.pageDepartmentByParams(wxEnterpriseId,keyword,storeFlag,recycleFlag),DepartmentDTO.class);
}
@Override
public HaobanResponse repairRecycle(String departmentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(0);
departmentService.repairRecycle(departmentId);
return hr;
}
}
package com.gic.haoban.manage.service.service.impl;
package com.gic.haoban.manage.service.service.out.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -3,5 +3,5 @@ package com.gic.haoban.manage.service.service.out.impl;
/**
* Created by tgs on 2020/2/9.
*/
public class TestApiServiceImpl {
public class TestServiceImpl {
}
......@@ -13,12 +13,13 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="wx_department_id" property="wxDepartmentId" jdbcType="VARCHAR" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="sort" property="sort" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
department_id, department_name, parent_department_id, related_id, chain_id, is_store,
status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level
status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level,wx_enterprise_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
......@@ -34,11 +35,11 @@
insert into tab_haoban_department (department_id, department_name, parent_department_id,
related_id, chain_id, is_store,
status_flag, recycle_flag, create_time,
update_time,wx_department_id,sort,level)
update_time,wx_department_id,sort,level,wx_enterprise_id)
values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR},
#{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level})
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level},#{wxEnterpriseId})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" >
insert into tab_haoban_department
......@@ -158,6 +159,9 @@
<if test="wxDepartmentId != null" >
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="sort != null" >
sort = #{sort,jdbcType=INTEGER},
</if>
......@@ -180,7 +184,9 @@
level = #{level,jdbcType=INTEGER},
recycle_flag = #{recycleFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
wx_enterprise_id = #{wxEnterpriseId}
where department_id = #{departmentId,jdbcType=VARCHAR}
</update>
......
......@@ -9,16 +9,20 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.gic.api.base.commons.Page;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.DepartmentService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.common.utils.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.DepartmentAddQO;
import com.gic.haoban.manage.web.qo.DepartmentEditQO;
import com.gic.haoban.manage.web.vo.LoginVO;
@RestController
public class DepartmentContoller extends WebBaseController{
......@@ -50,6 +54,7 @@ public class DepartmentContoller extends WebBaseController{
DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentName);
department.setWxEnterpriseId(dto.getWxDepartmentId());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0);
departmentApiService.add(department);
......@@ -88,8 +93,13 @@ public class DepartmentContoller extends WebBaseController{
if(dto == null || dto.getStatusFlag() == 0) {
return resultResponse(HaoBanErrCode.ERR_10003);
}
HaobanResponse hr;
if(StringUtils.isBlank(dto.getRelatedId())) {
hr = departmentApiService.del(departmentId);
}else {
hr = departmentApiService.recycle(departmentId);
}
HaobanResponse hr = departmentApiService.del(departmentId);
if(hr.getErrorCode() == 0) {
return resultResponse(HaoBanErrCode.ERR_0, hr.getMessage());
}
......@@ -112,6 +122,7 @@ public class DepartmentContoller extends WebBaseController{
}
DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId);
department.setWxDepartmentId(dto.getWxDepartmentId());
department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0);
......@@ -152,7 +163,15 @@ public class DepartmentContoller extends WebBaseController{
if(StringUtils.isNotBlank(delDepartmentIds)) {
String[] delIds = delDepartmentIds.split(",");
for (String string : delIds) {
departmentApiService.del(string);
DepartmentDTO dto = departmentApiService.selectById(string);
if(dto == null || dto.getStatusFlag() == 0) {
continue;
}
if(StringUtils.isBlank(dto.getRelatedId())) {
departmentApiService.del(string);
}else {
departmentApiService.recycle(string);
}
}
}
......@@ -193,6 +212,30 @@ public class DepartmentContoller extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1,dtoList);
}
@RequestMapping("department-recycle-list")
public HaobanResponse departmentRecycleList(String keyword,Integer storeFlag,BasePageInfo pageInfo) {
LoginVO login = (LoginVO) AuthRequestUtil.getAppLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
Integer recycleFlag = 1;
Page<DepartmentDTO> page = departmentApiService.pageDepartmentByParams(pageInfo,wxEnterpriseId,keyword,storeFlag,recycleFlag);
return resultResponse(HaoBanErrCode.ERR_1,page);
}
@RequestMapping("department-repair")
public HaobanResponse departmentRepair(String departmentId) {
DepartmentDTO dto = departmentApiService.selectById(departmentId);
if(dto == null || dto.getStatusFlag() == 0) {
return resultResponse(HaoBanErrCode.ERR_10003);
}
departmentApiService.repairRecycle(departmentId);
return resultResponse(HaoBanErrCode.ERR_1);
}
private void handler(String sonDepartment, String parentId) {
if(StringUtils.isNotBlank(sonDepartment)) {
......@@ -212,6 +255,7 @@ public class DepartmentContoller extends WebBaseController{
if(StringUtils.isBlank(departmentId)) {
DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId);
department.setWxEnterpriseId(dto.getWxEnterpriseId());
department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0);
......
......@@ -30,43 +30,43 @@ import java.util.Map;
@RequestMapping("/test")
public class TestController extends WebBaseController {
@Autowired
private TestService testService;
@RequestMapping("/testList")
@ResponseBody
public HaobanResponse testList(String id, BasePageInfo info) {
HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
Page<TestDTO> testDTOPage = testService.queryPage(info);
return resultResponse(errCode, testDTOPage);
}
@RequestMapping("/imcallback")
@ResponseBody
public JSONObject imcallback(@RequestBody JSONObject msg) {
System.out.println(msg);
System.out.println(msg.toJSONString());
String rest = "{\n" +
" \"ActionStatus\": \"OK\",\n" +
" \"ErrorInfo\": \"\",\n" +
" \"ErrorCode\": 0 // 0 为允许发言\n" +
"}";
return JSONObject.parseObject(rest);
}
@RequestMapping("/testListVo")
@ResponseBody
public HaobanResponse testListVo(TestQo qo, BasePageInfo info) {
HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
String s = CheckContainUtil.checkAttr(qo);
if (s != null) {
System.out.println("缺少参数");
errCode = HaoBanErrCode.ERR_5;
return resultResponse(errCode);
}
Page<TestDTO> testDTOPage = testService.queryPage(info);
List<TestVo> res = EntityUtil.changeEntityListByJSON(TestVo.class, testDTOPage.getResult());
return resultResponse(errCode, res);
}
// @Autowired
// private TestService testService;
//
// @RequestMapping("/testList")
// @ResponseBody
// public HaobanResponse testList(String id, BasePageInfo info) {
// HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
// Page<TestDTO> testDTOPage = testService.queryPage(info);
// return resultResponse(errCode, testDTOPage);
// }
//
// @RequestMapping("/imcallback")
// @ResponseBody
// public JSONObject imcallback(@RequestBody JSONObject msg) {
// System.out.println(msg);
// System.out.println(msg.toJSONString());
// String rest = "{\n" +
// " \"ActionStatus\": \"OK\",\n" +
// " \"ErrorInfo\": \"\",\n" +
// " \"ErrorCode\": 0 // 0 为允许发言\n" +
// "}";
// return JSONObject.parseObject(rest);
// }
//
//
// @RequestMapping("/testListVo")
// @ResponseBody
// public HaobanResponse testListVo(TestQo qo, BasePageInfo info) {
// HaoBanErrCode errCode = HaoBanErrCode.ERR_1;
// String s = CheckContainUtil.checkAttr(qo);
// if (s != null) {
// System.out.println("缺少参数");
// errCode = HaoBanErrCode.ERR_5;
// return resultResponse(errCode);
// }
// Page<TestDTO> testDTOPage = testService.queryPage(info);
// List<TestVo> res = EntityUtil.changeEntityListByJSON(TestVo.class, testDTOPage.getResult());
// return resultResponse(errCode, res);
// }
}
......@@ -4,14 +4,12 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.auth.api.anno.MenuCheck;
import com.gic.haoban.auth.api.dto.UserRightDetailDTO;
import com.gic.haoban.auth.api.enums.RoleCodeEnum;
import com.gic.haoban.auth.api.service.ClerkRightManageService;
import com.gic.haoban.common.utils.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
......@@ -32,8 +30,8 @@ public class WebInterceptor extends HandlerInterceptorAdapter {
private static Logger logger= LoggerFactory.getLogger(WebInterceptor.class);
@Autowired
private ClerkRightManageService clerkRightManageService;
// @Autowired
// private ClerkRightManageService clerkRightManageService;
private void errorResult(HttpServletResponse httpServletResponse, HaoBanErrCode errCode) {
......
......@@ -11,7 +11,7 @@
<context:component-scan base-package="com.gic.haoban" />
<!-- 应用名称 -->
<dubbo:application name="haoban-apps-web"/>
<dubbo:application name="haoban-manage3-web"/>
<dubbo:protocol name="dubbo" port="30009"/>
<!-- 使用zookeeper注册中心暴露服务地址 -->
......
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