Commit 85a26794ba29ca12004891da7f84246efa852011
Merge remote-tracking branch 'origin/test'
Showing
4 changed files
with
46 additions
and
29 deletions
fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/angel/InsurerRpcService.java
@@ -17,8 +17,10 @@ import org.springframework.data.redis.core.BoundValueOperations; | @@ -17,8 +17,10 @@ import org.springframework.data.redis.core.BoundValueOperations; | ||
17 | import org.springframework.data.redis.core.StringRedisTemplate; | 17 | import org.springframework.data.redis.core.StringRedisTemplate; |
18 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
19 | import org.springframework.util.Assert; | 19 | import org.springframework.util.Assert; |
20 | +import org.springframework.util.CollectionUtils; | ||
20 | 21 | ||
21 | import java.util.Date; | 22 | import java.util.Date; |
23 | +import java.util.List; | ||
22 | import java.util.Objects; | 24 | import java.util.Objects; |
23 | import java.util.concurrent.TimeUnit; | 25 | import java.util.concurrent.TimeUnit; |
24 | 26 | ||
@@ -84,25 +86,37 @@ public class InsurerRpcService { | @@ -84,25 +86,37 @@ public class InsurerRpcService { | ||
84 | if (StringUtils.isValid(cache)) { | 86 | if (StringUtils.isValid(cache)) { |
85 | return JSONObject.parseObject(cache, InsuranceDTO.class); | 87 | return JSONObject.parseObject(cache, InsuranceDTO.class); |
86 | } | 88 | } |
87 | - Message<InsuranceOrderDTO> msg = insuranceEstimateApiService.getCusLatest(customerId); | 89 | + Message<List<InsuranceOrderDTO>> msg = insuranceEstimateApiService.getCusLatest(customerId); |
90 | + | ||
88 | log.info("查询正在生效的保险信息:{}", msg.getResult()); | 91 | log.info("查询正在生效的保险信息:{}", msg.getResult()); |
89 | - InsuranceOrderDTO data = msg.getData(); | ||
90 | - if (!msg.isSuccess() || Objects.isNull(data) || Objects.isNull(data.getInsuranceInfo())) { | 92 | + List<InsuranceOrderDTO> data = msg.getData(); |
93 | + if (!msg.isSuccess() || CollectionUtils.isEmpty(data)) { | ||
91 | return null; | 94 | return null; |
92 | } | 95 | } |
93 | - Date tciEndTime = data.getInsuranceInfo().getTciEndTime(); | ||
94 | - Date vciEndTime = data.getInsuranceInfo().getVciEndTime(); | 96 | + Date tciEndTime = null; |
97 | + Date vciEndTime = null; | ||
98 | + Date tciStartTime = null; | ||
99 | + Date vciStartTime = null; | ||
100 | + for (InsuranceOrderDTO insuranceOrderDTO : data) { | ||
101 | + if (1 == insuranceOrderDTO.getInsuranceInfo().getInsuranceType()) { | ||
102 | + tciEndTime = insuranceOrderDTO.getInsuranceInfo().getEndTime(); | ||
103 | + tciStartTime = insuranceOrderDTO.getInsuranceInfo().getStartTime(); | ||
104 | + } else if (2 == insuranceOrderDTO.getInsuranceInfo().getInsuranceType()) { | ||
105 | + vciEndTime = insuranceOrderDTO.getInsuranceInfo().getEndTime(); | ||
106 | + vciStartTime = insuranceOrderDTO.getInsuranceInfo().getStartTime(); | ||
107 | + } | ||
108 | + } | ||
95 | final Date now = new Date(); | 109 | final Date now = new Date(); |
96 | boolean before1 = !Objects.isNull(tciEndTime) && now.before(tciEndTime); | 110 | boolean before1 = !Objects.isNull(tciEndTime) && now.before(tciEndTime); |
97 | - boolean before2 = !Objects.isNull(tciEndTime) && now.before(vciEndTime); | 111 | + boolean before2 = !Objects.isNull(vciEndTime) && now.before(vciEndTime); |
98 | 112 | ||
99 | if (before1 || before2) { | 113 | if (before1 || before2) { |
100 | InsuranceDTO dto = new InsuranceDTO(); | 114 | InsuranceDTO dto = new InsuranceDTO(); |
101 | BeanUtils.copyProperties(data, dto); | 115 | BeanUtils.copyProperties(data, dto); |
102 | - dto.setEffectDate(data.getInsuranceInfo().getVciStartTime()); | ||
103 | - dto.setExpiryDate(data.getInsuranceInfo().getVciEndTime()); | ||
104 | - dto.setTciEffectDate(data.getInsuranceInfo().getTciStartTime()); | ||
105 | - dto.setTciExpiryDate(data.getInsuranceInfo().getTciEndTime()); | 116 | + dto.setEffectDate(vciStartTime); |
117 | + dto.setExpiryDate(vciEndTime); | ||
118 | + dto.setTciEffectDate(tciStartTime); | ||
119 | + dto.setTciExpiryDate(tciEndTime); | ||
106 | setToCache(key, JSONObject.toJSONString(dto), 30); | 120 | setToCache(key, JSONObject.toJSONString(dto), 30); |
107 | return dto; | 121 | return dto; |
108 | } | 122 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/component/InsuranceConsumer.java
@@ -2,7 +2,6 @@ package cn.fw.valhalla.component; | @@ -2,7 +2,6 @@ package cn.fw.valhalla.component; | ||
2 | 2 | ||
3 | import cn.fw.angel.sdk.result.InsuOrderMqDTO; | 3 | import cn.fw.angel.sdk.result.InsuOrderMqDTO; |
4 | import cn.fw.valhalla.common.utils.DateUtil; | 4 | import cn.fw.valhalla.common.utils.DateUtil; |
5 | -import cn.fw.valhalla.common.utils.StringUtils; | ||
6 | import cn.fw.valhalla.domain.db.OriginalData; | 5 | import cn.fw.valhalla.domain.db.OriginalData; |
7 | import cn.fw.valhalla.domain.db.customer.Customer; | 6 | import cn.fw.valhalla.domain.db.customer.Customer; |
8 | import cn.fw.valhalla.sdk.enums.DataTypeEnum; | 7 | import cn.fw.valhalla.sdk.enums.DataTypeEnum; |
@@ -62,25 +61,27 @@ public class InsuranceConsumer implements RocketMQListener<InsuOrderMqDTO> { | @@ -62,25 +61,27 @@ public class InsuranceConsumer implements RocketMQListener<InsuOrderMqDTO> { | ||
62 | } | 61 | } |
63 | originalData = new OriginalData(); | 62 | originalData = new OriginalData(); |
64 | 63 | ||
64 | + if (1 == t.getInsuranceType() || 2 == t.getInsuranceType()) { | ||
65 | + Date startTime = t.getStartTime(); | ||
66 | + String detaId = t.getOrderNo(); | ||
65 | 67 | ||
66 | - Date startTime = Objects.isNull(t.getTciStartTime()) ? t.getVciStartTime() : t.getTciStartTime(); | ||
67 | - String detaId = StringUtils.isEmpty(t.getTciOrderNo()) ? t.getVciOrderNo() : t.getTciOrderNo(); | 68 | + Timestamp insExpireTime = DateUtil.getExpiredYear(startTime, 1); |
69 | + customer.setInsuranceExpires(insExpireTime); | ||
70 | + customerService.updateById(customer); | ||
68 | 71 | ||
69 | - Timestamp insExpireTime = DateUtil.getExpiredYear(startTime, 1); | ||
70 | - customer.setInsuranceExpires(insExpireTime); | ||
71 | - customerService.updateById(customer); | 72 | + originalData.setType(DataTypeEnum.BI); |
73 | + originalData.setCustomerId(customer.getId()); | ||
74 | + originalData.setPlateNo(customer.getPlateNo()); | ||
75 | + originalData.setUserId(t.getUploaderId()); | ||
76 | + originalData.setGenerateTime(insExpireTime); | ||
77 | + originalData.setDetailId(detaId); | ||
78 | + originalData.setSolved(Boolean.FALSE); | ||
79 | + originalData.setShopId(t.getShopId()); | ||
80 | + originalData.setGroupId(t.getGroupId()); | ||
81 | + originalData.setCreateTime(new Date()); | ||
82 | + originalData.setUpdateTime(new Date()); | ||
83 | + originalDataService.save(originalData); | ||
84 | + } | ||
72 | 85 | ||
73 | - originalData.setType(DataTypeEnum.BI); | ||
74 | - originalData.setCustomerId(customer.getId()); | ||
75 | - originalData.setPlateNo(customer.getPlateNo()); | ||
76 | - originalData.setUserId(t.getUploaderId()); | ||
77 | - originalData.setGenerateTime(insExpireTime); | ||
78 | - originalData.setDetailId(detaId); | ||
79 | - originalData.setSolved(Boolean.FALSE); | ||
80 | - originalData.setShopId(t.getShopId()); | ||
81 | - originalData.setGroupId(t.getGroupId()); | ||
82 | - originalData.setCreateTime(new Date()); | ||
83 | - originalData.setUpdateTime(new Date()); | ||
84 | - originalDataService.save(originalData); | ||
85 | } | 86 | } |
86 | } | 87 | } |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/LeaveNeedDoServiceImpl.java
@@ -12,6 +12,7 @@ import org.springframework.lang.Nullable; | @@ -12,6 +12,7 @@ import org.springframework.lang.Nullable; | ||
12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
13 | import org.springframework.util.CollectionUtils; | 13 | import org.springframework.util.CollectionUtils; |
14 | 14 | ||
15 | +import java.util.Date; | ||
15 | import java.util.List; | 16 | import java.util.List; |
16 | 17 | ||
17 | /** | 18 | /** |
@@ -42,6 +43,7 @@ public class LeaveNeedDoServiceImpl extends ServiceImpl<LeaveNeedDoMapper, Leave | @@ -42,6 +43,7 @@ public class LeaveNeedDoServiceImpl extends ServiceImpl<LeaveNeedDoMapper, Leave | ||
42 | public void dealById(@NonNull Long id) { | 43 | public void dealById(@NonNull Long id) { |
43 | update(Wrappers.<LeaveNeedDo>lambdaUpdate() | 44 | update(Wrappers.<LeaveNeedDo>lambdaUpdate() |
44 | .set(LeaveNeedDo::getDone, Boolean.TRUE) | 45 | .set(LeaveNeedDo::getDone, Boolean.TRUE) |
46 | + .set(LeaveNeedDo::getUpdateTime, new Date()) | ||
45 | .eq(LeaveNeedDo::getId, id) | 47 | .eq(LeaveNeedDo::getId, id) |
46 | ); | 48 | ); |
47 | } | 49 | } |
pom.xml
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | <fw-qywx-sdk.version>1.0</fw-qywx-sdk.version> | 48 | <fw-qywx-sdk.version>1.0</fw-qywx-sdk.version> |
49 | <fw-flow-sdk.version>1.0.0</fw-flow-sdk.version> | 49 | <fw-flow-sdk.version>1.0.0</fw-flow-sdk.version> |
50 | <fw-order-sdk.version>2.0.0</fw-order-sdk.version> | 50 | <fw-order-sdk.version>2.0.0</fw-order-sdk.version> |
51 | - <fw-angel-sdk.version>1.0</fw-angel-sdk.version> | 51 | + <fw-angel-sdk.version>3.0.0</fw-angel-sdk.version> |
52 | <redis.spring.boot.starter>1.0</redis.spring.boot.starter> | 52 | <redis.spring.boot.starter>1.0</redis.spring.boot.starter> |
53 | <javase>3.0.0</javase> | 53 | <javase>3.0.0</javase> |
54 | <caffeine>2.5.3</caffeine> | 54 | <caffeine>2.5.3</caffeine> |