Authored by mali

Merge branch 'dev_NFC' into test6.9.9

... ... @@ -9,7 +9,7 @@ import java.util.List;
public interface IdentifyRecordsMapper {
IdentifyRecord selectByTagAndNfcId(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid);
int updateOwner(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("owner") Integer owner);
int updateOwner(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("owner") Integer owner, @Param("newOrderCode")Long newOrderCode);
int updateAllowPop(@Param("tagId") String tagId, @Param("nfcUid") String nfcUid, @Param("allowPop") Integer allowPop);
... ...
... ... @@ -26,7 +26,10 @@
</select>
<update id="updateOwner">
update identify_records set owner=#{owner}, allow_pop=1
update identify_records set owner=#{owner}, allow_pop=1
<if test="newOrderCode != null" >
, last_order_code = #{newOrderCode,jdbcType=BIGINT}
</if>
where tag_id = #{tagId,jdbcType=VARCHAR}
<if test="nfcUid != null" >
and nfc_uid = #{nfcUid,jdbcType=VARCHAR}
... ... @@ -42,6 +45,6 @@
</update>
<select id="selectByOrderCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from identify_records where order_code = #{orderCode} limit 1
from identify_records where order_code = #{orderCode} or last_order_code = #{orderCode} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -404,7 +404,7 @@ public class DepositServiceImpl implements DepositService {
sd.setNewSkup(0);
LOGGER.info("new owner record is sd", sd);
storageDepositMapper.insert(sd);
autoTransfer(orderCode, newUid);
autoTransfer(orderCode, newUid, buyOrderCode);
clearCache(uid, sd.getProductId(), sd.getStorageId());
clearCache(newUid, sd.getProductId(), sd.getStorageId());
return true;
... ... @@ -518,9 +518,9 @@ public class DepositServiceImpl implements DepositService {
.build();
}
private void autoTransfer(Long orderCode, Integer toUid) {
private void autoTransfer(Long orderCode, Integer toUid, Long buyOrderCode) {
try {
ApiResponse resp = ufoServiceCaller.call("ufo.product.autoTransfer", ApiResponse.class, orderCode, toUid);
ApiResponse resp = ufoServiceCaller.call("ufo.product.autoTransfer", ApiResponse.class, orderCode, toUid, buyOrderCode);
LOGGER.info("物权转移接口调用结果:{}", resp);
} catch (Exception e) {
LOGGER.error("物权转移接口调用失败!", e);
... ...
... ... @@ -175,10 +175,11 @@ public class ProductIdentifyController {
@RequestMapping(params = "method=ufo.product.autoTransfer")
public ApiResponse autoTransfer(@RequestParam(value = "orderCode", required = false) Long orderCode,
@RequestParam(value = "toUid",required = false) Integer toUid) throws GatewayException {
@RequestParam(value = "toUid",required = false) Integer toUid,
@RequestParam(value = "buyOrderCode",required = false) Long buyOrderCode) throws GatewayException {
try{
logger.info("method autoTransfer begin! orderCode={}, toUid is{}", orderCode, toUid);
productIdentifyHandle.autoTransfer(orderCode, toUid);
logger.info("method autoTransfer begin! orderCode={}, toUid is{}, buyOrderCode is {}", orderCode, toUid, buyOrderCode);
productIdentifyHandle.autoTransfer(orderCode, toUid, buyOrderCode);
logger.info("method autoTransfer end! orderCode={}, toUid is{}", orderCode, toUid);
return new ApiResponse.ApiResponseBuilder().code(200).build();
}catch (Exception e){
... ...
... ... @@ -23,5 +23,5 @@ public interface ProductIdentifyService {
ProductIdentifyResp queryIdentifyInfoForPlatform(String tagId, String nfcUid) throws GatewayException;
void autoTransfer(Long orderCode, Integer toUid); // 自动转移物权所属
void autoTransfer(Long orderCode, Integer toUid, Long buyerOrderCode); // 自动转移物权所属
}
... ...
... ... @@ -23,8 +23,8 @@ public class ProductIdentifyHandle implements ApplicationContextAware{
ApplicationContext applicationContext;
public void autoTransfer(Long orderCode, Integer toUid) {
ProductIdentifyVo build = ProductIdentifyVo.builder().orderCode(orderCode).toUid(toUid).build();
public void autoTransfer(Long orderCode, Integer toUid, Long buyOrderCode) {
ProductIdentifyVo build = ProductIdentifyVo.builder().orderCode(orderCode).toUid(toUid).buyOrderCode(buyOrderCode).build();
LOGGER.info("ProductIdentifyHandle.autoTransfer run, build is {}", build);
... ...
... ... @@ -496,7 +496,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
addTransferRecord(tagId, nfcUid, histroy.getFromUid(), history.getToUid());
//更新identify_record
result = identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
result = identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid, null);
setFinalTimeToEnd(inboxId, identifyRecord.getOwner());
//发信息
... ... @@ -1001,7 +1001,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
* @return
* @throws 不能抛异常,影响订单流程
*/
public void autoTransfer(Long orderCode, Integer toUid) {
public void autoTransfer(Long orderCode, Integer toUid, Long buyerOrderCode) {
IdentifyRecord identifyRecord = selectByOrderCode(orderCode);
logger.info("result autoTransfer of selectByOrderCode is identifyRecord {}, orderCode is {}, toUid is {}", identifyRecord, orderCode, toUid);
... ... @@ -1015,7 +1015,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
addTransferRecord(tagId, nfcUid, String.valueOf(identifyRecord.getOwner()), String.valueOf(toUid)); //新增转移记录
//更新identify_record
identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid);
identifyRecordsMapper.updateOwner(tagId, nfcUid, toUid, buyerOrderCode);
//发信息
messageFacade.ownerPass(String.valueOf(toUid), identifyRecord.getOrderCode());
... ...
... ... @@ -24,7 +24,7 @@ public class ProductIdentifyListener implements ApplicationListener<ProductIdent
ProductIdentifyVo record = (ProductIdentifyVo)event.getSource();
LOGGER.info("ProductIdentifyListener begin, ProductIdentifyVo is {}", record);
productIdentifyService.autoTransfer(record.getOrderCode(), record.getToUid());
productIdentifyService.autoTransfer(record.getOrderCode(), record.getToUid(), record.getBuyOrderCode());
LOGGER.info("ProductIdentifyListener end , ProductIdentifyVo is {} ", record);
}
... ...