biz-customer、kafka-cdnc-server | 修改 | 处理事务不生效问题
mt 2024年12月20日18:03:18
Showing
10 changed files
with
149 additions
and
105 deletions
| ... | @@ -34,6 +34,7 @@ public enum ResponseCode { | ... | @@ -34,6 +34,7 @@ public enum ResponseCode { |
| 34 | MESSAGE_CODE_30014(30014,"business_exception_30014"), | 34 | MESSAGE_CODE_30014(30014,"business_exception_30014"), |
| 35 | MESSAGE_CODE_30015(30015,"business_success_30015"), | 35 | MESSAGE_CODE_30015(30015,"business_success_30015"), |
| 36 | MESSAGE_CODE_30016(30016,"business_exception_30016"), | 36 | MESSAGE_CODE_30016(30016,"business_exception_30016"), |
| 37 | + MESSAGE_CODE_30017(30017,"business_exception_30017"), | ||
| 37 | 38 | ||
| 38 | /******打个样,编写样例*****/ | 39 | /******打个样,编写样例*****/ |
| 39 | // MESSAGE_CODE_30001(30001,"business_exception_30001"), | 40 | // MESSAGE_CODE_30001(30001,"business_exception_30001"), | ... | ... |
| ... | @@ -28,4 +28,6 @@ public interface ConsignmentExtMapper { | ... | @@ -28,4 +28,6 @@ public interface ConsignmentExtMapper { |
| 28 | @Select("SELECT BC.* FROM T_BIZ_CONSIGNMENT BC WHERE BC.ID = #{query.consignmentId}") | 28 | @Select("SELECT BC.* FROM T_BIZ_CONSIGNMENT BC WHERE BC.ID = #{query.consignmentId}") |
| 29 | Consignment findConsignmentInfo(@Param("query") UserConsignmentInfoQuery query); | 29 | Consignment findConsignmentInfo(@Param("query") UserConsignmentInfoQuery query); |
| 30 | 30 | ||
| 31 | + @Select("SELECT ID FROM T_BIZ_CONSIGNMENT WHERE ID = #{id} FOR UPDATE NOWAIT") | ||
| 32 | + Long lockConsignmentRow(@Param("id") Long id); | ||
| 31 | } | 33 | } | ... | ... |
| ... | @@ -23,4 +23,6 @@ public interface IConsignmentRepository { | ... | @@ -23,4 +23,6 @@ public interface IConsignmentRepository { |
| 23 | Consignment saveOrUpdate(Consignment entity); | 23 | Consignment saveOrUpdate(Consignment entity); |
| 24 | 24 | ||
| 25 | void saveOrUpdateAll(List<Consignment> list); | 25 | void saveOrUpdateAll(List<Consignment> list); |
| 26 | + | ||
| 27 | + void lockConsignmentRow(Long id); | ||
| 26 | } | 28 | } | ... | ... |
| ... | @@ -9,7 +9,10 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery; | ... | @@ -9,7 +9,10 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery; |
| 9 | import com.fedex.connect.customer.repository.base.BaseDao; | 9 | import com.fedex.connect.customer.repository.base.BaseDao; |
| 10 | import com.fedex.connect.customer.repository.repo.IConsignmentRepository; | 10 | import com.fedex.connect.customer.repository.repo.IConsignmentRepository; |
| 11 | import org.apache.commons.lang3.StringUtils; | 11 | import org.apache.commons.lang3.StringUtils; |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | import org.springframework.stereotype.Repository; | 13 | import org.springframework.stereotype.Repository; |
| 14 | +import org.springframework.transaction.annotation.Propagation; | ||
| 15 | +import org.springframework.transaction.annotation.Transactional; | ||
| 13 | 16 | ||
| 14 | import java.time.LocalDate; | 17 | import java.time.LocalDate; |
| 15 | import java.util.Collections; | 18 | import java.util.Collections; |
| ... | @@ -99,4 +102,16 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe | ... | @@ -99,4 +102,16 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe |
| 99 | } | 102 | } |
| 100 | }); | 103 | }); |
| 101 | } | 104 | } |
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * @Author mt | ||
| 108 | + * @Description 为运单表增加行级锁,行级锁使用主键id作为标志,否则可能锁表 | ||
| 109 | + * @Date 2024/12/20 | ||
| 110 | + * @param id | ||
| 111 | + * @return void | ||
| 112 | + */ | ||
| 113 | + @Override | ||
| 114 | + public void lockConsignmentRow(Long id){ | ||
| 115 | + consignmentExtMapper.lockConsignmentRow(id); | ||
| 116 | + } | ||
| 102 | } | 117 | } | ... | ... |
| ... | @@ -3,7 +3,9 @@ package com.fedex.connect.customer.service.biz.impl; | ... | @@ -3,7 +3,9 @@ package com.fedex.connect.customer.service.biz.impl; |
| 3 | import com.fedex.connect.common.dependencies.contants.DigitConstants; | 3 | import com.fedex.connect.common.dependencies.contants.DigitConstants; |
| 4 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | 4 | import com.fedex.connect.common.dependencies.date.vo.ResponseVo; |
| 5 | import com.fedex.connect.common.dependencies.exception.OpErrorException; | 5 | import com.fedex.connect.common.dependencies.exception.OpErrorException; |
| 6 | -import com.fedex.connect.common.model.biz.*; | 6 | +import com.fedex.connect.common.model.biz.Attachment; |
| 7 | +import com.fedex.connect.common.model.biz.Consignment; | ||
| 8 | +import com.fedex.connect.common.model.biz.UploadRecord; | ||
| 7 | import com.fedex.connect.common.model.sys.User; | 9 | import com.fedex.connect.common.model.sys.User; |
| 8 | import com.fedex.connect.customer.data.bo.AddBo; | 10 | import com.fedex.connect.customer.data.bo.AddBo; |
| 9 | import com.fedex.connect.customer.data.bo.ConsignmentBo; | 11 | import com.fedex.connect.customer.data.bo.ConsignmentBo; |
| ... | @@ -12,28 +14,24 @@ import com.fedex.connect.customer.enums.ResponseCode; | ... | @@ -12,28 +14,24 @@ import com.fedex.connect.customer.enums.ResponseCode; |
| 12 | import com.fedex.connect.customer.service.base.BaseService; | 14 | import com.fedex.connect.customer.service.base.BaseService; |
| 13 | import com.fedex.connect.customer.service.biz.IAttachmentService; | 15 | import com.fedex.connect.customer.service.biz.IAttachmentService; |
| 14 | import com.fedex.connect.customer.service.biz.IConsignmentService; | 16 | import com.fedex.connect.customer.service.biz.IConsignmentService; |
| 15 | -import com.fedex.connect.customer.service.biz.IEmailService; | ||
| 16 | import com.fedex.connect.customer.util.service.biz.ConsignmentUtil; | 17 | import com.fedex.connect.customer.util.service.biz.ConsignmentUtil; |
| 17 | -import com.fedex.connect.customer.util.service.biz.PushObUtil; | ||
| 18 | import com.fedex.connect.customer.util.service.biz.UploadRecordUtil; | 18 | import com.fedex.connect.customer.util.service.biz.UploadRecordUtil; |
| 19 | -import com.fedex.connect.customer.util.service.biz.UserConsignmentMappingUtil; | 19 | +import lombok.extern.slf4j.Slf4j; |
| 20 | import org.apache.commons.lang3.StringUtils; | 20 | import org.apache.commons.lang3.StringUtils; |
| 21 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | import org.springframework.stereotype.Service; | 22 | import org.springframework.stereotype.Service; |
| 23 | -import org.springframework.transaction.annotation.Transactional; | ||
| 24 | import org.springframework.web.multipart.MultipartFile; | 23 | import org.springframework.web.multipart.MultipartFile; |
| 25 | 24 | ||
| 26 | import java.time.LocalDate; | 25 | import java.time.LocalDate; |
| 27 | -import java.util.ArrayList; | ||
| 28 | import java.util.List; | 26 | import java.util.List; |
| 29 | import java.util.Objects; | 27 | import java.util.Objects; |
| 30 | -import java.util.Optional; | ||
| 31 | 28 | ||
| 32 | /** | 29 | /** |
| 33 | * @Author Szl | 30 | * @Author Szl |
| 34 | * @Description 类说明 运单操作相关service | 31 | * @Description 类说明 运单操作相关service |
| 35 | * @Date 2024/10/31 | 32 | * @Date 2024/10/31 |
| 36 | */ | 33 | */ |
| 34 | +@Slf4j | ||
| 37 | @Service | 35 | @Service |
| 38 | public class ConsignmentServiceImpl extends BaseService implements IConsignmentService { | 36 | public class ConsignmentServiceImpl extends BaseService implements IConsignmentService { |
| 39 | @Autowired | 37 | @Autowired |
| ... | @@ -41,13 +39,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -41,13 +39,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 41 | @Autowired | 39 | @Autowired |
| 42 | private UploadRecordUtil uploadRecordUtil; | 40 | private UploadRecordUtil uploadRecordUtil; |
| 43 | @Autowired | 41 | @Autowired |
| 44 | - private UserConsignmentMappingUtil userConsignmentMappingUtil; | ||
| 45 | - @Autowired | ||
| 46 | - private PushObUtil pushObUtil; | ||
| 47 | - @Autowired | ||
| 48 | private IAttachmentService attachmentService; | 42 | private IAttachmentService attachmentService; |
| 49 | - @Autowired | ||
| 50 | - private IEmailService emailService; | ||
| 51 | 43 | ||
| 52 | /** | 44 | /** |
| 53 | * @Author Szl | 45 | * @Author Szl |
| ... | @@ -134,7 +126,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -134,7 +126,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 134 | /** | 126 | /** |
| 135 | * 保存运单相关信息 | 127 | * 保存运单相关信息 |
| 136 | */ | 128 | */ |
| 137 | - this.submitInfo(consignment,attachmentList,uploadRecord,user); | 129 | + consignmentUtil.submitInfo(consignment,attachmentList,uploadRecord,user); |
| 138 | }catch(OpErrorException ex){ | 130 | }catch(OpErrorException ex){ |
| 139 | /** | 131 | /** |
| 140 | * 提交异常,需要删除对应已上传附件 | 132 | * 提交异常,需要删除对应已上传附件 |
| ... | @@ -150,73 +142,4 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS | ... | @@ -150,73 +142,4 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS |
| 150 | } | 142 | } |
| 151 | return responseUtils.success(ResponseCode.MESSAGE_CODE_30015); | 143 | return responseUtils.success(ResponseCode.MESSAGE_CODE_30015); |
| 152 | } | 144 | } |
| 153 | - | ||
| 154 | - /** | ||
| 155 | - * @Author mt | ||
| 156 | - * @Description 保存运单相关信息 | ||
| 157 | - * @Date 2024/11/19 | ||
| 158 | - * @param consignment | ||
| 159 | - * @param attachmentList | ||
| 160 | - * @param uploadRecord | ||
| 161 | - * @param user | ||
| 162 | - * @return void | ||
| 163 | - */ | ||
| 164 | - @Transactional(rollbackFor = Exception.class) | ||
| 165 | - public void submitInfo(Consignment consignment, | ||
| 166 | - List<Attachment> attachmentList, | ||
| 167 | - UploadRecord uploadRecord, | ||
| 168 | - User user) throws Exception{ | ||
| 169 | - /** | ||
| 170 | - * 保存或更新运单表 | ||
| 171 | - */ | ||
| 172 | - consignmentRepository.saveOrUpdate(consignment); | ||
| 173 | - //设置上传记录表运单ID | ||
| 174 | - uploadRecord.setConsignmentId(consignment.getId()); | ||
| 175 | - /** | ||
| 176 | - * 保存上传记录表 | ||
| 177 | - */ | ||
| 178 | - uploadRecordRepository.saveOrUpdate(uploadRecord); | ||
| 179 | - //设置附件表运单id,上传记录表id | ||
| 180 | - Optional.ofNullable(attachmentList).orElse(new ArrayList<>()).stream().filter(Objects::nonNull).forEach(p->{ | ||
| 181 | - p.setBizId(consignment.getId()); | ||
| 182 | - p.setUploadRecordId(uploadRecord.getId()); | ||
| 183 | - }); | ||
| 184 | - /** | ||
| 185 | - * 保存附件表信息 | ||
| 186 | - */ | ||
| 187 | - attachmentRepository.saveOrUpdateAll(attachmentList); | ||
| 188 | - //用户uuid与运单uuid不一致,则需要添加用户运单中间表信息 | ||
| 189 | - if(!user.getUserUuid().equals(consignment.getUserUuid())){ | ||
| 190 | - /** | ||
| 191 | - * 查找用户与运单关联信息 | ||
| 192 | - */ | ||
| 193 | - UserConsignmentMapping userConsignmentMapping = userConsignmentMappingRepository.findByUserIdConsignmentId(user.getId(),consignment.getId()); | ||
| 194 | - if(Objects.isNull(userConsignmentMapping)){ | ||
| 195 | - /** | ||
| 196 | - * 初始化插入预清关文件推送任务日志 | ||
| 197 | - */ | ||
| 198 | - userConsignmentMapping = userConsignmentMappingUtil.initUserConsignmentMapping(user.getId(),consignment.getId()); | ||
| 199 | - /** | ||
| 200 | - * 初始化插入预清关文件推送任务日志 | ||
| 201 | - */ | ||
| 202 | - userConsignmentMappingRepository.saveOrUpdate(userConsignmentMapping); | ||
| 203 | - } | ||
| 204 | - } | ||
| 205 | - /** | ||
| 206 | - * Todo 初始化插入预清关文件推送邮件任务日志,szl添加 | ||
| 207 | - */ | ||
| 208 | - | ||
| 209 | - /** | ||
| 210 | - * 初始化插入预清关文件推送日志,mt添加 | ||
| 211 | - */ | ||
| 212 | - PushOb pushOb = pushObUtil.initPushOb(consignment,uploadRecord,user); | ||
| 213 | - /** | ||
| 214 | - * 初始化插入提醒发件人邮件日志 | ||
| 215 | - */ | ||
| 216 | - emailService.saveNotificationEmail(consignment,user); | ||
| 217 | - /** | ||
| 218 | - * 推送进口文件主表 | ||
| 219 | - */ | ||
| 220 | - pushObRepository.saveOrUpdate(pushOb); | ||
| 221 | - } | ||
| 222 | } | 145 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -7,27 +7,30 @@ import com.fedex.connect.common.dependencies.enums.biz.ConsignmentStatusEnum; | ... | @@ -7,27 +7,30 @@ import com.fedex.connect.common.dependencies.enums.biz.ConsignmentStatusEnum; |
| 7 | import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; | 7 | import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; |
| 8 | import com.fedex.connect.common.dependencies.util.ResponseUtils; | 8 | import com.fedex.connect.common.dependencies.util.ResponseUtils; |
| 9 | import com.fedex.connect.common.model.bi.DictionaryEntries; | 9 | import com.fedex.connect.common.model.bi.DictionaryEntries; |
| 10 | -import com.fedex.connect.common.model.biz.Consignment; | 10 | +import com.fedex.connect.common.model.biz.*; |
| 11 | import com.fedex.connect.common.model.sys.User; | 11 | import com.fedex.connect.common.model.sys.User; |
| 12 | import com.fedex.connect.customer.data.bo.AddBo; | 12 | import com.fedex.connect.customer.data.bo.AddBo; |
| 13 | import com.fedex.connect.customer.data.bo.ConsignmentBo; | 13 | import com.fedex.connect.customer.data.bo.ConsignmentBo; |
| 14 | import com.fedex.connect.customer.data.dto.ConsignmentAddDto; | 14 | import com.fedex.connect.customer.data.dto.ConsignmentAddDto; |
| 15 | import com.fedex.connect.customer.enums.ResponseCode; | 15 | import com.fedex.connect.customer.enums.ResponseCode; |
| 16 | -import com.fedex.connect.customer.repository.repo.IConsignmentRepository; | 16 | +import com.fedex.connect.customer.repository.repo.*; |
| 17 | +import com.fedex.connect.customer.service.biz.IEmailService; | ||
| 18 | +import lombok.extern.slf4j.Slf4j; | ||
| 17 | import org.springframework.beans.BeanUtils; | 19 | import org.springframework.beans.BeanUtils; |
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.stereotype.Component; | 21 | import org.springframework.stereotype.Component; |
| 22 | +import org.springframework.transaction.annotation.Transactional; | ||
| 20 | import org.springframework.util.StringUtils; | 23 | import org.springframework.util.StringUtils; |
| 21 | 24 | ||
| 22 | import java.time.LocalDate; | 25 | import java.time.LocalDate; |
| 23 | -import java.util.Date; | 26 | +import java.util.*; |
| 24 | -import java.util.Objects; | ||
| 25 | 27 | ||
| 26 | /** | 28 | /** |
| 27 | * @Author Szl | 29 | * @Author Szl |
| 28 | * @Description 类说明 运单相关util | 30 | * @Description 类说明 运单相关util |
| 29 | * @Date 2024/11/5 | 31 | * @Date 2024/11/5 |
| 30 | */ | 32 | */ |
| 33 | +@Slf4j | ||
| 31 | @Component | 34 | @Component |
| 32 | public class ConsignmentUtil { | 35 | public class ConsignmentUtil { |
| 33 | @Autowired | 36 | @Autowired |
| ... | @@ -36,6 +39,20 @@ public class ConsignmentUtil { | ... | @@ -36,6 +39,20 @@ public class ConsignmentUtil { |
| 36 | ResponseUtils responseUtils; | 39 | ResponseUtils responseUtils; |
| 37 | @Autowired | 40 | @Autowired |
| 38 | IConsignmentRepository consignmentRepository; | 41 | IConsignmentRepository consignmentRepository; |
| 42 | + @Autowired | ||
| 43 | + UserConsignmentMappingUtil userConsignmentMappingUtil; | ||
| 44 | + @Autowired | ||
| 45 | + PushObUtil pushObUtil; | ||
| 46 | + @Autowired | ||
| 47 | + IEmailService emailService; | ||
| 48 | + @Autowired | ||
| 49 | + IUploadRecordRepository uploadRecordRepository; | ||
| 50 | + @Autowired | ||
| 51 | + IPushObRepository pushObRepository; | ||
| 52 | + @Autowired | ||
| 53 | + IAttachmentRepository attachmentRepository; | ||
| 54 | + @Autowired | ||
| 55 | + IUserConsignmentMappingRepository userConsignmentMappingRepository; | ||
| 39 | 56 | ||
| 40 | /** | 57 | /** |
| 41 | * @Author mt | 58 | * @Author mt |
| ... | @@ -194,4 +211,78 @@ public class ConsignmentUtil { | ... | @@ -194,4 +211,78 @@ public class ConsignmentUtil { |
| 194 | private boolean isShipperAccountMatch(String account1, String account2) { | 211 | private boolean isShipperAccountMatch(String account1, String account2) { |
| 195 | return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2); | 212 | return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2); |
| 196 | } | 213 | } |
| 214 | + | ||
| 215 | + /** | ||
| 216 | + * @Author mt | ||
| 217 | + * @Description 保存运单相关信息 | ||
| 218 | + * @Date 2024/11/19 | ||
| 219 | + * @param consignment | ||
| 220 | + * @param attachmentList | ||
| 221 | + * @param uploadRecord | ||
| 222 | + * @param user | ||
| 223 | + * @return void | ||
| 224 | + */ | ||
| 225 | + @Transactional(rollbackFor = Exception.class) | ||
| 226 | + public void submitInfo(Consignment consignment, | ||
| 227 | + List<Attachment> attachmentList, | ||
| 228 | + UploadRecord uploadRecord, | ||
| 229 | + User user) throws Exception{ | ||
| 230 | + if(Objects.nonNull(consignment) && Objects.nonNull(consignment.getId())){ | ||
| 231 | + try{ | ||
| 232 | + //增加行级锁 | ||
| 233 | + consignmentRepository.lockConsignmentRow(consignment.getId()); | ||
| 234 | + }catch(Exception ex){ | ||
| 235 | + responseUtils.fail(ResponseCode.MESSAGE_CODE_30017,ex); | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + /** | ||
| 239 | + * 保存或更新运单表 | ||
| 240 | + */ | ||
| 241 | + consignmentRepository.saveOrUpdate(consignment); | ||
| 242 | + //设置上传记录表运单ID | ||
| 243 | + uploadRecord.setConsignmentId(consignment.getId()); | ||
| 244 | + /** | ||
| 245 | + * 保存上传记录表 | ||
| 246 | + */ | ||
| 247 | + uploadRecordRepository.saveOrUpdate(uploadRecord); | ||
| 248 | + //设置附件表运单id,上传记录表id | ||
| 249 | + Optional.ofNullable(attachmentList).orElse(new ArrayList<>()).stream().filter(Objects::nonNull).forEach(p->{ | ||
| 250 | + p.setBizId(consignment.getId()); | ||
| 251 | + p.setUploadRecordId(uploadRecord.getId()); | ||
| 252 | + }); | ||
| 253 | + /** | ||
| 254 | + * 保存附件表信息 | ||
| 255 | + */ | ||
| 256 | + attachmentRepository.saveOrUpdateAll(attachmentList); | ||
| 257 | + //用户uuid与运单uuid不一致,则需要添加用户运单中间表信息 | ||
| 258 | + if(!user.getUserUuid().equals(consignment.getUserUuid())){ | ||
| 259 | + /** | ||
| 260 | + * 查找用户与运单关联信息 | ||
| 261 | + */ | ||
| 262 | + UserConsignmentMapping userConsignmentMapping = userConsignmentMappingRepository.findByUserIdConsignmentId(user.getId(),consignment.getId()); | ||
| 263 | + if(Objects.isNull(userConsignmentMapping)){ | ||
| 264 | + /** | ||
| 265 | + * 初始化插入预清关文件推送任务日志 | ||
| 266 | + */ | ||
| 267 | + userConsignmentMapping = userConsignmentMappingUtil.initUserConsignmentMapping(user.getId(),consignment.getId()); | ||
| 268 | + /** | ||
| 269 | + * 初始化插入预清关文件推送任务日志 | ||
| 270 | + */ | ||
| 271 | + userConsignmentMappingRepository.saveOrUpdate(userConsignmentMapping); | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + /** | ||
| 275 | + * 初始化插入预清关文件推送日志,mt添加 | ||
| 276 | + */ | ||
| 277 | + PushOb pushOb = pushObUtil.initPushOb(consignment,uploadRecord,user); | ||
| 278 | + /** | ||
| 279 | + * 初始化插入提醒发件人邮件日志 | ||
| 280 | + */ | ||
| 281 | + emailService.saveNotificationEmail(consignment,user); | ||
| 282 | + | ||
| 283 | + /** | ||
| 284 | + * 推送进口文件主表 | ||
| 285 | + */ | ||
| 286 | + pushObRepository.saveOrUpdate(pushOb); | ||
| 287 | + } | ||
| 197 | } | 288 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -46,3 +46,4 @@ business_exception_30013=文件名为:{0},上传失败,请检查后重试 | ... | @@ -46,3 +46,4 @@ business_exception_30013=文件名为:{0},上传失败,请检查后重试 |
| 46 | business_exception_30014=运单信息加载失败,请稍后重试 | 46 | business_exception_30014=运单信息加载失败,请稍后重试 |
| 47 | business_success_30015=上传成功 | 47 | business_success_30015=上传成功 |
| 48 | business_exception_30016=运单提交失败 | 48 | business_exception_30016=运单提交失败 |
| 49 | +business_exception_30017=运单提交失败,该运单正在被其他用户操作,请稍后重试 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -36,8 +36,8 @@ business_exception_30003={0}不正确,请重新输入 | ... | @@ -36,8 +36,8 @@ business_exception_30003={0}不正确,请重新输入 |
| 36 | business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. | 36 | business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. |
| 37 | business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. | 37 | business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation. |
| 38 | business_exception_30006=附件上传不符合标准 | 38 | business_exception_30006=附件上传不符合标准 |
| 39 | -business_exception_30007=所有上传文件数量不超过50个文件 | 39 | +business_exception_30007=所有上传文件数量不超过{}个文件 |
| 40 | -business_exception_30008=所有上传文件总大小不超过50M | 40 | +business_exception_30008=所有上传文件总大小不超过{}M |
| 41 | business_exception_30009=运单或发票未上传 | 41 | business_exception_30009=运单或发票未上传 |
| 42 | business_exception_30010=文件类型不在:运单、发票、箱单、其他 | 42 | business_exception_30010=文件类型不在:运单、发票、箱单、其他 |
| 43 | business_exception_30011=该运单已被其他人创建,不可以重复创建 | 43 | business_exception_30011=该运单已被其他人创建,不可以重复创建 |
| ... | @@ -46,3 +46,4 @@ business_exception_30013=文件名为:{0},上传失败,请检查后重试 | ... | @@ -46,3 +46,4 @@ business_exception_30013=文件名为:{0},上传失败,请检查后重试 |
| 46 | business_exception_30014=运单信息加载失败,请稍后重试 | 46 | business_exception_30014=运单信息加载失败,请稍后重试 |
| 47 | business_success_30015=上传成功 | 47 | business_success_30015=上传成功 |
| 48 | business_exception_30016=运单提交失败 | 48 | business_exception_30016=运单提交失败 |
| 49 | +business_exception_30017=运单提交失败,该运单正在被其他用户操作,请稍后重试 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -56,7 +56,10 @@ public class Dm501ServiceImpl extends BaseService implements IDm501Service { | ... | @@ -56,7 +56,10 @@ public class Dm501ServiceImpl extends BaseService implements IDm501Service { |
| 56 | CeInfo ceInfo = dm501Util.generateCeInfo(consignment501,kafKaTemporaryStorage.getSendTime()); | 56 | CeInfo ceInfo = dm501Util.generateCeInfo(consignment501,kafKaTemporaryStorage.getSendTime()); |
| 57 | //ce数据解析正常,进行后续操作 | 57 | //ce数据解析正常,进行后续操作 |
| 58 | Consignment consignment = dm501Util.generateConsignment(ceInfo); | 58 | Consignment consignment = dm501Util.generateConsignment(ceInfo); |
| 59 | - this.saveCeInfoAndConsignment(ceInfo,consignment); | 59 | + /** |
| 60 | + * 保存ce信息、以及运单表信息 | ||
| 61 | + */ | ||
| 62 | + dm501Util.saveCeInfoAndConsignment(ceInfo,consignment); | ||
| 60 | } | 63 | } |
| 61 | }catch(Exception ex){ | 64 | }catch(Exception ex){ |
| 62 | log.error("DM501消息处理异常:{}", ex.getMessage(),ex); | 65 | log.error("DM501消息处理异常:{}", ex.getMessage(),ex); |
| ... | @@ -65,19 +68,4 @@ public class Dm501ServiceImpl extends BaseService implements IDm501Service { | ... | @@ -65,19 +68,4 @@ public class Dm501ServiceImpl extends BaseService implements IDm501Service { |
| 65 | return processResults; | 68 | return processResults; |
| 66 | } | 69 | } |
| 67 | 70 | ||
| 68 | - /** | ||
| 69 | - * @Author mt | ||
| 70 | - * @Description 保存ce信息、以及运单表信息 | ||
| 71 | - * @Date 2024/11/1 | ||
| 72 | - * @param ceInfo | ||
| 73 | - * @param consignment | ||
| 74 | - * @return void | ||
| 75 | - */ | ||
| 76 | - @Transactional(rollbackFor = Exception.class) | ||
| 77 | - public void saveCeInfoAndConsignment(CeInfo ceInfo, Consignment consignment){ | ||
| 78 | - ceInfoRepository.save(ceInfo); | ||
| 79 | - //绑定ceInfo表Id | ||
| 80 | - consignment.setCeInfoId(ceInfo.getId()); | ||
| 81 | - consignmentRepository.save(consignment); | ||
| 82 | - } | ||
| 83 | } | 71 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -10,12 +10,14 @@ import com.fedex.connect.common.model.sys.User; | ... | @@ -10,12 +10,14 @@ import com.fedex.connect.common.model.sys.User; |
| 10 | import com.fedex.connect.kafka.constants.Constant; | 10 | import com.fedex.connect.kafka.constants.Constant; |
| 11 | import com.fedex.connect.kafka.data.dto.dm.dm501.Dm501ConAddresses; | 11 | import com.fedex.connect.kafka.data.dto.dm.dm501.Dm501ConAddresses; |
| 12 | import com.fedex.connect.kafka.data.dto.dm.dm501.Dm501Consignments; | 12 | import com.fedex.connect.kafka.data.dto.dm.dm501.Dm501Consignments; |
| 13 | +import com.fedex.connect.kafka.repository.repo.ICeInfoRepository; | ||
| 13 | import com.fedex.connect.kafka.repository.repo.IConsignmentRepository; | 14 | import com.fedex.connect.kafka.repository.repo.IConsignmentRepository; |
| 14 | import com.fedex.connect.kafka.repository.repo.IUserRepository; | 15 | import com.fedex.connect.kafka.repository.repo.IUserRepository; |
| 15 | import org.apache.commons.lang3.StringUtils; | 16 | import org.apache.commons.lang3.StringUtils; |
| 16 | import org.springframework.beans.BeanUtils; | 17 | import org.springframework.beans.BeanUtils; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Component; | 19 | import org.springframework.stereotype.Component; |
| 20 | +import org.springframework.transaction.annotation.Transactional; | ||
| 19 | 21 | ||
| 20 | import java.math.BigDecimal; | 22 | import java.math.BigDecimal; |
| 21 | import java.util.Date; | 23 | import java.util.Date; |
| ... | @@ -30,6 +32,8 @@ public class Dm501Util { | ... | @@ -30,6 +32,8 @@ public class Dm501Util { |
| 30 | @Autowired | 32 | @Autowired |
| 31 | IConsignmentRepository consignmentRepository; | 33 | IConsignmentRepository consignmentRepository; |
| 32 | @Autowired | 34 | @Autowired |
| 35 | + ICeInfoRepository ceInfoRepository; | ||
| 36 | + @Autowired | ||
| 33 | IUserRepository userRepository; | 37 | IUserRepository userRepository; |
| 34 | 38 | ||
| 35 | /** | 39 | /** |
| ... | @@ -283,4 +287,20 @@ public class Dm501Util { | ... | @@ -283,4 +287,20 @@ public class Dm501Util { |
| 283 | } | 287 | } |
| 284 | return address; | 288 | return address; |
| 285 | } | 289 | } |
| 290 | + | ||
| 291 | + /** | ||
| 292 | + * @Author mt | ||
| 293 | + * @Description 保存ce信息、以及运单表信息 | ||
| 294 | + * @Date 2024/11/1 | ||
| 295 | + * @param ceInfo | ||
| 296 | + * @param consignment | ||
| 297 | + * @return void | ||
| 298 | + */ | ||
| 299 | + @Transactional(rollbackFor = Exception.class) | ||
| 300 | + public void saveCeInfoAndConsignment(CeInfo ceInfo, Consignment consignment){ | ||
| 301 | + ceInfoRepository.save(ceInfo); | ||
| 302 | + //绑定ceInfo表Id | ||
| 303 | + consignment.setCeInfoId(ceInfo.getId()); | ||
| 304 | + consignmentRepository.save(consignment); | ||
| 305 | + } | ||
| 286 | } | 306 | } | ... | ... |
-
Please register or login to post a comment