fix: 修复redis缓存临时行程规划单的bug
This commit is contained in:
parent
c7dfb7f045
commit
f2adeab8f6
|
@ -1,6 +1,7 @@
|
|||
package com.chint.application.in;
|
||||
|
||||
import com.chint.application.dtos.DeleteLegData;
|
||||
import com.chint.application.dtos.LegApprovalParam;
|
||||
import com.chint.application.queryies.OrderQuery;
|
||||
import com.chint.application.services.OrderApplicationService;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
|
@ -53,6 +54,13 @@ public class OrderPublicController {
|
|||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
@ApiOperation("提交需要审批的行程节点")
|
||||
@PostMapping("/approve/leg")
|
||||
public Result<String> approveOrder(@RequestBody LegApprovalParam param) {
|
||||
|
||||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("审批拒绝行程规划单")
|
||||
@PostMapping("/reject")
|
||||
|
|
|
@ -73,14 +73,20 @@ public class OrderOutController {
|
|||
public Result<RouteOrderRes> queryOrder(@RequestBody OrderQueryData queryData) {
|
||||
String fakeOrderNo = queryData.getFakeOrderNo();
|
||||
String sysCode = queryData.getSysCode();
|
||||
RouteOrder routeOrder;
|
||||
Long routeId = queryData.getRouteId();
|
||||
RouteOrder routeOrder = null;
|
||||
if (fakeOrderNo != null && sysCode != null) {
|
||||
routeOrder = routeRepository.findTempRouteOrderBySysCodeAndBillCode(sysCode, fakeOrderNo);
|
||||
} else {
|
||||
routeOrder = orderQuery.queryById(queryData.getRouteId()).reloadStatus();
|
||||
}
|
||||
if (routeId != null) {
|
||||
routeOrder = orderQuery.queryById(routeId).reloadStatus();
|
||||
}
|
||||
if (routeOrder != null) {
|
||||
RouteOrderRes routeOrderRes = orderQuery.queryRouteRes(routeOrder);
|
||||
return Result.Success(SUCCESS, routeOrderRes);
|
||||
} else {
|
||||
return Result.error("无法查询到相关差旅申请单");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询行程规划订单")
|
||||
|
@ -137,8 +143,8 @@ public class OrderOutController {
|
|||
legResList.forEach(it -> it.setUserName(userRepository.findByUserEmployeeNo(routeOrder.getUserId()).getName()));
|
||||
legDomainService.getSupplierName(legResList, routeOrder);
|
||||
return Result.Success(SUCCESS, legResList);
|
||||
}
|
||||
|
||||
}
|
||||
@ApiOperation("查询单日行程规划单")
|
||||
@PostMapping("/query/route/filed")
|
||||
public Result<PageResult<RouteOrderFiledVO>> queryRoutOrderField(@RequestBody RoutOrderFieldParam param) {
|
||||
|
|
|
@ -336,6 +336,12 @@ public class OrderQuery {
|
|||
}
|
||||
|
||||
if (routeOrder != null) {
|
||||
if (routeOrder.getCreateTime() == null) {
|
||||
routeOrder.setCreateTime(LocalDateTime.now());
|
||||
}
|
||||
if (routeOrder.getUpdateTime() == null) {
|
||||
routeOrder.setUpdateTime(LocalDateTime.now());
|
||||
}
|
||||
routeOrder.reloadStatus();
|
||||
}
|
||||
|
||||
|
@ -577,6 +583,7 @@ public class OrderQuery {
|
|||
order.getLegItems().stream().anyMatch(leg -> !leg.getLegType().equals(LEG_TYPE_OTHER)))
|
||||
.filter(order -> order.getSupplierName() == null)
|
||||
.filter(order -> order.getLegItems().stream().map(Leg::getLegType).anyMatch(allowSupplierProductList::contains))//判断有无允许预订的商品
|
||||
.filter(order -> order.getEndTime().isAfter(LocalDateTime.now())) //如果是已经过期的差旅行程单,那么就取消需要同步的订单
|
||||
.sorted(Comparator.comparing(RouteOrder::getUpdateTime).reversed())
|
||||
.map(order -> {
|
||||
User user = userRepository.findByUserEmployeeNo(order.getUserId());
|
||||
|
|
|
@ -64,7 +64,7 @@ public class UserController {
|
|||
@ApiOperation("根据Id查询用户信息")
|
||||
@PostMapping("/query")
|
||||
public Result<UserRes> getUserByEmployeeNo() {
|
||||
User currentUser = BaseContext.getCurrentUser().loadRoleOrg();
|
||||
User currentUser = BaseContext.getCurrentUser();
|
||||
return Result.Success(SUCCESS, BeanUtil.copyProperties(currentUser, UserRes.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,4 +34,9 @@ public abstract class BaseEvent implements Serializable {
|
|||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public BaseEvent extension(String extension) {
|
||||
this.extension = extension;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.chint.domain.aggregates.base;
|
||||
|
||||
import com.chint.domain.aggregates.order.LegApprovalEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EventManageable {
|
||||
|
@ -18,4 +20,7 @@ public interface EventManageable {
|
|||
List<? extends BaseEvent> eventList = getEvents();
|
||||
return eventList.isEmpty() ? null : eventList.get(eventList.size() - 1);
|
||||
}
|
||||
|
||||
|
||||
List<LegApprovalEvent> get();
|
||||
}
|
|
@ -17,7 +17,6 @@ public class RouteCustomExtensionField implements Serializable {
|
|||
private Long id;
|
||||
@Column("route_id")
|
||||
private Long routeId;
|
||||
private Long routeOrderKey;
|
||||
private String fieldName;
|
||||
private String fieldValue;
|
||||
private String extension;
|
||||
|
|
|
@ -135,6 +135,8 @@ public class RouteOrder implements Serializable {
|
|||
}
|
||||
if (data.getCreator() != null) {
|
||||
approveOrderNo.setCreator(data.getCreator());
|
||||
} else {
|
||||
approveOrderNo.setCreator(this.userId);
|
||||
}
|
||||
if (data.getAccountCompany() != null) {
|
||||
approveOrderNo.setAccountCompanyName(data.getAccountCompany());
|
||||
|
|
|
@ -71,6 +71,11 @@ public class RouteRequest implements Serializable, EventManageable {
|
|||
return this.eventList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LegApprovalEvent> get() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
public RouteRequest reloadStatus() {
|
||||
BaseEvent lastEvent = this.getLastEvent().reloadStatus();
|
||||
this.status = lastEvent.getEventType();
|
||||
|
|
|
@ -22,4 +22,6 @@ public class RouterOrderExtensionField implements Serializable {
|
|||
|
||||
private String belongDeptCode;
|
||||
|
||||
private String companyCode;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.chint.domain.aggregates.system;
|
|||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
|
@ -25,4 +26,18 @@ public class SystemCode implements Serializable {
|
|||
private List<CompanyInfo> companyInfos;
|
||||
@MappedCollection(idColumn = "system_code_id")
|
||||
private SystemCodeUrl systemCodeUrl;
|
||||
@Transient
|
||||
// @MappedCollection(idColumn = "system_id", keyColumn = "system_key")
|
||||
private List<SystemCodeExtensionField> systemCodeExtensionFieldList;
|
||||
|
||||
|
||||
public String getApprovalPlatformMark() {
|
||||
if (systemCodeExtensionFieldList == null || systemCodeExtensionFieldList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return this.systemCodeExtensionFieldList.stream().filter(it -> it.getFieldName().equals("ApprovalPlatformMark"))
|
||||
.map(SystemCodeExtensionField::getFieldValue)
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.chint.domain.aggregates.system;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Table("system_code_extension_field")
|
||||
public class SystemCodeExtensionField implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8167639173251119570L;
|
||||
@Id
|
||||
private Long id;
|
||||
@Column("system_code_id")
|
||||
private Long systemCodeId;
|
||||
private String fieldName;
|
||||
private String fieldValue;
|
||||
private String extension;
|
||||
|
||||
private SystemCodeExtensionField(String fieldName, String fieldValue, String extension) {
|
||||
this.fieldName = fieldName;
|
||||
this.fieldValue = fieldValue;
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
public static SystemCodeExtensionField of(String fieldName, String fieldValue, String extension) {
|
||||
return new SystemCodeExtensionField(fieldName, fieldValue, extension);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -92,4 +92,14 @@ public class SystemOrganization implements Serializable {
|
|||
public RoleOrganizationVO mapToRoleOrganizationVO() {
|
||||
return BeanUtil.copyProperties(this, RoleOrganizationVO.class);
|
||||
}
|
||||
|
||||
public String getApprovalPlatformMark() {
|
||||
if (systemOrganizationExtensionList == null || systemOrganizationExtensionList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return this.systemOrganizationExtensionList.stream().filter(it -> it.getFieldName().equals("ApprovalPlatformMark"))
|
||||
.map(SystemOrganizationExtension::getFieldValue)
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,4 @@ public class Role implements Serializable {
|
|||
}
|
||||
return role;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -26,4 +26,6 @@ public interface SystemOrganizationRepository {
|
|||
SystemOrganization queryChild(SystemOrganization systemOrganization);
|
||||
|
||||
List<SystemOrganization> expandOrganizations(List<SystemOrganization> systemOrganizations);
|
||||
|
||||
Optional<SystemOrganization> findByOrgCodeContainingOrOrgNameContaining(String orgCode, String orgName);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,17 @@ public class LegConstant {
|
|||
public static final int LEG_STATUS_REJECT = -1;
|
||||
public static final String LEG_STATUS_REJECT_NAME = "审批未通过";
|
||||
|
||||
public static final int LEG_APPROVAL_STATUS_NOT = -1;
|
||||
public static final String LEG_APPROVAL_STATUS_NOT_NAME = "无需审批";
|
||||
public static final int LEG_APPROVAL_STATUS_PREPARE = 0;
|
||||
public static final String LEG_APPROVAL_STATUS_PREPARE_NAME = "未审批";
|
||||
public static final int LEG_APPROVAL_STATUS_SUBMIT = 1;
|
||||
public static final String LEG_APPROVAL_STATUS_SUBMIT_NAME = "审批中";
|
||||
public static final int LEG_APPROVAL_STATUS_SUCCESS = 2;
|
||||
public static final String LEG_APPROVAL_STATUS_SUCCESS_NAME = "已通过";
|
||||
public static final int LEG_APPROVAL_STATUS_REJECT = 3;
|
||||
public static final String LEG_APPROVAL_STATUS_REJECT_NAME = "已驳回";
|
||||
|
||||
|
||||
// 规划节点运输方式
|
||||
public static final int LEG_TYPE_TRAIN = 0;
|
||||
|
|
|
@ -205,8 +205,15 @@ public class RouteRepositoryImpl implements RouteRepository {
|
|||
@Override
|
||||
public RouteOrder saveTempRouteOrder(RouteOrder routeOrder, Long hours) {
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
routeOrder.reloadStatus();
|
||||
if (routeOrder.getCreateTime() == null) {
|
||||
routeOrder.setCreateTime(LocalDateTime.now());
|
||||
}
|
||||
if (routeOrder.getUpdateTime() == null) {
|
||||
routeOrder.setUpdateTime(LocalDateTime.now());
|
||||
}
|
||||
String redisKey = "TemporaryRouteOrder:" + approveOrderNo.getSysCode() + "-" + approveOrderNo.getFakeOrderNo();
|
||||
redisTemplate.opsForValue().set(redisKey, routeOrder, hours, TimeUnit.HOURS);
|
||||
redisTemplate.opsForValue().set(redisKey, routeOrder, 7L, TimeUnit.DAYS);
|
||||
return routeOrder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Repository
|
||||
public class SystemOrganizationRepositoryImpl implements SystemOrganizationRepository {
|
||||
|
@ -127,6 +128,17 @@ public class SystemOrganizationRepositoryImpl implements SystemOrganizationRepos
|
|||
return allOrganizations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SystemOrganization> findByOrgCodeContainingOrOrgNameContaining(String orgCode, String orgName) {
|
||||
return Stream.of(
|
||||
jdbcSystemOrganizationRepository.findByOrgCode(orgCode).stream().findFirst(),
|
||||
jdbcSystemOrganizationRepository.findByOrgName(orgName).stream().findFirst()
|
||||
)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
private void expandOrganizationRecursively(SystemOrganization org,
|
||||
List<SystemOrganization> allOrganizations) {
|
||||
if (org == null) {
|
||||
|
|
|
@ -139,7 +139,11 @@ public class AmapUserRequest implements UserSync {
|
|||
UserParam userParam = new UserParam();
|
||||
userParam.setUserId(user.getEmployeeNo());
|
||||
userParam.setEmail(user.getEmail());
|
||||
userParam.setMobile(user.getPhoneNumber());
|
||||
String phoneNumber = user.getPhoneNumber();
|
||||
if (phoneNumber.startsWith("+86")) {
|
||||
phoneNumber = phoneNumber.replace("+86", "");
|
||||
}
|
||||
userParam.setMobile(phoneNumber);
|
||||
userNameRepository.findByEmployeeNo(user.getEmployeeNo()).ifPresentOrElse(
|
||||
it -> userParam.setRealName(it.getIdName()),
|
||||
() -> userParam.setRealName(user.getName()));
|
||||
|
|
|
@ -32,7 +32,11 @@ public class TokenRequest {
|
|||
public TokenDto getTokenDto(User user) {
|
||||
TokenDto tokenDto = new TokenDto();
|
||||
TokenDto.UserInfo userInfo = new TokenDto.UserInfo();
|
||||
userInfo.setMobile(user.getPhoneNumber());
|
||||
String phoneNumber = user.getPhoneNumber();
|
||||
if(phoneNumber.startsWith("+86")){
|
||||
phoneNumber = phoneNumber.replace("+86", "");
|
||||
}
|
||||
userInfo.setMobile(phoneNumber);
|
||||
userInfo.setUserId(user.getEmployeeNo());
|
||||
String json = gson.toJson(userInfo);
|
||||
tokenDto.setUserInfo(json);
|
||||
|
|
Loading…
Reference in New Issue