fhx
2024-09-02 3824d0fdba2c522d45e58a7b437e9bb0ed143162
1.新增结账更新治疗单关联用户项目逻辑
1个文件已修改
25 ■■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderPayMoneyUtil.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderPayMoneyUtil.java
@@ -2000,6 +2000,8 @@
            }
            setUserProjectItem(ordersTotal, userProject, userProjectItem, date, vo,orderItemSon,1);
            commonService.insert(UserProjectItemMapper.class,userProjectItem);//新增用户项目子项记录
            //结账更新治疗单项目关联用户项目
            updateTreatProjectAssocUserProjectItem(commonService, userProjectItem, ordersTotal.getId(), vo.getId(), orderItemSon == null ? null : orderItemSon.getId());
        }else{
            map.put("commonId",vo.getCommonId());
            UserProject userProject=commonService.selectOne(UserProjectMapper.class,sqlSentence);
@@ -2030,6 +2032,9 @@
            }
            setUserProjectItem(ordersTotal, userProject, userProjectItem, date, vo,orderItemSon,0);
            commonService.insert(UserProjectItemMapper.class,userProjectItem);//新增用户项目子项记录
            //结账更新治疗单项目关联用户项目
            updateTreatProjectAssocUserProjectItem(commonService, userProjectItem, ordersTotal.getId(), vo.getId(), orderItemSon == null ? null : orderItemSon.getId());
        }
    }
@@ -2388,4 +2393,24 @@
        }
        return stringBuffer.toString();
    }
    /** 结账更新治疗单项目关联用户项目 */
    private static void updateTreatProjectAssocUserProjectItem(CommonService commonService, UserProjectItem userProjectItem, String orderId, String orderItemId, String orderItemSonId){
        if(userProjectItem == null || StringUtils.isEmpty(userProjectItem.getId())){
            return;
        }
        SqlSentence sqlSentence = new SqlSentence();
        Map<String, Object> values = new HashMap<>();
        sqlSentence.setM(values);
        values.put("userProjectItemId", userProjectItem.getId());
        values.put("orderId", orderId);
        values.put("orderItemId", orderItemId);
        if(StringUtils.isEmpty(orderItemSonId)){
            sqlSentence.setSqlSentence(" userProjectItemId = #{m.userProjectItemId} where orderId = #{m.orderId} and orderItemId = #{m.orderItemId} and userProjectItemId is null ");
        }else{
            values.put("orderItemSonId", orderItemSonId);
            sqlSentence.setSqlSentence(" userProjectItemId = #{m.userProjectItemId} where orderId = #{m.orderId} and orderItemId = #{m.orderItemId} and orderItemSonId = #{m.orderItemSonId} and userProjectItemId is null ");
        }
        commonService.updateWhere(TreatProjectMapper.class, sqlSentence);
    }
}