乐其工作记录

工作问题记录

安装nacos出现问题

/nacos/conf/cluster.conf (No such file or directory)启动日志报错。查询发现是以集群的方式启动了,改成以单机的方式启动。

1
sh startup.sh -m standalone

为什么要加@Transactional(rollbackFor = Exception.class)

1
这种设置是因为Spring的默认回滚RuntimeException,如果想要回滚Exception时,要设置@Transactional(rollbackFor = Exception.class),而且Exception还要抛出。

产品运营反馈问题

某商品库存被单据占有无法分配,提供barcode进行排查。

  • 1.根据barcode查到商品id,观察qty_total和qty_available判断可能是哪个order_goods_id

    1
    2
    select * from wms.product_location pl inner join wms.product p on pl.product_id=p.product_id 
    where p.barcode='pxp001'
  • 2.查到order_goods_id

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    select count(1), order_goods_id from (
    (select order_goods_id
    from wms.order_goods where order_id in (select distinct op.order_id from wms.product_location_detail pld
    inner join wms.task t on pld.task_id = t.task_id
    inner join wms.order_process op on t.batch_pick_id = op.batch_pick_id
    where pld.pl_id in (
    select pl.pl_id from wms.product_location pl
    inner join wms.location l on pl.location_id = l.location_id
    where product_id = 73172 and l.location_type = 'TRANSIT_LOCATION' and pl.physical_warehouse_id=1164 and pl.customer_id=1087)) and product_id = 73172)
    union all
    (select og.order_goods_id from wms.order_goods og
    inner join wms.product_location_detail pld on og.order_goods_id = pld.order_goods_id
    inner join wms.product_location pl on pld.pl_id = pl.pl_id
    inner join wms.location l on pl.location_id = l.location_id
    where og.product_id = 73172 and l.location_type = 'TRANSIT_LOCATION' and pl.physical_warehouse_id=1164 and pl.customer_id=1087) ) as ob
    group by order_goods_id
    having count(1) = 1;
  • 3.排查该订单的订单轨迹

    1
    2
    3
    select * from wms.user_action_order where order_id=4381294
    select * from wms.order_goods where order_id=2351367
    select * from wms.order_inventory_return where order_id=2351367

@RequestParam接收不到前端参数

application/x-www-form-urlencoded是以表格的形式请求,而application/json则将数据序列化后才进行传递,如果使用了@RequestParam会在Content里面查找对应的数据,结果因为传递的数据已经被序列化所以不能找到,所以当要使用@RequestParam注解时候应当使用application/x-www-form-urlencoded,而如果想要使用application/json则应当使用@RequestBody获取被序列化的参数。

git cherry-pick

在公共分支上不小心提交了开发分支的代码,可以查看当前提交的id,从开发分支上cherry-pick这个提交。

1
$ git cherry-pick <commitHash>

java.lang.ClassNotFoundException:

集成支付宝时候,启动时候发现报了这个错误,java.lang.NoClassDefFoundError: com/alipay/api/AlipayApiException

百思不得其解,lib已经导入了,然后发现在tomcat的war包里面的lib没有阿里爸爸的包,用的是idea工具,因为已经添加了alipay的jar包所以重新模拟下。右键打开modul设置,Arifacts—>选择自己项目—>lib—>Add Copy of–>Libray Files 选择alipay.jar包即可。