Commit e0185240 by 刘鑫

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop-16542

2 parents 4d0d259a 615ee65c
......@@ -171,12 +171,15 @@ public class Location {
@Override
public boolean equals(Object obj) {
if (obj == null)
if (obj == null) {
return false;
if (!(obj instanceof Location))
}
if (!(obj instanceof Location)) {
return false;
if (obj == this)
}
if (obj == this) {
return true;
}
return this.id == ((Location) obj).getId();
}
......
......@@ -132,7 +132,9 @@ public enum StatusCodeEnum {
FENDAN_ENGINEER_UNMATCHED("023", "分单接口没有查到配置工程师", false),
FENDAN_IS_TRANSCEND("024", "分单超派", false);
FENDAN_IS_TRANSCEND("024", "分单超派", false),
RESOURCE_USER_EXISTS_ROLE("025", "用绑定用户的角色不允许删除,需要解绑后才可以删除角色", false);
/**
* 状态码
......
......@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequestMapping("/pea-order")
......@@ -50,6 +51,20 @@ public class OrderAssignController {
return res;
}
@PostMapping("/order/assign/list")
public Result<?> orderAssign(@RequestBody List<OrderAssignReq> assignReqList) {
// 服务单指派-指派提交
try {
for (OrderAssignReq assignReq : assignReqList) {
orderAssign.orderAssign(assignReq);
}
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return Result.success();
}
@PostMapping("/order/revoke/assign")
public Result<?> orderRevokeAssign(@RequestBody OrderRevokeAssign req) {
// 放回工单池
......@@ -73,4 +88,23 @@ public class OrderAssignController {
}
return res;
}
/**
* 批量改约
*
* @param rescheduleList
* @return
*/
@PostMapping("/order/rescheduling/list")
public Result<?> orderRescheduling(@RequestBody List<OrderReschedule> rescheduleList) {
// 订单改约
try {
for (OrderReschedule reschedule : rescheduleList) {
orderInfoService.orderReschedule(reschedule);
}
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return Result.success();
}
}
......@@ -20,6 +20,8 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
List<EngineerInfoEntity> findByGroupId(String groupId);
List<EngineerInfoEntity> findByPhone(String phone);
List<EngineerInfoEntity> findByGroupIdIn(List<String> groupIds);
List<EngineerInfoEntity> findByEngineerCodeIn(List<String> engineerCodes);
......
......@@ -9,28 +9,36 @@ import java.util.List;
@Data
@EqualsAndHashCode
public class OrderServiceListReq {
@NotNull
private String levelType;
@NotNull
private String levelValue;
@NotNull
private String startDate;
@NotNull
private String endDate;
@NotNull
private long page;
@NotNull
private long size;
private List<String> branchIds;
private List<String> groupIds;
private List<String> teamIds;
private List<String> engineerCodes;
private List<Integer> priorities;
private List<String> typeCategory;
private List<String> skillCategory;
private List<Integer> groupCategory;
private String phone;
private String orderId;
private List<String> appointmentStatus;
private List<String> appointmentType;
@NotNull
private String levelType;
@NotNull
private String levelValue;
@NotNull
private String startDate;
@NotNull
private String endDate;
@NotNull
private long page;
@NotNull
private long size;
private List<String> branchIds;
private List<String> groupIds;
private List<String> teamIds;
private List<String> engineerCodes;
private List<Integer> priorities;
private List<String> typeCategory;
private List<String> skillCategory;
private List<Integer> groupCategory;
private String phone;
private String orderId;
private List<String> appointmentStatus;
private List<String> appointmentType;
/**
* 工单状态
*/
private List<String> orderStatus;
/**
* 服务状态
*/
private List<String> serviceStatus;
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ import com.dituhui.pea.order.utils.TypeUtils;
import com.google.gson.internal.LinkedTreeMap;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
......@@ -163,13 +164,15 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
@Transactional
@Override
public Result<?> businessCustomLayerAdd(String branchId, String layerName, String layerDesc, List<String> skillCodes) {
if (orgBranchDao.getByBranchId(branchId) == null) {
throw new BusinessException("分部参数错误,请联系管理员/研发");
}
String layerId = UUID.randomUUID().toString().replace("-", "");
// 同步创建saas图层,返回layerId
String result = saasRemoteService.addLayer(ak, layerName, 1, 1);
String saasLayerName = branchId + "_" + layerId;
String result = saasRemoteService.addLayer(ak, saasLayerName, 1, 1);
log.info("addLayer params:{} result:{}", layerName, result);
Result<LinkedTreeMap<String, Object>> saasResult = TypeUtils.convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
......@@ -177,8 +180,6 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
}
String saasLayerId = (String) saasResult.getResult().get("id");// 存入pea
String layerId = UUID.randomUUID().toString().replace("-", "");
// 入库保存
MapLayerCustomizeEntity m = new MapLayerCustomizeEntity();
m.setLayerId(layerId);
......@@ -238,6 +239,7 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
}
@Override
@Transactional
public Result<?> businessCustomLayerRemove(String layerId) throws BusinessException {
MapLayerCustomizeEntity layer = mapLayerCustomizeDao.getByLayerId(layerId);
......@@ -251,12 +253,14 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
return Result.failure("该图层下面还有区块");
}
// 同步删除saas图层
String result = saasRemoteService.deleteLayer(ak, layer.getSaasLayerId());
log.info("deleteLayer params:{} result:{}", layerId, result);
Result<Boolean> saasResult = TypeUtils.convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure(saasResult.getMessage());
if (StringUtils.isNotBlank(layer.getSaasLayerId())) {
// 同步删除saas图层
String result = saasRemoteService.deleteLayer(ak, layer.getSaasLayerId());
log.info("deleteLayer params:{} result:{}", layerId, result);
Result<Boolean> saasResult = TypeUtils.convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure(saasResult.getMessage());
}
}
// 更新状态为删除状态
......
......@@ -518,13 +518,11 @@ public class DispatchServiceImpl implements DispatchService {
if (ListUtils.isNotEmpty(reqDTO.getGroupCategory())) {
Subquery<OrderInfoEntity> skillGroupCategorySubquery = criteriaQuery.subquery(OrderInfoEntity.class);
Root<SkillInfoEntity> skillInfoRoot = skillGroupCategorySubquery.from(SkillInfoEntity.class);
Root<OrgGroupEntity> orgGroupEntityRoot = skillGroupCategorySubquery.from(OrgGroupEntity.class);
skillGroupCategorySubquery.select(root) // 注意这里的 select 使用主查询的 root
.where(
criteriaBuilder.equal(skillInfoRoot.get("brand"), root.get("brand")),
criteriaBuilder.equal(skillInfoRoot.get("type"), root.get("type")),
criteriaBuilder.equal(skillInfoRoot.get("skill"), root.get("skill")),
skillInfoRoot.get("groupCategory").in(reqDTO.getGroupCategory())
criteriaBuilder.equal(orgGroupEntityRoot.get("groupId"), root.get("orgGroupId")),
orgGroupEntityRoot.get("category").in(reqDTO.getGroupCategory())
);
predicates.add(criteriaBuilder.exists(skillGroupCategorySubquery));
}
......@@ -566,6 +564,7 @@ public class DispatchServiceImpl implements DispatchService {
teamSubquery.select(criteriaBuilder.literal(1))
.where(
criteriaBuilder.equal(teamRoot.get("engineerCode"), root.get("engineerCode")),
criteriaBuilder.equal(teamRoot.get("status"), 1),
teamRoot.get("teamId").in(teamIds)
);
predicates.add(criteriaBuilder.exists(teamSubquery));
......
......@@ -91,6 +91,9 @@ public class OrderCreateServiceImpl implements OrderCreateService {
private OrgGroupDao orgGroupDao;
@Autowired
private OrgBranchDao orgBranchDao;
@Autowired
private MsgService msgService;
@Autowired
......@@ -154,13 +157,12 @@ public class OrderCreateServiceImpl implements OrderCreateService {
if (fendanResult.getCode().equals(StatusCodeEnum.FENDAN_IS_TRANSCEND.getCode())) {
entity.setTranscend(1);
}
OrgGroupEntity groupDaoByCitycodeListLike = orgGroupDao.getByCitycodeListLike(adminDistrict.getResult().getSubNames().getCounty());
entity.setOrgClusterId(groupDaoByCitycodeListLike.getClusterId());
entity.setOrgBranchId(groupDaoByCitycodeListLike.getBranchId());
entity.setOrgGroupId(groupDaoByCitycodeListLike.getGroupId());
OrgBranchEntity branchEntity = orgBranchDao.findByCitycodeListLike("%" + adminDistrict.getResult().getSubNames().getCounty() + "%");
entity.setOrgClusterId(branchEntity.getClusterId());
entity.setOrgBranchId(branchEntity.getBranchId());
//发送通知分部消息
MsgDTO msgDTO = new MsgDTO();
msgDTO.setGroupId(groupDaoByCitycodeListLike.getGroupId());
msgDTO.setBranchId(branchEntity.getBranchId());
msgDTO.setType(0);
msgDTO.setOrderIds(orderId);
msgDTO.setContent("有1条预约日期在" + entity.getExpectTimeBegin().toLocalDate() + "的工单需人工外理");
......
......@@ -256,7 +256,15 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return Result.success(null);
}
/**
* 改约
*
* @param req
* @return
* @throws BusinessException
*/
@Override
@Transactional
public Result<?> orderReschedule(OrderReschedule req) throws BusinessException {
// 判断是否分配到人和是否是今天
LocalDateTime expectBegin = TimeUtils.IsoDateTime2LocalDateTime(req.getExpectBegin());
......
......@@ -53,10 +53,12 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
lqw.ge(OrderInfo::getDt, startDate); //预约开始日期
lqw.le(OrderInfo::getDt, endDate); //预约开始日期
//筛选项
lqw.eq(StringUtils.isNotEmpty(reqDTO.getPhone()), OrderInfo::getPhone, reqDTO.getPhone());
if (StringUtils.isNotBlank(reqDTO.getOrderId())) {
lqw.in(StringUtils.isNotEmpty(reqDTO.getOrderId()), OrderInfo::getOrderId, reqDTO.getOrderId().split(","));
}
lqw.eq(StringUtils.isNotEmpty(reqDTO.getPhone()), OrderInfo::getPhone, reqDTO.getPhone());
lqw.in(ListUtils.isNotEmpty(reqDTO.getServiceStatus()), OrderInfo::getServiceStatus, reqDTO.getServiceStatus());
lqw.in(ListUtils.isNotEmpty(reqDTO.getOrderStatus()), OrderInfo::getOrderStatus, reqDTO.getOrderStatus());
lqw.in(ListUtils.isNotEmpty(reqDTO.getBranchIds()), OrderInfo::getOrgBranchId, reqDTO.getBranchIds());
lqw.in(ListUtils.isNotEmpty(reqDTO.getGroupIds()), OrderInfo::getOrgGroupId, reqDTO.getGroupIds());
lqw.in(ListUtils.isNotEmpty(reqDTO.getTeamIds()), OrderInfo::getOrgTeamId, reqDTO.getTeamIds());
......
package com.dituhui.pea.order.service.impl;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
......@@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
import javax.persistence.criteria.Predicate;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
......@@ -204,12 +207,16 @@ public class ScheduleServiceImpl implements ScheduleService {
item.setSkill(o.getSkill());
item.setOrderStatus(o.getAppointmentStatus());
item.setOrderStatusName("");
item.setDistance(3000);
item.setDistance(o.getArriveDistance());
item.setTimeType("auto");
item.setExpectArriveDuration("10分钟");
item.setArriveTime("10分钟");
item.setExpectWorkDuration("30分钟");
item.setWorkDuration("30分钟");
item.setExpectArriveDuration(o.getArriveElapsed() + "分钟");
item.setArriveTime(null);
if (ObjectUtil.isAllNotEmpty(o.getPlanStartTime(), o.getPlanEndTime())) {
item.setExpectWorkDuration(LocalDateTimeUtil.between(o.getPlanStartTime(), o.getPlanEndTime(), ChronoUnit.MINUTES) + "分钟");
}
if (ObjectUtil.isAllNotEmpty(o.getActualStartTime(), o.getActualEndTime())) {
item.setWorkDuration(LocalDateTimeUtil.between(o.getActualStartTime(), o.getActualEndTime(), ChronoUnit.MINUTES) + "分钟");
}
orders.add(item);
}
......
......@@ -131,6 +131,10 @@ public class RoleService {
if (ObjectUtil.isNull(roleEntity)) {
throw new BusinessException(StatusCodeEnum.ROLE_DOES_NOT_EXIST);
}
List<UserRoleEntity> roleEntities = userRoleDao.findByRoleId(roleId);
if (CollectionUtils.isNotEmpty(roleEntities)) {
throw new BusinessException(StatusCodeEnum.RESOURCE_USER_EXISTS_ROLE);
}
// 删除角色
roleDao.deleteById(roleId);
// 删除用户和角色的关系
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!