Commit c967b1a4 by wubh

包活干V2.2.0-功能修改、欧了接口地址修改

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@29267 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent b45e3f72
......@@ -205,8 +205,8 @@ public class OraOrderController extends BaseController {
*
* @return
*/
@RequestMapping(value = "/deviceStatus", method = RequestMethod.POST)
public OraResultObject deviceStatus(@RequestBody Map<String, String> paramMap) {
@RequestMapping(value = "/checkDevice", method = RequestMethod.POST)
public OraResultObject checkDevice(@RequestBody Map<String, String> paramMap) {
String deviceNoListJson = paramMap.get("deviceNoList");
List<String> deviceNoList = JSONArray.parseArray(deviceNoListJson).toJavaList(String.class);
if (CollectionUtils.isEmpty(deviceNoList)) {
......@@ -217,7 +217,7 @@ public class OraOrderController extends BaseController {
//设备号请求响应数据封装
JSONObject jsonObject = new JSONObject();
for (String deviceNo : deviceNoList) {
OraResultObject object = oraOrderService.getDeviceData(deviceNo);
OraResultObject object = oraOrderService.checkDevice(deviceNo);
if (object.getCode() == ResultCodeEnum.FAIL.getCode()) {
codeEnum = ResultCodeEnum.FAIL;
jsonObject.put(deviceNo, object.getMessage());
......@@ -225,7 +225,7 @@ public class OraOrderController extends BaseController {
}
array.add(jsonObject);
OraResultObject resultObject = new OraResultObject(codeEnum, array);
logger.info("/api/ora/deviceStatus接口处理数据返回结果:{}", resultObject.toString());
logger.info("/api/ora/checkDevice 接口处理数据返回结果:{}", resultObject.toString());
return resultObject;
}
......
package com.glsx.ordercenter.service;
import java.util.List;
import com.glsx.ordercenter.dto.resp.OraResultObject;
import com.glsx.ordercenter.pojo.SysOrder;
import java.util.List;
/**
* 长城欧拉工单处理service
*/
......@@ -32,7 +31,7 @@ public interface OraOrderService {
* @param deviceNo
* @return
*/
OraResultObject getDeviceData(String deviceNo);
OraResultObject checkDevice(String deviceNo);
/**
* 工单取消
......
......@@ -586,7 +586,7 @@ public class OraOrderServiceImpl implements OraOrderService {
}
@Override
public OraResultObject getDeviceData(String deviceNo) {
public OraResultObject checkDevice(String deviceNo) {
//业务参数封装
JSONObject object = new JSONObject();
object.put("equipmentNumber", deviceNo);
......
......@@ -46,6 +46,13 @@ public class OrganizationController extends BaseController {
ResultObject result;
SysUser currentUser = ShiroUtil.getUser();
// 如果当前用户为服务商则指定查找该服务商根组织的组织
if (currentUser.getUserType() == Constants.USER_TYPE_SP && organization.getId() == null) {
this.logger.info("==== /getListByParam id not specified, set to `groupId`.");
organization.setId(currentUser.getGroupId());
}
List<SysOrganization> organizationList = this.organizationService.getListByParam(
organization, currentUser);
result = new ResultObject(ResultCodeEnum.SUCCESS.getCode(),
......@@ -59,6 +66,7 @@ public class OrganizationController extends BaseController {
*
* @param organization 请求体
* @return 结果
* @deprecated V2.2.0 已废弃,使用 {@link #getListByParam(SysOrganization)}
*/
@RequestMapping(value = "/getByParams2", method = {RequestMethod.GET, RequestMethod.POST})
public ResultObject getByParams2(SysOrganization organization) {
......
......@@ -21,6 +21,7 @@ import com.glsx.usercenter.pojo.menu.SysOrganizationExample.Criteria;
import com.glsx.usercenter.pojo.user.SysUser;
import com.glsx.usercenter.pojo.user.SysUserOrg;
import com.glsx.usercenter.service.ISysOrganizationService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -39,7 +40,7 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
@Autowired
private SysOrganizationMapper organizationMapper;
@Autowired
private SysUserOrgMapper sysUserOrgDao;
private SysUserOrgMapper userOrgMapper;
@Override
public long countByExample(SysOrganizationExample example) {
......@@ -108,18 +109,18 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
// 记录用户的组织
if (!isRootNote) {
// 如果不是跟组织 ,则 将该组织数据权限授权给 拥有该节点的父节点权限的运营用户
List<Integer> userIDs = sysUserOrgDao.selectUserIdByOrgId(parentId);
List<Integer> userIDs = userOrgMapper.selectUserIdByOrgId(parentId);
for (Integer id : userIDs) {
SysUserOrg sysUserOrg = new SysUserOrg();
sysUserOrg.setOrgId(orgId);
sysUserOrg.setUserId(id);
sysUserOrgDao.insertSelective(sysUserOrg);
userOrgMapper.insertSelective(sysUserOrg);
}
} else { // 新增根节点,只授权给当前用户
SysUserOrg sysUserOrg = new SysUserOrg();
sysUserOrg.setOrgId(record.getId());
sysUserOrg.setUserId(userId);
sysUserOrgDao.insertSelective(sysUserOrg);
userOrgMapper.insertSelective(sysUserOrg);
}
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
......@@ -173,7 +174,7 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
List<SysOrganization> organizationList;
if (StringUtils.isNotBlank(orgName) && orgId != null && orgStatus != null) {
// 根据三个条件查找
// 根据三个条件查找,先根据父组织id和状态查找,再根据名称过滤
SysOrganization record = new SysOrganization();
record.setId(orgId);
record.setOrgStatus(orgStatus);
......@@ -220,9 +221,10 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
}
/**
*
* @deprecated V2.2.0 已废弃
*/
@Override
@Deprecated
public List<SysOrganization> selectByExample(String orgName, Byte orgStatus, SysUser user) {
SysOrganizationExample example = new SysOrganizationExample();
Criteria criteria = example.createCriteria();
......@@ -303,19 +305,13 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
return effectRows;
}
/* (non-Javadoc)
* @see com.glsx.usercenter.service.ISysOrganizationService#findMenuByParams(java.util.Map)
*/
@Deprecated
@Override
public List<SysOrganization> findOrgByRecord(SysOrganization record) {
return organizationMapper.selectByRecord(record);
}
/* (non-Javadoc)
* @see com.glsx.usercenter.service.ISysOrganizationService#findAllRecursion(java.lang.Integer)
*/
@Deprecated
@Override
public List<SysOrganization> findOrgById(Integer id) {
......@@ -327,7 +323,7 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
* 说明方法描述:递归查询子节点
*
* @param childList 子节点
* @param parentId 父节点id
* @param parentUuid 父节点id
* @return
*/
......@@ -335,7 +331,7 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
List<SysOrganization> listParentRecord = new ArrayList<>();
List<SysOrganization> listNotParentRecord = new ArrayList<>();
// 遍历tmpList,找出所有的根节点和非根节点
if (childList != null && childList.size() > 0) {
if (CollectionUtils.isNotEmpty(childList)) {
for (SysOrganization record : childList) {
// 对比找出父节点
if (record.getParentId() == parentUuid) {
......@@ -343,16 +339,15 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
} else {
listNotParentRecord.add(record);
}
}
}
// 查询子节点
if (listParentRecord.size() > 0) {
for (SysOrganization record : listParentRecord) {
// 递归查询子节点
record.setChildren(getTreeChildRecord(listNotParentRecord, record.getId()));
}
for (SysOrganization record : listParentRecord) {
// 递归查询子节点
record.setChildren(getTreeChildRecord(listNotParentRecord, record.getId()));
}
return listParentRecord;
}
......@@ -364,21 +359,20 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
* @param filterFields 要过滤的字段
* @return
*/
private List<SysOrganization> convertListToTreeByKeyword(List<SysOrganization> allRecords, String keywords,
String... filterFields) {
private List<SysOrganization> convertListToTreeByKeyword(List<SysOrganization> allRecords,
String keywords, String... filterFields) {
List<SysOrganization> listRecord = new ArrayList<>();
Map<Integer, SysOrganization> allRecordMap = new HashMap<>();
for (SysOrganization record : allRecords) {
allRecordMap.put(record.getId(), record);
}
// 遍历allRrecords找出所有的nodeName和关键字keywords相关的数据
if (allRecords != null && allRecords.size() > 0) {
// 遍历allRecords找出所有的nodeName和关键字keywords相关的数据
if (!allRecords.isEmpty()) {
if (filterFields.length > 1) {
for (SysOrganization record : allRecords) {
for (String field : filterFields) {
// 比较
if (record.getName().toLowerCase().indexOf(keywords.toLowerCase()) != -1) {
if (record.getName().toLowerCase().contains(keywords.toLowerCase())) {
listRecord.add(record);
}
}
......@@ -386,7 +380,7 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
} else {
for (SysOrganization record : allRecords) {
// 比较
if (record.getName().toLowerCase().indexOf(keywords.toLowerCase()) != -1) {
if (record.getName().toLowerCase().contains(keywords.toLowerCase())) {
listRecord.add(record);
}
......@@ -412,28 +406,25 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
List<SysOrganization> listNotParentRecord = new ArrayList<>();
// 第一步:遍历allRecords保存所有数据的id用于判断是不是根节点
Map<Integer, Integer> mapAllUuid = new HashMap<>();
Map<Integer, SysOrganization> allRecordMap = new HashMap<>();
for (SysOrganization record : allRecords) {
mapAllUuid.put(record.getId(), record.getId());
allRecordMap.put(record.getId(), record);
}
// 第二步:遍历allRecords找出所有的根节点和非根节点
if (!allRecords.isEmpty()) {
for (SysOrganization record : allRecords) {
if (record.getParentId() == null || !mapAllUuid.containsKey(record.getParentId())) {
listParentRecord.add(record);
} else {
listNotParentRecord.add(record);
}
for (SysOrganization record : allRecords) {
if (record.getParentId() == null || !mapAllUuid.containsKey(record.getParentId())) {
listParentRecord.add(record);
} else {
listNotParentRecord.add(record);
}
}
// 第三步: 递归获取所有子节点
if (!listParentRecord.isEmpty()) {
for (SysOrganization record : listParentRecord) {
// 添加所有子级
record.setChildren(this.getTreeChildRecord(listNotParentRecord, record.getId()));
}
for (SysOrganization record : listParentRecord) {
// 添加所有子级
record.setChildren(this.getTreeChildRecord(listNotParentRecord, record.getId()));
}
return listParentRecord;
}
......@@ -450,7 +441,7 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
private List<SysOrganization> getSelfAndTheirParentRecord(List<SysOrganization> parentList, List<SysOrganization> resultList,
Map<Integer, SysOrganization> filterRecordMap, Map<Integer, SysOrganization> allRecordMap) {
// 当父节点为null或者节点数量为0时返回结果,退出递归
if (parentList == null || parentList.size() == 0) {
if (parentList == null || parentList.isEmpty()) {
return resultList;
}
// 重新创建父节点集合
......@@ -491,7 +482,6 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
*/
@Override
public SysOrganization selectDetailById(Integer id) {
return organizationMapper.selectDetailById(id);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!