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