Authored by mali

Merge branch 'dev_NFC' into test6.9.9

@@ -9,7 +9,7 @@ import java.util.List; @@ -9,7 +9,7 @@ import java.util.List;
9 public interface IdentifyRecordsMapper { 9 public interface IdentifyRecordsMapper {
10 IdentifyRecord selectByTagAndNfcId(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid); 10 IdentifyRecord selectByTagAndNfcId(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid);
11 11
12 - int updateOwner(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("owner") Integer owner); 12 + int updateOwner(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("owner") Integer owner, @Param("newOrderCode")Long newOrderCode);
13 13
14 int updateAllowPop(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("allowPop") Integer allowPop); 14 int updateAllowPop(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("allowPop") Integer allowPop);
15 15
@@ -27,6 +27,9 @@ @@ -27,6 +27,9 @@
27 27
28 <update id="updateOwner"> 28 <update id="updateOwner">
29 update identify_records set owner=#{owner}, allow_pop=1 29 update identify_records set owner=#{owner}, allow_pop=1
  30 + <if test="newOrderCode != null" >
  31 + , last_order_code = #{newOrderCode,jdbcType=BIGINT}
  32 + </if>
30 where tag_id = #{tagId,jdbcType=VARCHAR} 33 where tag_id = #{tagId,jdbcType=VARCHAR}
31 <if test="nfcUid != null" > 34 <if test="nfcUid != null" >
32 and nfc_uid = #{nfcUid,jdbcType=VARCHAR} 35 and nfc_uid = #{nfcUid,jdbcType=VARCHAR}
@@ -42,6 +45,6 @@ @@ -42,6 +45,6 @@
42 </update> 45 </update>
43 <select id="selectByOrderCode" resultMap="BaseResultMap"> 46 <select id="selectByOrderCode" resultMap="BaseResultMap">
44 select <include refid="Base_Column_List" /> 47 select <include refid="Base_Column_List" />
45 - from identify_records where order_code = #{orderCode} limit 1 48 + from identify_records where order_code = #{orderCode} or last_order_code = #{orderCode} limit 1
46 </select> 49 </select>
47 </mapper> 50 </mapper>
@@ -404,7 +404,7 @@ public class DepositServiceImpl implements DepositService { @@ -404,7 +404,7 @@ public class DepositServiceImpl implements DepositService {
404 sd.setNewSkup(0); 404 sd.setNewSkup(0);
405 LOGGER.info("new owner record is sd", sd); 405 LOGGER.info("new owner record is sd", sd);
406 storageDepositMapper.insert(sd); 406 storageDepositMapper.insert(sd);
407 - autoTransfer(orderCode, newUid); 407 + autoTransfer(orderCode, newUid, buyOrderCode);
408 clearCache(uid, sd.getProductId(), sd.getStorageId()); 408 clearCache(uid, sd.getProductId(), sd.getStorageId());
409 clearCache(newUid, sd.getProductId(), sd.getStorageId()); 409 clearCache(newUid, sd.getProductId(), sd.getStorageId());
410 return true; 410 return true;
@@ -518,9 +518,9 @@ public class DepositServiceImpl implements DepositService { @@ -518,9 +518,9 @@ public class DepositServiceImpl implements DepositService {
518 .build(); 518 .build();
519 } 519 }
520 520
521 - private void autoTransfer(Long orderCode, Integer toUid) { 521 + private void autoTransfer(Long orderCode, Integer toUid, Long buyOrderCode) {
522 try { 522 try {
523 - ApiResponse resp = ufoServiceCaller.call("ufo.product.autoTransfer", ApiResponse.class, orderCode, toUid); 523 + ApiResponse resp = ufoServiceCaller.call("ufo.product.autoTransfer", ApiResponse.class, orderCode, toUid, buyOrderCode);
524 LOGGER.info("物权转移接口调用结果:{}", resp); 524 LOGGER.info("物权转移接口调用结果:{}", resp);
525 } catch (Exception e) { 525 } catch (Exception e) {
526 LOGGER.error("物权转移接口调用失败!", e); 526 LOGGER.error("物权转移接口调用失败!", e);
@@ -175,10 +175,11 @@ public class ProductIdentifyController { @@ -175,10 +175,11 @@ public class ProductIdentifyController {
175 175
176 @RequestMapping(params = "method=ufo.product.autoTransfer") 176 @RequestMapping(params = "method=ufo.product.autoTransfer")
177 public ApiResponse autoTransfer(@RequestParam(value = "orderCode", required = false) Long orderCode, 177 public ApiResponse autoTransfer(@RequestParam(value = "orderCode", required = false) Long orderCode,
178 - @RequestParam(value = "toUid",required = false) Integer toUid) throws GatewayException { 178 + @RequestParam(value = "toUid",required = false) Integer toUid,
  179 + @RequestParam(value = "buyOrderCode",required = false) Long buyOrderCode) throws GatewayException {
179 try{ 180 try{
180 - logger.info("method autoTransfer begin! orderCode={}, toUid is{}", orderCode, toUid);  
181 - productIdentifyHandle.autoTransfer(orderCode, toUid); 181 + logger.info("method autoTransfer begin! orderCode={}, toUid is{}, buyOrderCode is {}", orderCode, toUid, buyOrderCode);
  182 + productIdentifyHandle.autoTransfer(orderCode, toUid, buyOrderCode);
182 logger.info("method autoTransfer end! orderCode={}, toUid is{}", orderCode, toUid); 183 logger.info("method autoTransfer end! orderCode={}, toUid is{}", orderCode, toUid);
183 return new ApiResponse.ApiResponseBuilder().code(200).build(); 184 return new ApiResponse.ApiResponseBuilder().code(200).build();
184 }catch (Exception e){ 185 }catch (Exception e){
@@ -23,5 +23,5 @@ public interface ProductIdentifyService { @@ -23,5 +23,5 @@ public interface ProductIdentifyService {
23 23
24 ProductIdentifyResp queryIdentifyInfoForPlatform(String tagId, String nfcUid) throws GatewayException; 24 ProductIdentifyResp queryIdentifyInfoForPlatform(String tagId, String nfcUid) throws GatewayException;
25 25
26 - void autoTransfer(Long orderCode, Integer toUid); // 自动转移物权所属 26 + void autoTransfer(Long orderCode, Integer toUid, Long buyerOrderCode); // 自动转移物权所属
27 } 27 }
@@ -23,8 +23,8 @@ public class ProductIdentifyHandle implements ApplicationContextAware{ @@ -23,8 +23,8 @@ public class ProductIdentifyHandle implements ApplicationContextAware{
23 23
24 ApplicationContext applicationContext; 24 ApplicationContext applicationContext;
25 25
26 - public void autoTransfer(Long orderCode, Integer toUid) {  
27 - ProductIdentifyVo build = ProductIdentifyVo.builder().orderCode(orderCode).toUid(toUid).build(); 26 + public void autoTransfer(Long orderCode, Integer toUid, Long buyOrderCode) {
  27 + ProductIdentifyVo build = ProductIdentifyVo.builder().orderCode(orderCode).toUid(toUid).buyOrderCode(buyOrderCode).build();
28 28
29 LOGGER.info("ProductIdentifyHandle.autoTransfer run, build is {}", build); 29 LOGGER.info("ProductIdentifyHandle.autoTransfer run, build is {}", build);
30 30
@@ -496,7 +496,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ @@ -496,7 +496,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
496 addTransferRecord(tagId, nfcUid, histroy.getFromUid(), history.getToUid()); 496 addTransferRecord(tagId, nfcUid, histroy.getFromUid(), history.getToUid());
497 497
498 //更新identify_record 498 //更新identify_record
499 - result = identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid); 499 + result = identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid, null);
500 setFinalTimeToEnd(inboxId, identifyRecord.getOwner()); 500 setFinalTimeToEnd(inboxId, identifyRecord.getOwner());
501 501
502 //发信息 502 //发信息
@@ -1001,7 +1001,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ @@ -1001,7 +1001,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
1001 * @return 1001 * @return
1002 * @throws 不能抛异常,影响订单流程 1002 * @throws 不能抛异常,影响订单流程
1003 */ 1003 */
1004 - public void autoTransfer(Long orderCode, Integer toUid) { 1004 + public void autoTransfer(Long orderCode, Integer toUid, Long buyerOrderCode) {
1005 IdentifyRecord identifyRecord = selectByOrderCode(orderCode); 1005 IdentifyRecord identifyRecord = selectByOrderCode(orderCode);
1006 1006
1007 logger.info("result autoTransfer of selectByOrderCode is identifyRecord {}, orderCode is {}, toUid is {}", identifyRecord, orderCode, toUid); 1007 logger.info("result autoTransfer of selectByOrderCode is identifyRecord {}, orderCode is {}, toUid is {}", identifyRecord, orderCode, toUid);
@@ -1015,7 +1015,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ @@ -1015,7 +1015,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
1015 addTransferRecord(tagId, nfcUid, String.valueOf(identifyRecord.getOwner()), String.valueOf(toUid)); //新增转移记录 1015 addTransferRecord(tagId, nfcUid, String.valueOf(identifyRecord.getOwner()), String.valueOf(toUid)); //新增转移记录
1016 1016
1017 //更新identify_record 1017 //更新identify_record
1018 - identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid); 1018 + identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid, buyerOrderCode);
1019 1019
1020 //发信息 1020 //发信息
1021 messageFacade.ownerPass(String.valueOf(toUid), identifyRecord.getOrderCode()); 1021 messageFacade.ownerPass(String.valueOf(toUid), identifyRecord.getOrderCode());
@@ -24,7 +24,7 @@ public class ProductIdentifyListener implements ApplicationListener<ProductIdent @@ -24,7 +24,7 @@ public class ProductIdentifyListener implements ApplicationListener<ProductIdent
24 ProductIdentifyVo record = (ProductIdentifyVo)event.getSource(); 24 ProductIdentifyVo record = (ProductIdentifyVo)event.getSource();
25 LOGGER.info("ProductIdentifyListener begin, ProductIdentifyVo is {}", record); 25 LOGGER.info("ProductIdentifyListener begin, ProductIdentifyVo is {}", record);
26 26
27 - productIdentifyService.autoTransfer(record.getOrderCode(), record.getToUid()); 27 + productIdentifyService.autoTransfer(record.getOrderCode(), record.getToUid(), record.getBuyOrderCode());
28 28
29 LOGGER.info("ProductIdentifyListener end , ProductIdentifyVo is {} ", record); 29 LOGGER.info("ProductIdentifyListener end , ProductIdentifyVo is {} ", record);
30 } 30 }