Commit 7c6a13b9 by qwmqiuwenmin

部门调整

parent 8248b4d8
...@@ -10,8 +10,10 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,8 +10,10 @@ import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.enterprise.api.dto.GicTreeDTO;
import com.gic.enterprise.api.dto.StoreDTO; 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.StoreGroupService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.Constant; import com.gic.haoban.base.api.common.Constant;
...@@ -34,6 +36,9 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -34,6 +36,9 @@ public class DepartmentContoller extends WebBaseController{
@Autowired @Autowired
private StoreService storeService; private StoreService storeService;
@Autowired
private StoreGroupService storeGroupService;
@RequestMapping("department-list") @RequestMapping("department-list")
public HaobanResponse departmentList(String parentId) { public HaobanResponse departmentList(String parentId) {
List<DepartmentDTO> list = departmentApiService.listByParentId(parentId); List<DepartmentDTO> list = departmentApiService.listByParentId(parentId);
...@@ -183,32 +188,20 @@ public class DepartmentContoller extends WebBaseController{ ...@@ -183,32 +188,20 @@ public class DepartmentContoller extends WebBaseController{
public HaobanResponse unbindDepartmentList(String departmentId,String enterpriseId) { public HaobanResponse unbindDepartmentList(String departmentId,String enterpriseId) {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
list.add(departmentId); list.add(departmentId);
List<com.gic.enterprise.api.dto.DepartmentDTO> departmentList = departmentService.getDeptmentByPids(list); List<GicTreeDTO> departmentList = storeGroupService.listGicTree(enterpriseId,null, departmentId);
List<StoreDTO> storeList = storeService.listStoreByStoreGroupId(departmentId);
List<DepartmentDTO> dtoList = new ArrayList<DepartmentDTO>(); List<DepartmentDTO> dtoList = new ArrayList<DepartmentDTO>();
for (com.gic.enterprise.api.dto.DepartmentDTO departmentDTO : departmentList) { for (GicTreeDTO departmentDTO : departmentList) {
DepartmentDTO dto = departmentApiService.selectByRelatedId(departmentDTO.getDepartId()); DepartmentDTO dto = departmentApiService.selectByRelatedId(departmentDTO.getId());
if(dto == null) { if(dto == null) {
DepartmentDTO unBindDTO = new DepartmentDTO(); DepartmentDTO unBindDTO = new DepartmentDTO();
unBindDTO.setRelatedId(departmentDTO.getDepartId()); unBindDTO.setRelatedId(departmentDTO.getId());
unBindDTO.setIsStore(0); unBindDTO.setIsStore(departmentDTO.getType());
unBindDTO.setDepartmentName(departmentDTO.getDepartName()); unBindDTO.setDepartmentName(departmentDTO.getName());
dtoList.add(unBindDTO); dtoList.add(unBindDTO);
} }
} }
for (StoreDTO storeDTO : storeList) {
DepartmentDTO dto = departmentApiService.selectByRelatedId(storeDTO.getStoreId());
if(dto == null) {
DepartmentDTO unBindDTO = new DepartmentDTO();
unBindDTO.setRelatedId(storeDTO.getStoreId());
unBindDTO.setIsStore(0);
unBindDTO.setDepartmentName(storeDTO.getStoreName());
dtoList.add(unBindDTO);
}
}
return resultResponse(HaoBanErrCode.ERR_1,dtoList); return resultResponse(HaoBanErrCode.ERR_1,dtoList);
} }
......
...@@ -28,4 +28,5 @@ ...@@ -28,4 +28,5 @@
<dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/> <dubbo:reference interface="com.gic.enterprise.api.service.StoreService" id="storeService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="departmentService"/> <dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="departmentService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.DepartmentApiService" id="departmentApiService"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.DepartmentApiService" id="departmentApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.StoreGroupService" id="storeGroupService"/>
</beans> </beans>
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