Commit 86c916c2 by qwmqiuwenmin

地址调整一下

parent ded76ad8
...@@ -30,6 +30,8 @@ public class DepartmentDTO implements Serializable { ...@@ -30,6 +30,8 @@ public class DepartmentDTO implements Serializable {
private Integer level; private Integer level;
private Integer sort; private Integer sort;
private String wxEnterpriseId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -136,6 +138,14 @@ public class DepartmentDTO implements Serializable { ...@@ -136,6 +138,14 @@ public class DepartmentDTO implements Serializable {
public void setSort(Integer sort) { public void setSort(Integer sort) {
this.sort = sort; this.sort = sort;
} }
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
......
...@@ -38,5 +38,11 @@ public interface DepartmentApiService { ...@@ -38,5 +38,11 @@ public interface DepartmentApiService {
* @return * @return
*/ */
DepartmentDTO selectByRelatedId(String departId); DepartmentDTO selectByRelatedId(String departId);
/**
* 放入回收站
* @param departmentId
* @return
*/
HaobanResponse recycle(String departmentId);
} }
...@@ -29,6 +29,8 @@ public class TabHaobanDepartment implements Serializable { ...@@ -29,6 +29,8 @@ public class TabHaobanDepartment implements Serializable {
private Integer level; private Integer level;
private Integer sort; private Integer sort;
private String wxEnterpriseId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -135,6 +137,14 @@ public class TabHaobanDepartment implements Serializable { ...@@ -135,6 +137,14 @@ public class TabHaobanDepartment implements Serializable {
public void setSort(Integer sort) { public void setSort(Integer sort) {
this.sort = sort; this.sort = sort;
} }
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service;
import java.util.List; import java.util.List;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
...@@ -19,4 +20,6 @@ public interface DepartmentService { ...@@ -19,4 +20,6 @@ public interface DepartmentService {
TabHaobanDepartment selectByRelatedId(String relatedId); TabHaobanDepartment selectByRelatedId(String relatedId);
void recycle(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.Date;
import java.util.List; import java.util.List;
...@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper; import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
...@@ -75,4 +76,14 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -75,4 +76,14 @@ public class DepartmentServiceImpl implements DepartmentService {
return mapper.selectByRelatedId(relatedId); 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);
}
} }
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
...@@ -3,5 +3,5 @@ package com.gic.haoban.manage.service.service.impl; ...@@ -3,5 +3,5 @@ package com.gic.haoban.manage.service.service.impl;
/** /**
* Created by tgs on 2020/2/9. * Created by tgs on 2020/2/9.
*/ */
public class TestServiceImpl { public class TestApiServiceImpl {
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.impl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -107,4 +107,12 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -107,4 +107,12 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
return EntityUtil.changeEntityByJSON(DepartmentDTO.class, tab); return EntityUtil.changeEntityByJSON(DepartmentDTO.class, tab);
} }
@Override
public HaobanResponse recycle(String departmentId) {
HaobanResponse hr = new HaobanResponse();
hr.setErrorCode(1);
departmentService.recycle(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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
...@@ -3,5 +3,5 @@ package com.gic.haoban.manage.service.service.out.impl; ...@@ -3,5 +3,5 @@ package com.gic.haoban.manage.service.service.out.impl;
/** /**
* Created by tgs on 2020/2/9. * Created by tgs on 2020/2/9.
*/ */
public class TestApiServiceImpl { public class TestServiceImpl {
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="wx_department_id" property="wxDepartmentId" jdbcType="VARCHAR" /> <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="sort" property="sort" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" /> <result column="level" property="level" jdbcType="INTEGER" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
department_id, department_name, parent_department_id, related_id, chain_id, is_store, 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> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select select
...@@ -34,11 +35,11 @@ ...@@ -34,11 +35,11 @@
insert into tab_haoban_department (department_id, department_name, parent_department_id, insert into tab_haoban_department (department_id, department_name, parent_department_id,
related_id, chain_id, is_store, related_id, chain_id, is_store,
status_flag, recycle_flag, create_time, 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}, values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR},
#{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER}, #{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level}) #{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level},#{wxEnterpriseId})
</insert> </insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" > <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" >
insert into tab_haoban_department insert into tab_haoban_department
...@@ -158,6 +159,9 @@ ...@@ -158,6 +159,9 @@
<if test="wxDepartmentId != null" > <if test="wxDepartmentId != null" >
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR}, wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
</if> </if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="sort != null" > <if test="sort != null" >
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
</if> </if>
...@@ -180,7 +184,9 @@ ...@@ -180,7 +184,9 @@
level = #{level,jdbcType=INTEGER}, level = #{level,jdbcType=INTEGER},
recycle_flag = #{recycleFlag,jdbcType=INTEGER}, recycle_flag = #{recycleFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}, 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} where department_id = #{departmentId,jdbcType=VARCHAR}
</update> </update>
......
...@@ -13,12 +13,14 @@ import com.gic.enterprise.api.dto.StoreDTO; ...@@ -13,12 +13,14 @@ import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.DepartmentService; import com.gic.enterprise.api.service.DepartmentService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.Constant; 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.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.DepartmentAddQO; import com.gic.haoban.manage.web.qo.DepartmentAddQO;
import com.gic.haoban.manage.web.qo.DepartmentEditQO; import com.gic.haoban.manage.web.qo.DepartmentEditQO;
import com.gic.haoban.manage.web.vo.LoginVO;
@RestController @RestController
public class DepartmentContoller extends WebBaseController{ public class DepartmentContoller extends WebBaseController{
...@@ -50,6 +52,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -50,6 +52,7 @@ public class DepartmentContoller extends WebBaseController{
DepartmentDTO department = new DepartmentDTO(); DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId); department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentName); department.setDepartmentName(departmentName);
department.setWxEnterpriseId(dto.getWxDepartmentId());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0); department.setIsStore(0);
departmentApiService.add(department); departmentApiService.add(department);
...@@ -88,8 +91,13 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -88,8 +91,13 @@ public class DepartmentContoller extends WebBaseController{
if(dto == null || dto.getStatusFlag() == 0) { if(dto == null || dto.getStatusFlag() == 0) {
return resultResponse(HaoBanErrCode.ERR_10003); 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) { if(hr.getErrorCode() == 0) {
return resultResponse(HaoBanErrCode.ERR_0, hr.getMessage()); return resultResponse(HaoBanErrCode.ERR_0, hr.getMessage());
} }
...@@ -112,6 +120,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -112,6 +120,7 @@ public class DepartmentContoller extends WebBaseController{
} }
DepartmentDTO department = new DepartmentDTO(); DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId); department.setParentDepartmentId(parentId);
department.setWxDepartmentId(dto.getWxDepartmentId());
department.setDepartmentName(departmentAddQO.getDepartmentName()); department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0); department.setIsStore(0);
...@@ -152,7 +161,15 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -152,7 +161,15 @@ public class DepartmentContoller extends WebBaseController{
if(StringUtils.isNotBlank(delDepartmentIds)) { if(StringUtils.isNotBlank(delDepartmentIds)) {
String[] delIds = delDepartmentIds.split(","); String[] delIds = delDepartmentIds.split(",");
for (String string : delIds) { 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 +210,18 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -193,6 +210,18 @@ public class DepartmentContoller extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1,dtoList); return resultResponse(HaoBanErrCode.ERR_1,dtoList);
} }
@RequestMapping("department-recycle-list")
public HaobanResponse departmentRecycleList(String keyWrod,String storeFlag) {
LoginVO login = (LoginVO) AuthRequestUtil.getAppLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
return resultResponse(HaoBanErrCode.ERR_1);
}
private void handler(String sonDepartment, String parentId) { private void handler(String sonDepartment, String parentId) {
if(StringUtils.isNotBlank(sonDepartment)) { if(StringUtils.isNotBlank(sonDepartment)) {
...@@ -212,6 +241,7 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -212,6 +241,7 @@ public class DepartmentContoller extends WebBaseController{
if(StringUtils.isBlank(departmentId)) { if(StringUtils.isBlank(departmentId)) {
DepartmentDTO department = new DepartmentDTO(); DepartmentDTO department = new DepartmentDTO();
department.setParentDepartmentId(parentId); department.setParentDepartmentId(parentId);
department.setWxEnterpriseId(dto.getWxEnterpriseId());
department.setDepartmentName(departmentAddQO.getDepartmentName()); department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId()); department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setIsStore(0); department.setIsStore(0);
......
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